Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI::Array::FullArray Class Reference

#include <GIDI.hpp>

Public Member Functions

 FullArray (std::vector< std::size_t > const &a_shape)
 FullArray (std::vector< std::size_t > const &a_shape, std::vector< double > const &a_flattenedValues)
 ~FullArray ()
std::size_t size () const

Public Attributes

std::vector< std::size_t > m_shape
std::vector< double > m_flattenedValues

Detailed Description

The class for storing any GNDS array as a flattened full array. It is the array returned by the Array.constructArray method. Note, this class is never used to store a GNDS array node, but to provide a convenient way to access data in any of the ways an array can be stored compactly in GNDS.

Definition at line 890 of file GIDI.hpp.

Constructor & Destructor Documentation

◆ FullArray() [1/2]

GIDI::Array::FullArray::FullArray ( std::vector< std::size_t > const & a_shape)

Constructs a FullArray using the arguments a_shape. The values for m_flattenedValues are set to 0.0.

Parameters
a_shape[in] The shape of the full array.

Definition at line 53 of file GIDI_arrays.cc.

53 :
54 m_shape( a_shape ) {
55
56 std::size_t size = 1;
57 for( auto iter = a_shape.begin( ); iter != a_shape.end( ); ++iter ) size *= *iter;
58 m_flattenedValues.resize( size, 0.0 );
59}
std::vector< std::size_t > m_shape
Definition GIDI.hpp:897
std::size_t size() const
Definition GIDI.hpp:900
std::vector< double > m_flattenedValues
Definition GIDI.hpp:898

◆ FullArray() [2/2]

GIDI::Array::FullArray::FullArray ( std::vector< std::size_t > const & a_shape,
std::vector< double > const & a_flattenedValues )

Constructs a FullArray using the arguments a_shape and a_flattenedValues.

Parameters
a_shape[in] The shape of the full array.
a_flattenedValues[in] The values of the array. Its size must be the same has that specified by a_shape.

Definition at line 68 of file GIDI_arrays.cc.

68 :
69 m_shape( a_shape ) {
70
71 std::size_t size = 1;
72 for( auto iter = a_shape.begin( ); iter != a_shape.end( ); ++iter ) size *= *iter;
73
74 if( size != static_cast<std::size_t>( a_flattenedValues.size( ) ) ) throw Exception( "FullArray::FullArray: a_shape and a_flattenedValues are not the same size." );
75
76 m_flattenedValues.resize( size );
77 for( std::size_t index = 0; index < size; ++index ) m_flattenedValues[index] = a_flattenedValues[index];
78}

◆ ~FullArray()

GIDI::Array::FullArray::~FullArray ( )
inline

Definition at line 895 of file GIDI.hpp.

895{}

Member Function Documentation

◆ size()

std::size_t GIDI::Array::FullArray::size ( ) const
inline

Definition at line 900 of file GIDI.hpp.

900{ return( m_flattenedValues.size( ) ); }

Referenced by MCGIDI::Distributions::CoherentElasticTNSL::CoherentElasticTNSL(), FullArray(), and FullArray().

Member Data Documentation

◆ m_flattenedValues

std::vector<double> GIDI::Array::FullArray::m_flattenedValues

A std::vector<double> representing the flattened arrary.

Definition at line 898 of file GIDI.hpp.

Referenced by MCGIDI::Distributions::CoherentElasticTNSL::CoherentElasticTNSL(), FullArray(), FullArray(), and size().

◆ m_shape

std::vector<std::size_t> GIDI::Array::FullArray::m_shape

The shape of the array.

Definition at line 897 of file GIDI.hpp.

Referenced by FullArray(), and FullArray().


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