ug4
serialization.cpp File Reference
#include <cassert>
#include <vector>
#include <algorithm>
#include "serialization.h"
#include "common/serialization.h"
#include "debug_util.h"
#include "common/util/hash.h"

Classes

struct  ug::GridHeader
 

Namespaces

 ug
 the ug namespace
 

Macros

#define PROFILE_GRID_SERIALIZATION
 
#define SRLZ_PROFILE(name)   PROFILE_BEGIN_GROUP(name, "serialization")
 
#define SRLZ_PROFILE_END()   PROFILE_END()
 
#define SRLZ_PROFILE_FUNC()   PROFILE_FUNC_GROUP("serialization")
 

Typedefs

typedef std::pair< byte, int > ug::ParentInfo
 Stores a tuple (type, index), identifying a parent. More...
 

Enumerations

enum  ug::GridHeaderConstants { ug::GHC_HEADER_BEGIN = 1 , ug::GHC_HEADER_END = 2 , ug::GHC_READ_OPTIONS = 3 }
 
enum  ug::GridHeaderReadOptions { ug::GHRO_READ_DEFAULT = 0 , ug::GHRO_READ_LEVELS = 1 << 0 , ug::GHRO_READ_PARENTS = 1 << 1 }
 
enum  ug::GridSerializationID {
  ug::GSID_END_OF_GRID = -2 , ug::GSID_INVALID = -1 , ug::GSID_GEOMETRIC_OBJECT = 0 , ug::GSID_VERTEX_BASE = 10 ,
  ug::GSID_VERTEX = 11 , ug::GSID_HANGING_VERTEX = 12 , ug::GSID_EDGE_BASE = 20 , ug::GSID_EDGE = 21 ,
  ug::GSID_CONSTRAINED_EDGE = 22 , ug::GSID_CONSTRAINING_EDGE = 23 , ug::GSID_FACE = 30 , ug::GSID_TRIANGLE = 31 ,
  ug::GSID_CONSTRAINED_TRIANGLE = 32 , ug::GSID_CONSTRAINING_TRIANGLE = 33 , ug::GSID_QUADRILATERAL = 40 , ug::GSID_CONSTRAINED_QUADRILATERAL = 41 ,
  ug::GSID_CONSTRAINING_QUADRILATERAL = 42 , ug::GSID_VOLUME = 60 , ug::GSID_TETRAHEDRON = 61 , ug::GSID_HEXAHEDRON = 70 ,
  ug::GSID_PRISM = 80 , ug::GSID_PYRAMID = 90 , ug::GSID_OCTAHEDRON = 100 , ug::GSID_NEW_LEVEL = 1000
}
 

Functions

bool ug::DeserializeGridElements (Grid &grid, BinaryBuffer &in, bool readGridHeader=true)
 Creates grid elements from a binary stream. More...
 
bool ug::DeserializeMultiGridElements (MultiGrid &mg, BinaryBuffer &in, std::vector< Vertex * > *pvVrts=NULL, std::vector< Edge * > *pvEdges=NULL, std::vector< Face * > *pvFaces=NULL, std::vector< Volume * > *pvVols=NULL, MultiElementAttachmentAccessor< AGeomObjID > *paaID=NULL)
 Creates multi-grid elements from a binary stream. More...
 
bool ug::DeserializeSelector (Grid &grid, ISelector &sel, BinaryBuffer &in)
 assigns subset-indices to all elements in the grid from a stream. More...
 
bool ug::DeserializeSelector (Grid &grid, ISelector &sel, GridObjectCollection goc, BinaryBuffer &in)
 assigns subset-indices to all elements in the goc from a stream. More...
 
bool ug::DeserializeSubsetHandler (Grid &grid, ISubsetHandler &sh, BinaryBuffer &in, bool readPropertyMap=true)
 assigns subset-indices to all elements in the grid from a stream. More...
 
bool ug::DeserializeSubsetHandler (Grid &grid, ISubsetHandler &sh, GridObjectCollection goc, BinaryBuffer &in, bool readPropertyMap=true)
 assigns subset-indices to all elements in the goc from a stream. More...
 
static pair< GridObject *, char > ug::GetParent (BinaryBuffer &in, const vector< Vertex * > &vVrts, const vector< Edge * > &vEdges, const vector< Face * > &vFaces, const vector< Volume * > &vVols)
 
static bool ug::ReadGridHeader (GridHeader &gridHeader, BinaryBuffer &in)
 
template<class TElemIter >
static void ug::ReadSelectionStatesFromStream (TElemIter iterBegin, TElemIter iterEnd, ISelector &sel, BinaryBuffer &in)
 
template<class TElemIter >
static void ug::ReadSubsetIndicesFromStream (TElemIter iterBegin, TElemIter iterEnd, ISubsetHandler &sh, BinaryBuffer &in)
 
bool ug::SerializeGridElements (Grid &grid, BinaryBuffer &out)
 Writes all grid elements into a binary-stream. More...
 
bool ug::SerializeGridElements (Grid &grid, GridObjectCollection goc, AInt &aIntVRT, BinaryBuffer &out)
 Writes a part of the grids elements to a binary-stream. More...
 
bool ug::SerializeGridElements (Grid &grid, GridObjectCollection goc, BinaryBuffer &out)
 Writes a part of the grids elements to a binary-stream. More...
 
bool ug::SerializeMultiGridElements (MultiGrid &mg, BinaryBuffer &out)
 writes the elements of a MultiGrid to a binary stream. More...
 
bool ug::SerializeMultiGridElements (MultiGrid &mg, GridObjectCollection goc, BinaryBuffer &out)
 writes a part of the elements of a MultiGrid to a binary stream. More...
 
bool ug::SerializeMultiGridElements (MultiGrid &mg, GridObjectCollection goc, MultiElementAttachmentAccessor< AInt > &aaInt, BinaryBuffer &out, MultiElementAttachmentAccessor< AGeomObjID > *paaID=NULL)
 writes a part of the elements of a MultiGrid to a binary stream. More...
 
bool ug::SerializeSelector (Grid &grid, ISelector &sel, BinaryBuffer &out)
 writes the subset-indices of all elements in the grid to a stream. More...
 
bool ug::SerializeSelector (Grid &grid, ISelector &sel, GridObjectCollection goc, BinaryBuffer &out)
 writes the subset-indices of all elements in the goc to a stream. More...
 
bool ug::SerializeSubsetHandler (Grid &grid, ISubsetHandler &sh, BinaryBuffer &out)
 writes the subset-indices of all elements in the grid to a stream. More...
 
bool ug::SerializeSubsetHandler (Grid &grid, ISubsetHandler &sh, GridObjectCollection goc, BinaryBuffer &out)
 writes the subset-indices of all elements in the goc to a stream. More...
 
static void ug::WriteGridHeader (const GridHeader &gridHeader, BinaryBuffer &out)
 
template<class TElem >
static void ug::WriteParent (MultiGrid &mg, TElem *pElem, MultiElementAttachmentAccessor< AInt > &aaInt, BinaryBuffer &out)
 
template<class TElemIter >
static void ug::WriteSelectionStatesToStream (TElemIter iterBegin, TElemIter iterEnd, ISelector &sel, BinaryBuffer &out)
 
template<class TElemIter >
static void ug::WriteSubsetIndicesToStream (TElemIter iterBegin, TElemIter iterEnd, ISubsetHandler &sh, BinaryBuffer &out)
 

Macro Definition Documentation

◆ PROFILE_GRID_SERIALIZATION

#define PROFILE_GRID_SERIALIZATION

◆ SRLZ_PROFILE

#define SRLZ_PROFILE (   name)    PROFILE_BEGIN_GROUP(name, "serialization")

◆ SRLZ_PROFILE_END

#define SRLZ_PROFILE_END ( )    PROFILE_END()

◆ SRLZ_PROFILE_FUNC

#define SRLZ_PROFILE_FUNC ( )    PROFILE_FUNC_GROUP("serialization")