Doxygen Index

class BlockMerger
#include <BlockMerger.h>

A class responsible to merge an array of sorted blocks.

Author

RdB

Public Functions

BlockMerger(std::vector<GridBlock> blocks)

Constructor from a list of blocks.

The blocks are not checked to be sorted

Parameters
  • [in] blocks: A vector of sorted GridBlock objects

BlockMerger(vtkSmartPointer<vtkMultiBlockDataSet> multiblock)

Constructor from a vtkMultiBlockDataSet.

void SetBoundariesOverlapping(bool flag)

Set overlapping of boundaries.

If the overlapping of boundaries is set to true, each block is sliced removing the first layer of points such that to not have same data replicated

void Merge()

The actual method that merges the blocks.

The basic algorithm is that the blocks are looped and the number of elements of each block is tracked down in order to allocate the right memory for the underlying data structure for the merged grid. When the x, y, z coordinate changes, you need to wrap the indices since we start back from the starting i, j, k index of the previous block. Then memory is allocated and the blocks are actualy inserted in the right position of the merged vtkImageData.

vtkSmartPointer<vtkImageData> GetOutput()

Returns the merged data.

Private Functions

void SortBlocks()

Sort the internal blocks by coordinate.

Order of sorting: z - y - x

void InsertBlock(GridBlock block) const

Append block in the merged container next to another one along a given axis.

Private Members

vtkSmartPointer<vtkImageData> m_mergedImageData

The pointer to the merged grid.

bool m_overlapping = true

If the block are overlapping on the borders.

IdType m_allocatedBlocks = 0

Internal attribute to check if we need to cleanup blocks.

It is set to != 0 by the vtkMultiBlockDataSet version of the constructor

int m_levelSetComponent = 0

The component index corresponding to the level-set.

For now it’s the component 0. Check the

std::vector<GridBlock> m_blocks

vector of blocks to merge

class BlockMirror
#include <BlockMirror.h>

A class responsible to reflect a vtkImageData along an axis.

Author

RdB

Public Functions

BlockMirror(vtkSmartPointer<vtkImageData> block, Direction axis, Orientation orientation)

Constructor from a vtkImageData and a Direction axis.

void SetAxis(const Direction axis)

Set the axis along which to perform the reflection.

void Mirror()

Perform the reflection.

Return

A GridBlock object that contains the mirrored image

vtkSmartPointer<vtkImageData> GetOutput()

Return flipped and merged block.

Private Members

vtkSmartPointer<vtkImageData> m_block

The block to mirror.

Direction m_axis

The direction axis along which to reflect.

Orientation m_orientation

The orientation of flipping along the given axis.

class Cell
#include <Cell.h>

A class representing a Surface cell. It provides method to extract important features of the cell.

Author

RdB

Public Functions

Cell(Surface &mesh, IdType cellId)

: Constructor from cell ID

IdType Id() const

m_id accessor

ThreeArray<Point> Points() const

Get the points that define the cell connectivity.

Return

An iterable containing the coordinates

ThreeArray<SimpleVector> Edges() const

Get the edges that connect the cell points.

Return

An iterable containing the edges

double Area() const

Compute Surface Area of the cell.

Return

The value of the surface

double Perimeter() const

Compute the perimeter of the cell.

Return

The value of the perimeter

double MixedArea(const Point &pc) const

Compute the mixed area of the cell.

In

[1] they define a “special” area of a cell when performing the calculations for a 1-ring. This area is the Voronoi region if the triangle is non-obtuse, otherwise is a fraction of the area of the triangle if one of the angles of is obtuse
Return

The value of the mixed area

Parameters
  • [in] pc: The point that is the vertex of the 1-ring

double ComputeCotan(const Edge &edge) const

Compute the contangent of the angle that is opposed to an edge.

Return

The value of the cotangent of the angle

Parameters
  • [in] edge: The edge that is opposed to the angle to be calculated

double ComputeAngle(const Edge &edge) const

Compute the angle that is opposed to an edge.

Return

The value of the angle

Parameters
  • [in] edge: The edge that is opposed to the angle to be calculated

double GA(const Point &pc) const

Compute the contribution to the Gauss curvature due to the cell.

The returned value is multiplied by the MixedArea such that when used in the points loop it is not computed twice

Return

The value of the contribution for the Gauss curvature

Parameters
  • [in] pc: The center point that is the vertex around which to compute the Gauss curvatur

double Quality() const

Compute the cell quality.

This method computes the quality associated to the cell. At the moment the method implemented is just the ratio of the radius of the circle inscribed in the triangle and the circle circumscribed to the triangle

Cell &operator++()
Cell operator++(int)
bool operator==(const Cell &other) const
bool operator!=(const Cell &other) const

Public Static Functions

double ComputeCotan(const SimpleVector &a, const SimpleVector &b)

Compute the cotangent of the angle that is comprised between two edges.

Return

The value of the cotangent

Parameters
  • [in] a: First Edge

  • [in] b: Second Edge

double ComputeAngle(const SimpleVector &a, const SimpleVector &b)

Compute the angle that is comprised between two edges.

Return

The value of the angle

Parameters
  • [in] a: First edge

  • [in] b: Second edge

Private Members

IdType m_id

The id of the cell

Surface &m_mesh

A reference to the Surface

vtkSmartPointer<vtkTriangle> m_triangle

Using vtkTriangle to compute useful properties of the cell.

Private Static Functions

Cell GetEndItem(Surface &mesh)

Static member to return the last Cell present in the given Surface object.

Friends

friend hgve::Cell::Surface
friend hgve::Cell::Iterator< Cell >
struct CurvaturesData
#include <CurvaturesData.h>

A class that describes its fields in an array of strings and stores the values of the geometrical parameters in an unordered map.

Public Types

using CurvNames = std::array<std::string, 6>

Public Functions

CurvaturesData()
CurvaturesData(double G, double H, double C, double SI, double A, double Q)
double &G()
const double &G() const
double &H()
const double &H() const
double &C()
const double &C() const
double &SI()
const double &SI() const
double &A()
const double &A() const
double &operator[](const std::string key)
const double &at(const std::string key) const
CurvaturesData &operator+=(const CurvaturesData &other)
CurvaturesData &operator-=(const CurvaturesData &other)
CurvaturesData &operator*=(const double lambda)
CurvaturesData &operator*=(const CurvaturesData &other)
CurvaturesData &operator/=(const double lambda)
CurvaturesData &operator/=(const CurvaturesData &other)

Public Members

std::unordered_map<std::string, double> m_fields

Public Static Attributes

const CurvaturesData::CurvNames m_names = {"Gauss Curvature", , , , , }

Friends

CurvaturesData operator+(const CurvaturesData &a, const CurvaturesData &b)
CurvaturesData operator-(const CurvaturesData &a, const CurvaturesData &b)
CurvaturesData operator*(const CurvaturesData &a, const double lambda)
CurvaturesData operator*(const CurvaturesData &a, const CurvaturesData &b)
CurvaturesData operator/(const CurvaturesData &a, const double lambda)
CurvaturesData operator/(const CurvaturesData &a, const CurvaturesData &b)
class CurvaturesDataArray
#include <CurvaturesDataArray.h>

A class storing CurvatureData elements.

Public Types

using iterator = DataMap::iterator
using const_iterator = DataMap::const_iterator

Public Functions

CurvaturesDataArray()
void SetNumberOfValues(IdType n)

Set the number of elements in the array.

IdType GetNumberOfElements() const

Get the number of elements in the array.

void Append(IdType i, CurvaturesData curvData)

Append a CurvaturesData object to the array.

Parameters
  • i: The ID of the point for which to store the data

  • curvData: The actual CurvaturesData object to store

CurvaturesData Get(IdType i) const

Retrieve the CurvatureData structure at ID i.

void Write(std::string filename) const

Write the array into a file.

iterator begin()
const_iterator begin() const
const_iterator cbegin() const
iterator end()
const_iterator end() const
const_iterator cend() const

Private Types

using DataMap = std::unordered_map<std::string, vtkSmartPointer<vtkDoubleArray>>

Private Members

DataMap m_data
IdType m_npoints
class Edge
#include <Edge.h>

A class representing an edge.

Author

RdB This class represents an edge of a 1-ring. So, let’s imagine the 1-ring as a star:

                          x     x
                           \   /
                            \ /
                          x--C::::N
                             |
                             x
So each (x) is a point of the 1-ring, C is the vertex of the 1-ring, and N is one neighbour. C-N is one edge, that is hence given by the center point of the 1-ring (C) and one neighbour point.

Attention

It’s important to specify which is the center point because that point is used to lookup for the cells that share the edge

Public Functions

Edge(Point pc, Point p2, Pair<Cell> cellEdgePair)

Constructor from two Points and a Pair.

IdType Id() const

Id of the Edge.

The Id is given by a combination of the Ids of the two points composing the edge

const Point &Pc() const

Accessor to the central vertex.

const Point &P2() const

Accessor to the “other” vertex.

Pair<Cell> EdgeCells()

Access the two cells that share this edge.

Return

A Pair<Cell> that contains the two cells

bool operator==(const Edge &other) const

Private Members

Point m_pc

This is the point that is the center of the star This is a neighbour point.

Point m_p2
const Pair<Cell> m_cellEdgePair

A pair containing the two cells that share the same

class ErrorObserver : public vtkCommand
#include <ErrorObserver.h>

A class to observe errors in VTK filters.

Author

RdB Source: https://lorensen.github.io/VTKExamples/site/Cxx/Utilities/ObserveError/

Public Functions

ErrorObserver()
bool GetError() const
bool GetWarning() const
void Clear()
void Execute(vtkObject *vtkNotUsedcaller, unsigned long event, void *calldata)
std::string GetErrorMessage()
std::string GetWarningMessage()

Public Static Functions

ErrorObserver *New()

Private Members

bool Error
bool Warning
std::string ErrorMessage
std::string WarningMessage
template<typename T, typename ConstructorFun>
class Factory
#include <Factory.h>

A self registering factory base class.

Public Functions

void Register(const std::string name, ConstructorFun *constructorFun)

Public Static Functions

static T &GetInstance()

Returns the instance of the Factory.

Protected Functions

Factory()
Factory(const Factory&)
Factory &operator=(const Factory&)
virtual ~Factory()

Protected Attributes

std::unordered_map<std::string, ConstructorFun *> m_register
class GridBlock
#include <GridBlock.h>

This class is a handy wrapper over a vtkImageData.

In order to be able to sort it coordinate-wise and perform the algorithm to merge the blocks if a simulation is multiblock. A block is identified by the coordinate of the leftmost bottom corner.

Public Functions

GridBlock(vtkSmartPointer<vtkImageData> block)
int Nx() const

Accessor method to the number of x-wise elements.

int Ny() const

Accessor method to the number of y-wise elements.

int Nz() const

Accessor method to the number of z-wise elements.

std::vector<int> GetDimensions() const

Returns the dimension over x, y, z axis respectively.

double *GetSpacing() const

Returns the spacing of the block.

double *GetOrigin() const

Returns the Origin coordinates of the block.

double X() const

Accessor method to the x-coordinate of the block corner.

double Y() const

Accessor method to the y-coordinate of the block corner.

double Z() const

Accessor method to the z-coordinate of the block corner.

void SetStartIJK(int i, int j, int k)

Set the initial position of the block within the merged grid.

std::vector<int> GetStartIJK() const

Get the initial position of the block within the merged grid.

void SetEndIJK(int i, int j, int k)

Set the final position of the block within the merged grid.

std::vector<int> GetEndIJK() const

Get the final position of the block within the merged grid.

double GetScalarComponent(const int componentID, const int i, const int j, const int k) const

Get the scalar component value at ijk.

Return

The value of the scalar component identified by componentID at i,j,k position in the grid

Parameters
  • [in] componentID: The index of the component to get

  • [in] i: The x-wise index of the block element

  • [in] j: The y-wise index of the block element

  • [in] k: The z-wise index of the element

bool operator<(const GridBlock &other) const

Private Members

int m_nx

Number of elements x-wise

int m_ny

Number of elements y-wise

int m_nz

Number of elements z-wise

double m_x

x-coordinate of the bottom-left corner point

double m_y

y-coordinate of the bottom-left corner point

double m_z

z-coordinate of the bottom-left corner point

std::vector<int> m_startijk
bool m_hasStartIJK = false
std::vector<int> m_endijk
bool m_hasEndIJK = false
vtkSmartPointer<vtkImageData> m_block

The pointer to underlying vtkImageData.

class GridObject
#include <GridObject.h>

An interface representing the possible input objects for a grid.

At the moment the results of a DNS could be given as different datasets i.e. a vtkMultiBlockDataSet that needs to be merged, or a bare vtkImageData that can be used as it is, and maybe in the future other types of objects. This provides an interface that allows polymorphims notably within Volume class to allow to use different inputs.

Public Functions

GridObject()
virtual ~GridObject()
template<typename IterItem>
struct ItemHash
#include <ItemHash.h>

The hashing function for a general IterItem.

It simply has the object with its ID

Public Functions

size_t operator()(const IterItem &cell) const
template<typename IterItem>
class Iterator
#include <Iterator.h>

The IterItem iterator class for the Surface container.

Author

RdB This class implements the iterator class to iterate over IterItems in a Surface class

Public Types

template<>
using value_type = IterItem
template<>
using difference_type = std::ptrdiff_t
template<>
using pointer = IterItem *
template<>
using reference = IterItem&
template<>
using iterator_category = std::forward_iterator_tag

Public Functions

Iterator(IterItem iter)

Constructor from a IterItem object

Iterator &operator++()
Iterator operator++(int)
IterItem &operator*()
IterItem *operator->()
bool operator!=(const Iterator &other)
bool operator==(const Iterator &other)

Private Members

IterItem _iter
class LevelSetCylinder : public hgve::LevelSetObject
#include <LevelSetCylinder.h>

A cylinder in \(\mathbb{R}^3\) represented by its SDF.

Public Functions

LevelSetCylinder(double R, double h, SimpleVector center)

Private Members

double m_R

Radius of the cylinder

double m_h

Height of the cylinder

SimpleVector m_C

Center of the cylinder

class LevelSetEllipsoid : public hgve::LevelSetObject
#include <LevelSetEllipsoid.h>

An ellipsoid in \(\mathbb{R}^3\) represented by its SDF.

Public Functions

LevelSetEllipsoid(double Rx, double Ry, double Rz)

Constructor.

Parameters
  • Rx: x semi-axis

  • Ry: y semi-axis

  • Rz: z semi-axis

Private Members

double m_Rx

The x semi-axis of the ellipsoid

double m_Ry

The y semi-axis of the ellipsoid

double m_Rz

The z semi-axis of the ellipsoid

class LevelSetObject
#include <LevelSetObject.h>

An Abstract class representing a 3D surface object described by a SDF in \(\mathbb{R}^3\).

A 2D surface can be described by a level-set function, that means a function:

\[ \phi(\mathbf{x}) = 0 \]

In particular a Signed Distance Function (SDF) is a function that gives the distance of any point of the domain \(\mathbf{x}\) from the surface itself. Being signed, that means we can also understand when we are inside the object (+) and when we are outside (-). Most of the operators and algorithms are inspired by: https://iquilezles.org/www/articles/distfunctions/distfunctions.htm

Subclassed by hgve::LevelSetCylinder, hgve::LevelSetEllipsoid, hgve::LevelSetSphere, hgve::LevelSetTorus

Protected Attributes

SDFFunction m_SDF

The internal function representing the functional strucutre of the SDF.

Private Types

using SDFFunction = std::function<double(double, double, double)>
class LevelSetSphere : public hgve::LevelSetObject
#include <LevelSetSphere.h>

A sphere in \(\mathbb{R}^3\) represented by its SDF.

Author

RdB

Public Functions

LevelSetSphere(double radius, SimpleVector center)

Constructor.

Parameters
  • radius: The radius of the sphere

Private Members

double m_R

The radius of the sphere

SimpleVector m_C

The center of the sphere

class LevelSetTorus : public hgve::LevelSetObject
#include <LevelSetTorus.h>

A Torus in \(\mathbb{R}^3\) represented by its SDF.

Public Functions

LevelSetTorus(double R, double r, SimpleVector center)

Private Members

double m_R

The ring radius of the torus

double m_r

The radius of the tube of the torus

SimpleVector m_C

Center of the Torus

class NonManifoldException : public exception
#include <NonManifoldException.h>

An exception to handle cases where we have non-manifold cells.

Public Functions

const char *what() const
class Point
#include <Point.h>

A class representing a Surface point in 3D.

Author

RdB

Public Functions

Point(Surface &mesh)

Constructor that just holds a reference to the mesh.

Point(Surface &mesh, IdType pointId)

Constructor for point ID.

Point(const Point &other)

copy constructor

ThreeArray<double> GetCoordinates() const

Get the x, y, z coordinates of the Point.

Return

A Coords3D containing the coordinates

IdType Id() const

Access id of the point.

double Norm() const

Compute the Euclidean norm of the Point.

Return

The value of the norm

Set<Cell> OneRingCells() const

Iterate over the cells that share this point.

Return

An iterable over all the cells that compose the one ring of this point (i.e. share this point)

Set<Point> OneRingPoints() const

Iterate over the connectivity of the one-ring of this point.

Return

An iterable over all the points that are connected by an edge to this point

Set<Edge> OneRingEdges() const

Iterate over the edges that compose the 1-ring.

Return

An iterable over the edges that are connected to this point

double OneRingArea() const

Compute the 1-ring area.

It uses the mixed area approach described in [1].

Attention

Not really used in the computation of the mean curvature to avoid an additional loop.

Return

The value of the 1-ring area

CurvaturesData OneRingProperties() const

Compute the 1-ring geometrical properties.

The mean curvature is computed as a space-averaged value on the point 1-ring as explained in [1]

Return

The values of the properties associated to each 1-ring

SimpleVector operator+(const Point &other) const
SimpleVector operator-(const Point &other) const
SimpleVector operator^(const Point &other) const
Point &operator=(const Point &other)
Point &operator++()
Point operator++(int)
bool operator==(const Point &other) const
bool operator!=(const Point &other) const

Private Members

IdType m_id
Surface &m_mesh

Private Static Functions

Point GetEndItem(Surface &mesh)

Static member to return the last Point present in the given Surface object.

Friends

friend hgve::Point::Surface
friend hgve::Point::Iterator< Point >
class Product
#include <Product.h>

Empty base abstract class of a Factory-produceable Product object.

Public Functions

Product()
virtual ~Product()
template<typename IterItem>
struct Range
#include <Iterator.h>

A small handy struct to be used in range-based loop.

e.g. for (

Point p : polydata.range<Point>() ) { // polydata.range() returns a Range struct // Do stuff with p }
Author

RdB The struct is needed to be able to perform range-based for loops on the templated Iterator

Public Functions

Iterator<IterItem> begin()
Iterator<IterItem> end()

Public Members

Iterator<IterItem> begin_iter
Iterator<IterItem> end_iter
class SimpleVector
#include <SimpleVector.h>

A class representing the sum/difference between Point.

Author

RdB

Public Functions

SimpleVector(ThreeArray<double> p)

Constructor from 3D position vector.

SimpleVector(double x, double y, double z)

Constructor from separate x, y, z coordinates.

double X() const

Accessor to X.

double Y() const

Accessor to Y.

double Z() const

Accessor to Z.

double Norm2() const

Compute square of the Norm.

double Norm() const

Compute the Norm.

double Dot(const SimpleVector &b) const

Scalar Product.

SimpleVector Multiply(const SimpleVector &b) const

Element-wise Multiplication.

SimpleVector Divide(const SimpleVector &b) const

Element-wise Division.

SimpleVector Clamp(const SimpleVector &minVal, const SimpleVector &maxVal) const

Clamp function for vectors as for GLSL language.

The clamp function returns x if it is larger than minVal and smaller than maxVal. In case x is smaller than minVal, minVal is returned. If x is larger than maxVal, maxVal is returned. The operation is done component-wise.

Return

A clamped SimpleVector

Parameters
  • X: The value to clamp

  • minVal: The minimum value to clamp to

  • maxVal: The maximum value to clamp to

SimpleVector Abs() const

Element-wise absolute value.

SimpleVector &operator+=(const SimpleVector &b)
SimpleVector &operator-=(const SimpleVector &b)
SimpleVector operator-() const &
SimpleVector &operator*=(const double lambda)
SimpleVector &operator/=(const double lambda)
bool operator==(const SimpleVector &b) const
bool operator!=(const SimpleVector &b) const
SimpleVector operator^(const SimpleVector &b)

Private Members

double m_x
double m_y
double m_z

Friends

SimpleVector Min(const SimpleVector &a, const SimpleVector &b)

Element-wise std::min equivalent.

SimpleVector Max(const SimpleVector &a, const SimpleVector &b)

Element-wise std::max equivalent.

SimpleVector operator+(const SimpleVector &a, const SimpleVector &b)
SimpleVector operator-(const SimpleVector &a, const SimpleVector &b)
SimpleVector operator*(const double lambda, const SimpleVector &v)
SimpleVector operator*(const SimpleVector &v, const double lambda)
SimpleVector operator/(const double lambda, const SimpleVector &v)
SimpleVector operator/(const SimpleVector &v, const double lambda)
SimpleVector operator^(const SimpleVector &a, const SimpleVector &b)

Cross Product.

class Surface
#include <Surface.h>

A class representing a 2D surface in a 3D space.

Author

RdB This class is basically a wrapper around the vtkPolyData data structure and provides method to access the underlying data structure and its iterables and also methods to compute curvatures

Public Functions

Surface(vtkSmartPointer<vtkPolyData> polydata)

Constructor taking only a vtkSmartPointer<vtkPolyData> as argument.

Surface(const Surface &other)

Copy-constructor.

bool HasGeometricalData() const

Returs true if ComputeCurvatures has been called and the Surface contains geometrical data.

const CurvaturesDataArray &GetCurvArray() const

Read-only accessor to the CurvaturesDataArray.

const vtkSmartPointer<vtkPolyData> GetPolyData() const

Read-only accessor to the underlying vtkPolyData.

void Clean(double rad)

Cleanup degenerate cells in order to obtain a clean surface triangulation.

Parameters
  • rad: The tolerance radius close points are merged within

void Sanitize()

Remove degenerate cells with (e.g. two points cells).

It’s generally needed when generating 3D objects directly and not from a volumetric level-set to which a contouring procedure is then applied

void Rebuild()

Rebuild the surface connectivity.

template<typename IterItem>
Range<IterItem> IterateOver()

Method to loop over objects in the polygonal data.

Use this method to loop over the objects composing the data structure, for example Points, or Cells

template<typename IterItem>
IterItem GetBeginItem()

Returns the first IterItem in the polygonal data.

template<typename IterItem>
IterItem GetEndItem()

Returns the last IterItem in the polygonal data.

ThreeArray<double> GetPoint(IdType id) const

: Retrieve point coordinates from its ID

Return

: A 3-element array coords containing the coordinates coords[0] = x coords[1] = y coords[2] = z

vtkIdType FindPoint(double x, double y, double z) const

: Retrieve point ID from its coordinates

Return

: The ID of the point

vtkIdType GetNumberOfPoints() const

Get total number of points.

Return

The total number of points

vtkIdType GetNumberOfCells() const

Get total number of cells.

Return

The total number of points

ThreeArray<Point> GetCellPoints(const Cell cell)

Get Points composing a cell.

Set<Cell> GetPointCells(const Point &point)

Returns an iterator over the given point’s neighbour cells.

double Area()

Compute the area of the surface.

void ComputeCurvatures()

Computes the values of the curvatures and stores them in the.

void Average(double radius)

Averages the point values with the value of the neighbours.

Given a specified radius, it averages the value for each single point with the value of the points within the specified radius averaged by the 1-ring area value of that point

void Write(std::string filename)

Writes the surface in a file that can be read by ParaView.

At the moment is XML VTK

Surface &operator=(const Surface &other)

Private Members

bool m_hasGeometricalData = false

A flag to check if curvatures have been computed.

vtkSmartPointer<vtkPolyData> m_polyPtr

A pointer to the vtk object.

vtkSmartPointer<vtkPointLocator> m_locator = vtkSmartPointer<vtkPointLocator>::New()

Point Locator.

CurvaturesDataArray m_curvData

Storing the curvatures data.

Friends

friend hgve::Surface::SurfaceWriter
class SurfaceASCIIWriter : public hgve::SurfaceWriter
#include <SurfaceASCIIWriter.h>

This class writes a Surface object to a simple ASCII file.

First all the properties of the points are listed Then the connectivity of the cells is also saved

# Points section
x y z H G A ...

# Cells section
Point1 Point2 Point3

Public Functions

SurfaceASCIIWriter(std::string filename, Surface &surface)
void Write() const

Private Functions

void SerializeWithGeometry(std::ofstream &file) const

This method takes care of serializing the surface when it also contains geometrical data.

void SerializeWithoutGeometry(std::ofstream &file) const

This method takes care of serializing the surface when it does not contain geometrical data.

Private Members

const std::string POINT_HEADER = "# [Point Data]n# X Y Z "
const std::string CELL_HEADER = "# [Cell Data]n# Point1 Point2 Point3n"
class SurfaceVTKWriter : public hgve::SurfaceWriter
#include <SurfaceVTKWriter.h>

This class writes a Surface object to a VTK .vtp file.

Public Functions

SurfaceVTKWriter(std::string filename, Surface &surface)
void Write() const
class SurfaceWriter
#include <SurfaceWriter.h>

The base class for Surface writers.

A derived class needs to override the Write() method to serialize the Surface object to disk

Subclassed by hgve::SurfaceASCIIWriter, hgve::SurfaceVTKWriter

Public Functions

SurfaceWriter(std::string filename, Surface &surface)
virtual void Write() const
virtual ~SurfaceWriter()

Protected Attributes

std::string m_filename
Surface &m_surface

Private Static Functions

Surface &RescaleSurface(Surface &surface)
class SurfaceWriterFactory : public hgve::Factory<SurfaceWriterFactory, SurfaceWriterConstructorFun>
#include <SurfaceWriterFactory.h>

A factory to create SurfaceWriter objects.

The register keys are the file extensions. That mean, for example, that the constructor function of the SurfaceVTKWriter class is indexed in the register with the extension .vtp

Public Functions

void Write(std::string(filename), Surface&, )
template<typename WriterType>
class SurfaceWriterRegistration
#include <SurfaceWriterFactoryReg.h>

This class is needed to be able to perform the registration of classes within the SurfaceWriterFactory register.

Public Functions

SurfaceWriterRegistration(std::string name)
class Volume
#include <Volume.h>

A class representing a 3D volume on which a level-set function is given.

This class is practically a wrapper over the vtkImageData class of VTK. It’s meant to provide an easier API over the results of the DNS. It also ships method to handle multiblock files from DNS simulations

Public Functions

Volume(IdType nx, IdType ny, IdType nz, double dx, double dy, double dz)

Constructor to internally generate the grid.

This constructor instantiate internally a vtkImageData object to act as the Volume (instead of taking a vtkImageData (or Block) as input).

Parameters
  • nx: Number of points in the x-direction

  • ny: Number of points in the y-direction

  • nz: Number of points in the z-direction

  • dx: Spacing in the x-direction

  • dy: Spacing in the y-direction

  • dz: Spacing in the z-direction

Volume(IdType nx, IdType ny, IdType nz, SimpleVector p)

Contructor to internally generate the grid.

This version of the constructor builds the grid giving the number of points per direction and the coordinates of the upper-right point of the grid (the bottom-left is assumed to be (0, 0, 0);

Parameters
  • nx: Number of points in the x-direction

  • ny: Number of points in the y-direction

  • nz: Number of points in the z-direction

  • p: The upper-right point

Volume(ThreeArray<IdType> n, ThreeArray<double> d)

Constructor to internally generate the grid.

This constructor instantiate internally a vtkImageData object to act as the Volume (instead of taking a vtkImageData (or Block) as input).

Parameters
  • n: Array of the number of points in the three directions (x, y, z)

  • d: Array of spacings in the three directions (x, y, z)

Volume(vtkSmartPointer<vtkDataObject> grid, bool overlap = true)

Constructor from pre-existing vtkDataObject.

Parameters
  • grid: The level-set grid. Can be directly a vtkImageData or a vtkMultiBlockDataSet. If it’s a multiblock the blocks are merged.

  • overlap: A flag that is passed to the merger. If true the first layer of points is skipped during the merging

void AddLevelSetObject(const LevelSetObject &object)

Materialize a LevelSetObject in the domain.

This method takes a LevelSetObject and writes it’s Signed Distance function

Parameters
  • object: The level set object to add in the domain

std::unique_ptr<Surface> Triangulate() const

This method triangulates the level-set returning a Surface.

ThreeArray<double> GetSpacing() const

This method returns the points spacing in the three dimensions.

IdType GetNumberOfPoints() const

This method returns the number of points contained in the volume.

void Write(std::string filename)

Writes the volume into a file that can be read by Paraview.

At the moment is XML VTK

Parameters
  • filename: The name of the file

void SetInputData(vtkSmartPointer<vtkImageData> imageData)

Set internal object.

vtkSmartPointer<vtkImageData> GetOutput()

Return pointer to internal object.

Private Members

vtkSmartPointer<vtkImageData> m_imageData

The underlying vtkImageData.

Private Static Functions

void InitImageData(Volume *volume, IdType nx, IdType ny, IdType nz, double dx, double dy, double dz)

A satic method that fills up a vtkImageData with proper spacing and details. It is needed to be called from the different flavours of constructor.

Parameters
  • volume: A pointer to an instance of Volume

  • nx: Number of points in the x-direction

  • ny: Number of points in the y-direction

  • nz: Number of points in the z-direction

  • dx: Spacing in the x-direction

  • dy: Spacing in the y-direction

  • dz: Spacing in the z-direction

namespace hgve

Useful math stuff

Typedefs

using SurfaceWriterConstructorFun = std::shared_ptr<SurfaceWriter>(std::string filename, Surface &surface)
using IdType = vtkIdType
using IdList = vtkIdList
using Set = std::unordered_set<IterItem, ItemHash<IterItem>>

Templated set type for each “iter-item” of the polydata.

using Pair = std::pair<IterItem, IterItem>

Templated 2-element pair.

using ThreeArray = std::array<IterItem, 3>

Templated 3-element array.

Enums

enum Direction

Enum class to indicate the direction of mirroring.

Values:

X = 0
Y = 1
Z = 2
enum Orientation

Enum class for the orientation of flipping.

You can mirror in the same orientation as the given axis or in the opposite one

Values:

POS = 1
NEG = -1
enum Axes

Enum of type of axes that are used to wrap indices while merging blocks of a DNS simulation.

Values:

x
y
z

Functions

CurvaturesData operator+(const CurvaturesData &a, const CurvaturesData &b)
CurvaturesData operator-(const CurvaturesData &a, const CurvaturesData &b)
CurvaturesData operator*(const CurvaturesData &a, const CurvaturesData &b)
CurvaturesData operator*(const CurvaturesData &a, const double lambda)
CurvaturesData operator/(const CurvaturesData &a, const CurvaturesData &b)
CurvaturesData operator/(const CurvaturesData &a, const double lambda)
SimpleVector Min(const SimpleVector &a, const SimpleVector &b)
SimpleVector Max(const SimpleVector &a, const SimpleVector &b)
SimpleVector operator+(const SimpleVector &a, const SimpleVector &b)
SimpleVector operator-(const SimpleVector &a, const SimpleVector &b)
SimpleVector operator*(const double lambda, const SimpleVector &v)
SimpleVector operator*(const SimpleVector &v, const double lambda)
SimpleVector operator/(const double lambda, const SimpleVector &v)
SimpleVector operator/(const SimpleVector &v, const double lambda)
SimpleVector operator^(const SimpleVector &a, const SimpleVector &b)

Variables

std::unordered_map<std::string, std::pair<Direction, Orientation> > hgve::axes= { {"+X", std::make_pair(Direction::X, Orientation::POS)}, {"+Y", std::make_pair(Direction::Y, Orientation::POS)}, {"+Z", std::make_pair(Direction::Z, Orientation::POS)}, {"-X", std::make_pair(Direction::X, Orientation::NEG)}, {"-Y", std::make_pair(Direction::Y, Orientation::NEG)}, {"-Z", std::make_pair(Direction::Z, Orientation::NEG)}, }

A map used to match string representation of axes to the enum.

Mainly useful when parsing user input in the main file

const double EPS = std::numeric_limits<double>::epsilon()
const double SMALL = 50 * std::numeric_limits<double>::epsilon()
const double maxPrecision = std::numeric_limits<double>::max_digits10
const int TAB_WIDTH = 2
const int ID_WIDTH = 6
const int PRECISION_WIDTH = 24
namespace factory

Functions

SurfaceWriterRegistration<SurfaceASCIIWriter> hgve::factory::_SurfaceASCIIWriter(std::string(".ascii"))
SurfaceWriterRegistration<SurfaceVTKWriter> hgve::factory::_SurfaceVTKWriter(std::string(".vtp"))
file hgve.cxx
#include <iostream>#include <docopt.h>#include <numeric>#include <vtkSmartPointer.h>#include <vtkXdmfReader.h>#include “MercurveConfig.h”#include “filesystem.h”#include “BlockMerger.h”#include “BlockMirror.h”#include “ErrorObserver.h”#include “Volume.h”

Functions

int main(int argc, char *argv[])

Variables

const std::string USAGE
file BlockMerger.cxx
#include <iterator>#include “BlockMerger.h”#include “HGMath.h”
file BlockMerger.h
#include <algorithm>#include <vector>#include <vtkImageData.h>#include <vtkMultiBlockDataSet.h>#include “types.h”#include “GridBlock.h”
file BlockMirror.cxx
#include <vtkMatrix4x4.h>#include <vtkImageReslice.h>#include “BlockMirror.h”#include “types.h”
file BlockMirror.h
#include <unordered_map>#include <vtkSmartPointer.h>#include “GridBlock.h”
file Cell.cxx
#include <unordered_map>#include <vtkMath.h>#include “Cell.h”#include “Edge.h”#include “Point.h”#include “SimpleVector.h”#include “Surface.h”#include “HGMath.h”
file Cell.h
#include <array>#include <cmath>#include <vtkSmartPointer.h>#include <vtkTriangle.h>#include <vtkType.h>#include “types.h”#include “ItemHash.h”#include “Iterator.h”#include “SimpleVector.h”
file CurvaturesData.cxx
#include “CurvaturesData.h”
file CurvaturesData.h
#include <array>#include <string>#include <unordered_map>
file CurvaturesDataArray.cxx
#include <iostream>#include <vtkArrayData.h>#include <vtkArrayWriter.h>#include “CurvaturesDataArray.h”#include “HGMath.h”
file CurvaturesDataArray.h
#include <unordered_map>#include “vtkDoubleArray.h”#include “vtkSmartPointer.h”#include “types.h”#include “CurvaturesData.h”
file Edge.cxx
#include “Edge.h”
file Edge.h
#include “types.h”#include “Point.h”#include “Cell.h”
file ErrorObserver.cxx
#include “ErrorObserver.h”
file ErrorObserver.h
#include <string>#include <vtkCommand.h>
file Factory.h
#include <memory>#include <unordered_map>
file GridBlock.cxx
#include “GridBlock.h”#include “HGMath.h”
file GridBlock.h
#include <vtkImageData.h>#include <vtkSmartPointer.h>#include “types.h”
file GridObject.h
file HGMath.h
#include <limits>
file ItemHash.h
file Iterator.h
#include <cstddef>#include <iterator>
file LevelSetCylinder.cxx
#include <cmath>#include “LevelSetCylinder.h”
file LevelSetCylinder.h
#include “LevelSetObject.h”#include “SimpleVector.h”
file LevelSetEllipsoid.cxx
#include “LevelSetEllipsoid.h”#include “SimpleVector.h”
file LevelSetEllipsoid.h
#include “LevelSetObject.h”
file LevelSetObject.cxx
#include <cmath>#include “LevelSetObject.h”
file LevelSetObject.h
#include <functional>#include “types.h”#include “SimpleVector.h”
file LevelSetSphere.cxx
#include “LevelSetSphere.h”#include “SimpleVector.h”
file LevelSetSphere.h
#include “LevelSetObject.h”#include “SimpleVector.h”
file LevelSetTorus.cxx
#include <cmath>#include “LevelSetTorus.h”
file LevelSetTorus.h
#include “LevelSetObject.h”#include “SimpleVector.h”
file NonManifoldException.cxx
#include “NonManifoldException.h”
file NonManifoldException.h
#include <stdexcept>
file Point.cxx
#include <algorithm>#include <vtkMath.h>#include “Point.h”#include “Cell.h”#include “Edge.h”#include “NonManifoldException.h”#include “Surface.h”#include “SimpleVector.h”

Variables

const double TWO_PI = 2 * vtkMath::Pi()
file Point.h
#include <array>#include <vector>#include <cmath>#include “types.h”#include “CurvaturesData.h”#include “ItemHash.h”#include “Iterator.h”
file Product.h
file SimpleVector.cxx
#include <cmath>#include “SimpleVector.h”
file SimpleVector.h
#include “types.h”#include “Point.h”
file Surface.cxx
#include <sstream>#include <vtkCleanPolyData.h>#include <vtkPointData.h>#include <vtkPointLocator.h>#include <vtkTransform.h>#include <vtkTransformPolyDataFilter.h>#include <vtkXMLPolyDataWriter.h>#include <vtkZLibDataCompressor.h>#include “Point.h”#include “Surface.h”#include “SurfaceWriterFactory.h”
file Surface.h
#include <vtkDoubleArray.h>#include <vtkPointLocator.h>#include <vtkPolyData.h>#include <vtkSmartPointer.h>#include <vtkTriangle.h>#include “types.h”#include “Cell.h”#include “CurvaturesDataArray.h”#include “Iterator.h”#include “Point.h”
file SurfaceASCIIWriter.cxx
#include “HGMath.h”#include “SurfaceASCIIWriter.h”
file SurfaceASCIIWriter.h
#include “SurfaceWriter.h”#include “SurfaceWriterFactoryReg.h”
file SurfaceVTKWriter.cxx
#include <vtkXMLPolyDataWriter.h>#include “SurfaceVTKWriter.h”
file SurfaceVTKWriter.h
#include “SurfaceWriter.h”#include “SurfaceWriterFactoryReg.h”
file SurfaceWriter.cxx
#include <vtkPointData.h>#include <vtkTransform.h>#include <vtkTransformPolyDataFilter.h>#include “SurfaceWriter.h”
file SurfaceWriter.h
#include <string>#include “Surface.h”
file SurfaceWriterFactory.cxx
#include “filesystem.h”#include “SurfaceWriterFactory.h”#include “SurfaceWriter.h”
file SurfaceWriterFactory.h
#include “Factory.h”
file SurfaceWriterFactoryReg.h
#include “SurfaceWriterFactory.h”
file types.h
#include <array>#include <utility>#include <vector>#include <unordered_set>#include <vtkIdList.h>#include <vtkType.h>#include “ItemHash.h”
file Volume.cxx
#include <limits>#include <vtkMarchingCubes.h>#include <vtkMultiBlockDataSet.h>#include <vtkXMLImageDataWriter.h>#include “BlockMerger.h”#include “Volume.h”
file Volume.h
#include <vtkDataObject.h>#include <vtkImageData.h>#include <vtkSmartPointer.h>#include “LevelSetObject.h”#include “Surface.h”
page todo

page citelist

dir /builds/massot-team/hgve/src/apps
dir /builds/massot-team/hgve/src/libs
dir /builds/massot-team/hgve/src