summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c++/descriptor.hpp3
-rw-r--r--c++/macroscopic.hpp12
-rw-r--r--examples/cavity_2d.cpp6
3 files changed, 13 insertions, 8 deletions
diff --git a/c++/descriptor.hpp b/c++/descriptor.hpp
index aa8c943..b1ee5b1 100644
--- a/c++/descriptor.hpp
+++ b/c++/descriptor.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <forstio/codec/data.hpp>
+#include <forstio/codec/schema_factory.hpp>
namespace kel {
namespace lbm {
@@ -164,10 +165,12 @@ public:
factory_struct_{inp}
{}
+ /*
template<typename TA, saw::string_literal KA>
constexpr auto require() const noexcept {
return {factory_struct_.add_maybe()};
}
+ */
};
}
diff --git a/c++/macroscopic.hpp b/c++/macroscopic.hpp
index 608b89e..43c727b 100644
--- a/c++/macroscopic.hpp
+++ b/c++/macroscopic.hpp
@@ -1,18 +1,20 @@
#pragma once
+#include "descriptor.hpp"
+
namespace kel {
namespace lbm {
/**
* Calculate the macroscopic variables rho and u in Lattice Units.
*/
-template<typename Desc>
+template<typename T, typename Desc>
void compute_rho_u (
- const saw::data<sch::DfCell<Desc>>& dfs,
- typename saw::native_data_type<sch::T>::type& rho,
- std::array<typename saw::native_data_type<sch::T>::type, 2>& vel
+ saw::data<sch::Cell<T, Desc, 0, 0, 1>>& dfs,
+ typename saw::native_data_type<T>::type& rho,
+ std::array<typename saw::native_data_type<T>::type, 2>& vel
)
{
- using dfi = df_info<sch::T, Desc>;
+ using dfi = df_info<T, Desc>;
rho = 0;
std::fill(vel.begin(), vel.end(), 0);
diff --git a/examples/cavity_2d.cpp b/examples/cavity_2d.cpp
index 5085635..55223a4 100644
--- a/examples/cavity_2d.cpp
+++ b/examples/cavity_2d.cpp
@@ -193,7 +193,7 @@ public:
void apply(saw::data<sch::DfCell<Desc>>& dfs){
typename saw::native_data_type<sch::T>::type rho;
std::array<typename saw::native_data_type<sch::T>::type, Desc::D> vel;
- compute_rho_u<Desc>(dfs,rho,vel);
+ compute_rho_u<sch::T,Desc>(dfs,rho,vel);
auto eq = equilibrium<Desc>(rho,vel);
for(uint64_t i = 0u; i < Desc::Q; ++i){
@@ -420,7 +420,7 @@ int main(){
auto& dfs = cell.template get<"dfs">();
typename saw::native_data_type<sch::T>::type rho;
std::array<typename saw::native_data_type<sch::T>::type, sch::D2Q9::D> vel;
- compute_rho_u<sch::D2Q9>(dfs,rho,vel);
+ compute_rho_u<sch::T,sch::D2Q9>(dfs,rho,vel);
if(i > 1 && (i+2) < dim_x && j > 1 && (j+2) < dim_y){
sum += rho;
@@ -517,7 +517,7 @@ int main(){
typename saw::native_data_type<sch::T>::type rho;
std::array<typename saw::native_data_type<sch::T>::type, sch::D2Q9::D> vel;
- compute_rho_u<sch::D2Q9>(dfs,rho,vel);
+ compute_rho_u<sch::T,sch::D2Q9>(dfs,rho,vel);
vtk_file << static_cast<float>(vel[0u]) << " " << static_cast<float>(vel[1u])<<" 0.0\n";
}, lattice);