HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_EdgeMesh< T > Class Template Reference

#include <GU_EdgeMesh.h>

+ Inheritance diagram for GU_EdgeMesh< T >:

Public Types

using Base = GU_EdgeMeshBase< T >
 

Public Member Functions

 GU_EdgeMesh ()
 
 ~GU_EdgeMesh () override
 
void buildMesh (const GU_Detail *gdp) override
 
void solveEikonalAttrib (GA_Attribute *dst, const GA_Attribute *speeds, const GA_PointGroup *pinned, T unreachable) const
 
void solvePoissonAttrib (GA_Attribute *dst, const GA_Attribute *src, const GA_Attribute *weights, const GA_PointGroup *pinned) const
 
void solveDiffusionAttrib (GA_Attribute *dst, const GA_Attribute *rates, const GA_PointGroup *pinned, T dt, T min_rate) const
 
- Public Member Functions inherited from GU_EdgeMeshBase< T >
 GU_EdgeMeshBase ()
 
virtual ~GU_EdgeMeshBase ()
 
void setMinimumDistance (T min_dist)
 Set the minimum distance between adjacent nodes used by the solver. More...
 
template<bool USE_SPEEDS>
void solveEikonal (UT_Array< T > &times, const UT_Array< T > &speeds, const UT_Set< int > &starters) const
 
void laplacian (UT_Array< T > &result, const UT_Array< T > &vals) const
 Computes the Laplacian of the function defined in vals. More...
 
void weightedLaplacian (UT_Array< T > &result, const UT_Array< T > &vals, const UT_Array< T > &weights) const
 
void solvePoisson (UT_Array< T > &sol, const UT_Array< T > &rhs, const UT_Set< int > &pinned, T def=0) const
 
void solveDiffusion (UT_Array< T > &sol, const UT_Array< T > *rates, const UT_Set< int > &pinned, T dt) const
 

Protected Member Functions

template<bool WRITE_TO_ALL, bool CHECK_EQUALITY = false>
void writeArrayToAttribute (GA_Attribute *dst, const UT_Array< T > &src, int comp, T def, T equal) const
 
void copyArrayFromAttributeAndSetPinned (UT_Array< T > &dst_a, UT_Set< int > &dst_s, const GA_Attribute *src_a, const GA_PointGroup *src_s) const
 
void copyArraysFromAttributesAndSetPinned (UT_Array< T > &a1, const GA_Attribute *ar1, UT_Array< T > &a2, const GA_Attribute *ar2, T def, UT_Set< int > &dst_s, const GA_PointGroup *src_s) const
 
void setPinnedFromGroup (UT_Set< int > &dst, const GA_PointGroup *src) const
 Adds every point in the given source group to the destination set. More...
 
template<bool CLAMP_BELOW = false, bool CLAMP_ABOVE = false>
void copyArrayFromAttribute (UT_Array< T > &dst, const GA_Attribute *src, int comp, T below=0, T above=1) const
 
- Protected Member Functions inherited from GU_EdgeMeshBase< T >
void setDiffusionRatesCacheIds (bool used, GA_DataId id, float min_rate) const
 
void resetCache () const
 Resets the internal cache. Should only be called if the graph changed. More...
 

Protected Attributes

const GU_DetailmyDetail
 Pointer to the detail this is to be built from. More...
 
GA_DataId myTopologyId
 Data ID for mesh topology of the last built graph. More...
 
GA_DataId myPositionId
 Data ID for the position attribute of the last built graph. More...
 
UT_Map< GA_Offset, intmyIndexMap
 Mapping of point offsets in the detail to indices in the mesh. More...
 
- Protected Attributes inherited from GU_EdgeMeshBase< T >
int myNumVertices
 Number of vertices in this graph. More...
 
UT_Array< UT_Set< int > > myVertexConnections
 Adjacency list for each vertex. More...
 
UT_Array< UT_Vector3T< T > > myVertexPositions
 Array of point locations in space. More...
 
gu_EMSolveCache< T > * mySolveCache
 Our solve cache to speed up subsequent similar solves. More...
 
T myMinDist2
 

Detailed Description

template<typename T>
class GU_EdgeMesh< T >

Definition at line 104 of file GU_EdgeMesh.h.

Member Typedef Documentation

template<typename T >
using GU_EdgeMesh< T >::Base = GU_EdgeMeshBase<T>

Definition at line 107 of file GU_EdgeMesh.h.

Constructor & Destructor Documentation

template<typename T >
GU_EdgeMesh< T >::GU_EdgeMesh ( )
template<typename T >
GU_EdgeMesh< T >::~GU_EdgeMesh ( )
inlineoverride

Definition at line 110 of file GU_EdgeMesh.h.

Member Function Documentation

template<typename T >
void GU_EdgeMesh< T >::buildMesh ( const GU_Detail gdp)
overridevirtual

Constructs the edge mesh from its detail. This function must be called before the solve routines can be invoked. NOTE: the graph will only be rebuilt if the topology or point positions changed.

Implements GU_EdgeMeshBase< T >.

template<typename T >
template<bool CLAMP_BELOW = false, bool CLAMP_ABOVE = false>
void GU_EdgeMesh< T >::copyArrayFromAttribute ( UT_Array< T > &  dst,
const GA_Attribute src,
int  comp,
T  below = 0,
T  above = 1 
) const
protected

Reads values from the given attribute and writes them to the destination array. If CLAMP_* is true, values will be clamped beyond that endpoint (given by below and above function arguments).

template<typename T >
void GU_EdgeMesh< T >::copyArrayFromAttributeAndSetPinned ( UT_Array< T > &  dst_a,
UT_Set< int > &  dst_s,
const GA_Attribute src_a,
const GA_PointGroup src_s 
) const
protected

Reads values from the given attribute and writes them to the destination array. Also adds every point in the given source group to the destination set.

template<typename T >
void GU_EdgeMesh< T >::copyArraysFromAttributesAndSetPinned ( UT_Array< T > &  a1,
const GA_Attribute ar1,
UT_Array< T > &  a2,
const GA_Attribute ar2,
T  def,
UT_Set< int > &  dst_s,
const GA_PointGroup src_s 
) const
protected

Reads values from the given attributes and writes them to the destination arrays. Also adds every point in the given source group to the destination set. The second attribute and point group must be non-null. a1 is left untouched if ar1 is null. a2 is set to the value of the attribute for each pinned point; it is set to def for points not in the group.

template<typename T >
void GU_EdgeMesh< T >::setPinnedFromGroup ( UT_Set< int > &  dst,
const GA_PointGroup src 
) const
protected

Adds every point in the given source group to the destination set.

template<typename T >
void GU_EdgeMesh< T >::solveDiffusionAttrib ( GA_Attribute dst,
const GA_Attribute rates,
const GA_PointGroup pinned,
T  dt,
T  min_rate 
) const

This function solves a single time step of the heat equation. Points in the pinned group are assumed to be fixed boundary conditions (this can be NULL if there are no fixed boundaries). The conductivity rates can vary per attribute (specified in rates, values are clamped from below at min_rate).

template<typename T >
void GU_EdgeMesh< T >::solveEikonalAttrib ( GA_Attribute dst,
const GA_Attribute speeds,
const GA_PointGroup pinned,
T  unreachable 
) const

This function calculates arrival times for all points in the mesh, given the starting vertices (the ones in the pinned group, which are arrived at the current value of the dst attribute) and propagation speeds (read from the speeds point attribute). Results are written in the destination point attribute. Points that are not reachable from the starters get the value of unreachable. The attributes and the group must be defined for points and be for the same detail as the one this mesh was built from. If speeds are not provided, speed of 1 is assumed for every point.

template<typename T >
void GU_EdgeMesh< T >::solvePoissonAttrib ( GA_Attribute dst,
const GA_Attribute src,
const GA_Attribute weights,
const GA_PointGroup pinned 
) const

This function solves the Poisson boundary value problem. Points in the pinned group are the boundary conditions, and the field will be as close as possible to the values defined in the source attribute; if a source attribute is not given, it will be assumed to be constant. Matching weights can also be provided; if given, they control how closely the source field is to be matched at each point (weight values should be between 0 and 1). Alternatively, the actual field to match is a convex combination of the incoming source field and a linear function; the weight then controls the contribution of the source field. Results are written in the destination point attribute. The attributes and the group must be defined for points and be for the same detail as the one this mesh was built from.

template<typename T >
template<bool WRITE_TO_ALL, bool CHECK_EQUALITY = false>
void GU_EdgeMesh< T >::writeArrayToAttribute ( GA_Attribute dst,
const UT_Array< T > &  src,
int  comp,
T  def,
T  equal 
) const
protected

Writes the contents of the array (indexed within this mesh) to the given attribute. The attribute must live on points of this mesh's detail. If WRITE_TO_ALL is true, points not in the mesh will write the value of def. If CHECK_EQUALITY is true, def is written for points whose value in src is the same as equal. If CHECK_EQUALITY is false, this parameter is not used.

Member Data Documentation

template<typename T >
const GU_Detail* GU_EdgeMesh< T >::myDetail
protected

Pointer to the detail this is to be built from.

Definition at line 203 of file GU_EdgeMesh.h.

template<typename T >
UT_Map<GA_Offset, int> GU_EdgeMesh< T >::myIndexMap
protected

Mapping of point offsets in the detail to indices in the mesh.

Definition at line 209 of file GU_EdgeMesh.h.

template<typename T >
GA_DataId GU_EdgeMesh< T >::myPositionId
protected

Data ID for the position attribute of the last built graph.

Definition at line 207 of file GU_EdgeMesh.h.

template<typename T >
GA_DataId GU_EdgeMesh< T >::myTopologyId
protected

Data ID for mesh topology of the last built graph.

Definition at line 205 of file GU_EdgeMesh.h.


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