~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/smoke/intern/FLUID_3D_STATIC.cpp

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
                        field[index] = field[index + 2];
95
95
 
96
96
                        // right slab
97
 
                        index += res[0] - 1;
 
97
                        index = y * res[0] + z * slabSize + res[0] - 1;
98
98
                        field[index] = field[index - 2];
99
99
                }
100
 
 
101
 
        // fix, force top slab to only allow outwards flux
102
 
        for (int y = 0; y < res[1]; y++)
103
 
                for (int z = zBegin; z < zEnd; z++)
104
 
                {
105
 
                        // top slab
106
 
                        index = y * res[0] + z * slabSize;
107
 
                        index += res[0] - 1;
108
 
                        if(field[index]<0.) field[index] = 0.;
109
 
                        index -= 1;
110
 
                        if(field[index]<0.) field[index] = 0.;
111
 
                }
112
100
 }
113
101
 
114
102
//////////////////////////////////////////////////////////////////////
121
109
        for (int z = zBegin; z < zEnd; z++)
122
110
                for (int x = 0; x < res[0]; x++)
123
111
                {
124
 
                        // bottom slab
 
112
                        // front slab
125
113
                        index = x + z * slabSize;
126
114
                        field[index] = field[index + 2 * res[0]];
127
115
 
128
 
                        // top slab
129
 
                        index += slabSize - res[0];
 
116
                        // back slab
 
117
                        index = x + z * slabSize + slabSize - res[0];
130
118
                        field[index] = field[index - 2 * res[0]];
131
119
                }
132
 
 
133
 
        // fix, force top slab to only allow outwards flux
134
 
        for (int z = zBegin; z < zEnd; z++)
135
 
                for (int x = 0; x < res[0]; x++)
136
 
                {
137
 
                        // top slab
138
 
                        index = x + z * slabSize;
139
 
                        index += slabSize - res[0];
140
 
                        if(field[index]<0.) field[index] = 0.;
141
 
                        index -= res[0];
142
 
                        if(field[index]<0.) field[index] = 0.;
143
 
                }
144
 
                
145
120
}
146
121
 
147
122
//////////////////////////////////////////////////////////////////////
154
129
        const int cellsslab = totalCells - slabSize;
155
130
        int index;
156
131
 
157
 
        index = 0;
158
 
        if (zBegin == 0)
159
 
        for (int y = 0; y < res[1]; y++)
160
 
                for (int x = 0; x < res[0]; x++, index++)
161
 
                {
162
 
                        // front slab
163
 
                        field[index] = field[index + 2 * slabSize];
164
 
                }
165
 
 
166
 
        if (zEnd == res[2])
167
 
        {
168
 
        index = 0;
169
 
        int indexx = 0;
170
 
 
171
 
        for (int y = 0; y < res[1]; y++)
172
 
                for (int x = 0; x < res[0]; x++, index++)
173
 
                {
174
 
 
175
 
                        // back slab
176
 
                        indexx = index + cellsslab;
177
 
                        field[indexx] = field[indexx - 2 * slabSize];
178
 
                }
179
 
        
180
 
 
181
 
        // fix, force top slab to only allow outwards flux
182
 
        for (int y = 0; y < res[1]; y++)
183
 
                for (int x = 0; x < res[0]; x++)
184
 
                {
185
 
                        // top slab
186
 
                        index = x + y * res[0];
187
 
                        index += cellsslab;
188
 
                        if(field[index]<0.) field[index] = 0.;
189
 
                        index -= slabSize;
190
 
                        if(field[index]<0.) field[index] = 0.;
191
 
                }
192
 
 
193
 
        }       // zEnd == res[2]
 
132
        if (zBegin == 0) {
 
133
                for (int y = 0; y < res[1]; y++)
 
134
                        for (int x = 0; x < res[0]; x++)
 
135
                        {
 
136
                                // front slab
 
137
                                index = x + y * res[0];
 
138
                                field[index] = field[index + 2 * slabSize];
 
139
                        }
 
140
        }
 
141
 
 
142
        if (zEnd == res[2]) {
 
143
                for (int y = 0; y < res[1]; y++)
 
144
                        for (int x = 0; x < res[0]; x++)
 
145
                        {
 
146
                                // back slab
 
147
                                index = x + y * res[0] + cellsslab;
 
148
                                field[index] = field[index - 2 * slabSize];
 
149
                        }
 
150
        }
194
151
                
195
152
}
196
153