44#include <Teuchos_TimeMonitor.hpp>
45#include <Teuchos_RCP.hpp>
46#include <Teuchos_RCPStdSharedPtrConversions.hpp>
47#include <PanzerAdaptersSTK_config.hpp>
52#ifdef PANZER_HAVE_IOSS
54#include <Ionit_Initializer.h>
55#include <Ioss_ElementBlock.h>
56#include <Ioss_EdgeBlock.h>
57#include <Ioss_FaceBlock.h>
58#include <Ioss_Region.h>
59#include <stk_mesh/base/GetBuckets.hpp>
60#include <stk_io/StkMeshIoBroker.hpp>
61#include <stk_io/IossBridge.hpp>
62#include <stk_mesh/base/FieldParallel.hpp>
65#include <Ioumr_DatabaseIO.hpp>
68#include "Teuchos_StandardParameterEntryValidators.hpp"
72int getMeshDimension(
const std::string & meshStr,
73 stk::ParallelMachine parallelMach,
74 const std::string & typeStr)
76 stk::io::StkMeshIoBroker meshData(parallelMach);
77 meshData.property_add(Ioss::Property(
"LOWER_CASE_VARIABLE_NAMES",
false));
78 meshData.add_mesh_database(meshStr, fileTypeToIOSSType(typeStr), stk::io::READ_MESH);
79 meshData.create_input_mesh();
80 return Teuchos::as<int>(meshData.meta_data_ptr()->spatial_dimension());
83std::string fileTypeToIOSSType(
const std::string & fileType)
86 if (fileType==
"Exodus")
87 IOSSType =
"exodusii";
89 else if (fileType==
"Exodus Refinement")
90 IOSSType =
"Refinement";
92 else if (fileType==
"Pamgen")
98STK_ExodusReaderFactory::STK_ExodusReaderFactory()
99 : fileName_(
""), fileType_(
""), restartIndex_(0), userMeshScaling_(false), keepPerceptData_(false),
100 keepPerceptParentElements_(false), rebalancing_(
"default"),
101meshScaleFactor_(0.0), levelsOfRefinement_(0),
102 createEdgeBlocks_(false), createFaceBlocks_(false), geometryName_(
"")
105STK_ExodusReaderFactory::STK_ExodusReaderFactory(
const std::string & fileName,
106 const int restartIndex)
107 : fileName_(fileName), fileType_(
"Exodus"), restartIndex_(restartIndex), userMeshScaling_(false),
108 keepPerceptData_(false), keepPerceptParentElements_(false), rebalancing_(
"default"),
109 meshScaleFactor_(0.0), levelsOfRefinement_(0), createEdgeBlocks_(false), createFaceBlocks_(false), geometryName_(
"")
112Teuchos::RCP<STK_Interface> STK_ExodusReaderFactory::buildMesh(stk::ParallelMachine parallelMach)
const
114 PANZER_FUNC_TIME_MONITOR(
"panzer::STK_ExodusReaderFactory::buildMesh()");
119 RCP<STK_Interface> mesh = buildUncommitedMesh(parallelMach);
125 mesh->initialize(parallelMach,
false,doPerceptRefinement());
127 completeMeshConstruction(*mesh,parallelMach);
136Teuchos::RCP<STK_Interface> STK_ExodusReaderFactory::buildUncommitedMesh(stk::ParallelMachine parallelMach)
const
138 PANZER_FUNC_TIME_MONITOR(
"panzer::STK_ExodusReaderFactory::buildUncomittedMesh()");
144 stk::io::StkMeshIoBroker* meshData =
new stk::io::StkMeshIoBroker(parallelMach);
145 meshData->property_add(Ioss::Property(
"LOWER_CASE_VARIABLE_NAMES",
false));
148 std::vector<std::string> entity_rank_names = stk::mesh::entity_rank_names();
149 entity_rank_names.push_back(
"FAMILY_TREE");
150 meshData->set_rank_name_vector(entity_rank_names);
152#ifdef PANZER_HAVE_UMR
154 Ioumr::IOFactory::factory();
156 meshData->property_add(Ioss::Property(
"GEOMETRY_FILE", geometryName_));
157 meshData->property_add(Ioss::Property(
"NUMBER_REFINEMENTS", levelsOfRefinement_));
160 meshData->add_mesh_database(fileName_, fileTypeToIOSSType(fileType_), stk::io::READ_MESH);
162 meshData->create_input_mesh();
163 RCP<stk::mesh::MetaData> metaData = Teuchos::rcp(meshData->meta_data_ptr());
165 RCP<STK_Interface> mesh = rcp(
new STK_Interface(metaData));
166 mesh->initializeFromMetaData();
167 mesh->instantiateBulkData(parallelMach);
168 meshData->set_bulk_data(Teuchos::get_shared_ptr(mesh->getBulkData()));
172 meshData->add_all_mesh_fields_as_input_fields();
176 mesh->getMetaData()->declare_attribute_with_delete(meshData);
179 registerElementBlocks(*mesh,*meshData);
180 registerSidesets(*mesh);
181 registerNodesets(*mesh);
183 if (createEdgeBlocks_) {
184 registerEdgeBlocks(*mesh,*meshData);
186 if (createFaceBlocks_ && mesh->getMetaData()->spatial_dimension() > 2) {
187 registerFaceBlocks(*mesh,*meshData);
190 buildMetaData(parallelMach, *mesh);
192 mesh->addPeriodicBCs(periodicBCVec_);
193 mesh->setBoundingBoxSearchFlag(useBBoxSearch_);
198void STK_ExodusReaderFactory::completeMeshConstruction(STK_Interface & mesh,stk::ParallelMachine parallelMach)
const
200 PANZER_FUNC_TIME_MONITOR(
"panzer::STK_ExodusReaderFactory::completeMeshConstruction()");
206 if(not mesh.isInitialized()) {
207 mesh.initialize(parallelMach,
true,doPerceptRefinement());
211 stk::mesh::MetaData & metaData = *mesh.getMetaData();
212 stk::mesh::BulkData & bulkData = *mesh.getBulkData();
213 stk::io::StkMeshIoBroker * meshData =
214 const_cast<stk::io::StkMeshIoBroker *
>(metaData.get_attribute<stk::io::StkMeshIoBroker>());
218 TEUCHOS_ASSERT(metaData.remove_attribute(meshData));
222 meshData->populate_bulk_data();
224 if (doPerceptRefinement()) {
225 const bool deleteParentElements = !keepPerceptParentElements_;
226 mesh.refineMesh(levelsOfRefinement_,deleteParentElements);
231 if (userMeshScaling_)
233 stk::mesh::Field<double,stk::mesh::Cartesian>* coord_field =
234 metaData.get_field<stk::mesh::Field<double, stk::mesh::Cartesian> >(stk::topology::NODE_RANK,
"coordinates");
236 stk::mesh::Selector select_all_local = metaData.locally_owned_part() | metaData.globally_shared_part();
237 stk::mesh::BucketVector
const& my_node_buckets = bulkData.get_buckets(stk::topology::NODE_RANK, select_all_local);
239 int mesh_dim = mesh.getDimension();
242 const double inv_msf = 1.0/meshScaleFactor_;
243 for (
size_t i=0; i < my_node_buckets.size(); ++i)
245 stk::mesh::Bucket& b = *(my_node_buckets[i]);
246 double* coordinate_data = field_data( *coord_field, b );
248 for (
size_t j=0; j < b.size(); ++j) {
249 for (
int k=0; k < mesh_dim; ++k) {
250 coordinate_data[mesh_dim*j + k] *= inv_msf;
258 int restartIndex = restartIndex_;
260 std::pair<int,double> lastTimeStep = meshData->get_input_ioss_region()->get_max_time();
261 restartIndex = 1+restartIndex+lastTimeStep.first;
265 meshData->read_defined_input_fields(restartIndex);
267 mesh.buildSubcells();
268 mesh.buildLocalElementIDs();
270 mesh.beginModification();
271 if (createEdgeBlocks_) {
272 mesh.buildLocalEdgeIDs();
275 if (createFaceBlocks_ && mesh.getMetaData()->spatial_dimension() > 2) {
276 mesh.buildLocalFaceIDs();
279 mesh.endModification();
281 if (userMeshScaling_) {
282 stk::mesh::Field<double,stk::mesh::Cartesian>* coord_field =
283 metaData.get_field<stk::mesh::Field<double, stk::mesh::Cartesian> >(stk::topology::NODE_RANK,
"coordinates");
284 std::vector< const stk::mesh::FieldBase *> fields;
285 fields.push_back(coord_field);
287 stk::mesh::communicate_field_data(bulkData, fields);
291 mesh.setInitialStateTime(meshData->get_input_ioss_region()->get_state_time(restartIndex));
293 mesh.setInitialStateTime(0.0);
298 if(rebalancing_ ==
"default")
300 this->rebalance(mesh);
301 else if(rebalancing_ !=
"none")
303 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
304 "ERROR: Rebalancing was not set to a valid choice");
309void STK_ExodusReaderFactory::setParameterList(
const Teuchos::RCP<Teuchos::ParameterList> & paramList)
311 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(!paramList->isParameter(
"File Name"),
312 Teuchos::Exceptions::InvalidParameterName,
313 "Error, the parameter {name=\"File Name\","
315 "\nis required in parameter (sub)list \""<< paramList->name() <<
"\"."
316 "\n\nThe parsed parameter parameter list is: \n" << paramList->currentParametersString()
322 if(!paramList->isParameter(
"Restart Index"))
323 paramList->set<
int>(
"Restart Index", -1);
325 if(!paramList->isParameter(
"File Type"))
326 paramList->set(
"File Type",
"Exodus");
328 if(!paramList->isSublist(
"Periodic BCs"))
329 paramList->sublist(
"Periodic BCs");
331 Teuchos::ParameterList& p_bcs = paramList->sublist(
"Periodic BCs");
332 if (!p_bcs.isParameter(
"Count"))
333 p_bcs.set<
int>(
"Count", 0);
335 if(!paramList->isParameter(
"Levels of Uniform Refinement"))
336 paramList->set<
int>(
"Levels of Uniform Refinement", 0);
338 if(!paramList->isParameter(
"Keep Percept Data"))
339 paramList->set<
bool>(
"Keep Percept Data",
false);
341 if(!paramList->isParameter(
"Keep Percept Parent Elements"))
342 paramList->set<
bool>(
"Keep Percept Parent Elements",
false);
344 if(!paramList->isParameter(
"Rebalancing"))
345 paramList->set<std::string>(
"Rebalancing",
"default");
347 if(!paramList->isParameter(
"Create Edge Blocks"))
349 paramList->set<
bool>(
"Create Edge Blocks",
false);
351 if(!paramList->isParameter(
"Create Face Blocks"))
353 paramList->set<
bool>(
"Create Face Blocks",
false);
355 if(!paramList->isParameter(
"Geometry File Name"))
356 paramList->set(
"Geometry File Name",
"");
358 paramList->validateParameters(*getValidParameters(),0);
360 setMyParamList(paramList);
362 fileName_ = paramList->get<std::string>(
"File Name");
364 geometryName_ = paramList->get<std::string>(
"Geometry File Name");
366 restartIndex_ = paramList->get<
int>(
"Restart Index");
368 fileType_ = paramList->get<std::string>(
"File Type");
371 if (paramList->isParameter(
"Scale Factor"))
373 meshScaleFactor_ = paramList->get<
double>(
"Scale Factor");
374 userMeshScaling_ =
true;
378 parsePeriodicBCList(Teuchos::rcpFromRef(paramList->sublist(
"Periodic BCs")),periodicBCVec_,useBBoxSearch_);
380 keepPerceptData_ = paramList->get<
bool>(
"Keep Percept Data");
382 keepPerceptParentElements_ = paramList->get<
bool>(
"Keep Percept Parent Elements");
384 rebalancing_ = paramList->get<std::string>(
"Rebalancing");
386 levelsOfRefinement_ = paramList->get<
int>(
"Levels of Uniform Refinement");
388 createEdgeBlocks_ = paramList->get<
bool>(
"Create Edge Blocks");
389 createFaceBlocks_ = paramList->get<
bool>(
"Create Face Blocks");
393Teuchos::RCP<const Teuchos::ParameterList> STK_ExodusReaderFactory::getValidParameters()
const
395 static Teuchos::RCP<Teuchos::ParameterList> validParams;
397 if(validParams==Teuchos::null) {
398 validParams = Teuchos::rcp(
new Teuchos::ParameterList);
399 validParams->set<std::string>(
"File Name",
"<file name not set>",
"Name of exodus file to be read",
400 Teuchos::rcp(
new Teuchos::FileNameValidator));
401 validParams->set<std::string>(
"Geometry File Name",
"<file name not set>",
"Name of geometry file for refinement",
402 Teuchos::rcp(
new Teuchos::FileNameValidator));
404 validParams->set<
int>(
"Restart Index",-1,
"Index of solution to read in",
405 Teuchos::rcp(
new Teuchos::AnyNumberParameterEntryValidator(Teuchos::AnyNumberParameterEntryValidator::PREFER_INT,Teuchos::AnyNumberParameterEntryValidator::AcceptedTypes(
true))));
407 Teuchos::setStringToIntegralParameter<int>(
"File Type",
409 "Choose input file type - either \"Exodus\", \"Exodus Refinement\" or \"Pamgen\"",
410 Teuchos::tuple<std::string>(
"Exodus",
"Pamgen"
411#ifdef PANZER_HAVE_UMR
418 validParams->set<
double>(
"Scale Factor", 1.0,
"Scale factor to apply to mesh after read",
419 Teuchos::rcp(
new Teuchos::AnyNumberParameterEntryValidator(Teuchos::AnyNumberParameterEntryValidator::PREFER_DOUBLE,Teuchos::AnyNumberParameterEntryValidator::AcceptedTypes(
true))));
421 Teuchos::ParameterList & bcs = validParams->sublist(
"Periodic BCs");
422 bcs.set<
int>(
"Count",0);
424 validParams->set(
"Levels of Uniform Refinement",0,
"Number of levels of inline uniform mesh refinement");
426 validParams->set(
"Keep Percept Data",
false,
"Keep the Percept mesh after uniform refinement is applied");
428 validParams->set(
"Keep Percept Parent Elements",
false,
"Keep the parent element information in the Percept data");
430 validParams->set(
"Rebalancing",
"default",
"The type of rebalancing to be performed on the mesh after creation (default, none)");
433 validParams->set(
"Create Edge Blocks",
false,
"Create or copy edge blocks in the mesh");
434 validParams->set(
"Create Face Blocks",
false,
"Create or copy face blocks in the mesh");
437 return validParams.getConst();
440void STK_ExodusReaderFactory::registerElementBlocks(STK_Interface & mesh,stk::io::StkMeshIoBroker & meshData)
const
444 RCP<stk::mesh::MetaData> femMetaData = mesh.getMetaData();
449 const Ioss::ElementBlockContainer & elem_blocks = meshData.get_input_ioss_region()->get_element_blocks();
450 for(Ioss::ElementBlockContainer::const_iterator itr=elem_blocks.begin();itr!=elem_blocks.end();++itr) {
451 Ioss::GroupingEntity * entity = *itr;
452 const std::string & name = entity->name();
454 const stk::mesh::Part * part = femMetaData->get_part(name);
455 shards::CellTopology cellTopo = stk::mesh::get_cell_topology(femMetaData->get_topology(*part));
456 const CellTopologyData * ct = cellTopo.getCellTopologyData();
458 TEUCHOS_ASSERT(ct!=0);
459 mesh.addElementBlock(part->name(),ct);
461 if (createEdgeBlocks_) {
462 createUniqueEdgeTopologyMap(mesh, part);
464 if (createFaceBlocks_ && mesh.getMetaData()->spatial_dimension() > 2) {
465 createUniqueFaceTopologyMap(mesh, part);
470template <
typename SetType>
471void buildSetNames(
const SetType & setData,std::vector<std::string> & names)
474 for(
typename SetType::const_iterator itr=setData.begin();itr!=setData.end();++itr) {
475 Ioss::GroupingEntity * entity = *itr;
476 names.push_back(entity->name());
480void STK_ExodusReaderFactory::registerSidesets(STK_Interface & mesh)
const
484 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
485 const stk::mesh::PartVector & parts = metaData->get_parts();
487 stk::mesh::PartVector::const_iterator partItr;
488 for(partItr=parts.begin();partItr!=parts.end();++partItr) {
489 const stk::mesh::Part * part = *partItr;
490 const stk::mesh::PartVector & subsets = part->subsets();
491 shards::CellTopology cellTopo = stk::mesh::get_cell_topology(metaData->get_topology(*part));
492 const CellTopologyData * ct = cellTopo.getCellTopologyData();
496 if(part->primary_entity_rank()==mesh.getSideRank() && ct==0 && subsets.size()>0) {
497 TEUCHOS_TEST_FOR_EXCEPTION(subsets.size()!=1,std::runtime_error,
498 "STK_ExodusReaderFactory::registerSidesets error - part \"" << part->name() <<
499 "\" has more than one subset");
502 const stk::mesh::Part * ss_part = subsets[0];
503 shards::CellTopology ss_cellTopo = stk::mesh::get_cell_topology(metaData->get_topology(*ss_part));
504 const CellTopologyData * ss_ct = ss_cellTopo.getCellTopologyData();
508 mesh.addSideset(part->name(),ss_ct);
513void STK_ExodusReaderFactory::registerNodesets(STK_Interface & mesh)
const
517 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
518 const stk::mesh::PartVector & parts = metaData->get_parts();
520 stk::mesh::PartVector::const_iterator partItr;
521 for(partItr=parts.begin();partItr!=parts.end();++partItr) {
522 const stk::mesh::Part * part = *partItr;
523 shards::CellTopology cellTopo = stk::mesh::get_cell_topology(metaData->get_topology(*part));
524 const CellTopologyData * ct = cellTopo.getCellTopologyData();
528 if(part->primary_entity_rank()==mesh.getNodeRank() && ct==0) {
531 if(part->name()!=STK_Interface::nodesString)
532 mesh.addNodeset(part->name());
537void STK_ExodusReaderFactory::registerEdgeBlocks(STK_Interface & mesh,stk::io::StkMeshIoBroker & meshData)
const
541 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
549 const Ioss::EdgeBlockContainer & edge_blocks = meshData.get_input_ioss_region()->get_edge_blocks();
550 for(Ioss::EdgeBlockContainer::const_iterator ebc_iter=edge_blocks.begin();ebc_iter!=edge_blocks.end();++ebc_iter) {
551 Ioss::GroupingEntity * entity = *ebc_iter;
552 const stk::mesh::Part * edgeBlockPart = metaData->get_part(entity->name());
553 const stk::topology edgeBlockTopo = metaData->get_topology(*edgeBlockPart);
555 for (
auto ebuet_iter : elemBlockUniqueEdgeTopologies_) {
556 std::string elemBlockName = ebuet_iter.first;
557 std::vector<stk::topology> uniqueEdgeTopologies = ebuet_iter.second;
559 auto find_result = std::find(uniqueEdgeTopologies.begin(), uniqueEdgeTopologies.end(), edgeBlockTopo);
560 if (find_result != uniqueEdgeTopologies.end()) {
561 mesh.addEdgeBlock(elemBlockName, edgeBlockPart->name(), edgeBlockTopo);
567void STK_ExodusReaderFactory::registerFaceBlocks(STK_Interface & mesh,stk::io::StkMeshIoBroker & meshData)
const
571 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
579 const Ioss::FaceBlockContainer & face_blocks = meshData.get_input_ioss_region()->get_face_blocks();
580 for(Ioss::FaceBlockContainer::const_iterator fbc_itr=face_blocks.begin();fbc_itr!=face_blocks.end();++fbc_itr) {
581 Ioss::GroupingEntity * entity = *fbc_itr;
582 const stk::mesh::Part * faceBlockPart = metaData->get_part(entity->name());
583 const stk::topology faceBlockTopo = metaData->get_topology(*faceBlockPart);
585 for (
auto ebuft_iter : elemBlockUniqueFaceTopologies_) {
586 std::string elemBlockName = ebuft_iter.first;
587 std::vector<stk::topology> uniqueFaceTopologies = ebuft_iter.second;
589 auto find_result = std::find(uniqueFaceTopologies.begin(), uniqueFaceTopologies.end(), faceBlockTopo);
590 if (find_result != uniqueFaceTopologies.end()) {
591 mesh.addFaceBlock(elemBlockName, faceBlockPart->name(), faceBlockTopo);
597bool topo_less (stk::topology &i,stk::topology &j) {
return (i.value() < j.value()); }
598bool topo_equal (stk::topology &i,stk::topology &j) {
return (i.value() == j.value()); }
600void STK_ExodusReaderFactory::createUniqueEdgeTopologyMap(STK_Interface & mesh,
const stk::mesh::Part *elemBlockPart)
const
607 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
608 const stk::topology elemBlockTopo = metaData->get_topology(*elemBlockPart);
610 std::vector<stk::topology> edge_topologies;
611 for (
unsigned i=0;i<elemBlockTopo.num_edges();i++) {
612 edge_topologies.push_back(elemBlockTopo.edge_topology(i));
614 std::sort(edge_topologies.begin(), edge_topologies.end(), topo_less);
615 std::vector<stk::topology>::iterator new_end;
616 new_end = std::unique(edge_topologies.begin(), edge_topologies.end(), topo_equal);
617 edge_topologies.resize( std::distance(edge_topologies.begin(),new_end) );
619 elemBlockUniqueEdgeTopologies_[elemBlockPart->name()] = edge_topologies;
622void STK_ExodusReaderFactory::createUniqueFaceTopologyMap(STK_Interface & mesh,
const stk::mesh::Part *elemBlockPart)
const
629 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
630 const stk::topology elemBlockTopo = metaData->get_topology(*elemBlockPart);
632 std::vector<stk::topology> face_topologies;
633 for (
unsigned i=0;i<elemBlockTopo.num_faces();i++) {
634 face_topologies.push_back(elemBlockTopo.face_topology(i));
636 std::sort(face_topologies.begin(), face_topologies.end(), topo_less);
637 std::vector<stk::topology>::iterator new_end;
638 new_end = std::unique(face_topologies.begin(), face_topologies.end(), topo_equal);
639 face_topologies.resize( std::distance(face_topologies.begin(),new_end) );
641 elemBlockUniqueFaceTopologies_[elemBlockPart->name()] = face_topologies;
646void STK_ExodusReaderFactory::addEdgeBlocks(STK_Interface & mesh)
const
648 Teuchos::RCP<stk::mesh::BulkData> bulkData = mesh.getBulkData();
649 Teuchos::RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
655 for (
auto iter : elemBlockUniqueEdgeTopologies_) {
656 std::string elemBlockName = iter.first;
657 std::vector<stk::topology> uniqueEdgeTopologies = iter.second;
659 for (
auto topo : uniqueEdgeTopologies ) {
660 const stk::mesh::Part * elemBlockPart = metaData->get_part(elemBlockName);
661 const stk::mesh::Part & edgeTopoPart = metaData->get_topology_root_part(topo);
663 stk::mesh::Selector owned_block;
664 owned_block = *elemBlockPart;
665 owned_block &= edgeTopoPart;
666 owned_block &= metaData->locally_owned_part();
669 stk::mesh::Part * edge_block = mesh.getEdgeBlock(edge_block_name);
671 std::vector<stk::mesh::Entity> all_edges_for_topo;
672 bulkData->get_entities(mesh.getEdgeRank(),owned_block,all_edges_for_topo);
673 mesh.addEntitiesToEdgeBlock(all_edges_for_topo, edge_block);
680void STK_ExodusReaderFactory::addFaceBlocks(STK_Interface & mesh)
const
682 Teuchos::RCP<stk::mesh::BulkData> bulkData = mesh.getBulkData();
683 Teuchos::RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
689 for (
auto iter : elemBlockUniqueFaceTopologies_) {
690 std::string elemBlockName = iter.first;
691 std::vector<stk::topology> uniqueFaceTopologies = iter.second;
693 for (
auto topo : uniqueFaceTopologies ) {
694 const stk::mesh::Part * elemBlockPart = metaData->get_part(elemBlockName);
695 const stk::mesh::Part & faceTopoPart = metaData->get_topology_root_part(topo);
697 stk::mesh::Selector owned_block;
698 owned_block = *elemBlockPart;
699 owned_block &= faceTopoPart;
700 owned_block &= metaData->locally_owned_part();
703 stk::mesh::Part * face_block = mesh.getFaceBlock(face_block_name);
705 std::vector<stk::mesh::Entity> all_faces_for_topo;
706 bulkData->get_entities(mesh.getFaceRank(),owned_block,all_faces_for_topo);
707 mesh.addEntitiesToFaceBlock(all_faces_for_topo, face_block);
712void STK_ExodusReaderFactory::buildMetaData(stk::ParallelMachine , STK_Interface & mesh)
const
714 if (createEdgeBlocks_) {
718 for (
auto iter : elemBlockUniqueEdgeTopologies_) {
719 std::string elemBlockName = iter.first;
720 std::vector<stk::topology> uniqueEdgeTopologies = iter.second;
722 for (
auto topo : uniqueEdgeTopologies ) {
724 mesh.addEdgeBlock(elemBlockName, edge_block_name, topo);
728 if (createFaceBlocks_ && mesh.getMetaData()->spatial_dimension() > 2) {
732 for (
auto iter : elemBlockUniqueFaceTopologies_) {
733 std::string elemBlockName = iter.first;
734 std::vector<stk::topology> uniqueFaceTopologies = iter.second;
736 for (
auto topo : uniqueFaceTopologies ) {
738 mesh.addFaceBlock(elemBlockName, face_block_name, topo);
744bool STK_ExodusReaderFactory::doPerceptRefinement()
const
746 return (fileType_!=
"Exodus Refinement") && (levelsOfRefinement_ > 0);
749std::string STK_ExodusReaderFactory::mkBlockName(std::string base, std::string topo_name)
const
752 name = topo_name+
"_"+base;
753 std::transform(name.begin(), name.end(), name.begin(),
755 { return char(std::tolower(c)); });
static const std::string edgeBlockString
static const std::string faceBlockString