DFT-EFE
 
Loading...
Searching...
No Matches
FEBasisManager.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2021. *
3 * The Regents of the University of Michigan and DFT-EFE developers. *
4 * *
5 * This file is part of the DFT-EFE code. *
6 * *
7 * DFT-EFE is free software: you can redistribute it and/or modify *
8 * it under the terms of the Lesser GNU General Public License as *
9 * published by the Free Software Foundation, either version 3 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * DFT-EFE is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15 * See the Lesser GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License at the top level of DFT-EFE distribution. If not, see *
19 * <https://www.gnu.org/licenses/>. *
20 ******************************************************************************/
21
22/*
23 * @author Bikash Kanungo, Avirup Sircar
24 */
25
26#ifndef dftefeFEBasisManager_h
27#define dftefeFEBasisManager_h
28
29#include <basis/BasisManager.h>
31namespace dftefe
32{
33 namespace basis
34 {
39 template <typename ValueTypeBasisCoeff,
40 typename ValueTypeBasisData,
42 size_type dim>
43 class FEBasisManager : public BasisManager<ValueTypeBasisCoeff, memorySpace>
44 {
45 //
46 // typedefs
47 //
48 public:
52 typename BasisManager<ValueTypeBasisCoeff,
53 memorySpace>::GlobalSizeTypeVector;
54 using LocalIndexIter = typename SizeTypeVector::iterator;
55 using const_LocalIndexIter = typename SizeTypeVector::const_iterator;
56 using GlobalIndexIter = typename GlobalSizeTypeVector::iterator;
58 typename GlobalSizeTypeVector::const_iterator;
59
60 public:
61 FEBasisManager(std::shared_ptr<const BasisDofHandler> basisDofHandler,
62 std::shared_ptr<const utils::ScalarSpatialFunctionReal>
63 dirichletBoundaryCondition = nullptr);
64
65 void
66 reinit(std::shared_ptr<const BasisDofHandler> basisDofHandler,
67 std::shared_ptr<const utils::ScalarSpatialFunctionReal>
68 dirichletBoundaryCondition);
69
70 ~FEBasisManager() = default;
71
72 const BasisDofHandler &
73 getBasisDofHandler() const override;
74
76 getConstraints() const override;
77
78 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
79 getMPIPatternP2P() const override;
80
81 std::vector<std::pair<global_size_type, global_size_type>>
82 getLocallyOwnedRanges() const override;
83
85 getGhostIndices() const override;
86
88 nLocal() const override;
89
91 nLocallyOwned() const override;
92
94 nGhost() const override;
95
96 std::pair<bool, size_type>
97 inLocallyOwnedRanges(const global_size_type globalId) const override;
98
99 std::pair<bool, size_type>
100 isGhostEntry(const global_size_type ghostId) const override;
101
103 globalToLocalIndex(const global_size_type globalId) const override;
104
106 localToGlobalIndex(const size_type localId) const override;
107
108 void
109 getBasisCenters(const size_type localId,
110 dftefe::utils::Point &basisCenter) const override;
111
112 //
113 // FE specific functions
114 //
115
117 nLocallyOwnedCells() const;
118
120 nLocallyOwnedCellDofs(const size_type cellId) const;
121
124
127
130
132 locallyOwnedCellGlobalDofIdsEnd(const size_type cellId) const;
133
136
139
141 locallyOwnedCellLocalDofIdsEnd(const size_type cellId) const;
142
143 void
144 getCellDofsLocalIds(const size_type cellId,
145 std::vector<size_type> &vecLocalNodeId) const;
146
147 private:
148 std::shared_ptr<
151 std::shared_ptr<const ConstraintsLocal<ValueTypeBasisCoeff, memorySpace>>
153 std::vector<std::pair<global_size_type, global_size_type>>
155 std::vector<size_type> d_locallyOwnedCellStartIds;
157 std::vector<size_type> d_numLocallyOwnedCellDofs;
158
159 // constraints dependent data
160 std::shared_ptr<GlobalSizeTypeVector> d_ghostIndices;
161 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
163 std::shared_ptr<SizeTypeVector> d_locallyOwnedCellLocalIndices;
164 std::map<global_size_type, utils::Point> d_supportPoints;
165 };
166
167 } // end of namespace basis
168} // end of namespace dftefe
170#endif // dftefeFEBasisManager_h
Definition: BasisDofHandler.h:41
An abstract class to encapsulate the partitioning of a basis across multiple processors.
Definition: BasisManager.h:54
Definition: ConstraintsLocal.h:43
Definition: FEBasisDofHandler.h:57
An abstract class to encapsulate the partitioning of a finite element basis across multiple processor...
Definition: FEBasisManager.h:44
GlobalSizeTypeVector d_locallyOwnedCellGlobalIndices
Definition: FEBasisManager.h:156
const GlobalSizeTypeVector & getGhostIndices() const override
Definition: FEBasisManager.t.cpp:440
typename GlobalSizeTypeVector::const_iterator const_GlobalIndexIter
Definition: FEBasisManager.h:58
const_LocalIndexIter locallyOwnedCellLocalDofIdsEnd(const size_type cellId) const
Definition: FEBasisManager.t.cpp:588
size_type globalToLocalIndex(const global_size_type globalId) const override
Definition: FEBasisManager.t.cpp:473
size_type nCumulativeLocallyOwnedCellDofs() const
Definition: FEBasisManager.t.cpp:410
std::vector< size_type > d_locallyOwnedCellStartIds
Definition: FEBasisManager.h:155
std::shared_ptr< const FEBasisDofHandler< ValueTypeBasisCoeff, memorySpace, dim > > d_feBDH
Definition: FEBasisManager.h:150
std::shared_ptr< const ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > > d_constraintsLocal
Definition: FEBasisManager.h:152
size_type nLocallyOwnedCellDofs(const size_type cellId) const
Definition: FEBasisManager.t.cpp:421
std::vector< std::pair< global_size_type, global_size_type > > d_locallyOwnedRanges
Definition: FEBasisManager.h:154
size_type nGhost() const override
Definition: FEBasisManager.t.cpp:365
typename SizeTypeVector::iterator LocalIndexIter
Definition: FEBasisManager.h:54
std::shared_ptr< SizeTypeVector > d_locallyOwnedCellLocalIndices
Definition: FEBasisManager.h:163
global_size_type localToGlobalIndex(const size_type localId) const override
Definition: FEBasisManager.t.cpp:484
void getCellDofsLocalIds(const size_type cellId, std::vector< size_type > &vecLocalNodeId) const
Definition: FEBasisManager.t.cpp:617
void reinit(std::shared_ptr< const BasisDofHandler > basisDofHandler, std::shared_ptr< const utils::ScalarSpatialFunctionReal > dirichletBoundaryCondition)
Definition: FEBasisManager.t.cpp:169
std::pair< bool, size_type > inLocallyOwnedRanges(const global_size_type globalId) const override
Definition: FEBasisManager.t.cpp:451
size_type nLocal() const override
Definition: FEBasisManager.t.cpp:331
typename BasisManager< ValueTypeBasisCoeff, memorySpace >::SizeTypeVector SizeTypeVector
Definition: FEBasisManager.h:50
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > getMPIPatternP2P() const override
Definition: FEBasisManager.t.cpp:309
typename BasisManager< ValueTypeBasisCoeff, memorySpace >::GlobalSizeTypeVector GlobalSizeTypeVector
Definition: FEBasisManager.h:53
std::shared_ptr< GlobalSizeTypeVector > d_ghostIndices
Definition: FEBasisManager.h:160
const BasisDofHandler & getBasisDofHandler() const override
Definition: FEBasisManager.t.cpp:606
size_type nLocallyOwned() const override
Definition: FEBasisManager.t.cpp:349
const_LocalIndexIter locallyOwnedCellLocalDofIdsBegin() const
Definition: FEBasisManager.t.cpp:554
typename SizeTypeVector::const_iterator const_LocalIndexIter
Definition: FEBasisManager.h:55
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > d_mpiPatternP2P
Definition: FEBasisManager.h:162
std::map< global_size_type, utils::Point > d_supportPoints
Definition: FEBasisManager.h:164
std::pair< bool, size_type > isGhostEntry(const global_size_type ghostId) const override
Definition: FEBasisManager.t.cpp:462
std::vector< std::pair< global_size_type, global_size_type > > getLocallyOwnedRanges() const override
Definition: FEBasisManager.t.cpp:320
std::vector< size_type > d_numLocallyOwnedCellDofs
Definition: FEBasisManager.h:157
size_type nLocallyOwnedCells() const
Definition: FEBasisManager.t.cpp:399
typename GlobalSizeTypeVector::iterator GlobalIndexIter
Definition: FEBasisManager.h:56
const_GlobalIndexIter locallyOwnedCellGlobalDofIdsEnd(const size_type cellId) const
Definition: FEBasisManager.t.cpp:534
const ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > & getConstraints() const override
Definition: FEBasisManager.t.cpp:298
const_GlobalIndexIter locallyOwnedCellGlobalDofIdsBegin() const
Definition: FEBasisManager.t.cpp:501
void getBasisCenters(const size_type localId, dftefe::utils::Point &basisCenter) const override
Definition: FEBasisManager.t.cpp:377
Definition: PointImpl.h:13
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8
unsigned long int global_size_type
Definition: TypeConfig.h:9