本文整理汇总了C++中AssemblyOptions::assemblyMode方法的典型用法代码示例。如果您正苦于以下问题:C++ AssemblyOptions::assemblyMode方法的具体用法?C++ AssemblyOptions::assemblyMode怎么用?C++ AssemblyOptions::assemblyMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssemblyOptions
的用法示例。
在下文中一共展示了AssemblyOptions::assemblyMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reallyMakeAssemblers
std::pair<
shared_ptr<typename HypersingularIntegralOperator<
BasisFunctionType, KernelType, ResultType>::LocalAssembler>,
shared_ptr<typename HypersingularIntegralOperator<
BasisFunctionType, KernelType, ResultType>::LocalAssembler>
>
HypersingularIntegralOperator<BasisFunctionType, KernelType, ResultType>::makeAssemblers(
const QuadratureStrategy& quadStrategy,
const AssemblyOptions& options) const
{
typedef Fiber::RawGridGeometry<CoordinateType> RawGridGeometry;
typedef std::vector<const Fiber::Shapeset<BasisFunctionType>*> ShapesetPtrVector;
const bool verbose = (options.verbosityLevel() >= VerbosityLevel::DEFAULT);
shared_ptr<RawGridGeometry> testRawGeometry, trialRawGeometry;
shared_ptr<GeometryFactory> testGeometryFactory, trialGeometryFactory;
shared_ptr<Fiber::OpenClHandler> openClHandler;
shared_ptr<ShapesetPtrVector> testShapesets, trialShapesets;
bool cacheSingularIntegrals;
if (verbose)
std::cout << "Collecting data for assembler construction..." << std::endl;
this->collectDataForAssemblerConstruction(options,
testRawGeometry, trialRawGeometry,
testGeometryFactory, trialGeometryFactory,
testShapesets, trialShapesets,
openClHandler, cacheSingularIntegrals);
if (verbose)
std::cout << "Data collection finished." << std::endl;
bool makeSeparateOffDiagonalAssembler =
options.assemblyMode() == AssemblyOptions::ACA &&
options.acaOptions().mode == AcaOptions::HYBRID_ASSEMBLY;
return reallyMakeAssemblers(quadStrategy,
testGeometryFactory, trialGeometryFactory,
testRawGeometry, trialRawGeometry,
testShapesets, trialShapesets, openClHandler,
options.parallelizationOptions(),
options.verbosityLevel(),
cacheSingularIntegrals,
makeSeparateOffDiagonalAssembler);
}
示例2: runtime_error
//.........这里部分代码省略.........
// Estimate number of entries in each row
// This will be useful when we begin to use MPI
// // Get global DOF indices for which this process is responsible
// const int testGlobalDofCount = testSpace.globalDofCount();
// Epetra_Map rowMap(testGlobalDofCount, 0 /* index-base */, comm);
// std::vector<int> myTestGlobalDofs(rowMap.MyGlobalElements(),
// rowMap.MyGlobalElements() +
// rowMap.NumMyElements());
// const int myTestGlobalDofCount = myTestGlobalDofs.size();
const int testGlobalDofCount = testSpace.globalDofCount();
const int trialGlobalDofCount = trialSpace.globalDofCount();
arma::Col<int> nonzeroEntryCountEstimates(testGlobalDofCount);
nonzeroEntryCountEstimates.fill(0);
// Upper estimate for the number of global trial DOFs coupled to a given
// global test DOF: sum of the local trial DOF counts for each element that
// contributes to the global test DOF in question
for (size_t e = 0; e < elementCount; ++e)
for (size_t testLdof = 0; testLdof < testGdofs[e].size(); ++testLdof) {
int testGdof = testGdofs[e][testLdof];
if (testGdof >= 0)
nonzeroEntryCountEstimates(testGdof) += trialGdofs[e].size();
}
Epetra_SerialComm comm; // To be replaced once we begin to use MPI
Epetra_LocalMap rowMap(testGlobalDofCount, 0 /* index_base */, comm);
Epetra_LocalMap colMap(trialGlobalDofCount, 0 /* index_base */, comm);
shared_ptr<Epetra_FECrsMatrix> result =
boost::make_shared<Epetra_FECrsMatrix>(
Copy, rowMap, colMap, nonzeroEntryCountEstimates.memptr());
// TODO: make each process responsible for a subset of elements
// Find maximum number of local dofs per element
size_t maxLdofCount = 0;
for (size_t e = 0; e < elementCount; ++e)
maxLdofCount =
std::max(maxLdofCount, testGdofs[e].size() * trialGdofs[e].size());
// Initialise sparse matrix with zeros at required positions
arma::Col<double> zeros(maxLdofCount);
zeros.fill(0.);
for (size_t e = 0; e < elementCount; ++e)
result->InsertGlobalValues(testGdofs[e].size(), &testGdofs[e][0],
trialGdofs[e].size(), &trialGdofs[e][0],
zeros.memptr());
// Add contributions from individual elements
for (size_t e = 0; e < elementCount; ++e)
epetraSumIntoGlobalValues(*result, testGdofs[e], trialGdofs[e],
localResult[e]);
result->GlobalAssemble();
// If assembly mode is equal to ACA and we have AHMED,
// construct the block cluster tree. Otherwise leave it uninitialized.
typedef ClusterConstructionHelper<BasisFunctionType> CCH;
typedef AhmedDofWrapper<CoordinateType> AhmedDofType;
typedef ExtendedBemCluster<AhmedDofType> AhmedBemCluster;
typedef bbxbemblcluster<AhmedDofType, AhmedDofType> AhmedBemBlcluster;
shared_ptr<AhmedBemBlcluster> blockCluster;
shared_ptr<IndexPermutation> test_o2pPermutation, test_p2oPermutation;
shared_ptr<IndexPermutation> trial_o2pPermutation, trial_p2oPermutation;
#ifdef WITH_AHMED
if (options.assemblyMode() == AssemblyOptions::ACA) {
const AcaOptions &acaOptions = options.acaOptions();
bool indexWithGlobalDofs = acaOptions.mode != AcaOptions::HYBRID_ASSEMBLY;
typedef ClusterConstructionHelper<BasisFunctionType> CCH;
shared_ptr<AhmedBemCluster> testClusterTree;
CCH::constructBemCluster(testSpace, indexWithGlobalDofs, acaOptions,
testClusterTree, test_o2pPermutation,
test_p2oPermutation);
// TODO: construct a hermitian H-matrix if possible
shared_ptr<AhmedBemCluster> trialClusterTree;
CCH::constructBemCluster(trialSpace, indexWithGlobalDofs, acaOptions,
trialClusterTree, trial_o2pPermutation,
trial_p2oPermutation);
unsigned int blockCount = 0;
bool useStrongAdmissibilityCondition = !indexWithGlobalDofs;
blockCluster.reset(CCH::constructBemBlockCluster(
acaOptions, false /* hermitian */, *testClusterTree, *trialClusterTree,
useStrongAdmissibilityCondition, blockCount).release());
}
#endif
// Create and return a discrete operator represented by the matrix that
// has just been calculated
return std::unique_ptr<DiscreteBoundaryOperator<ResultType>>(
new DiscreteSparseBoundaryOperator<ResultType>(
result, this->symmetry(), NO_TRANSPOSE, blockCluster,
trial_o2pPermutation, test_o2pPermutation));
#else // WITH_TRILINOS
throw std::runtime_error(
"ElementaryLocalOperator::assembleWeakFormInSparseMode(): "
"To enable assembly in sparse mode, recompile BEM++ "
"with the symbol WITH_TRILINOS defined.");
#endif
}