45 #include "Phalanx_DataLayout.hpp"
46 #include "Phalanx_DataLayout_MDALayout.hpp"
49 #include "Panzer_Workset_Builder.hpp"
61 #include "Shards_CellTopology.hpp"
67 void buildLocalOrientations(
const int num_cells,
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]];
85 applyBV2Orientations(
const int num_cells,
86 BasisValues2<double> & basis_values,
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)
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_nodes.extent(0);
171 const int num_nodes_per_cell = partition.
cell_nodes.extent(1);
172 const int num_dims_per_node = partition.
cell_nodes.extent(2);
184 const auto partition_nodes = partition.
cell_nodes;
186 Kokkos::parallel_for(num_cells, KOKKOS_LAMBDA (
int i) {
187 for(
int j=0;j<num_nodes_per_cell;++j)
188 for(
int k=0;k<num_dims_per_node;++k)
189 cnc(i,j,k) = partition_nodes(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()<<
"'");
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);
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);
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);
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);
597 num_cells = o_cells + g_cells + v_cells;
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;
Control volume side integral.
int num_cells
DEPRECATED - use: numCells()
bool hasSubcellConnectivity(const unsigned int subcell_dimension) const
Check if subcell connectivity exists for a given dimension.
Teuchos::RCP< const shards::CellTopology > cell_topology
std::map< size_t, Teuchos::RCP< const panzer::IntegrationRule > > _integration_rule_map
PHX::View< const int * > cell_local_ids_k
virtual Kokkos::DynRankView< double > getPoints(const shards::CellTopology &topo) const =0
Get the points for a particular topology.
Teuchos::RCP< panzer::SubcellConnectivity > face_connectivity_
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...
unsigned int numDimensions() const
Get the cell dimension for the mesh.
std::map< size_t, std::map< size_t, Teuchos::RCP< panzer::BasisValues2< double > > > > basis_point_values_map_
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 SubcellConnectivity & getSubcellConnectivity(const unsigned int subcell_dimension) const
Get the subcell connectivity for the workset topology.
std::vector< size_t > cell_local_ids
Integral over a specific side of cells (side must be set)
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > getOrientations() const
Used to define options for lazy evaluation of BasisValues and IntegrationValues objects.
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 ...
PHX::View< panzer::LocalOrdinal * > local_cells
Teuchos::RCP< std::vector< int > > ir_degrees
If workset corresponds to a sub cell, what is the index?
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::map< size_t, Teuchos::RCP< const panzer::IntegrationValues2< double > > > integration_values_map_
Teuchos::RCP< std::vector< std::string > > basis_names
Value corresponds to basis type. Use the offest for indexing.
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...
bool hasGenerator() const
Check if the point descriptor has a generator for generating point values.
int subcell_dim
DEPRECATED - use: getSubcellDimension()
int numOwnedCells() const
Number of cells owned by this workset.
int getSubcellIndex() const
Get the subcell index (returns -1 if not a subcell)
std::map< size_t, Teuchos::RCP< const panzer::PureBasis > > _pure_basis_map
No integral specified - default state.
PHX::MDField< Scalar, T0 > buildStaticArray(const std::string &str, int d0) const
Generates a SubcellConnectivity associated with faces and cells given a partition of the local mesh...
int numGhostCells() const
Number of cells owned by a different workset.
const int & getType() const
Get type of integrator.
panzer::LocalOrdinal num_owned_cells
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)
panzer::LocalOrdinal num_virtual_cells
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
const std::string & getType() const
Get type of basis.
Teuchos::RCP< const shards::CellTopology > cell_topology_
#define TEUCHOS_TEST_FOR_EXCEPT_MSG(throw_exception_test, msg)
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...
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.
std::vector< Teuchos::RCP< panzer::IntegrationValues2< double > > > int_rules
std::map< size_t, Teuchos::RCP< panzer::PointValues2< double > > > point_values_map_
const PointGenerator & getGenerator() const
const int & getSide() const
Get side associated with integration - this is for backward compatibility.
panzer::LocalOrdinal num_ghstd_cells
Integral over all sides of cells (closed surface integral)
int getOrder() const
Get order of basis.
std::map< size_t, std::map< size_t, Teuchos::RCP< panzer::BasisValues2< double > > > > basis_integration_values_map_
const panzer::IntegrationValues2< double > & getIntegrationValues(const panzer::IntegrationDescriptor &description, const bool lazy_version=false) const
Get the integration values for a given integration description.
Kokkos::View< const int *, PHX::Device > getLocalCellIDs() const
Get the local cell IDs for the workset.
std::string block_id
DEPRECATED - use: getElementBlock()
WorksetDetails()
Default constructor.
KOKKOS_INLINE_FUNCTION int numSubcells() const
Gives number of subcells (e.g. faces) in connectivity.
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...
int subcell_index
DEPRECATED - use: getSubcellIndex()
const std::string & getType() const
Get unique string associated with the type of point descriptor. This will be used generate a hash to ...
int numCells() const
Number of total cells in workset (owned, ghost, and virtual)
int getSubcellDimension() const
Get the subcell dimension.
CellCoordArray getCellNodes() const
Get the node coordinates for the cells.
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
bool align_side_points_
If workset side integration values must align with another workset, there must be a unique order assi...
CellCoordArray cell_node_coordinates
DEPRECATED - use: getCellNodes()
PHX::View< double *** > cell_nodes
const std::string & getElementBlock() const
Get the element block id.
std::string element_block_name
virtual bool hasPoints(const shards::CellTopology &topo) const =0
Check if the generator can generate points for the given topology.
int numVirtualCells() const
Number of cells not owned by any workset - these are used for boundary conditions.
Description and data layouts associated with a particular basis.
#define TEUCHOS_ASSERT(assertion_test)
const panzer::SubcellConnectivity & getFaceConnectivity() const
void setup(const LocalMeshPartition &partition, const WorksetOptions &options)
Constructs the workset details from a given chunk of the mesh.
const panzer::BasisValues2< double > & getBasisValues(const panzer::BasisDescriptor &basis_description, const bool lazy_version=false) const