8.1
general documentation
cs_paramedmem_remapper.cxx File Reference
#include "cs_defs.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <mpi.h>
#include "bft_error.h"
#include "bft_mem.h"
#include "bft_printf.h"
#include "cs_mesh.h"
#include "cs_mesh_connect.h"
#include "cs_parall.h"
#include "cs_prototypes.h"
#include "cs_selector.h"
#include "cs_timer.h"
#include "fvm_defs.h"
#include "fvm_nodal_from_desc.h"
#include "cs_medcoupling_mesh.hxx"
#include "cs_paramedmem_remapper.h"
#include <MEDLoader.hxx>
#include <MEDCoupling_version.h>
#include <MEDFileField.hxx>
#include <MEDFileFieldMultiTS.hxx>
#include <MEDFileMesh.hxx>
#include <MEDCouplingUMesh.hxx>
#include <MEDCouplingField.hxx>
#include <MEDCouplingFieldDouble.hxx>
#include <ParaFIELD.hxx>
#include <ParaMESH.hxx>
#include <OverlapDEC.hxx>
#include <ParaMEDFileMesh.hxx>
+ Include dependency graph for cs_paramedmem_remapper.cxx:

Functions

static _mesh_transformation_t * _cs_paramedmem_create_transformation (int type, const cs_real_t center[3], const cs_real_t vector[3], const cs_real_t angle)
 Create a mesh transformation (rotation or translation) More...
 
static void _cs_paramedmem_reset_transformations (void)
 Reset all mesh transformations. More...
 
static void _cs_paramedmem_apply_transformations (MEDCouplingFieldDouble *field, cs_paramedmem_remapper_t *r)
 Apply the different mesh transformations and update the bounding sphere. More...
 
static int * _cs_paramedmem_get_mpi_comm_world_ranks (void)
 Returns an array containing the ranks of code_saturne processes in MPI_COMM_WORLD. More...
 
static cs_paramedmem_remapper_t * _cs_paramedmem_overlap_create (const char *name)
 Create the parallel remapper structure based on ParaMEDMEM OverlapDEC. More...
 
static void _cs_paramedmem_remapper_target_mesh (cs_paramedmem_remapper_t *r, const char *name, const char *select_criteria)
 Set the target mesh for interpolation. More...
 
static void _cs_paramedmem_load_paramesh (cs_paramedmem_remapper_t *r, char *file_name, char *mesh_name)
 Load the mesh parts on each process. More...
 
static void _cs_paramedmem_remapper_destroy (cs_paramedmem_remapper_t *r)
 Destroy a remapper. More...
 
cs_paramedmem_remapper_t * cs_paramedmem_remapper_create (char *name, const char *sel_criteria, char *file_name, char *mesh_name, cs_real_t center[3], cs_real_t radius)
 Creates a new cs_paramedmem_remapper_t instance. More...
 
cs_paramedmem_remapper_t * cs_paramedmem_remapper_by_name_try (const char *name)
 get a remapper by its name More...
 
cs_real_tcs_paramedmem_remap_field_one_time (cs_paramedmem_remapper_t *r, char *field_name, cs_real_t default_val, int dt, int it)
 Remaps a field from the med file to the local mesh for a given time. More...
 
cs_real_tcs_paramedmem_remap_field (cs_paramedmem_remapper_t *r, char *field_name, cs_real_t default_val, int time_choice, double tval)
 Interpolate a given field on the local mesh for a given time. More...
 
void cs_paramedmem_remapper_translate (cs_paramedmem_remapper_t *r, cs_real_t translation[3])
 translate the mesh using a given vector More...
 
void cs_paramedmem_remapper_rotate (cs_paramedmem_remapper_t *r, cs_real_t invariant[3], cs_real_t axis[3], cs_real_t angle)
 Rotate the mesh using a center point, axis and angle. More...
 
void cs_paramedmem_remapper_destroy_all (void)
 Destroy all remappers. More...
 

Variables

static int _n_remappers = 0
 
static cs_paramedmem_remapper_t ** _remapper = NULL
 
static int _n_transformations = 0
 
static _mesh_transformation_t ** _transformations = NULL
 
static bool _transformations_applied = false
 

Function Documentation

◆ _cs_paramedmem_apply_transformations()

static void _cs_paramedmem_apply_transformations ( MEDCouplingFieldDouble *  field,
cs_paramedmem_remapper_t *  r 
)
static

Apply the different mesh transformations and update the bounding sphere.

◆ _cs_paramedmem_create_transformation()

static _mesh_transformation_t* _cs_paramedmem_create_transformation ( int  type,
const cs_real_t  center[3],
const cs_real_t  vector[3],
const cs_real_t  angle 
)
static

Create a mesh transformation (rotation or translation)

Returns
a mesh_transformation pointer

◆ _cs_paramedmem_get_mpi_comm_world_ranks()

static int* _cs_paramedmem_get_mpi_comm_world_ranks ( void  )
static

Returns an array containing the ranks of code_saturne processes in MPI_COMM_WORLD.

Returns
array of ranks in MPI_COMM_WORLD

◆ _cs_paramedmem_load_paramesh()

static void _cs_paramedmem_load_paramesh ( cs_paramedmem_remapper_t *  r,
char *  file_name,
char *  mesh_name 
)
static

Load the mesh parts on each process.

Parameters
[in]rpointer to cs_paramedmem_remapper_t struct
[in]file_namename of med file containing the data
[in]mesh_namename of the mesh to read in the med file

◆ _cs_paramedmem_overlap_create()

static cs_paramedmem_remapper_t* _cs_paramedmem_overlap_create ( const char *  name)
static

Create the parallel remapper structure based on ParaMEDMEM OverlapDEC.

Parameters
[in]namename of the remapper
Returns
pointer to cs_paramedmem_remapper_t struct

◆ _cs_paramedmem_remapper_destroy()

static void _cs_paramedmem_remapper_destroy ( cs_paramedmem_remapper_t *  r)
static

Destroy a remapper.

Parameters
[in]rremapper to destroy

◆ _cs_paramedmem_remapper_target_mesh()

static void _cs_paramedmem_remapper_target_mesh ( cs_paramedmem_remapper_t *  r,
const char *  name,
const char *  select_criteria 
)
static

Set the target mesh for interpolation.

Parameters
[in]rpointer to cs_paramedmem_remapper_t struct
[in]namemesh name
[in]select_criteriaselection criteria for needed cells

◆ _cs_paramedmem_reset_transformations()

static void _cs_paramedmem_reset_transformations ( void  )
static

Reset all mesh transformations.

◆ cs_paramedmem_remap_field()

cs_real_t* cs_paramedmem_remap_field ( cs_paramedmem_remapper_t *  r,
char *  field_name,
cs_real_t  default_val,
int  time_choice,
double  tval 
)

Interpolate a given field on the local mesh for a given time.

Parameters
[in]rpointer to cs_paramedmem_remapper_t struct
[in]field_namename of the field to remap from the file
[in]default_valdefault value for unmapped elements
[in]time_choiceChoice of the time interpolation. 0: Value of field interpolated at t=tval from the med file. 1: Returns field values for the first time step in the file. tval is then ignored. 2: Returns field values for the last time step in the file. tval is then ignored.
[in]tvalrequested time instant. If time choice is 0 and tval outside of the file time bounds, return value will be at the the first time step (if tval < tmin) or last time step (if tval > tmax)
Returns
cs_real_t pointer containing the new values on target mesh

◆ cs_paramedmem_remap_field_one_time()

cs_real_t* cs_paramedmem_remap_field_one_time ( cs_paramedmem_remapper_t *  r,
char *  field_name,
cs_real_t  default_val,
int  dt,
int  it 
)

Remaps a field from the med file to the local mesh for a given time.

Parameters
[in]rpointer to cs_paramedmem_remapper_t struct
[in]field_namename of the field to remap from the file
[in]default_valdefault value for unmapped elements
[in]dttime value to use from the file
[in]ittime iteration to use from the file
Returns
cs_real_t pointer containing the new values on target mesh

◆ cs_paramedmem_remapper_by_name_try()

cs_paramedmem_remapper_t* cs_paramedmem_remapper_by_name_try ( const char *  name)

get a remapper by its name

Parameters
[in]namename of the remapper
Returns
pointer to cs_paramedmem_remapper_t struct

◆ cs_paramedmem_remapper_create()

cs_paramedmem_remapper_t* cs_paramedmem_remapper_create ( char *  name,
const char *  sel_criteria,
char *  file_name,
char *  mesh_name,
cs_real_t  center[3],
cs_real_t  radius 
)

Creates a new cs_paramedmem_remapper_t instance.

Parameters
[in]namename of the remapper
[in]sel_criteriacells selection criteria
[in]file_namemed file name
[in]mesh_namename of the mesh in the med file
[in]centercenter of bounding sphere
[in]radiusradius of bounding sphere
Returns
cs_paramedmem_remapper_t struct

◆ cs_paramedmem_remapper_destroy_all()

void cs_paramedmem_remapper_destroy_all ( void  )

Destroy all remappers.

◆ cs_paramedmem_remapper_rotate()

void cs_paramedmem_remapper_rotate ( cs_paramedmem_remapper_t *  r,
cs_real_t  invariant[3],
cs_real_t  axis[3],
cs_real_t  angle 
)

Rotate the mesh using a center point, axis and angle.

Parameters
[in]rpointer to the cs_paramedmem_remapper_t struct
[in]invariantcoordinates of the invariant point
[in]axisrotation axis vector
[in]anglerotation angle in radians

◆ cs_paramedmem_remapper_translate()

void cs_paramedmem_remapper_translate ( cs_paramedmem_remapper_t *  r,
cs_real_t  translation[3] 
)

translate the mesh using a given vector

Parameters
[in]rpointer to the cs_paramedmem_remapper_t struct
[in]translationtranslation vector

Variable Documentation

◆ _n_remappers

int _n_remappers = 0
static

◆ _n_transformations

int _n_transformations = 0
static

◆ _remapper

cs_paramedmem_remapper_t** _remapper = NULL
static

◆ _transformations

_mesh_transformation_t** _transformations = NULL
static

◆ _transformations_applied

bool _transformations_applied = false
static