18 static int countTotal(apf::Mesh* m,
int dim)
20 int total = apf::countOwned(m, dim);
21 PCU_Add_Ints(&total, 1);
30 std::cerr <<
"Constructing parallel proteus mesh\n";
32 int dim = m->getDimension();
33 int numGlobElem = countTotal(m, dim);
36 int numLocElem = m->count(dim);
39 int numGlobNodes = countTotal(m, 0);
42 int numLocNodes = m->count(0);
45 int numGlobFaces = countTotal(m, 2);
46 int numLocFaces = m->count(2);
48 int numGlobEdges = countTotal(m, 1);
51 int numLocEdges = m->count(1);
73 for (
int i = 0; i < PCU_Comm_Peers(); ++i) {
74 if (i == PCU_Comm_Self()) {
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);
114 int 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(&localOffset, 1);
145 MPI_Allgather(&localOffset, 1, MPI_INT,
146 allOffsets, 1, MPI_INT, MPI_COMM_WORLD);
147 allOffsets[PCU_Comm_Peers()] = countTotal(m, dim);
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(&localOffset, 1);
178 MPI_Allgather(&localOffset, 1, MPI_INT,
179 allOffsets, 1, MPI_INT, MPI_COMM_WORLD);
180 allOffsets[PCU_Comm_Peers()] = countTotal(m, dim);
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]);
195 int 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() <<
".txt";
246 std::string
s = ss.str();
247 FILE*
f = fopen(
s.c_str(),
"w");