GQCP
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
GQCP::Field< T_ > Class Template Reference

#include <Field.hpp>

Collaboration diagram for GQCP::Field< T_ >:
Collaboration graph

Public Types

using T = T_
 

Public Member Functions

 Field (const std::vector< T > &values)
 
Field< T > & operator+= (const Field< T > &rhs)
 
Field< Toperator- () const
 
Field< T > & operator-= (const Field< T > &rhs)
 
size_t size () const
 
void map (const std::function< T(const T &)> &function)
 
Field< Tmapped (const std::function< T(const T &)> &function) const
 
const Tvalue (const size_t index) const
 
Tvalue (const size_t index)
 
const std::vector< T > & values () const
 

Static Public Member Functions

template<typename Z = T>
static enable_if_t< std::is_same< Z, double >::value, Field< double > > ReadCubeFile (const std::string &filename)
 
template<int N>
static Field< Vector< double, N > > ReadGridFile (const std::string &filename)
 

Friends

Field< Toperator+ (Field< T > lhs, const Field< T > &rhs)
 
Field< Toperator- (Field< T > lhs, const Field< T > &rhs)
 

Detailed Description

template<typename T_>
class GQCP::Field< T_ >

A set of function values corresponding to points in space.

Template Parameters
T_The type of the evaluated function values.

Member Typedef Documentation

◆ T

template<typename T_ >
using GQCP::Field< T_ >::T = T_

Constructor & Destructor Documentation

◆ Field()

template<typename T_ >
GQCP::Field< T_ >::Field ( const std::vector< T > &  values)
inline

The memberwise constructor.

Parameters
valuesThe evaluated function values, in the order of the grid's loop.

Member Function Documentation

◆ map()

template<typename T_ >
void GQCP::Field< T_ >::map ( const std::function< T(const T &)> &  function)
inline

Apply a given function on each of this field's values, in-place.

Parameters
functionThe function to be used on each of the values.

◆ mapped()

template<typename T_ >
Field< T > GQCP::Field< T_ >::mapped ( const std::function< T(const T &)> &  function) const
inline

Apply a given function on each of this field's values.

Parameters
functionThe function to be used on each of the values.
Returns
A field with the mapped values.

◆ operator+=()

template<typename T_ >
Field< T > & GQCP::Field< T_ >::operator+= ( const Field< T > &  rhs)
inline

Add a field to this one by a point-wise addition.

Parameters
rhsThe right-hand side of the addition.
Returns
A reference to the modified this.
Note
The fields are supposed to be defined on the same grid.

◆ operator-()

template<typename T_ >
Field< T > GQCP::Field< T_ >::operator- ( ) const
inline

Negate the values of this field.

Returns
A negated version of this field.

◆ operator-=()

template<typename T_ >
Field< T > & GQCP::Field< T_ >::operator-= ( const Field< T > &  rhs)
inline

Subtract another field from this field by point-wise subtraction.

Parameters
rhsThe right-hand side of the subtraction.
Returns
A reference to the modified this.
Note
The fields are supposed to be defined on the same grid.

◆ ReadCubeFile()

template<typename T_ >
template<typename Z = T>
static enable_if_t< std::is_same< Z, double >::value, Field< double > > GQCP::Field< T_ >::ReadCubeFile ( const std::string &  filename)
inlinestatic

Parse a GAUSSIAN Cube file (http://paulbourke.net/dataformats/cube/) for scalar field values. The grid-associated information is discarded.

Parameters
filenameThe name of the cubefile.
Note
This named constructor is only enabled for Field<double>.

◆ ReadGridFile()

template<typename T_ >
template<int N>
static Field< Vector< double, N > > GQCP::Field< T_ >::ReadGridFile ( const std::string &  filename)
inlinestatic

Parse an .igrid- or .rgrid-file and create the field that is contained in it. The values for the grid are discarded.

Parameters
filenameThe name of the .igrid-file.
Note
An integration grid (.igrid) file is a headerless file and contains the following data:
  • Each row relates to one grid point.
  • Column specification:
    • Column 1: The index from 1 to the number of grid points
    • Columns 2-4: The position of the grid point: x, y, and z
    • Optional: Column 5 or columns 5-7: 1 value for a scalar field, 3 values for a vector field
    • Column 5, 6 or 8: The integration weight associated to the grid point
A regular grid (.rgrid) file is a headerless file and contains the following data:
  • Each row relates to one grid point, where the fastest changing values are z > y > x.
  • Column specification:
    • Column 1: The index from 1 to the number of grid points
    • Columns 2-4: The position of the grid point: x, y, and z
    • Optional: Column 5 or columns 5-7: 1 value for a scalar field, 3 values for a vector field

◆ size()

template<typename T_ >
size_t GQCP::Field< T_ >::size ( ) const
inline
Returns
The size of this field, i.e. the number of field values.

◆ value() [1/2]

template<typename T_ >
T & GQCP::Field< T_ >::value ( const size_t  index)
inline

Access one of the field's values.

Parameters
indexThe index of the function value.
Returns
A writable field value, corresponding to the given index.

◆ value() [2/2]

template<typename T_ >
const T & GQCP::Field< T_ >::value ( const size_t  index) const
inline

Access one of the field's values.

Parameters
indexThe index of the function value.
Returns
A read-only field value, corresponding to the given index.

◆ values()

template<typename T_ >
const std::vector< T > & GQCP::Field< T_ >::values ( ) const
inline
Returns
The evaluated function values, in the order of the grid's loop.

Friends And Related Function Documentation

◆ operator+

template<typename T_ >
Field< T > operator+ ( Field< T lhs,
const Field< T > &  rhs 
)
friend

Add two fields by a point-wise addition.

Parameters
lhsThe left-hand side of the addition.
rhsThe right-hand side of the addition.
Returns
The sum of the two fields.
Note
The fields are supposed to be defined on the same grid.

◆ operator-

template<typename T_ >
Field< T > operator- ( Field< T lhs,
const Field< T > &  rhs 
)
friend

Subtract one field from another by point-wise subtraction.

Parameters
lhsThe left-hand side of the subtraction.
rhsThe right-hand side of the subtraction.
Returns
The difference of the two fields.
Note
The fields are supposed to be defined on the same grid.

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