Skip to content

Commit

Permalink
Merge 'trilinos/Trilinos:develop' (82b5ec6) into 'tcad-charon/Trilino…
Browse files Browse the repository at this point in the history
…s:develop' (5d3eef0).

* trilinos-develop:
  Adding fix to stop basis values from applying orientations to virtual cells
  have mesh motion test passing
  Fix PanzerAdaptersSTK_tScatterResidual_MPI_2  and PanzerAdaptersSTK_tScatterDirichletResidual_MPI_2 with UVM off (trilinos#9644)
  Return the state of the ROL algorithm
  • Loading branch information
Charonops Jenkins Pipeline committed Sep 3, 2021
2 parents 5d3eef0 + 82b5ec6 commit 9942f4e
Show file tree
Hide file tree
Showing 10 changed files with 337 additions and 299 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1827,7 +1827,7 @@ void STK_Interface::getElementVertices_FromField(const std::vector<stk::mesh::En

// allocate space
vertices = Kokkos::createDynRankView(vertices,"vertices",elements.size(),masterVertexCount,getDimension());

auto vertices_h = Kokkos::create_mirror_view(vertices);
std::map<std::string,std::vector<std::string> >::const_iterator itr = meshCoordFields_.find(eBlock);
if(itr==meshCoordFields_.end()) {
// no coordinate field set for this element block
Expand Down Expand Up @@ -1856,10 +1856,11 @@ void STK_Interface::getElementVertices_FromField(const std::vector<stk::mesh::En

// recall mesh field coordinates are stored as displacements
// from the mesh coordinates, make sure to add them together
vertices(cell,i,d) = solnData[0]+coord[d];
vertices_h(cell,i,d) = solnData[0]+coord[d];
}
}
}
Kokkos::deep_copy(vertices, vertices_h);
}

template <typename ArrayT>
Expand Down
7 changes: 6 additions & 1 deletion packages/panzer/disc-fe/src/Panzer_BasisValues2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ namespace panzer {

PHX::MDField<Scalar,Cell,NODE,Dim> cell_vertex_coordinates_;

// Number of cells to apply orientations to (required in situations where virtual cells exist)
int num_orientations_cells_;

// Orientations object
Teuchos::RCP<const OrientationsInterface> orientations_;

/// Used to check if arrays have been cached
Expand Down Expand Up @@ -354,7 +358,8 @@ namespace panzer {

/// Set the orientations object for applying orientations using the lazy evaluation path - required for certain bases
void
setOrientations(const Teuchos::RCP<const OrientationsInterface> & orientations);
setOrientations(const Teuchos::RCP<const OrientationsInterface> & orientations,
const int num_orientations_cells = -1);

/// Set the cubature weights (weighted measure) for the basis values object - required to get weighted basis objects
void
Expand Down
20 changes: 13 additions & 7 deletions packages/panzer/disc-fe/src/Panzer_BasisValues2_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ applyOrientationsImpl(const int num_cells,
const std::vector<Intrepid2::Orientation> & orientations,
const typename BasisValues2<Scalar>::IntrepidBasis & basis)
{

// Move orientations vector to device
Kokkos::DynRankView<Intrepid2::Orientation,PHX::Device> device_orientations("drv_orts", num_cells);
auto host_orientations = Kokkos::create_mirror_view(device_orientations);
Expand Down Expand Up @@ -651,8 +652,13 @@ setupUniform(const Teuchos::RCP<const panzer::BasisIRLayout> & basis,
template <typename Scalar>
void
BasisValues2<Scalar>::
setOrientations(const Teuchos::RCP<const OrientationsInterface> & orientations)
setOrientations(const Teuchos::RCP<const OrientationsInterface> & orientations,
const int num_orientations_cells)
{
if(num_orientations_cells < 0)
num_orientations_cells_ = num_evaluate_cells_;
else
num_orientations_cells_ = num_orientations_cells;
if(orientations == Teuchos::null){
orientations_applied_ = false;
orientations_ = Teuchos::null;
Expand Down Expand Up @@ -1160,7 +1166,7 @@ getBasisValues(const bool weighted,
// fix the logic.

if(orientations_ != Teuchos::null)
applyOrientationsImpl<Scalar>(num_evaluate_cells_, tmp_basis_scalar.get_view(), *orientations_->getOrientations(), *intrepid_basis);
applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_basis_scalar.get_view(), *orientations_->getOrientations(), *intrepid_basis);

// Store for later if cache is enabled
PANZER_CACHE_DATA(basis_scalar);
Expand Down Expand Up @@ -1341,7 +1347,7 @@ getVectorBasisValues(const bool weighted,
}

if(orientations_ != Teuchos::null)
applyOrientationsImpl<Scalar>(num_evaluate_cells_, tmp_basis_vector.get_view(), *orientations_->getOrientations(), *intrepid_basis);
applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_basis_vector.get_view(), *orientations_->getOrientations(), *intrepid_basis);

// Store for later if cache is enabled
PANZER_CACHE_DATA(basis_vector);
Expand Down Expand Up @@ -1486,7 +1492,7 @@ getGradBasisValues(const bool weighted,
}

if(orientations_ != Teuchos::null)
applyOrientationsImpl<Scalar>(num_evaluate_cells_, tmp_grad_basis.get_view(), *orientations_->getOrientations(), *intrepid_basis);
applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_grad_basis.get_view(), *orientations_->getOrientations(), *intrepid_basis);

// Store for later if cache is enabled
PANZER_CACHE_DATA(grad_basis);
Expand Down Expand Up @@ -1629,7 +1635,7 @@ getCurl2DVectorBasis(const bool weighted,
}

if(orientations_ != Teuchos::null)
applyOrientationsImpl<Scalar>(num_evaluate_cells_, tmp_curl_basis_scalar.get_view(), *orientations_->getOrientations(), *intrepid_basis);
applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_curl_basis_scalar.get_view(), *orientations_->getOrientations(), *intrepid_basis);

// Store for later if cache is enabled
PANZER_CACHE_DATA(curl_basis_scalar);
Expand Down Expand Up @@ -1775,7 +1781,7 @@ getCurlVectorBasis(const bool weighted,
}

if(orientations_ != Teuchos::null)
applyOrientationsImpl<Scalar>(num_evaluate_cells_, tmp_curl_basis_vector.get_view(), *orientations_->getOrientations(), *intrepid_basis);
applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_curl_basis_vector.get_view(), *orientations_->getOrientations(), *intrepid_basis);

// Store for later if cache is enabled
PANZER_CACHE_DATA(curl_basis_vector);
Expand Down Expand Up @@ -1911,7 +1917,7 @@ getDivVectorBasis(const bool weighted,
}

if(orientations_ != Teuchos::null)
applyOrientationsImpl<Scalar>(num_evaluate_cells_, tmp_div_basis.get_view(), *orientations_->getOrientations(), *intrepid_basis);
applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_div_basis.get_view(), *orientations_->getOrientations(), *intrepid_basis);

// Store for later if cache is enabled
PANZER_CACHE_DATA(div_basis);
Expand Down
14 changes: 7 additions & 7 deletions packages/panzer/disc-fe/src/Panzer_Workset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,15 @@ getBasisValues(const panzer::BasisDescriptor & basis_description,

biv = Teuchos::rcp(new BasisValues2<double>());

biv->setOrientations(options_.orientations_);
biv->setWeightedMeasure(iv.weighted_measure);
biv->setCellVertexCoordinates(cell_vertex_coordinates);

if(integration_description.getType() == IntegrationDescriptor::VOLUME)
biv->setupUniform(bir, iv.cub_points, iv.jac, iv.jac_det, iv.jac_inv);
else
biv->setup(bir, iv.ref_ip_coordinates, iv.jac, iv.jac_det, iv.jac_inv);

biv->setOrientations(options_.orientations_, numOwnedCells()+numGhostCells());
biv->setWeightedMeasure(iv.weighted_measure);
biv->setCellVertexCoordinates(cell_vertex_coordinates);

} else {

// Standard, fully allocated version of BasisValues2
Expand Down Expand Up @@ -557,11 +557,11 @@ getBasisValues(const panzer::BasisDescriptor & basis_description,

bpv = Teuchos::rcp(new BasisValues2<double>());

bpv->setOrientations(options_.orientations_);
bpv->setCellVertexCoordinates(cell_vertex_coordinates);

bpv->setupUniform(bir, pv.coords_ref, pv.jac, pv.jac_det, pv.jac_inv);

bpv->setOrientations(options_.orientations_, numOwnedCells()+numGhostCells());
bpv->setCellVertexCoordinates(cell_vertex_coordinates);

} else {

// Standard fully allocated version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ CoordinatesEvaluator<EvalT, Traits>::
evaluateFields(
typename Traits::EvalData d)
{
PHX::MDField<double,Cell,NODE,Dim> coords = this->wda(d).cell_vertex_coordinates;
auto coords = this->wda(d).cell_vertex_coordinates.get_static_view();
auto coordinate_v = coordinate.get_static_view();
auto l_dimension = dimension;
// const Kokkos::DynRankView<double,PHX::Device> & coords = this->wda(d).cell_vertex_coordinates;

// copy coordinates directly into the field
for(index_t i=0;i<d.num_cells;i++)
for(int j=0;j<coords.extent_int(1);j++)
coordinate(i,j) = coords(i,j,dimension);
Kokkos::parallel_for(d.num_cells, KOKKOS_LAMBDA (int i) {
for(int j=0;j<coords.extent_int(1);j++)
coordinate_v(i,j) = coords(i,j,l_dimension);
});
Kokkos::fence();
}

//**********************************************************************
Expand Down
Loading

0 comments on commit 9942f4e

Please sign in to comment.