commit abeed670d7f49bf2801ca628880a00082e1bb67c
parent 7f7950775af57b0e1c49a40e81c5f7ecf0b2c997
Author: Fabian Wermelinger <fabianw@mavt.ethz.ch>
Date: Sat, 10 Jun 2017 01:55:11 -0700
definition of states is problem dependent and belongs here
Diffstat:
9 files changed, 38 insertions(+), 36 deletions(-)
diff --git a/src/bubbleDynamics.cpp b/src/bubbleDynamics.cpp
@@ -118,8 +118,10 @@ int main(int argc, const char** argv)
// set up solution vector
#if (_POS_STATE_ && _USE_EIGEN_)
+ typedef State<Real,8> State8;
using vec_t = StateVector<State8>;
#else
+ typedef State<Real,2> State2;
using vec_t = StateVector<State2>;
#endif
vec_t U(simConfig.Nbubbles);
diff --git a/src/kernels/KMClusterPositions_D.h b/src/kernels/KMClusterPositions_D.h
@@ -60,7 +60,7 @@ public:
infile >> data.R0[i];
infile >> data.Rdot0[i];
- State8& IC = U[i];
+ typename Tinput::DataType& IC = U[i];
IC[0] = data.R0[i];
IC[1] = data.Rdot0[i];
IC[2] = b.pos[0];
@@ -106,14 +106,14 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State8& Ui = U[i];
+ const typename Tinput::DataType& Ui = U[i];
const Bubble bi = {Ui[2], Ui[4], Ui[6]};
// fill row i of A
Real bnbr = 0;
std::vector<Real> bnbrp(3,0.0);
for (size_t j = 0; j < _N; ++j)
{
- const State8& Uj = U[j];
+ const typename Tinput::DataType& Uj = U[j];
if (i == j)
{
A(i,j) = (static_cast<Real>(1) - Ui[1]*clInv)*Ui[0] + static_cast<Real>(4.0)*bd.nuL*clInv;
@@ -283,8 +283,8 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State8& Ui = U[i];
- State8& ri = rhs[i];
+ const typename Tinput::DataType& Ui = U[i];
+ typename Trhs::DataType& ri = rhs[i];
ri[0] = Ui[1];
ri[1] = Rddot(i);
ri[2] = Ui[3];
diff --git a/src/kernels/KMCluster_FC.h b/src/kernels/KMCluster_FC.h
@@ -58,7 +58,7 @@ public:
infile >> data.R0[i];
infile >> data.Rdot0[i];
- State2& IC = U[i];
+ typename Tinput::DataType& IC = U[i];
IC[0] = data.R0[i];
IC[1] = data.Rdot0[i];
}
@@ -97,13 +97,13 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State2& Ui = U[i];
+ const typename Tinput::DataType& Ui = U[i];
// fill row i of A
Real bnbr = 0;
Real bnbr2 = 0;
for (size_t j = 0; j < _N; ++j)
{
- const State2& Uj = U[j];
+ const typename Tinput::DataType& Uj = U[j];
if (i == j)
A(i,j) = (static_cast<Real>(1) - Ui[1]*clInv)*Ui[0] + static_cast<Real>(4.0)*bd.nuL*clInv;
else
@@ -141,8 +141,8 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State2& Ui = U[i];
- State2& ri = rhs[i];
+ const typename Tinput::DataType& Ui = U[i];
+ typename Trhs::DataType& ri = rhs[i];
ri[0] = Ui[1];
ri[1] = Rddot(i);
}
diff --git a/src/kernels/KMCluster_TY.h b/src/kernels/KMCluster_TY.h
@@ -58,7 +58,7 @@ public:
infile >> data.R0[i];
infile >> data.Rdot0[i];
- State2& IC = U[i];
+ typename Tinput::DataType& IC = U[i];
IC[0] = data.R0[i];
IC[1] = data.Rdot0[i];
}
@@ -97,12 +97,12 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State2& Ui = U[i];
+ const typename Tinput::DataType& Ui = U[i];
// fill row i of A
Real bnbr = 0;
for (size_t j = 0; j < _N; ++j)
{
- const State2& Uj = U[j];
+ const typename Tinput::DataType& Uj = U[j];
if (i == j)
A(i,j) = (static_cast<Real>(1) - Ui[1]*clInv)*Ui[0] + static_cast<Real>(4.0)*bd.nuL*clInv;
else
@@ -137,8 +137,8 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State2& Ui = U[i];
- State2& ri = rhs[i];
+ const typename Tinput::DataType& Ui = U[i];
+ typename Trhs::DataType& ri = rhs[i];
ri[0] = Ui[1];
ri[1] = Rddot(i);
}
diff --git a/src/kernels/KellerMiksis.h b/src/kernels/KellerMiksis.h
@@ -27,7 +27,7 @@ public:
{
assert(Tinput::DataType::SIZE == 2);
assert(data.Nbubbles == 1);
- State2& IC = U[0];
+ typename Tinput::DataType& IC = U[0];
IC[0] = data.R0[0];
IC[1] = data.Rdot0[0];
}
@@ -35,8 +35,8 @@ public:
virtual void compute(const Tinput& U, Trhs& rhs, Real const t, void const* const data=nullptr)
{
const BubbleData& bd = *(BubbleData const* const)data;
- const State2& u = U[0];
- State2& r = rhs[0];
+ const typename Tinput::DataType& u = U[0];
+ typename Trhs::DataType& r = rhs[0];
assert(Tinput::DataType::SIZE == 2);
assert(u[0] > 0.0);
diff --git a/src/kernels/RPCluster.h b/src/kernels/RPCluster.h
@@ -58,7 +58,7 @@ public:
infile >> data.R0[i];
infile >> data.Rdot0[i];
- State2& IC = U[i];
+ typename Tinput::DataType& IC = U[i];
IC[0] = data.R0[i];
IC[1] = data.Rdot0[i];
}
@@ -95,12 +95,12 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State2& Ui = U[i];
+ const typename Tinput::DataType& Ui = U[i];
// fill row i of A
Real bnbr = 0;
for (size_t j = 0; j < _N; ++j)
{
- const State2& Uj = U[j];
+ const typename Tinput::DataType& Uj = U[j];
if (i == j)
A(i,j) = Ui[0];
else
@@ -131,8 +131,8 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State2& Ui = U[i];
- State2& ri = rhs[i];
+ const typename Tinput::DataType& Ui = U[i];
+ typename Trhs::DataType& ri = rhs[i];
ri[0] = Ui[1];
ri[1] = Rddot(i);
}
diff --git a/src/kernels/RPClusterPositions_D.h b/src/kernels/RPClusterPositions_D.h
@@ -57,9 +57,9 @@ public:
Bubble& b = data.coords[i];
infile >> b.pos[0] >> b.pos[1] >> b.pos[2];
infile >> data.R0[i];
- infile >> data.Rdot0[i];
+ infile >> data.Rdot0[i];
- State8& IC = U[i];
+ typename Tinput::DataType& IC = U[i];
IC[0] = data.R0[i];
IC[1] = data.Rdot0[i];
IC[2] = b.pos[0];
@@ -103,14 +103,14 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State8& Ui = U[i];
+ const typename Tinput::DataType& Ui = U[i];
const Bubble bi = {Ui[2], Ui[4], Ui[6]};
// fill row i of A
Real bnbr = 0;
std::vector<Real> bnbrp(3,0.0);
for (size_t j = 0; j < _N; ++j)
{
- const State8& Uj = U[j];
+ const typename Tinput::DataType& Uj = U[j];
if (i == j)
{
A(i,j) = Ui[0];
@@ -123,7 +123,7 @@ public:
A(ip,_N+3*i+(rr+2)%3) = static_cast<Real>(0.0);
A(ip,j) = static_cast<Real>(0.0);
}
- }
+ }
else
{
// compute distance between bubbles
@@ -263,8 +263,8 @@ public:
for (size_t i = 0; i < _N; ++i)
{
- const State8& Ui = U[i];
- State8& ri = rhs[i];
+ const typename Tinput::DataType& Ui = U[i];
+ typename Trhs::DataType& ri = rhs[i];
ri[0] = Ui[1];
ri[1] = Rddot(i);
ri[2] = Ui[3];
diff --git a/src/kernels/RayleighPlesset.h b/src/kernels/RayleighPlesset.h
@@ -27,7 +27,7 @@ public:
{
assert(Tinput::DataType::SIZE == 2);
assert(data.Nbubbles == 1);
- State2& IC = U[0];
+ typename Tinput::DataType& IC = U[0];
IC[0] = data.R0[0];
IC[1] = data.Rdot0[0];
}
@@ -35,8 +35,8 @@ public:
virtual void compute(const Tinput& U, Trhs& rhs, Real const t, void const* const data=nullptr)
{
const BubbleData& bd = *(BubbleData const* const)data;
- const State2& u = U[0];
- State2& r = rhs[0];
+ const typename Tinput::DataType& u = U[0];
+ typename Trhs::DataType& r = rhs[0];
assert(Tinput::DataType::SIZE == 2);
assert(u[0] > 0.0);
diff --git a/src/kernels/RayleighPlesset_HBGL.h b/src/kernels/RayleighPlesset_HBGL.h
@@ -27,7 +27,7 @@ public:
{
assert(Tinput::DataType::SIZE == 2);
assert(data.Nbubbles == 1);
- State2& IC = U[0];
+ typename Tinput::DataType& IC = U[0];
IC[0] = data.R0[0];
IC[1] = data.Rdot0[0];
}
@@ -35,8 +35,8 @@ public:
virtual void compute(const Tinput& U, Trhs& rhs, Real const t, void const* const data=nullptr)
{
const BubbleData& bd = *(BubbleData const* const)data;
- const State2& u = U[0];
- State2& r = rhs[0];
+ const typename Tinput::DataType& u = U[0];
+ typename Trhs::DataType& r = rhs[0];
assert(Tinput::DataType::SIZE == 2);
assert(u[0] > 0.0);