On Wed, Jun 13, 2018 at 11:03 AM, Michael Povolotskyi <[email protected]>
wrote:
> Hello John,
>
> I played with it, and this is what worked for me.
>
> #include <vector>
> #include <sstream>
> using namespace std;
>
> #define private public //to get access to libMesh::LibMeshInit._vtk_mpi_
> controller
>
> #include "libmesh/mesh_generation.h"
> #include "libmesh/mesh.h"
> #include "libmesh/vtk_io.h"
> #include "libmesh/libmesh.h"
> #include "vtkMPIController.h"
> int main(int argc, char ** argv)
> {
>
> MPI_Init(&argc, &argv);
>
> {
> libMesh::LibMeshInit init (argc, argv,MPI_COMM_WORLD);
> int rank;
> MPI_Comm_rank(MPI_COMM_WORLD, &rank);
>
> vtkMPICommunicator* mcomm = vtkMPICommunicator::
> GetWorldCommunicator()->NewInstance ();
> mcomm->SplitInitialize (mcomm, rank, 0);
>
> init._vtk_mpi_controller->SetCommunicator (mcomm);
>
> libMesh::Mesh mesh(libMesh::Parallel::Communicator(MPI_COMM_SELF));
> libMesh::MeshTools::Generation::build_cube (mesh,
> 10, 10, 5, 0.0, 2.0, 0.0,
> 3.0, 0.0, 4.0,libMesh::HEX8);
>
>
> if (rank == 0)
> {
> libMesh::VTKIO out(mesh);
> out.write("mesh1.pvtu");
> }
> }
> MPI_Finalize();
> return 0;
>
>
>
> }
>
> What do you think? Can you provide an access to
> libMesh::LibMeshInit._vtk_mpi_controller?
> Or there is a better solution?
>
I think it would be reasonable to provide a public accessor for
_vtk_mpi_controller, as long as we can still get away with a forward
declaration for vtkMPIController.
Would it be possible to do the same algorithm from within VTKIO::read()? At
that point, we have a Communicator (mesh.comm()) for the Mesh we are
currently writing, so we could probably do the same New/Split/Set series of
steps there, but unfortunately we don't have access to the LibMeshInit at
that point...
--
John
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users