43 #include <PanzerAdaptersSTK_config.hpp> 50 #include <stk_mesh/base/FieldBase.hpp> 51 #include <stk_mesh/base/Comm.hpp> 52 #include <stk_mesh/base/Selector.hpp> 53 #include <stk_mesh/base/GetEntities.hpp> 54 #include <stk_mesh/base/GetBuckets.hpp> 55 #include <stk_mesh/base/CreateAdjacentEntities.hpp> 62 #include <stk_util/parallel/ParallelReduce.hpp> 64 #ifdef PANZER_HAVE_IOSS 65 #include <Ionit_Initializer.h> 66 #include <stk_io/IossBridge.hpp> 80 : gid_(gid), nodes_(nodes) {}
97 : dimension_(0), initialized_(false), currentLocalId_(0), initialStateTime_(0.0), currentStateTime_(0.0), useFieldCoordinates_(false)
103 : dimension_(0), initialized_(false), currentLocalId_(0), initialStateTime_(0.0), currentStateTime_(0.0), useFieldCoordinates_(false)
109 : dimension_(dim), initialized_(false), currentLocalId_(0), useFieldCoordinates_(false)
111 std::vector<std::string> entity_rank_names = stk::mesh::entity_rank_names();
112 entity_rank_names.push_back(
"FAMILY_TREE");
124 stk::mesh::Part * sideset =
metaData_->get_part(name);
126 sideset = &
metaData_->declare_part_with_topology(name,
127 stk::mesh::get_topology(shards::CellTopology(ctData),
dimension_));
128 sidesets_.insert(std::make_pair(name,sideset));
136 stk::mesh::Part * nodeset =
metaData_->get_part(name);
138 const CellTopologyData * ctData = shards::getCellTopologyData<shards::Node>();
139 nodeset = &
metaData_->declare_part_with_topology(name,
140 stk::mesh::get_topology(shards::CellTopology(ctData),
dimension_));
142 nodesets_.insert(std::make_pair(name,nodeset));
149 "Unknown element block \"" << blockId <<
"\"");
150 std::pair<std::string,std::string> key = std::make_pair(fieldName,blockId);
165 "Unknown element block \"" << blockId <<
"\"");
166 std::pair<std::string,std::string> key = std::make_pair(fieldName,blockId);
178 const std::vector<std::string> & coordNames,
179 const std::string & dispPrefix)
185 "Unknown element block \"" << blockId <<
"\"");
189 "STK_Interface::addMeshCoordFields: Can't set more than one set of coordinate " 190 "fields for element block \""+blockId+
"\".");
203 std::pair<std::string,std::string> key = std::make_pair(coordNames[i],blockId);
204 std::string dispName = dispPrefix+coordNames[i];
206 dispFields[i] = dispName;
242 #ifdef PANZER_HAVE_IOSS 249 std::map<std::string, stk::mesh::Part*>::iterator itr;
251 if(!stk::io::is_part_io_part(*itr->second))
252 stk::io::put_io_part_attribute(*itr->second);
257 std::map<std::string, stk::mesh::Part*>::iterator itr;
259 if(!stk::io::is_part_io_part(*itr->second))
260 stk::io::put_io_part_attribute(*itr->second);
265 std::map<std::string, stk::mesh::Part*>::iterator itr;
267 if(!stk::io::is_part_io_part(*itr->second))
268 stk::io::put_io_part_attribute(*itr->second);
276 stk::io::set_field_role(*
edgesField_, Ioss::Field::MESH);
278 stk::io::set_field_role(*
facesField_, Ioss::Field::MESH);
294 std::set<SolutionFieldType*> uniqueFields;
295 std::map<std::pair<std::string,std::string>,
SolutionFieldType*>::const_iterator fieldIter;
296 for(fieldIter=nameToField.begin();fieldIter!=nameToField.end();++fieldIter)
297 uniqueFields.insert(fieldIter->second);
300 std::set<SolutionFieldType*>::const_iterator uniqueFieldIter;
301 for(uniqueFieldIter=uniqueFields.begin();uniqueFieldIter!=uniqueFields.end();++uniqueFieldIter)
302 stk::mesh::put_field(*(*uniqueFieldIter),
metaData_->universal_part());
305 #ifdef PANZER_HAVE_IOSS 308 std::set<SolutionFieldType*>::const_iterator uniqueFieldIter;
309 for(uniqueFieldIter=uniqueFields.begin();uniqueFieldIter!=uniqueFields.end();++uniqueFieldIter)
310 stk::io::set_field_role(*(*uniqueFieldIter), Ioss::Field::TRANSIENT);
327 "STK_Interface: Must call \"initialized\" or \"instantiateBulkData\" before \"beginModification\"");
335 "STK_Interface: Must call \"initialized\" or \"instantiateBulkData\" before \"endModification\"");
344 for (
int phase=0;phase<2;++phase) {
345 for (
int i=0;i<
bulkData_->parallel_size();++i) {
347 const stk::mesh::BucketVector& buckets =
bulkData_->buckets(stk::topology::NODE_RANK);
348 for (
size_t j=0;j<buckets.size();++j) {
349 const stk::mesh::Bucket& bucket = *buckets[j];
350 if ( bucket.owned() ) {
351 for (
size_t k=0;k<bucket.size();++k) {
352 stk::mesh::EntityKey key =
bulkData_->entity_key(bucket[k]);
353 comm.send_buffer(i).pack<stk::mesh::EntityKey>(key);
368 for (
int i=0;i<
bulkData_->parallel_size();++i) {
370 while(
comm.recv_buffer(i).remaining()) {
371 stk::mesh::EntityKey key;
372 comm.recv_buffer(i).unpack<stk::mesh::EntityKey>(key);
373 stk::mesh::Entity node =
bulkData_->get_entity(key);
391 "STK_Interface::addNode: STK_Interface must be modifiable to add a node");
393 "STK_Interface::addNode: number of coordinates in vector must mation dimension");
395 "STK_Interface::addNode: STK has STUPID restriction of no zero GIDs, pick something else");
402 for(std::size_t i=0;i<coord.size();++i)
403 fieldCoords[i] = coord[i];
408 std::vector<stk::mesh::Part*> sidesetV;
409 sidesetV.push_back(sideset);
411 bulkData_->change_entity_parts(entity,sidesetV);
416 std::vector<stk::mesh::Part*> nodesetV;
417 nodesetV.push_back(nodeset);
419 bulkData_->change_entity_parts(entity,nodesetV);
424 std::vector<stk::mesh::Part*> blockVec;
425 blockVec.push_back(block);
429 stk::mesh::Entity element =
bulkData_->declare_entity(elementRank,ed->getGID(),blockVec);
432 const std::vector<stk::mesh::EntityId> & nodes = ed->getNodes();
433 for(std::size_t i=0;i<nodes.size();++i) {
435 stk::mesh::Entity node =
bulkData_->get_entity(nodeRank,nodes[i]);
437 bulkData_->declare_relation(element,node,i);
441 procId[0] = Teuchos::as<ProcIdData>(
procRank_);
449 std::vector<stk::mesh::Entity> localElmts;
451 std::vector<stk::mesh::Entity>::const_iterator itr;
452 for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
453 stk::mesh::Entity element = (*itr);
454 stk::mesh::EntityId gid =
bulkData_->identifier(element);
455 std::vector<stk::mesh::EntityId> subcellIds;
458 for(std::size_t i=0;i<subcellIds.size();++i) {
459 stk::mesh::Entity edge =
bulkData_->get_entity(edgeRank,subcellIds[i]);
460 stk::mesh::Entity
const* relations =
bulkData_->begin_nodes(edge);
466 double * edgeCoords = stk::mesh::field_data(*
edgesField_,edge);
468 edgeCoords[i] = (node_coord_1[i]+node_coord_2[i])/2.0;
477 std::vector<stk::mesh::Entity> localElmts;
479 std::vector<stk::mesh::Entity>::const_iterator itr;
480 for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
481 stk::mesh::Entity element = (*itr);
483 std::vector<stk::mesh::EntityId> subcellIds;
486 for(std::size_t i=0;i<subcellIds.size();++i) {
487 stk::mesh::Entity face =
bulkData_->get_entity(faceRank,subcellIds[i]);
488 stk::mesh::Entity
const* relations =
bulkData_->begin_nodes(face);
489 const size_t num_relations =
bulkData_->num_nodes(face);
492 double * faceCoords = stk::mesh::field_data(*
facesField_,face);
495 for(std::size_t j=0;j<num_relations;++j)
497 faceCoords[i] /= double(num_relations);
505 PANZER_FUNC_TIME_MONITOR(
"STK_Interface::writeToExodus(filename)");
507 #ifdef PANZER_HAVE_IOSS 511 stk::io::StkMeshIoBroker meshData(
comm);
513 const int meshIndex = meshData.create_output_mesh(filename, stk::io::WRITE_RESULTS);
514 const stk::mesh::FieldVector &fields =
metaData_->get_fields();
515 for (
size_t i=0; i < fields.size(); i++) {
517 meshData.add_field(meshIndex, *fields[i]);
519 catch (std::runtime_error
const&) { }
522 meshData.process_output_request(meshIndex, 0.0);
530 const size_t num_rels =
bulkData_->num_connectivity(src, tgt_rank);
531 stk::mesh::Entity
const* relations =
bulkData_->begin(src, tgt_rank);
532 stk::mesh::ConnectivityOrdinal
const* ordinals =
bulkData_->begin_ordinals(src, tgt_rank);
533 for (
size_t i = 0; i < num_rels; ++i) {
534 if (ordinals[i] == static_cast<stk::mesh::ConnectivityOrdinal>(rel_id)) {
539 return stk::mesh::Entity();
544 PANZER_FUNC_TIME_MONITOR(
"STK_Interface::setupTransientExodusFile(filename)");
546 #ifdef PANZER_HAVE_IOSS 552 meshIndex_ = meshData_->create_output_mesh(filename, stk::io::WRITE_RESULTS);
553 const stk::mesh::FieldVector &fields =
metaData_->get_fields();
554 for (
size_t i=0; i < fields.size(); i++) {
556 meshData_->add_field(meshIndex_, *fields[i]);
558 catch (std::runtime_error
const&) { }
567 PANZER_FUNC_TIME_MONITOR(
"STK_Interface::writeToExodus(timestep)");
569 #ifdef PANZER_HAVE_IOSS 570 if(meshData_!=Teuchos::null) {
572 meshData_->process_output_request(meshIndex_, timestep);
577 out <<
"WARNING: Exodus I/O has been disabled or not setup properly, not writing to Exodus" << std::endl;
586 #ifdef PANZER_HAVE_IOSS 598 stk::mesh::Entity node =
bulkData_->get_entity(nodeRank,nodeId);
599 const size_t numElements =
bulkData_->num_elements(node);
600 stk::mesh::Entity
const* relations =
bulkData_->begin_elements(node);
603 elements.insert(elements.end(), relations, relations + numElements);
607 std::vector<int> & relIds)
const 610 const size_t numElements =
bulkData_->num_elements(node);
611 stk::mesh::Entity
const* relations =
bulkData_->begin_elements(node);
612 stk::mesh::ConnectivityOrdinal
const* rel_ids =
bulkData_->begin_element_ordinals(node);
615 for (
size_t i = 0; i < numElements; ++i) {
616 stk::mesh::Entity element = relations[i];
620 elements.push_back(element);
621 relIds.push_back(rel_ids[i]);
627 std::vector<int> & relIds,
unsigned int matchType)
const 629 stk::mesh::EntityRank rank;
632 else if(matchType == 1)
634 else if(matchType == 2)
639 stk::mesh::Entity node =
bulkData_->get_entity(rank,nodeId);
646 std::vector<stk::mesh::Entity> current;
649 std::sort(current.begin(),current.end());
652 for(std::size_t n=1;n<nodeIds.size();++n) {
654 std::vector<stk::mesh::Entity> nextNode;
656 std::sort(nextNode.begin(),nextNode.end());
659 std::vector<stk::mesh::Entity> intersection(std::min(nextNode.size(),current.size()));
660 std::vector<stk::mesh::Entity>::const_iterator endItr
661 = std::set_intersection(current.begin(),current.end(),
662 nextNode.begin(),nextNode.end(),
663 intersection.begin());
664 std::size_t newLength = endItr-intersection.begin();
665 intersection.resize(newLength);
669 current = intersection;
678 stk::mesh::Entity
const* nodeRel =
getBulkData()->begin_nodes(element);
679 const size_t numNodes =
getBulkData()->num_nodes(element);
681 nodeIds.reserve(numNodes);
682 for(
size_t i = 0; i < numNodes; ++i) {
697 const unsigned entityRankCount =
metaData_->entity_rank_count();
698 const size_t commCount = 10;
703 stk::ParallelMachine mach = *
mpiComm_->getRawMpiComm();
705 std::vector<stk::mesh::EntityId> local(commCount,0);
708 stk::mesh::Selector ownedPart =
metaData_->locally_owned_part();
709 for(stk::mesh::EntityRank i=stk::topology::NODE_RANK; i<entityRankCount; ++i) {
710 std::vector<stk::mesh::Entity> entities;
712 stk::mesh::get_selected_entities(ownedPart,
bulkData_->buckets(i),entities);
715 std::vector<stk::mesh::Entity>::const_iterator itr;
716 for(itr=entities.begin();itr!=entities.end();++itr) {
717 stk::mesh::EntityId
id =
bulkData_->identifier(*itr);
724 stk::all_reduce(mach,stk::ReduceMax<10>(&local[0]));
725 maxEntityId_.assign(local.begin(),local.begin()+entityRankCount+1);
731 "STK_Interface::getEntityCounts: Entity counts do not include rank: " << entityRank);
739 "STK_Interface::getMaxEntityId: Max entity ids do not include rank: " << entityRank);
746 stk::mesh::PartVector emptyPartVector;
747 stk::mesh::create_adjacent_entities(*
bulkData_,emptyPartVector);
769 std::vector<stk::mesh::EntityId> & subcellIds)
const 772 stk::mesh::Entity cell =
bulkData_->get_entity(elementRank,elementId);
775 "STK_Interface::getSubcellIndices: could not find element requested (GID = " << elementId <<
")");
777 const size_t numSubcells =
bulkData_->num_connectivity(cell, static_cast<stk::mesh::EntityRank>(entityRank));
778 stk::mesh::Entity
const* subcells =
bulkData_->begin(cell, static_cast<stk::mesh::EntityRank>(entityRank));
780 subcellIds.resize(numSubcells,0);
783 for(
size_t i = 0; i < numSubcells; ++i) {
784 stk::mesh::Entity subcell = subcells[i];
785 subcellIds[i] =
bulkData_->identifier(subcell);
792 stk::mesh::Selector ownedPart =
metaData_->locally_owned_part();
796 stk::mesh::get_selected_entities(ownedPart,
bulkData_->buckets(elementRank),elements);
807 stk::mesh::Selector ownedBlock =
metaData_->locally_owned_part() & (*elementBlock);
811 stk::mesh::get_selected_entities(ownedBlock,
bulkData_->buckets(elementRank),elements);
817 stk::mesh::Selector neighborBlock = (!
metaData_->locally_owned_part());
821 stk::mesh::get_selected_entities(neighborBlock,
bulkData_->buckets(elementRank),elements);
831 stk::mesh::Selector neighborBlock = (!
metaData_->locally_owned_part()) & (*elementBlock);
835 stk::mesh::get_selected_entities(neighborBlock,
bulkData_->buckets(elementRank),elements);
840 stk::mesh::Part * sidePart =
getSideset(sideName);
842 "Unknown side set \"" << sideName <<
"\"");
844 stk::mesh::Selector side = *sidePart;
845 stk::mesh::Selector ownedBlock =
metaData_->locally_owned_part() & side;
853 stk::mesh::Part * sidePart =
getSideset(sideName);
856 "Unknown side set \"" << sideName <<
"\"");
858 "Unknown element block \"" << blockName <<
"\"");
860 stk::mesh::Selector side = *sidePart;
861 stk::mesh::Selector block = *elmtPart;
862 stk::mesh::Selector ownedBlock =
metaData_->locally_owned_part() & block & side;
870 stk::mesh::Part * sidePart =
getSideset(sideName);
872 "Unknown side set \"" << sideName <<
"\"");
874 stk::mesh::Selector side = *sidePart;
882 stk::mesh::Part * sidePart =
getSideset(sideName);
885 "Unknown side set \"" << sideName <<
"\"");
887 "Unknown element block \"" << blockName <<
"\"");
889 stk::mesh::Selector side = *sidePart;
890 stk::mesh::Selector block = *elmtPart;
891 stk::mesh::Selector sideBlock = block & side;
897 void STK_Interface::getMyNodes(
const std::string & nodesetName,
const std::string & blockName,std::vector<stk::mesh::Entity> & nodes)
const 899 stk::mesh::Part * nodePart =
getNodeset(nodesetName);
902 "Unknown node set \"" << nodesetName <<
"\"");
904 "Unknown element block \"" << blockName <<
"\"");
906 stk::mesh::Selector nodeset = *nodePart;
907 stk::mesh::Selector block = *elmtPart;
908 stk::mesh::Selector ownedBlock =
metaData_->locally_owned_part() & block & nodeset;
921 std::map<std::string, stk::mesh::Part*>::const_iterator blkItr;
923 names.push_back(blkItr->first);
933 std::map<std::string, stk::mesh::Part*>::const_iterator sideItr;
935 names.push_back(sideItr->first);
943 std::map<std::string, stk::mesh::Part*>::const_iterator nodeItr;
945 names.push_back(nodeItr->first);
961 std::unordered_map<stk::mesh::EntityId,std::size_t>::const_iterator itr =
localIDHash_.find(gid);
969 std::map<std::string,stk::mesh::Part*>::const_iterator itr;
971 if(
bulkData_->bucket(elmt).member(*itr->second))
977 const std::string & blockId)
const 985 "Solution field name \"" << fieldName <<
"\" in block ID \"" << blockId <<
"\" was not found");
991 const std::string & blockId)
const 999 "Cell field named \"" << fieldName <<
"\" in block ID \"" << blockId <<
"\" was not found");
1001 return iter->second;
1021 stk::mesh::Part * block =
metaData_->get_part(name);
1023 block = &
metaData_->declare_part_with_topology(name, stk::mesh::get_topology(shards::CellTopology(ctData)));
1066 std::vector<stk::mesh::Entity> elements;
1069 for(std::size_t index=0;index<elements.size();++index) {
1070 stk::mesh::Entity element = elements[index];
1074 procId[0] = Teuchos::as<ProcIdData>(
procRank_);
1087 for(std::size_t index=0;index<elements.size();++index) {
1088 stk::mesh::Entity element = elements[index];
1092 procId[0] = Teuchos::as<ProcIdData>(
procRank_);
1104 std::vector<std::string> names;
1107 for(std::size_t b=0;b<names.size();b++) {
1109 std::map<std::string,double>::const_iterator bw_itr =
blockWeights_.find(names[b]);
1110 double blockWeight = (bw_itr!=
blockWeights_.end()) ? bw_itr->second : 1.0;
1112 std::vector<stk::mesh::Entity> elements;
1115 for(std::size_t index=0;index<elements.size();++index) {
1117 double * loadBal = stk::mesh::field_data(*
loadBalField_,elements[index]);
1118 loadBal[0] = blockWeight;
1125 const std::string & fieldName,
1128 std::map<std::string,std::vector<std::string> >::const_iterator blkItr =
meshCoordFields_.find(eBlock);
1134 for(axis=0;axis<Teuchos::as<int>(blkItr->second.size());axis++) {
1135 if(blkItr->second[axis]==fieldName)
1139 if(axis>=Teuchos::as<int>(blkItr->second.size()))
1150 const std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > & matchers =
getPeriodicBCVector();
1153 for(std::size_t m=0;m<matchers.size();m++){
1154 vec = matchers[m]->getMatchedPair(*
this,vec);
1156 if(matchers[m]->getType() ==
"coord")
1158 else if(matchers[m]->getType() ==
"edge")
1160 else if(matchers[m]->getType() ==
"face")
1164 type_vec->insert(type_vec->begin(),vec->size()-type_vec->size(),type);
1167 return std::make_pair(vec,type_vec);
1172 std::map<std::string, stk::mesh::Part*>::const_iterator blkItr =
elementBlocks_.find(blockId);
1179 std::vector<std::string> blockNames, sidesetNames, nodesetNames;
1185 os <<
"STK Mesh data:\n";
1188 os <<
" Entity counts (Nodes, Edges, Cells) = ( " 1193 os <<
" Entity counts (Nodes, Edges, Faces, Cells) = ( " 1199 os <<
" Entity counts (Nodes, Cells) = ( " 1203 os <<
" Element blocks = ";
1204 for(std::size_t i=0;i<blockNames.size();i++)
1205 os <<
"\"" << blockNames[i] <<
"\" ";
1207 os <<
" Sidesets = ";
1208 for(std::size_t i=0;i<sidesetNames.size();i++)
1209 os <<
"\"" << sidesetNames[i] <<
"\" ";
1211 os <<
" Nodesets = ";
1212 for(std::size_t i=0;i<nodesetNames.size();i++)
1213 os <<
"\"" << nodesetNames[i] <<
"\" ";
1217 const std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > & bcVector
1219 if(bcVector.size()!=0) {
1220 os <<
" Periodic BCs:\n";
1221 for(std::size_t i=0;i<bcVector.size();i++)
1222 os <<
" " << bcVector[i]->getString() <<
"\n";
1229 std::vector<std::string> blockNames, sidesetNames, nodesetNames;
1235 os <<
"STK Meta data:\n";
1236 os <<
" Element blocks = ";
1237 for(std::size_t i=0;i<blockNames.size();i++)
1238 os <<
"\"" << blockNames[i] <<
"\" ";
1240 os <<
" Sidesets = ";
1241 for(std::size_t i=0;i<sidesetNames.size();i++)
1242 os <<
"\"" << sidesetNames[i] <<
"\" ";
1244 os <<
" Nodesets = ";
1245 for(std::size_t i=0;i<nodesetNames.size();i++)
1246 os <<
"\"" << nodesetNames[i] <<
"\" ";
1250 const std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > & bcVector
1252 if(bcVector.size()!=0) {
1253 os <<
" Periodic BCs:\n";
1254 for(std::size_t i=0;i<bcVector.size();i++)
1255 os <<
" " << bcVector[i]->getString() <<
"\n";
1261 const stk::mesh::FieldVector & fv =
metaData_->get_fields();
1262 for(std::size_t i=0;i<fv.size();i++)
1263 os <<
"\"" << fv[i]->name() <<
"\" ";
1269 std::map<std::string, Teuchos::RCP<shards::CellTopology> >::const_iterator itr;
1273 std::stringstream ss;
1276 "STK_Interface::getCellTopology: No such element block \"" +eBlock +
"\" available.\n\n" 1277 <<
"STK Meta Data follows: \n" << ss.str());
1286 const int err = MPI_Comm_dup (parallelMach, &newComm);
1288 "panzer::STK_Interface: MPI_Comm_dup failed with error \"" 1289 << Teuchos::mpiErrorCodeToString (err) <<
"\".");
1291 return Teuchos::rcp(
new Teuchos::MpiComm<int>(Teuchos::opaqueWrapper (newComm,MPI_Comm_free)));
1301 stk::mesh::Selector selector(
getMetaData()->universal_part());
1302 stk::mesh::Selector owned_selector(
getMetaData()->locally_owned_part());
1311 graph.
sublist(stk::rebalance::Zoltan::default_parameters_name()) = params;
void initializeFromMetaData()
Teuchos::RCP< ElementDescriptor > buildElementDescriptor(stk::mesh::EntityId elmtId, std::vector< stk::mesh::EntityId > &nodes)
Teuchos::RCP< stk::mesh::MetaData > getMetaData() const
stk::mesh::Part * getElementBlockPart(const std::string &name) const
get the block count
bool isMeshCoordField(const std::string &eBlock, const std::string &fieldName, int &axis) const
void addNodeset(const std::string &name)
Teuchos::RCP< stk::mesh::BulkData > bulkData_
void getMySides(const std::string &sideName, std::vector< stk::mesh::Entity > &sides) const
std::vector< stk::mesh::Part * > facesPartVec_
std::map< std::pair< std::string, std::string >, SolutionFieldType * > fieldNameToSolution_
void addEntityToNodeset(stk::mesh::Entity entity, stk::mesh::Part *nodeset)
stk::mesh::EntityRank getFaceRank() const
std::string containingBlockId(stk::mesh::Entity elmt)
ConstIterator begin() const
std::size_t elementLocalId(stk::mesh::Entity elmt) const
stk::mesh::Field< double > SolutionFieldType
std::vector< stk::mesh::Part * > edgesPartVec_
std::map< std::string, double > blockWeights_
VectorFieldType * coordinatesField_
bool isModifiable() const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void getMyElements(std::vector< stk::mesh::Entity > &elements) const
void addEntityToSideset(stk::mesh::Entity entity, stk::mesh::Part *sideset)
stk::mesh::Part * nodesPart_
stk::mesh::EntityRank getNodeRank() const
void addSolutionField(const std::string &fieldName, const std::string &blockId)
std::map< std::string, Teuchos::RCP< shards::CellTopology > > elementBlockCT_
Teuchos::RCP< stk::mesh::BulkData > getBulkData() const
std::size_t currentLocalId_
std::map< std::string, stk::mesh::Part * > sidesets_
std::vector< std::size_t > entityCounts_
void getElementsSharingNode(stk::mesh::EntityId nodeId, std::vector< stk::mesh::Entity > &elements) const
get a set of elements sharing a single node
void getSubcellIndices(unsigned entityRank, stk::mesh::EntityId elementId, std::vector< stk::mesh::EntityId > &subcellIds) const
stk::mesh::EntityRank getSideRank() const
void initialize(stk::ParallelMachine parallelMach, bool setupIO=true)
SolutionFieldType * loadBalField_
stk::mesh::Entity findConnectivityById(stk::mesh::Entity src, stk::mesh::EntityRank tgt_rank, unsigned rel_id) const
static const std::string nodesString
const double * getNodeCoordinates(stk::mesh::EntityId nodeId) const
void instantiateBulkData(stk::ParallelMachine parallelMach)
void getElementBlockNames(std::vector< std::string > &names) const
stk::mesh::EntityRank getEdgeRank() const
stk::mesh::Part * getSideset(const std::string &name) const
ConstIterator end() const
unsigned getDimension() const
get the dimension
void addElement(const Teuchos::RCP< ElementDescriptor > &ed, stk::mesh::Part *block)
std::map< std::string, std::vector< std::string > > meshDispFields_
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
VectorFieldType * edgesField_
stk::mesh::EntityId elementGlobalId(std::size_t lid) const
void getNodeIdsForElement(stk::mesh::Entity element, std::vector< stk::mesh::EntityId > &nodeIds) const
get a list of node ids for nodes connected to an element
static const std::string coordsString
stk::mesh::Field< double, stk::mesh::Cartesian > VectorFieldType
stk::mesh::Field< double > * getCellField(const std::string &fieldName, const std::string &blockId) const
std::size_t getEntityCounts(unsigned entityRank) const
get the global counts for the entity of specified rank
void writeToExodus(const std::string &filename)
void setupTransientExodusFile(const std::string &filename)
std::map< std::string, stk::mesh::Part * > elementBlocks_
std::vector< stk::mesh::Part * > nodesPartVec_
static const std::string edgesString
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
void printMetaData(std::ostream &os) const
PHX::MDField< const ScalarT, Cell, IP > field
void initializeFieldsInSTK(const std::map< std::pair< std::string, std::string >, SolutionFieldType *> &nameToField, bool setupIO)
Teuchos::RCP< const std::vector< stk::mesh::Entity > > getElementsOrderedByLID() const
void addNode(stk::mesh::EntityId gid, const std::vector< double > &coord)
const std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > & getPeriodicBCVector() const
void buildSubcells()
force the mesh to build subcells: edges and faces
Teuchos::RCP< Teuchos::MpiComm< int > > mpiComm_
Teuchos::RCP< stk::mesh::MetaData > metaData_
virtual ~ElementDescriptor()
Teuchos::RCP< std::vector< stk::mesh::Entity > > orderedElementVector_
void addMeshCoordFields(const std::string &blockId, const std::vector< std::string > &coordField, const std::string &dispPrefix)
void applyElementLoadBalanceWeights()
bool validBlockId(const std::string &blockId) const
void addSideset(const std::string &name, const CellTopologyData *ctData)
void rebalance(const Teuchos::ParameterList ¶ms)
Teuchos::RCP< const shards::CellTopology > getCellTopology(const std::string &eBlock) const
void getAllSides(const std::string &sideName, std::vector< stk::mesh::Entity > &sides) const
Teuchos::RCP< const Teuchos::Comm< int > > comm
void getSidesetNames(std::vector< std::string > &name) const
std::map< std::string, std::vector< std::string > > meshCoordFields_
static const std::string facesString
Teuchos::RCP< Teuchos::MpiComm< int > > getSafeCommunicator(stk::ParallelMachine parallelMach) const
std::pair< Teuchos::RCP< std::vector< std::pair< std::size_t, std::size_t > > >, Teuchos::RCP< std::vector< unsigned int > > > getPeriodicNodePairing() const
void getNodesetNames(std::vector< std::string > &name) const
void buildLocalElementIDs()
std::unordered_map< stk::mesh::EntityId, std::size_t > localIDHash_
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
std::vector< stk::mesh::EntityId > maxEntityId_
const VectorFieldType & getCoordinatesField() const
void print(std::ostream &os) const
stk::mesh::EntityRank getElementRank() const
stk::mesh::Field< ProcIdData > ProcIdFieldType
stk::mesh::EntityId getMaxEntityId(unsigned entityRank) const
get max entity ID of type entityRank
#define TEUCHOS_ASSERT(assertion_test)
void addCellField(const std::string &fieldName, const std::string &blockId)
RCP< const T > getConst() const
stk::mesh::Part * edgesPart_
void getMyNodes(const std::string &sideName, const std::string &blockName, std::vector< stk::mesh::Entity > &nodes) const
void getElementsSharingNodes(const std::vector< stk::mesh::EntityId > nodeId, std::vector< stk::mesh::Entity > &elements) const
get a set of elements sharing multiple nodes
stk::mesh::Part * facesPart_
ProcIdFieldType * processorIdField_
void addElementBlock(const std::string &name, const CellTopologyData *ctData)
void getOwnedElementsSharingNode(stk::mesh::Entity node, std::vector< stk::mesh::Entity > &elements, std::vector< int > &relIds) const
stk::mesh::Part * getNodeset(const std::string &name) const
stk::mesh::Field< double > * getSolutionField(const std::string &fieldName, const std::string &blockId) const
std::map< std::pair< std::string, std::string >, SolutionFieldType * > fieldNameToCellField_
std::map< std::string, stk::mesh::Part * > nodesets_
VectorFieldType * facesField_
void getNeighborElements(std::vector< stk::mesh::Entity > &elements) const