15 #include "PanzerDiscFE_config.hpp"
19 #include "Tpetra_Import.hpp"
20 #include "Tpetra_MultiVector.hpp"
30 std::vector<Intrepid2::Orientation> & orientations)
33 using MVector = Tpetra::MultiVector<panzer::GlobalOrdinal, panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType>;
34 using Map = Tpetra::Map<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType>;
35 using Importer = Tpetra::Import<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType>;
39 PHX::View<panzer::GlobalOrdinal*> owned_cells, ghost_cells, virtual_cells;
47 auto importer =
Teuchos::rcp(
new Importer(owned_cell_map,ghost_cell_map));
50 shards::CellTopology topology;
55 std::vector<std::string> elementBlockIds;
56 std::vector<shards::CellTopology> elementBlockTopologies;
62 numElementBlocks != static_cast<int>(elementBlockIds.size()) &&
63 numElementBlocks != static_cast<int>(elementBlockTopologies.size()),
65 "panzer::buildIntrepidOrientation: Number of element blocks does not match to element block meta data");
67 topology = elementBlockTopologies.at(0);
69 const int num_nodes_per_cell = topology.getNodeCount();
72 auto owned_nodes_vector =
Teuchos::rcp(
new MVector(owned_cell_map,num_nodes_per_cell));
73 auto ghost_nodes_vector =
Teuchos::rcp(
new MVector(ghost_cell_map,num_nodes_per_cell));
80 const int num_owned_cells = owned_cells.extent(0);
81 const int num_ghost_cells = ghost_cells.extent(0);
85 orientations.resize(num_owned_cells+num_ghost_cells);
89 auto vector_view = owned_nodes_vector->getLocalViewHost(Tpetra::Access::OverwriteAll);
90 for(
int cell=0; cell<owned_cells.extent_int(0); ++cell){
92 for(
int node=0; node<num_nodes_per_cell; ++node)
93 vector_view(cell,node) = nodes[node];
98 ghost_nodes_vector->doImport(*owned_nodes_vector,*importer,Tpetra::CombineMode::REPLACE);
102 auto vector_view = owned_nodes_vector->getLocalViewHost(Tpetra::Access::ReadOnly);
103 for(
int cell=0; cell<num_owned_cells; ++cell){
104 NodeView nodes(
"nodes",num_nodes_per_cell);
105 for(
int node=0; node<num_nodes_per_cell; ++node)
106 nodes(node) = vector_view(cell,node);
107 orientations[cell] = Intrepid2::Orientation::getOrientation(topology, nodes);
113 auto vector_view = ghost_nodes_vector->getLocalViewHost(Tpetra::Access::ReadOnly);
114 for(
int ghost_cell=0; ghost_cell<num_ghost_cells; ++ghost_cell){
115 const int cell = num_owned_cells + ghost_cell;
116 NodeView nodes(
"nodes",num_nodes_per_cell);
117 for(
int node=0; node<num_nodes_per_cell; ++node)
118 nodes(node) = vector_view(ghost_cell,node);
119 orientations[cell] = Intrepid2::Orientation::getOrientation(topology, nodes);
128 using Teuchos::rcp_dynamic_cast;
132 auto orientation =
rcp(
new std::vector<Intrepid2::Orientation>);
134 auto comm = globalIndexer->
getComm();
135 auto conn = globalIndexer->
getConnManager()->noConnectivityClone();
138 "panzer::buildIntrepidOrientation: Could not cast ConnManagerBase");
virtual Teuchos::RCP< Teuchos::Comm< int > > getComm() const =0
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > getOrientations() const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void fillLocalCellIDs(const Teuchos::RCP< const Teuchos::Comm< int >> &comm, panzer::ConnManager &conn, PHX::View< panzer::GlobalOrdinal * > &owned_cells, PHX::View< panzer::GlobalOrdinal * > &ghost_cells, PHX::View< panzer::GlobalOrdinal * > &virtual_cells)
Get the owned, ghost and virtual global cell ids for this process.
void buildIntrepidOrientation(std::vector< Intrepid2::Orientation > &orientation, panzer::ConnManager &connMgr)
Builds the element orientations for all element blocks.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual void getElementBlockIds(std::vector< std::string > &elementBlockIds) const =0
virtual Teuchos::RCP< const ConnManager > getConnManager() const =0
Returns the connection manager currently being used.
Pure virtual base class for supplying mesh connectivity information to the DOF Manager.
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > orientations_
Orientations.
virtual void getElementBlockTopologies(std::vector< shards::CellTopology > &elementBlockTopologies) const =0
virtual std::size_t numElementBlocks() const =0
OrientationsInterface()=delete
Block default constructor.
#define TEUCHOS_ASSERT(assertion_test)
virtual void buildConnectivity(const FieldPattern &fp)=0
virtual const GlobalOrdinal * getConnectivity(LocalOrdinal localElmtId) const =0