Panzer  Version of the Day
Panzer_STK_Interface.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Panzer: A partial differential equation assembly
5 // engine for strongly coupled complex multiphysics systems
6 // Copyright (2011) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39 // Eric C. Cyr (eccyr@sandia.gov)
40 // ***********************************************************************
41 // @HEADER
42 
43 #ifndef __Panzer_STK_Interface_hpp__
44 #define __Panzer_STK_Interface_hpp__
45 
46 #include <Teuchos_RCP.hpp>
47 #include <Teuchos_DefaultMpiComm.hpp>
48 
49 #include <stk_mesh/base/Types.hpp>
50 #include <stk_mesh/base/MetaData.hpp>
51 #include <stk_mesh/base/BulkData.hpp>
52 #include <stk_mesh/base/Field.hpp>
53 #include <stk_mesh/base/FieldBase.hpp>
54 #include <stk_mesh/base/MetaData.hpp>
55 #include <stk_mesh/base/CoordinateSystems.hpp>
56 
57 #include "Kokkos_Core.hpp"
58 
59 #include <Shards_CellTopology.hpp>
60 #include <Shards_CellTopologyData.h>
61 
62 #include <PanzerAdaptersSTK_config.hpp>
63 #include <Kokkos_ViewFactory.hpp>
64 
65 #include <unordered_map>
66 
67 #ifdef PANZER_HAVE_IOSS
68 #include <stk_io/StkMeshIoBroker.hpp>
69 #endif
70 
71 namespace panzer_stk {
72 
73 class PeriodicBC_MatcherBase;
74 
79 public:
80  ElementDescriptor(stk::mesh::EntityId gid,const std::vector<stk::mesh::EntityId> & nodes);
81  virtual ~ElementDescriptor();
82 
83  stk::mesh::EntityId getGID() const { return gid_; }
84  const std::vector<stk::mesh::EntityId> & getNodes() const { return nodes_; }
85 protected:
86  stk::mesh::EntityId gid_;
87  std::vector<stk::mesh::EntityId> nodes_;
88 
90 };
91 
94 Teuchos::RCP<ElementDescriptor>
95 buildElementDescriptor(stk::mesh::EntityId elmtId,std::vector<stk::mesh::EntityId> & nodes);
96 
98 public:
99  typedef double ProcIdData; // ECC: Not sure why?
100  typedef stk::mesh::Field<double> SolutionFieldType;
101  typedef stk::mesh::Field<double,stk::mesh::Cartesian> VectorFieldType;
102  typedef stk::mesh::Field<ProcIdData> ProcIdFieldType;
103 
104  // some simple exception classes
105  struct ElementBlockException : public std::logic_error
106  { ElementBlockException(const std::string & what) : std::logic_error(what) {} };
107 
108  struct SidesetException : public std::logic_error
109  { SidesetException(const std::string & what) : std::logic_error(what) {} };
110 
111  STK_Interface();
112 
115  STK_Interface(unsigned dim);
116 
117  STK_Interface(Teuchos::RCP<stk::mesh::MetaData> metaData);
118 
119  // functions called before initialize
121 
124  void addElementBlock(const std::string & name,const CellTopologyData * ctData);
125 
128  void addSideset(const std::string & name,const CellTopologyData * ctData);
129 
132  void addNodeset(const std::string & name);
133 
136  void addSolutionField(const std::string & fieldName,const std::string & blockId);
137 
140  void addCellField(const std::string & fieldName,const std::string & blockId);
141 
150  void addMeshCoordFields(const std::string & blockId,
151  const std::vector<std::string> & coordField,
152  const std::string & dispPrefix);
153 
155 
163  void initialize(stk::ParallelMachine parallelMach,bool setupIO=true);
164 
170  void instantiateBulkData(stk::ParallelMachine parallelMach);
171 
172  // functions to manage and manipulate bulk data
174 
177  void beginModification();
178 
181  void endModification();
182 
188  void addNode(stk::mesh::EntityId gid, const std::vector<double> & coord);
189 
190  void addElement(const Teuchos::RCP<ElementDescriptor> & ed,stk::mesh::Part * block);
191 
192  void addEdges();
193 
194  void addFaces();
195 
198  void addEntityToSideset(stk::mesh::Entity entity,stk::mesh::Part * sideset);
199 
202  void addEntityToNodeset(stk::mesh::Entity entity,stk::mesh::Part * nodeset);
203 
204  // Methods to interrogate the mesh topology and structure
206 
210  { return *coordinatesField_; }
211 
215  { return *edgesField_; }
216 
218  { return *facesField_; }
219 
222  const double * getNodeCoordinates(stk::mesh::EntityId nodeId) const;
223 
226  const double * getNodeCoordinates(stk::mesh::Entity node) const;
227 
230  void getSubcellIndices(unsigned entityRank,stk::mesh::EntityId elementId,
231  std::vector<stk::mesh::EntityId> & subcellIds) const;
232 
235  void getMyElements(std::vector<stk::mesh::Entity> & elements) const;
236 
239  void getMyElements(const std::string & blockID,std::vector<stk::mesh::Entity> & elements) const;
240 
244  void getNeighborElements(std::vector<stk::mesh::Entity> & elements) const;
245 
248  void getNeighborElements(const std::string & blockID,std::vector<stk::mesh::Entity> & elements) const;
249 
257  void getMySides(const std::string & sideName,std::vector<stk::mesh::Entity> & sides) const;
258 
267  void getMySides(const std::string & sideName,const std::string & blockName,std::vector<stk::mesh::Entity> & sides) const;
268 
276  void getAllSides(const std::string & sideName,std::vector<stk::mesh::Entity> & sides) const;
277 
287  void getAllSides(const std::string & sideName,const std::string & blockName,std::vector<stk::mesh::Entity> & sides) const;
288 
298  void getMyNodes(const std::string & sideName,const std::string & blockName,std::vector<stk::mesh::Entity> & nodes) const;
299 
308  stk::mesh::Entity findConnectivityById(stk::mesh::Entity src, stk::mesh::EntityRank tgt_rank, unsigned rel_id) const;
309 
310  // Utility functions
312 
316  void writeToExodus(const std::string & filename);
317 
322  void setupTransientExodusFile(const std::string & filename);
323 
328  void writeToExodus(double timestep);
329 
330  // Accessor functions
332 
333  Teuchos::RCP<stk::mesh::BulkData> getBulkData() const { return bulkData_; }
334  Teuchos::RCP<stk::mesh::MetaData> getMetaData() const { return metaData_; }
335 
336  bool isWritable() const;
337 
338  bool isModifiable() const
339  { if(bulkData_==Teuchos::null) return false;
340  return bulkData_->in_modifiable_state(); }
341 
343  unsigned getDimension() const
344  { return dimension_; }
345 
347  std::size_t getNumElementBlocks() const
348  { return elementBlocks_.size(); }
349 
357  void getElementBlockNames(std::vector<std::string> & names) const;
358 
366  void getSidesetNames(std::vector<std::string> & name) const;
367 
375  void getNodesetNames(std::vector<std::string> & name) const;
376 
378  stk::mesh::Part * getOwnedPart() const
379  { return &getMetaData()->locally_owned_part(); } // I don't like the pointer access here, but it will do for now!
380 
382  stk::mesh::Part * getElementBlockPart(const std::string & name) const
383  {
384  std::map<std::string, stk::mesh::Part*>::const_iterator itr = elementBlocks_.find(name); // Element blocks
385  if(itr==elementBlocks_.end()) return 0;
386  return itr->second;
387  }
388 
390  std::size_t getNumSidesets() const
391  { return sidesets_.size(); }
392 
393  stk::mesh::Part * getSideset(const std::string & name) const
394  { return sidesets_.find(name)->second; }
395 
397  std::size_t getNumNodesets() const
398  { return nodesets_.size(); }
399 
400  stk::mesh::Part * getNodeset(const std::string & name) const
401  { return nodesets_.find(name)->second; }
402 
404  std::size_t getEntityCounts(unsigned entityRank) const;
405 
407  stk::mesh::EntityId getMaxEntityId(unsigned entityRank) const;
408 
409  // Utilities
411 
413  void getElementsSharingNode(stk::mesh::EntityId nodeId,std::vector<stk::mesh::Entity> & elements) const;
414 
416  void getNodeIdsForElement(stk::mesh::Entity element,std::vector<stk::mesh::EntityId> & nodeIds) const;
417 
420  void getOwnedElementsSharingNode(stk::mesh::Entity node,std::vector<stk::mesh::Entity> & elements,
421  std::vector<int> & relIds) const;
422 
425  void getOwnedElementsSharingNode(stk::mesh::EntityId nodeId,std::vector<stk::mesh::Entity> & elements,
426  std::vector<int> & relIds, unsigned int matchType) const;
427 
428 
430  void getElementsSharingNodes(const std::vector<stk::mesh::EntityId> nodeId,std::vector<stk::mesh::Entity> & elements) const;
431 
433  void buildSubcells();
434 
437  std::size_t elementLocalId(stk::mesh::Entity elmt) const;
438 
441  std::size_t elementLocalId(stk::mesh::EntityId gid) const;
442 
445  inline stk::mesh::EntityId elementGlobalId(std::size_t lid) const
446  { return bulkData_->identifier((*orderedElementVector_)[lid]); }
447 
450  inline stk::mesh::EntityId elementGlobalId(stk::mesh::Entity elmt) const
451  { return bulkData_->identifier(elmt); }
452 
455  inline unsigned entityOwnerRank(stk::mesh::Entity entity) const
456  { return bulkData_->parallel_owner_rank(entity); }
457 
460  inline bool isValid(stk::mesh::Entity entity) const
461  { return bulkData_->is_valid(entity); }
462 
465  std::string containingBlockId(stk::mesh::Entity elmt);
466 
471  stk::mesh::Field<double> * getSolutionField(const std::string & fieldName,
472  const std::string & blockId) const;
473 
478  stk::mesh::Field<double> * getCellField(const std::string & fieldName,
479  const std::string & blockId) const;
480 
482 
484  bool isInitialized() const { return initialized_; }
485 
489  Teuchos::RCP<const std::vector<stk::mesh::Entity> > getElementsOrderedByLID() const;
490 
505  template <typename ArrayT>
506  void setSolutionFieldData(const std::string & fieldName,const std::string & blockId,
507  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues,double scaleValue=1.0);
508 
523  template <typename ArrayT>
524  void getSolutionFieldData(const std::string & fieldName,const std::string & blockId,
525  const std::vector<std::size_t> & localElementIds,ArrayT & solutionValues) const;
526 
541  template <typename ArrayT>
542  void setCellFieldData(const std::string & fieldName,const std::string & blockId,
543  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues,double scaleValue=1.0);
544 
553  template <typename ArrayT>
554  void getElementVertices(const std::vector<std::size_t> & localIds, ArrayT & vertices) const;
555 
564  template <typename ArrayT>
565  void getElementVertices(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const;
566 
576  template <typename ArrayT>
577  void getElementVertices(const std::vector<std::size_t> & localIds,const std::string & eBlock, ArrayT & vertices) const;
578 
588  template <typename ArrayT>
589  void getElementVertices(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const;
590 
599  template <typename ArrayT>
600  void getElementVerticesNoResize(const std::vector<std::size_t> & localIds, ArrayT & vertices) const;
601 
610  template <typename ArrayT>
611  void getElementVerticesNoResize(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const;
612 
622  template <typename ArrayT>
623  void getElementVerticesNoResize(const std::vector<std::size_t> & localIds,const std::string & eBlock, ArrayT & vertices) const;
624 
634  template <typename ArrayT>
635  void getElementVerticesNoResize(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const;
636 
637  // const stk::mesh::FEMInterface & getFEMInterface() const
638  // { return *femPtr_; }
639 
640  stk::mesh::EntityRank getElementRank() const { return stk::topology::ELEMENT_RANK; }
641  stk::mesh::EntityRank getSideRank() const { return metaData_->side_rank(); }
642  stk::mesh::EntityRank getFaceRank() const { return stk::topology::FACE_RANK; }
643  stk::mesh::EntityRank getEdgeRank() const { return stk::topology::EDGE_RANK; }
644  stk::mesh::EntityRank getNodeRank() const { return stk::topology::NODE_RANK; }
645 
648  void initializeFromMetaData();
649 
652  void buildLocalElementIDs();
653 
656  const std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > &
658  { return periodicBCs_; }
659 
662  std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > &
664  { return periodicBCs_; }
665 
671  void addPeriodicBC(const Teuchos::RCP<const PeriodicBC_MatcherBase> & bc)
672  { periodicBCs_.push_back(bc); }
673 
679  void addPeriodicBCs(const std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > & bc_vec)
680  { periodicBCs_.insert(periodicBCs_.end(),bc_vec.begin(),bc_vec.end()); }
681 
682  std::pair<Teuchos::RCP<std::vector<std::pair<std::size_t,std::size_t> > >, Teuchos::RCP<std::vector<unsigned int> > >
683  getPeriodicNodePairing() const;
684 
687  bool validBlockId(const std::string & blockId) const;
688 
691  void print(std::ostream & os) const;
692 
695  void printMetaData(std::ostream & os) const;
696 
699  Teuchos::RCP<const shards::CellTopology> getCellTopology(const std::string & eBlock) const;
700 
705  double getCurrentStateTime() const { return currentStateTime_; }
706 
712  double getInitialStateTime() const { return initialStateTime_; }
713 
719 
722  void rebalance(const Teuchos::ParameterList & params);
723 
727  void setBlockWeight(const std::string & blockId,double weight)
728  { blockWeights_[blockId] = weight; }
729 
736  void setUseFieldCoordinates(bool useFieldCoordinates)
737  { useFieldCoordinates_ = useFieldCoordinates; }
738 
741  { return useFieldCoordinates_; }
742 
744  void setUseLowerCaseForIO(bool useLowerCase)
745  { useLowerCase_ = useLowerCase; }
746 
748  bool getUseLowerCaseForIO() const
749  { return useLowerCase_; }
750 
761  template <typename ArrayT>
762  void getElementVertices_FromField(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const;
763 
764  template <typename ArrayT>
765  void getElementVertices_FromFieldNoResize(const std::vector<stk::mesh::Entity> & elements,
766  const std::string & eBlock, ArrayT & vertices) const;
767 
777  template <typename ArrayT>
778  void getElementVertices_FromCoords(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const;
779 
780  template <typename ArrayT>
781  void getElementVertices_FromCoordsNoResize(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const;
782 
783 public: // static operations
784  static const std::string coordsString;
785  static const std::string nodesString;
786  static const std::string edgesString;
787  static const std::string facesString;
788 
789 protected:
790 
793  void buildEntityCounts();
794 
797  void buildMaxEntityIds();
798 
802  void initializeFieldsInSTK(const std::map<std::pair<std::string,std::string>,SolutionFieldType*> & nameToField,
803  bool setupIO);
804 
809  Teuchos::RCP<Teuchos::MpiComm<int> > getSafeCommunicator(stk::ParallelMachine parallelMach) const;
810 
817 
821  bool isMeshCoordField(const std::string & eBlock,const std::string & fieldName,int & axis) const;
822 
838  template <typename ArrayT>
839  void setDispFieldData(const std::string & fieldName,const std::string & blockId,int axis,
840  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues);
841 
842  std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > periodicBCs_;
843 
844  Teuchos::RCP<stk::mesh::MetaData> metaData_;
845  Teuchos::RCP<stk::mesh::BulkData> bulkData_;
846 
847  std::map<std::string, stk::mesh::Part*> elementBlocks_; // Element blocks
848  std::map<std::string, stk::mesh::Part*> sidesets_; // Side sets
849  std::map<std::string, stk::mesh::Part*> nodesets_; // Node sets
850  std::map<std::string, Teuchos::RCP<shards::CellTopology> > elementBlockCT_;
851 
852  // for storing/accessing nodes
853  stk::mesh::Part * nodesPart_;
854  std::vector<stk::mesh::Part*> nodesPartVec_;
855  stk::mesh::Part * edgesPart_;
856  std::vector<stk::mesh::Part*> edgesPartVec_;
857  stk::mesh::Part * facesPart_;
858  std::vector<stk::mesh::Part*> facesPartVec_;
859 
865 
866  // maps field names to solution field stk mesh handles
867  std::map<std::pair<std::string,std::string>,SolutionFieldType*> fieldNameToSolution_;
868  std::map<std::pair<std::string,std::string>,SolutionFieldType*> fieldNameToCellField_;
869 
870  unsigned dimension_;
871 
873 
874  // how many elements, faces, edges, and nodes are there globally
875  std::vector<std::size_t> entityCounts_;
876 
877  // what is maximum entity ID
878  std::vector<stk::mesh::EntityId> maxEntityId_;
879 
880  unsigned procRank_;
881  std::size_t currentLocalId_;
882 
883  Teuchos::RCP<Teuchos::MpiComm<int> > mpiComm_;
884 
885  double initialStateTime_; // the time stamp at the time this object was constructed (default 0.0)
886  double currentStateTime_; // the time stamp set by the user when writeToExodus is called (default 0.0)
887 
888 #ifdef PANZER_HAVE_IOSS
889  // I/O support
890  Teuchos::RCP<stk::io::StkMeshIoBroker> meshData_;
891  int meshIndex_;
892 #endif
893 
894  // uses lazy evaluation
895  mutable Teuchos::RCP<std::vector<stk::mesh::Entity> > orderedElementVector_;
896 
897  // for element block weights
898  std::map<std::string,double> blockWeights_;
899 
900  std::unordered_map<stk::mesh::EntityId,std::size_t> localIDHash_;
901 
902  // Store mesh displacement fields by element block. This map
903  // goes like this meshCoordFields_[eBlock][axis_index] => coordinate FieldName
904  // goes like this meshDispFields_[eBlock][axis_index] => displacement FieldName
905  std::map<std::string,std::vector<std::string> > meshCoordFields_; // coordinate fields written by user
906  std::map<std::string,std::vector<std::string> > meshDispFields_; // displacement fields, output to exodus
907 
909 
911 
912  // Object describing how to sort a vector of elements using
913  // local ID as the key, very short lived object
915  public:
916  LocalIdCompare(const STK_Interface * mesh) : mesh_(mesh) {}
917 
918  // Compares two stk mesh entities based on local ID
919  bool operator() (stk::mesh::Entity a,stk::mesh::Entity b)
920  { return mesh_->elementLocalId(a) < mesh_->elementLocalId(b);}
921 
922  private:
924  };
925 };
926 
927 template <typename ArrayT>
928 void STK_Interface::setSolutionFieldData(const std::string & fieldName,const std::string & blockId,
929  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues,double scaleValue)
930 {
931  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
932 
933  int field_axis = -1;
934  if(isMeshCoordField(blockId,fieldName,field_axis)) {
935  setDispFieldData(fieldName,blockId,field_axis,localElementIds,solutionValues);
936  return;
937  }
938 
939  SolutionFieldType * field = this->getSolutionField(fieldName,blockId);
940 
941  for(std::size_t cell=0;cell<localElementIds.size();cell++) {
942  std::size_t localId = localElementIds[cell];
943  stk::mesh::Entity element = elements[localId];
944 
945  // loop over nodes set solution values
946  const size_t num_nodes = bulkData_->num_nodes(element);
947  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
948  for(std::size_t i=0; i<num_nodes; ++i) {
949  stk::mesh::Entity node = nodes[i];
950 
951  double * solnData = stk::mesh::field_data(*field,node);
952  // TEUCHOS_ASSERT(solnData!=0); // only needed if blockId is not specified
953  solnData[0] = scaleValue*solutionValues(cell,i);
954  }
955  }
956 }
957 
958 template <typename ArrayT>
959 void STK_Interface::setDispFieldData(const std::string & fieldName,const std::string & blockId,int axis,
960  const std::vector<std::size_t> & localElementIds,const ArrayT & dispValues)
961 {
962  TEUCHOS_ASSERT(axis>=0); // sanity check
963 
964  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
965 
966  SolutionFieldType * field = this->getSolutionField(fieldName,blockId);
967  const VectorFieldType & coord_field = this->getCoordinatesField();
968 
969  for(std::size_t cell=0;cell<localElementIds.size();cell++) {
970  std::size_t localId = localElementIds[cell];
971  stk::mesh::Entity element = elements[localId];
972 
973  // loop over nodes set solution values
974  const size_t num_nodes = bulkData_->num_nodes(element);
975  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
976  for(std::size_t i=0; i<num_nodes; ++i) {
977  stk::mesh::Entity node = nodes[i];
978 
979  double * solnData = stk::mesh::field_data(*field,node);
980  double * coordData = stk::mesh::field_data(coord_field,node);
981  // TEUCHOS_ASSERT(solnData!=0); // only needed if blockId is not specified
982  solnData[0] = dispValues(cell,i)-coordData[axis];
983  }
984  }
985 }
986 
987 template <typename ArrayT>
988 void STK_Interface::getSolutionFieldData(const std::string & fieldName,const std::string & blockId,
989  const std::vector<std::size_t> & localElementIds,ArrayT & solutionValues) const
990 {
991  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
992 
993  solutionValues = Kokkos::createDynRankView(solutionValues,
994  "solutionValues",
995  localElementIds.size(),
996  bulkData_->num_nodes(elements[localElementIds[0]]));
997 
998  SolutionFieldType * field = this->getSolutionField(fieldName,blockId);
999 
1000  for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1001  std::size_t localId = localElementIds[cell];
1002  stk::mesh::Entity element = elements[localId];
1003 
1004  // loop over nodes set solution values
1005  const size_t num_nodes = bulkData_->num_nodes(element);
1006  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1007  for(std::size_t i=0; i<num_nodes; ++i) {
1008  stk::mesh::Entity node = nodes[i];
1009 
1010  double * solnData = stk::mesh::field_data(*field,node);
1011  // TEUCHOS_ASSERT(solnData!=0); // only needed if blockId is not specified
1012  solutionValues(cell,i) = solnData[0];
1013  }
1014  }
1015 }
1016 
1017 template <typename ArrayT>
1018 void STK_Interface::setCellFieldData(const std::string & fieldName,const std::string & blockId,
1019  const std::vector<std::size_t> & localElementIds,const ArrayT & solutionValues,double scaleValue)
1020 {
1021  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1022 
1023  SolutionFieldType * field = this->getCellField(fieldName,blockId);
1024 
1025  for(std::size_t cell=0;cell<localElementIds.size();cell++) {
1026  std::size_t localId = localElementIds[cell];
1027  stk::mesh::Entity element = elements[localId];
1028 
1029  double * solnData = stk::mesh::field_data(*field,element);
1030  TEUCHOS_ASSERT(solnData!=0); // only needed if blockId is not specified
1031  solnData[0] = scaleValue*solutionValues(cell,0);
1032  }
1033 }
1034 
1035 template <typename ArrayT>
1036 void STK_Interface::getElementVertices(const std::vector<std::size_t> & localElementIds, ArrayT & vertices) const
1037 {
1038  if(!useFieldCoordinates_) {
1039  //
1040  // gather from the intrinsic mesh coordinates (non-lagrangian)
1041  //
1042 
1043  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1044 
1045  // convert to a vector of entity objects
1046  std::vector<stk::mesh::Entity> selected_elements;
1047  for(std::size_t cell=0;cell<localElementIds.size();cell++)
1048  selected_elements.push_back(elements[localElementIds[cell]]);
1049 
1050  getElementVertices_FromCoords(selected_elements,vertices);
1051  }
1052  else {
1053  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
1054  "STK_Interface::getElementVertices: Cannot call this method when field coordinates are used "
1055  "without specifying an element block.");
1056  }
1057 }
1058 
1059 template <typename ArrayT>
1060 void STK_Interface::getElementVertices(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const
1061 {
1062  if(!useFieldCoordinates_) {
1063  getElementVertices_FromCoords(elements,vertices);
1064  }
1065  else {
1066  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
1067  "STK_Interface::getElementVertices: Cannot call this method when field coordinates are used "
1068  "without specifying an element block.");
1069  }
1070 }
1071 
1072 template <typename ArrayT>
1073 void STK_Interface::getElementVertices(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const
1074 {
1075  if(!useFieldCoordinates_) {
1076  getElementVertices_FromCoords(elements,vertices);
1077  }
1078  else {
1079  getElementVertices_FromField(elements,eBlock,vertices);
1080  }
1081 }
1082 
1083 template <typename ArrayT>
1084 void STK_Interface::getElementVertices(const std::vector<std::size_t> & localElementIds,const std::string & eBlock, ArrayT & vertices) const
1085 {
1086  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1087 
1088  // convert to a vector of entity objects
1089  std::vector<stk::mesh::Entity> selected_elements;
1090  for(std::size_t cell=0;cell<localElementIds.size();cell++)
1091  selected_elements.push_back(elements[localElementIds[cell]]);
1092 
1093  if(!useFieldCoordinates_) {
1094  getElementVertices_FromCoords(selected_elements,vertices);
1095  }
1096  else {
1097  getElementVertices_FromField(selected_elements,eBlock,vertices);
1098  }
1099 }
1100 
1101 template <typename ArrayT>
1102 void STK_Interface::getElementVerticesNoResize(const std::vector<std::size_t> & localElementIds, ArrayT & vertices) const
1103 {
1104  if(!useFieldCoordinates_) {
1105  //
1106  // gather from the intrinsic mesh coordinates (non-lagrangian)
1107  //
1108 
1109  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1110 
1111  // convert to a vector of entity objects
1112  std::vector<stk::mesh::Entity> selected_elements;
1113  for(std::size_t cell=0;cell<localElementIds.size();cell++)
1114  selected_elements.push_back(elements[localElementIds[cell]]);
1115 
1116  getElementVertices_FromCoordsNoResize(selected_elements,vertices);
1117  }
1118  else {
1119  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
1120  "STK_Interface::getElementVerticesNoResize: Cannot call this method when field coordinates are used "
1121  "without specifying an element block.");
1122  }
1123 }
1124 
1125 template <typename ArrayT>
1126 void STK_Interface::getElementVerticesNoResize(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const
1127 {
1128  if(!useFieldCoordinates_) {
1129  getElementVertices_FromCoordsNoResize(elements,vertices);
1130  }
1131  else {
1132  TEUCHOS_TEST_FOR_EXCEPTION(true,std::invalid_argument,
1133  "STK_Interface::getElementVerticesNoResize: Cannot call this method when field coordinates are used "
1134  "without specifying an element block.");
1135  }
1136 }
1137 
1138 template <typename ArrayT>
1139 void STK_Interface::getElementVerticesNoResize(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const
1140 {
1141  if(!useFieldCoordinates_) {
1142  getElementVertices_FromCoordsNoResize(elements,vertices);
1143  }
1144  else {
1145  getElementVertices_FromFieldNoResize(elements,eBlock,vertices);
1146  }
1147 }
1148 
1149 template <typename ArrayT>
1150 void STK_Interface::getElementVerticesNoResize(const std::vector<std::size_t> & localElementIds,const std::string & eBlock, ArrayT & vertices) const
1151 {
1152  const std::vector<stk::mesh::Entity> & elements = *(this->getElementsOrderedByLID());
1153 
1154  // convert to a vector of entity objects
1155  std::vector<stk::mesh::Entity> selected_elements;
1156  for(std::size_t cell=0;cell<localElementIds.size();cell++)
1157  selected_elements.push_back(elements[localElementIds[cell]]);
1158 
1159  if(!useFieldCoordinates_) {
1160  getElementVertices_FromCoordsNoResize(selected_elements,vertices);
1161  }
1162  else {
1163  getElementVertices_FromFieldNoResize(selected_elements,eBlock,vertices);
1164  }
1165 }
1166 
1167 template <typename ArrayT>
1168 void STK_Interface::getElementVertices_FromCoords(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const
1169 {
1170  // nothing to do! silently return
1171  if(elements.size()==0) {
1172  vertices = Kokkos::createDynRankView(vertices,"vertices",0,0,0);
1173  return;
1174  }
1175 
1176  //
1177  // gather from the intrinsic mesh coordinates (non-lagrangian)
1178  //
1179 
1180  // get *master* cell toplogy...(belongs to first element)
1181  unsigned masterVertexCount
1182  = stk::mesh::get_cell_topology(bulkData_->bucket(elements[0]).topology()).getCellTopologyData()->vertex_count;
1183 
1184  // allocate space
1185  vertices = Kokkos::createDynRankView(vertices,"vertices",elements.size(),masterVertexCount,getDimension());
1186 
1187  // loop over each requested element
1188  unsigned dim = getDimension();
1189  for(std::size_t cell=0;cell<elements.size();cell++) {
1190  stk::mesh::Entity element = elements[cell];
1191  TEUCHOS_ASSERT(element!=0);
1192 
1193  unsigned vertexCount
1194  = stk::mesh::get_cell_topology(bulkData_->bucket(element).topology()).getCellTopologyData()->vertex_count;
1195  TEUCHOS_TEST_FOR_EXCEPTION(vertexCount!=masterVertexCount,std::runtime_error,
1196  "In call to STK_Interface::getElementVertices all elements "
1197  "must have the same vertex count!");
1198 
1199  // loop over all element nodes
1200  const size_t num_nodes = bulkData_->num_nodes(element);
1201  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1202  TEUCHOS_TEST_FOR_EXCEPTION(num_nodes!=masterVertexCount,std::runtime_error,
1203  "In call to STK_Interface::getElementVertices cardinality of "
1204  "element node relations must be the vertex count!");
1205  for(std::size_t node=0; node<num_nodes; ++node) {
1206  const double * coord = getNodeCoordinates(nodes[node]);
1207 
1208  // set each dimension of the coordinate
1209  for(unsigned d=0;d<dim;d++)
1210  vertices(cell,node,d) = coord[d];
1211  }
1212  }
1213 }
1214 
1215 template <typename ArrayT>
1216 void STK_Interface::getElementVertices_FromCoordsNoResize(const std::vector<stk::mesh::Entity> & elements, ArrayT & vertices) const
1217 {
1218  // nothing to do! silently return
1219  if(elements.size()==0) {
1220  return;
1221  }
1222 
1223  //
1224  // gather from the intrinsic mesh coordinates (non-lagrangian)
1225  //
1226 
1227  // get *master* cell toplogy...(belongs to first element)
1228  unsigned masterVertexCount
1229  = stk::mesh::get_cell_topology(bulkData_->bucket(elements[0]).topology()).getCellTopologyData()->vertex_count;
1230 
1231  // loop over each requested element
1232  unsigned dim = getDimension();
1233  for(std::size_t cell=0;cell<elements.size();cell++) {
1234  stk::mesh::Entity element = elements[cell];
1235  TEUCHOS_ASSERT(element!=0);
1236 
1237  unsigned vertexCount
1238  = stk::mesh::get_cell_topology(bulkData_->bucket(element).topology()).getCellTopologyData()->vertex_count;
1239  TEUCHOS_TEST_FOR_EXCEPTION(vertexCount!=masterVertexCount,std::runtime_error,
1240  "In call to STK_Interface::getElementVertices all elements "
1241  "must have the same vertex count!");
1242 
1243  // loop over all element nodes
1244  const size_t num_nodes = bulkData_->num_nodes(element);
1245  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1246  TEUCHOS_TEST_FOR_EXCEPTION(num_nodes!=masterVertexCount,std::runtime_error,
1247  "In call to STK_Interface::getElementVertices cardinality of "
1248  "element node relations must be the vertex count!");
1249  for(std::size_t node=0; node<num_nodes; ++node) {
1250  const double * coord = getNodeCoordinates(nodes[node]);
1251 
1252  // set each dimension of the coordinate
1253  for(unsigned d=0;d<dim;d++)
1254  vertices(cell,node,d) = coord[d];
1255  }
1256  }
1257 }
1258 
1259 template <typename ArrayT>
1260 void STK_Interface::getElementVertices_FromField(const std::vector<stk::mesh::Entity> & elements,const std::string & eBlock, ArrayT & vertices) const
1261 {
1262  TEUCHOS_ASSERT(useFieldCoordinates_);
1263 
1264  // nothing to do! silently return
1265  if(elements.size()==0) {
1266  vertices = Kokkos::createDynRankView(vertices,"vertices",0,0,0);
1267  return;
1268  }
1269 
1270  // get *master* cell toplogy...(belongs to first element)
1271  unsigned masterVertexCount
1272  = stk::mesh::get_cell_topology(bulkData_->bucket(elements[0]).topology()).getCellTopologyData()->vertex_count;
1273 
1274  // allocate space
1275  vertices = Kokkos::createDynRankView(vertices,"vertices",elements.size(),masterVertexCount,getDimension());
1276 
1277  std::map<std::string,std::vector<std::string> >::const_iterator itr = meshCoordFields_.find(eBlock);
1278  if(itr==meshCoordFields_.end()) {
1279  // no coordinate field set for this element block
1280  TEUCHOS_ASSERT(false);
1281  }
1282 
1283  const std::vector<std::string> & coordField = itr->second;
1284  std::vector<SolutionFieldType*> fields(getDimension());
1285  for(std::size_t d=0;d<fields.size();d++) {
1286  fields[d] = this->getSolutionField(coordField[d],eBlock);
1287  }
1288 
1289  for(std::size_t cell=0;cell<elements.size();cell++) {
1290  stk::mesh::Entity element = elements[cell];
1291 
1292  // loop over nodes set solution values
1293  const size_t num_nodes = bulkData_->num_nodes(element);
1294  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1295  for(std::size_t i=0; i<num_nodes; ++i) {
1296  stk::mesh::Entity node = nodes[i];
1297 
1298  const double * coord = getNodeCoordinates(node);
1299 
1300  for(unsigned d=0;d<getDimension();d++) {
1301  double * solnData = stk::mesh::field_data(*fields[d],node);
1302 
1303  // recall mesh field coordinates are stored as displacements
1304  // from the mesh coordinates, make sure to add them together
1305  vertices(cell,i,d) = solnData[0]+coord[d];
1306  }
1307  }
1308  }
1309 }
1310 
1311 template <typename ArrayT>
1312 void STK_Interface::getElementVertices_FromFieldNoResize(const std::vector<stk::mesh::Entity> & elements,
1313  const std::string & eBlock, ArrayT & vertices) const
1314 {
1315  TEUCHOS_ASSERT(useFieldCoordinates_);
1316 
1317  // nothing to do! silently return
1318  if(elements.size()==0) {
1319  return;
1320  }
1321 
1322  std::map<std::string,std::vector<std::string> >::const_iterator itr = meshCoordFields_.find(eBlock);
1323  if(itr==meshCoordFields_.end()) {
1324  // no coordinate field set for this element block
1325  TEUCHOS_ASSERT(false);
1326  }
1327 
1328  const std::vector<std::string> & coordField = itr->second;
1329  std::vector<SolutionFieldType*> fields(getDimension());
1330  for(std::size_t d=0;d<fields.size();d++) {
1331  fields[d] = this->getSolutionField(coordField[d],eBlock);
1332  }
1333 
1334  for(std::size_t cell=0;cell<elements.size();cell++) {
1335  stk::mesh::Entity element = elements[cell];
1336 
1337  // loop over nodes set solution values
1338  const size_t num_nodes = bulkData_->num_nodes(element);
1339  stk::mesh::Entity const* nodes = bulkData_->begin_nodes(element);
1340  for(std::size_t i=0; i<num_nodes; ++i) {
1341  stk::mesh::Entity node = nodes[i];
1342 
1343  const double * coord = getNodeCoordinates(node);
1344 
1345  for(unsigned d=0;d<getDimension();d++) {
1346  double * solnData = stk::mesh::field_data(*fields[d],node);
1347 
1348  // recall mesh field coordinates are stored as displacements
1349  // from the mesh coordinates, make sure to add them together
1350  vertices(cell,i,d) = solnData[0]+coord[d];
1351  }
1352  }
1353  }
1354 }
1355 
1356 }
1357 
1358 #endif
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)
void getElementVertices(const std::vector< std::size_t > &localIds, ArrayT &vertices) const
Teuchos::RCP< stk::mesh::BulkData > bulkData_
void setSolutionFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localElementIds, const ArrayT &solutionValues, double scaleValue=1.0)
void getMySides(const std::string &sideName, std::vector< stk::mesh::Entity > &sides) const
std::vector< stk::mesh::Part * > facesPartVec_
stk::mesh::EntityId getGID() const
void getElementVertices_FromCoordsNoResize(const std::vector< stk::mesh::Entity > &elements, ArrayT &vertices) const
std::vector< stk::mesh::EntityId > nodes_
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
void setDispFieldData(const std::string &fieldName, const std::string &blockId, int axis, const std::vector< std::size_t > &localElementIds, const ArrayT &solutionValues)
std::string containingBlockId(stk::mesh::Entity elmt)
void addPeriodicBC(const Teuchos::RCP< const PeriodicBC_MatcherBase > &bc)
std::size_t elementLocalId(stk::mesh::Entity elmt) const
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > & getPeriodicBCVector()
stk::mesh::Field< double > SolutionFieldType
std::vector< stk::mesh::Part * > edgesPartVec_
const std::vector< stk::mesh::EntityId > & getNodes() const
std::map< std::string, double > blockWeights_
void getMyElements(std::vector< stk::mesh::Entity > &elements) const
void addEntityToSideset(stk::mesh::Entity entity, stk::mesh::Part *sideset)
std::size_t getNumSidesets() const
get the side set count
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::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
stk::mesh::Part * getOwnedPart() const
Get a pointer to the locally owned part.
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)
stk::mesh::Entity findConnectivityById(stk::mesh::Entity src, stk::mesh::EntityRank tgt_rank, unsigned rel_id) const
bool isValid(stk::mesh::Entity entity) const
PHX::MDField< ScalarT > vector
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
unsigned getDimension() const
get the dimension
const VectorFieldType & getFacesField() const
void addElement(const Teuchos::RCP< ElementDescriptor > &ed, stk::mesh::Part *block)
std::map< std::string, std::vector< std::string > > meshDispFields_
Kokkos::DynRankView< typename InputArray::value_type, PHX::Device > createDynRankView(const InputArray &a, const std::string &name, const DimensionPack... dims)
Wrapper to simplify Panzer use of Sacado ViewFactory.
void setUseFieldCoordinates(bool useFieldCoordinates)
stk::mesh::EntityId elementGlobalId(std::size_t lid) const
void getElementVertices_FromField(const std::vector< stk::mesh::Entity > &elements, const std::string &eBlock, ArrayT &vertices) 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 getElementVertices_FromCoords(const std::vector< stk::mesh::Entity > &elements, ArrayT &vertices) const
void writeToExodus(const std::string &filename)
void getElementVertices_FromFieldNoResize(const std::vector< stk::mesh::Entity > &elements, const std::string &eBlock, ArrayT &vertices) const
void setupTransientExodusFile(const std::string &filename)
std::map< std::string, stk::mesh::Part * > elementBlocks_
bool isInitialized() const
Has initialize been called on this mesh object?
std::vector< stk::mesh::Part * > nodesPartVec_
static const std::string edgesString
std::size_t getNumElementBlocks() const
get the block count
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)
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > periodicBCs_
Teuchos::RCP< const std::vector< stk::mesh::Entity > > getElementsOrderedByLID() const
void addNode(stk::mesh::EntityId gid, const std::vector< double > &coord)
void setBlockWeight(const std::string &blockId, double weight)
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_
void getElementVerticesNoResize(const std::vector< std::size_t > &localIds, ArrayT &vertices) const
void setInitialStateTime(double value)
std::size_t getNumNodesets() const
get the side set count
Teuchos::RCP< stk::mesh::MetaData > metaData_
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 setUseLowerCaseForIO(bool useLowerCase)
bool validBlockId(const std::string &blockId) const
void addSideset(const std::string &name, const CellTopologyData *ctData)
void getSolutionFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localElementIds, ArrayT &solutionValues) const
void setCellFieldData(const std::string &fieldName, const std::string &blockId, const std::vector< std::size_t > &localElementIds, const ArrayT &solutionValues, double scaleValue=1.0)
ProcIdFieldType * getProcessorIdField()
void rebalance(const Teuchos::ParameterList &params)
Teuchos::RCP< const shards::CellTopology > getCellTopology(const std::string &eBlock) const
void getAllSides(const std::string &sideName, std::vector< stk::mesh::Entity > &sides) const
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
stk::mesh::EntityId elementGlobalId(stk::mesh::Entity elmt) const
void getNodesetNames(std::vector< std::string > &name) const
std::unordered_map< stk::mesh::EntityId, std::size_t > localIDHash_
std::vector< stk::mesh::EntityId > maxEntityId_
unsigned entityOwnerRank(stk::mesh::Entity entity) const
const VectorFieldType & getCoordinatesField() const
void print(std::ostream &os) const
stk::mesh::EntityRank getElementRank() const
stk::mesh::Field< ProcIdData > ProcIdFieldType
void addPeriodicBCs(const std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > &bc_vec)
stk::mesh::EntityId getMaxEntityId(unsigned entityRank) const
get max entity ID of type entityRank
void addCellField(const std::string &fieldName, const std::string &blockId)
bool operator()(stk::mesh::Entity a, stk::mesh::Entity b)
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
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_
const VectorFieldType & getEdgesField() const
std::map< std::string, stk::mesh::Part * > nodesets_
void getNeighborElements(std::vector< stk::mesh::Entity > &elements) const