Skip to content

Commit

Permalink
core/utils: Put Vector19d into namespace Utils
Browse files Browse the repository at this point in the history
  • Loading branch information
fweik committed Apr 17, 2019
1 parent c5cc181 commit d02e5bd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/core/grid_based_algorithms/lb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct LB_Parameters {

/** \name Derived parameters */
/** amplitudes of the fluctuations of the modes */
Vector19d phi;
Utils::Vector19d phi;
// Thermal energy
double kT;

Expand Down Expand Up @@ -260,7 +260,7 @@ inline void lb_get_populations(Lattice::index_t index, double *pop) {
}
}

inline void lb_set_populations(Lattice::index_t index, const Vector19d &pop) {
inline void lb_set_populations(Lattice::index_t index, const Utils::Vector19d &pop) {
for (int i = 0; i < LB_Model<>::n_veloc; ++i) {
lbfluid[i][index] = pop[i] - lbmodel.coeff[i][0] * lbpar.rho;
}
Expand Down
14 changes: 7 additions & 7 deletions src/core/grid_based_algorithms/lb_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void mpi_recv_fluid(int node, int index, double *rho, double *j, double *pi) {

void mpi_send_fluid_populations_slave(int node, int index) {
if (node == this_node) {
Vector19d populations;
Utils::Vector19d populations;
MPI_Recv(populations.data(), 19, MPI_DOUBLE, 0, SOME_TAG, comm_cart,
MPI_STATUS_IGNORE);
lb_set_populations(index, populations);
Expand All @@ -89,7 +89,7 @@ REGISTER_CALLBACK(mpi_send_fluid_populations_slave)
* @param index index of the lattice site
* @param pop local fluid population
*/
void mpi_send_fluid_populations(int node, int index, const Vector19d &pop) {
void mpi_send_fluid_populations(int node, int index, const Utils::Vector19d &pop) {
if (node == this_node) {
lb_set_populations(index, pop);
} else {
Expand Down Expand Up @@ -1060,7 +1060,7 @@ void lb_lbfluid_load_checkpoint(const std::string &filename, int binary) {
throw std::runtime_error(err_msg + "could not open file for reading.");
}

Vector19d pop;
Utils::Vector19d pop;
Utils::Vector3i ind;
auto const gridsize = lblattice.global_grid;
int saved_gridsize[3];
Expand Down Expand Up @@ -1375,13 +1375,13 @@ int lb_lbnode_get_boundary(const Utils::Vector3i &ind) {
throw std::runtime_error("LB not activated.");
}

const Vector19d lb_lbnode_get_pop(const Utils::Vector3i &ind) {
const Utils::Vector19d lb_lbnode_get_pop(const Utils::Vector3i &ind) {
if (lattice_switch == ActiveLB::GPU) {
#ifdef LB_GPU
float population[19];

lb_lbfluid_get_population(ind, population);
Vector19d p_pop;
Utils::Vector19d p_pop;
for (int i = 0; i < LBQ; ++i)
p_pop[i] = population[i];
return p_pop;
Expand All @@ -1398,7 +1398,7 @@ const Vector19d lb_lbnode_get_pop(const Utils::Vector3i &ind) {
node = lblattice.map_lattice_to_node(ind_shifted, node_grid);
index = get_linear_index(ind_shifted[0], ind_shifted[1], ind_shifted[2],
lblattice.halo_grid);
Vector19d p_pop;
Utils::Vector19d p_pop;
mpi_recv_fluid_populations(node, index, p_pop.data());
return p_pop;
#else
Expand Down Expand Up @@ -1471,7 +1471,7 @@ void lb_lbnode_set_velocity(const Utils::Vector3i &ind, const Utils::Vector3d &u
}
}

void lb_lbnode_set_pop(const Utils::Vector3i &ind, const Vector19d &p_pop) {
void lb_lbnode_set_pop(const Utils::Vector3i &ind, const Utils::Vector19d &p_pop) {
if (lattice_switch == ActiveLB::GPU) {
#ifdef LB_GPU
float population[19];
Expand Down
4 changes: 2 additions & 2 deletions src/core/grid_based_algorithms/lb_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void lb_lbnode_set_velocity(const Utils::Vector3i &ind, const Utils::Vector3d &u
/**
* @brief Set the LB fluid populations for a single node.
*/
void lb_lbnode_set_pop(const Utils::Vector3i &ind, const Vector19d &pop);
void lb_lbnode_set_pop(const Utils::Vector3i &ind, const Utils::Vector19d &pop);

/**
* @brief Get the LB time step.
Expand Down Expand Up @@ -198,7 +198,7 @@ int lb_lbnode_get_boundary(const Utils::Vector3i &ind);
/**
* @brief Get the LB fluid populations for a single node.
*/
const Vector19d lb_lbnode_get_pop(const Utils::Vector3i &ind);
const Utils::Vector19d lb_lbnode_get_pop(const Utils::Vector3i &ind);

/* IO routines */
void lb_lbfluid_print_vtk_boundary(const std::string &filename);
Expand Down
3 changes: 0 additions & 3 deletions src/core/utils/Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ template <typename T, std::size_t N> class Vector : public Utils::Array<T, N> {
}
};

template <size_t N> using VectorXd = Vector<double, N>;
using Vector19d = VectorXd<19>;

namespace Utils {
template <size_t N> using VectorXd = Vector<double, N>;
using Vector2d = VectorXd<2>;
Expand Down

0 comments on commit d02e5bd

Please sign in to comment.