45#include "Phalanx_DataLayout.hpp"
46#include "Phalanx_DataLayout_MDALayout.hpp"
49#include "Panzer_Workset_Builder.hpp"
61#include "Shards_CellTopology.hpp"
67void buildLocalOrientations(
const int num_cells,
68 const Kokkos::View<const panzer::LocalOrdinal*,PHX::Device> & local_cell_ids,
69 const Teuchos::RCP<const OrientationsInterface> & orientations_interface,
70 std::vector<Intrepid2::Orientation> & workset_orientations)
74 const auto & local_orientations = *orientations_interface->getOrientations();
75 workset_orientations.resize(num_cells);
78 auto local_cell_ids_host = Kokkos::create_mirror_view(local_cell_ids);
79 Kokkos::deep_copy(local_cell_ids_host, local_cell_ids);
80 for(
int i=0; i<num_cells; ++i)
81 workset_orientations[i] = local_orientations[local_cell_ids_host[i]];
85applyBV2Orientations(
const int num_cells,
86 BasisValues2<double> & basis_values,
87 const Kokkos::View<const panzer::LocalOrdinal*,PHX::Device> & local_cell_ids,
88 const Teuchos::RCP<const OrientationsInterface> & orientations_interface)
94 if(orientations_interface.is_null())
98 if(basis_values.orientationsApplied())
102 std::vector<Intrepid2::Orientation> workset_orientations(num_cells);
103 buildLocalOrientations(num_cells,local_cell_ids,orientations_interface, workset_orientations);
105 basis_values.applyOrientations(workset_orientations,num_cells);
115 , ir_degrees(new
std::vector<int>())
116 , basis_names(new
std::vector<
std::string>())
118 , num_owned_cells_(0)
119 , num_ghost_cells_(0)
120 , num_virtual_cells_(0)
121 , num_dimensions_(-1)
150 Kokkos::View<LocalOrdinal*, PHX::Device> cell_ids = Kokkos::View<LocalOrdinal*, PHX::Device>(
"cell_ids",
num_cells);
151 Kokkos::deep_copy(cell_ids, partition.
local_cells);
155 auto local_cells_h = Kokkos::create_mirror_view(partition.
local_cells);
156 Kokkos::deep_copy(local_cells_h, partition.
local_cells);
159 const int local_cell = local_cells_h(cell);
170 const int num_partition_cells = partition.
cell_vertices.extent(0);
171 const int num_vertices_per_cell = partition.
cell_vertices.extent(1);
172 const int num_dims_per_vertex = partition.
cell_vertices.extent(2);
175 TEUCHOS_ASSERT(num_partition_cells ==
num_cells);
176 TEUCHOS_ASSERT(num_vertices_per_cell > 0);
177 TEUCHOS_ASSERT(num_dims_per_vertex > 0);
186 Kokkos::parallel_for(
num_cells, KOKKOS_LAMBDA (
int i) {
187 for(
int j=0;j<num_vertices_per_cell;++j)
188 for(
int k=0;k<num_dims_per_vertex;++k)
189 cvc(i,j,k) = partition_vertices(i,j,k);
197 face_connectivity->setup(partition);
220 "Workset::getSubcellConnectivity : Requested subcell dimension "<<subcell_dimension<<
" for a "<<
num_dimensions_<<
"D workset. This is not supported.");
235 const bool lazy_version)
const
240 size_t key = description.
getKey();
242 panzer::hash_combine<int>(key, 123);
247 return *(itr->second);
258 "Workset::getIntegrationValues : Attempted to build integration values for side '"<<description.
getSide()<<
"', but workset is constructed for side '"<<
getSubcellIndex()<<
"'");
263 Teuchos::RCP<IntegrationValues2<double>> iv;
287 ir_degrees->push_back(iv->int_rule->cubature_degree);
297 const bool lazy_version)
const
304 for(
const auto & pr : itr->second)
329 const bool lazy_version)
const
334 size_t basis_key = basis_description.
getKey();
336 panzer::hash_combine<int>(basis_key, 123);
339 size_t integration_key = integration_description.
getKey();
341 panzer::hash_combine<int>(integration_key, 123);
346 const auto & submap = itr->second;
347 const auto itr2 = submap.find(integration_key);
348 if(itr2 != submap.end())
349 return *(itr2->second);
357 Teuchos::RCP<BasisValues2<double>> biv;
366 biv->setupUniform(bir, iv.getUniformCubaturePointsRef(
false), iv.getJacobian(
false), iv.getJacobianDeterminant(
false), iv.getJacobianInverse(
false));
368 biv->setup(bir, iv.getCubaturePointsRef(
false), iv.getJacobian(
false), iv.getJacobianDeterminant(
false), iv.getJacobianInverse(
false));
371 std::vector<Intrepid2::Orientation> workset_orientations;
375 biv->setWeightedMeasure(iv.getWeightedMeasure(
false));
383 biv->setupArrays(bir);
388 biv->evaluateValuesCV(iv.ref_ip_coordinates,
401 biv->evaluateValues(iv.cub_points,
412 biv->evaluateValues(iv.ref_ip_coordinates,
428 bases.push_back(biv);
446 return *(itr->second);
448 TEUCHOS_TEST_FOR_EXCEPT_MSG(not description.
hasGenerator(),
449 "Point Descriptor of type '"<<description.
getType()<<
"' does not have associated generator.");
472 const bool lazy_version)
const
477 size_t basis_key = basis_description.
getKey();
479 panzer::hash_combine<int>(basis_key, 123);
484 const auto & submap = itr->second;
485 const auto itr2 = submap.find(point_description.
getKey());
486 if(itr2 != submap.end())
487 return *(itr2->second);
496 Teuchos::RCP<BasisValues2<double>> bpv;
504 bpv->setupUniform(bir, pv.coords_ref, pv.jac, pv.jac_det, pv.jac_inv);
507 std::vector<Intrepid2::Orientation> workset_orientations;
518 bpv->setupArrays(bir);
519 bpv->evaluateValues(pv.coords_ref,
557 "Workset::getIntegrationValues : Attempted to build integration values for side '"<<description.
getSide()<<
"', but workset is constructed for side '"<<
getSubcellIndex()<<
"'");
566 return *(itr->second);
584 return *(itr->second);
606 os <<
"Workset" << endl;
608 os <<
" num_cells:" << w.
num_cells << endl;
612 os <<
" cell_local_ids (size=" << w.
getLocalCellIDs().size() <<
")" << endl;
616 os <<
" ir_degrees: " << endl;
617 for (std::vector<int>::const_iterator ir = w.
ir_degrees->begin();
619 os <<
" " << *ir << std::endl;
621 std::vector<int>::const_iterator ir = w.
ir_degrees->begin();
625 os <<
" IR Values (Degree=" << *ir <<
"):" << endl;
627 os <<
" cub_points:" << endl;
628 os << (*irv)->cub_points << endl;
630 os <<
" side_cub_points:" << endl;
631 os << (*irv)->side_cub_points << endl;
633 os <<
" cub_weights:" << endl;
634 os << (*irv)->cub_weights << endl;
636 os <<
" node_coordinates:" << endl;
637 os << (*irv)->node_coordinates << endl;
639 os <<
" jac:" << endl;
640 os << (*irv)->jac << endl;
642 os <<
" jac_inv:" << endl;
643 os << (*irv)->jac_inv << endl;
645 os <<
" jac_det:" << endl;
646 os << (*irv)->jac_det << endl;
648 os <<
" weighted_measure:" << endl;
649 os << (*irv)->weighted_measure << endl;
651 os <<
" covarient:" << endl;
652 os << (*irv)->covarient << endl;
654 os <<
" contravarient:" << endl;
655 os << (*irv)->contravarient << endl;
657 os <<
" norm_contravarient:" << endl;
658 os << (*irv)->norm_contravarient << endl;
660 os <<
" ip_coordinates:" << endl;
661 os << (*irv)->ip_coordinates << endl;
663 os <<
" int_rule->getName():" << (*irv)->int_rule->getName() << endl;
667 os <<
" basis_names: " << endl;
668 for (std::vector<std::string>::const_iterator b = w.
basis_names->begin();
670 os <<
" " << *b << std::endl;
672 std::vector<std::string>::const_iterator b = w.
basis_names->begin();
676 os <<
" Basis Values (basis_name=" << *b <<
"):" << endl;
704 os <<
" basis_layout->name():" << (*bv)->basis_layout->name() << endl;
int getOrder() const
Get order of basis.
const std::string & getType() const
Get type of basis.
std::size_t getKey() const
Get unique key associated with basis of this order and type The key is used to sort through a map of ...
Generates a SubcellConnectivity associated with faces and cells given a partition of the local mesh.
@ VOLUME
No integral specified - default state.
@ CV_VOLUME
Integral over a specific side of cells (side must be set)
@ CV_SIDE
Control volume integral.
@ CV_BOUNDARY
Control volume side integral.
@ SIDE
Integral over all sides of cells (closed surface integral)
@ SURFACE
Integral over volume.
const int & getSide() const
Get side associated with integration - this is for backward compatibility.
std::size_t getKey() const
Get unique key associated with integrator of this order and type The key is used to sort through a ma...
const int & getType() const
Get type of integrator.
PHX::MDField< Scalar, T0 > buildStaticArray(const std::string &str, int d0) const
const PointGenerator & getGenerator() const
bool hasGenerator() const
Check if the point descriptor has a generator for generating point values.
const std::string & getType() const
Get unique string associated with the type of point descriptor. This will be used generate a hash to ...
std::size_t getKey() const
Get unique key associated with integrator of this order and type The key is used to sort through a ma...
virtual Kokkos::DynRankView< double > getPoints(const shards::CellTopology &topo) const =0
Get the points for a particular topology.
virtual bool hasPoints(const shards::CellTopology &topo) const =0
Check if the generator can generate points for the given topology.
Description and data layouts associated with a particular basis.
KOKKOS_INLINE_FUNCTION int numSubcells() const
Gives number of subcells (e.g. faces) in connectivity.
int numOwnedCells() const
Number of cells owned by this workset.
const panzer::IntegrationRule & getIntegrationRule(const panzer::IntegrationDescriptor &description) const
Grab the integration rule for a given integration description (throws error if integration doesn't ex...
std::string block_id
DEPRECATED - use: getElementBlock()
Teuchos::RCP< panzer::SubcellConnectivity > face_connectivity_
std::map< size_t, Teuchos::RCP< const panzer::IntegrationValues2< double > > > integration_values_map_
std::map< size_t, std::map< size_t, Teuchos::RCP< panzer::BasisValues2< double > > > > basis_integration_values_map_
const panzer::SubcellConnectivity & getFaceConnectivity() const
int subcell_dim
DEPRECATED - use: getSubcellDimension()
std::vector< Teuchos::RCP< panzer::BasisValues2< double > > > bases
Static basis function data, key is basis name, value is index in the static_bases vector.
std::vector< Teuchos::RCP< panzer::IntegrationValues2< double > > > int_rules
Teuchos::RCP< const shards::CellTopology > cell_topology_
const std::string & getElementBlock() const
Get the element block id.
PHX::View< const int * > cell_local_ids_k
std::map< size_t, Teuchos::RCP< const panzer::IntegrationRule > > _integration_rule_map
unsigned int numDimensions() const
Get the cell dimension for the mesh.
Kokkos::View< const int *, PHX::Device > getLocalCellIDs() const
Get the local cell IDs for the workset.
int num_cells
DEPRECATED - use: numCells()
bool hasSubcellConnectivity(const unsigned int subcell_dimension) const
Check if subcell connectivity exists for a given dimension.
panzer::PointValues2< double > & getPointValues(const panzer::PointDescriptor &point_description) const
Grab the basis values for a given basis description and integration description (throws error if it d...
int numCells() const
Number of total cells in workset (owned, ghost, and virtual)
Teuchos::RCP< std::vector< std::string > > basis_names
Value corresponds to basis type. Use the offest for indexing.
const panzer::IntegrationValues2< double > & getIntegrationValues(const panzer::IntegrationDescriptor &description, const bool lazy_version=false) const
Get the integration values for a given integration description.
std::map< size_t, Teuchos::RCP< const panzer::PureBasis > > _pure_basis_map
std::map< size_t, std::map< size_t, Teuchos::RCP< panzer::BasisValues2< double > > > > basis_point_values_map_
int numGhostCells() const
Number of cells owned by a different workset.
Teuchos::RCP< std::vector< int > > ir_degrees
If workset corresponds to a sub cell, what is the index?
CellCoordArray getCellVertices() const
Get the vertices for the cells.
const panzer::PureBasis & getBasis(const panzer::BasisDescriptor &description) const
Grab the pure basis (contains data layouts) for a given basis description (throws error if integratio...
const SubcellConnectivity & getSubcellConnectivity(const unsigned int subcell_dimension) const
Get the subcell connectivity for the workset topology.
int getSubcellDimension() const
Get the subcell dimension.
int subcell_index
DEPRECATED - use: getSubcellIndex()
void setNumberOfCells(const int owned_cells, const int ghost_cells, const int virtual_cells)
Provides access to set numbers of cells (required for backwards compatibility)
const panzer::BasisValues2< double > & getBasisValues(const panzer::BasisDescriptor &basis_description, const bool lazy_version=false) const
std::map< size_t, Teuchos::RCP< panzer::PointValues2< double > > > point_values_map_
WorksetDetails()
Default constructor.
int getSubcellIndex() const
Get the subcell index (returns -1 if not a subcell)
int numVirtualCells() const
Number of cells not owned by any workset - these are used for boundary conditions.
std::vector< size_t > cell_local_ids
CellCoordArray cell_vertex_coordinates
DEPRECATED - use: getCellVertices()
void setup(const LocalMeshPartition &partition, const WorksetOptions &options)
Constructs the workset details from a given chunk of the mesh.
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
panzer::LocalOrdinal num_owned_cells
panzer::LocalOrdinal num_ghstd_cells
PHX::View< double *** > cell_vertices
panzer::LocalOrdinal num_virtual_cells
PHX::View< panzer::LocalOrdinal * > local_cells
Teuchos::RCP< const shards::CellTopology > cell_topology
std::string element_block_name
Used to define options for lazy evaluation of BasisValues and IntegrationValues objects.
bool align_side_points_
If workset side integration values must align with another workset, there must be a unique order assi...
Teuchos::RCP< const OrientationsInterface > orientations_
Must be set to apply orientations - if it is set, then orientations will be applied to basis values.
bool side_assembly_
Build integration values for sides.