Alsvinn  0.5.3
The fast FVM simulator with UQ support
Public Member Functions | List of all members
alsfvm::io::DLLWriter Class Reference

#include <alsfvm/io/DLLWriter.hpp>

Inheritance diagram for alsfvm::io::DLLWriter:
alsfvm::io::Writer

Public Member Functions

 DLLWriter (const std::string &basename, const Parameters &parameters, alsutils::mpi::ConfigurationPtr mpiConfigration=nullptr)
 
virtual void write (const volume::Volume &conservedVariables, const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation)
 write writes the data to disk More...
 
virtual void finalize (const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation)
 This method should be called at the end of the simulation. More...
 
- Public Member Functions inherited from alsfvm::io::Writer
virtual ~Writer ()
 
void addAttributes (const std::string &nameOfAttributes, const boost::property_tree::ptree &attributes)
 

Additional Inherited Members

- Static Public Member Functions inherited from alsfvm::io::Writer
static std::string getClassName ()
 
- Protected Attributes inherited from alsfvm::io::Writer
std::map< std::string, boost::property_tree::ptree > attributesMap
 

Detailed Description

The DLLWriter forwards the volume to an external DLL, loaded via boost::dll

The parameters you need to supply are

parameter name description
library

filename of dll

create_function

name of the create/init function, should have the following signature

void* create_function(const char* simulator_name, const char* simulator_version, void* parameters);

use NONE if it is not supplied

delete_function

the function to delete any data created, if create_function is NONE, this is ignored assumes signature

void delete_function(void* data);

write_function

the name of the write function assumes signature

void write_function(void* data, void* parameters, real time, const char* variable_name, const real* variable_data, int nx, int ny, int nz, int ngx, int ngy, int ngz, real ax, real ay, real az, real bx, real by, real bz, int gpu_number );

where gpu_number is the gpu id where the data lives (-1 if the data is on the CPU).

The domain is $[ax, bx] \times [ay, by] \times [az, bz]$ discretized into nx, ny, and nx cells, with an ADDITIONAL ngx, ngy and ngz ghost cells in each direction and side.

The total number of cells is $(nx+2*ngx)*(ny+2*ngy)*(nz+2*ngz)$

make_parameters_function

Name of the function to create the parameter struct assumes the signature

void* make_parameters_function();

delete_parameters_function

name of the function to delete the parameter struct assumes the signature

void delete_parameters_function(void* parameters);

needs_data_on_host_function

should the data be on host? If this function returns true, alsvinn will first copy the data to host before calling the write function

bool needs_data_on_host_function(void* data, void* parameters);

can be NONE, then it is assumed this function returns false.

set_parameter_function

set the parameter, assumes the signature

void set_parameter_function(void* parameters, const char* key, const char* value);

set_mpi_comm_function

set mpi communicator, assumes the signature

void set_mpi_comm_function(void* data, void* parameters, MPI_Comm communicator);

can be set to NONE

new_timestep_function called when at the beginning of a new timestep to be written
void new_timestep_function(void* data, void* parameters, real time, int timestep_number);
end_timestep_function called when at the end of a new timestep after all variables have been written
void end_timestep_function(void* data, void* parameters, real time, int timestep_number);

Constructor & Destructor Documentation

◆ DLLWriter()

alsfvm::io::DLLWriter::DLLWriter ( const std::string &  basename,
const Parameters parameters,
alsutils::mpi::ConfigurationPtr  mpiConfigration = nullptr 
)

Member Function Documentation

◆ finalize()

void alsfvm::io::DLLWriter::finalize ( const grid::Grid grid,
const simulator::TimestepInformation timestepInformation 
)
virtual

This method should be called at the end of the simulation.

Reimplemented from alsfvm::io::Writer.

◆ write()

void alsfvm::io::DLLWriter::write ( const volume::Volume conservedVariables,
const grid::Grid grid,
const simulator::TimestepInformation timestepInformation 
)
virtual

write writes the data to disk

Parameters
conservedVariablesthe conservedVariables to write
gridthe grid that is used (describes the whole domain)
timestepInformation

Implements alsfvm::io::Writer.


The documentation for this class was generated from the following files: