Brion  1.6.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

BRION_API ~Mesh ()
 Close mesh file. More...
 
Read API
BRION_API Mesh (const std::string &source)
 Open the given source to a mesh file for reading. More...
 
BRION_API MeshVersion getVersion () const
 
BRION_API size_t getNumVertices () const
 
BRION_API Vector3fsPtr readVertices () const
 
BRION_API uint16_tsPtr readVertexSections () const
 
BRION_API floatsPtr readVertexDistances () const
 
BRION_API size_t getNumTriangles () const
 
BRION_API uint32_tsPtr readTriangles () const
 
BRION_API uint16_tsPtr readTriangleSections () const
 
BRION_API floatsPtr readTriangleDistances () const
 
BRION_API size_t getTriStripLength () const
 
BRION_API uint32_tsPtr readTriStrip () const
 
BRION_API size_t getNumNormals () const
 
BRION_API Vector3fsPtr readNormals () const
 
BRION_API size_t getNumStructures (MeshStructure type) const
 Get the number of structural meshes of the given type. More...
 
BRION_API Vector3fsPtr readStructureVertices (MeshStructure type, size_t index) const
 Get the vertices of the given structure. More...
 
BRION_API uint32_tsPtr readStructureTriangles (MeshStructure type, size_t index) const
 Get the triangles of the given structure. More...
 
BRION_API uint32_tsPtr readStructureTriStrip (MeshStructure type, size_t index) const
 Get the triangle strip of the given structure. More...
 
Write API
BRION_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...
 
BRION_API void writeVertices (const Vector3fs &vertices)
 Write vertices describing the surface/membrane mesh of a neuron. More...
 
BRION_API void writeVertexSections (const uint16_ts &vSections)
 Write section indices for each vertex of the surface/membrane mesh. More...
 
BRION_API void writeVertexDistances (const floats &vDistances)
 Write relative distances in the section for each vertex of the surface/membrane mesh. More...
 
BRION_API void writeTriangles (const uint32_ts &triangles)
 Write triangles describing the surface/membrane mesh of a neuron. More...
 
BRION_API void writeTriangleSections (const uint16_ts &tSections)
 Write section indices for each triangle of the surface/membrane mesh. More...
 
BRION_API void writeTriangleDistances (const floats &tDistances)
 Write relative distances in the section for each triangle of the surface/membrane mesh. More...
 
BRION_API void writeTriStrip (const uint32_ts &tristrip)
 Write triangle strip describing the surface/membrane mesh of a neuron. More...
 
BRION_API void writeNormals (const Vector3fs &normals)
 Write per-vertex normals for the surface/membrane mesh of a neuron. More...
 
BRION_API void writeStructureVertices (const Vector3fs &vertices, MeshStructure type, size_t index)
 Write vertices for one type of structural mesh. More...
 
BRION_API void writeStructureTriangles (const uint32_ts &triangles, MeshStructure type, size_t index)
 Write triangles for one type of structural mesh. More...
 
BRION_API void writeStructureTriStrip (const uint32_ts &tristrip, MeshStructure type, size_t index)
 Write the triangle strip for one type of structural mesh. More...
 
BRION_API 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 39 of file mesh.h.

Constructor & Destructor Documentation

BRION_API brion::Mesh::~Mesh ( )

Close mesh file.

BRION_API 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_API 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

BRION_API void brion::Mesh::flush ( )

Flush data to output.

BRION_API size_t brion::Mesh::getNumNormals ( ) const
Returns
the number of normals, is 0 for binary meshes
BRION_API 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
BRION_API size_t brion::Mesh::getNumTriangles ( ) const
Returns
the number of triangles, can be 0 if a triangle strip is used
BRION_API size_t brion::Mesh::getNumVertices ( ) const
Returns
the number of vertices, is never 0 for a valid mesh
BRION_API size_t brion::Mesh::getTriStripLength ( ) const
Returns
the length of the triangle strip, can be 0 if triangles are used
BRION_API MeshVersion brion::Mesh::getVersion ( ) const
Returns
the version of the mesh
BRION_API Vector3fsPtr brion::Mesh::readNormals ( ) const
Returns
per-vertex normals calculated by the mesh generation
BRION_API 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
BRION_API 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
BRION_API 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
BRION_API floatsPtr brion::Mesh::readTriangleDistances ( ) const
Returns
relative distances in the section for each triangle
BRION_API uint32_tsPtr brion::Mesh::readTriangles ( ) const
Returns
triangles describing the membrane/surface mesh
BRION_API uint16_tsPtr brion::Mesh::readTriangleSections ( ) const
Returns
section indices for each triangle
BRION_API uint32_tsPtr brion::Mesh::readTriStrip ( ) const
Returns
triangle strip describing the membrane/surface mesh
BRION_API floatsPtr brion::Mesh::readVertexDistances ( ) const
Returns
relative distances in the section for each vertex
BRION_API uint16_tsPtr brion::Mesh::readVertexSections ( ) const
Returns
section indices for each vertex
BRION_API Vector3fsPtr brion::Mesh::readVertices ( ) const
Returns
vertices describing the membrane/surface mesh
BRION_API 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
BRION_API 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
BRION_API 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
BRION_API 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
BRION_API 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
BRION_API 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
BRION_API 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
BRION_API 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
BRION_API 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
BRION_API 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
BRION_API 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: