Miscellaneous cleanup

This commit is contained in:
Sterling Harper 2018-05-27 13:38:16 -04:00
parent d78c5619de
commit 7f7af84e64
10 changed files with 114 additions and 185 deletions

View file

@ -219,8 +219,8 @@ Curly braces
For a function definition, the opening and closing braces should each be on
their own lines. This helps distinguish function code from the argument list.
If the entire function fits on one line, then the braces can be on the same
line. e.g.:
If the entire function fits on one or two lines, then the braces can be on the
same line. e.g.:
.. code-block:: C++
@ -238,6 +238,9 @@ line. e.g.:
int return_one() {return 1;}
int return_one()
{return 1;}
For a conditional, the opening brace should be on the same line as the end of
the conditional statement. If there is a following ``else if`` or ``else``
statement, the closing brace should be on the same line as that following

View file

@ -12,9 +12,6 @@
#include "surface.h"
#include "xml_interface.h"
//TODO: remove this include
#include <iostream>
namespace openmc {
@ -34,14 +31,13 @@ extern "C" double FP_PRECISION;
// Global variables
//==============================================================================
// Braces force n_cells to be defined here, not just declared.
extern "C" {int32_t n_cells {0};}
int32_t n_cells {0};
std::vector<Cell*> cells_c;
std::map<int32_t, int32_t> cell_dict;
std::unordered_map<int32_t, int32_t> cell_dict;
std::vector<Universe*> universes_c;
std::map<int32_t, int32_t> universe_dict;
std::unordered_map<int32_t, int32_t> universe_dict;
//==============================================================================
//! Convert region specification string to integer tokens.
@ -249,6 +245,7 @@ Cell::Cell(pugi::xml_node cell_node)
fatal_error(err_msg);
}
// Read the region specification.
std::string region_spec {""};
if (check_for_node(cell_node, "region")) {
region_spec = get_node_value(cell_node, "region");
@ -280,6 +277,8 @@ Cell::Cell(pugi::xml_node cell_node)
}
}
//==============================================================================
bool
Cell::contains(const double xyz[3], const double uvw[3],
int32_t on_surface) const
@ -291,6 +290,8 @@ Cell::contains(const double xyz[3], const double uvw[3],
}
}
//==============================================================================
std::pair<double, int32_t>
Cell::distance(const double xyz[3], const double uvw[3],
int32_t on_surface) const
@ -306,7 +307,6 @@ Cell::distance(const double xyz[3], const double uvw[3],
// Note the off-by-one indexing
bool coincident {token == on_surface};
double d {surfaces_c[abs(token)-1]->distance(xyz, uvw, coincident)};
//std::cout << token << " " << on_surface << " " << coincident << std::endl;
// Check if this distance is the new minimum.
if (d < min_dist) {
@ -320,20 +320,18 @@ Cell::distance(const double xyz[3], const double uvw[3],
return {min_dist, i_surf};
}
//==============================================================================
void
Cell::to_hdf5(hid_t cell_group) const
{
// std::string group_name {"surface "};
// group_name += std::to_string(id);
//
// hid_t surf_group = create_group(group_id, group_name);
if (!name.empty()) {
write_string(cell_group, "name", name, false);
}
//TODO: Fix the off-by-one indexing.
write_int(cell_group, "universe", universes_c[universe-1]->id);
write_int(cell_group, 0, nullptr, "universe", &universes_c[universe-1]->id,
false);
// Write the region specification.
if (!region.empty()) {
@ -355,10 +353,10 @@ Cell::to_hdf5(hid_t cell_group) const
}
write_string(cell_group, "region", region_spec.str(), false);
}
// close_group(cell_group);
}
//==============================================================================
bool
Cell::contains_simple(const double xyz[3], const double uvw[3],
int32_t on_surface) const
@ -382,6 +380,8 @@ Cell::contains_simple(const double xyz[3], const double uvw[3],
return true;
}
//==============================================================================
bool
Cell::contains_complex(const double xyz[3], const double uvw[3],
int32_t on_surface) const
@ -432,6 +432,8 @@ Cell::contains_complex(const double xyz[3], const double uvw[3],
}
}
//==============================================================================
// Non-method functions
//==============================================================================
extern "C" void

View file

@ -1,9 +1,9 @@
#ifndef CELL_H
#define CELL_H
#include <map>
#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>
#include "hdf5.h"
@ -28,11 +28,11 @@ extern "C" int32_t n_cells;
class Cell;
extern std::vector<Cell*> cells_c;
extern std::map<int32_t, int32_t> cell_dict;
extern std::unordered_map<int32_t, int32_t> cell_dict;
class Universe;
extern std::vector<Universe*> universes_c;
extern std::map<int32_t, int32_t> universe_dict;
extern std::unordered_map<int32_t, int32_t> universe_dict;
//==============================================================================
//! A geometry primitive that fills all space and contains cells.
@ -41,10 +41,9 @@ extern std::map<int32_t, int32_t> universe_dict;
class Universe
{
public:
int32_t id; //! Unique ID
int32_t type;
std::vector<int32_t> cells; //! Cells within this universe
double x0, y0, z0; //! Translation coordinates.
int32_t id; //!< Unique ID
std::vector<int32_t> cells; //!< Cells within this universe
//double x0, y0, z0; //!< Translation coordinates.
};
//==============================================================================
@ -61,8 +60,9 @@ public:
int32_t fill; //!< Universe # filling this cell
int32_t n_instances{0}; //!< Number of instances of this cell
//! Material within this cell. May be multiple materials for distribcell.
//! C_NONE signifies a universe.
//! \brief Material(s) within this cell.
//!
//! May be multiple materials for distribcell. C_NONE signifies a universe.
std::vector<int32_t> material;
//! Definition of spatial region as Boolean expression of half-spaces
@ -77,7 +77,7 @@ public:
explicit Cell(pugi::xml_node cell_node);
//! Determine if a cell contains the particle at a given location.
//! \brief Determine if a cell contains the particle at a given location.
//!
//! The bounds of the cell are detemined by a logical expression involving
//! surface half-spaces. At initialization, the expression was converted
@ -99,10 +99,11 @@ public:
bool
contains(const double xyz[3], const double uvw[3], int32_t on_surface) const;
//! Find the oncoming boundary of this cell.
std::pair<double, int32_t>
distance(const double xyz[3], const double uvw[3], int32_t on_surface) const;
//! Write all information needed to reconstruct the cell to an HDF5 group.
//! \brief Write cell information to an HDF5 group.
//! @param group_id An HDF5 group id.
void to_hdf5(hid_t group_id) const;

View file

@ -292,7 +292,6 @@ module geometry_header
integer(C_INT32_T), bind(C) :: n_cells ! # of cells
integer(C_INT32_T), bind(C) :: n_universes ! # of universes
integer(C_INT32_T), bind(C) :: n_lattices ! # of lattices
type(Cell), allocatable, target :: cells(:)
type(Universe), allocatable, target :: universes(:)
@ -520,7 +519,6 @@ contains
n_cells = 0
n_universes = 0
n_lattices = 0
if (allocated(cells)) deallocate(cells)
if (allocated(universes)) deallocate(universes)

View file

@ -84,20 +84,6 @@ void write_string(hid_t group_id, const char* name, const std::string& buffer, b
extern "C" void write_tally_results(hid_t group_id, hsize_t n_filter, hsize_t n_score,
const double* results);
inline void
write_int(hid_t group_id, char const *name, int32_t buffer)
{
hid_t dataspace = H5Screate(H5S_SCALAR);
hid_t dataset = H5Dcreate(group_id, name, H5T_NATIVE_INT32, dataspace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer);
H5Sclose(dataspace);
H5Dclose(dataset);
}
template<std::size_t array_len> void
write_int(hid_t group_id, char const *name,
const std::array<int, array_len> &buffer, bool indep)
@ -108,12 +94,12 @@ write_int(hid_t group_id, char const *name,
template<std::size_t array_len> void
write_double_1D(hid_t group_id, char const *name,
const std::array<double, array_len> &buffer)
write_double(hid_t group_id, char const *name,
const std::array<double, array_len> &buffer, bool indep)
{
hsize_t dims[1] {array_len};
write_dataset(group_id, 1, dims, name, H5T_NATIVE_DOUBLE,
buffer.data(), false);
buffer.data(), indep);
}
} // namespace openmc

View file

@ -1257,8 +1257,7 @@ contains
! Allocate lattices array
n_rlats = size(node_rlat_list)
n_hlats = size(node_hlat_list)
n_lattices = n_rlats + n_hlats
allocate(lattices(n_lattices))
allocate(lattices(n_rlats + n_hlats))
RECT_LATTICES: do i = 1, n_rlats
allocate(RectLattice::lattices(i) % obj)

View file

@ -5,15 +5,11 @@
#include <vector>
#include "cell.h"
#include "constants.h"
#include "error.h"
#include "geometry_aux.h"
#include "hdf5_interface.h"
#include "xml_interface.h"
//TODO: remove this include
#include <iostream>
namespace openmc {
@ -23,7 +19,7 @@ namespace openmc {
std::vector<Lattice*> lattices_c;
std::map<int32_t, int32_t> lattice_dict;
std::unordered_map<int32_t, int32_t> lattice_dict;
//==============================================================================
// Lattice implementation
@ -48,31 +44,17 @@ Lattice::Lattice(pugi::xml_node lat_node)
//==============================================================================
LatticeIter
Lattice::begin()
{
return LatticeIter(*this, 0);
}
LatticeIter Lattice::begin()
{return LatticeIter(*this, 0);}
LatticeIter
Lattice::end()
{
return LatticeIter(*this, universes.size());
}
LatticeIter Lattice::end()
{return LatticeIter(*this, universes.size());}
//==============================================================================
ReverseLatticeIter Lattice::rbegin()
{return ReverseLatticeIter(*this, universes.size()-1);}
ReverseLatticeIter
Lattice::rbegin()
{
return ReverseLatticeIter(*this, universes.size()-1);
}
ReverseLatticeIter
Lattice::rend()
{
return ReverseLatticeIter(*this, -1);
}
ReverseLatticeIter Lattice::rend()
{return ReverseLatticeIter(*this, -1);}
//==============================================================================
@ -80,7 +62,7 @@ void
Lattice::adjust_indices()
{
// Adjust the indices for the universes array.
for (auto it = begin(); it != end(); ++it) {
for (LatticeIter it = begin(); it != end(); ++it) {
int uid = *it;
auto search = universe_dict.find(uid);
if (search != universe_dict.end()) {
@ -109,18 +91,10 @@ Lattice::adjust_indices()
//==============================================================================
void
Lattice::allocate_offset_table(int n_maps)
{
offsets.resize(n_maps * universes.size(), C_NONE);
}
//==============================================================================
int32_t
Lattice::fill_offset_table(int32_t offset, int32_t target_univ_id, int map)
{
for (auto it = begin(); it != end(); ++it) {
for (LatticeIter it = begin(); it != end(); ++it) {
offsets[map * universes.size() + it.indx] = offset;
offset += count_universe_instances(*it, target_univ_id);
}
@ -202,9 +176,6 @@ RectLattice::RectLattice(pugi::xml_node lat_node)
if (is_3d) {pitch[2] = stod(pitch_words[2]);}
// Read the universes and make sure the correct number was specified.
int nx = n_cells[0];
int ny = n_cells[1];
int nz = n_cells[2];
std::string univ_str {get_node_value(lat_node, "universes")};
std::vector<std::string> univ_words {split(univ_str)};
if (univ_words.size() != nx*ny*nz) {
@ -217,7 +188,7 @@ RectLattice::RectLattice(pugi::xml_node lat_node)
}
// Parse the universes.
universes.resize(nx*ny*nz, -1);
universes.resize(nx*ny*nz, C_NONE);
for (int iz = 0; iz < nz; iz++) {
for (int iy = ny-1; iy > -1; iy--) {
for (int ix = 0; ix < nx; ix++) {
@ -234,9 +205,6 @@ RectLattice::RectLattice(pugi::xml_node lat_node)
int32_t&
RectLattice::operator[](const int i_xyz[3])
{
int nx = n_cells[0];
int ny = n_cells[1];
int nz = n_cells[2];
int indx = nx*ny*i_xyz[2] + nx*i_xyz[1] + i_xyz[0];
return universes[indx];
}
@ -350,9 +318,6 @@ RectLattice::get_local_xyz(const double global_xyz[3], const int i_xyz[3]) const
int32_t&
RectLattice::offset(int map, const int i_xyz[3])
{
int nx = n_cells[0];
int ny = n_cells[1];
int nz = n_cells[2];
return offsets[nx*ny*nz*map + nx*ny*i_xyz[2] + nx*i_xyz[1] + i_xyz[0]];
}
@ -361,8 +326,6 @@ RectLattice::offset(int map, const int i_xyz[3])
std::string
RectLattice::index_to_string(int indx) const
{
int nx {n_cells[0]};
int ny {n_cells[1]};
int iz {indx / (nx * ny)};
int iy {(indx - nx * ny * iz) / nx};
int ix {indx - nx * ny * iz - nx * iy};
@ -384,14 +347,14 @@ RectLattice::to_hdf5_inner(hid_t lat_group) const
// Write basic lattice information.
write_string(lat_group, "type", "rectangular", false);
if (is_3d) {
write_double_1D(lat_group, "pitch", pitch);
write_double_1D(lat_group, "lower_left", lower_left);
write_double(lat_group, "pitch", pitch, false);
write_double(lat_group, "lower_left", lower_left, false);
write_int(lat_group, "dimension", n_cells, false);
} else {
std::array<double, 2> pitch_short {{pitch[0], pitch[1]}};
write_double_1D(lat_group, "pitch", pitch_short);
write_double(lat_group, "pitch", pitch_short, false);
std::array<double, 2> ll_short {{lower_left[0], lower_left[1]}};
write_double_1D(lat_group, "lower_left", ll_short);
write_double(lat_group, "lower_left", ll_short, false);
std::array<int, 2> nc_short {{n_cells[0], n_cells[1]}};
write_int(lat_group, "dimension", nc_short, false);
}
@ -480,7 +443,6 @@ HexLattice::HexLattice(pugi::xml_node lat_node)
if (is_3d) {pitch[1] = stod(pitch_words[1]);}
// Read the universes and make sure the correct number was specified.
//int n_univ = (2*n_rings - 1) * (2*n_rings - 1) * n_axial;
int n_univ = (3*n_rings*n_rings - 3*n_rings + 1) * n_axial;
std::string univ_str {get_node_value(lat_node, "universes")};
std::vector<std::string> univ_words {split(univ_str)};
@ -502,7 +464,7 @@ HexLattice::HexLattice(pugi::xml_node lat_node)
// in a manner that matches the input order. Note that i_x = 0, i_a = 0
// corresponds to the center of the hexagonal lattice.
universes.resize((2*n_rings-1) * (2*n_rings-1) * n_axial, -1);
universes.resize((2*n_rings-1) * (2*n_rings-1) * n_axial, C_NONE);
int input_index = 0;
for (int m = 0; m < n_axial; m++) {
// Initialize lattice indecies.
@ -599,19 +561,11 @@ HexLattice::operator[](const int i_xyz[3])
//==============================================================================
LatticeIter
HexLattice::begin()
{
return LatticeIter(*this, n_rings-1);
}
LatticeIter HexLattice::begin()
{return LatticeIter(*this, n_rings-1);}
//==============================================================================
ReverseLatticeIter
HexLattice::rbegin()
{
return ReverseLatticeIter(*this, universes.size()-n_rings);
}
ReverseLatticeIter HexLattice::rbegin()
{return ReverseLatticeIter(*this, universes.size()-n_rings);}
//==============================================================================
@ -625,6 +579,8 @@ HexLattice::are_valid_indices(const int i_xyz[3]) const
&& (i_xyz[2] < n_axial));
}
//==============================================================================
std::pair<double, std::array<int, 3>>
HexLattice::distance(const double xyz[3], const double uvw[3],
const int i_xyz[3]) const
@ -872,13 +828,13 @@ HexLattice::to_hdf5_inner(hid_t lat_group) const
write_int(lat_group, 0, nullptr, "n_rings", &n_rings, false);
write_int(lat_group, 0, nullptr, "n_axial", &n_axial, false);
if (is_3d) {
write_double_1D(lat_group, "pitch", pitch);
write_double_1D(lat_group, "center", center);
write_double(lat_group, "pitch", pitch, false);
write_double(lat_group, "center", center, false);
} else {
std::array<double, 1> pitch_short {{pitch[0]}};
write_double_1D(lat_group, "pitch", pitch_short);
write_double(lat_group, "pitch", pitch_short, false);
std::array<double, 2> center_short {{center[0], center[1]}};
write_double_1D(lat_group, "center", center_short);
write_double(lat_group, "center", center_short, false);
}
// Write the universe ids.
@ -976,9 +932,7 @@ extern "C" {
}
int32_t lattice_offset(Lattice *lat, int map, const int i_xyz[3])
{
return lat->offset(map, i_xyz);
}
{return lat->offset(map, i_xyz);}
int32_t lattice_outer(Lattice *lat) {return lat->outer;}

View file

@ -3,11 +3,11 @@
#include <array>
#include <cstdint>
#include <limits> // For numeric_limits
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
#include "constants.h"
#include "hdf5.h"
#include "pugixml/pugixml.hpp"
@ -24,30 +24,27 @@ constexpr int32_t NO_OUTER_UNIVERSE{-1};
// Global variables
//==============================================================================
//extern "C" int32_t n_lattice;
class Lattice;
//extern Lattice **lattices_c;
extern std::vector<Lattice*> lattices_c;
extern std::map<int32_t, int32_t> lattice_dict;
extern std::unordered_map<int32_t, int32_t> lattice_dict;
//==============================================================================
//! Abstract type for ordered array of universes.
//! \class Lattice
//! \brief Abstract type for ordered array of universes.
//==============================================================================
class LatticeIter;
class ReverseLatticeIter;
class Lattice
{
public:
int32_t id; //!< Universe ID number
std::string name; //!< User-defined name
std::vector<int32_t> universes; //!< Universes filling each lattice tile
int32_t outer{NO_OUTER_UNIVERSE}; //!< Universe tiled outside the lattice
std::vector<int32_t> offsets; //!< Distribcell offset table
int32_t id; //!< Universe ID number
std::string name; //!< User-defined name
std::vector<int32_t> universes; //!< Universes filling each lattice tile
int32_t outer {NO_OUTER_UNIVERSE}; //!< Universe tiled outside the lattice
std::vector<int32_t> offsets; //!< Distribcell offset table
explicit Lattice(pugi::xml_node lat_node);
@ -65,17 +62,19 @@ public:
void adjust_indices();
//! Allocate offset table for distribcell.
void allocate_offset_table(int n_maps);
void allocate_offset_table(int n_maps)
{offsets.resize(n_maps * universes.size(), C_NONE);}
//! Populate the distribcell offset tables.
int32_t fill_offset_table(int32_t offset, int32_t target_univ_id, int map);
//! Check lattice indices.
//! \brief Check lattice indices.
//! @param i_xyz[3] The indices for a lattice tile.
//! @return true if the given indices fit within the lattice bounds. False
//! otherwise.
virtual bool are_valid_indices(const int i_xyz[3]) const = 0;
//! Find the next lattice surface crossing
//! \brief Find the next lattice surface crossing
//! @param xyz[3] A 3D Cartesian coordinate.
//! @param uvw[3] A 3D Cartesian direction.
//! @param i_xyz[3] The indices for a lattice tile.
@ -85,45 +84,43 @@ public:
distance(const double xyz[3], const double uvw[3], const int i_xyz[3]) const
= 0;
//! Find the lattice tile indices for a given point.
//! \brief Find the lattice tile indices for a given point.
//! @param xyz[3] A 3D Cartesian coordinate.
//! @return An array containing the indices of a lattice tile.
virtual std::array<int, 3> get_indices(const double xyz[3]) const = 0;
//! Get coordinates local to a lattice tile.
//! \brief Get coordinates local to a lattice tile.
//! @param global_xyz[3] A 3D Cartesian coordinate.
//! @param i_xyz[3] The indices for a lattice tile.
//! @return Local 3D Cartesian coordinates.
virtual std::array<double, 3>
get_local_xyz(const double global_xyz[3], const int i_xyz[3]) const = 0;
//! Check flattened lattice index.
//! \brief Check flattened lattice index.
//! @param indx The index for a lattice tile.
//! @return true if the given index fit within the lattice bounds. False
//! otherwise.
virtual bool is_valid_index(int indx) const
{
return (indx >= 0) && (indx < universes.size());
}
{return (indx >= 0) && (indx < universes.size());}
//! Get the distribcell offset for a lattice tile.
//! \brief Get the distribcell offset for a lattice tile.
//! @param The map index for the target cell.
//! @param i_xyz[3] The indices for a lattice tile.
//! @return Distribcell offset i.e. the largest instance number for the target
//! cell found in the geometry tree under this lattice tile.
virtual int32_t& offset(int map, const int i_xyz[3]) = 0;
//! Convert an array index to a useful human-readable string.
//! \brief Convert an array index to a useful human-readable string.
//! @param indx The index for a lattice tile.
//! @return A string representing the lattice tile.
virtual std::string index_to_string(int indx) const = 0;
//! Write all information needed to reconstruct the lattice to an HDF5 group.
//! \brief Write lattice information to an HDF5 group.
//! @param group_id An HDF5 group id.
void to_hdf5(hid_t group_id) const;
protected:
bool is_3d; //! Has divisions along the z-axis
bool is_3d; //!< Has divisions along the z-axis?
virtual void to_hdf5_inner(hid_t group_id) const = 0;
};
@ -135,7 +132,6 @@ protected:
class LatticeIter
{
public:
int indx; //!< An index to a Lattice universes or offsets array.
LatticeIter(Lattice &lat_, int indx_)
@ -143,20 +139,11 @@ public:
indx(indx_)
{}
bool operator==(const LatticeIter &rhs)
{
return (indx == rhs.indx);
}
bool operator==(const LatticeIter &rhs) {return (indx == rhs.indx);}
bool operator!=(const LatticeIter &rhs)
{
return !(*this == rhs);
}
bool operator!=(const LatticeIter &rhs) {return !(*this == rhs);}
int32_t& operator*()
{
return lat.universes[indx];
}
int32_t& operator*() {return lat.universes[indx];}
LatticeIter& operator++()
{
@ -194,7 +181,6 @@ public:
}
};
//==============================================================================
//==============================================================================
class RectLattice : public Lattice
@ -202,8 +188,6 @@ class RectLattice : public Lattice
public:
explicit RectLattice(pugi::xml_node lat_node);
virtual ~RectLattice() {}
int32_t& operator[](const int i_xyz[3]);
bool are_valid_indices(const int i_xyz[3]) const;
@ -222,13 +206,17 @@ public:
void to_hdf5_inner(hid_t group_id) const;
protected:
private:
std::array<int, 3> n_cells; //!< Number of cells along each axis
std::array<double, 3> lower_left; //!< Global lower-left corner of the lattice
std::array<double, 3> pitch; //!< Lattice tile width along each axis
// Convenience aliases
int &nx {n_cells[0]};
int &ny {n_cells[1]};
int &nz {n_cells[2]};
};
//==============================================================================
//==============================================================================
class HexLattice : public Lattice
@ -236,8 +224,6 @@ class HexLattice : public Lattice
public:
explicit HexLattice(pugi::xml_node lat_node);
virtual ~HexLattice() {}
int32_t& operator[](const int i_xyz[3]);
LatticeIter begin();
@ -262,7 +248,7 @@ public:
void to_hdf5_inner(hid_t group_id) const;
protected:
private:
int n_rings; //!< Number of radial tile positions
int n_axial; //!< Number of axial tile positions
std::array<double, 3> center; //!< Global center of lattice

View file

@ -176,7 +176,7 @@ contains
call write_attribute(geom_group, "n_cells", n_cells)
call write_attribute(geom_group, "n_surfaces", n_surfaces)
call write_attribute(geom_group, "n_universes", n_universes)
call write_attribute(geom_group, "n_lattices", n_lattices)
call write_attribute(geom_group, "n_lattices", size(lattices))
! ==========================================================================
! WRITE INFORMATION ON CELLS
@ -292,7 +292,7 @@ contains
lattices_group = create_group(geom_group, "lattices")
do i = 1, n_lattices
do i = 1, size(lattices)
lat => lattices(i)%obj
call lat % to_hdf5(lattices_group)
end do

View file

@ -318,7 +318,7 @@ void SurfaceXPlane::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "x-plane", false);
std::array<double, 1> coeffs {{x0}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
bool SurfaceXPlane::periodic_translate(PeriodicSurface *other, double xyz[3],
@ -383,7 +383,7 @@ void SurfaceYPlane::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "y-plane", false);
std::array<double, 1> coeffs {{y0}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
bool SurfaceYPlane::periodic_translate(PeriodicSurface *other, double xyz[3],
@ -449,7 +449,7 @@ void SurfaceZPlane::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "z-plane", false);
std::array<double, 1> coeffs {{z0}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
bool SurfaceZPlane::periodic_translate(PeriodicSurface *other, double xyz[3],
@ -510,7 +510,7 @@ void SurfacePlane::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "plane", false);
std::array<double, 4> coeffs {{A, B, C, D}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
bool SurfacePlane::periodic_translate(PeriodicSurface *other, double xyz[3],
@ -642,7 +642,7 @@ void SurfaceXCylinder::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "x-cylinder", false);
std::array<double, 3> coeffs {{y0, z0, r}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
//==============================================================================
@ -676,7 +676,7 @@ void SurfaceYCylinder::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "y-cylinder", false);
std::array<double, 3> coeffs {{x0, z0, r}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
//==============================================================================
@ -710,7 +710,7 @@ void SurfaceZCylinder::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "z-cylinder", false);
std::array<double, 3> coeffs {{x0, y0, r}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
//==============================================================================
@ -781,7 +781,7 @@ void SurfaceSphere::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "sphere", false);
std::array<double, 4> coeffs {{x0, y0, z0, r}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
//==============================================================================
@ -898,7 +898,7 @@ void SurfaceXCone::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "x-cone", false);
std::array<double, 4> coeffs {{x0, y0, z0, r_sq}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
//==============================================================================
@ -932,7 +932,7 @@ void SurfaceYCone::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "y-cone", false);
std::array<double, 4> coeffs {{x0, y0, z0, r_sq}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
//==============================================================================
@ -966,7 +966,7 @@ void SurfaceZCone::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "z-cone", false);
std::array<double, 4> coeffs {{x0, y0, z0, r_sq}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
//==============================================================================
@ -1060,7 +1060,7 @@ void SurfaceQuadric::to_hdf5_inner(hid_t group_id) const
{
write_string(group_id, "type", "quadric", false);
std::array<double, 10> coeffs {{A, B, C, D, E, F, G, H, J, K}};
write_double_1D(group_id, "coefficients", coeffs);
write_double(group_id, "coefficients", coeffs, false);
}
//==============================================================================