#ifndef __FVM_TO_MED_H__
#define __FVM_TO_MED_H__
#if defined(HAVE_MED)
/*============================================================================
* Write a nodal representation associated with a mesh and associated
* variables to MED files
*============================================================================*/
/*
This file is part of the "Finite Volume Mesh" library, intended to provide
finite volume mesh and associated fields I/O and manipulation services.
Copyright (C) 2004-2006 EDF
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*----------------------------------------------------------------------------
* Local headers
*----------------------------------------------------------------------------*/
#include <fvm_defs.h>
#include <fvm_nodal.h>
#include <fvm_writer.h>
/*----------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#if 0
} /* Fake brace to force back Emacs auto-indentation back to column 0 */
#endif
#endif /* __cplusplus */
/*=============================================================================
* Macro definitions
*============================================================================*/
/*============================================================================
* Type definitions
*============================================================================*/
/*=============================================================================
* Public function prototypes
*============================================================================*/
/*----------------------------------------------------------------------------
* Initialize FVM to MED file writer.
*
* Options are:
* discard_polygons do not output polygons or related values
* discard_polyhedra do not output polyhedra or related values
* divide_polygons tesselate polygons with triangles
* divide_polyhedra tesselate polyhedra with tetrahedra and pyramids
* (adding a vertex near each polyhedron's center)
*
* parameters:
* name <-- base output case name.
* options <-- whitespace separated, lowercase options list
* time_dependecy <-- indicates if and how meshes will change with time
* comm <-- associated MPI communicator.
*
* returns:
* pointer to opaque MED writer structure.
*----------------------------------------------------------------------------*/
#if defined(FVM_HAVE_MPI)
void *
fvm_to_med_init_writer(const char *const name,
const char *const path,
const char *const options,
const fvm_writer_time_dep_t time_dependency,
const MPI_Comm comm);
#else
void *
fvm_to_med_init_writer(const char *const name,
const char *const path,
const char *const options,
const fvm_writer_time_dep_t time_dependency);
#endif
/*----------------------------------------------------------------------------
* Finalize FVM to MED file writer.
*
* parameters:
* this_writer_p <-- pointer to opaque MED writer structure.
*
* returns:
* NULL pointer.
*----------------------------------------------------------------------------*/
void *
fvm_to_med_finalize_writer(void *this_writer_p);
/*----------------------------------------------------------------------------
* Indicate if a elements of a given type in a mesh associated to a given
* MED file writer need to be tesselated.
*
* parameters:
* this_writer <-- pointer to associated writer
* mesh <-- pointer to nodal mesh structure that should be written
* element_type <-- element type we are interested in
*
* returns:
* 1 if tesselation of the given element type is needed, 0 otherwise
*----------------------------------------------------------------------------*/
int
fvm_to_med_needs_tesselation(fvm_writer_t *this_writer,
const fvm_nodal_t *mesh,
fvm_element_t element_type);
/*----------------------------------------------------------------------------
* Associate new time step with a MED mesh.
*
* parameters:
* this_writer <-- pointer to associated writer
* time_step <-- time step number
* time_value <-- time_value number
*----------------------------------------------------------------------------*/
void
fvm_to_med_set_mesh_time(void *const this_writer,
const int time_step,
const double time_value);
/*----------------------------------------------------------------------------
* Write nodal mesh to a MED file
*
* parameters:
* this_writer_p <-- pointer to associated writer.
* mesh <-- pointer to nodal mesh structure that should be written.
*----------------------------------------------------------------------------*/
void
fvm_to_med_export_nodal(void *const this_writer_p,
const fvm_nodal_t *const mesh);
/*----------------------------------------------------------------------------
* Write field associated with a nodal mesh to a MED file.
*
* Assigning a negative value to the time step indicates a time-independent
* field (in which case the time_value argument is unused).
*
* parameters:
* this_writer_p <-- pointer to associated writer
* mesh <-- pointer to associated nodal mesh structure
* name <-- variable name
* location <-- variable definition location (nodes or elements)
* dimension <-- variable dimension (0: constant, 1: scalar,
* 3: vector, 6: sym. tensor, 9: asym. tensor)
* interlace <-- indicates if variable in memory is interlaced
* n_parent_lists <-- indicates if variable values are to be obtained
* directly through the local entity index (when 0) or
* through the parent entity numbers (when 1 or more)
* parent_num_shift <-- parent number to value array index shifts;
* size: n_parent_lists
* datatype <-- indicates the data type of (source) field values
* time_step <-- number of the current time step
* time_value <-- associated time value
* field_values <-- array of associated field value arrays
*----------------------------------------------------------------------------*/
void
fvm_to_med_export_field(void *const this_writer,
const fvm_nodal_t *const mesh,
const char *const name,
const fvm_writer_var_loc_t location,
const int dimension,
const fvm_interlace_t interlace,
const int n_parent_lists,
const fvm_lnum_t parent_num_shift[],
const fvm_datatype_t datatype,
const int time_step,
const double time_value,
const void *const field_values[]);
/*----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __FVM_TO_MED_H__ */
#endif /* HAVE_MED */
syntax highlighted by Code2HTML, v. 0.9.1