Cholla 3.0.1-dev
Cholla - Massively parallel hydro on GPUs
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
FieldInfo Class Reference

#include <field_info.h>

Public Member Functions

 FieldInfo (FieldInfo &&)=default
 
FieldInfooperator= (FieldInfo &&)=default
 
 FieldInfo (const FieldInfo &)=delete
 
FieldInfooperator= (const FieldInfo &)=delete
 
const utils::FrozenKeyIdxBiMapget_field_id_map () const
 
std::optional< int > field_id (const char *field_name) const
 
std::optional< int > field_id (std::string_view field_name) const
 
std::optional< std::string > field_name (int field_id) const
 
std::optional< bool > is_cell_centered (int field_id) const
 
std::optional< field::IOBufio_buf (int field_id) const
 
int n_fields () const
 
int n_fields (field::Kind kind) const
 
std::optional< int > scalar_start () const
 
field::IdRange get_id_range (field::Kind kind) const
 

Static Public Member Functions

static FieldInfo create ()
 

Detailed Description

Dynamically describes the available fields and associated properties

Member Function Documentation

◆ create()

FieldInfo FieldInfo::create ( )
static

Factory method

Ideally, we would make it possible to customize the active scalars, but that's a topic for the future.

◆ field_id()

std::optional< int > FieldInfo::field_id ( const char *  field_name) const
inline

try to lookup the field_id associated with the field_name

◆ field_name()

std::optional< std::string > FieldInfo::field_name ( int  field_id) const
inline

try to look up the field name from the field id

◆ get_field_id_map()

const utils::FrozenKeyIdxBiMap & FieldInfo::get_field_id_map ( ) const
inline

Get the underlying mapping object between field names and ids

◆ get_id_range()

field::IdRange FieldInfo::get_id_range ( field::Kind  kind) const
inline

This returns a "range" over all ids

This might be used in a case like the following:

{c++}
for (int field_id: field_info.get_id_range(field::Kind::HYDRO)) {
// ...
}
std::optional< int > field_id(const char *field_name) const
Definition field_info.h:85
field::IdRange get_id_range(field::Kind kind) const
Definition field_info.h:149

◆ io_buf()

std::optional< field::IOBuf > FieldInfo::io_buf ( int  field_id) const
inline

try to look up the IOBuf value associated with a field

Note
We may want to revisit whether this actually should be tracked by FieldInfo in the future.

◆ is_cell_centered()

std::optional< bool > FieldInfo::is_cell_centered ( int  field_id) const
inline

try to look up whether the field id refers to a cell-centered field

Note
It may be more useful to return a value that directly specifies whether a field is cell-center, x-face-centered, y-face-centered, z-face-centered. It might be convenient to specify this with a hydro_utilities::VectorXYZ<int>. For example, {0,0,0} could represent a cell-centered value and {1,0,0}, or maybe {-1, 0, 0} (we need to think about conventions), could denote a field centered on x-faces.

◆ n_fields() [1/2]

int FieldInfo::n_fields ( ) const
inline

Returns the number of fields

◆ n_fields() [2/2]

int FieldInfo::n_fields ( field::Kind  kind) const
inline

Returns the number of fields of a given category

◆ scalar_start()

std::optional< int > FieldInfo::scalar_start ( ) const
inline

Returns the first field_id corresponding to a passive scalar (if there are any)


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