9 #ifndef _MeshVolumeSubdivision_HPP_ 10 #define _MeshVolumeSubdivision_HPP_ 20 template<
typename MeshType>
34 UInt _numSubregions = 1,
bool _verbose =
false );
36 Epetra_IntSerialDenseVector _regionFlags,
UInt _numSubregions = 1,
bool _verbose =
false );
72 template<
typename MeshType>
79 template<
typename MeshType>
87 template<
typename MeshType>
99 M_numElementPerFlag( iRegion ) = 0;
105 template<
typename MeshType>
108 UInt _numSubregions,
bool _verbose )
122 M_numElementPerFlag( iRegion ) = 0;
128 template<
typename MeshType>
131 Epetra_IntSerialDenseVector _regionFlags,
UInt _numSubregions,
bool _verbose )
144 template<
typename MeshType>
155 template<
typename MeshType>
160 M_regionFlags = _regionFlags;
164 template<
typename MeshType>
172 std::cout <<
"Counting elements per flag" << std::endl;
177 std::cout <<
"I HAVE NOT READ THE FLAGS" << std::endl;
181 UInt nbElements ( M_mesh->numElements() );
182 UInt oldMarkerID = M_mesh->element( 0 ).markerID( ) + 1;
187 std::cout << std::endl <<
"TOTAL NUMBER OF ELEMENTS proc " << M_comm->MyPID() <<
": " << nbElements << std::endl << std::endl;
190 for (
UInt iElement(0); iElement < nbElements; iElement++)
193 UInt markerID = M_mesh->element( iElement ).markerID( );
195 if( oldMarkerID != markerID )
199 if( M_regionFlags( iRegion ) == markerID )
207 M_numElementPerFlag( numRegion ) = M_numElementPerFlag( numRegion ) + 1;
208 oldMarkerID = markerID;
220 template<
typename MeshType>
228 std::cout <<
"Filling elements per flag" << std::endl;
233 std::cout <<
"I HAVE NOT READ THE FLAGS" << std::endl;
237 std::vector<
int> counters(M_numSubregions, 0);
239 UInt nbElements( M_mesh->numElements( ) );
240 UInt oldMarkerID = 0;
243 for (
UInt iElement(0); iElement < nbElements; iElement++)
246 UInt markerID = M_mesh->element( iElement ).markerID( );
248 if( oldMarkerID != markerID )
252 if( M_regionFlags( iRegion ) == markerID )
260 (M_elements[numRegion])[ counters[numRegion] ] = iElement;
261 counters[numRegion]++;
262 oldMarkerID = markerID;
267 template<
typename MeshType>
275 std::cout <<
"ID " << M_comm->MyPID() <<
" Region: " << iRegion
276 <<
" flag " << M_regionFlags( iRegion ) << std::endl;
282 template<
typename MeshType>
288 std::cout <<
"Printing number of element per each flag " << std::endl;
292 std::cout <<
"ID " << M_comm->MyPID()
293 <<
" Region: " << iRegion
294 <<
" flag " << M_regionFlags( iRegion )
295 <<
" numElements: " << M_numElementPerFlag( iRegion ) << std::endl;
300 template<
typename MeshType>
308 std::cout <<
"Allocating for the elements" << std::endl;
313 if( M_numElementPerFlag( iRegion ) > 0 )
319 M_elements[iRegion] = nullptr;
325 template<
typename MeshType>
331 std::cout <<
"Printing number of element per each flag " << std::endl;
335 for( UInt iElement(0); iElement < M_numElementPerFlag( iRegion ); iElement++ )
337 std::cout <<
"ID " << M_comm->MyPID()
338 <<
" Region: " << iRegion
339 <<
" flag " << M_regionFlags( iRegion )
340 <<
" numElements: " << M_numElementPerFlag( iRegion )
341 <<
" element " << iElement
342 <<
" globally in the mpi local mesh " << (M_elements[iRegion])[ iElement ]
350 template<
typename MeshType>
361 template<
typename MeshType>
366 return M_numElementPerFlag[flag];
369 template<
typename MeshType>
377 template<
typename MeshType>
382 return M_regionFlags( flag );
const UInt getFlag(UInt flag) const
std::shared_ptr< MeshType > meshPtr_Type
MeshVolumeSubdivision(std::shared_ptr< Epetra_Comm > _comm, meshPtr_Type _mesh, UInt _numSubregions=1, bool _verbose=false)
MeshVolumeSubdivision(std::shared_ptr< Epetra_Comm > _comm)
UInt fillElementPerFlag()
MeshVolumeSubdivision(std::shared_ptr< Epetra_Comm > _comm, bool _verbose=false)
UInt assignRegionFlags(Epetra_IntSerialDenseVector _regionFlags)
void printNumElementPerFlag()
UInt countElementPerFlag()
MeshVolumeSubdivision(std::shared_ptr< Epetra_Comm > _comm, UInt _numSubregions=1, bool _verbose=false)
UInt allocatePerElements()
MeshVolumeSubdivision(std::shared_ptr< Epetra_Comm > _comm, meshPtr_Type _mesh, Epetra_IntSerialDenseVector _regionFlags, UInt _numSubregions=1, bool _verbose=false)
const UInt getNumElements(UInt flag) const
Epetra_IntSerialDenseVector M_numElementPerFlag
std::shared_ptr< Epetra_Comm > M_comm
Epetra_IntSerialDenseVector M_regionFlags
void printElementPerFlag()
uint32_type UInt
generic unsigned integer (used mainly for addressing)
const UInt * getSubmesh(UInt flag) const