Skip to content

Commit

Permalink
Merge pull request #1190 from epernod/inf_sph_PSource
Browse files Browse the repository at this point in the history
[SofaSphFluid] Clean code of ParticleSource and update scenes
  • Loading branch information
fredroy committed Oct 24, 2019
2 parents e2c4988 + bd96e06 commit a625bbc
Show file tree
Hide file tree
Showing 7 changed files with 487 additions and 404 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "CudaParticleSource.inl"
#include <sofa/core/ObjectFactory.h>
#include <sofa/core/behavior/ProjectiveConstraintSet.h>
#include <SofaSphFluid/ParticleSource.h>
#include <SofaSphFluid/ParticleSource.inl>

namespace sofa
{
Expand Down
1 change: 1 addition & 0 deletions applications/plugins/SofaSphFluid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(HEADER_FILES
${PLUGIN_SPH_SRC_DIR}/config.h.in
${PLUGIN_SPH_SRC_DIR}/ParticleSink.h
${PLUGIN_SPH_SRC_DIR}/ParticleSource.h
${PLUGIN_SPH_SRC_DIR}/ParticleSource.inl
${PLUGIN_SPH_SRC_DIR}/ParticlesRepulsionForceField.h
${PLUGIN_SPH_SRC_DIR}/ParticlesRepulsionForceField.inl
${PLUGIN_SPH_SRC_DIR}/SPHKernel.h
Expand Down
42 changes: 30 additions & 12 deletions applications/plugins/SofaSphFluid/examples/ParticleSource.scn
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
<Node dt="0.005" gravity="0 -10 0">
<RequiredPlugin name="SofaOpenglVisual"/>
<RequiredPlugin name="SofaImplicitField"/>
<?xml version="1.0" ?>
<Node dt="0.005" gravity="0 -10 0" bbox="-4 -4 -4 4 4 4">
<RequiredPlugin name="SofaOpenglVisual"/>
<RequiredPlugin name='SofaSphFluid' />
<VisualStyle displayFlags="showBehaviorModels showForceFields showWireframe" />
<Node name="Fluid">
<RungeKutta4 />
<MechanicalObject name="MModel" />
<ParticleSource name="Source" center="&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; -0.375 0 -0.75&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.0 0 -0.75&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.375 0 -0.75&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; -0.75 0 -0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; -0.375 0 -0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.0 0 -0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.375 0 -0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.75 0 -0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; -0.75 0 0.0&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; -0.375 0 0.0&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.0 0 0.0&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.375 0 0.0&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.75 0 0.0&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; -0.75 0 0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; -0.375 0 0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.0 0 0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.375 0 0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.75 0 0.375&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; -0.375 0 0.75&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.0 0 0.75&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; 0.375 0 0.75&#x0A;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09;&#x09; " translation="0 3 0" radius="0.01 0.1 0.01" velocity="0 -20 0" delay="0.01875" start="-0.1" stop="2" />
<UniformMass name="M1" vertexMass="1" />
<Node id="Visual">
<OglModel name="VModel" color="blue" />
<ImplicitSurfaceMapping name="MarchingCube" input="@../MModel" output="@VModel" isoValue="0.5" radius="0.75" step="0.25" />
</Node>

<Node name="Particles">
<EulerSolver symplectic="1" />
<MechanicalObject name="MModel" showObject="1"/>
<ParticleSource name="Source" translation="0 4 0" radius="0.01 0.1 0.01" velocity="0 -1 0" delay="0.1" start="-0.1" stop="10" printLog="0"
center="-0.375 0 -0.75
0.0 0.0 -0.75
0.375 0.0 -0.75
-0.75 0.0 -0.375
-0.375 0.0 -0.375
0.0 0.0 -0.375
0.375 0.0 -0.375
0.75 0.0 -0.375
-0.75 0.0 0.0
-0.375 0.0 0.0
0.0 0.0 0.0
0.375 0.0 0.0
0.75 0.0 0.0
-0.75 0.0 0.375
-0.375 0.0 0.375
0.0 0.0 0.375
0.375 0.0 0.375
0.75 0.0 0.375
-0.375 0.0 0.75
0.0 0.0 0.75
0.375 0.0 0.75" />
<UniformMass name="M1" vertexMass="1.0" />
</Node>
</Node>
46 changes: 46 additions & 0 deletions applications/plugins/SofaSphFluid/examples/SPHParticleSource.scn
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" ?>
<Node dt="0.01" gravity="0 -10 0" bbox="-4 -4 -4 4 4 4">
<RequiredPlugin name="SofaOpenglVisual"/>
<RequiredPlugin name='SofaSphFluid' />
<VisualStyle displayFlags="showBehaviorModels showForceFields showWireframe" />

<Node name="Particles">
<EulerSolver symplectic="1" />
<MechanicalObject name="MModel" />
<ParticleSource name="Source" translation="0 10 0" radius="0.01 0.1 0.01" velocity="0 -10 0" delay="0.02" start="-0.1" stop="4" printLog="0"
center="-0.375 0 -0.75
0.0 0.0 -0.75
0.375 0.0 -0.75
-0.75 0.0 -0.375
-0.375 0.0 -0.375
0.0 0.0 -0.375
0.375 0.0 -0.375
0.75 0.0 -0.375
-0.75 0.0 0.0
-0.375 0.0 0.0
0.0 0.0 0.0
0.375 0.0 0.0
0.75 0.0 0.0
-0.75 0.0 0.375
-0.375 0.0 0.375
0.0 0.0 0.375
0.375 0.0 0.375
0.75 0.0 0.375
-0.375 0.0 0.75
0.0 0.0 0.75
0.375 0.0 0.75" />

<UniformMass name="M1" totalMass="1.0" />
<PointSetTopologyContainer name="con" />
<PointSetTopologyModifier name="mod" />

<SpatialGridContainer cellWidth="0.75" />
<SPHFluidForceField radius="0.7" density="25" kernelType="1" viscosityType="2" viscosity="10" pressure="1000" surfaceTension="-1000" printLog="0" />

<PlaneForceField normal="1 0 0" d="-4" showPlane="1" />
<PlaneForceField normal="-1 0 0" d="-4" showPlane="1" />
<PlaneForceField normal="0.5 1 0.1" d="-4" showPlane="1" />
<PlaneForceField normal="0 0 1" d="-4" showPlane="1" />
<PlaneForceField normal="0 0 -1" d="-4" showPlane="1" />
</Node>
</Node>
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#define SOFA_COMPONENT_MISC_PARTICLESOURCE_CPP
#include "ParticleSource.h"
#include <SofaSphFluid/ParticleSource.inl>
#include <sofa/core/ObjectFactory.h>
#include <sofa/defaulttype/VecTypes.h>
#include "sofa/defaulttype/VecTypes.h"

namespace sofa
{
Expand Down
Loading

0 comments on commit a625bbc

Please sign in to comment.