Field3D
MatrixFieldMappingIO Class Reference

#include <FieldMappingIO.h>

Inheritance diagram for MatrixFieldMappingIO:
FieldMappingIO FieldMappingIO RefBase RefBase RefBase RefBase

List of all members.

Public Types

typedef boost::intrusive_ptr
< MatrixFieldMappingIO
Ptr
typedef boost::intrusive_ptr
< MatrixFieldMappingIO
Ptr

Public Member Functions

virtual std::string className () const
 Returns the class name.
virtual std::string className () const
 Returns the class name.
 MatrixFieldMappingIO ()
 Ctor.
 MatrixFieldMappingIO ()
 Ctor.
virtual FieldMapping::Ptr read (hid_t mappingGroup)
 Reads the field mapping and tries to create a MatrixFieldMapping object from it.
virtual FieldMapping::Ptr read (hid_t mappingGroup)
 Reads the field mapping and tries to create a MatrixFieldMapping object from it.
virtual bool write (hid_t mappingGroup, FieldMapping::Ptr mapping)
 Writes the given field mapping to disk.
virtual bool write (hid_t mappingGroup, FieldMapping::Ptr mapping)
 Writes the given field mapping to disk.

Static Public Member Functions

static FieldMappingIO::Ptr create ()
static FieldMappingIO::Ptr create ()

Detailed Description

Handles IO for a MatrixFieldMapping object

Definition at line 159 of file FieldMappingIO.h.


Member Typedef Documentation

typedef boost::intrusive_ptr<MatrixFieldMappingIO> MatrixFieldMappingIO::Ptr

Reimplemented from FieldMappingIO.

Definition at line 166 of file FieldMappingIO.h.

typedef boost::intrusive_ptr<MatrixFieldMappingIO> MatrixFieldMappingIO::Ptr

Reimplemented from FieldMappingIO.

Definition at line 166 of file FieldMappingIO.h.


Constructor & Destructor Documentation

MatrixFieldMappingIO::MatrixFieldMappingIO ( ) [inline]

Ctor.

Definition at line 171 of file FieldMappingIO.h.

   : FieldMappingIO()
  { }
MatrixFieldMappingIO::MatrixFieldMappingIO ( ) [inline]

Ctor.

Definition at line 171 of file FieldMappingIO.h.

   : FieldMappingIO()
  { }

Member Function Documentation

static FieldMappingIO::Ptr MatrixFieldMappingIO::create ( ) [inline, static]

Definition at line 175 of file FieldMappingIO.h.

Referenced by initIO().

  { return Ptr(new MatrixFieldMappingIO); }
FieldMapping::Ptr MatrixFieldMappingIO::read ( hid_t  mappingGroup) [virtual]

Reads the field mapping and tries to create a MatrixFieldMapping object from it.

Returns:
Matrix if no object was read

Implements FieldMappingIO.

Definition at line 108 of file FieldMappingIO.cpp.

References Msg::print(), Hdf5Util::readAttribute(), and Msg::SevWarning.

{
  M44d mtx;

  if (!readAttribute(mappingGroup, k_matrixMappingDataName, 16,
                     mtx.x[0][0])) {
    Msg::print(Msg::SevWarning, "Couldn't read attribute " + k_matrixMappingDataName);
    return MatrixFieldMapping::Ptr();
  }

  MatrixFieldMapping::Ptr mm(new MatrixFieldMapping);

  mm->setLocalToWorld(mtx);

  return mm;
}
bool MatrixFieldMappingIO::write ( hid_t  mappingGroup,
FieldMapping::Ptr  mapping 
) [virtual]

Writes the given field mapping to disk.

Returns:
true if successful, otherwise false

Implements FieldMappingIO.

Definition at line 128 of file FieldMappingIO.cpp.

References Msg::print(), Msg::SevWarning, and Hdf5Util::writeAttribute().

{
  MatrixFieldMapping::Ptr mm =
    boost::dynamic_pointer_cast<MatrixFieldMapping>(mapping);
  if (!mm) {
    Msg::print(Msg::SevWarning, "Couldn't get MatrixFieldMapping from pointer");
    return false;
  }
  if (!writeAttribute(mappingGroup, k_matrixMappingDataName, 16, 
                    mm->localToWorld().x[0][0])) {
    Msg::print(Msg::SevWarning, "Couldn't add attribute " + k_matrixMappingDataName);
    return false;
  }

  return true;
}
std::string MatrixFieldMappingIO::className ( ) const [virtual]

Returns the class name.

Implements FieldMappingIO.

Definition at line 148 of file FieldMappingIO.cpp.

References FIELD3D_NAMESPACE_OPEN::k_matrixMappingName().

{ return k_matrixMappingName; }
static FieldMappingIO::Ptr MatrixFieldMappingIO::create ( ) [inline, static]

Definition at line 175 of file FieldMappingIO.h.

  { return Ptr(new MatrixFieldMappingIO); }
virtual FieldMapping::Ptr MatrixFieldMappingIO::read ( hid_t  mappingGroup) [virtual]

Reads the field mapping and tries to create a MatrixFieldMapping object from it.

Returns:
Matrix if no object was read

Implements FieldMappingIO.

virtual bool MatrixFieldMappingIO::write ( hid_t  mappingGroup,
FieldMapping::Ptr  mapping 
) [virtual]

Writes the given field mapping to disk.

Returns:
true if successful, otherwise false

Implements FieldMappingIO.

virtual std::string MatrixFieldMappingIO::className ( ) const [virtual]

Returns the class name.

Implements FieldMappingIO.


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