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 736 of file exodusII_io_helper.C.

739 : our_data(our_data_in),
740 single_precision(single_precision_in)
741{
742 // Allocate temporary space to store enough floats/doubles, if required.
744 {
745 if (sizeof(Real) != sizeof(float))
746 float_vec.resize(our_data.size());
747 }
748 else if (sizeof(Real) != sizeof(double))
749 double_vec.resize(our_data.size());
750}
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 752 of file exodusII_io_helper.C.

754{
756 {
757 if (sizeof(Real) != sizeof(float))
758 our_data.assign(float_vec.begin(), float_vec.end());
759 }
760 else if (sizeof(Real) != sizeof(double))
761 our_data.assign(double_vec.begin(), double_vec.end());
762}

References libMesh::Real.

Member Function Documentation

◆ data()

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

Definition at line 765 of file exodusII_io_helper.C.

766{
768 {
769 if (sizeof(Real) != sizeof(float))
770 return static_cast<void*>(float_vec.data());
771 }
772
773 else if (sizeof(Real) != sizeof(double))
774 return static_cast<void*>(double_vec.data());
775
776 // Otherwise return a (suitably casted) pointer to the original underlying data.
777 return static_cast<void *>(our_data.data());
778}

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: