Monte Carlo eXtreme (MCX)
Classes | Macros | Typedefs | Functions
mcx_shapes.h File Reference

MCX shape JSON parser header. More...

#include <vector_types.h>
Include dependency graph for mcx_shapes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GridSpace
 3D voxelated space with which the shape constructs are rasterized More...
 

Macros

#define MAX_SHAPE_ERR   256
 

Typedefs

typedef struct GridSpace Grid3D
 

Functions

int mcx_load_jsonshapes (Grid3D *g, char *fname)
 Load a JSON-formatted shape file and process. More...
 
int mcx_parse_jsonshapes (cJSON *root, Grid3D *g)
 Parse a JSON-formatted shape file and rasterize the objects to the volume. More...
 
int mcx_parse_shapestring (Grid3D *g, char *shapedata)
 Load JSON-formatted shape definitions from a string. More...
 
int mcx_raster_origin (cJSON *obj, Grid3D *g)
 Reset the origin of the domain, default is [0,0,0]. More...
 
int mcx_raster_sphere (cJSON *obj, Grid3D *g)
 Rasterize a 3D sphere and add to the volume. More...
 
int mcx_raster_subgrid (cJSON *obj, Grid3D *g)
 Rasterize a 3D rectangular region and add to the volume. More...
 
int mcx_raster_box (cJSON *obj, Grid3D *g)
 Rasterize a 3D rectangular region and add to the volume. More...
 
int mcx_raster_cylinder (cJSON *obj, Grid3D *g)
 Rasterize a finite 3D cylindrical region and add to the volume. More...
 
int mcx_raster_slabs (cJSON *obj, Grid3D *g)
 Rasterize a 3D layered-slab structure and add to the volume. More...
 
int mcx_raster_layers (cJSON *obj, Grid3D *g)
 Rasterize a 3D layer structure and add to the volume. More...
 
int mcx_raster_upperspace (cJSON *obj, Grid3D *g)
 Rasterize a 3D semi-space region and add to the volume. More...
 
int mcx_raster_grid (cJSON *obj, Grid3D *g)
 Recreate the background grid with a different dimension or medium. More...
 
int mcx_find_shapeid (char *shapename)
 Look up the JSON object tag and return the index to the processing function. More...
 
char * mcx_last_shapeerror ()
 return the last error message encountered in the processing
 

Detailed Description

MCX shape JSON parser header.

Function Documentation

◆ mcx_find_shapeid()

int mcx_find_shapeid ( char *  shapename)

Look up the JSON object tag and return the index to the processing function.

Parameters
shapenameThe string of the JSON shape object

◆ mcx_load_jsonshapes()

int mcx_load_jsonshapes ( Grid3D g,
char *  fname 
)

Load a JSON-formatted shape file and process.

Parameters
gA structure pointing to the volume and dimension data
fnameThe file name string to the JSON shape file

◆ mcx_parse_jsonshapes()

int mcx_parse_jsonshapes ( cJSON *  root,
Grid3D g 
)

Parse a JSON-formatted shape file and rasterize the objects to the volume.

Parameters
rootA cJSON pointer points to the root obj of the shape block
gA structure pointing to the volume and dimension data
Here is the call graph for this function:

◆ mcx_parse_shapestring()

int mcx_parse_shapestring ( Grid3D g,
char *  shapedata 
)

Load JSON-formatted shape definitions from a string.

Parameters
gA structure pointing to the volume and dimension data
shapedataA string containg the JSON shape data
Here is the call graph for this function:

◆ mcx_raster_box()

int mcx_raster_box ( cJSON *  obj,
Grid3D g 
)

Rasterize a 3D rectangular region and add to the volume.

Parameters
objA cJSON pointer points to the rectangular obj block
gA structure pointing to the volume and dimension data

◆ mcx_raster_cylinder()

int mcx_raster_cylinder ( cJSON *  obj,
Grid3D g 
)

Rasterize a finite 3D cylindrical region and add to the volume.

Parameters
objA cJSON pointer points to the cylindrical obj block
gA structure pointing to the volume and dimension data

◆ mcx_raster_grid()

int mcx_raster_grid ( cJSON *  obj,
Grid3D g 
)

Recreate the background grid with a different dimension or medium.

Parameters
objA cJSON pointer points to the background grid block
gA structure pointing to the volume and dimension data

◆ mcx_raster_layers()

int mcx_raster_layers ( cJSON *  obj,
Grid3D g 
)

Rasterize a 3D layer structure and add to the volume.

Parameters
objA cJSON pointer points to the layer structure block
gA structure pointing to the volume and dimension data

◆ mcx_raster_origin()

int mcx_raster_origin ( cJSON *  obj,
Grid3D g 
)

Reset the origin of the domain, default is [0,0,0].

Parameters
objA cJSON pointer points to the Origin obj block
gA structure pointing to the volume and dimension data

◆ mcx_raster_slabs()

int mcx_raster_slabs ( cJSON *  obj,
Grid3D g 
)

Rasterize a 3D layered-slab structure and add to the volume.

Parameters
objA cJSON pointer points to the layered-slab structure block
gA structure pointing to the volume and dimension data

◆ mcx_raster_sphere()

int mcx_raster_sphere ( cJSON *  obj,
Grid3D g 
)

Rasterize a 3D sphere and add to the volume.

Parameters
objA cJSON pointer points to the sphere obj block
gA structure pointing to the volume and dimension data

◆ mcx_raster_subgrid()

int mcx_raster_subgrid ( cJSON *  obj,
Grid3D g 
)

Rasterize a 3D rectangular region and add to the volume.

Parameters
objA cJSON pointer points to the rectangular obj block
gA structure pointing to the volume and dimension data

◆ mcx_raster_upperspace()

int mcx_raster_upperspace ( cJSON *  obj,
Grid3D g 
)

Rasterize a 3D semi-space region and add to the volume.

Parameters
objA cJSON pointer points to the semi-space object block
gA structure pointing to the volume and dimension data