libMesh::MeshSerializer Class Reference

Temporarily serializes a DistributedMesh for output. 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 serializes a DistributedMesh for output.

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

Definition at line 42 of file mesh_serializer.h.

Constructor & Destructor Documentation

◆ MeshSerializer()

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::MeshBase::gather_to_zero(), libMesh::MeshBase::is_serial(), mesh, 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 void allgather()
Definition: mesh_base.h:183
MeshBase & mesh
virtual void gather_to_zero()
Definition: mesh_base.h:189
virtual bool is_serial() const
Definition: mesh_base.h:154

◆ ~MeshSerializer()

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()
Definition: mesh_base.h:196

Member Data Documentation

◆ _mesh

MeshBase& libMesh::MeshSerializer::_mesh
private

Definition at line 50 of file mesh_serializer.h.

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

◆ reparallelize

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: