[MOAB-dev] r4269 - MOAB/trunk/tools/mbcoupler
smithrm at mcs.anl.gov
smithrm at mcs.anl.gov
Tue Nov 16 10:29:47 CST 2010
Author: smithrm
Date: 2010-11-16 10:29:47 -0600 (Tue, 16 Nov 2010)
New Revision: 4269
Modified:
MOAB/trunk/tools/mbcoupler/Coupler.cpp
MOAB/trunk/tools/mbcoupler/Coupler.hpp
MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp
Log:
Coupler.hpp, Coupler.cpp
o Added global normalization.
o Factored out common normalization code.
mbcoupler_test.cpp
o Added global normalization test.
o Changed extensions for output files.
Modified: MOAB/trunk/tools/mbcoupler/Coupler.cpp
===================================================================
--- MOAB/trunk/tools/mbcoupler/Coupler.cpp 2010-11-15 21:36:28 UTC (rev 4268)
+++ MOAB/trunk/tools/mbcoupler/Coupler.cpp 2010-11-16 16:29:47 UTC (rev 4269)
@@ -566,6 +566,54 @@
return MB_SUCCESS;
}
+// Normalize a field over the entire mesh represented by the root_set.
+int Coupler::normalize_mesh(iBase_EntitySetHandle &root_set,
+ const char *norm_tag,
+ Coupler::IntegType integ_type,
+ int num_integ_pts)
+{
+ int err = iBase_SUCCESS;
+
+ // Get an iMesh_Instance from MBCoupler::mbImpl.
+ iMesh_Instance iMeshInst = reinterpret_cast<iMesh_Instance>(mbImpl);
+
+ // SLAVE START ****************************************************************
+ // Search for entities based on tag_handles and tag_values
+
+ std::vector< std::vector<iBase_EntitySetHandle> > entity_sets;
+ std::vector< std::vector<iBase_EntityHandle> > entity_groups;
+
+ // put the root_set into entity_sets
+ std::vector<iBase_EntitySetHandle> ent_set;
+ ent_set.push_back(root_set);
+ entity_sets.push_back(ent_set);
+
+ // get all entities from root_set and put into entity_groups
+ std::vector<iBase_EntityHandle> entities;
+ iBase_EntityHandle *ents = NULL;
+ int ents_alloc = 0;
+ int ents_size = 0;
+
+ iMesh_getEntities(iMeshInst, root_set, iBase_ALL_TYPES, iMesh_ALL_TOPOLOGIES,
+ &ents, &ents_alloc, &ents_size, &err);
+ ERRORR("iMesh_getEntities failed on root_set.", err);
+
+ // put all of the entities from the entity set into ent_set and free the memory for ents.
+ for (int k = 0; k < ents_size; k++) {
+ entities.push_back(ents[k]);
+ }
+ free(ents);
+
+ entity_groups.push_back(entities);
+
+ // Call do_normalization() to continue common normalization processing
+ err = do_normalization(norm_tag, entity_sets, entity_groups, integ_type, num_integ_pts);
+ ERRORR("Failure in do_normalization().", err);
More information about the moab-dev
mailing list