本文整理汇总了C++中ArrayRCP::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayRCP::get方法的具体用法?C++ ArrayRCP::get怎么用?C++ ArrayRCP::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayRCP
的用法示例。
在下文中一共展示了ArrayRCP::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// ********************************************************
int main(int argc, char *argv[])
{
using namespace std;
using namespace Teuchos;
using namespace PHX;
GlobalMPISession mpi_session(&argc, &argv);
try {
RCP<Time> total_time = TimeMonitor::getNewTimer("Total Run Time");
TimeMonitor tm(*total_time);
// *********************************************************************
// Start of MDField Testing
// *********************************************************************
{
typedef MDField<double,Cell,Node>::size_type size_type;
std::vector<size_type> dims(3);
dims[0] = 10;
dims[1] = 4;
dims[2] = 3;
RCP<DataLayout> quad_vector =
rcp(new MDALayout<Cell,Quadrature,Dim>(dims[0],dims[1],dims[2]));
int size = quad_vector->size();
TEUCHOS_TEST_FOR_EXCEPTION(size != dims[0]*dims[1]*dims[2], std::runtime_error,
"Size mismatch on MDField!");
ArrayRCP<double> a_mem = arcp<double>(size);
ArrayRCP<double> b_mem = arcp<double>(size);
for (int i=0; i < a_mem.size(); ++i)
a_mem[i] = static_cast<double>(i);
for (int i=0; i < b_mem.size(); ++i)
b_mem[i] = static_cast<double>(i);
MDField<double,Cell,Point,Dim> a("density",quad_vector);
MDField<double> b("density",quad_vector);
a.setFieldData(a_mem);
b.setFieldData(b_mem);
simulated_intrepid_integrate(a);
simulated_intrepid_integrate(b);
// ***********************
// Shards tests
// ***********************
ArrayRCP<double> c_mem = arcp<double>(size);
ArrayRCP<double> d_mem = arcp<double>(size);
for (int i=0; i < c_mem.size(); ++i)
c_mem[i] = static_cast<double>(i);
for (int i=0; i < d_mem.size(); ++i)
d_mem[i] = static_cast<double>(i);
shards::Array<double,shards::NaturalOrder,Cell,Node,Dim> c(c_mem.get(),
dims[0],
dims[1],
dims[2]);
size_type rank = dims.size();
const ArrayRCP<const shards::ArrayDimTag*> tags =
arcp<const shards::ArrayDimTag*>(rank);
tags[0] = &Cell::tag();
tags[1] = &Point::tag();
tags[2] = &Dim::tag();
shards::Array<double,shards::NaturalOrder> d(d_mem.get(),rank,
&dims[0],tags.get());
simulated_intrepid_integrate(d);
simulated_intrepid_integrate((const shards::Array<double,shards::NaturalOrder>&)(c));
}
// *********************************************************************
// *********************************************************************
std::cout << "\nTest passed!\n" << std::endl;
// *********************************************************************
// *********************************************************************
}
catch (const std::exception& e) {
std::cout << "************************************************" << endl;
std::cout << "************************************************" << endl;
std::cout << "Exception Caught!" << endl;
std::cout << "Error message is below\n " << e.what() << endl;
std::cout << "************************************************" << endl;
}
//.........这里部分代码省略.........