47#include "PanzerDiscFE_config.hpp"
51#include "Tpetra_Import.hpp"
52#include "Tpetra_MultiVector.hpp"
62 std::vector<Intrepid2::Orientation> & orientations)
65 using MVector = Tpetra::MultiVector<panzer::GlobalOrdinal, panzer::LocalOrdinal, panzer::GlobalOrdinal, panzer::TpetraNodeType>;
66 using Map = Tpetra::Map<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType>;
67 using Importer = Tpetra::Import<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType>;
68 using NodeView = Kokkos::View<panzer::GlobalOrdinal*, Kokkos::DefaultHostExecutionSpace>;
71 PHX::View<panzer::GlobalOrdinal*> owned_cells, ghost_cells, virtual_cells;
75 auto owned_cell_map = Teuchos::rcp(
new Map(Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid(),owned_cells,0,comm));
76 auto ghost_cell_map = Teuchos::rcp(
new Map(Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid(),ghost_cells,0,comm));
79 auto importer = Teuchos::rcp(
new Importer(owned_cell_map,ghost_cell_map));
82 shards::CellTopology topology;
87 std::vector<std::string> elementBlockIds;
88 std::vector<shards::CellTopology> elementBlockTopologies;
93 TEUCHOS_TEST_FOR_EXCEPTION(numElementBlocks <= 0 &&
94 numElementBlocks !=
static_cast<int>(elementBlockIds.size()) &&
95 numElementBlocks !=
static_cast<int>(elementBlockTopologies.size()),
97 "panzer::buildIntrepidOrientation: Number of element blocks does not match to element block meta data");
99 topology = elementBlockTopologies.at(0);
101 const int num_nodes_per_cell = topology.getVertexCount();
104 auto owned_nodes_vector = Teuchos::rcp(
new MVector(owned_cell_map,num_nodes_per_cell));
105 auto ghost_nodes_vector = Teuchos::rcp(
new MVector(ghost_cell_map,num_nodes_per_cell));
111 const int num_owned_cells = owned_cells.extent(0);
112 const int num_ghost_cells = ghost_cells.extent(0);
115 orientations.clear();
116 orientations.resize(num_owned_cells+num_ghost_cells);
120 auto vector_view = owned_nodes_vector->getLocalViewHost(Tpetra::Access::OverwriteAll);
121 for(
int cell=0; cell<owned_cells.extent_int(0); ++cell){
123 for(
int node=0; node<num_nodes_per_cell; ++node)
124 vector_view(cell,node) = nodes[node];
129 ghost_nodes_vector->doImport(*owned_nodes_vector,*importer,Tpetra::CombineMode::REPLACE);
133 auto vector_view = owned_nodes_vector->getLocalViewHost(Tpetra::Access::ReadOnly);
134 for(
int cell=0; cell<num_owned_cells; ++cell){
135 NodeView nodes(
"nodes",num_nodes_per_cell);
136 for(
int node=0; node<num_nodes_per_cell; ++node)
137 nodes(node) = vector_view(cell,node);
138 orientations[cell] = Intrepid2::Orientation::getOrientation(topology, nodes);
144 auto vector_view = ghost_nodes_vector->getLocalViewHost(Tpetra::Access::ReadOnly);
145 for(
int ghost_cell=0; ghost_cell<num_ghost_cells; ++ghost_cell){
146 const int cell = num_owned_cells + ghost_cell;
147 NodeView nodes(
"nodes",num_nodes_per_cell);
148 for(
int node=0; node<num_nodes_per_cell; ++node)
149 nodes(node) = vector_view(ghost_cell,node);
150 orientations[cell] = Intrepid2::Orientation::getOrientation(topology, nodes);
156Teuchos::RCP<std::vector<Intrepid2::Orientation> >
159 using Teuchos::rcp_dynamic_cast;
163 auto orientation = rcp(
new std::vector<Intrepid2::Orientation>);
165 auto comm = globalIndexer->getComm();
168 TEUCHOS_TEST_FOR_EXCEPTION(conn == Teuchos::null,std::logic_error,
169 "panzer::buildIntrepidOrientation: Could not cast ConnManagerBase");
185Teuchos::RCP<const std::vector<Intrepid2::Orientation> >
Pure virtual base class for supplying mesh connectivity information to the DOF Manager.
virtual std::size_t numElementBlocks() const =0
virtual Teuchos::RCP< ConnManager > noConnectivityClone() const =0
virtual void buildConnectivity(const FieldPattern &fp)=0
virtual const GlobalOrdinal * getConnectivity(LocalOrdinal localElmtId) const =0
virtual void getElementBlockIds(std::vector< std::string > &elementBlockIds) const =0
virtual void getElementBlockTopologies(std::vector< shards::CellTopology > &elementBlockTopologies) const =0
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > orientations_
Orientations.
OrientationsInterface()=delete
Block default constructor.
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > getOrientations() const
void buildIntrepidOrientation(std::vector< Intrepid2::Orientation > &orientation, panzer::ConnManager &connMgr)
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.