Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update capstone test utils to use pcu::PCU object #469

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions test/capCheckParam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ void checkParametrization(MeshDatabaseInterface* mdb, GeometryDatabaseInterface*
int main(int argc, char** argv)
{
MPI_Init(&argc, &argv);
PCU_Comm_Init();
pcu::PCU *PCUobj = new pcu::PCU(MPI_COMM_WORLD);

if (argc != 2) {
if(0==PCU_Comm_Self())
std::cerr << "usage: " << argv[0]
<< " <cre file .cre>\n";
if (PCUobj->Self() == 0)
std::cerr << "usage: " << argv[0] << " <cre file .cre>\n";
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -112,7 +111,7 @@ int main(int argc, char** argv)
// check parametrization using capstone apis
checkParametrization(m, g);

PCU_Comm_Free();
delete PCUobj;
MPI_Finalize();
}

Expand Down
13 changes: 6 additions & 7 deletions test/capGeomTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ void visualizeEdges(gmi_model* model, int n, const char* fileName, pcu::PCU *PCU
int main(int argc, char** argv)
{
MPI_Init(&argc, &argv);
{
pcu::PCU PCUObj = pcu::PCU(MPI_COMM_WORLD);
pcu::PCU *PCUObj = new pcu::PCU(MPI_COMM_WORLD);

gmi_register_mesh();
gmi_register_null();
Expand Down Expand Up @@ -118,7 +117,7 @@ int main(int argc, char** argv)
gmi_register_cap();


apf::Mesh2* mesh0 = apf::createMesh(m,g,&PCUObj);
apf::Mesh2* mesh0 = apf::createMesh(m,g,PCUObj);
apf::writeVtkFiles("mesh_no_param", mesh0);

gmi_model* model = gmi_import_cap(g);
Expand All @@ -139,15 +138,15 @@ int main(int argc, char** argv)
while( (ge = gmi_next(model, gi)) ){
std::stringstream name_str;
name_str << "face_" << gmi_tag(model, ge) << "_mesh";
visualizeFace(model, ge, 100, 100, name_str.str().c_str(), &PCUObj);
visualizeFace(model, ge, 100, 100, name_str.str().c_str(), PCUObj);
}
gmi_end(model, gi);

printf("------------------------\n");
printf("creating mesh with param field\n");


apf::Mesh2* mesh = apf::createMesh(m,g,&PCUObj);
apf::Mesh2* mesh = apf::createMesh(m,g,PCUObj);
apf::Field* pf = apf::createFieldOn(mesh, "param_field", apf::VECTOR);
apf::Field* idf = apf::createFieldOn(mesh, "id", apf::SCALAR);
apf::MeshEntity* e;
Expand All @@ -165,7 +164,7 @@ int main(int argc, char** argv)

gmi_cap_stop();

}
delete PCUObj;
MPI_Finalize();
}

Expand Down Expand Up @@ -273,7 +272,7 @@ void visualizeFace(gmi_model* model, gmi_ent* entity, int n, int m, const char*

// make the vertexes and set the coordinates using the array
std::vector<ma::Entity*> vs;
apf::Mesh2* mesh = apf::makeEmptyMdsMesh(gmi_load(".null"), 2, false, &PCUObj);
apf::Mesh2* mesh = apf::makeEmptyMdsMesh(gmi_load(".null"), 2, false, PCUObj);
for (size_t i = 0; i < ps.size(); i++) {
ma::Entity* vert = mesh->createVert(0);
mesh->setPoint(vert, 0, ps[i]);
Expand Down
6 changes: 3 additions & 3 deletions test/cap_closestPoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

int main (int argc, char* argv[]) {
MPI_Init(&argc, &argv);
PCU_Comm_Init();
pcu::PCU* PCUObj = new pcu::PCU(MPI_COMM_WORLD);
lion_set_verbosity(1);
gmi_register_cap();

Expand All @@ -19,7 +19,7 @@ int main (int argc, char* argv[]) {
"Mesh Database : Create", "Attribution Database : Create");
cs.load_files(v_string(1, creFile));
// 2. CreateMesh.
apf::Mesh2* m = apf::createMesh(cs.get_mesh(), cs.get_geometry());
apf::Mesh2* m = apf::createMesh(cs.get_mesh(), cs.get_geometry(), PCUObj);

PCU_ALWAYS_ASSERT(m->canGetClosestPoint());

Expand All @@ -34,6 +34,6 @@ int main (int argc, char* argv[]) {
PCU_ALWAYS_ASSERT((to - apf::Vector3(0.5, 0.34, 0.5)).getLength() < 0.0001);

apf::destroyMesh(m);
PCU_Comm_Free();
delete PCUObj;
MPI_Finalize();
}
6 changes: 3 additions & 3 deletions test/cap_inClosureOf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

int main (int argc, char* argv[]) {
MPI_Init(&argc, &argv);
PCU_Comm_Init();
pcu::PCU *PCUObj = new pcu::PCU(MPI_COMM_WORLD);
lion_set_verbosity(1);
gmi_register_cap();

Expand All @@ -19,7 +19,7 @@ int main (int argc, char* argv[]) {
"Mesh Database : Create", "Attribution Database : Create");
cs.load_files(v_string(1, creFile));
// 2. CreateMesh.
apf::Mesh2* m = apf::createMesh(cs.get_mesh(), cs.get_geometry());
apf::Mesh2* m = apf::createMesh(cs.get_mesh(), cs.get_geometry(), PCUObj);
// 3. Get region 1 ModelEntity*.
apf::ModelEntity* rgn = m->findModelEntity(3, 1);
PCU_ALWAYS_ASSERT(rgn);
Expand All @@ -44,6 +44,6 @@ int main (int argc, char* argv[]) {
PCU_ALWAYS_ASSERT(m->isInClosureOf(m->findModelEntity(0, 8), f1));

apf::destroyMesh(m);
PCU_Comm_Free();
delete PCUObj;
MPI_Finalize();
}
Loading