libMesh
Public Member Functions | Private Attributes | List of all members
libMesh::MeshSerializer Class Reference

Temporarily serialize a DistributedMesh for output; a distributed mesh is allgathered by the MeshSerializer constructor if need_serial is true, then remote elements are deleted again by the destructor. More...

#include <mesh_serializer.h>

Public Member Functions

 MeshSerializer (MeshBase &mesh, bool need_serial=true, bool serial_only_needed_on_proc_0=false)
 
 ~MeshSerializer ()
 

Private Attributes

MeshBase_mesh
 
bool reparallelize
 

Detailed Description

Temporarily serialize a DistributedMesh for output; a distributed mesh is allgathered by the MeshSerializer constructor if need_serial is true, then remote elements are deleted again by the destructor.

Author
Roy Stogner
Date
2011 Temporarily serializes a DistributedMesh for output.

Definition at line 42 of file mesh_serializer.h.

Constructor & Destructor Documentation

libMesh::MeshSerializer::MeshSerializer ( MeshBase mesh,
bool  need_serial = true,
bool  serial_only_needed_on_proc_0 = false 
)

Definition at line 27 of file mesh_serializer.C.

References _mesh, libMesh::MeshBase::allgather(), libMesh::ParallelObject::comm(), libMesh::MeshBase::gather_to_zero(), libMesh::MeshBase::is_serial(), and reparallelize.

27  :
28  _mesh(mesh),
29  reparallelize(false)
30 {
31  libmesh_parallel_only(mesh.comm());
32  if (need_serial && !_mesh.is_serial() && !serial_only_needed_on_proc_0) {
33  reparallelize = true;
34  _mesh.allgather();
35  }
36  else if (need_serial && !_mesh.is_serial() && serial_only_needed_on_proc_0) {
37  // Note: NOT reparallelizing on purpose.
38  // Just waste a bit of space on processor 0 to speed things up
40  }
41 }
virtual bool is_serial() const
Definition: mesh_base.h:140
virtual void allgather()
Gathers all elements and nodes of the mesh onto every processor.
Definition: mesh_base.h:169
MeshBase & mesh
virtual void gather_to_zero()
Gathers all elements and nodes of the mesh onto processor zero.
Definition: mesh_base.h:175
libMesh::MeshSerializer::~MeshSerializer ( )

Definition at line 45 of file mesh_serializer.C.

References _mesh, libMesh::MeshBase::delete_remote_elements(), and reparallelize.

46 {
47  if (reparallelize)
49 }
virtual void delete_remote_elements()
When supported, deletes all nonlocal elements of the mesh except for "ghosts" which touch a local ele...
Definition: mesh_base.h:182

Member Data Documentation

MeshBase& libMesh::MeshSerializer::_mesh
private

Definition at line 50 of file mesh_serializer.h.

Referenced by MeshSerializer(), and ~MeshSerializer().

bool libMesh::MeshSerializer::reparallelize
private

Definition at line 51 of file mesh_serializer.h.

Referenced by MeshSerializer(), and ~MeshSerializer().


The documentation for this class was generated from the following files: