本文整理汇总了C++中typenameAbstractMesh::IsInternal方法的典型用法代码示例。如果您正苦于以下问题:C++ typenameAbstractMesh::IsInternal方法的具体用法?C++ typenameAbstractMesh::IsInternal怎么用?C++ typenameAbstractMesh::IsInternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类typenameAbstractMesh
的用法示例。
在下文中一共展示了typenameAbstractMesh::IsInternal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VecDuplicate
void AbstractContinuumMechanicsSolver<DIM>::AllocateMatrixMemory()
{
Vec template_vec = mrQuadMesh.GetDistributedVectorFactory()->CreateVec(mProblemDimension);
///////////////////////////
// three vectors
///////////////////////////
VecDuplicate(template_vec, &mResidualVector);
VecDuplicate(mResidualVector, &mLinearSystemRhsVector);
// the one is only allocated if it will be needed (in ApplyDirichletBoundaryConditions),
// depending on whether the matrix is kept symmetric.
mDirichletBoundaryConditionsVector = NULL;
PetscTools::Destroy(template_vec);
///////////////////////////
// two matrices
///////////////////////////
int lo, hi;
VecGetOwnershipRange(mResidualVector, &lo, &hi);
PetscInt local_size = hi - lo;
if (DIM==2)
{
// 2D: N elements around a point => 7N+3 non-zeros in that row? Assume N<=10 (structured mesh would have N_max=6) => 73.
unsigned num_non_zeros = std::min(75u, mNumDofs);
PetscTools::SetupMat(mSystemLhsMatrix, mNumDofs, mNumDofs, num_non_zeros, local_size, local_size);
PetscTools::SetupMat(mPreconditionMatrix, mNumDofs, mNumDofs, num_non_zeros, local_size, local_size);
}
else
{
assert(DIM==3);
// in 3d we get the number of containing elements for each node and use that to obtain an upper bound
// for the number of non-zeros for each DOF associated with that node.
int* num_non_zeros_each_row = new int[mNumDofs];
for (unsigned i=0; i<mNumDofs; i++)
{
num_non_zeros_each_row[i] = 0;
}
for (typename AbstractMesh<DIM,DIM>::NodeIterator iter = mrQuadMesh.GetNodeIteratorBegin();
iter != mrQuadMesh.GetNodeIteratorEnd();
++iter)
{
// this upper bound neglects the fact that two containing elements will share the same nodes..
// 4 = max num dofs associated with this node
// 30 = 3*9+3 = 3 dimensions x 9 other nodes on this element + 3 vertices with a pressure unknown
unsigned num_non_zeros_upper_bound = 4 + 30*iter->GetNumContainingElements();
num_non_zeros_upper_bound = std::min(num_non_zeros_upper_bound, mNumDofs);
unsigned i = iter->GetIndex();
num_non_zeros_each_row[mProblemDimension*i + 0] = num_non_zeros_upper_bound;
num_non_zeros_each_row[mProblemDimension*i + 1] = num_non_zeros_upper_bound;
num_non_zeros_each_row[mProblemDimension*i + 2] = num_non_zeros_upper_bound;
if (mCompressibilityType==INCOMPRESSIBLE)
{
if(!iter->IsInternal())
{
num_non_zeros_each_row[mProblemDimension*i + 3] = num_non_zeros_upper_bound;
}
else
{
num_non_zeros_each_row[mProblemDimension*i + 3] = 1;
}
}
}
// NOTE: PetscTools::SetupMat() or the below creates a MATAIJ matrix, which means the matrix will
// be of type MATSEQAIJ if num_procs=1 and MATMPIAIJ otherwise. In the former case
// MatSeqAIJSetPreallocation MUST be called [MatMPIAIJSetPreallocation will have
// no effect (silently)], and vice versa in the latter case
/// We want to allocate different numbers of non-zeros per row, which means
/// PetscTools::SetupMat isn't that useful. We could call
//PetscTools::SetupMat(mSystemLhsMatrix, mNumDofs, mNumDofs, 0, PETSC_DECIDE, PETSC_DECIDE);
//PetscTools::SetupMat(mPreconditionMatrix, mNumDofs, mNumDofs, 0, PETSC_DECIDE, PETSC_DECIDE);
/// but we would get warnings due to the lack allocation
// possible todo: create a PetscTools::SetupMatNoAllocation()
#if (PETSC_VERSION_MAJOR == 2 && PETSC_VERSION_MINOR == 2) //PETSc 2.2
MatCreate(PETSC_COMM_WORLD,local_size,local_size,mNumDofs,mNumDofs,&mSystemLhsMatrix);
MatCreate(PETSC_COMM_WORLD,local_size,local_size,mNumDofs,mNumDofs,&mPreconditionMatrix);
#else //New API
MatCreate(PETSC_COMM_WORLD,&mSystemLhsMatrix);
MatCreate(PETSC_COMM_WORLD,&mPreconditionMatrix);
MatSetSizes(mSystemLhsMatrix,local_size,local_size,mNumDofs,mNumDofs);
MatSetSizes(mPreconditionMatrix,local_size,local_size,mNumDofs,mNumDofs);
#endif
if (PetscTools::IsSequential())
{
//.........这里部分代码省略.........