44#include <Teuchos_TimeMonitor.hpp>
45#include <PanzerAdaptersSTK_config.hpp>
50#ifdef PANZER_HAVE_IOSS
52#include <Ionit_Initializer.h>
53#include <Ioss_ElementBlock.h>
54#include <Ioss_EdgeBlock.h>
55#include <Ioss_FaceBlock.h>
56#include <Ioss_Region.h>
57#include <stk_mesh/base/GetBuckets.hpp>
58#include <stk_io/StkMeshIoBroker.hpp>
59#include <stk_io/IossBridge.hpp>
60#include <stk_mesh/base/FieldParallel.hpp>
63#include <Ioumr_DatabaseIO.hpp>
66#include "Teuchos_StandardParameterEntryValidators.hpp"
70int getMeshDimension(
const std::string & meshStr,
71 stk::ParallelMachine parallelMach,
72 const std::string & typeStr)
74 stk::io::StkMeshIoBroker meshData(parallelMach);
75 meshData.property_add(Ioss::Property(
"LOWER_CASE_VARIABLE_NAMES",
false));
76 meshData.add_mesh_database(meshStr, fileTypeToIOSSType(typeStr), stk::io::READ_MESH);
77 meshData.create_input_mesh();
78 return Teuchos::as<int>(meshData.meta_data_ptr()->spatial_dimension());
81std::string fileTypeToIOSSType(
const std::string & fileType)
84 if (fileType==
"Exodus")
85 IOSSType =
"exodusii";
87 else if (fileType==
"Exodus Refinement")
88 IOSSType =
"Refinement";
90 else if (fileType==
"Pamgen")
96STK_ExodusReaderFactory::STK_ExodusReaderFactory()
97 : fileName_(
""), fileType_(
""), restartIndex_(0), userMeshScaling_(false), keepPerceptData_(false),
98 keepPerceptParentElements_(false), rebalancing_(
"default"),
99meshScaleFactor_(0.0), levelsOfRefinement_(0),
100 createEdgeBlocks_(false), createFaceBlocks_(false), geometryName_(
"")
103STK_ExodusReaderFactory::STK_ExodusReaderFactory(
const std::string & fileName,
104 const int restartIndex)
105 : fileName_(fileName), fileType_(
"Exodus"), restartIndex_(restartIndex), userMeshScaling_(false),
106 keepPerceptData_(false), keepPerceptParentElements_(false), rebalancing_(
"default"),
107 meshScaleFactor_(0.0), levelsOfRefinement_(0), createEdgeBlocks_(false), createFaceBlocks_(false), geometryName_(
"")
110Teuchos::RCP<STK_Interface> STK_ExodusReaderFactory::buildMesh(stk::ParallelMachine parallelMach)
const
112 PANZER_FUNC_TIME_MONITOR(
"panzer::STK_ExodusReaderFactory::buildMesh()");
117 RCP<STK_Interface> mesh = buildUncommitedMesh(parallelMach);
123 mesh->initialize(parallelMach,
false,doPerceptRefinement());
125 completeMeshConstruction(*mesh,parallelMach);
134Teuchos::RCP<STK_Interface> STK_ExodusReaderFactory::buildUncommitedMesh(stk::ParallelMachine parallelMach)
const
136 PANZER_FUNC_TIME_MONITOR(
"panzer::STK_ExodusReaderFactory::buildUncomittedMesh()");
142 stk::io::StkMeshIoBroker* meshData =
new stk::io::StkMeshIoBroker(parallelMach);
143 meshData->property_add(Ioss::Property(
"LOWER_CASE_VARIABLE_NAMES",
false));
146 std::vector<std::string> entity_rank_names = stk::mesh::entity_rank_names();
147 entity_rank_names.push_back(
"FAMILY_TREE");
148 meshData->set_rank_name_vector(entity_rank_names);
150#ifdef PANZER_HAVE_UMR
152 Ioumr::IOFactory::factory();
154 meshData->property_add(Ioss::Property(
"GEOMETRY_FILE", geometryName_));
155 meshData->property_add(Ioss::Property(
"NUMBER_REFINEMENTS", levelsOfRefinement_));
158 meshData->add_mesh_database(fileName_, fileTypeToIOSSType(fileType_), stk::io::READ_MESH);
160 meshData->create_input_mesh();
161 RCP<stk::mesh::MetaData> metaData = Teuchos::rcp(meshData->meta_data_ptr());
163 RCP<STK_Interface> mesh = rcp(
new STK_Interface(metaData));
164 mesh->initializeFromMetaData();
165 mesh->instantiateBulkData(parallelMach);
166 meshData->set_bulk_data(Teuchos::get_shared_ptr(mesh->getBulkData()));
170 meshData->add_all_mesh_fields_as_input_fields();
174 mesh->getMetaData()->declare_attribute_with_delete(meshData);
177 registerElementBlocks(*mesh,*meshData);
178 registerSidesets(*mesh);
179 registerNodesets(*mesh);
181 if (createEdgeBlocks_) {
182 registerEdgeBlocks(*mesh,*meshData);
184 if (createFaceBlocks_ && mesh->getMetaData()->spatial_dimension() > 2) {
185 registerFaceBlocks(*mesh,*meshData);
188 buildMetaData(parallelMach, *mesh);
190 mesh->addPeriodicBCs(periodicBCVec_);
191 mesh->setBoundingBoxSearchFlag(useBBoxSearch_);
196void STK_ExodusReaderFactory::completeMeshConstruction(STK_Interface & mesh,stk::ParallelMachine parallelMach)
const
198 PANZER_FUNC_TIME_MONITOR(
"panzer::STK_ExodusReaderFactory::completeMeshConstruction()");
204 if(not mesh.isInitialized()) {
205 mesh.initialize(parallelMach,
true,doPerceptRefinement());
209 stk::mesh::MetaData & metaData = *mesh.getMetaData();
210 stk::mesh::BulkData & bulkData = *mesh.getBulkData();
211 stk::io::StkMeshIoBroker * meshData =
212 const_cast<stk::io::StkMeshIoBroker *
>(metaData.get_attribute<stk::io::StkMeshIoBroker>());
216 TEUCHOS_ASSERT(metaData.remove_attribute(meshData));
220 meshData->populate_bulk_data();
222 if (doPerceptRefinement()) {
223 const bool deleteParentElements = !keepPerceptParentElements_;
224 mesh.refineMesh(levelsOfRefinement_,deleteParentElements);
229 if (userMeshScaling_)
231 stk::mesh::Field<double,stk::mesh::Cartesian>* coord_field =
232 metaData.get_field<stk::mesh::Field<double, stk::mesh::Cartesian> >(stk::topology::NODE_RANK,
"coordinates");
234 stk::mesh::Selector select_all_local = metaData.locally_owned_part() | metaData.globally_shared_part();
235 stk::mesh::BucketVector
const& my_node_buckets = bulkData.get_buckets(stk::topology::NODE_RANK, select_all_local);
237 int mesh_dim = mesh.getDimension();
240 const double inv_msf = 1.0/meshScaleFactor_;
241 for (
size_t i=0; i < my_node_buckets.size(); ++i)
243 stk::mesh::Bucket& b = *(my_node_buckets[i]);
244 double* coordinate_data = field_data( *coord_field, b );
246 for (
size_t j=0; j < b.size(); ++j) {
247 for (
int k=0; k < mesh_dim; ++k) {
248 coordinate_data[mesh_dim*j + k] *= inv_msf;
256 int restartIndex = restartIndex_;
258 std::pair<int,double> lastTimeStep = meshData->get_input_io_region()->get_max_time();
259 restartIndex = 1+restartIndex+lastTimeStep.first;
263 meshData->read_defined_input_fields(restartIndex);
265 mesh.buildSubcells();
266 mesh.buildLocalElementIDs();
268 mesh.beginModification();
269 if (createEdgeBlocks_) {
270 mesh.buildLocalEdgeIDs();
273 if (createFaceBlocks_ && mesh.getMetaData()->spatial_dimension() > 2) {
274 mesh.buildLocalFaceIDs();
277 mesh.endModification();
279 if (userMeshScaling_) {
280 stk::mesh::Field<double,stk::mesh::Cartesian>* coord_field =
281 metaData.get_field<stk::mesh::Field<double, stk::mesh::Cartesian> >(stk::topology::NODE_RANK,
"coordinates");
282 std::vector< const stk::mesh::FieldBase *> fields;
283 fields.push_back(coord_field);
285 stk::mesh::communicate_field_data(bulkData, fields);
289 mesh.setInitialStateTime(meshData->get_input_io_region()->get_state_time(restartIndex));
291 mesh.setInitialStateTime(0.0);
296 if(rebalancing_ ==
"default")
298 this->rebalance(mesh);
299 else if(rebalancing_ !=
"none")
301 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
302 "ERROR: Rebalancing was not set to a valid choice");
307void STK_ExodusReaderFactory::setParameterList(
const Teuchos::RCP<Teuchos::ParameterList> & paramList)
309 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(!paramList->isParameter(
"File Name"),
310 Teuchos::Exceptions::InvalidParameterName,
311 "Error, the parameter {name=\"File Name\","
313 "\nis required in parameter (sub)list \""<< paramList->name() <<
"\"."
314 "\n\nThe parsed parameter parameter list is: \n" << paramList->currentParametersString()
320 if(!paramList->isParameter(
"Restart Index"))
321 paramList->set<
int>(
"Restart Index", -1);
323 if(!paramList->isParameter(
"File Type"))
324 paramList->set(
"File Type",
"Exodus");
326 if(!paramList->isSublist(
"Periodic BCs"))
327 paramList->sublist(
"Periodic BCs");
329 Teuchos::ParameterList& p_bcs = paramList->sublist(
"Periodic BCs");
330 if (!p_bcs.isParameter(
"Count"))
331 p_bcs.set<
int>(
"Count", 0);
333 if(!paramList->isParameter(
"Levels of Uniform Refinement"))
334 paramList->set<
int>(
"Levels of Uniform Refinement", 0);
336 if(!paramList->isParameter(
"Keep Percept Data"))
337 paramList->set<
bool>(
"Keep Percept Data",
false);
339 if(!paramList->isParameter(
"Keep Percept Parent Elements"))
340 paramList->set<
bool>(
"Keep Percept Parent Elements",
false);
342 if(!paramList->isParameter(
"Rebalancing"))
343 paramList->set<std::string>(
"Rebalancing",
"default");
345 if(!paramList->isParameter(
"Create Edge Blocks"))
347 paramList->set<
bool>(
"Create Edge Blocks",
false);
349 if(!paramList->isParameter(
"Create Face Blocks"))
351 paramList->set<
bool>(
"Create Face Blocks",
false);
353 if(!paramList->isParameter(
"Geometry File Name"))
354 paramList->set(
"Geometry File Name",
"");
356 paramList->validateParameters(*getValidParameters(),0);
358 setMyParamList(paramList);
360 fileName_ = paramList->get<std::string>(
"File Name");
362 geometryName_ = paramList->get<std::string>(
"Geometry File Name");
364 restartIndex_ = paramList->get<
int>(
"Restart Index");
366 fileType_ = paramList->get<std::string>(
"File Type");
369 if (paramList->isParameter(
"Scale Factor"))
371 meshScaleFactor_ = paramList->get<
double>(
"Scale Factor");
372 userMeshScaling_ =
true;
376 parsePeriodicBCList(Teuchos::rcpFromRef(paramList->sublist(
"Periodic BCs")),periodicBCVec_,useBBoxSearch_);
378 keepPerceptData_ = paramList->get<
bool>(
"Keep Percept Data");
380 keepPerceptParentElements_ = paramList->get<
bool>(
"Keep Percept Parent Elements");
382 rebalancing_ = paramList->get<std::string>(
"Rebalancing");
384 levelsOfRefinement_ = paramList->get<
int>(
"Levels of Uniform Refinement");
386 createEdgeBlocks_ = paramList->get<
bool>(
"Create Edge Blocks");
387 createFaceBlocks_ = paramList->get<
bool>(
"Create Face Blocks");
391Teuchos::RCP<const Teuchos::ParameterList> STK_ExodusReaderFactory::getValidParameters()
const
393 static Teuchos::RCP<Teuchos::ParameterList> validParams;
395 if(validParams==Teuchos::null) {
396 validParams = Teuchos::rcp(
new Teuchos::ParameterList);
397 validParams->set<std::string>(
"File Name",
"<file name not set>",
"Name of exodus file to be read",
398 Teuchos::rcp(
new Teuchos::FileNameValidator));
399 validParams->set<std::string>(
"Geometry File Name",
"<file name not set>",
"Name of geometry file for refinement",
400 Teuchos::rcp(
new Teuchos::FileNameValidator));
402 validParams->set<
int>(
"Restart Index",-1,
"Index of solution to read in",
403 Teuchos::rcp(
new Teuchos::AnyNumberParameterEntryValidator(Teuchos::AnyNumberParameterEntryValidator::PREFER_INT,Teuchos::AnyNumberParameterEntryValidator::AcceptedTypes(
true))));
405 Teuchos::setStringToIntegralParameter<int>(
"File Type",
407 "Choose input file type - either \"Exodus\", \"Exodus Refinement\" or \"Pamgen\"",
408 Teuchos::tuple<std::string>(
"Exodus",
"Pamgen"
409#ifdef PANZER_HAVE_UMR
416 validParams->set<
double>(
"Scale Factor", 1.0,
"Scale factor to apply to mesh after read",
417 Teuchos::rcp(
new Teuchos::AnyNumberParameterEntryValidator(Teuchos::AnyNumberParameterEntryValidator::PREFER_DOUBLE,Teuchos::AnyNumberParameterEntryValidator::AcceptedTypes(
true))));
419 Teuchos::ParameterList & bcs = validParams->sublist(
"Periodic BCs");
420 bcs.set<
int>(
"Count",0);
422 validParams->set(
"Levels of Uniform Refinement",0,
"Number of levels of inline uniform mesh refinement");
424 validParams->set(
"Keep Percept Data",
false,
"Keep the Percept mesh after uniform refinement is applied");
426 validParams->set(
"Keep Percept Parent Elements",
false,
"Keep the parent element information in the Percept data");
428 validParams->set(
"Rebalancing",
"default",
"The type of rebalancing to be performed on the mesh after creation (default, none)");
431 validParams->set(
"Create Edge Blocks",
false,
"Create or copy edge blocks in the mesh");
432 validParams->set(
"Create Face Blocks",
false,
"Create or copy face blocks in the mesh");
435 return validParams.getConst();
438void STK_ExodusReaderFactory::registerElementBlocks(STK_Interface & mesh,stk::io::StkMeshIoBroker & meshData)
const
442 RCP<stk::mesh::MetaData> femMetaData = mesh.getMetaData();
447 const Ioss::ElementBlockContainer & elem_blocks = meshData.get_input_io_region()->get_element_blocks();
448 for(Ioss::ElementBlockContainer::const_iterator itr=elem_blocks.begin();itr!=elem_blocks.end();++itr) {
449 Ioss::GroupingEntity * entity = *itr;
450 const std::string & name = entity->name();
452 const stk::mesh::Part * part = femMetaData->get_part(name);
453 shards::CellTopology cellTopo = stk::mesh::get_cell_topology(femMetaData->get_topology(*part));
454 const CellTopologyData * ct = cellTopo.getCellTopologyData();
456 TEUCHOS_ASSERT(ct!=0);
457 mesh.addElementBlock(part->name(),ct);
459 if (createEdgeBlocks_) {
460 createUniqueEdgeTopologyMap(mesh, part);
462 if (createFaceBlocks_ && mesh.getMetaData()->spatial_dimension() > 2) {
463 createUniqueFaceTopologyMap(mesh, part);
468template <
typename SetType>
469void buildSetNames(
const SetType & setData,std::vector<std::string> & names)
472 for(
typename SetType::const_iterator itr=setData.begin();itr!=setData.end();++itr) {
473 Ioss::GroupingEntity * entity = *itr;
474 names.push_back(entity->name());
478void STK_ExodusReaderFactory::registerSidesets(STK_Interface & mesh)
const
482 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
483 const stk::mesh::PartVector & parts = metaData->get_parts();
485 stk::mesh::PartVector::const_iterator partItr;
486 for(partItr=parts.begin();partItr!=parts.end();++partItr) {
487 const stk::mesh::Part * part = *partItr;
488 const stk::mesh::PartVector & subsets = part->subsets();
489 shards::CellTopology cellTopo = stk::mesh::get_cell_topology(metaData->get_topology(*part));
490 const CellTopologyData * ct = cellTopo.getCellTopologyData();
494 if(part->primary_entity_rank()==mesh.getSideRank() && ct==0 && subsets.size()>0) {
495 TEUCHOS_TEST_FOR_EXCEPTION(subsets.size()!=1,std::runtime_error,
496 "STK_ExodusReaderFactory::registerSidesets error - part \"" << part->name() <<
497 "\" has more than one subset");
500 const stk::mesh::Part * ss_part = subsets[0];
501 shards::CellTopology ss_cellTopo = stk::mesh::get_cell_topology(metaData->get_topology(*ss_part));
502 const CellTopologyData * ss_ct = ss_cellTopo.getCellTopologyData();
506 mesh.addSideset(part->name(),ss_ct);
511void STK_ExodusReaderFactory::registerNodesets(STK_Interface & mesh)
const
515 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
516 const stk::mesh::PartVector & parts = metaData->get_parts();
518 stk::mesh::PartVector::const_iterator partItr;
519 for(partItr=parts.begin();partItr!=parts.end();++partItr) {
520 const stk::mesh::Part * part = *partItr;
521 shards::CellTopology cellTopo = stk::mesh::get_cell_topology(metaData->get_topology(*part));
522 const CellTopologyData * ct = cellTopo.getCellTopologyData();
526 if(part->primary_entity_rank()==mesh.getNodeRank() && ct==0) {
529 if(part->name()!=STK_Interface::nodesString)
530 mesh.addNodeset(part->name());
535void STK_ExodusReaderFactory::registerEdgeBlocks(STK_Interface & mesh,stk::io::StkMeshIoBroker & meshData)
const
539 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
547 const Ioss::EdgeBlockContainer & edge_blocks = meshData.get_input_io_region()->get_edge_blocks();
548 for(Ioss::EdgeBlockContainer::const_iterator ebc_iter=edge_blocks.begin();ebc_iter!=edge_blocks.end();++ebc_iter) {
549 Ioss::GroupingEntity * entity = *ebc_iter;
550 const stk::mesh::Part * edgeBlockPart = metaData->get_part(entity->name());
551 const stk::topology edgeBlockTopo = metaData->get_topology(*edgeBlockPart);
553 for (
auto ebuet_iter : elemBlockUniqueEdgeTopologies_) {
554 std::string elemBlockName = ebuet_iter.first;
555 std::vector<stk::topology> uniqueEdgeTopologies = ebuet_iter.second;
557 auto find_result = std::find(uniqueEdgeTopologies.begin(), uniqueEdgeTopologies.end(), edgeBlockTopo);
558 if (find_result != uniqueEdgeTopologies.end()) {
559 mesh.addEdgeBlock(elemBlockName, edgeBlockPart->name(), edgeBlockTopo);
565void STK_ExodusReaderFactory::registerFaceBlocks(STK_Interface & mesh,stk::io::StkMeshIoBroker & meshData)
const
569 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
577 const Ioss::FaceBlockContainer & face_blocks = meshData.get_input_io_region()->get_face_blocks();
578 for(Ioss::FaceBlockContainer::const_iterator fbc_itr=face_blocks.begin();fbc_itr!=face_blocks.end();++fbc_itr) {
579 Ioss::GroupingEntity * entity = *fbc_itr;
580 const stk::mesh::Part * faceBlockPart = metaData->get_part(entity->name());
581 const stk::topology faceBlockTopo = metaData->get_topology(*faceBlockPart);
583 for (
auto ebuft_iter : elemBlockUniqueFaceTopologies_) {
584 std::string elemBlockName = ebuft_iter.first;
585 std::vector<stk::topology> uniqueFaceTopologies = ebuft_iter.second;
587 auto find_result = std::find(uniqueFaceTopologies.begin(), uniqueFaceTopologies.end(), faceBlockTopo);
588 if (find_result != uniqueFaceTopologies.end()) {
589 mesh.addFaceBlock(elemBlockName, faceBlockPart->name(), faceBlockTopo);
595bool topo_less (stk::topology &i,stk::topology &j) {
return (i.value() < j.value()); }
596bool topo_equal (stk::topology &i,stk::topology &j) {
return (i.value() == j.value()); }
598void STK_ExodusReaderFactory::createUniqueEdgeTopologyMap(STK_Interface & mesh,
const stk::mesh::Part *elemBlockPart)
const
605 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
606 const stk::topology elemBlockTopo = metaData->get_topology(*elemBlockPart);
608 std::vector<stk::topology> edge_topologies;
609 for (
unsigned i=0;i<elemBlockTopo.num_edges();i++) {
610 edge_topologies.push_back(elemBlockTopo.edge_topology(i));
612 std::sort(edge_topologies.begin(), edge_topologies.end(), topo_less);
613 std::vector<stk::topology>::iterator new_end;
614 new_end = std::unique(edge_topologies.begin(), edge_topologies.end(), topo_equal);
615 edge_topologies.resize( std::distance(edge_topologies.begin(),new_end) );
617 elemBlockUniqueEdgeTopologies_[elemBlockPart->name()] = edge_topologies;
620void STK_ExodusReaderFactory::createUniqueFaceTopologyMap(STK_Interface & mesh,
const stk::mesh::Part *elemBlockPart)
const
627 RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
628 const stk::topology elemBlockTopo = metaData->get_topology(*elemBlockPart);
630 std::vector<stk::topology> face_topologies;
631 for (
unsigned i=0;i<elemBlockTopo.num_faces();i++) {
632 face_topologies.push_back(elemBlockTopo.face_topology(i));
634 std::sort(face_topologies.begin(), face_topologies.end(), topo_less);
635 std::vector<stk::topology>::iterator new_end;
636 new_end = std::unique(face_topologies.begin(), face_topologies.end(), topo_equal);
637 face_topologies.resize( std::distance(face_topologies.begin(),new_end) );
639 elemBlockUniqueFaceTopologies_[elemBlockPart->name()] = face_topologies;
644void STK_ExodusReaderFactory::addEdgeBlocks(STK_Interface & mesh)
const
646 Teuchos::RCP<stk::mesh::BulkData> bulkData = mesh.getBulkData();
647 Teuchos::RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
653 for (
auto iter : elemBlockUniqueEdgeTopologies_) {
654 std::string elemBlockName = iter.first;
655 std::vector<stk::topology> uniqueEdgeTopologies = iter.second;
657 for (
auto topo : uniqueEdgeTopologies ) {
658 const stk::mesh::Part * elemBlockPart = metaData->get_part(elemBlockName);
659 const stk::mesh::Part & edgeTopoPart = metaData->get_topology_root_part(topo);
661 stk::mesh::Selector owned_block;
662 owned_block = *elemBlockPart;
663 owned_block &= edgeTopoPart;
664 owned_block &= metaData->locally_owned_part();
667 stk::mesh::Part * edge_block = mesh.getEdgeBlock(edge_block_name);
669 std::vector<stk::mesh::Entity> all_edges_for_topo;
670 bulkData->get_entities(mesh.getEdgeRank(),owned_block,all_edges_for_topo);
671 mesh.addEntitiesToEdgeBlock(all_edges_for_topo, edge_block);
678void STK_ExodusReaderFactory::addFaceBlocks(STK_Interface & mesh)
const
680 Teuchos::RCP<stk::mesh::BulkData> bulkData = mesh.getBulkData();
681 Teuchos::RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
687 for (
auto iter : elemBlockUniqueFaceTopologies_) {
688 std::string elemBlockName = iter.first;
689 std::vector<stk::topology> uniqueFaceTopologies = iter.second;
691 for (
auto topo : uniqueFaceTopologies ) {
692 const stk::mesh::Part * elemBlockPart = metaData->get_part(elemBlockName);
693 const stk::mesh::Part & faceTopoPart = metaData->get_topology_root_part(topo);
695 stk::mesh::Selector owned_block;
696 owned_block = *elemBlockPart;
697 owned_block &= faceTopoPart;
698 owned_block &= metaData->locally_owned_part();
701 stk::mesh::Part * face_block = mesh.getFaceBlock(face_block_name);
703 std::vector<stk::mesh::Entity> all_faces_for_topo;
704 bulkData->get_entities(mesh.getFaceRank(),owned_block,all_faces_for_topo);
705 mesh.addEntitiesToFaceBlock(all_faces_for_topo, face_block);
710void STK_ExodusReaderFactory::buildMetaData(stk::ParallelMachine , STK_Interface & mesh)
const
712 if (createEdgeBlocks_) {
716 for (
auto iter : elemBlockUniqueEdgeTopologies_) {
717 std::string elemBlockName = iter.first;
718 std::vector<stk::topology> uniqueEdgeTopologies = iter.second;
720 for (
auto topo : uniqueEdgeTopologies ) {
722 mesh.addEdgeBlock(elemBlockName, edge_block_name, topo);
726 if (createFaceBlocks_ && mesh.getMetaData()->spatial_dimension() > 2) {
730 for (
auto iter : elemBlockUniqueFaceTopologies_) {
731 std::string elemBlockName = iter.first;
732 std::vector<stk::topology> uniqueFaceTopologies = iter.second;
734 for (
auto topo : uniqueFaceTopologies ) {
736 mesh.addFaceBlock(elemBlockName, face_block_name, topo);
742bool STK_ExodusReaderFactory::doPerceptRefinement()
const
744 return (fileType_!=
"Exodus Refinement") && (levelsOfRefinement_ > 0);
747std::string STK_ExodusReaderFactory::mkBlockName(std::string base, std::string topo_name)
const
750 name = topo_name+
"_"+base;
751 std::transform(name.begin(), name.end(), name.begin(),
753 { return char(std::tolower(c)); });
static const std::string edgeBlockString
static const std::string faceBlockString