本文整理汇总了C++中kokkos::DynRankView::dimension方法的典型用法代码示例。如果您正苦于以下问题:C++ DynRankView::dimension方法的具体用法?C++ DynRankView::dimension怎么用?C++ DynRankView::dimension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kokkos::DynRankView
的用法示例。
在下文中一共展示了DynRankView::dimension方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: work
void
Basis_HGRAD_LINE_Cn_FEM::
getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
const Kokkos::DynRankView<vinvValueType, vinvProperties...> vinv,
const EOperator operatorType ) {
typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
typedef Kokkos::DynRankView<vinvValueType, vinvProperties...> vinvViewType;
typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
// loopSize corresponds to cardinality
const auto loopSizeTmp1 = (inputPoints.dimension(0)/numPtsPerEval);
const auto loopSizeTmp2 = (inputPoints.dimension(0)%numPtsPerEval != 0);
const auto loopSize = loopSizeTmp1 + loopSizeTmp2;
Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
typedef typename inputPointViewType::value_type inputPointType;
const ordinal_type cardinality = outputValues.dimension(0);
auto vcprop = Kokkos::common_view_alloc_prop(inputPoints);
typedef typename Kokkos::DynRankView< inputPointType, typename inputPointViewType::memory_space> workViewType;
workViewType work(Kokkos::view_alloc("Basis_HGRAD_LINE_Cn_FEM::getValues::work", vcprop), cardinality, inputPoints.dimension(0));
switch (operatorType) {
case OPERATOR_VALUE: {
typedef Functor<outputValueViewType,inputPointViewType,vinvViewType,workViewType,
OPERATOR_VALUE,numPtsPerEval> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints, vinv, work) );
break;
}
case OPERATOR_GRAD:
case OPERATOR_D1:
case OPERATOR_D2:
case OPERATOR_D3:
case OPERATOR_D4:
case OPERATOR_D5:
case OPERATOR_D6:
case OPERATOR_D7:
case OPERATOR_D8:
case OPERATOR_D9:
case OPERATOR_D10: {
typedef Functor<outputValueViewType,inputPointViewType,vinvViewType,workViewType,
OPERATOR_Dn,numPtsPerEval> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints, vinv, work,
getOperatorOrder(operatorType)) );
break;
}
default: {
INTREPID2_TEST_FOR_EXCEPTION( true , std::invalid_argument,
">>> ERROR (Basis_HGRAD_LINE_Cn_FEM): Operator type not implemented" );
//break; commented out because this always throws
}
}
}
示例2: mapToPhysicalFrame
void
CellTools<SpT>::
mapToPhysicalFrame( /**/ Kokkos::DynRankView<physPointValueType,physPointProperties...> physPoints,
const Kokkos::DynRankView<refPointValueType,refPointProperties...> refPoints,
const Kokkos::DynRankView<worksetCellValueType,worksetCellProperties...> worksetCell,
const HGradBasisPtrType basis ) {
#ifdef HAVE_INTREPID2_DEBUG
CellTools_mapToPhysicalFrameArgs( physPoints, refPoints, worksetCell, basis->getBaseCellTopology() );
#endif
const auto cellTopo = basis->getBaseCellTopology();
const auto numCells = worksetCell.dimension(0);
//points can be rank-2 (P,D), or rank-3 (C,P,D)
const auto refPointRank = refPoints.rank();
const auto numPoints = (refPointRank == 2 ? refPoints.dimension(0) : refPoints.dimension(1));
const auto basisCardinality = basis->getCardinality();
typedef Kokkos::DynRankView<physPointValueType,physPointProperties...> physPointViewType;
typedef Kokkos::DynRankView<decltype(basis->getDummyOutputValue()),SpT> valViewType;
valViewType vals;
switch (refPointRank) {
case 2: {
// refPoints is (P,D): single set of ref. points is mapped to one or multiple physical cells
vals = valViewType("CellTools::mapToPhysicalFrame::vals", basisCardinality, numPoints);
basis->getValues(vals,
refPoints,
OPERATOR_VALUE);
break;
}
case 3: {
// refPoints is (C,P,D): multiple sets of ref. points are mapped to matching number of physical cells.
vals = valViewType("CellTools::mapToPhysicalFrame::vals", numCells, basisCardinality, numPoints);
for (size_type cell=0;cell<numCells;++cell)
basis->getValues(Kokkos::subdynrankview( vals, cell, Kokkos::ALL(), Kokkos::ALL() ),
Kokkos::subdynrankview( refPoints, cell, Kokkos::ALL(), Kokkos::ALL() ),
OPERATOR_VALUE);
break;
}
}
typedef Kokkos::DynRankView<worksetCellValueType,worksetCellProperties...> worksetCellViewType;
typedef FunctorCellTools::F_mapToPhysicalFrame<physPointViewType,worksetCellViewType,valViewType> FunctorType;
typedef typename ExecSpace<typename worksetCellViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
const auto loopSize = physPoints.dimension(0)*physPoints.dimension(1);
Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
Kokkos::parallel_for( policy, FunctorType(physPoints, worksetCell, vals) );
}
示例3: getValues
void
Basis_HGRAD_QUAD_C1_FEM::
getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
const EOperator operatorType ) {
typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
// Number of evaluation points = dim 0 of inputPoints
const auto loopSize = inputPoints.dimension(0);
Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
switch (operatorType) {
case OPERATOR_VALUE: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_GRAD:
case OPERATOR_D1: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_CURL: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_CURL> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_DIV: {
INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_DIV, std::invalid_argument,
">>> ERROR (Basis_HGRAD_QUAD_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 2D");
break;
}
case OPERATOR_D2: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_D2> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_D3:
case OPERATOR_D4:
case OPERATOR_D5:
case OPERATOR_D6:
case OPERATOR_D7:
case OPERATOR_D8:
case OPERATOR_D9:
case OPERATOR_D10: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
default: {
INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
">>> ERROR (Basis_HGRAD_QUAD_C1_FEM): Invalid operator type");
}
}
}
示例4: cell
void
Basis_HCURL_TRI_I1_FEM<SpT,OT,PT>::Internal::
getDofCoords( Kokkos::DynRankView<dofCoordValueType,dofCoordProperties...> dofCoords ) const {
#ifdef HAVE_INTREPID2_DEBUG
// Verify rank of output array.
INTREPID2_TEST_FOR_EXCEPTION( dofCoords.rank() != 2, std::invalid_argument,
">>> ERROR: (Intrepid2::Basis_HCURL_TRI_I1_FEM::getDofCoords) rank = 2 required for dofCoords array");
// Verify 0th dimension of output array.
INTREPID2_TEST_FOR_EXCEPTION( dofCoords.dimension(0) != obj_->basisCardinality_, std::invalid_argument,
">>> ERROR: (Intrepid2::Basis_HCURL_TRI_I1_FEM::getDofCoords) mismatch in number of dof and 0th dimension of dofCoords array");
// Verify 1st dimension of output array.
INTREPID2_TEST_FOR_EXCEPTION( dofCoords.dimension(1) != obj_->basisCellTopology_.getDimension(), std::invalid_argument,
">>> ERROR: (Intrepid2::Basis_HCURL_TRI_I1_FEM::getDofCoords) incorrect reference cell (1st) dimension in dofCoords array");
#endif
Kokkos::deep_copy(dofCoords, obj_->dofCoords_);
}
示例5: compareToAnalytic
ordinal_type compareToAnalytic( std::ifstream &inputFile,
const Kokkos::DynRankView<ValueType,testMatProperties...> testMat,
const ValueType reltol,
const ordinal_type iprint,
const TypeOfExactData analyticDataType ) {
INTREPID2_TEST_FOR_EXCEPTION( testMat.rank() != 2, std::invalid_argument,
">>> ERROR (compareToAnalytic): testMat must have rank 2");
Teuchos::RCP<std::ostream> outStream;
Teuchos::oblackholestream outNothing;
if (iprint > 0)
outStream = Teuchos::rcp(&std::cout, false);
else
outStream = Teuchos::rcp(&outNothing, false);
// Save the format state of the original std::cout.
Teuchos::oblackholestream oldFormatState;
oldFormatState.copyfmt(std::cout);
std::string line;
ValueType testentry;
ValueType abstol;
ValueType absdiff;
ordinal_type i = 0, j = 0;
ordinal_type err = 0;
while (! inputFile.eof() && i < static_cast<ordinal_type>(testMat.dimension(0)) ) {
std::getline(inputFile,line);
std::istringstream linestream(line);
std::string chunk;
j = 0;
while( linestream >> chunk ) {
ordinal_type num1;
ordinal_type num2;
std::string::size_type loc = chunk.find( "/", 0);
if( loc != std::string::npos ) {
chunk.replace( loc, 1, " ");
std::istringstream chunkstream(chunk);
chunkstream >> num1;
chunkstream >> num2;
testentry = (ValueType)(num1)/(ValueType)(num2);
abstol = ( std::fabs(testentry) < reltol ? reltol : std::fabs(reltol*testentry) );
absdiff = std::fabs(testentry - testMat(i, j));
if (absdiff > abstol) {
++err;
*outStream << "FAILURE --> ";
}
*outStream << "entry[" << i << "," << j << "]:" << " "
<< testMat(i, j) << " " << num1 << "/" << num2 << " "
<< absdiff << " " << "<?" << " " << abstol << "\n";
}
else {
std::istringstream chunkstream(chunk);
if (analyticDataType == INTREPID2_UTILS_FRACTION) {
chunkstream >> num1;
testentry = (ValueType)(num1);
}
else if (analyticDataType == INTREPID2_UTILS_SCALAR)
示例6: dotMultiply
void
ArrayTools<SpT>::Internal::
dotMultiply( /**/ Kokkos::DynRankView<outputValueType, outputProperties...> output,
const Kokkos::DynRankView<leftInputValueType, leftInputProperties...> leftInput,
const Kokkos::DynRankView<rightInputValueType,rightInputProperties...> rightInput,
const bool hasField ) {
typedef Kokkos::DynRankView<outputValueType, outputProperties...> outputViewType;
typedef Kokkos::DynRankView<leftInputValueType, leftInputProperties...> leftInputViewType;
typedef Kokkos::DynRankView<rightInputValueType,rightInputProperties...> rightInputViewType;
typedef FunctorArrayTools::F_dotMultiply<outputViewType, leftInputViewType, rightInputViewType> FunctorType;
typedef typename ExecSpace< typename leftInputViewType::execution_space , SpT >::ExecSpaceType ExecSpaceType;
const size_type loopSize = ( hasField ? output.dimension(0)*output.dimension(1)*output.dimension(2) :
/**/ output.dimension(0)*output.dimension(1) );
Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
Kokkos::parallel_for( policy, FunctorType(output, leftInput, rightInput, hasField) );
}
示例7: getDofCoords
void
Basis_HGRAD_LINE_C1_FEM<SpT>::
getDofCoords( Kokkos::DynRankView<dofCoordValueType,dofCoordProperties...> dofCoords ) const {
#ifdef HAVE_INTREPID2_DEBUG
// Verify rank of output array.
INTREPID2_TEST_FOR_EXCEPTION( dofCoords.rank() != 2, std::invalid_argument,
">>> ERROR: (Intrepid2::Basis_HGRAD_LINE_C1_FEM::getDofCoords) rank = 2 required for dofCoords array");
// Verify 0th dimension of output array.
INTREPID2_TEST_FOR_EXCEPTION( dofCoords.dimension(0) != this->basisCardinality_, std::invalid_argument,
">>> ERROR: (Intrepid2::Basis_HGRAD_LINE_C1_FEM::getDofCoords) mismatch in number of dof and 0th dimension of dofCoords array");
// Verify 1st dimension of output array.
INTREPID2_TEST_FOR_EXCEPTION( dofCoords.dimension(1) != this->basisCellTopology_.getDimension(), std::invalid_argument,
">>> ERROR: (Intrepid2::Basis_HGRAD_LINE_C1_FEM::getDofCoords) incorrect reference cell (1st) dimension in dofCoords array");
#endif
dofCoords(0,0) = -1.0;
dofCoords(1,0) = 1.0;
}
示例8: getValues
void
Basis_HGRAD_TRI_Cn_FEM_ORTH::
getValues( /**/ Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
const ordinal_type order,
const EOperator operatorType ) {
typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
// loopSize corresponds to the # of points
const auto loopSizeTmp1 = (inputPoints.dimension(0)/numPtsPerEval);
const auto loopSizeTmp2 = (inputPoints.dimension(0)%numPtsPerEval != 0);
const auto loopSize = loopSizeTmp1 + loopSizeTmp2;
Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
switch (operatorType) {
case OPERATOR_VALUE: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE,numPtsPerEval> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints,
order) );
break;
}
case OPERATOR_GRAD:
case OPERATOR_D1: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD,numPtsPerEval> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints,
order) );
break;
}
case OPERATOR_D2:
case OPERATOR_D3:
case OPERATOR_D4:
case OPERATOR_D5:
case OPERATOR_D6:
case OPERATOR_D7:
case OPERATOR_D8:
case OPERATOR_D9:
case OPERATOR_D10: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_Dn,numPtsPerEval> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints,
order, getOperatorOrder(operatorType)) );
break;
}
case OPERATOR_DIV:
case OPERATOR_CURL: {
INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_DIV ||
operatorType == OPERATOR_CURL, std::invalid_argument,
">>> ERROR (Basis_HGRAD_TRI_Cn_FEM_ORTH): invalid operator type (div and curl).");
break;
}
default: {
INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
">>> ERROR (Basis_HGRAD_TRI_Cn_FEM_ORTH): invalid operator type");
}
}
}
示例9: getValues
KOKKOS_INLINE_FUNCTION
void
Basis_HGRAD_TRI_C1_FEM<SpT,OT,PT>::Serial<opType>::
getValues( /**/ Kokkos::DynRankView<outputValueValueType,outputValueProperties...> output,
const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> input ) {
switch (opType) {
case OPERATOR_VALUE: {
const auto x = input(0);
const auto y = input(1);
// output is a rank-2 array with dimensions (basisCardinality_)
output(0) = 1.0 - x - y;
output(1) = x;
output(2) = y;
break;
}
case OPERATOR_GRAD: {
// output is a rank-3 array with dimensions (basisCardinality_, spaceDim)
output(0, 0) = -1.0;
output(0, 1) = -1.0;
output(1, 0) = 1.0;
output(1, 1) = 0.0;
output(2, 0) = 0.0;
output(2, 1) = 1.0;
break;
}
case OPERATOR_CURL: {
output(0, 0) = -1.0;
output(0, 1) = 1.0;
output(1, 0) = 0.0;
output(1, 1) = -1.0;
output(2, 0) = 1.0;
output(2, 1) = 0.0;
break;
}
case OPERATOR_MAX: {
const auto jend = output.dimension(1);
const auto iend = output.dimension(0);
for (size_type j=0;j<jend;++j)
for (size_type i=0;i<iend;++i)
output(i, j) = 0.0;
break;
}
default: {
INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
opType != OPERATOR_GRAD &&
opType != OPERATOR_CURL &&
opType != OPERATOR_MAX,
">>> ERROR: (Intrepid2::Basis_HGRAD_TRI_C1_FEM::Serial::getValues) operator is not supported");
}
}
}
示例10: getValues
void
Basis_HGRAD_LINE_C1_FEM<SpT,OT,PT>::Internal::
getValues( /**/ Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
const EOperator operatorType ) const {
#ifdef HAVE_INTREPID2_DEBUG
Intrepid2::getValues_HGRAD_Args(outputValues,
inputPoints,
operatorType,
obj_->getBaseCellTopology(),
obj_->getCardinality() );
#endif
typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
// Number of evaluation points = dim 0 of inputPoints
const auto loopSize = inputPoints.dimension(0);
Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
switch (operatorType) {
case OPERATOR_VALUE: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_GRAD:
case OPERATOR_DIV:
case OPERATOR_CURL:
case OPERATOR_D1: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
case OPERATOR_D2:
case OPERATOR_D3:
case OPERATOR_D4:
case OPERATOR_D5:
case OPERATOR_D6:
case OPERATOR_D7:
case OPERATOR_D8:
case OPERATOR_D9:
case OPERATOR_D10: {
typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
break;
}
default: {
INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
">>> ERROR (Basis_HGRAD_LINE_C1_FEM): Invalid operator type");
}
}
}
示例11: getInterpolatoryCoordinates
/** Get the local coordinates for this field. This is independent of element
* locations.
*
* \param[in,out] coords Coordinates associated with this field type.
*/
void
Intrepid2FieldPattern::
getInterpolatoryCoordinates(const Kokkos::DynRankView<double,PHX::Device> & cellVertices,
Kokkos::DynRankView<double,PHX::Device> & coords) const
{
TEUCHOS_ASSERT(cellVertices.rank()==3);
int numCells = cellVertices.dimension(0);
// grab the local coordinates
Kokkos::DynRankView<double,PHX::Device> localCoords;
getInterpolatoryCoordinates(localCoords);
// resize the coordinates field container
coords = Kokkos::DynRankView<double,PHX::Device>("coords",numCells,localCoords.dimension(0),getDimension());
if(numCells>0) {
Intrepid2::CellTools<PHX::Device> cellTools;
cellTools.mapToPhysicalFrame(coords,localCoords,cellVertices,intrepidBasis_->getBaseCellTopology());
}
}
示例12: getOrientation
void
OrientationTools<SpT>::
getOrientation(/**/ Kokkos::DynRankView<elemOrtValueType,elemOrtProperties...> elemOrts,
const Kokkos::DynRankView<elemNodeValueType,elemNodeProperties...> elemNodes,
const shards::CellTopology cellTopo) {
// small meta data modification and it uses shards; let's do this on host
typedef typename Kokkos::Impl::is_space<SpT>::host_mirror_space::execution_space host_space_type;
auto elemOrtsHost = Kokkos::create_mirror_view(typename host_space_type::memory_space(), elemOrts);
auto elemNodesHost = Kokkos::create_mirror_view(typename host_space_type::memory_space(), elemNodes);
const ordinal_type numCells = elemNodes.dimension(0);
for (auto cell=0;cell<numCells;++cell) {
const auto nodes = Kokkos::subview(elemNodesHost, cell, Kokkos::ALL());
elemOrtsHost(cell) = Orientation::getOrientation(cellTopo, nodes);
}
Kokkos::deep_copy(elemOrts, elemOrtsHost);
}
示例13: getLattice
void
PointTools::
getLattice( /**/ Kokkos::DynRankView<pointValueType,pointProperties...> points,
const shards::CellTopology cell,
const ordinal_type order,
const ordinal_type offset,
const EPointType pointType ) {
#ifdef HAVE_INTREPID2_DEBUG
INTREPID2_TEST_FOR_EXCEPTION( points.rank() != 2,
std::invalid_argument ,
">>> ERROR (PointTools::getLattice): points rank must be 2." );
INTREPID2_TEST_FOR_EXCEPTION( order < 0 || offset < 0,
std::invalid_argument ,
">>> ERROR (PointTools::getLattice): order and offset must be positive values." );
const size_type latticeSize = getLatticeSize( cell, order, offset );
const size_type spaceDim = cell.getDimension();
INTREPID2_TEST_FOR_EXCEPTION( points.dimension(0) != latticeSize ||
points.dimension(1) != spaceDim,
std::invalid_argument ,
">>> ERROR (PointTools::getLattice): dimension does not match to lattice size." );
#endif
// const auto latticeSize = getLatticeSize( cell, order, offset );
// const auto spaceDim = cell.getDimension();
// // the interface assumes that the input array follows the cell definition
// // so, let's match all dimensions according to the cell specification
// typedef Kokkos::pair<ordinal_type,ordinal_type> range_type;
// auto pts = Kokkos::subview( points,
// range_type(0, latticeSize),
// range_type(0, spaceDim) );
switch (pointType) {
case POINTTYPE_EQUISPACED: getEquispacedLattice( points, cell, order, offset ); break;
case POINTTYPE_WARPBLEND: getWarpBlendLattice ( points, cell, order, offset ); break;
default: {
INTREPID2_TEST_FOR_EXCEPTION( true ,
std::invalid_argument ,
">>> ERROR (PointTools::getLattice): invalid EPointType." );
}
}
}
示例14: getValues
//.........这里部分代码省略.........
output(8, 0) = 4.*z;
output(8, 1) = 0.;
output(8, 2) = 4.*x;
output(9, 0) = 0.;
output(9, 1) = 4.*z;
output(9, 2) = 4.*y;
break;
}
case OPERATOR_D2: {
output(0, 0) = 4.;
output(0, 1) = 4.;
output(0, 2) = 4.;
output(0, 3) = 4.;
output(0, 4) = 4.;
output(0, 5) = 4.;
output(1, 0) = 4.;
output(1, 1) = 0.;
output(1, 2) = 0.;
output(1, 3) = 0.;
output(1, 4) = 0.;
output(1, 5) = 0.;
output(2, 0) = 0.;
output(2, 1) = 0.;
output(2, 2) = 0.;
output(2, 3) = 4.;
output(2, 4) = 0.;
output(2, 5) = 0.;
output(3, 0) = 0.;
output(3, 1) = 0.;
output(3, 2) = 0.;
output(3, 3) = 0.;
output(3, 4) = 0.;
output(3, 5) = 4.;
output(4, 0) = -8.;
output(4, 1) = -4.;
output(4, 2) = -4.;
output(4, 3) = 0.;
output(4, 4) = 0.;
output(4, 5) = 0.;
output(5, 0) = 0.;
output(5, 1) = 4.;
output(5, 2) = 0.;
output(5, 3) = 0.;
output(5, 4) = 0.;
output(5, 5) = 0.;
output(6, 0) = 0.;
output(6, 1) = -4.;
output(6, 2) = 0.;
output(6, 3) = -8.;
output(6, 4) = -4.;
output(6, 5) = 0;
output(7, 0) = 0.;
output(7, 1) = 0.;
output(7, 2) = -4.;
output(7, 3) = 0.;
output(7, 4) = -4.;
output(7, 5) = -8.;
output(8, 0) = 0.;
output(8, 1) = 0.;
output(8, 2) = 4.;
output(8, 3) = 0.;
output(8, 4) = 0.;
output(8, 5) = 0.;
output(9, 0) = 0.;
output(9, 1) = 0.;
output(9, 2) = 0.;
output(9, 3) = 0.;
output(9, 4) = 4.;
output(9, 5) = 0.;
break;
}
case OPERATOR_MAX: {
const auto jend = output.dimension(1);
const auto iend = output.dimension(0);
for (auto j=0;j<jend;++j)
for (auto i=0;i<iend;++i)
output(i, j) = 0.0;
break;
}
default: {
INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
opType != OPERATOR_GRAD &&
opType != OPERATOR_D1 &&
opType != OPERATOR_D2 &&
opType != OPERATOR_MAX,
">>> ERROR: (Intrepid2::Basis_HGRAD_TET_C2_FEM::Serial::getValues) operator is not supported");
}
}
}
示例15: modifyBasisByOrientation
void
OrientationTools<SpT>::
modifyBasisByOrientation(/**/ Kokkos::DynRankView<outputValueType,outputProperties...> output,
const Kokkos::DynRankView<inputValueType, inputProperties...> input,
const Kokkos::DynRankView<ortValueType, ortProperties...> orts,
const BasisPtrType basis ) {
#ifdef HAVE_INTREPID2_DEBUG
{
INTREPID2_TEST_FOR_EXCEPTION( input.rank() != output.rank(), std::invalid_argument,
">>> ERROR (OrientationTools::modifyBasisByOrientation): Input and output rank are not 3.");
for (ordinal_type i=0;i<input.rank();++i)
INTREPID2_TEST_FOR_EXCEPTION( input.dimension(i) != output.dimension(i), std::invalid_argument,
">>> ERROR (OrientationTools::modifyBasisByOrientation): Input and output dimension does not match.");
INTREPID2_TEST_FOR_EXCEPTION( input.dimension(1) != basis->getCardinality(), std::invalid_argument,
">>> ERROR (OrientationTools::modifyBasisByOrientation): Field dimension of input/output does not match to basis cardinality.");
INTREPID2_TEST_FOR_EXCEPTION( input.dimension(3) != basis->getBaseCellTopology().getDimension(), std::invalid_argument,
">>> ERROR (OrientationTools::modifyBasisByOrientation): Space dimension of input/output does not match to topology dimension.");
}
#endif
if (basis->requireOrientation()) {
auto ordinalToTag = Kokkos::create_mirror_view(typename SpT::memory_space(), basis->getAllDofTags());
auto tagToOrdinal = Kokkos::create_mirror_view(typename SpT::memory_space(), basis->getAllDofOrdinal());
Kokkos::deep_copy(ordinalToTag, basis->getAllDofTags());
Kokkos::deep_copy(tagToOrdinal, basis->getAllDofOrdinal());
const ordinal_type
numCells = output.dimension(0),
//numBasis = output.dimension(1),
numPoints = output.dimension(2),
dimBasis = output.dimension(3);
const CoeffMatrixDataViewType matData = createCoeffMatrix(basis);
const shards::CellTopology cellTopo = basis->getBaseCellTopology();
const ordinal_type
numVerts = cellTopo.getVertexCount(),
numEdges = cellTopo.getEdgeCount(),
numFaces = cellTopo.getFaceCount();
const ordinal_type intrDim = ( numEdges == 0 ? 1 :
numFaces == 0 ? 2 :
/**/ 3 );
for (auto cell=0;cell<numCells;++cell) {
auto out = Kokkos::subview(output, cell, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
auto in = Kokkos::subview(input, cell, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
// vertex copy (no orientation)
for (auto vertId=0;vertId<numVerts;++vertId) {
const auto i = tagToOrdinal(0, vertId, 0);
if (i != -1) // if dof does not exist i returns with -1
for (auto j=0;j<numPoints;++j)
for (auto k=0;k<dimBasis;++k)
out(i, j, k) = in(i, j, k);
}
// interior copy
{
const auto ordIntr = tagToOrdinal(intrDim, 0, 0);
if (ordIntr != -1) {
const auto ndofIntr = ordinalToTag(ordIntr, 3);
for (auto i=0;i<ndofIntr;++i) {
const auto ii = tagToOrdinal(intrDim, 0, i);
for (auto j=0;j<numPoints;++j)
for (auto k=0;k<dimBasis;++k)
out(ii, j, k) = in(ii, j, k);
}
}
}
// edge transformation
if (numEdges > 0) {
ordinal_type ortEdges[12];
orts(cell).getEdgeOrientation(ortEdges, numEdges);
// apply coeff matrix
for (auto edgeId=0;edgeId<numEdges;++edgeId) {
const auto ordEdge = tagToOrdinal(1, edgeId, 0);
if (ordEdge != -1) {
const auto ndofEdge = ordinalToTag(ordEdge, 3);
const auto mat = Kokkos::subview(matData,
edgeId, ortEdges[edgeId],
Kokkos::ALL(), Kokkos::ALL());
for (auto j=0;j<numPoints;++j)
for (auto i=0;i<ndofEdge;++i) {
const auto ii = tagToOrdinal(1, edgeId, i);
for (auto k=0;k<dimBasis;++k) {
double temp = 0.0;
for (auto l=0;l<ndofEdge;++l) {
const auto ll = tagToOrdinal(1, edgeId, l);
temp += mat(i,l)*in(ll, j, k);
}
out(ii, j, k) = temp;
}
}
//.........这里部分代码省略.........