1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2004-2005 by Blender Foundation
17  * All rights reserved.
18  */
19 
20 /** \file
21  * \ingroup DNA
22  */
23 
24 #pragma once
25 
26 #include "DNA_ID.h"
27 #include "DNA_defs.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct Ipo;
34 
35 typedef struct FluidVertexVelocity {
36   float vel[3];
37 } FluidVertexVelocity;
38 
39 typedef struct FluidsimSettings {
40   /** For fast RNA access. */
41   struct FluidsimModifierData *fmd;
42   /* threadcont the calculation is done with */
43   int threads;
44   char _pad1[4];
45   /* domain, fluid or obstacle */
46   short type;
47   /* display advanced options in fluid sim tab (on=1, off=0)*/
48   short show_advancedoptions;
49 
50   /* domain object settings */
51   /* resolutions */
52   short resolutionxyz;
53   short previewresxyz;
54   /* size of the domain in real units (meters along largest resolution x, y, z extent) */
55   float realsize;
56   /* show original meshes, preview or final sim */
57   short guiDisplayMode;
58   short renderDisplayMode;
59 
60   /* fluid properties */
61   float viscosityValue;
62   short viscosityMode DNA_DEPRECATED;
63   short viscosityExponent;
64   /* gravity strength */
65   float grav[3];
66   /* anim start end time (in seconds) */
67   float animStart, animEnd;
68   /* bake start end time (in blender frames) */
69   int bakeStart, bakeEnd;
70   /* offset for baked frames */
71   int frameOffset;
72   char _pad2[4];
73   /* g star param (LBM compressibility) */
74   float gstar;
75   /* activate refinement? */
76   int maxRefine;
77 
78   /* fluid object type settings */
79   /* gravity strength */
80   float iniVelx, iniVely, iniVelz;
81 
82   /* store output path, and file prefix for baked fluid surface */
83   /* strlens; 256= FILE_MAXFILE, 768= FILE_MAXDIR */
84   char surfdataPath[1024];
85 
86   /* store start coords of axis aligned bounding box together with size */
87   /* values are inited during derived mesh display */
88   float bbStart[3], bbSize[3];
89 
90   /* animated params */
91   struct Ipo *ipo;
92 
93   /* additional flags depending on the type, lower short contains flags
94    * to check validity, higher short additional flags */
95   short typeFlags;
96   /**
97    * Switch off velocity generation,
98    * volume init type for fluid/obstacles (volume=1, shell=2, both=3).
99    */
100   char domainNovecgen, volumeInitType;
101 
102   /* boundary "stickiness" for part slip values */
103   float partSlipValue;
104 
105   /* number of tracers to generate */
106   int generateTracers;
107   /* particle generation - on if >0, then determines amount (experimental...) */
108   float generateParticles;
109   /* smooth fluid surface? */
110   float surfaceSmoothing;
111   /** Number of surface subdivisions. */
112   int surfaceSubdivs;
113   /** GUI flags. */
114   int flag;
115 
116   /** Particle display - size scaling, and alpha influence. */
117   float particleInfSize, particleInfAlpha;
118   /* testing vars */
119   float farFieldSize;
120 
121   /** Vertex velocities of simulated fluid mesh. */
122   struct FluidVertexVelocity *meshVelocities;
123   /** Number of vertices in simulated fluid mesh. */
124   int totvert;
125 
126   /* Fluid control settings */
127   float cpsTimeStart;
128   float cpsTimeEnd;
129   float cpsQuality;
130 
131   float attractforceStrength;
132   float attractforceRadius;
133   float velocityforceStrength;
134   float velocityforceRadius;
135 
136   int lastgoodframe;
137 
138   /** Simulation/flow rate control (i.e. old "Fac-Time"). */
139   float animRate;
140 } FluidsimSettings;
141 
142 /* ob->fluidsimSettings defines */
143 #define OB_FLUIDSIM_ENABLE 1
144 #define OB_FLUIDSIM_DOMAIN 2
145 #define OB_FLUIDSIM_FLUID 4
146 #define OB_FLUIDSIM_OBSTACLE 8
147 #define OB_FLUIDSIM_INFLOW 16
148 #define OB_FLUIDSIM_OUTFLOW 32
149 #define OB_FLUIDSIM_PARTICLE 64
150 #define OB_FLUIDSIM_CONTROL 128
151 
152 #define OB_TYPEFLAG_START 7
153 #define OB_FSGEO_THIN (1 << (OB_TYPEFLAG_START + 1))
154 #define OB_FSBND_NOSLIP (1 << (OB_TYPEFLAG_START + 2))
155 #define OB_FSBND_PARTSLIP (1 << (OB_TYPEFLAG_START + 3))
156 #define OB_FSBND_FREESLIP (1 << (OB_TYPEFLAG_START + 4))
157 #define OB_FSINFLOW_LOCALCOORD (1 << (OB_TYPEFLAG_START + 5))
158 
159 /* surface generation flag (part of enabling chapter 6 of
160  * "Free Surface Flows with Moving and Deforming Objects for LBM") */
161 #define OB_FSSG_NOOBS (1 << (OB_TYPEFLAG_START + 6))
162 
163 // guiDisplayMode particle flags
164 #define OB_FSDOM_GEOM 1
165 #define OB_FSDOM_PREVIEW 2
166 #define OB_FSDOM_FINAL 3
167 #define OB_FSPART_BUBBLE (1 << 1)
168 #define OB_FSPART_DROP (1 << 2)
169 #define OB_FSPART_NEWPART (1 << 3)
170 #define OB_FSPART_FLOAT (1 << 4)
171 #define OB_FSPART_TRACER (1 << 5)
172 
173 // new fluid bit flags for fss->flags
174 #define OB_FLUIDSIM_REVERSE (1 << 0)
175 #define OB_FLUIDSIM_ACTIVE (1 << 1)
176 #define OB_FLUIDSIM_OVERRIDE_TIME (1 << 2)
177 
178 #ifdef __cplusplus
179 }
180 #endif
181