35 #ifndef DOFGATHERER_HPP_ 36 #define DOFGATHERER_HPP_ 43 #include <boost/shared_ptr.hpp> 45 #include <lifev/core/LifeV.hpp> 47 #include <lifev/core/array/MapEpetra.hpp> 48 #include <lifev/core/fem/FESpace.hpp> 49 #include <lifev/core/mesh/GraphUtil.hpp> 78 template <
typename MeshType>
112 void showMe (std::ostream& s = std::cout);
140 Int x0 = * (first.begin() );
141 Int x1 = * (first.rbegin() );
142 Int y0 = * (second.begin() );
143 Int y1 = * (second.rbegin() );
144 return (x0 < y1) && (y0 < x1);
150 Int& returnValue)
const 152 Int x0 = * (first.begin() );
153 Int x1 = * (first.rbegin() );
154 Int y0 = * (second.begin() );
155 Int y1 = * (second.rbegin() );
183 template <
typename MeshType>
193 template <
typename MeshType>
198 template <
typename MeshType>
203 const Int numParts = M_elementIds->size();
204 M_dofGIDTable.reset (
new idSetGroup_Type (numParts) );
206 for (
Int i = 0; i < numParts; ++i)
208 M_dofGIDTable->at (i).reset (
new idSet_Type);
209 getDofGIDs (* (M_elementIds->at (i) ), * (M_dofGIDTable->at (i) ) );
218 M_dofGIDTable->push_back (idSetPtr_Type() );
219 M_dofGIDTable->at (numParts).reset (
new idSet_Type);
225 template <
typename MeshType>
229 const UInt nbDof = M_feSpace->refFE().nbDof();
230 const UInt fieldDim = M_feSpace->fieldDim();
232 for (Int iElement = 0; iElement < elementLIDs.size(); ++iElement)
234 Int elemLID = elementLIDs[iElement];
235 for (UInt iBlock = 0; iBlock < fieldDim; ++iBlock)
238 for (UInt iDof = 0; iDof < nbDof; ++iDof)
240 dofGIDs.insert (M_feSpace->dof().localToGlobalMap (elemLID, iDof)
241 + iBlock * M_feSpace->dof().numTotalDof() );
247 template <
typename MeshType>
250 for (Int i = 0; i < M_dofGIDTable->size(); ++i)
252 s <<
"DOF set " << i <<
" (size " << M_dofGIDTable->at (i)->size() <<
"): ";
253 idSet_Type& currentDofs = * (M_dofGIDTable->at (i) );
254 for (idSet_Type::const_iterator it = currentDofs.begin();
255 it != currentDofs.end(); ++it)
263 template<
typename MeshType>
267 Int numSets = M_dofGIDTable->size() - 1;
268 idSet_Type& commonSet = * (M_dofGIDTable->at (numSets) );
270 for (
Int i = 0; i < numSets - 1; ++i)
272 idSet_Type& currentSet = * (M_dofGIDTable->at (i) );
273 for (
Int j = i + 1; j < numSets; ++j)
275 idSet_Type& comparisonSet = * (M_dofGIDTable->at (j) );
282 currentSet.erase (temp);
283 comparisonSet.erase (temp);
284 commonSet.insert (temp);
289 std::set_intersection (currentSet.begin(), currentSet.end(),
290 comparisonSet.begin(), comparisonSet.end(),
291 std::inserter (intersectionSet, intersectionSet.begin() ) );
295 commonSet.insert (intersectionSet.begin(), intersectionSet.end() );
302 template<
typename MeshType>
306 for (idSet_Type::const_iterator it = valuesToRemove.begin();
307 it != valuesToRemove.end(); ++it)
309 targetSet.erase (*it);
std::set< Int > idSet_Type
void dofClassification()
Private methods that computes unique and shared dofs in M_dofGIDTable.
const bool setsCouldIntersect(const idSet_Type &first, const idSet_Type &second) const
Method that computes whether two (ordered) sets of IDs intersect.
const std::shared_ptr< FESpace< MeshType, MapEpetra > > M_feSpace
int32_type Int
Generic integer data.
void updateInverseJacobian(const UInt &iQuadPt)
void getDofGIDs(const idList_Type &elementLIDs, idSet_Type &dofGIDs)
Helper method to obtain dof GIDs associated with element LIDs.
Epetra_Import const & importer()
Getter for the Epetra_Import.
std::vector< LifeV::Int > idList_Type
DOFGatherer(const idTablePtr_Type &elementIds, const feSpacePtr_Type &feSpace)
Constructors and destructor.
const idSetGroupPtr_Type & dofGIDTable() const
Get methods.
Class that produces a list of dof GID from a list of element LIDs.
virtual ~DOFGatherer()
Destructor.
FESpace< MeshType, MapEpetra > feSpace_Type
Public typedefs.
const bool singleIntersect(const idSet_Type &first, const idSet_Type &second, Int &returnValue) const
Method that checks if two ordered sets of IDs have a single shared value.
std::shared_ptr< idSetGroup_Type > idSetGroupPtr_Type
void showMe(std::ostream &s=std::cout)
Public methods.
std::shared_ptr< idTable_Type > idTablePtr_Type
idSetGroupPtr_Type M_dofGIDTable
std::shared_ptr< feSpace_Type > feSpacePtr_Type
void run()
Private methods.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
const idTablePtr_Type M_elementIds
void removeValues(const idSet_Type &valuesToRemove, idSet_Type &targetSet)
Helper method that removes a subset of IDs from an idSet_Type.