[MOAB-dev] r5256 - in MOAB/trunk: itaps/igeom src
iulian at mcs.anl.gov
iulian at mcs.anl.gov
Sun Dec 11 23:14:57 CST 2011
Author: iulian
Date: 2011-12-11 23:14:53 -0600 (Sun, 11 Dec 2011)
New Revision: 5256
Modified:
MOAB/trunk/itaps/igeom/FBiGeom_MOAB.cpp
MOAB/trunk/src/FBEngine.cpp
Log:
the iGeom method getNumOfType can take as input type = 4, which means all,
vertex through volume
also, modify correspnding FBEngine method to be more efficient, and to take
advantage of the moab::get_entities_by_type_and_tag, to filter the geo sets
from the beginning
Modified: MOAB/trunk/itaps/igeom/FBiGeom_MOAB.cpp
===================================================================
--- MOAB/trunk/itaps/igeom/FBiGeom_MOAB.cpp 2011-12-09 18:35:34 UTC (rev 5255)
+++ MOAB/trunk/itaps/igeom/FBiGeom_MOAB.cpp 2011-12-12 05:14:53 UTC (rev 5256)
@@ -179,7 +179,7 @@
void FBiGeom_getNumOfType(FBiGeom_Instance instance,
iBase_EntitySetHandle set_handle, int entity_type, int* num_out, int* err) {
- if (0 > entity_type || 3 < entity_type) {
+ if (0 > entity_type || 4 < entity_type) {
ERROR(iBase_INVALID_ENTITY_TYPE, "Bad entity type.");
}
ErrorCode rval = FBE_cast(instance)->getNumOfType((EntityHandle)set_handle, entity_type, num_out);
Modified: MOAB/trunk/src/FBEngine.cpp
===================================================================
--- MOAB/trunk/src/FBEngine.cpp 2011-12-09 18:35:34 UTC (rev 5255)
+++ MOAB/trunk/src/FBEngine.cpp 2011-12-12 05:14:53 UTC (rev 5256)
@@ -482,22 +482,37 @@
ErrorCode FBEngine::getNumOfType(EntityHandle set, int ent_type, int * pNum)
{
- if (0 > ent_type || 3 < ent_type) {
+ if (0 > ent_type || 4 < ent_type) {
std::cout << "Invalid type\n";
return MB_FAILURE;
}
- int num_sets;
- ErrorCode rval = MBI->get_number_entities_by_type(set, MBENTITYSET, num_sets);
+ // get sets of geom dimension tag from here, and intersect with the gentities from goe
+ // ranges
- MBERRORR(rval, "Failed to get number of sets in the original set.");
+ // get the geom dimensions sets in the set (AKA gentities)
+ Range geom_sets;
+ Tag geom_tag;
+ ErrorCode rval = _mbImpl->tag_get_handle(GEOM_DIMENSION_TAG_NAME, 1, MB_TYPE_INTEGER, geom_tag,
+ MB_TAG_SPARSE|MB_TAG_CREAT);
+ MBERRORR(rval, "Failed to get geom tag.");
+ rval = _mbImpl->get_entities_by_type_and_tag(set, MBENTITYSET, &geom_tag, NULL, 1, geom_sets,
+ Interface::UNION);
+ MBERRORR(rval, "Failed to get gentities from set");
- // get also all sets in the set
- Range sets;
- rval = _mbImpl->get_entities_by_type(set, MBENTITYSET, sets, false); // nonrecursive
-
- // see how many are in the range
- sets = intersect(sets, _my_geomTopoTool->geoRanges()[ent_type]);
- *pNum = sets.size();
+ if (ent_type==4)
More information about the moab-dev
mailing list