![]() |
PRISMS-PF Manual
|
Class to read in a flat binary file and provide values at given points. More...
#include <read_binary.h>
Public Member Functions | |
| ReadBinary (const InitialConditionFile &_ic_file, const SpatialDiscretization< dim > &_spatial_discretization) | |
| Constructor. | |
| void | print_file () override |
| Print the binary file to text for debugging. | |
| number | get_scalar_value (const dealii::Point< dim > &point, const std::string &scalar_name) override |
| Get scalar value for a given point. | |
| dealii::Vector< number > | get_vector_value (const dealii::Point< dim > &point, const std::string &vector_name) override |
| Get vector value for a given point. | |
Public Member Functions inherited from ReadFieldBase< dim, number > | |
| ReadFieldBase (const InitialConditionFile &_ic_file, const SpatialDiscretization< dim > &_spatial_discretization) | |
| Constructor. | |
| virtual | ~ReadFieldBase ()=default |
| Destructor. | |
| ReadFieldBase (const ReadFieldBase &read_base)=delete | |
| Copy constructor. | |
| ReadFieldBase & | operator= (const ReadFieldBase &read_base)=delete |
| Copy assignment. | |
| ReadFieldBase (ReadFieldBase &&read_base) noexcept=delete | |
| Move constructor. | |
| ReadFieldBase & | operator= (ReadFieldBase &&read_base) noexcept=delete |
| Move assignment. | |
Static Public Member Functions | |
| static void | write_file (const std::vector< number > &data, const InitialConditionFile &ic_file) |
| Write a binary file for testing. | |
Private Member Functions | |
| void | check_file_size () |
| Check the size of the binary file and make sure it matches the expected size (in bytes). | |
| dealii::Vector< number > | get_value (const dealii::types::global_dof_index index, const unsigned int n_components) |
| Get vector value for a given index. | |
| dealii::Vector< number > | interpolate (const dealii::Point< dim > &point, const unsigned int n_components) |
| Get vector value for a given point. | |
Private Attributes | |
| dealii::types::global_dof_index | n_points = 1 |
| Number of grid points. | |
| dealii::types::global_dof_index | n_values = 0 |
| Number of values (n_points * n_components). | |
| std::vector< number > | data |
| Data array to hold the read in values. | |
Additional Inherited Members | |
Protected Attributes inherited from ReadFieldBase< dim, number > | |
| const SpatialDiscretization< dim > & | spatial_discretization |
| Spatial discretization object. | |
| const InitialConditionFile & | ic_file |
| Initial condition file object. | |
Class to read in a flat binary file and provide values at given points.
|
inline |
Constructor.
|
inlineprivate |
Check the size of the binary file and make sure it matches the expected size (in bytes).
|
inlineoverridevirtual |
Get scalar value for a given point.
Implements ReadFieldBase< dim, number >.
|
inlineprivate |
Get vector value for a given index.
|
inlineoverridevirtual |
Get vector value for a given point.
Implements ReadFieldBase< dim, number >.
|
inlineprivate |
Get vector value for a given point.
This function is necessary for binary files because we don't have a strict order of points that deal.II gives us in the initial condition function. For that reason, we have to interpolate the flat binary values assuming a rectangular grid with fixed spacing. Furthermore, we assume that the first point is the origin (0,0,0) and the last the furthest corner (increasing x, then y, and z).
|
inlineoverridevirtual |
Print the binary file to text for debugging.
Implements ReadFieldBase< dim, number >.
|
inlinestatic |
Write a binary file for testing.
|
private |
Data array to hold the read in values.
|
private |
Number of grid points.
We have to set the initial value to 1 so that when we multiply in the constructor we don't end up with zero.
|
private |
Number of values (n_points * n_components).