本文整理汇总了C++中phx::MDField::dimension方法的典型用法代码示例。如果您正苦于以下问题:C++ MDField::dimension方法的具体用法?C++ MDField::dimension怎么用?C++ MDField::dimension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phx::MDField
的用法示例。
在下文中一共展示了MDField::dimension方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCubatureCV
void IntegrationValues2<Scalar>::
getCubatureCV(const PHX::MDField<Scalar,Cell,NODE,Dim>& in_node_coordinates)
{
int num_space_dim = int_rule->topology->getDimension();
if (int_rule->isSide() && num_space_dim==1) {
std::cout << "WARNING: 0-D quadrature rule infrastructure does not exist!!! Will not be able to do "
<< "non-natural integration rules.";
return;
}
{
size_type num_cells = in_node_coordinates.dimension(0);
size_type num_nodes = in_node_coordinates.dimension(1);
size_type num_dims = in_node_coordinates.dimension(2);
for (size_type cell = 0; cell < num_cells; ++cell) {
for (size_type node = 0; node < num_nodes; ++node) {
for (size_type dim = 0; dim < num_dims; ++dim) {
node_coordinates(cell,node,dim) =
in_node_coordinates(cell,node,dim);
dyn_node_coordinates(cell,node,dim) =
Sacado::ScalarValue<Scalar>::eval(in_node_coordinates(cell,node,dim));
}
}
}
}
if (int_rule->cv_type == "side")
intrepid_cubature->getCubature(dyn_phys_cub_points.get_view(),dyn_phys_cub_norms.get_view(),dyn_node_coordinates.get_view());
else
intrepid_cubature->getCubature(dyn_phys_cub_points.get_view(),dyn_phys_cub_weights.get_view(),dyn_node_coordinates.get_view());
size_type num_cells = dyn_phys_cub_points.dimension(0);
size_type num_ip =dyn_phys_cub_points.dimension(1);
size_type num_dims = dyn_phys_cub_points.dimension(2);
for (size_type cell = 0; cell < num_cells; ++cell) {
for (size_type ip = 0; ip < num_ip; ++ip) {
if (int_rule->cv_type != "side")
weighted_measure(cell,ip) = dyn_phys_cub_weights(cell,ip);
for (size_type dim = 0; dim < num_dims; ++dim) {
ip_coordinates(cell,ip,dim) = dyn_phys_cub_points(cell,ip,dim);
if (int_rule->cv_type == "side")
weighted_normals(cell,ip,dim) = dyn_phys_cub_norms(cell,ip,dim);
}
}
}
}
示例2: evaluateContainer
virtual void evaluateContainer(const PHX::MDField<panzer::Traits::Residual::ScalarT,panzer::Cell,panzer::IP,panzer::Dim> & points,
PHX::MDField<panzer::Traits::Residual::ScalarT> & field) const
{
int num_cells = field.dimension(0);
int num_qp = points.dimension(1);
for(int i=0; i<num_cells; i++) {
for(int j=0; j<num_qp; j++) {
double x = points(i,j,0); // just x and y
double y = points(i,j,1);
field(i,j,0) = (x+y)*(x+y);
field(i,j,1) = sin(x+y);
}
}
}
示例3: af
void IntegrationValues2<Scalar>::
evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim>& in_node_coordinates,
const PHX::MDField<Scalar,Cell,IP,Dim>& other_ip_coordinates)
{
getCubature(in_node_coordinates);
{
// Determine the permutation.
std::vector<size_type> permutation(other_ip_coordinates.dimension(1));
permuteToOther(ip_coordinates, other_ip_coordinates, permutation);
// Apply the permutation to the cubature arrays.
MDFieldArrayFactory af(prefix, alloc_arrays);
const size_type num_ip = dyn_cub_points.dimension(0);
{
const size_type num_dim = dyn_side_cub_points.dimension(1);
DblArrayDynamic old_dyn_side_cub_points = af.template buildArray<double,IP,Dim>(
"old_dyn_side_cub_points", num_ip, num_dim);
old_dyn_side_cub_points.deep_copy(dyn_side_cub_points);
for (size_type ip = 0; ip < num_ip; ++ip)
if (ip != permutation[ip])
for (size_type dim = 0; dim < num_dim; ++dim)
dyn_side_cub_points(ip, dim) = old_dyn_side_cub_points(permutation[ip], dim);
}
{
const size_type num_dim = dyn_cub_points.dimension(1);
DblArrayDynamic old_dyn_cub_points = af.template buildArray<double,IP,Dim>(
"old_dyn_cub_points", num_ip, num_dim);
old_dyn_cub_points.deep_copy(dyn_cub_points);
for (size_type ip = 0; ip < num_ip; ++ip)
if (ip != permutation[ip])
for (size_type dim = 0; dim < num_dim; ++dim)
dyn_cub_points(ip, dim) = old_dyn_cub_points(permutation[ip], dim);
}
{
DblArrayDynamic old_dyn_cub_weights = af.template buildArray<double,IP>(
"old_dyn_cub_weights", num_ip);
old_dyn_cub_weights.deep_copy(dyn_cub_weights);
for (size_type ip = 0; ip < dyn_cub_weights.dimension(0); ++ip)
if (ip != permutation[ip])
dyn_cub_weights(ip) = old_dyn_cub_weights(permutation[ip]);
}
{
const size_type num_cells = ip_coordinates.dimension(0), num_ip = ip_coordinates.dimension(1),
num_dim = ip_coordinates.dimension(2);
Array_CellIPDim old_ip_coordinates = af.template buildStaticArray<Scalar,Cell,IP,Dim>(
"old_ip_coordinates", num_cells, num_ip, num_dim);
Kokkos::deep_copy(old_ip_coordinates.get_kokkos_view(), ip_coordinates.get_kokkos_view());
for (size_type cell = 0; cell < num_cells; ++cell)
for (size_type ip = 0; ip < num_ip; ++ip)
if (ip != permutation[ip])
for (size_type dim = 0; dim < num_dim; ++dim)
ip_coordinates(cell, ip, dim) = old_ip_coordinates(cell, permutation[ip], dim);
}
// All subsequent calculations inherit the permutation.
}
evaluateRemainingValues(in_node_coordinates);
}
示例4: coordinate
//**********************************************************************
PHX_EVALUATE_FIELDS(CoordinatesEvaluator,d)
{
PHX::MDField<double,Cell,NODE,Dim> coords = this->wda(d).cell_vertex_coordinates;
// const Intrepid::FieldContainer<double> & coords = this->wda(d).cell_vertex_coordinates;
// copy coordinates directly into the field
for(std::size_t i=0; i<d.num_cells; i++)
for(int j=0; j<coords.dimension(1); j++)
coordinate(i,j) = coords(i,j,dimension);
}
示例5: transformWeightedGradientBF
void transformWeightedGradientBF (
const Field<2>& F, const RealType& F_det,
const PHX::MDField<RealType, Cell, Node, QuadPoint, Dim>& w_grad_bf,
const int cell, const int pt, const int node, RealType w[3])
{
const int nd = w_grad_bf.dimension(3);
for (int k = 0; k < nd; ++k) {
w[k] = 0;
for (int i = 0; i < nd; ++i)
w[k] += (w_grad_bf(cell, node, pt, i) * F()(cell, pt, i, k));
w[k] /= F_det;
}
}
示例6: d
static void
permuteToOther(const PHX::MDField<Scalar,Cell,IP,Dim>& coords,
const PHX::MDField<Scalar,Cell,IP,Dim>& other_coords,
std::vector<typename ArrayTraits<Scalar,PHX::MDField<Scalar> >::size_type>& permutation)
{
typedef typename ArrayTraits<Scalar,PHX::MDField<Scalar> >::size_type size_type;
// We can safely assume: (1) The permutation is the same for every cell in
// the workset. (2) The first workset has valid data. Hence we operate only
// on cell 0.
const size_type cell = 0;
const size_type num_ip = coords.dimension(1), num_dim = coords.dimension(2);
permutation.resize(num_ip);
std::vector<char> taken(num_ip, 0);
for (size_type ip = 0; ip < num_ip; ++ip) {
// Find an other point to associate with ip.
size_type i_min = 0;
Scalar d_min = -1;
for (size_type other_ip = 0; other_ip < num_ip; ++other_ip) {
// For speed, skip other points that are already associated.
if (taken[other_ip]) continue;
// Compute the distance between the two points.
Scalar d(0);
for (size_type dim = 0; dim < num_dim; ++dim) {
const Scalar diff = coords(cell, ip, dim) - other_coords(cell, other_ip, dim);
d += diff*diff;
}
if (d_min < 0 || d < d_min) {
d_min = d;
i_min = other_ip;
}
}
// Record the match.
permutation[ip] = i_min;
// This point is now taken.
taken[i_min] = 1;
}
}
示例7: dPhiInv
void SurfaceBasis<EvalT, Traits>::computeJacobian(
const PHX::MDField<MeshScalarT, Cell, QuadPoint, Dim, Dim> basis,
const PHX::MDField<MeshScalarT, Cell, QuadPoint, Dim, Dim> dualBasis,
PHX::MDField<MeshScalarT, Cell, QuadPoint> area)
{
const std::size_t worksetSize = basis.dimension(0);
for (std::size_t cell(0); cell < worksetSize; ++cell) {
for (std::size_t pt(0); pt < numQPs; ++pt) {
Intrepid::Tensor<MeshScalarT> dPhiInv(3, &dualBasis(cell, pt, 0, 0));
Intrepid::Tensor<MeshScalarT> dPhi(3, &basis(cell, pt, 0, 0));
Intrepid::Vector<MeshScalarT> G_2(3, &basis(cell, pt, 2, 0));
MeshScalarT j0 = Intrepid::det(dPhi);
MeshScalarT jacobian = j0 *
std::sqrt( Intrepid::dot(Intrepid::dot(G_2, Intrepid::transpose(dPhiInv) * dPhiInv), G_2));
area(cell, pt) = jacobian * refWeights(pt);
}
}
}
示例8: if
void IntegrationValues2<Scalar>::
evaluateValuesCV(const PHX::MDField<Scalar,Cell,NODE,Dim> & in_node_coordinates)
{
Intrepid2::CellTools<Scalar> cell_tools;
{
size_type num_cells = in_node_coordinates.dimension(0);
size_type num_nodes = in_node_coordinates.dimension(1);
size_type num_dims = in_node_coordinates.dimension(2);
for (size_type cell = 0; cell < num_cells; ++cell) {
for (size_type node = 0; node < num_nodes; ++node) {
for (size_type dim = 0; dim < num_dims; ++dim) {
node_coordinates(cell,node,dim) =
in_node_coordinates(cell,node,dim);
dyn_node_coordinates(cell,node,dim) =
Sacado::ScalarValue<Scalar>::eval(in_node_coordinates(cell,node,dim));
}
}
}
}
if (int_rule->cv_type == "volume")
intrepid_cubature->getCubature(dyn_phys_cub_points,dyn_phys_cub_weights,dyn_node_coordinates);
else if (int_rule->cv_type == "side")
intrepid_cubature->getCubature(dyn_phys_cub_points,dyn_phys_cub_norms,dyn_node_coordinates);
if (int_rule->cv_type == "volume")
{
size_type num_cells = dyn_phys_cub_points.dimension(0);
size_type num_ip = dyn_phys_cub_points.dimension(1);
size_type num_dims = dyn_phys_cub_points.dimension(2);
for (size_type cell = 0; cell < num_cells; ++cell) {
for (size_type ip = 0; ip < num_ip; ++ip) {
weighted_measure(cell,ip) = dyn_phys_cub_weights(cell,ip);
for (size_type dim = 0; dim < num_dims; ++dim)
ip_coordinates(cell,ip,dim) = dyn_phys_cub_points(cell,ip,dim);
}
}
cell_tools.mapToReferenceFrame(ref_ip_coordinates, ip_coordinates, node_coordinates,
*(int_rule->topology),-1);
cell_tools.setJacobian(jac, ref_ip_coordinates, node_coordinates,
*(int_rule->topology));
}
else if (int_rule->cv_type == "side")
{
size_type num_cells = dyn_phys_cub_points.dimension(0);
size_type num_ip = dyn_phys_cub_points.dimension(1);
size_type num_dims = dyn_phys_cub_points.dimension(2);
for (size_type cell = 0; cell < num_cells; ++cell) {
for (size_type ip = 0; ip < num_ip; ++ip) {
for (size_type dim = 0; dim < num_dims; ++dim) {
ip_coordinates(cell,ip,dim) = dyn_phys_cub_points(cell,ip,dim);
weighted_normals(cell,ip,dim) = dyn_phys_cub_norms(cell,ip,dim);
}
}
}
cell_tools.mapToReferenceFrame(ref_ip_coordinates, ip_coordinates, node_coordinates,
*(int_rule->topology),-1);
cell_tools.setJacobian(jac, ref_ip_coordinates, node_coordinates,
*(int_rule->topology));
}
cell_tools.setJacobianInv(jac_inv, jac);
cell_tools.setJacobianDet(jac_det, jac);
}