IFEM  90A354
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
DataExporter Class Reference

Administer and write data using DataWriters. More...

#include <DataExporter.h>

Inheritance diagram for DataExporter:
Inheritance graph
[legend]
Collaboration diagram for DataExporter:
Collaboration graph
[legend]

Classes

struct  FileEntry
 A structure holding information about registered fields. More...
 

Public Types

enum  FieldType {
  VECTOR , INTVECTOR , KNOTSPAN , SIM ,
  NODALFORCES , BASIS
}
 Supported field types.
 
enum  Results {
  PRIMARY = 1 , DISPLACEMENT = 2 , SECONDARY = 4 , NORMS = 8 ,
  EIGENMODES = 16 , ONCE = 32 , GRID = 128 , REDUNDANT = 256 ,
  L2G_NODE = 512 , ELEMENT_MASK = 1024
}
 An enum used to describe the results to write from a SIM. More...
 

Public Member Functions

 DataExporter (bool dynWriters=false, int ndump=1, int level0=0)
 Default constructor. More...
 
virtual ~DataExporter ()
 The destructor deletes the writers if dynWriters was true.
 
void registerWriter (DataWriter *writer)
 Adds the data writer to the list of registered writers.
 
bool registerField (const std::string &name, const std::string &description, FieldType field, int results=PRIMARY, const std::string &prefix="", int ncmps=0)
 Registers an entry for storage. More...
 
bool setFieldValue (const std::string &name, const void *data, const void *data2=nullptr, const void *data3=nullptr, const void *data4=nullptr)
 Sets the data values for a registered field. More...
 
bool dumpTimeLevel (const TimeStep *tp=nullptr, bool geoUpd=false, bool doLog=false)
 Dumps all registered fields using the registered writers. More...
 
virtual void OnControl (const tinyxml2::XMLElement *context)
 Callback on receiving a XML control block from external controller.
 
virtual std::string GetContext () const
 Returns context name for callback for external controller.
 
std::string getName () const
 Returns name from (first) data writer.
 
int getTimeLevel () const
 Returns current time level of the exporter.
 
int getStride () const
 Returns the data dump stride.
 

Protected Attributes

std::map< std::string, FileEntrym_entry
 A map of field names -> field info structures.
 
std::vector< DataWriter * > m_writers
 A vector of registered data writers.
 
bool m_delete
 If true, we are in charge of freeing up datawriters.
 
int m_ndump
 Time level stride for dumping.
 
int m_level
 Current time level.
 
int m_last_step
 Last time step we dumped for.
 

Detailed Description

Administer and write data using DataWriters.

This class holds a list of data writers, and the SIM classes or vectors to write.

Member Enumeration Documentation

◆ Results

An enum used to describe the results to write from a SIM.

Enumerator
PRIMARY 

Storage of primary solutions.

DISPLACEMENT 

Storage of vector fields as displacements.

SECONDARY 

Storage of secondary field.

NORMS 

Storage of norms.

EIGENMODES 

Storage of eigenmodes.

ONCE 

Only write field once.

GRID 

Always store an updated grid.

REDUNDANT 

Field is redundantly calculated on all processes.

L2G_NODE 

Storage of local-to-global node mapping.

ELEMENT_MASK 

Storage of element activation flags.

Constructor & Destructor Documentation

◆ DataExporter()

DataExporter::DataExporter ( bool  dynWriters = false,
int  ndump = 1,
int  level0 = 0 
)
inline

Default constructor.

Parameters
[in]dynWritersIf true, delete the writers on destruction
[in]ndumpInterval between dumps
[in]level0Time level to start dumping from (in case of restart)

Member Function Documentation

◆ dumpTimeLevel()

bool DataExporter::dumpTimeLevel ( const TimeStep tp = nullptr,
bool  geoUpd = false,
bool  doLog = false 
)

Dumps all registered fields using the registered writers.

Parameters
[in]tpCurrent time stepping info
[in]geoUpdIf true, write updated geometry as well
[in]doLogIf true, write a log message when dumping data

References IFEM::cout, m_entry, m_last_step, m_level, m_ndump, m_writers, TimeStep::multiSteps(), ONCE, PROFILE1, TimeStep::step, TimeDomain::t, and TimeStep::time.

Referenced by SIMSolver< T1 >::saveState(), SIMSolverAdapInternal< T1 >::saveState(), and SIMSolverStat< T1 >::solveProblem().

◆ registerField()

bool DataExporter::registerField ( const std::string &  name,
const std::string &  description,
FieldType  field,
int  results = PRIMARY,
const std::string &  prefix = "",
int  ncmps = 0 
)

Registers an entry for storage.

Parameters
[in]nameName of entry
[in]descriptionDescription of entry
[in]fieldType of entry
[in]resultsWhich results to store
[in]prefixField name prefix
[in]ncmpsNumber of field components

References DataExporter::FileEntry::description, DataExporter::FileEntry::enabled, DataExporter::FileEntry::field, m_entry, DataExporter::FileEntry::ncmps, DataExporter::FileEntry::prefix, and DataExporter::FileEntry::results.

◆ setFieldValue()

bool DataExporter::setFieldValue ( const std::string &  name,
const void *  data,
const void *  data2 = nullptr,
const void *  data3 = nullptr,
const void *  data4 = nullptr 
)

Sets the data values for a registered field.

Parameters
[in]nameName the field is registered with
[in]dataThe value to set the field to
[in]data2(optional) The secondary data of the field
[in]data3(optional) The third data of the field
[in]data4(optional) The fourth data of the field

References m_entry.


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