libMesh
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
libMesh::ExodusII_IO_Helper::MappedInputVector Struct Reference

This class facilitates reading in vectors from Exodus file that may be of a different floating point type than Real. More...

#include <exodusII_io_helper.h>

Public Member Functions

 MappedInputVector (std::vector< Real > &vec_in, bool single_precision_in)
 
 ~MappedInputVector ()
 
void * data ()
 

Private Attributes

std::vector< Real > & our_data
 
bool single_precision
 
std::vector< double > double_vec
 
std::vector< float > float_vec
 

Detailed Description

This class facilitates reading in vectors from Exodus file that may be of a different floating point type than Real.

It employs basically the same approach as the MappedOutputVector, just going in the opposite direction. For more information, see the MappedOutputVector class docs.

Definition at line 1100 of file exodusII_io_helper.h.

Constructor & Destructor Documentation

◆ MappedInputVector()

libMesh::ExodusII_IO_Helper::MappedInputVector::MappedInputVector ( std::vector< Real > &  vec_in,
bool  single_precision_in 
)

Definition at line 648 of file exodusII_io_helper.C.

651 : our_data(our_data_in),
652 single_precision(single_precision_in)
653{
654 // Allocate temporary space to store enough floats/doubles, if required.
656 {
657 if (sizeof(Real) != sizeof(float))
658 float_vec.resize(our_data.size());
659 }
660 else if (sizeof(Real) != sizeof(double))
661 double_vec.resize(our_data.size());
662}
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

References double_vec, float_vec, our_data, libMesh::Real, and single_precision.

◆ ~MappedInputVector()

libMesh::ExodusII_IO_Helper::MappedInputVector::~MappedInputVector ( )

Definition at line 664 of file exodusII_io_helper.C.

666{
668 {
669 if (sizeof(Real) != sizeof(float))
670 our_data.assign(float_vec.begin(), float_vec.end());
671 }
672 else if (sizeof(Real) != sizeof(double))
673 our_data.assign(double_vec.begin(), double_vec.end());
674}

References libMesh::Real.

Member Function Documentation

◆ data()

void * libMesh::ExodusII_IO_Helper::MappedInputVector::data ( )

Definition at line 677 of file exodusII_io_helper.C.

678{
680 {
681 if (sizeof(Real) != sizeof(float))
682 return static_cast<void*>(float_vec.data());
683 }
684
685 else if (sizeof(Real) != sizeof(double))
686 return static_cast<void*>(double_vec.data());
687
688 // Otherwise return a (suitably casted) pointer to the original underlying data.
689 return static_cast<void *>(our_data.data());
690}

References libMesh::Real.

Referenced by libMesh::ExodusII_IO_Helper::read_all_nodesets().

Member Data Documentation

◆ double_vec

std::vector<double> libMesh::ExodusII_IO_Helper::MappedInputVector::double_vec
private

Definition at line 1113 of file exodusII_io_helper.h.

Referenced by MappedInputVector().

◆ float_vec

std::vector<float> libMesh::ExodusII_IO_Helper::MappedInputVector::float_vec
private

Definition at line 1114 of file exodusII_io_helper.h.

Referenced by MappedInputVector().

◆ our_data

std::vector<Real>& libMesh::ExodusII_IO_Helper::MappedInputVector::our_data
private

Definition at line 1111 of file exodusII_io_helper.h.

Referenced by MappedInputVector().

◆ single_precision

bool libMesh::ExodusII_IO_Helper::MappedInputVector::single_precision
private

Definition at line 1112 of file exodusII_io_helper.h.

Referenced by MappedInputVector().


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