6.2
general documentation
cs_stl.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <errno.h>
#include <math.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "bft_mem.h"
#include "bft_error.h"
#include "fvm_nodal.h"
#include "fvm_nodal_append.h"
#include "cs_mesh_headers.h"
#include "cs_order.h"
#include "cs_parall.h"
#include "cs_math.h"
#include "cs_stl.h"
+ Include dependency graph for cs_stl.c:

Functions

cs_stl_mesh_tcs_stl_mesh_add (const char *name)
 Add a new STL mesh structure. More...
 
cs_stl_mesh_tcs_stl_mesh_get_by_name (const char *name)
 Return a pointer to a STL mesh based on its name if present. More...
 
void cs_stl_mesh_destroy_all (void)
 Free all allocated STL mesh structures. More...
 
void cs_stl_file_read (cs_stl_mesh_t *stl_mesh, const char *path)
 Read a binary STL file and store its content in a STL mesh structure. More...
 
void cs_stl_file_write (cs_stl_mesh_t *stl_mesh, const char *path)
 Write a binary STL file according to a given STL mesh structure. More...
 

Function Documentation

◆ cs_stl_file_read()

void cs_stl_file_read ( cs_stl_mesh_t stl_mesh,
const char *  path 
)

Read a binary STL file and store its content in a STL mesh structure.

Each STL file composed of the following header:

uint8[80] – Header uint32 – Number of triangles

followed by 50 byte blocks for each triangle:

  • real32[3] – Normal vector
  • real32[3] – Vertex 1 coordinates
  • real32[3] – Vertex 2 coordinates
  • real32[3] – Vertex 3 coordiantes
  • uint16 – Attribute (any other information, usually void)
Parameters
[in]pathpath to the STL file
[in]stl_meshpointer to the associated STL mesh structure

◆ cs_stl_file_write()

void cs_stl_file_write ( cs_stl_mesh_t stl_mesh,
const char *  path 
)

Write a binary STL file according to a given STL mesh structure.

Parameters
[in]stl_meshpointer to the associated STL mesh structure
[in]pathpath to the STL file

◆ cs_stl_mesh_add()

cs_stl_mesh_t* cs_stl_mesh_add ( const char *  name)

Add a new STL mesh structure.

Parameters
[in]namename of the STL mesh
Returns
pointer to the new STL mesh structure

◆ cs_stl_mesh_destroy_all()

void cs_stl_mesh_destroy_all ( void  )

Free all allocated STL mesh structures.

◆ cs_stl_mesh_get_by_name()

cs_stl_mesh_t* cs_stl_mesh_get_by_name ( const char *  name)

Return a pointer to a STL mesh based on its name if present.

Parameters
[in]namename of the STL mesh

If no STL mesh of the given name is defined, NULL is returned.

Returns
pointer to the STL mesh structure, or NULL