2#ifndef STORMM_MESH_PARAMETERS_H
3#define STORMM_MESH_PARAMETERS_H
8#include "Constants/behavior.h"
9#include "DataTypes/common_types.h"
10#include "DataTypes/stormm_vector_types.h"
11#include "Math/math_enumerators.h"
12#include "Math/rounding.h"
13#include "Numerics/split_fixed_precision.h"
14#include "Topology/atomgraph.h"
15#include "Topology/atomgraph_abstracts.h"
16#include "Topology/atomgraph_enumerators.h"
17#include "Trajectory/coordinateframe.h"
18#include "Trajectory/coordinate_series.h"
19#include "Trajectory/phasespace.h"
20#include "structure_enumerators.h"
25using constants::CartesianDimension;
26using constants::UnitCellAxis;
27using data_types::getStormmScalarTypeName;
28using data_types::isSignedIntegralScalarType;
29using data_types::isFloatingPointScalarType;
30using data_types::isFloatingPointHpcVectorType;
31using stmath::Interpolant;
33using topology::AtomGraph;
34using topology::NonbondedKit;
35using topology::UnitCellType;
36using trajectory::CoordinateFrame;
37using trajectory::CoordinateFrameReader;
38using trajectory::CoordinateSeries;
39using trajectory::CoordinateSeriesReader;
40using trajectory::determineUnitCellTypeByShape;
44constexpr int default_mesh_scaling_bits = 40;
48constexpr int mesh_nonoverflow_bits = 46;
57constexpr int max_mesh_definition_bits = 77;
65 int95_t orig_z_in,
double scale_in,
double inv_scale_in,
int scale_bits_in,
66 const double* umat_in,
const double* invu_in,
const double* full_umat_in,
67 const double* full_invu_in,
const double* widths_in,
const int95_t* fp_invu_in,
68 double max_span_in, BoundaryCondition bounds_in, Interpolant stencil_kind_in,
69 UnitCellType unit_cell_in);
127 MeshParameters(
int na_in,
int nb_in,
int nc_in,
double origin_x_in,
double origin_y_in,
128 double origin_z_in,
const std::vector<double> &element_vectors,
129 int scale_bits_in = default_mesh_scaling_bits,
130 Interpolant stencil_kind_in = Interpolant::SMOOTHNESS);
134 MeshParameters(
int na_in,
int nb_in,
int nc_in,
double origin_x_in,
double origin_y_in,
135 double origin_z_in,
double element_x,
double element_y,
double element_z,
136 int scale_bits_in = default_mesh_scaling_bits,
137 Interpolant stencil_kind_in = Interpolant::SMOOTHNESS);
139 MeshParameters(
int na_in,
int nb_in,
int nc_in,
double origin_x_in,
double origin_y_in,
140 double origin_z_in,
double element_width,
141 int scale_bits_in = default_mesh_scaling_bits,
142 Interpolant stencil_kind_in = Interpolant::SMOOTHNESS);
217 template <
typename Tcoord>
282 CartesianDimension cart_axis)
const;
319 void setOrigin(
double v, CartesianDimension cart_axis);
321 void setOrigin(
const std::vector<double> &v);
322 void setOrigin(
const std::vector<int95_t> &v);
331 void defineElement(
const std::vector<double> &element_vectors);
355 double inverse_scale_factor;
357 UnitCellType unit_cell;
358 BoundaryCondition boundary;
359 Interpolant stencil_kind;
369 double element_umat[9];
374 float sp_element_umat[9];
380 double element_invu[9];
383 float sp_element_invu[9];
413 void validateMeshDimensions()
const;
416 void validateFixedPrecisionBits()
const;
419 double maximumSpan()
const;
444 double spacing,
int scale_bits_in);
447 const std::vector<double> &mesh_bounds,
double spacing,
451 const std::vector<double> &spacing,
int scale_bits_in);
453template <
typename Tcoord>
455 double padding,
const std::vector<double> &spacing,
458MeshParameters getMeasurements(
const std::vector<double> &mesh_bounds,
459 const std::vector<double> &spacing,
int scale_bits_in);
465#include "mesh_parameters.tpp"
MeshParameters(int na_in, int nb_in, int nc_in, double origin_x_in, double origin_y_in, double origin_z_in, const std::vector< double > &element_vectors, int scale_bits_in=default_mesh_scaling_bits, Interpolant stencil_kind_in=Interpolant::SMOOTHNESS)
The constructor takes formal arguments for all member variables. Variants support triclinic and ortho...
Definition mesh_parameters.cpp:50
Encode the critical dimensions of a regular, rectilinear mesh. The locations of mesh points as well a...
Definition mesh_parameters.h:121
double getScalingFactor() const
Get the scaling factor for this mesh's fixed-precision format.
Definition mesh_parameters.cpp:197
int getAxisElementCount(UnitCellAxis dim) const
Get the number of points along one of the mesh axes.
Definition mesh_parameters.cpp:97
std::vector< int95_t > getAxisCoordinates(UnitCellAxis mesh_axis, CartesianDimension cart_axis) const
Get a vector of fixed-precision format coordinates of the line of grid points starting at the origin ...
Definition mesh_parameters.cpp:207
Interpolant getStencilKind() const
Get the type of stencil to use in producing tricubic coefficients for each mesh element.
Definition mesh_parameters.cpp:168
double getInverseScalingFactor() const
Get the inverse scaling factor for this mesh's fixed-precision format.
Definition mesh_parameters.cpp:202
std::vector< Tcoord > getMeshTransform() const
Get the entire element space matrix in any format. Real formats will have units of inverse Angstroms.
MeshParameters(const MeshParameters &original)=default
With no const members or pointers, the default copy and move constructors as well as copy and move as...
const MeshParameters * getSelfPointer() const
Get a pointer to the object itself.
Definition mesh_parameters.cpp:265
std::vector< Tcoord > getMeshElementVector(UnitCellAxis dim) const
Get the element vector along one of the unit cell axes in floating-point numbers.
T3 getMeshElementVectorAsTuple(UnitCellAxis dim) const
Get the element vector along one of the unit cell axes as a tuple of floating-point numbers.
std::vector< int95_t > getMeshElementVectorAsFP(UnitCellAxis dim) const
Get the element vector along one of the unit cell axes in fixed precision.
Definition mesh_parameters.cpp:173
std::vector< int95_t > getMeshInverseTransformAsFP() const
Get the inverse element transformation matrix in (authoritative) fixed-precision format.
Definition mesh_parameters.cpp:183
void setBoundaryCondition(BoundaryCondition boundary_in)
Set the boundary conditions in which the mesh shall operate.
Definition mesh_parameters.cpp:347
std::vector< int95_t > getMeshOriginAsFP() const
Get the Cartesian origin of the mesh in fixed-precision numbers.
Definition mesh_parameters.cpp:136
UnitCellType getMeshCellType() const
Get the type of mesh cell to understand whether the cell vectors are orthogonal to one another.
Definition mesh_parameters.cpp:158
BoundaryCondition getBoundaryConditions() const
Get the type of boundary conditions under which the mesh operates.
Definition mesh_parameters.cpp:163
void setMeshDimension(int n_in, UnitCellAxis mesh_axis)
Set the number of mesh elements along the "a", "b", or "c" axes.
Definition mesh_parameters.cpp:270
double getMaximumSpan() const
Get the maximum distance between any two vertices of the mesh element.
Definition mesh_parameters.cpp:238
void setStencilKind(Interpolant stencil_kind_in)
Set the type of stencil to be used in determining the interpolants for each mesh element.
Definition mesh_parameters.cpp:352
T3 getMeshOriginAsTuple() const
Get the Cartesian origin of the mesh as a tuple of floating-point numbers.
std::string printDimensions() const
Produce a description of the mesh element's dimensions suitable for printing.
Definition mesh_parameters.cpp:243
void defineElement(const std::vector< double > &element_vectors)
Define the basic element coordinates using three vectors in three-dimensional space.
Definition mesh_parameters.cpp:357
void setOrigin(double v, CartesianDimension cart_axis)
Set the origin's Cartesian X, Y, or Z coordinates.
Definition mesh_parameters.cpp:299
void setScalingBits(int scale_bits_in)
Set the scaling bits. This will also update the scaling factors.
Definition mesh_parameters.cpp:341
std::vector< Tcoord > getMeshInverseTransform() const
Get the inverse element transformation matrix in real-number format, with units of inverse Angstroms.
MeshParamKit data() const
Obtain the abstract for this object.
Definition mesh_parameters.cpp:258
int getScalingBits() const
Get the number of bits after the decimal in this mesh's fixed-precision coordinate representations.
Definition mesh_parameters.cpp:192
MeshParameters(int na_in, int nb_in, int nc_in, double origin_x_in, double origin_y_in, double origin_z_in, const std::vector< double > &element_vectors, int scale_bits_in=default_mesh_scaling_bits, Interpolant stencil_kind_in=Interpolant::SMOOTHNESS)
The constructor takes formal arguments for all member variables. Variants support triclinic and ortho...
Definition mesh_parameters.cpp:50
std::vector< Tcoord > getMeshOrigin() const
Get the Cartesian origin of the mesh in floating-point numbers.
A struct to hold information relating to an Amber topology. This struct's member functions are limite...
Definition atomgraph.h:50
Store the coordinates and box information for a frame, only. This abridged struct can serve when the ...
Definition coordinateframe.h:111
Store the coordinates and box information for a series of frames, in one of several levels of precisi...
Definition coordinate_series.h:137
A mixed tuple for 95-bit integer accumulation. This is the proper way to take double-precision floati...
Definition stormm_vector_types.h:265
MeshParamKit(int na_in, int nb_in, int nc_in, int95_t orig_x_in, int95_t orig_y_in, int95_t orig_z_in, double scale_in, double inv_scale_in, int scale_bits_in, const double *umat_in, const double *invu_in, const double *full_umat_in, const double *full_invu_in, const double *widths_in, const int95_t *fp_invu_in, double max_span_in, BoundaryCondition bounds_in, Interpolant stencil_kind_in, UnitCellType unit_cell_in)
The constructor takes arguments for all member variables.
Definition mesh_parameters.cpp:22
The abstract of a MeshParameters object is read-only (modify the original to get a new abstract if th...
Definition mesh_parameters.h:61
const float inv_scale_f
Single-precision form of inv_scale.
Definition mesh_parameters.h:91
const double full_invu[9]
Definition mesh_parameters.h:98
const double widths[3]
Definition mesh_parameters.h:101
const int nb
Number of mesh elements along the "b" (~y) axis.
Definition mesh_parameters.h:81
const int95_t orig_x
Cartesian X origin of the mesh in fixed-precision format.
Definition mesh_parameters.h:83
const int95_t orig_y
Cartesian Y origin of the mesh in fixed-precision format.
Definition mesh_parameters.h:84
const double scale
Definition mesh_parameters.h:86
const double invu[9]
Definition mesh_parameters.h:94
const Interpolant stencil_kind
Definition mesh_parameters.h:111
const double full_umat[9]
Definition mesh_parameters.h:96
const double inv_scale
Definition mesh_parameters.h:88
const int scale_bits
Bits after the decimal used in the fixed precision scaling.
Definition mesh_parameters.h:92
MeshParamKit(int na_in, int nb_in, int nc_in, int95_t orig_x_in, int95_t orig_y_in, int95_t orig_z_in, double scale_in, double inv_scale_in, int scale_bits_in, const double *umat_in, const double *invu_in, const double *full_umat_in, const double *full_invu_in, const double *widths_in, const int95_t *fp_invu_in, double max_span_in, BoundaryCondition bounds_in, Interpolant stencil_kind_in, UnitCellType unit_cell_in)
The constructor takes arguments for all member variables.
Definition mesh_parameters.cpp:22
const BoundaryCondition bounds
Boundary conditions for the mesh.
Definition mesh_parameters.h:110
const float scale_f
Single-precision form of scale.
Definition mesh_parameters.h:90
const int nc
Number of mesh elements along the "c" (~z) axis.
Definition mesh_parameters.h:82
const int95_t fp_invu[9]
Definition mesh_parameters.h:106
const double max_span
Definition mesh_parameters.h:108
const int na
Number of mesh elements along the "a" (~x) axis.
Definition mesh_parameters.h:80
const int95_t orig_z
Cartesian Z origin of the mesh in fixed-precision format.
Definition mesh_parameters.h:85
MeshParamKit(const MeshParamKit &original)=default
The default copy and move constructors will be valid for this object. Const members negate the use of...
const UnitCellType unit_cell
Definition mesh_parameters.h:113
const double umat[9]
Transformation matrix taking coordinates into element space.
Definition mesh_parameters.h:93