doxygen: add newline after \file
[blender.git] / intern / elbeem / intern / elbeem.cpp
index 4517e20..01e4801 100644 (file)
@@ -1,3 +1,6 @@
+/** \file
+ * \ingroup elbeem
+ */
 /******************************************************************************
  *
  * El'Beem - Free Surface Fluid Simulation with the Lattice Boltzmann Method
@@ -96,6 +99,13 @@ int elbeemInit() {
        return 0;
 }
 
+// fluidsim end
+extern "C" 
+int elbeemFree() {
+       
+       return 0;
+}
+
 // start fluidsim init
 extern "C" 
 int elbeemAddDomain(elbeemSimulationSettings *settings) {
@@ -163,11 +173,16 @@ void elbeemResetMesh(elbeemMesh *mesh) {
        /* fluid control settings */
        mesh->cpsTimeStart = 0;
        mesh->cpsTimeEnd = 0;
+       mesh->cpsQuality = 0;
        
-       mesh->attractforceStrength = 0;
-       mesh->attractforceRadius = 0;
-       mesh->velocityforceStrength = 0;
-       mesh->velocityforceRadius = 0;
+       mesh->channelSizeAttractforceStrength = 0;
+       mesh->channelAttractforceStrength = NULL;
+       mesh->channelSizeAttractforceRadius = 0;
+       mesh->channelAttractforceRadius = NULL;
+       mesh->channelSizeVelocityforceStrength = 0;
+       mesh->channelVelocityforceStrength = NULL;
+       mesh->channelSizeVelocityforceRadius = 0;
+       mesh->channelVelocityforceRadius = NULL;
 }
 
 int globalMeshCounter = 1;
@@ -192,6 +207,7 @@ int elbeemAddMesh(elbeemMesh *mesh) {
        
        ntlGeometryObjModel *obj = new ntlGeometryObjModel( );
        gpWorld->getRenderGlobals()->getSimScene()->addGeoClass( obj );
+       gpWorld->getRenderGlobals()->getRenderScene()->addGeoClass(obj);
        obj->initModel(
                        mesh->numVertices, mesh->vertices, mesh->numTriangles, mesh->triangles,
                        mesh->channelSizeVertices, mesh->channelVertices );
@@ -205,26 +221,34 @@ int elbeemAddMesh(elbeemMesh *mesh) {
        obj->setGeoInitId( mesh->parentDomainId+1 );
        obj->setGeoInitIntersect(true);
        obj->setGeoInitType(initType);
-       obj->setGeoPartSlipValue(mesh->obstaclePartslip);
+       
+       // abuse partslip value for control fluid: reverse control keys or not
+       if(initType == FGI_CONTROL)
+               obj->setGeoPartSlipValue(mesh->obstacleType);
+       else
+               obj->setGeoPartSlipValue(mesh->obstaclePartslip);
+       
        obj->setGeoImpactFactor(mesh->obstacleImpactFactor);
        
        /* fluid control features */
        obj->setCpsTimeStart(mesh->cpsTimeStart);
        obj->setCpsTimeEnd(mesh->cpsTimeEnd);
-       obj->setAttractForceStrength(mesh->attractforceStrength);
-       obj->setAttractForceRadius(mesh->attractforceRadius);
-       obj->setVelocityForceStrength(mesh->velocityforceStrength);
-       obj->setVelocityForceRadius(mesh->velocityforceRadius);
+       obj->setCpsQuality(mesh->cpsQuality);
        
        if((mesh->volumeInitType<VOLUMEINIT_VOLUME)||(mesh->volumeInitType>VOLUMEINIT_BOTH)) mesh->volumeInitType = VOLUMEINIT_VOLUME;
        obj->setVolumeInit(mesh->volumeInitType);
        // use channel instead, obj->setInitialVelocity( ntlVec3Gfx(mesh->iniVelocity[0], mesh->iniVelocity[1], mesh->iniVelocity[2]) );
+       
        obj->initChannels(
                        mesh->channelSizeTranslation, mesh->channelTranslation, 
                        mesh->channelSizeRotation,    mesh->channelRotation, 
                        mesh->channelSizeScale,       mesh->channelScale,
                        mesh->channelSizeActive,      mesh->channelActive,
-                       mesh->channelSizeInitialVel,  mesh->channelInitialVel
+                       mesh->channelSizeInitialVel,  mesh->channelInitialVel,
+                       mesh->channelSizeAttractforceStrength,  mesh->channelAttractforceStrength,
+                       mesh->channelSizeAttractforceRadius,  mesh->channelAttractforceRadius,
+                       mesh->channelSizeVelocityforceStrength,  mesh->channelVelocityforceStrength,
+                       mesh->channelSizeVelocityforceRadius,  mesh->channelVelocityforceRadius
                );
        obj->setLocalCoordInivel( mesh->localInivelCoords );
 
@@ -246,6 +270,7 @@ int elbeemSimulate(void) {
                if(getElbeemState() != SIMWORLD_STOP) {
                        // ok, we're done...
                        delete gpWorld;
+                       
                        gpWorld = NULL;
                        debMsgStd("elbeemSimulate",DM_NOTIFY, "El'Beem simulation done, time: "<<getTimeString(timeend-timestart)<<".\n", 2 ); 
                } else {