本文整理汇总了C++中teuchos::Array::append方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::append方法的具体用法?C++ Array::append怎么用?C++ Array::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::Array
的用法示例。
在下文中一共展示了Array::append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkFunctionsAgree
void FunctionTests::checkFunctionsAgree(FunctionPtr f1, FunctionPtr f2, BasisCachePtr basisCache) {
ASSERT_EQ(f1->rank(), f2->rank())
<< "f1->rank() " << f1->rank() << " != f2->rank() " << f2->rank() << endl;
int rank = f1->rank();
int numCells = basisCache->getPhysicalCubaturePoints().dimension(0);
int numPoints = basisCache->getPhysicalCubaturePoints().dimension(1);
int spaceDim = basisCache->getPhysicalCubaturePoints().dimension(2);
Teuchos::Array<int> dim;
dim.append(numCells);
dim.append(numPoints);
for (int i=0; i<rank; i++) {
dim.append(spaceDim);
}
FieldContainer<double> f1Values(dim);
FieldContainer<double> f2Values(dim);
f1->values(f1Values,basisCache);
f2->values(f2Values,basisCache);
double tol = 1e-14;
double maxDiff;
EXPECT_TRUE(fcsAgree(f1Values,f2Values,tol,maxDiff))
<< "Test failed: f1 and f2 disagree; maxDiff " << maxDiff << ".\n"
<< "f1Values: \n" << f1Values
<< "f2Values: \n" << f2Values;
}
示例2: mustBeAccessible
// =============================================================================
Teuchos::RCP<Tpetra::Map<ORD> >
VIO::TpetraMesh::Mesh::
getElemsToNodesMap_() const
{
// create list of elements that need to be accessible from this process
// Make sure that *all entries that belong to any of the elements in
// this core are accessible.
// First mark all the nodes that need to be accessible:
TEUCHOS_ASSERT( !elems_.is_null() );
TEUCHOS_ASSERT( !nodes_.is_null() );
int numNodes = nodes_.size();
Teuchos::Array<bool> mustBeAccessible( numNodes );
for ( int k=0; k<elems_.size(); k++ )
for ( int l=0; l<elems_[k].size(); l++ )
mustBeAccessible[ elems_[k][l] ] = true;
// now create the list
Teuchos::Array<ORD> entryList;
for ( int k=0; k<numNodes; k++ )
if ( mustBeAccessible[k] )
entryList.append( k );
Teuchos::RCP<Tpetra::Map<ORD> > map =
Teuchos::rcp( new Tpetra::Map<ORD>( Teuchos::OrdinalTraits<ORD>::invalid(), entryList(), 0, comm_ )
);
return map;
}
示例3: functionsAgree
bool FunctionTests::functionsAgree(FunctionPtr f1, FunctionPtr f2, BasisCachePtr basisCache)
{
if (f2->rank() != f1->rank() )
{
cout << "f1->rank() " << f1->rank() << " != f2->rank() " << f2->rank() << endl;
return false;
}
int rank = f1->rank();
int numCells = basisCache->getPhysicalCubaturePoints().dimension(0);
int numPoints = basisCache->getPhysicalCubaturePoints().dimension(1);
int spaceDim = basisCache->getSpaceDim();
Teuchos::Array<int> dim;
dim.append(numCells);
dim.append(numPoints);
for (int i=0; i<rank; i++)
{
dim.append(spaceDim);
}
FieldContainer<double> f1Values(dim);
FieldContainer<double> f2Values(dim);
f1->values(f1Values,basisCache);
f2->values(f2Values,basisCache);
double tol = 1e-14;
double maxDiff;
bool functionsAgree = TestSuite::fcsAgree(f1Values,f2Values,tol,maxDiff);
if ( ! functionsAgree )
{
functionsAgree = false;
cout << "Test failed: f1 and f2 disagree; maxDiff " << maxDiff << ".\n";
cout << "f1Values: \n" << f1Values;
cout << "f2Values: \n" << f2Values;
}
else
{
// cout << "f1 and f2 agree!" << endl;
}
return functionsAgree;
}