| 40 | } |
| 41 | |
| 42 | void AnimationField::step() |
| 43 | { |
| 44 | Simulation *sim = Simulation::getCurrent(); |
| 45 | TimeManager *tm = TimeManager::getCurrent(); |
| 46 | const Real t = tm->getTime(); |
| 47 | const Real dt = tm->getTimeStepSize(); |
| 48 | |
| 49 | if (t >= m_startTime && t <= m_endTime) |
| 50 | { |
| 51 | // animate particles |
| 52 | const unsigned int nModels = sim->numberOfFluidModels(); |
| 53 | for (unsigned int m = 0; m < nModels; m++) |
| 54 | { |
| 55 | FluidModel *fm = sim->getFluidModel(m); |
| 56 | const unsigned int numParticles = fm->numActiveParticles(); |
| 57 | |
| 58 | // find animated field |
| 59 | const FieldDescription *particleField = nullptr; |
| 60 | for (unsigned int j = 0; j < fm->numberOfFields(); j++) |
| 61 | { |
| 62 | const FieldDescription &field = fm->getField(j); |
| 63 | if (field.name == m_particleFieldName) |
| 64 | { |
| 65 | particleField = &field; |
| 66 | break; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | if (particleField == nullptr) |
| 71 | continue; |
| 72 | |
| 73 | #pragma omp parallel for schedule(static) default(shared) |
| 74 | for (int i = 0; i < (int)numParticles; i++) |
| 75 | { |
| 76 | const Vector3r &xi = fm->getPosition(i); |
| 77 | const Vector3r &vi = fm->getVelocity(i); |
| 78 | |
| 79 | const Eigen::Vector3d xi_double = xi.cast<double>(); |
| 80 | const Eigen::Vector3d vi_double = vi.cast<double>(); |
| 81 | |
| 82 | if (inShape(m_type, xi, m_x, m_rotation, m_scale)) |
| 83 | { |
| 84 | Eigen::Map<Vector3r> value((Real*) particleField->getFct(i)); |
| 85 | const Eigen::Vector3d value_double = Vector3r(value).cast<double>(); |
| 86 | |
| 87 | const double t_double = static_cast<double>(t); |
| 88 | const double dt_double = static_cast<double>(dt); |
| 89 | |
| 90 | te_variable vars[] = { {"t", &t_double}, {"dt", &dt_double}, |
| 91 | {"x", &xi_double[0]}, {"y", &xi_double[1]}, {"z", &xi_double[2]}, |
| 92 | {"vx", &vi_double[0]}, {"vy", &vi_double[1]}, {"vz", &vi_double[2]}, |
| 93 | {"valuex", &value_double[0]}, {"valuey", &value_double[1]}, {"valuez", &value_double[2]}, |
| 94 | }; |
| 95 | const int numVars = 11; |
| 96 | int err; |
| 97 | |
| 98 | ////////////////////////////////////////////////////////////////////////// |
| 99 | // v_x |
nothing calls this directly
no test coverage detected