61 #include "Phalanx_KokkosDeviceTypes.hpp"
63 #include "Teuchos_Assert.hpp"
66 #include "Tpetra_Import.hpp"
67 #include "Tpetra_CrsMatrix.hpp"
68 #include "Tpetra_RowMatrixTransposer.hpp"
73 #include <unordered_set>
87 Kokkos::View<panzer::GlobalOrdinal*> & globals)
90 std::vector<shards::CellTopology> elementBlockTopologies;
92 const shards::CellTopology & topology = elementBlockTopologies[0];
95 for(
const auto & other_topology : elementBlockTopologies){
100 if(topology.getDimension() == 1){
102 }
else if(topology.getDimension() == 2){
104 }
else if(topology.getDimension() == 3){
112 std::vector<std::string> block_ids;
115 std::size_t totalSize = 0;
116 for (std::size_t which_blk=0;which_blk<block_ids.size();which_blk++) {
118 const std::vector<int> & localIDs = conn.
getElementBlock(block_ids[which_blk]);
119 totalSize += localIDs.size();
121 globals = Kokkos::View<panzer::GlobalOrdinal*>(
"global_cells",totalSize);
123 for (std::size_t
id=0;
id<totalSize; ++id) {
129 globals(
id) = connectivity[0];
139 buildCellToNodes(
panzer::ConnManager & conn, Kokkos::View<panzer::GlobalOrdinal**> & globals)
142 std::vector<shards::CellTopology> elementBlockTopologies;
144 const shards::CellTopology & topology = elementBlockTopologies[0];
147 for(
const auto & other_topology : elementBlockTopologies){
155 std::vector<std::string> block_ids;
159 std::size_t totalCells=0, maxNodes=0;
160 for (std::size_t which_blk=0;which_blk<block_ids.size();which_blk++) {
162 const std::vector<int> & localIDs = conn.
getElementBlock(block_ids[which_blk]);
163 if ( localIDs.size() == 0 )
167 totalCells += localIDs.size();
168 maxNodes = maxNodes<Teuchos::as<std::size_t>(thisSize) ? Teuchos::as<std::size_t>(thisSize) : maxNodes;
170 globals = Kokkos::View<panzer::GlobalOrdinal**>(
"cell_to_node",totalCells,maxNodes);
173 for (std::size_t
id=0;
id<totalCells; ++id) {
177 for(
int n=0;n<nodeCnt;n++)
178 globals(
id,n) = connectivity[n];
186 Kokkos::View<const panzer::GlobalOrdinal**> cells_to_nodes)
203 typedef Tpetra::Map<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> map_type;
206 std::set<panzer::GlobalOrdinal> global_nodes;
207 for(
unsigned int i=0;i<cells_to_nodes.extent(0);i++)
208 for(
unsigned int j=0;j<cells_to_nodes.extent(1);j++)
209 global_nodes.insert(cells_to_nodes(i,j));
212 Kokkos::View<panzer::GlobalOrdinal*> node_ids(
"global_nodes",global_nodes.size());
214 for(
auto itr=global_nodes.begin();itr!=global_nodes.end();++itr,++i)
228 Kokkos::View<const panzer::GlobalOrdinal*> owned_cells,
229 Kokkos::View<const panzer::GlobalOrdinal**> owned_cells_to_nodes)
234 typedef Tpetra::Map<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> map_type;
235 typedef Tpetra::CrsMatrix<panzer::LocalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> crs_type;
236 typedef Tpetra::Import<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> import_type;
239 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer_stk::buildNodeToCellMatrix",BNTCM);
241 TEUCHOS_ASSERT(owned_cells.extent(0)==owned_cells_to_nodes.extent(0));
246 auto node_map = buildNodeMap(comm,owned_cells_to_nodes);
249 auto unique_node_map = Tpetra::createOneToOne(node_map);
256 RCP<crs_type> cell_to_node;
258 PANZER_FUNC_TIME_MONITOR_DIFF(
"Build matrix",BuildMatrix);
261 const unsigned int num_local_cells = owned_cells_to_nodes.extent(0);
262 const unsigned int num_nodes_per_cell = owned_cells_to_nodes.extent(1);
265 cell_to_node =
rcp(
new crs_type(cell_map,num_nodes_per_cell,
266 Tpetra::StaticProfile));
268 std::vector<panzer::LocalOrdinal> local_node_indexes(num_nodes_per_cell);
269 std::vector<panzer::GlobalOrdinal> global_node_indexes(num_nodes_per_cell);
270 for(
unsigned int i=0;i<num_local_cells;i++) {
271 const panzer::GlobalOrdinal global_cell_index = owned_cells(i);
274 for(
unsigned int j=0;j<num_nodes_per_cell;j++) {
277 local_node_indexes[j] = Teuchos::as<panzer::LocalOrdinal>(j);
278 global_node_indexes[j] = owned_cells_to_nodes(i,j);
282 cell_to_node->insertGlobalValues(global_cell_index,global_node_indexes,local_node_indexes);
284 cell_to_node->fillComplete(unique_node_map,cell_map);
289 RCP<crs_type> node_to_cell;
291 PANZER_FUNC_TIME_MONITOR_DIFF(
"Tranpose matrix",TransposeMatrix);
294 Tpetra::RowMatrixTransposer<panzer::LocalOrdinal,panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> transposer(cell_to_node);
297 auto trans = transposer.createTranspose();
301 RCP<import_type>
import =
rcp(
new import_type(unique_node_map,node_map));
305 node_to_cell =
rcp(
new crs_type(node_map,0));
308 node_to_cell->doImport(*trans,*
import,Tpetra::INSERT);
312 node_to_cell->fillComplete(cell_map,unique_node_map);
321 Kokkos::View<const panzer::GlobalOrdinal*>
323 Kokkos::View<const panzer::GlobalOrdinal*> cells,
324 Kokkos::View<const panzer::GlobalOrdinal**> cells_to_nodes)
327 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer_stk::buildGhostedCellOneRing",BGCOR);
328 typedef Tpetra::CrsMatrix<int,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> crs_type;
360 std::unordered_set<panzer::GlobalOrdinal> unique_cells;
364 for(
size_t i=0;i<cells.extent(0);i++) {
365 unique_cells.insert(cells(i));
369 std::set<panzer::GlobalOrdinal> ghstd_cells_set;
373 auto node_map = node_to_cell->getMap()->getMyGlobalIndices();
376 for(
size_t i=0;i<node_map.extent(0);i++) {
377 const panzer::GlobalOrdinal global_node_index = node_map(i);
378 size_t numEntries = node_to_cell->getNumEntriesInGlobalRow(node_map(i));
383 node_to_cell->getGlobalRowCopy(global_node_index,indices,values,numEntries);
385 for(
auto index : indices) {
388 if(unique_cells.find(index)==unique_cells.end()) {
389 ghstd_cells_set.insert(index);
390 unique_cells.insert(index);
397 Kokkos::View<panzer::GlobalOrdinal*> ghstd_cells(
"ghstd_cells",ghstd_cells_set.size());
398 for(
auto global_cell_index : ghstd_cells_set) {
399 ghstd_cells(indx) = global_cell_index;
411 Kokkos::DynRankView<double,PHX::Device>
412 buildGhostedVertices(
const Tpetra::Import<int,panzer::GlobalOrdinal,panzer::TpetraNodeType> & importer,
413 Kokkos::DynRankView<const double,PHX::Device> owned_vertices)
418 typedef Tpetra::MultiVector<double,int,panzer::GlobalOrdinal,panzer::TpetraNodeType> mvec_type;
419 typedef typename mvec_type::dual_view_type dual_view_type;
421 size_t owned_cell_cnt = importer.getSourceMap()->getNodeNumElements();
422 size_t ghstd_cell_cnt = importer.getTargetMap()->getNodeNumElements();
423 int vertices_per_cell = owned_vertices.extent(1);
424 int space_dim = owned_vertices.extent(2);
429 RCP<mvec_type> owned_vertices_mv =
rcp(
new mvec_type(importer.getSourceMap(),vertices_per_cell*space_dim));
430 RCP<mvec_type> ghstd_vertices_mv =
rcp(
new mvec_type(importer.getTargetMap(),vertices_per_cell*space_dim));
433 auto owned_vertices_view = owned_vertices_mv->template getLocalView<dual_view_type>();
434 for(
size_t i=0;i<owned_cell_cnt;i++) {
436 for(
int j=0;j<vertices_per_cell;j++)
437 for(
int k=0;k<space_dim;k++,l++)
438 owned_vertices_view(i,l) = owned_vertices(i,j,k);
443 ghstd_vertices_mv->doImport(*owned_vertices_mv,importer,Tpetra::INSERT);
446 Kokkos::DynRankView<double,PHX::Device> ghstd_vertices(
"ghstd_vertices",ghstd_cell_cnt,vertices_per_cell,space_dim);
448 auto ghstd_vertices_view = ghstd_vertices_mv->template getLocalView<dual_view_type>();
449 for(
size_t i=0;i<ghstd_cell_cnt;i++) {
451 for(
int j=0;j<vertices_per_cell;j++)
452 for(
int k=0;k<space_dim;k++,l++)
453 ghstd_vertices(i,j,k) = ghstd_vertices_view(i,l);
457 return ghstd_vertices;
464 const std::string & element_block_name,
475 const shards::CellTopology & topology = *(mesh.
getCellTopology(element_block_name));
477 if(topology.getDimension() == 1){
479 }
else if(topology.getDimension() == 2){
481 }
else if(topology.getDimension() == 3){
486 PANZER_FUNC_TIME_MONITOR(
"Build connectivity");
491 std::vector<panzer::LocalOrdinal> owned_block_cells;
492 for(
int parent_owned_cell=0;parent_owned_cell<num_parent_owned_cells;++parent_owned_cell){
493 const panzer::LocalOrdinal local_cell = mesh_info.
local_cells(parent_owned_cell);
494 const bool is_in_block = conn.
getBlockId(local_cell) == element_block_name;
497 owned_block_cells.push_back(parent_owned_cell);
502 if ( owned_block_cells.size() == 0 )
508 PANZER_FUNC_TIME_MONITOR(
"panzer::partitioning_utilities::setupSubLocalMeshInfo");
518 const std::string & element_block_name,
519 const std::string & sideset_name,
524 using LocalOrdinal = panzer::LocalOrdinal;
525 using ParentOrdinal = int;
526 using SubcellOrdinal = short;
532 std::vector<stk::mesh::Entity> side_entities;
538 mesh.
getAllSides(sideset_name, element_block_name, side_entities);
540 }
catch(STK_Interface::SidesetException & e) {
541 std::stringstream ss;
542 std::vector<std::string> sideset_names;
546 ss << e.what() <<
"\nChoose existing sideset:\n";
547 for(
const auto & optional_sideset_name : sideset_names){
548 ss <<
"\t\"" << optional_sideset_name <<
"\"\n";
553 }
catch(STK_Interface::ElementBlockException & e) {
554 std::stringstream ss;
555 std::vector<std::string> element_block_names;
559 ss << e.what() <<
"\nChoose existing element block:\n";
560 for(
const auto & optional_element_block_name : element_block_names){
561 ss <<
"\t\"" << optional_element_block_name <<
"\"\n";
566 }
catch(std::logic_error & e) {
567 std::stringstream ss;
568 ss << e.what() <<
"\nUnrecognized logic error.\n";
575 std::map<ParentOrdinal,std::vector<SubcellOrdinal> > owned_parent_cell_to_subcell_indexes;
579 const size_t face_subcell_dimension =
static_cast<size_t>(mesh.
getCellTopology(element_block_name)->getDimension()-1);
588 std::vector<stk::mesh::Entity> elements;
589 std::vector<size_t> subcell_indexes;
590 std::vector<size_t> subcell_dimensions;
592 const size_t num_elements = subcell_dimensions.size();
595 std::unordered_map<LocalOrdinal,ParentOrdinal> local_to_parent_lookup;
596 for(ParentOrdinal parent_index=0; parent_index<static_cast<ParentOrdinal>(mesh_info.
local_cells.extent(0)); ++parent_index)
597 local_to_parent_lookup[mesh_info.
local_cells(parent_index)] = parent_index;
601 for(
size_t element_index=0; element_index<num_elements; ++element_index) {
602 const size_t subcell_dimension = subcell_dimensions[element_index];
605 if(subcell_dimension == face_subcell_dimension){
606 const SubcellOrdinal subcell_index =
static_cast<SubcellOrdinal
>(subcell_indexes[element_index]);
607 const LocalOrdinal element_local_index =
static_cast<LocalOrdinal
>(mesh.
elementLocalId(elements[element_index]));
610 const auto itr = local_to_parent_lookup.find(element_local_index);
612 const ParentOrdinal element_parent_index = itr->second;
614 owned_parent_cell_to_subcell_indexes[element_parent_index].push_back(subcell_index);
621 const panzer::LocalOrdinal num_owned_cells = owned_parent_cell_to_subcell_indexes.size();
630 face_t(
const ParentOrdinal c0,
631 const ParentOrdinal c1,
632 const SubcellOrdinal sc0,
633 const SubcellOrdinal sc1)
640 ParentOrdinal cell_0;
641 ParentOrdinal cell_1;
642 SubcellOrdinal subcell_index_0;
643 SubcellOrdinal subcell_index_1;
648 std::unordered_set<panzer::LocalOrdinal> owned_parent_cells_set, ghstd_parent_cells_set, virtual_parent_cells_set;
649 std::vector<face_t> faces;
653 for(
const auto & local_cell_index_pair : owned_parent_cell_to_subcell_indexes){
655 const ParentOrdinal parent_cell = local_cell_index_pair.first;
656 const auto & subcell_indexes = local_cell_index_pair.second;
658 owned_parent_cells_set.insert(parent_cell);
660 for(
const SubcellOrdinal & subcell_index : subcell_indexes){
662 const LocalOrdinal face = mesh_info.
cell_to_faces(parent_cell, subcell_index);
663 const LocalOrdinal face_other_side = (mesh_info.
face_to_cells(face,0) == parent_cell) ? 1 : 0;
667 const ParentOrdinal other_side_cell = mesh_info.
face_to_cells(face, face_other_side);
668 const SubcellOrdinal other_side_subcell_index = mesh_info.
face_to_lidx(face, face_other_side);
670 faces.push_back(face_t(parent_cell, other_side_cell, subcell_index, other_side_subcell_index));
672 if(other_side_cell >= parent_virtual_cell_offset){
673 virtual_parent_cells_set.insert(other_side_cell);
675 ghstd_parent_cells_set.insert(other_side_cell);
681 std::vector<ParentOrdinal> all_cells;
682 all_cells.insert(all_cells.end(),owned_parent_cells_set.begin(),owned_parent_cells_set.end());
683 all_cells.insert(all_cells.end(),ghstd_parent_cells_set.begin(),ghstd_parent_cells_set.end());
684 all_cells.insert(all_cells.end(),virtual_parent_cells_set.begin(),virtual_parent_cells_set.end());
690 const LocalOrdinal num_total_cells = num_real_cells + sideset_info.
num_virtual_cells;
691 const LocalOrdinal num_vertices_per_cell = mesh_info.
cell_vertices.extent(1);
692 const LocalOrdinal num_dims = mesh_info.
cell_vertices.extent(2);
696 sideset_info.
global_cells = Kokkos::View<panzer::GlobalOrdinal*>(
"global_cells", num_total_cells);
697 sideset_info.
local_cells = Kokkos::View<LocalOrdinal*>(
"local_cells", num_total_cells);
698 sideset_info.
cell_vertices = Kokkos::View<double***,PHX::Device>(
"cell_vertices", num_total_cells, num_vertices_per_cell, num_dims);
701 for(LocalOrdinal i=0; i<num_total_cells; ++i){
702 const ParentOrdinal parent_cell = all_cells[i];
705 for(LocalOrdinal j=0; j<num_vertices_per_cell; ++j)
706 for(LocalOrdinal k=0; k<num_dims; ++k)
713 const LocalOrdinal num_faces = faces.size();
714 const LocalOrdinal num_faces_per_cell = mesh_info.
cell_to_faces.extent(1);
716 sideset_info.
face_to_cells = Kokkos::View<LocalOrdinal*[2]>(
"face_to_cells", num_faces);
717 sideset_info.
face_to_lidx = Kokkos::View<LocalOrdinal*[2]>(
"face_to_lidx", num_faces);
718 sideset_info.
cell_to_faces = Kokkos::View<LocalOrdinal**>(
"cell_to_faces", num_total_cells, num_faces_per_cell);
724 std::unordered_map<ParentOrdinal,ParentOrdinal> parent_to_sideset_lookup;
725 for(
unsigned int i=0; i<all_cells.size(); ++i)
726 parent_to_sideset_lookup[all_cells[i]] = i;
728 for(
int face_index=0;face_index<num_faces;++face_index){
729 const face_t & face = faces[face_index];
730 const ParentOrdinal & parent_cell_0 = face.cell_0;
731 const ParentOrdinal & parent_cell_1 = face.cell_1;
734 const auto itr_0 = parent_to_sideset_lookup.find(parent_cell_0);
736 const ParentOrdinal sideset_cell_0 = itr_0->second;
738 const auto itr_1 = parent_to_sideset_lookup.find(parent_cell_1);
740 const ParentOrdinal sideset_cell_1 = itr_1->second;
748 sideset_info.
face_to_lidx(face_index,0) = face.subcell_index_0;
749 sideset_info.
face_to_lidx(face_index,1) = face.subcell_index_1;
751 sideset_info.
cell_to_faces(sideset_cell_0,face.subcell_index_0) = face_index;
752 sideset_info.
cell_to_faces(sideset_cell_1,face.subcell_index_1) = face_index;
768 typedef Tpetra::Map<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> map_type;
769 typedef Tpetra::Import<panzer::LocalOrdinal,panzer::GlobalOrdinal,panzer::TpetraNodeType> import_type;
792 Kokkos::View<panzer::GlobalOrdinal**> owned_cell_to_nodes;
793 buildCellToNodes(conn, owned_cell_to_nodes);
797 Kokkos::View<panzer::GlobalOrdinal*> owned_cells;
798 buildCellGlobalIDs(conn, owned_cells);
802 Kokkos::View<const panzer::GlobalOrdinal*> ghstd_cells = buildGhostedCellOneRing(comm,owned_cells,owned_cell_to_nodes);
811 RCP<import_type> cellimport_own2ghst =
rcp(
new import_type(owned_cell_map,ghstd_cell_map));
816 for(
size_t i=0;i<localCells.size();i++){
821 std::vector<std::string> element_block_names;
824 const shards::CellTopology & cell_topology = *(mesh.
getCellTopology(element_block_names[0]));
826 const int space_dim = cell_topology.getDimension();
827 const int vertices_per_cell = cell_topology.getVertexCount();
828 const int faces_per_cell = cell_topology.getSubcellCount(space_dim-1);
831 Kokkos::DynRankView<double,PHX::Device> owned_vertices(
"owned_vertices",localCells.size(),vertices_per_cell,space_dim);
835 Kokkos::DynRankView<double,PHX::Device> ghstd_vertices = buildGhostedVertices(*cellimport_own2ghst,owned_vertices);
840 std::unordered_map<panzer::GlobalOrdinal,int> global_to_local;
841 global_to_local[-1] = -1;
842 for(
size_t i=0;i<owned_cells.extent(0);i++)
843 global_to_local[owned_cells(i)] = i;
844 for(
size_t i=0;i<ghstd_cells.extent(0);i++)
845 global_to_local[ghstd_cells(i)] = i+Teuchos::as<int>(owned_cells.extent(0));
849 faceToElement->initialize(conn);
850 auto elems_by_face = faceToElement->getFaceToElementsMap();
851 auto face_to_lidx = faceToElement->getFaceToCellLocalIdxMap();
853 const int num_owned_cells =owned_cells.extent(0);
854 const int num_ghstd_cells =ghstd_cells.extent(0);
867 std::vector<int> all_boundary_faces;
868 const int num_faces = elems_by_face.extent(0);
869 for(
int face=0;face<num_faces;++face){
870 if(elems_by_face(face,0) < 0 or elems_by_face(face,1) < 0){
871 all_boundary_faces.push_back(face);
874 const panzer::LocalOrdinal num_virtual_cells = all_boundary_faces.size();
877 const panzer::LocalOrdinal num_real_cells = num_owned_cells + num_ghstd_cells;
878 const panzer::LocalOrdinal num_total_cells = num_real_cells + num_virtual_cells;
879 const panzer::LocalOrdinal num_total_faces = elems_by_face.extent(0);
883 Kokkos::View<panzer::GlobalOrdinal*> virtual_cells = Kokkos::View<panzer::GlobalOrdinal*>(
"virtual_cells",num_virtual_cells);
885 PANZER_FUNC_TIME_MONITOR_DIFF(
"Initial global index creation",InitialGlobalIndexCreation);
887 const int num_ranks = comm->getSize();
888 const int rank = comm->getRank();
890 std::vector<panzer::GlobalOrdinal> owned_cell_distribution(num_ranks,0);
892 std::vector<panzer::GlobalOrdinal> my_owned_cell_distribution(num_ranks,0);
893 my_owned_cell_distribution[rank] = num_owned_cells;
895 Teuchos::reduceAll(*comm,
Teuchos::REDUCE_SUM, num_ranks, my_owned_cell_distribution.data(),owned_cell_distribution.data());
898 std::vector<panzer::GlobalOrdinal> virtual_cell_distribution(num_ranks,0);
900 std::vector<panzer::GlobalOrdinal> my_virtual_cell_distribution(num_ranks,0);
901 my_virtual_cell_distribution[rank] = num_virtual_cells;
903 Teuchos::reduceAll(*comm,
Teuchos::REDUCE_SUM, num_ranks, my_virtual_cell_distribution.data(),virtual_cell_distribution.data());
906 panzer::GlobalOrdinal num_global_real_cells=0;
907 for(
int i=0;i<num_ranks;++i){
908 num_global_real_cells+=owned_cell_distribution[i];
911 panzer::GlobalOrdinal global_virtual_start_idx = num_global_real_cells;
912 for(
int i=0;i<rank;++i){
913 global_virtual_start_idx += virtual_cell_distribution[i];
916 for(
int i=0;i<num_virtual_cells;++i){
917 virtual_cells(i) = global_virtual_start_idx + panzer::GlobalOrdinal(i);
923 Kokkos::View<panzer::LocalOrdinal*[2]> face_to_cells = Kokkos::View<panzer::LocalOrdinal*[2]>(
"face_to_cells",num_total_faces);
926 Kokkos::View<panzer::LocalOrdinal*[2]> face_to_localidx = Kokkos::View<panzer::LocalOrdinal*[2]>(
"face_to_localidx",num_total_faces);
929 Kokkos::View<panzer::LocalOrdinal**> cell_to_face = Kokkos::View<panzer::LocalOrdinal**>(
"cell_to_face",num_total_cells,faces_per_cell);
932 Kokkos::deep_copy(cell_to_face,-1);
936 PANZER_FUNC_TIME_MONITOR_DIFF(
"Transer faceToElement to local",TransferFaceToElementLocal);
938 int virtual_cell_index = num_real_cells;
939 for(
size_t f=0;f<elems_by_face.extent(0);f++) {
941 const panzer::GlobalOrdinal global_c0 = elems_by_face(f,0);
942 const panzer::GlobalOrdinal global_c1 = elems_by_face(f,1);
945 TEUCHOS_ASSERT(global_to_local.find(global_c0)!=global_to_local.end());
946 TEUCHOS_ASSERT(global_to_local.find(global_c1)!=global_to_local.end());
948 auto c0 = global_to_local[global_c0];
949 auto lidx0 = face_to_lidx(f,0);
950 auto c1 = global_to_local[global_c1];
951 auto lidx1 = face_to_lidx(f,1);
958 c0 = virtual_cell_index++;
965 cell_to_face(c0,lidx0) = f;
971 c1 = virtual_cell_index++;
978 cell_to_face(c1,lidx1) = f;
982 face_to_cells(f,0) = c0;
983 face_to_localidx(f,0) = lidx0;
984 face_to_cells(f,1) = c1;
985 face_to_localidx(f,1) = lidx1;
987 face_to_cells(f,0) = c1;
988 face_to_localidx(f,0) = lidx1;
989 face_to_cells(f,1) = c0;
990 face_to_localidx(f,1) = lidx0;
1004 PANZER_FUNC_TIME_MONITOR_DIFF(
"Assign Indices",AssignIndices);
1013 mesh_info.
global_cells = Kokkos::View<panzer::GlobalOrdinal*>(
"global_cell_indices",num_total_cells);
1014 mesh_info.
local_cells = Kokkos::View<panzer::LocalOrdinal*>(
"local_cell_indices",num_total_cells);
1016 for(
int i=0;i<num_owned_cells;++i){
1021 for(
int i=0;i<num_ghstd_cells;++i){
1022 mesh_info.
global_cells(i+num_owned_cells) = ghstd_cells(i);
1023 mesh_info.
local_cells(i+num_owned_cells) = i+num_owned_cells;
1026 for(
int i=0;i<num_virtual_cells;++i){
1027 mesh_info.
global_cells(i+num_real_cells) = virtual_cells(i);
1028 mesh_info.
local_cells(i+num_real_cells) = i+num_real_cells;
1031 mesh_info.
cell_vertices = Kokkos::View<double***, PHX::Device>(
"cell_vertices",num_total_cells,vertices_per_cell,space_dim);
1036 for(
int i=0;i<num_owned_cells;++i){
1037 for(
int j=0;j<vertices_per_cell;++j){
1038 for(
int k=0;k<space_dim;++k){
1044 for(
int i=0;i<num_ghstd_cells;++i){
1045 for(
int j=0;j<vertices_per_cell;++j){
1046 for(
int k=0;k<space_dim;++k){
1047 mesh_info.
cell_vertices(i+num_owned_cells,j,k) = ghstd_vertices(i,j,k);
1055 PANZER_FUNC_TIME_MONITOR_DIFF(
"Assign geometry traits",AssignGeometryTraits);
1056 for(
int i=0;i<num_virtual_cells;++i){
1058 const panzer::LocalOrdinal virtual_cell = i+num_real_cells;
1059 bool exists =
false;
1060 for(
int local_face=0; local_face<faces_per_cell; ++local_face){
1061 const panzer::LocalOrdinal face = cell_to_face(virtual_cell, local_face);
1064 const panzer::LocalOrdinal other_side = (face_to_cells(face, 0) == virtual_cell) ? 1 : 0;
1065 const panzer::LocalOrdinal real_cell = face_to_cells(face,other_side);
1067 for(
int j=0;j<vertices_per_cell;++j){
1068 for(
int k=0;k<space_dim;++k){
1081 std::vector<std::string> sideset_names;
1084 for(
const std::string & element_block_name : element_block_names){
1085 PANZER_FUNC_TIME_MONITOR_DIFF(
"Set up setupLocalMeshBlockInfo",SetupLocalMeshBlockInfo);
1087 setupLocalMeshBlockInfo(mesh, conn, mesh_info, element_block_name, block_info);
1090 for(
const std::string & sideset_name : sideset_names){
1091 PANZER_FUNC_TIME_MONITOR_DIFF(
"Setup LocalMeshSidesetInfo",SetupLocalMeshSidesetInfo);
1093 setupLocalMeshSidesetInfo(mesh, conn, mesh_info, element_block_name, sideset_name, sideset_info);
void getSidesetNames(std::vector< std::string > &name) const
std::map< std::string, std::map< std::string, LocalMeshSidesetInfo > > sidesets
Kokkos::View< double ***, PHX::Device > cell_vertices
std::string element_block_name
void getElementVerticesNoResize(const std::vector< std::size_t > &localIds, ArrayT &vertices) const
Kokkos::View< panzer::LocalOrdinal * > local_cells
void getElementBlockNames(std::vector< std::string > &names) const
Teuchos::RCP< const shards::CellTopology > cell_topology
void generateLocalMeshInfo(const panzer_stk::STK_Interface &mesh, panzer::LocalMeshInfo &mesh_info)
virtual LocalOrdinal getConnectivitySize(LocalOrdinal localElmtId) const =0
Kokkos::View< panzer::GlobalOrdinal * > global_cells
panzer::LocalOrdinal num_owned_cells
Kokkos::View< panzer::LocalOrdinal *[2]> face_to_cells
std::size_t elementLocalId(stk::mesh::Entity elmt) const
panzer::LocalOrdinal num_virtual_cells
Teuchos::RCP< const shards::CellTopology > cell_topology
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
#define TEUCHOS_TEST_FOR_EXCEPT_MSG(throw_exception_test, msg)
virtual const std::vector< LocalOrdinal > & getElementBlock(const std::string &blockID) const =0
virtual void getElementBlockIds(std::vector< std::string > &elementBlockIds) const =0
Pure virtual base class for supplying mesh connectivity information to the DOF Manager.
virtual void getElementBlockTopologies(std::vector< shards::CellTopology > &elementBlockTopologies) const =0
panzer::LocalOrdinal num_ghstd_cells
std::map< std::string, LocalMeshBlockInfo > element_blocks
bool isInitialized() const
Has initialize been called on this mesh object?
Kokkos::View< panzer::LocalOrdinal *[2]> face_to_lidx
void getAllSides(const std::string &sideName, std::vector< stk::mesh::Entity > &sides) const
Kokkos::View< panzer::LocalOrdinal ** > cell_to_faces
std::string element_block_name
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
get the comm associated with this mesh
#define TEUCHOS_ASSERT(assertion_test)
void getSideElementCascade(const panzer_stk::STK_Interface &mesh, const std::string &blockId, const std::vector< stk::mesh::Entity > &sides, std::vector< std::size_t > &localSubcellDim, std::vector< std::size_t > &localSubcellIds, std::vector< stk::mesh::Entity > &elements)
void setupSubLocalMeshInfo(const panzer::LocalMeshInfoBase &parent_info, const std::vector< panzer::LocalOrdinal > &owned_parent_cells, panzer::LocalMeshInfoBase &sub_info)
virtual void buildConnectivity(const FieldPattern &fp)=0
Teuchos::RCP< const shards::CellTopology > getCellTopology(const std::string &eBlock) const
#define TEUCHOS_FUNC_TIME_MONITOR_DIFF(FUNCNAME, DIFF)
virtual std::string getBlockId(LocalOrdinal localElmtId) const =0
#define TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(throw_exception_test, Exception, msg)
virtual const GlobalOrdinal * getConnectivity(LocalOrdinal localElmtId) const =0