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>;
36 using NodeView = Kokkos::View<panzer::GlobalOrdinal*, Kokkos::DefaultHostExecutionSpace>;
39 PHX::View<panzer::GlobalOrdinal*> owned_cells, ghost_cells, virtual_cells;
43 auto owned_cell_map = Teuchos::rcp(
new Map(Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid(),owned_cells,0,comm));
44 auto ghost_cell_map = Teuchos::rcp(
new Map(Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid(),ghost_cells,0,comm));
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;
61 TEUCHOS_TEST_FOR_EXCEPTION(numElementBlocks <= 0 &&
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);
125Teuchos::RCP<std::vector<Intrepid2::Orientation> >
128 using Teuchos::rcp_dynamic_cast;
132 auto orientation = rcp(
new std::vector<Intrepid2::Orientation>);
134 auto comm = globalIndexer->getComm();
137 TEUCHOS_TEST_FOR_EXCEPTION(conn == Teuchos::null,std::logic_error,
138 "panzer::buildIntrepidOrientation: Could not cast ConnManagerBase");
154Teuchos::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)
Builds the element orientations for all element blocks.
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.