MeshLib C Docs
Loading...
Searching...
No Matches
MRGraph.h File Reference
#include <MRCMesh/MRId.h>
#include <MRCMisc/common.h>
#include <MRCMisc/exports.h>
#include <stdbool.h>
#include <stddef.h>

Go to the source code of this file.

Typedefs

typedef struct MR_GraphEdgeBitSet MR_GraphEdgeBitSet
 
typedef struct MR_GraphVertBitSet MR_GraphVertBitSet
 
typedef struct MR_Vector_MR_Graph_EndVertices_MR_GraphEdgeId MR_Vector_MR_Graph_EndVertices_MR_GraphEdgeId
 
typedef struct MR_Vector_std_vector_MR_GraphEdgeId_MR_GraphVertId MR_Vector_std_vector_MR_GraphEdgeId_MR_GraphVertId
 
typedef struct MR_std_function_void_from_MR_GraphEdgeId_MR_GraphEdgeId MR_std_function_void_from_MR_GraphEdgeId_MR_GraphEdgeId
 
typedef struct MR_std_vector_MR_GraphEdgeId MR_std_vector_MR_GraphEdgeId
 
typedef struct MR_Graph_EndVertices MR_Graph_EndVertices
 
typedef struct MR_Graph MR_Graph
 

Functions

MRC_API MR_GraphMR_Graph_DefaultConstruct (void)
 
MRC_API MR_GraphMR_Graph_DefaultConstructArray (size_t num_elems)
 
MRC_API const MR_GraphMR_Graph_OffsetPtr (const MR_Graph *ptr, ptrdiff_t i)
 
MRC_API MR_GraphMR_Graph_OffsetMutablePtr (MR_Graph *ptr, ptrdiff_t i)
 
MRC_API MR_GraphMR_Graph_ConstructFromAnother (MR_PassBy _other_pass_by, MR_Graph *_other)
 
MRC_API void MR_Graph_Destroy (const MR_Graph *_this)
 Destroys a heap-allocated instance of MR_Graph. Does nothing if the pointer is null.
 
MRC_API void MR_Graph_DestroyArray (const MR_Graph *_this)
 Destroys a heap-allocated array of MR_Graph. Does nothing if the pointer is null.
 
MRC_API MR_GraphMR_Graph_AssignFromAnother (MR_Graph *_this, MR_PassBy _other_pass_by, MR_Graph *_other)
 
MRC_API void MR_Graph_construct (MR_Graph *_this, MR_PassBy neighboursPerVertex_pass_by, MR_Vector_std_vector_MR_GraphEdgeId_MR_GraphVertId *neighboursPerVertex, MR_PassBy endsPerEdge_pass_by, MR_Vector_MR_Graph_EndVertices_MR_GraphEdgeId *endsPerEdge)
 
MRC_API MR_uint64_t MR_Graph_vertSize (const MR_Graph *_this)
 
MRC_API const MR_GraphVertBitSetMR_Graph_validVerts (const MR_Graph *_this)
 
MRC_API bool MR_Graph_valid_MR_GraphVertId (const MR_Graph *_this, MR_GraphVertId v)
 
MRC_API MR_uint64_t MR_Graph_edgeSize (const MR_Graph *_this)
 
MRC_API const MR_GraphEdgeBitSetMR_Graph_validEdges (const MR_Graph *_this)
 
MRC_API bool MR_Graph_valid_MR_GraphEdgeId (const MR_Graph *_this, MR_GraphEdgeId e)
 
MRC_API const MR_std_vector_MR_GraphEdgeIdMR_Graph_neighbours (const MR_Graph *_this, MR_GraphVertId v)
 
MRC_API const MR_Graph_EndVerticesMR_Graph_ends (const MR_Graph *_this, MR_GraphEdgeId e)
 
MRC_API MR_GraphEdgeId MR_Graph_findEdge (const MR_Graph *_this, MR_GraphVertId a, MR_GraphVertId b)
 
MRC_API bool MR_Graph_areNeighbors (const MR_Graph *_this, MR_GraphVertId a, MR_GraphVertId b)
 
MRC_API void MR_Graph_merge (MR_Graph *_this, MR_GraphVertId remnant, MR_GraphVertId dead, MR_PassBy onMergeEdges_pass_by, MR_std_function_void_from_MR_GraphEdgeId_MR_GraphEdgeId *onMergeEdges)
 
MRC_API bool MR_Graph_checkValidity (const MR_Graph *_this)
 
MRC_API const MR_GraphVertIdMR_Graph_EndVertices_Get_v0 (const MR_Graph_EndVertices *_this)
 
MRC_API void MR_Graph_EndVertices_Set_v0 (MR_Graph_EndVertices *_this, MR_GraphVertId value)
 
MRC_API MR_GraphVertIdMR_Graph_EndVertices_GetMutable_v0 (MR_Graph_EndVertices *_this)
 
MRC_API const MR_GraphVertIdMR_Graph_EndVertices_Get_v1 (const MR_Graph_EndVertices *_this)
 
MRC_API void MR_Graph_EndVertices_Set_v1 (MR_Graph_EndVertices *_this, MR_GraphVertId value)
 
MRC_API MR_GraphVertIdMR_Graph_EndVertices_GetMutable_v1 (MR_Graph_EndVertices *_this)
 
MRC_API MR_Graph_EndVerticesMR_Graph_EndVertices_DefaultConstruct (void)
 
MRC_API MR_Graph_EndVerticesMR_Graph_EndVertices_DefaultConstructArray (size_t num_elems)
 
MRC_API MR_Graph_EndVerticesMR_Graph_EndVertices_ConstructFrom (MR_GraphVertId v0, MR_GraphVertId v1)
 
MRC_API const MR_Graph_EndVerticesMR_Graph_EndVertices_OffsetPtr (const MR_Graph_EndVertices *ptr, ptrdiff_t i)
 
MRC_API MR_Graph_EndVerticesMR_Graph_EndVertices_OffsetMutablePtr (MR_Graph_EndVertices *ptr, ptrdiff_t i)
 
MRC_API MR_Graph_EndVerticesMR_Graph_EndVertices_ConstructFromAnother (const MR_Graph_EndVertices *_other)
 
MRC_API void MR_Graph_EndVertices_Destroy (const MR_Graph_EndVertices *_this)
 Destroys a heap-allocated instance of MR_Graph_EndVertices. Does nothing if the pointer is null.
 
MRC_API void MR_Graph_EndVertices_DestroyArray (const MR_Graph_EndVertices *_this)
 Destroys a heap-allocated array of MR_Graph_EndVertices. Does nothing if the pointer is null.
 
MRC_API MR_Graph_EndVerticesMR_Graph_EndVertices_AssignFromAnother (MR_Graph_EndVertices *_this, const MR_Graph_EndVertices *_other)
 
MRC_API MR_GraphVertId MR_Graph_EndVertices_otherEnd (const MR_Graph_EndVertices *_this, MR_GraphVertId a)
 
MRC_API void MR_Graph_EndVertices_replaceEnd (MR_Graph_EndVertices *_this, MR_GraphVertId what, MR_GraphVertId with)
 

Typedef Documentation

◆ MR_Graph

typedef struct MR_Graph MR_Graph

mathematical graph consisting from vertices and undirected edges Generated from class MR::Graph. Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Copy, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_Graph_EndVertices

Generated from class MR::Graph::EndVertices. Supported MR_PassBy modes: MR_PassBy_DefaultConstruct, MR_PassBy_Copy, MR_PassBy_Move (and MR_PassBy_DefaultArgument and MR_PassBy_NoObject if supported by the callee).

◆ MR_GraphEdgeBitSet

◆ MR_GraphVertBitSet

◆ MR_std_function_void_from_MR_GraphEdgeId_MR_GraphEdgeId

◆ MR_std_vector_MR_GraphEdgeId

◆ MR_Vector_MR_Graph_EndVertices_MR_GraphEdgeId

◆ MR_Vector_std_vector_MR_GraphEdgeId_MR_GraphVertId

Function Documentation

◆ MR_Graph_areNeighbors()

MRC_API bool MR_Graph_areNeighbors ( const MR_Graph * _this,
MR_GraphVertId a,
MR_GraphVertId b )

returns true if the vertices a and b are neighbors Generated from method MR::Graph::areNeighbors. Parameter _this can not be null. It is a single object.

◆ MR_Graph_AssignFromAnother()

MRC_API MR_Graph * MR_Graph_AssignFromAnother ( MR_Graph * _this,
MR_PassBy _other_pass_by,
MR_Graph * _other )

Generated from method MR::Graph::operator=. Parameter _this can not be null. It is a single object. The reference to things referred to by the parameter _other (if any) might be preserved in this object. The returned pointer will never be null. It is non-owning, do NOT destroy it. When this function is called, this object will drop any object references it had previously.

◆ MR_Graph_checkValidity()

MRC_API bool MR_Graph_checkValidity ( const MR_Graph * _this)

verifies that all internal data structures are valid Generated from method MR::Graph::checkValidity. Parameter _this can not be null. It is a single object.

◆ MR_Graph_construct()

MRC_API void MR_Graph_construct ( MR_Graph * _this,
MR_PassBy neighboursPerVertex_pass_by,
MR_Vector_std_vector_MR_GraphEdgeId_MR_GraphVertId * neighboursPerVertex,
MR_PassBy endsPerEdge_pass_by,
MR_Vector_MR_Graph_EndVertices_MR_GraphEdgeId * endsPerEdge )

constructs the graph from all valid vertices and edges Generated from method MR::Graph::construct. Parameter _this can not be null. It is a single object.

◆ MR_Graph_ConstructFromAnother()

MRC_API MR_Graph * MR_Graph_ConstructFromAnother ( MR_PassBy _other_pass_by,
MR_Graph * _other )

Generated from constructor MR::Graph::Graph. The reference to things referred to by the parameter _other (if any) might be preserved in the constructed object. Never returns null. Returns an instance allocated on the heap! Must call MR_Graph_Destroy() to free it when you're done using it.

◆ MR_Graph_DefaultConstruct()

MRC_API MR_Graph * MR_Graph_DefaultConstruct ( void )

Constructs an empty (default-constructed) instance. Never returns null. Returns an instance allocated on the heap! Must call MR_Graph_Destroy() to free it when you're done using it.

◆ MR_Graph_DefaultConstructArray()

MRC_API MR_Graph * MR_Graph_DefaultConstructArray ( size_t num_elems)

Constructs an array of empty (default-constructed) instances, of the specified size. Will never return null. The array must be destroyed using MR_Graph_DestroyArray(). Use MR_Graph_OffsetMutablePtr() and MR_Graph_OffsetPtr() to access the array elements.

◆ MR_Graph_Destroy()

MRC_API void MR_Graph_Destroy ( const MR_Graph * _this)

Destroys a heap-allocated instance of MR_Graph. Does nothing if the pointer is null.

◆ MR_Graph_DestroyArray()

MRC_API void MR_Graph_DestroyArray ( const MR_Graph * _this)

Destroys a heap-allocated array of MR_Graph. Does nothing if the pointer is null.

◆ MR_Graph_edgeSize()

MRC_API MR_uint64_t MR_Graph_edgeSize ( const MR_Graph * _this)

returns the number of edge records, including invalid ones Generated from method MR::Graph::edgeSize. Parameter _this can not be null. It is a single object.

◆ MR_Graph_ends()

MRC_API const MR_Graph_EndVertices * MR_Graph_ends ( const MR_Graph * _this,
MR_GraphEdgeId e )

returns the ends of given edge Generated from method MR::Graph::ends. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Graph_EndVertices_AssignFromAnother()

MRC_API MR_Graph_EndVertices * MR_Graph_EndVertices_AssignFromAnother ( MR_Graph_EndVertices * _this,
const MR_Graph_EndVertices * _other )

Generated from method MR::Graph::EndVertices::operator=. Parameter _this can not be null. It is a single object. Parameter _other can not be null. It is a single object. The reference to things referred to by the parameter _other (if any) might be preserved in this object. The returned pointer will never be null. It is non-owning, do NOT destroy it. When this function is called, this object will drop any object references it had previously.

◆ MR_Graph_EndVertices_ConstructFrom()

MRC_API MR_Graph_EndVertices * MR_Graph_EndVertices_ConstructFrom ( MR_GraphVertId v0,
MR_GraphVertId v1 )

Constructs MR::Graph::EndVertices elementwise. The reference to the parameter v0 might be preserved in the constructed object. The reference to the parameter v1 might be preserved in the constructed object. Never returns null. Returns an instance allocated on the heap! Must call MR_Graph_EndVertices_Destroy() to free it when you're done using it. When this function is called, this object will drop any object references it had previously.

◆ MR_Graph_EndVertices_ConstructFromAnother()

MRC_API MR_Graph_EndVertices * MR_Graph_EndVertices_ConstructFromAnother ( const MR_Graph_EndVertices * _other)

Generated from constructor MR::Graph::EndVertices::EndVertices. Parameter _other can not be null. It is a single object. The reference to things referred to by the parameter _other (if any) might be preserved in the constructed object. Never returns null. Returns an instance allocated on the heap! Must call MR_Graph_EndVertices_Destroy() to free it when you're done using it.

◆ MR_Graph_EndVertices_DefaultConstruct()

MRC_API MR_Graph_EndVertices * MR_Graph_EndVertices_DefaultConstruct ( void )

Constructs an empty (default-constructed) instance. Never returns null. Returns an instance allocated on the heap! Must call MR_Graph_EndVertices_Destroy() to free it when you're done using it.

◆ MR_Graph_EndVertices_DefaultConstructArray()

MRC_API MR_Graph_EndVertices * MR_Graph_EndVertices_DefaultConstructArray ( size_t num_elems)

Constructs an array of empty (default-constructed) instances, of the specified size. Will never return null. The array must be destroyed using MR_Graph_EndVertices_DestroyArray(). Use MR_Graph_EndVertices_OffsetMutablePtr() and MR_Graph_EndVertices_OffsetPtr() to access the array elements.

◆ MR_Graph_EndVertices_Destroy()

MRC_API void MR_Graph_EndVertices_Destroy ( const MR_Graph_EndVertices * _this)

Destroys a heap-allocated instance of MR_Graph_EndVertices. Does nothing if the pointer is null.

◆ MR_Graph_EndVertices_DestroyArray()

MRC_API void MR_Graph_EndVertices_DestroyArray ( const MR_Graph_EndVertices * _this)

Destroys a heap-allocated array of MR_Graph_EndVertices. Does nothing if the pointer is null.

◆ MR_Graph_EndVertices_Get_v0()

MRC_API const MR_GraphVertId * MR_Graph_EndVertices_Get_v0 ( const MR_Graph_EndVertices * _this)

Returns a pointer to a member variable of class MR::Graph::EndVertices named v0. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Graph_EndVertices_Get_v1()

MRC_API const MR_GraphVertId * MR_Graph_EndVertices_Get_v1 ( const MR_Graph_EndVertices * _this)

Returns a pointer to a member variable of class MR::Graph::EndVertices named v1. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Graph_EndVertices_GetMutable_v0()

MRC_API MR_GraphVertId * MR_Graph_EndVertices_GetMutable_v0 ( MR_Graph_EndVertices * _this)

Returns a mutable pointer to a member variable of class MR::Graph::EndVertices named v0. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Graph_EndVertices_GetMutable_v1()

MRC_API MR_GraphVertId * MR_Graph_EndVertices_GetMutable_v1 ( MR_Graph_EndVertices * _this)

Returns a mutable pointer to a member variable of class MR::Graph::EndVertices named v1. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Graph_EndVertices_OffsetMutablePtr()

MRC_API MR_Graph_EndVertices * MR_Graph_EndVertices_OffsetMutablePtr ( MR_Graph_EndVertices * ptr,
ptrdiff_t i )

Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element. The reference to the parameter ptr might be preserved in the return value.

◆ MR_Graph_EndVertices_OffsetPtr()

MRC_API const MR_Graph_EndVertices * MR_Graph_EndVertices_OffsetPtr ( const MR_Graph_EndVertices * ptr,
ptrdiff_t i )

Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element. The reference to the parameter ptr might be preserved in the return value.

◆ MR_Graph_EndVertices_otherEnd()

MRC_API MR_GraphVertId MR_Graph_EndVertices_otherEnd ( const MR_Graph_EndVertices * _this,
MR_GraphVertId a )

Generated from method MR::Graph::EndVertices::otherEnd. Parameter _this can not be null. It is a single object.

◆ MR_Graph_EndVertices_replaceEnd()

MRC_API void MR_Graph_EndVertices_replaceEnd ( MR_Graph_EndVertices * _this,
MR_GraphVertId what,
MR_GraphVertId with )

Generated from method MR::Graph::EndVertices::replaceEnd. Parameter _this can not be null. It is a single object.

◆ MR_Graph_EndVertices_Set_v0()

MRC_API void MR_Graph_EndVertices_Set_v0 ( MR_Graph_EndVertices * _this,
MR_GraphVertId value )

Modifies a member variable of class MR::Graph::EndVertices named v0. Parameter _this can not be null. It is a single object. The reference to the parameter value might be preserved in this object in element v0. When this function is called, this object will drop object references it had previously in v0.

◆ MR_Graph_EndVertices_Set_v1()

MRC_API void MR_Graph_EndVertices_Set_v1 ( MR_Graph_EndVertices * _this,
MR_GraphVertId value )

Modifies a member variable of class MR::Graph::EndVertices named v1. Parameter _this can not be null. It is a single object. The reference to the parameter value might be preserved in this object in element v1. When this function is called, this object will drop object references it had previously in v1.

◆ MR_Graph_findEdge()

MRC_API MR_GraphEdgeId MR_Graph_findEdge ( const MR_Graph * _this,
MR_GraphVertId a,
MR_GraphVertId b )

finds and returns edge between vertices a and b; returns invalid edge otherwise Generated from method MR::Graph::findEdge. Parameter _this can not be null. It is a single object.

◆ MR_Graph_merge()

MRC_API void MR_Graph_merge ( MR_Graph * _this,
MR_GraphVertId remnant,
MR_GraphVertId dead,
MR_PassBy onMergeEdges_pass_by,
MR_std_function_void_from_MR_GraphEdgeId_MR_GraphEdgeId * onMergeEdges )

unites two vertices into one (deleting the second one), which leads to deletion and merge of some edges, for which callback is called Generated from method MR::Graph::merge. Parameter _this can not be null. It is a single object.

◆ MR_Graph_neighbours()

MRC_API const MR_std_vector_MR_GraphEdgeId * MR_Graph_neighbours ( const MR_Graph * _this,
MR_GraphVertId v )

returns all edges adjacent to given vertex Generated from method MR::Graph::neighbours. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Graph_OffsetMutablePtr()

MRC_API MR_Graph * MR_Graph_OffsetMutablePtr ( MR_Graph * ptr,
ptrdiff_t i )

Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element. The reference to the parameter ptr might be preserved in the return value.

◆ MR_Graph_OffsetPtr()

MRC_API const MR_Graph * MR_Graph_OffsetPtr ( const MR_Graph * ptr,
ptrdiff_t i )

Offsets a pointer to an array element by i positions (not bytes). Use only if you're certain that the pointer points to an array element. The reference to the parameter ptr might be preserved in the return value.

◆ MR_Graph_valid_MR_GraphEdgeId()

MRC_API bool MR_Graph_valid_MR_GraphEdgeId ( const MR_Graph * _this,
MR_GraphEdgeId e )

returns true if given edge is valid Generated from method MR::Graph::valid. Parameter _this can not be null. It is a single object.

◆ MR_Graph_valid_MR_GraphVertId()

MRC_API bool MR_Graph_valid_MR_GraphVertId ( const MR_Graph * _this,
MR_GraphVertId v )

returns true if given vertex is valid Generated from method MR::Graph::valid. Parameter _this can not be null. It is a single object.

◆ MR_Graph_validEdges()

MRC_API const MR_GraphEdgeBitSet * MR_Graph_validEdges ( const MR_Graph * _this)

returns all valid edges in the graph Generated from method MR::Graph::validEdges. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Graph_validVerts()

MRC_API const MR_GraphVertBitSet * MR_Graph_validVerts ( const MR_Graph * _this)

returns all valid vertices in the graph Generated from method MR::Graph::validVerts. Parameter _this can not be null. It is a single object. The returned pointer will never be null. It is non-owning, do NOT destroy it.

◆ MR_Graph_vertSize()

MRC_API MR_uint64_t MR_Graph_vertSize ( const MR_Graph * _this)

returns the number of vertex records, including invalid ones Generated from method MR::Graph::vertSize. Parameter _this can not be null. It is a single object.