13 #include "Phalanx_DataLayout.hpp"
14 #include "Phalanx_DataLayout_MDALayout.hpp"
17 #include "Panzer_Workset_Builder.hpp"
29 #include "Shards_CellTopology.hpp"
35 void buildLocalOrientations(
const int num_cells,
38 std::vector<Intrepid2::Orientation> & workset_orientations)
42 const auto & local_orientations = *orientations_interface->
getOrientations();
43 workset_orientations.resize(num_cells);
46 auto local_cell_ids_host = Kokkos::create_mirror_view(local_cell_ids);
47 Kokkos::deep_copy(local_cell_ids_host, local_cell_ids);
48 for(
int i=0; i<num_cells; ++i)
49 workset_orientations[i] = local_orientations[local_cell_ids_host[i]];
53 applyBV2Orientations(
const int num_cells,
54 BasisValues2<double> & basis_values,
62 if(orientations_interface.
is_null())
66 if(basis_values.orientationsApplied())
70 std::vector<Intrepid2::Orientation> workset_orientations(num_cells);
71 buildLocalOrientations(num_cells,local_cell_ids,orientations_interface, workset_orientations);
73 basis_values.applyOrientations(workset_orientations,num_cells);
83 , ir_degrees(new std::vector<int>())
84 , basis_names(new std::vector<std::string>())
88 , num_virtual_cells_(0)
119 Kokkos::deep_copy(cell_ids, partition.
local_cells);
123 auto local_cells_h = Kokkos::create_mirror_view(partition.
local_cells);
124 Kokkos::deep_copy(local_cells_h, partition.
local_cells);
127 const int local_cell = local_cells_h(cell);
138 const int num_partition_cells = partition.
cell_nodes.extent(0);
139 const int num_nodes_per_cell = partition.
cell_nodes.extent(1);
140 const int num_dims_per_node = partition.
cell_nodes.extent(2);
152 const auto partition_nodes = partition.
cell_nodes;
154 Kokkos::parallel_for(num_cells, KOKKOS_LAMBDA (
int i) {
155 for(
int j=0;j<num_nodes_per_cell;++j)
156 for(
int k=0;k<num_dims_per_node;++k)
157 cnc(i,j,k) = partition_nodes(i,j,k);
165 face_connectivity->setup(partition);
188 "Workset::getSubcellConnectivity : Requested subcell dimension "<<subcell_dimension<<
" for a "<<
num_dimensions_<<
"D workset. This is not supported.");
203 const bool lazy_version)
const
208 size_t key = description.
getKey();
210 panzer::hash_combine<int>(key, 123);
215 return *(itr->second);
226 "Workset::getIntegrationValues : Attempted to build integration values for side '"<<description.
getSide()<<
"', but workset is constructed for side '"<<
getSubcellIndex()<<
"'");
255 ir_degrees->push_back(iv->int_rule->cubature_degree);
265 const bool lazy_version)
const
272 for(
const auto & pr : itr->second)
297 const bool lazy_version)
const
302 size_t basis_key = basis_description.
getKey();
304 panzer::hash_combine<int>(basis_key, 123);
307 size_t integration_key = integration_description.
getKey();
309 panzer::hash_combine<int>(integration_key, 123);
314 const auto & submap = itr->second;
315 const auto itr2 = submap.find(integration_key);
316 if(itr2 != submap.end())
317 return *(itr2->second);
334 biv->setupUniform(bir, iv.getUniformCubaturePointsRef(
false), iv.getJacobian(
false), iv.getJacobianDeterminant(
false), iv.getJacobianInverse(
false));
336 biv->setup(bir, iv.getCubaturePointsRef(
false), iv.getJacobian(
false), iv.getJacobianDeterminant(
false), iv.getJacobianInverse(
false));
339 std::vector<Intrepid2::Orientation> workset_orientations;
343 biv->setWeightedMeasure(iv.getWeightedMeasure(
false));
351 biv->setupArrays(bir);
356 biv->evaluateValuesCV(iv.ref_ip_coordinates,
369 biv->evaluateValues(iv.cub_points,
380 biv->evaluateValues(iv.ref_ip_coordinates,
396 bases.push_back(biv);
414 return *(itr->second);
417 "Point Descriptor of type '"<<description.
getType()<<
"' does not have associated generator.");
440 const bool lazy_version)
const
445 size_t basis_key = basis_description.
getKey();
447 panzer::hash_combine<int>(basis_key, 123);
452 const auto & submap = itr->second;
453 const auto itr2 = submap.find(point_description.
getKey());
454 if(itr2 != submap.end())
455 return *(itr2->second);
472 bpv->setupUniform(bir, pv.coords_ref, pv.jac, pv.jac_det, pv.jac_inv);
475 std::vector<Intrepid2::Orientation> workset_orientations;
486 bpv->setupArrays(bir);
487 bpv->evaluateValues(pv.coords_ref,
525 "Workset::getIntegrationValues : Attempted to build integration values for side '"<<description.
getSide()<<
"', but workset is constructed for side '"<<
getSubcellIndex()<<
"'");
534 return *(itr->second);
552 return *(itr->second);
565 num_cells = o_cells + g_cells + v_cells;
574 os <<
"Workset" << endl;
576 os <<
" num_cells:" << w.
num_cells << endl;
580 os <<
" cell_local_ids (size=" << w.
getLocalCellIDs().size() <<
")" << endl;
584 os <<
" ir_degrees: " << endl;
585 for (std::vector<int>::const_iterator ir = w.
ir_degrees->begin();
587 os <<
" " << *ir << std::endl;
589 std::vector<int>::const_iterator ir = w.
ir_degrees->begin();
593 os <<
" IR Values (Degree=" << *ir <<
"):" << endl;
595 os <<
" cub_points:" << endl;
596 os << (*irv)->cub_points << endl;
598 os <<
" side_cub_points:" << endl;
599 os << (*irv)->side_cub_points << endl;
601 os <<
" cub_weights:" << endl;
602 os << (*irv)->cub_weights << endl;
604 os <<
" node_coordinates:" << endl;
605 os << (*irv)->node_coordinates << endl;
607 os <<
" jac:" << endl;
608 os << (*irv)->jac << endl;
610 os <<
" jac_inv:" << endl;
611 os << (*irv)->jac_inv << endl;
613 os <<
" jac_det:" << endl;
614 os << (*irv)->jac_det << endl;
616 os <<
" weighted_measure:" << endl;
617 os << (*irv)->weighted_measure << endl;
619 os <<
" covarient:" << endl;
620 os << (*irv)->covarient << endl;
622 os <<
" contravarient:" << endl;
623 os << (*irv)->contravarient << endl;
625 os <<
" norm_contravarient:" << endl;
626 os << (*irv)->norm_contravarient << endl;
628 os <<
" ip_coordinates:" << endl;
629 os << (*irv)->ip_coordinates << endl;
631 os <<
" int_rule->getName():" << (*irv)->int_rule->getName() << endl;
635 os <<
" basis_names: " << endl;
636 for (std::vector<std::string>::const_iterator b = w.
basis_names->begin();
638 os <<
" " << *b << std::endl;
640 std::vector<std::string>::const_iterator b = w.
basis_names->begin();
644 os <<
" Basis Values (basis_name=" << *b <<
"):" << endl;
672 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