#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 "bft_printf.h"
#include "fvm_writer.h"
#include "cs_post.h"
#include "fvm_nodal_append.h"
#include "fvm_neighborhood.h"
#include "cs_math.h"
#include "cs_mesh_headers.h"
#include "cs_order.h"
#include "cs_parall.h"
#include "cs_rotation.h"
#include "cs_stl.h"
Functions | |
cs_stl_mesh_t * | cs_stl_mesh_add (const char *name) |
Add a new STL mesh structure. More... | |
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. 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_mesh_transform (cs_stl_mesh_t *stl_mesh, double matrix[3][4]) |
Apply a transformation matrix to a STL mesh structure. More... | |
void | cs_stl_mesh_transform_from_init (cs_stl_mesh_t *stl_mesh, double matrix[3][4]) |
Apply a transformation matrix to a STL mesh structure, but use. More... | |
void | cs_stl_mesh_translate (cs_stl_mesh_t *stl_mesh, cs_real_t vector[3]) |
Apply a translation to a STL mesh structure. More... | |
void | cs_stl_mesh_rotate (cs_stl_mesh_t *stl_mesh, double theta, double axis[3], double center[3]) |
Apply a rotation to a STL mesh structure. More... | |
void | cs_stl_mesh_scale (cs_stl_mesh_t *stl_mesh, double scale) |
Apply a scaling to a STL mesh structure. More... | |
void | cs_stl_set_porosity_seed (cs_stl_mesh_t *stl_mesh, int n_points, cs_real_t *coords) |
Set the points outside he STL geometry. Those points will be used as. More... | |
int | cs_stl_post_get_writer_id (void) |
Return writer_id used for stl meshes. 0 means unused. More... | |
void | cs_stl_post_init_writer (const char *case_name, const char *dir_name, const char *fmt_name, const char *fmt_opts, fvm_writer_time_dep_t time_dep, bool output_at_start, bool output_at_end, int frequency_n, double frequency_t) |
Create a new writer that will contains the STL mesh added by the user. More... | |
void | cs_stl_post_add_mesh (cs_stl_mesh_t *stl_mesh) |
Associate a STL mesh to the default writer. 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... | |
void | cs_stl_intersection (cs_stl_mesh_t *stl_mesh, cs_lnum_t n_input, cs_lnum_t *input_idx, cs_lnum_t *n_selected_cells, cs_lnum_t *selected_cells, cs_lnum_t *tria_in_cell_idx, cs_lnum_t **tria_in_cell_lst, cs_lnum_t *max_size) |
Compute intersection between a STL mesh and the main mesh. More... | |
void | cs_stl_refine (cs_stl_mesh_t *stl_mesh, int n_ref, int n_add_layer) |
Refine the mesh following a given STL mesh. More... | |
void | cs_stl_compute_porosity (cs_stl_mesh_t *stl_mesh, cs_real_t *porosity, int *indic) |
Compute porosity field according to a given STL mesh. More... | |
void cs_stl_compute_porosity | ( | cs_stl_mesh_t * | stl_mesh, |
cs_real_t * | porosity, | ||
int * | indic | ||
) |
Compute porosity field according to a given STL mesh.
[in] | stl_mesh | pointer to the associated STL mesh structure |
[out] | porosity | interpolated porosity field |
[out] | indic | indicator of the STL location |
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:
[in] | path | path to the STL file |
[in] | stl_mesh | pointer to the associated STL mesh structure |
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.
[in] | stl_mesh | pointer to the associated STL mesh structure |
[in] | path | path to the STL file |
void cs_stl_intersection | ( | cs_stl_mesh_t * | stl_mesh, |
cs_lnum_t | n_input, | ||
cs_lnum_t * | input_idx, | ||
cs_lnum_t * | n_selected_cells, | ||
cs_lnum_t * | selected_cells, | ||
cs_lnum_t * | tria_in_cell_idx, | ||
cs_lnum_t ** | tria_in_cell_lst, | ||
cs_lnum_t * | max_size | ||
) |
Compute intersection between a STL mesh and the main mesh.
[in] | stl_mesh | pointer to the associated STL mesh structure |
[in] | n_input | number of cells on which intersection is done |
[in] | input_idx | index of input cells (size: input_idx) |
[out] | n_selected_cells | number of output intersecting cells |
[out] | selected_cells | index of output cells (size: output_idx) |
[out] | tria_in_cell_idx | start index of triangle intersecting each cell (size: n_output) |
[out] | tria_in_cell_lst | list of triangles in intersecting cells |
[in,out] | max_size | maximum size of tria_in_cell_lst array |
cs_stl_mesh_t * cs_stl_mesh_add | ( | const char * | name | ) |
Add a new STL mesh structure.
[in] | name | name of the STL mesh |
void cs_stl_mesh_destroy_all | ( | void | ) |
Free all allocated STL mesh structures.
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.
[in] | name | name of the STL mesh |
If no STL mesh of the given name is defined, nullptr is returned.
void cs_stl_mesh_rotate | ( | cs_stl_mesh_t * | stl_mesh, |
double | theta, | ||
double | axis[3], | ||
double | center[3] | ||
) |
Apply a rotation to a STL mesh structure.
[in] | stl_mesh | pointer to the associated STL mesh structure |
[in] | theta | rotation angle |
[in] | axis | rotation axis |
[in] | center | rotation center |
void cs_stl_mesh_scale | ( | cs_stl_mesh_t * | stl_mesh, |
double | scale | ||
) |
Apply a scaling to a STL mesh structure.
[in] | stl_mesh | pointer to the associated STL mesh structure |
[in] | vector | translation vector |
void cs_stl_mesh_transform | ( | cs_stl_mesh_t * | stl_mesh, |
double | matrix[3][4] | ||
) |
Apply a transformation matrix to a STL mesh structure.
[in] | stl_mesh | pointer to the associated STL mesh structure |
[in] | matrix | transformation matrix |
void cs_stl_mesh_transform_from_init | ( | cs_stl_mesh_t * | stl_mesh, |
double | matrix[3][4] | ||
) |
Apply a transformation matrix to a STL mesh structure, but use.
the initial coordinates as inputs
[in] | stl_mesh | pointer to the associated STL mesh structure |
[in] | matrix | transformation matrix |
void cs_stl_mesh_translate | ( | cs_stl_mesh_t * | stl_mesh, |
cs_real_t | vector[3] | ||
) |
Apply a translation to a STL mesh structure.
[in] | stl_mesh | pointer to the associated STL mesh structure |
[in] | vector | translation vector |
void cs_stl_post_add_mesh | ( | cs_stl_mesh_t * | stl_mesh | ) |
Associate a STL mesh to the default writer.
[in] | stl_mesh | pointer to the associated STL mesh structure |
int cs_stl_post_get_writer_id | ( | void | ) |
Return writer_id used for stl meshes. 0 means unused.
void cs_stl_post_init_writer | ( | const char * | case_name, |
const char * | dir_name, | ||
const char * | fmt_name, | ||
const char * | fmt_opts, | ||
fvm_writer_time_dep_t | time_dep, | ||
bool | output_at_start, | ||
bool | output_at_end, | ||
int | frequency_n, | ||
double | frequency_t | ||
) |
Create a new writer that will contains the STL mesh added by the user.
The writer_id is stored in the cs_glob_stl_meshes structure.
[in] | time_dep | > 1 if the writer is transient, else writer is fixed |
void cs_stl_refine | ( | cs_stl_mesh_t * | stl_mesh, |
int | n_ref, | ||
int | n_add_layer | ||
) |
Refine the mesh following a given STL mesh.
[in] | stl_mesh | pointer to the associated STL mesh structure |
[in] | n_ref | level of refinement |
[in] | n_add_layer | additional layers between two refinement stage |
void cs_stl_set_porosity_seed | ( | cs_stl_mesh_t * | stl_mesh, |
int | n_points, | ||
cs_real_t * | coords | ||
) |
Set the points outside he STL geometry. Those points will be used as.
seeds to propagate porosity values outside the STL geometry.
[in] | stl_mesh | pointer to the associated STL mesh structure |
[in] | n_points | number of points |
[in] | coords | coordinates (x1,y1,z1,...,xn,yn,zn) (size : 3*n_point) |