#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "bft_error.h"
#include "bft_mem.h"
#include "bft_printf.h"
#include "cs_block_dist.h"
#include "cs_math.h"
#include "cs_mesh.h"
#include "cs_mesh_builder.h"
#include "cs_mesh_cartesian.h"
Functions | |
static cs_mesh_cartesian_params_t * | _cs_mesh_cartesian_init (int ndir) |
Create the mesh parameters structure. More... | |
static _cs_mesh_cartesian_direction_t * | _cs_mesh_cartesian_create_direction (cs_mesh_cartesian_law_t law, int ncells, cs_real_t smin, cs_real_t smax, cs_real_t progression) |
Create parameters for a direction. More... | |
static void | _add_nx_face (cs_mesh_builder_t *mb, cs_lnum_t f_id, cs_gnum_t nx, cs_gnum_t ny, cs_gnum_t nz, cs_gnum_t i, cs_gnum_t j, cs_gnum_t k) |
Add a face with x-normal. More... | |
static void | _add_ny_face (cs_mesh_builder_t *mb, cs_lnum_t f_id, cs_gnum_t nx, cs_gnum_t ny, cs_gnum_t nz, cs_gnum_t i, cs_gnum_t j, cs_gnum_t k) |
Add a face with y-normal. More... | |
static void | _add_nz_face (cs_mesh_builder_t *mb, cs_lnum_t f_id, cs_gnum_t nx, cs_gnum_t ny, cs_gnum_t nz, cs_gnum_t i, cs_gnum_t j, cs_gnum_t k) |
Add a face with z-normal. More... | |
cs_mesh_cartesian_params_t * | cs_mesh_cartesian_get_params (void) |
Return pointer to cartesian mesh parameters structure. More... | |
void | cs_mesh_cartesian_create (void) |
Create cartesian mesh structure. More... | |
void | cs_mesh_cartesian_define_simple (int ncells[3], cs_real_t xyz[6]) |
Define a simple cartesian mesh with a constant step in all directions. More... | |
void | cs_mesh_cartesian_define_dir_user (int idir, int ncells, cs_real_t vtx_coord[]) |
Define directions parameters based on a user input. More... | |
void | cs_mesh_cartesian_define_dir_geom_by_part (int idir, int n_parts, const cs_real_t part_coords[], const cs_lnum_t n_part_cells[], const cs_real_t amp_factors[]) |
Define direction parameters based on a piecewise definition. Each part follows a geometric (or uniform) sequence. To get the uniform sequence, set the amplification factor to 1 in the wanted part. More... | |
void | cs_mesh_cartesian_define_from_csv (const char *csv_file_name) |
Define a simple cartesian mesh based on a CSV file. CSV file needs to contain : (1) First line which is empty or contains a header (2) Second line containing number of vertices per direction: format is 'nx;ny;nz' (3) Third line is empty or contains a header (4) Fourth line and onwards contains vertices coordinates for each direction. Format is "X1[i];X2[i];X3[i]" for index i. If current vertex index is beyond max value for a given direction, an empty value is expected. For example, if for index 'j' the first direction is empty, format is : ';X2[j];X3[j]'. More... | |
void | cs_mesh_cartesian_define_dir_params (int idim, cs_mesh_cartesian_law_t law, int ncells, cs_real_t smin, cs_real_t smax, cs_real_t progression) |
Define parameters for a given direction. More... | |
int | cs_mesh_cartesian_need_build (void) |
Indicate if a cartesian mesh is to be built. More... | |
int | cs_mesh_cartesian_get_ncells (int idim) |
Get number of cells in a given direction. More... | |
void | cs_mesh_cartesian_connectivity (cs_mesh_t *m, cs_mesh_builder_t *mb, long echo) |
Build unstructured connectivity needed for partitionning. More... | |
void | cs_mesh_cartesian_params_destroy (void) |
Destroy cartesian mesh parameters. More... | |
Variables | |
static int | _build_mesh_cartesian = 0 |
static cs_mesh_cartesian_params_t * | _mesh_params = NULL |
|
static |
Add a face with x-normal.
[in,out] | mb | pointer to cs_mesh_builder_t structure |
[in] | f_id | id of added face |
[in] | nx | number of cells in x direction |
[in] | ny | number of cells in x direction |
[in] | nz | number of cells in x direction |
[in] | i | i index (x) direction |
[in] | j | j index (x) direction |
[in] | k | k index (x) direction |
|
static |
Add a face with y-normal.
[in,out] | mb | pointer to cs_mesh_builder_t structure |
[in] | f_id | id of added face |
[in] | nx | number of cells in x direction |
[in] | ny | number of cells in x direction |
[in] | nz | number of cells in x direction |
[in] | i | i index (x) direction |
[in] | j | j index (x) direction |
[in] | k | k index (x) direction |
|
static |
Add a face with z-normal.
[in,out] | mb | pointer to cs_mesh_builder_t structure |
[in] | f_id | id of added face |
[in] | nx | number of cells in x direction |
[in] | ny | number of cells in x direction |
[in] | nz | number of cells in x direction |
[in] | i | i index (x) direction |
[in] | j | j index (x) direction |
[in] | k | k index (x) direction |
|
static |
Create parameters for a direction.
[in] | law | 1D discreization law : constant, geometric or parabolic |
[in] | ncells | Number of cells for this direction |
[in] | smin | Min coordinate value for this direction |
[in] | smax | Max coordinate value for this direction |
[in] | progression | Progression value, only used for geometric or parabolic laws. |
|
static |
Create the mesh parameters structure.
[in] | ndir | number of directions |
void cs_mesh_cartesian_connectivity | ( | cs_mesh_t * | m, |
cs_mesh_builder_t * | mb, | ||
long | echo | ||
) |
Build unstructured connectivity needed for partitionning.
[in] | m | pointer to cs_mesh_t structure |
[in] | mb | pointer to cs_mesh_builder_t structure |
[in] | echo | verbosity flag |
void cs_mesh_cartesian_create | ( | void | ) |
Create cartesian mesh structure.
void cs_mesh_cartesian_define_dir_geom_by_part | ( | int | idir, |
int | n_parts, | ||
const cs_real_t | part_coords[], | ||
const cs_lnum_t | n_part_cells[], | ||
const cs_real_t | amp_factors[] | ||
) |
Define direction parameters based on a piecewise definition. Each part follows a geometric (or uniform) sequence. To get the uniform sequence, set the amplification factor to 1 in the wanted part.
A direction is split in several parts. Each part contains a number of cells, its starting and ending position (stored in a compact way) inside part_coords, the amplification factor (f) between the first and last cell size of each part. Notice that if f = 1, this leads to a uniform refinement. If f > 1, (resp f < 1) this leads to a growing (resp. decreasing) geometric progression of the cell size when moving along the direction of increasing coordinates.
[in] | idir | Direction index. 0->X, 1->Y, 2->Z |
[in] | n_parts | Number of parts to define the direction |
[in] | part_coords | Position delimiting each part (size = n_parts + 1) |
[in] | n_part_cells | Number of cells in each part (size = n_parts) |
[in] | amp_factors | Amplification factor in each part (size = n_parts) |
void cs_mesh_cartesian_define_dir_params | ( | int | idim, |
cs_mesh_cartesian_law_t | law, | ||
int | ncells, | ||
cs_real_t | smin, | ||
cs_real_t | smax, | ||
cs_real_t | progression | ||
) |
Define parameters for a given direction.
[in] | idim | Geometrical direction: 0->X, 1->Y, 2->Z |
[in] | law | 1D discretization law: constant, geometric or parabolic |
[in] | ncells | Number of cells for this direction |
[in] | smin | Min coordinate value for this direction |
[in] | smax | Max coordinate value for this direction |
[in] | progression | Progression value, only used for geometric or parabolic laws. |
void cs_mesh_cartesian_define_dir_user | ( | int | idir, |
int | ncells, | ||
cs_real_t | vtx_coord[] | ||
) |
Define directions parameters based on a user input.
[in] | idir | Direction index. 0->X, 1->Y, 2->Z |
[in] | ncells | Number of cells for the direction |
[in] | vtx_coord | Array of size ncells+1 containing 1D coordinate values for vertices on the given direction |
void cs_mesh_cartesian_define_from_csv | ( | const char * | csv_file_name | ) |
Define a simple cartesian mesh based on a CSV file. CSV file needs to contain : (1) First line which is empty or contains a header (2) Second line containing number of vertices per direction: format is 'nx;ny;nz' (3) Third line is empty or contains a header (4) Fourth line and onwards contains vertices coordinates for each direction. Format is "X1[i];X2[i];X3[i]" for index i. If current vertex index is beyond max value for a given direction, an empty value is expected. For example, if for index 'j' the first direction is empty, format is : ';X2[j];X3[j]'.
[in] | csv_file_name | name of CSV file containing mesh information. |
void cs_mesh_cartesian_define_simple | ( | int | ncells[3], |
cs_real_t | xyz[6] | ||
) |
Define a simple cartesian mesh with a constant step in all directions.
[in] | ncells | Array of size 3 containing number of cells in each direction |
[in] | xyz | Array of size 6 containing min values, followed by max values for the three directions. |
int cs_mesh_cartesian_get_ncells | ( | int | idim | ) |
Get number of cells in a given direction.
[in] | idim | Index of direction: 0->X, 1->Y, 2->Z |
cs_mesh_cartesian_params_t* cs_mesh_cartesian_get_params | ( | void | ) |
Return pointer to cartesian mesh parameters structure.
int cs_mesh_cartesian_need_build | ( | void | ) |
Indicate if a cartesian mesh is to be built.
void cs_mesh_cartesian_params_destroy | ( | void | ) |
Destroy cartesian mesh parameters.
|
static |
|
static |