PeriDyno 1.0.0
Loading...
Searching...
No Matches
VolumeBoundary.cpp
Go to the documentation of this file.
1#include "VolumeBoundary.h"
2
4
5namespace dyno
6{
7 template<typename TDataType>
9 : Node()
10 {
11 mBoundaryConstraint = std::make_shared<BoundaryConstraint<TDataType>>();
12
13 this->varNormalFriction()->attach(
14 std::make_shared<FCallBackFunc>(
15 [=]() {
16 mBoundaryConstraint->varNormalFriction()->setValue(this->varNormalFriction()->getValue());
17 }));
18
19 this->varTangentialFriction()->attach(
20 std::make_shared<FCallBackFunc>(
21 [=]() {
22 mBoundaryConstraint->varTangentialFriction()->setValue(this->varTangentialFriction()->getValue());
23 }));
24
25 this->varNormalFriction()->setValue(0.95f);
26 this->varTangentialFriction()->setValue(0.0f);
27 }
28
29 template<typename TDataType>
33
34 template<typename TDataType>
36 {
37 Real dt = this->stateTimeStep()->getValue();
38
39 auto volumes = this->getVolumes();
40
41 for (size_t t = 0; t < volumes.size(); t++)
42 {
43 auto levelset = volumes[t]->stateLevelSet()->getDataPtr();
44
45 auto pSys = this->getParticleSystems();
46
47 for (int i = 0; i < pSys.size(); i++)
48 {
49 auto posFd = pSys[i]->statePosition();
50 auto velFd = pSys[i]->stateVelocity();
51
52 if(!posFd->isEmpty() && !velFd->isEmpty())
53 mBoundaryConstraint->constrain(posFd->getData(), velFd->getData(), levelset->getSDF(), dt);
54 }
55
56 auto triSys = this->getTriangularSystems();
57 for (int i = 0; i < triSys.size(); i++)
58 {
59 auto posFd = triSys[i]->statePosition();
60 auto velFd = triSys[i]->stateVelocity();
61
62 if (!posFd->isEmpty() && !velFd->isEmpty())
63 mBoundaryConstraint->constrain(posFd->getData(), velFd->getData(), levelset->getSDF(), dt);
64 }
65
66 auto tetSys = this->getTetrahedralSystems();
67 for (int i = 0; i < tetSys.size(); i++)
68 {
69 auto posFd = tetSys[i]->statePosition();
70 auto velFd = tetSys[i]->stateVelocity();
71
72 if (!posFd->isEmpty() && !velFd->isEmpty())
73 mBoundaryConstraint->constrain(posFd->getData(), velFd->getData(), levelset->getSDF(), dt);
74 }
75 }
76 }
77
78 template<typename TDataType>
83
85}
#define DEFINE_CLASS(name)
Definition Object.h:140
TDataType::Real Real
void updateStates() override
std::shared_ptr< BoundaryConstraint< TDataType > > mBoundaryConstraint
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25