Brion  2.0.0
The Blue Brain C++ I/O library
brion::Mesh Class Reference

Read & write access to a Mesh file. More...

#include <mesh.h>

+ Inheritance diagram for brion::Mesh:
+ Collaboration diagram for brion::Mesh:

Public Member Functions

 ~Mesh ()
 Close mesh file. More...
 
Read API
 Mesh (const std::string &source)
 Open the given source to a mesh file for reading. More...
 
MeshVersion getVersion () const
 
size_t getNumVertices () const
 
Vector3fsPtr readVertices () const
 
uint16_tsPtr readVertexSections () const
 
floatsPtr readVertexDistances () const
 
size_t getNumTriangles () const
 
uint32_tsPtr readTriangles () const
 
uint16_tsPtr readTriangleSections () const
 
floatsPtr readTriangleDistances () const
 
size_t getTriStripLength () const
 
uint32_tsPtr readTriStrip () const
 
size_t getNumNormals () const
 
Vector3fsPtr readNormals () const
 
size_t getNumStructures (MeshStructure type) const
 Get the number of structural meshes of the given type. More...
 
Vector3fsPtr readStructureVertices (MeshStructure type, size_t index) const
 Get the vertices of the given structure. More...
 
uint32_tsPtr readStructureTriangles (MeshStructure type, size_t index) const
 Get the triangles of the given structure. More...
 
uint32_tsPtr readStructureTriStrip (MeshStructure type, size_t index) const
 Get the triangle strip of the given structure. More...
 
Write API
 Mesh (const std::string &source, MeshFormat format, bool overwrite=false, MeshVersion version=MESH_VERSION_1)
 Open the given mesh file for write access. More...
 
void writeVertices (const Vector3fs &vertices)
 Write vertices describing the surface/membrane mesh of a neuron. More...
 
void writeVertexSections (const uint16_ts &vSections)
 Write section indices for each vertex of the surface/membrane mesh. More...
 
void writeVertexDistances (const floats &vDistances)
 Write relative distances in the section for each vertex of the surface/membrane mesh. More...
 
void writeTriangles (const uint32_ts &triangles)
 Write triangles describing the surface/membrane mesh of a neuron. More...
 
void writeTriangleSections (const uint16_ts &tSections)
 Write section indices for each triangle of the surface/membrane mesh. More...
 
void writeTriangleDistances (const floats &tDistances)
 Write relative distances in the section for each triangle of the surface/membrane mesh. More...
 
void writeTriStrip (const uint32_ts &tristrip)
 Write triangle strip describing the surface/membrane mesh of a neuron. More...
 
void writeNormals (const Vector3fs &normals)
 Write per-vertex normals for the surface/membrane mesh of a neuron. More...
 
void writeStructureVertices (const Vector3fs &vertices, MeshStructure type, size_t index)
 Write vertices for one type of structural mesh. More...
 
void writeStructureTriangles (const uint32_ts &triangles, MeshStructure type, size_t index)
 Write triangles for one type of structural mesh. More...
 
void writeStructureTriStrip (const uint32_ts &tristrip, MeshStructure type, size_t index)
 Write the triangle strip for one type of structural mesh. More...
 
void flush ()
 Flush data to output. More...
 

Detailed Description

Read & write access to a Mesh file.

The supported types are binary and HDF5 files.

Following RAII, this class is ready to use after the creation and will ensure release of resources upon destruction.

Definition at line 41 of file mesh.h.

Constructor & Destructor Documentation

brion::Mesh::~Mesh ( )

Close mesh file.

brion::Mesh::Mesh ( const std::string &  source)
explicit

Open the given source to a mesh file for reading.

Parameters
sourcefilepath to mesh file
Exceptions
std::runtime_errorif file is not a valid mesh file
brion::Mesh::Mesh ( const std::string &  source,
MeshFormat  format,
bool  overwrite = false,
MeshVersion  version = MESH_VERSION_1 
)

Open the given mesh file for write access.

Parameters
sourcefilepath to mesh file
formatoutput format of the mesh
overwritetrue to allow overwrite of existing file
versionthe output file format version
Exceptions
std::runtime_errorif file could not be opened for write access

Member Function Documentation

void brion::Mesh::flush ( )

Flush data to output.

size_t brion::Mesh::getNumNormals ( ) const
Returns
the number of normals, is 0 for binary meshes
size_t brion::Mesh::getNumStructures ( MeshStructure  type) const

Get the number of structural meshes of the given type.

Note that binary meshes do not support structural mesh information.

Parameters
typethe mesh structure type to look for
Returns
number of structural meshes
size_t brion::Mesh::getNumTriangles ( ) const
Returns
the number of triangles, can be 0 if a triangle strip is used
size_t brion::Mesh::getNumVertices ( ) const
Returns
the number of vertices, is never 0 for a valid mesh
size_t brion::Mesh::getTriStripLength ( ) const
Returns
the length of the triangle strip, can be 0 if triangles are used
MeshVersion brion::Mesh::getVersion ( ) const
Returns
the version of the mesh
Vector3fsPtr brion::Mesh::readNormals ( ) const
Returns
per-vertex normals calculated by the mesh generation
uint32_tsPtr brion::Mesh::readStructureTriangles ( MeshStructure  type,
size_t  index 
) const

Get the triangles of the given structure.

Note that binary meshes do not support structural mesh information.

Parameters
typethe mesh structure type to look for
indexthe index of the mesh structure
Returns
triangles describing the structural mesh
uint32_tsPtr brion::Mesh::readStructureTriStrip ( MeshStructure  type,
size_t  index 
) const

Get the triangle strip of the given structure.

Note that binary meshes do not support structural mesh information.

Parameters
typethe mesh structure type to look for
indexthe index of the mesh structure
Returns
triangle strip describing the structural mesh
Vector3fsPtr brion::Mesh::readStructureVertices ( MeshStructure  type,
size_t  index 
) const

Get the vertices of the given structure.

Note that binary meshes do not support structural mesh information.

Parameters
typethe mesh structure type to look for
indexthe index of the mesh structure
Returns
vertices describing the structural mesh
floatsPtr brion::Mesh::readTriangleDistances ( ) const
Returns
relative distances in the section for each triangle
uint32_tsPtr brion::Mesh::readTriangles ( ) const
Returns
triangles describing the membrane/surface mesh
uint16_tsPtr brion::Mesh::readTriangleSections ( ) const
Returns
section indices for each triangle
uint32_tsPtr brion::Mesh::readTriStrip ( ) const
Returns
triangle strip describing the membrane/surface mesh
floatsPtr brion::Mesh::readVertexDistances ( ) const
Returns
relative distances in the section for each vertex
uint16_tsPtr brion::Mesh::readVertexSections ( ) const
Returns
section indices for each vertex
Vector3fsPtr brion::Mesh::readVertices ( ) const
Returns
vertices describing the membrane/surface mesh
void brion::Mesh::writeNormals ( const Vector3fs &  normals)

Write per-vertex normals for the surface/membrane mesh of a neuron.

Parameters
normalsthe per-vertex normals for the surface/membrane mesh
Exceptions
std::runtime_errorif number of vertices does not match
std::runtime_errorif called for binary meshes
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeStructureTriangles ( const uint32_ts &  triangles,
MeshStructure  type,
size_t  index 
)

Write triangles for one type of structural mesh.

Parameters
trianglesthe triangles describing the structural mesh
typethe type of the structural mesh
indexthe index of the structural mesh
Exceptions
std::runtime_errorif called for binary meshes
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeStructureTriStrip ( const uint32_ts &  tristrip,
MeshStructure  type,
size_t  index 
)

Write the triangle strip for one type of structural mesh.

Parameters
tristripthe triangle strip describing the structural mesh
typethe type of the structural mesh
indexthe index of the structural mesh
Exceptions
std::runtime_errorif called for binary meshes
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeStructureVertices ( const Vector3fs &  vertices,
MeshStructure  type,
size_t  index 
)

Write vertices for one type of structural mesh.

Parameters
verticesthe vertices describing the structural mesh
typethe type of the structural mesh
indexthe index of the structural mesh
Exceptions
std::runtime_errorif called for binary meshes
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeTriangleDistances ( const floats &  tDistances)

Write relative distances in the section for each triangle of the surface/membrane mesh.

Parameters
tDistancesthe relative distances in the section for each triangle
Exceptions
std::runtime_errorif number of triangles does not match
std::runtime_errorif called for binary meshes
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeTriangles ( const uint32_ts &  triangles)

Write triangles describing the surface/membrane mesh of a neuron.

Parameters
trianglesthe triangles describing the surface/membrane mesh
Exceptions
std::runtime_errorif vertices were not written before
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeTriangleSections ( const uint16_ts &  tSections)

Write section indices for each triangle of the surface/membrane mesh.

Parameters
tSectionsthe section indices for each triangle
Exceptions
std::runtime_errorif number of triangles does not match
std::runtime_errorif called for binary meshes
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeTriStrip ( const uint32_ts &  tristrip)

Write triangle strip describing the surface/membrane mesh of a neuron.

Parameters
tristripthe triangle strip describing the surface/membrane mesh
Exceptions
std::runtime_errorif vertices were not written before
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeVertexDistances ( const floats &  vDistances)

Write relative distances in the section for each vertex of the surface/membrane mesh.

Parameters
vDistancesthe relative distances in the section for each vertex
Exceptions
std::runtime_errorif number of vertices does not match
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeVertexSections ( const uint16_ts &  vSections)

Write section indices for each vertex of the surface/membrane mesh.

Parameters
vSectionsthe section indices for each vertex
Exceptions
std::runtime_errorif number of vertices does not match
std::runtime_errorif object not created with write ctor
void brion::Mesh::writeVertices ( const Vector3fs &  vertices)

Write vertices describing the surface/membrane mesh of a neuron.

Parameters
verticesthe vertices describing the surface/membrane mesh
Exceptions
std::runtime_errorif object not created with write ctor

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