本文整理汇总了C++中Obj::comm方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj::comm方法的具体用法?C++ Obj::comm怎么用?C++ Obj::comm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj
的用法示例。
在下文中一共展示了Obj::comm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OutputVTK
PetscErrorCode OutputVTK(const Obj<ALE::Mesh>& mesh, Options *options)
{
PetscViewer viewer;
PetscErrorCode ierr;
PetscFunctionBegin;
if (options->outputVTK) {
ALE::LogStage stage = ALE::LogStageRegister("VTKOutput");
ALE::LogStagePush(stage);
ierr = PetscPrintf(mesh->comm(), "Creating VTK mesh files\n");
CHKERRQ(ierr);
ierr = PetscViewerCreate(mesh->comm(), &viewer);
CHKERRQ(ierr);
ierr = PetscViewerSetType(viewer, PETSC_VIEWER_ASCII);
CHKERRQ(ierr);
ierr = PetscViewerSetFormat(viewer, PETSC_VIEWER_ASCII_VTK);
CHKERRQ(ierr);
ierr = PetscViewerFileSetName(viewer, "testMesh.vtk");
CHKERRQ(ierr);
ierr = VTKViewer::writeHeader(viewer);
CHKERRQ(ierr);
ierr = VTKViewer::writeHierarchyVertices(mesh, viewer, options->zScale);
CHKERRQ(ierr);
ierr = VTKViewer::writeHierarchyElements(mesh, viewer);
CHKERRQ(ierr);
ierr = PetscViewerDestroy(viewer);
CHKERRQ(ierr);
const ALE::Mesh::topology_type::sheaf_type& patches = mesh->getTopology()->getPatches();
#if 0
for(ALE::Mesh::topology_type::sheaf_type::iterator p_iter = patches.begin(); p_iter != patches.end(); ++p_iter) {
ostringstream filename;
filename << "coarseMesh." << *p_iter << ".vtk";
ierr = PetscViewerCreate(mesh->comm(), &viewer);
CHKERRQ(ierr);
ierr = PetscViewerSetType(viewer, PETSC_VIEWER_ASCII);
CHKERRQ(ierr);
ierr = PetscViewerSetFormat(viewer, PETSC_VIEWER_ASCII_VTK);
CHKERRQ(ierr);
ierr = PetscViewerFileSetName(viewer, filename.str().c_str());
CHKERRQ(ierr);
ierr = VTKViewer::writeHeader(viewer);
CHKERRQ(ierr);
ierr = VTKViewer::writeVertices(mesh, *p_iter, viewer);
CHKERRQ(ierr);
ierr = VTKViewer::writeElements(mesh, *p_iter, viewer);
CHKERRQ(ierr);
//ierr = FieldView_Sieve(mesh, "spacing", viewer);CHKERRQ(ierr);
ierr = PetscViewerDestroy(viewer);
CHKERRQ(ierr);
}
#endif
}
PetscFunctionReturn(0);
}
示例2: main
int main(int argc, char *argv[])
{
MPI_Comm comm;
Options options;
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscInitialize(&argc, &argv, (char *) 0, NULL);
CHKERRQ(ierr);
comm = PETSC_COMM_WORLD;
try {
Obj<ALE::Mesh> mesh;
ierr = ProcessOptions(comm, &options);
CHKERRQ(ierr);
ierr = CreateMesh(comm, mesh, &options);
CHKERRQ(ierr);
ierr = ALE::Coarsener::CreateSpacingFunction(mesh, 2);
CHKERRQ(ierr);
ierr = ALE::Coarsener::CreateCoarsenedHierarchyNew(mesh, 2, options.levels, options.coarseFactor);
CHKERRQ(ierr);
Obj<ALE::Mesh::sieve_type> sieve = new ALE::Mesh::sieve_type(mesh->comm(), 0);
mesh->getTopology()->setPatch(options.levels+1, sieve);
mesh->getTopology()->stratify();
ierr = OutputVTK(mesh, &options);
CHKERRQ(ierr);
} catch (ALE::Exception e) {
std::cout << e << std::endl;
}
ierr = PetscFinalize();
CHKERRQ(ierr);
PetscFunctionReturn(0);
}