18static int countTotal(apf::Mesh* m,
int dim, PCU_t PCUObj)
20 int total = apf::countOwned(m, dim);
21 PCU_Add_Ints(PCUObj, &total, 1);
29 if (!PCU_Comm_Self(PCUObj))
30 std::cerr <<
"Constructing parallel proteus mesh\n";
32 int dim = m->getDimension();
33 int numGlobElem = countTotal(m, dim, PCUObj);
36 int numLocElem = m->count(dim);
39 int numGlobNodes = countTotal(m, 0, PCUObj);
42 int numLocNodes = m->count(0);
45 int numGlobFaces = countTotal(m, 2, PCUObj);
46 int numLocFaces = m->count(2);
48 int numGlobEdges = countTotal(m, 1, PCUObj);
51 int numLocEdges = m->count(1);
73 for (
int i = 0; i < PCU_Comm_Peers(PCUObj); ++i) {
74 if (i == PCU_Comm_Self(PCUObj)) {
75 std::cerr <<
"*******Local Proteus Mesh Stats*********\n";
80 std::cerr <<
"*****************************************\n";
86 std::cerr <<
"*******Global Proteus Mesh Stats*********\n";
88 std::cerr <<
": Number of nodes " << mesh.
nNodes_global <<
"\n";
90 std::cerr <<
": Number of edges " << mesh.
nEdges_global <<
"\n";
91 std::cerr <<
"*****************************************\n";
95 constructGlobalNumbering(mesh);
102 constructGlobalStructures(mesh);
114int MeshAdaptPUMIDrvr::constructGlobalNumbering(
Mesh &mesh)
123 if(m->getDimension()==3){
124 for (
int dim = 0; dim <= m->getDimension(); ++dim) {
126 int nLocalOwned = apf::countOwned(m, dim);
127 int localOffset = nLocalOwned;
128 PCU_Exscan_Ints(PCUObj, &localOffset, 1);
145 MPI_Allgather(&localOffset, 1, MPI_INT,
146 allOffsets, 1, MPI_INT, MPI_COMM_WORLD);
147 allOffsets[PCU_Comm_Peers(PCUObj)] = countTotal(m, dim, PCUObj);
149 std::stringstream ss;
150 ss <<
"proteus_global_";
152 std::string name = ss.str();
155 global[dim] = apf::makeGlobal(apf::numberOwnedDimension(m, name.c_str(), dim));
156 apf::synchronize(global[dim]);
159 else if(m->getDimension()==2){
160 for (
int dim = 0; dim <= m->getDimension(); ++dim) {
162 int nLocalOwned = apf::countOwned(m, dim);
163 int localOffset = nLocalOwned;
164 PCU_Exscan_Ints(PCUObj, &localOffset, 1);
178 MPI_Allgather(&localOffset, 1, MPI_INT,
179 allOffsets, 1, MPI_INT, MPI_COMM_WORLD);
180 allOffsets[PCU_Comm_Peers(PCUObj)] = countTotal(m, dim, PCUObj);
181 std::stringstream ss;
182 ss <<
"proteus_global_";
184 std::string name = ss.str();
187 global[dim] = apf::makeGlobal(apf::numberOwnedDimension(m, name.c_str(), dim));
188 apf::synchronize(global[dim]);
195int MeshAdaptPUMIDrvr::constructGlobalStructures(
Mesh &mesh)
202 if(m->getDimension()==3){
203 for (
int d = 0; d <= m->getDimension(); ++d) {
204 int* temp_subdomain2global;
210 apf::MeshIterator* it = m->begin(d);
212 while ((e = m->iterate(it))) {
214 temp_subdomain2global[i] = apf::getNumber(global[d], apf::Node(e, 0));
217 apf::destroyGlobalNumbering(global[d]);
220 else if(m->getDimension()==2){
221 for (
int d = 0; d <= m->getDimension(); ++d) {
222 int* temp_subdomain2global;
223 int* temp_subdomain2global2;
227 apf::MeshIterator* it = m->begin(d);
229 while ((e = m->iterate(it))) {
231 temp_subdomain2global[i] = apf::getNumber(global[d], apf::Node(e, 0));
234 apf::destroyGlobalNumbering(global[d]);
244 std::stringstream ss;
245 ss <<
"dan_debug_" << PCU_Comm_Self(PCUObj) <<
".txt";
246 std::string
s = ss.str();
247 FILE*
f = fopen(
s.c_str(),
"w");
void dump_proteus_mesh(Mesh *m, FILE *f, PCU_t PCUObj)
#define DEFAULT_ELEMENT_MATERIAL
int localNumber(apf::MeshEntity *e)
int constructFromParallelPUMIMesh(Mesh &mesh, Mesh &subdomain_mesh)
void initializeMesh(Mesh &mesh)
const int INTERIOR_ELEMENT_BOUNDARY_MATERIAL
const int EXTERIOR_NODE_MATERIAL
const int DEFAULT_NODE_MATERIAL
const int INTERIOR_NODE_MATERIAL
const int EXTERIOR_ELEMENT_BOUNDARY_MATERIAL
int * edgeNumbering_subdomain2global
int * elementBoundaryNumbering_subdomain2global
int nNodes_elementBoundary
int * nodeNumbering_subdomain2global
int * elementBoundaryOffsets_subdomain_owned
int * elementOffsets_subdomain_owned
int nElementBoundaries_element
int * elementNumbering_subdomain2global
int * nodeOffsets_subdomain_owned
int * edgeOffsets_subdomain_owned
int nElementBoundaries_global