t8  1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
Data Structures | Typedefs | Functions
t8_geometry.h File Reference

Typedef for the t8_geometry class in order to be usable as a pointer from .c files. More...

#include <t8.h>
#include <t8_refcount.h>
#include <t8_cmesh.h>

Go to the source code of this file.

Data Structures

struct  t8_geometry_handler
 

Typedefs

typedef struct t8_geometry t8_geometry_c
 This typedef holds virtual functions for a particular geometry. More...
 
typedef struct t8_geometry_handler t8_geometry_handler_t
 

Functions

void t8_geom_handler_init (t8_geometry_handler_t **pgeom_handler)
 Initialize a geometry handler. More...
 
void t8_geom_handler_ref (t8_geometry_handler_t *geom_handler)
 Increase the reference counter of a geometry handler. More...
 
void t8_geom_handler_unref (t8_geometry_handler_t **pgeom_handler)
 Decrease the reference count of a geometry handler, if the refcount reaches 0, the handler will get destroyed. More...
 
void t8_geom_handler_destroy (t8_geometry_handler_t **pgeom_handler)
 Destroy a geometry handler and free its memory. More...
 
void t8_geom_handler_register_geometry (t8_geometry_handler_t *geom_handler, const t8_geometry_c *geometry)
 Add a geometry to the geometry handler. More...
 
void t8_geom_handler_commit (t8_geometry_handler_t *geom_handler)
 Commit a geometry handler. More...
 
int t8_geom_handler_is_committed (const t8_geometry_handler_t *geom_handler)
 
size_t t8_geom_handler_get_num_geometries (const t8_geometry_handler_t *geom_handler)
 Return the number of registered geometries. More...
 
const t8_geometry_ct8_geom_handler_get_unique_geometry (const t8_geometry_handler_t *geom_handler)
 If a geometry handler only has one registered geometry, get a pointer to this geometry. More...
 
t8_geometry_ct8_geom_handler_find_geometry (const t8_geometry_handler_t *geom_handler, const char *name)
 Given a geometry's name find that geometry in the geometry handler and return it. More...
 
void t8_geometry_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, double *out_coords)
 
void t8_geometry_jacobian (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, double *jacobian)
 

Detailed Description

Typedef for the t8_geometry class in order to be usable as a pointer from .c files.

Typedef Documentation

◆ t8_geometry_c

typedef struct t8_geometry t8_geometry_c

This typedef holds virtual functions for a particular geometry.

We need it so that we can use t8_geometry_c pointers in .c files without them seeing the actual C++ code (and then not compiling)

Function Documentation

◆ t8_geom_handler_commit()

void t8_geom_handler_commit ( t8_geometry_handler_t geom_handler)

Commit a geometry handler.

This specifies that no geometries will be added to it and makes it ready to be used.

Parameters
[in,out]geom_handlerAn initialized but not committed geometry handler.

◆ t8_geom_handler_destroy()

void t8_geom_handler_destroy ( t8_geometry_handler_t **  pgeom_handler)

Destroy a geometry handler and free its memory.

This is only valid if its reference count is 1. If you are unsure, call t8_geom_handler_unref instead.

Parameters
[in,out]pgeom_handlerPointer to an initialized geometry handler. Will point to NULL afterwards.

◆ t8_geom_handler_find_geometry()

t8_geometry_c* t8_geom_handler_find_geometry ( const t8_geometry_handler_t geom_handler,
const char *  name 
)

Given a geometry's name find that geometry in the geometry handler and return it.

Parameters
[in]geom_handlerA committed geometry handler.
[in]nameThe name of a geometry.
Returns
A pointer to the geomery or NULL if it was not found.

◆ t8_geom_handler_get_num_geometries()

size_t t8_geom_handler_get_num_geometries ( const t8_geometry_handler_t geom_handler)

Return the number of registered geometries.

Parameters
[in]geom_handlerA geometry handler (must be initialized and may or may not be committed).
Returns
The number of registered geometries in geom_handler.

◆ t8_geom_handler_get_unique_geometry()

const t8_geometry_c* t8_geom_handler_get_unique_geometry ( const t8_geometry_handler_t geom_handler)

If a geometry handler only has one registered geometry, get a pointer to this geometry.

Parameters
[in]geom_handlerMust be committed and have exactly one geometry registered.
Returns
The only registered geometry of geom_handler.
Note
Most cmeshes will have only one geometry and this function is an optimization for that special case. It is used for example in t8_cmesh_get_tree_geometry.

◆ t8_geom_handler_init()

void t8_geom_handler_init ( t8_geometry_handler_t **  pgeom_handler)

Initialize a geometry handler.

This will allocate memory.

Parameters
[in,out]pgeom_handlerOn input a pointer to unallocated memory. On output this will point to an initialized geometry handler.

◆ t8_geom_handler_ref()

void t8_geom_handler_ref ( t8_geometry_handler_t geom_handler)

Increase the reference counter of a geometry handler.

Parameters
[in]geom_handlerAn initialized geometry handler.

◆ t8_geom_handler_register_geometry()

void t8_geom_handler_register_geometry ( t8_geometry_handler_t geom_handler,
const t8_geometry_c geometry 
)

Add a geometry to the geometry handler.

Parameters
[in,out]geom_handlerAn initialized but not committed geometry handler.
[in]geometryThe geometry to add.

◆ t8_geom_handler_unref()

void t8_geom_handler_unref ( t8_geometry_handler_t **  pgeom_handler)

Decrease the reference count of a geometry handler, if the refcount reaches 0, the handler will get destroyed.

Parameters
[in,out]pgeom_handlerPointer to an initialized geometry handler. If the refcount reaches 0, will point to NULL afterwards.