-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #452 from SCOREC/apw/gmi_cap_improvements
Implement capstone gmi functions
- Loading branch information
Showing
6 changed files
with
127 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <apf.h> | ||
#include <apfCAP.h> | ||
#include <gmi_cap.h> | ||
#include <lionPrint.h> | ||
#include <pcu_util.h> | ||
#include <CapstoneModule.h> | ||
#include <PCU.h> | ||
|
||
int main (int argc, char* argv[]) { | ||
MPI_Init(&argc, &argv); | ||
PCU_Comm_Init(); | ||
lion_set_verbosity(1); | ||
gmi_register_cap(); | ||
|
||
PCU_ALWAYS_ASSERT(argc == 2); | ||
std::string creFile(argv[1]); | ||
// 1. Load model. | ||
CapstoneModule cs("cap_inClosureOf", "Geometry Database : SMLIB", | ||
"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()); | ||
|
||
PCU_ALWAYS_ASSERT(m->canGetClosestPoint()); | ||
|
||
apf::ModelEntity* face = m->findModelEntity(2, 1); | ||
apf::Vector3 from(0.3, 0.4, -0.8), to, p; | ||
m->getClosestPoint(face, from, to, p); | ||
PCU_ALWAYS_ASSERT((to - apf::Vector3(0.3, 0.4, -0.5)).getLength() < 0.0001); | ||
|
||
apf::ModelEntity* edge = m->findModelEntity(1, 1); | ||
from = apf::Vector3(0.6, 0.34, 0.6); | ||
m->getClosestPoint(edge, from, to, p); | ||
PCU_ALWAYS_ASSERT((to - apf::Vector3(0.5, 0.34, 0.5)).getLength() < 0.0001); | ||
|
||
apf::destroyMesh(m); | ||
PCU_Comm_Free(); | ||
MPI_Finalize(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <apf.h> | ||
#include <apfCAP.h> | ||
#include <gmi_cap.h> | ||
#include <lionPrint.h> | ||
#include <pcu_util.h> | ||
#include <CapstoneModule.h> | ||
#include <PCU.h> | ||
|
||
int main (int argc, char* argv[]) { | ||
MPI_Init(&argc, &argv); | ||
PCU_Comm_Init(); | ||
lion_set_verbosity(1); | ||
gmi_register_cap(); | ||
|
||
PCU_ALWAYS_ASSERT(argc == 2); | ||
std::string creFile(argv[1]); | ||
// 1. Load model. | ||
CapstoneModule cs("cap_inClosureOf", "Geometry Database : SMLIB", | ||
"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()); | ||
// 3. Get region 1 ModelEntity*. | ||
apf::ModelEntity* rgn = m->findModelEntity(3, 1); | ||
PCU_ALWAYS_ASSERT(rgn); | ||
// 4. Assert each model entity is in the closure of that region. | ||
//FIXME: gmi_iter | ||
for (int d = 0; d < 3; ++d) { | ||
apf::MeshIterator* it = m->begin(d); | ||
for (apf::MeshEntity* e = m->iterate(it); e; e = m->iterate(it)) { | ||
apf::ModelEntity* ge = m->toModel(e); | ||
PCU_ALWAYS_ASSERT(m->isInClosureOf(ge, rgn)); | ||
} | ||
} | ||
// 5. Test face 1 for edges 3, 5, 8, 12 and verts 3, 4, 7, 8. | ||
apf::ModelEntity* f1 = m->findModelEntity(2, 1); | ||
PCU_ALWAYS_ASSERT(m->isInClosureOf(m->findModelEntity(1, 3), f1)); | ||
PCU_ALWAYS_ASSERT(m->isInClosureOf(m->findModelEntity(1, 5), f1)); | ||
PCU_ALWAYS_ASSERT(m->isInClosureOf(m->findModelEntity(1, 8), f1)); | ||
PCU_ALWAYS_ASSERT(m->isInClosureOf(m->findModelEntity(1, 12), f1)); | ||
PCU_ALWAYS_ASSERT(m->isInClosureOf(m->findModelEntity(0, 3), f1)); | ||
PCU_ALWAYS_ASSERT(m->isInClosureOf(m->findModelEntity(0, 4), f1)); | ||
PCU_ALWAYS_ASSERT(m->isInClosureOf(m->findModelEntity(0, 7), f1)); | ||
PCU_ALWAYS_ASSERT(m->isInClosureOf(m->findModelEntity(0, 8), f1)); | ||
|
||
apf::destroyMesh(m); | ||
PCU_Comm_Free(); | ||
MPI_Finalize(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters