Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Genrich <daniel.genrich@gmx.net>2007-11-26 03:57:46 +0300
committerDaniel Genrich <daniel.genrich@gmx.net>2007-11-26 03:57:46 +0300
commitc1724d3ca1fb822a5bd834b9e5f7bcd0fbc8eb41 (patch)
tree9b5929c335d0881d1e69aa6e35e1b385be4060b0 /intern/elbeem
parentbc2c9336fdb6baf21bba58e042cbd4b039e25971 (diff)
Insert revert point (segfault)
Diffstat (limited to 'intern/elbeem')
-rw-r--r--intern/elbeem/intern/isosurface.cpp57
1 files changed, 39 insertions, 18 deletions
diff --git a/intern/elbeem/intern/isosurface.cpp b/intern/elbeem/intern/isosurface.cpp
index 5d20e68ef34..0e3d37ea494 100644
--- a/intern/elbeem/intern/isosurface.cpp
+++ b/intern/elbeem/intern/isosurface.cpp
@@ -18,6 +18,8 @@
#define round(x) (x)
#endif
+#include <omp.h>
+
/******************************************************************************
* Constructor
*****************************************************************************/
@@ -400,17 +402,28 @@ void IsoSurface::triangulate( void )
debMsgStd("IsoSurface::triangulate",DM_MSG,"Starting. Parts in use:"<<pInUse<<", Subdivs:"<<mSubdivs, 9);
pz = mStart[2]-(double)(0.*gsz)-0.5*orgGsz;
-/*
+
#pragma omp parallel
{
- vector<IsoLevelVertex> mPoints;
- */
-#pragma omp parallel for
+ vector<IsoLevelVertex> calcPoints;
+ vector<unsigned int> calcIndices;
+ const int id = omp_get_thread_num();
+ const int Nthrds = omp_get_num_threads();
+
+ const int Nj = (mSizey-2);
+
+ int jstart = 0+( id * (Nj / Nthrds) );
+ int jend = 0+( (id+1) * (Nj / Nthrds) );
+
+ if(jstart<1) jstart = 1;
+ if(jend>(mSizey-2)) jend = (mSizey-2);
+
+
for(int ok=1;ok<(mSizez-2)*mSubdivs;ok++) {
pz += gsz;
const int k = ok/mSubdivs;
if(k<=0) continue; // skip zero plane
- for(int j=1;j<(mSizey-2);j++) {
+ for(int j=jstart;j<jend;j++) {
for(int i=1;i<(mSizex-2);i++) {
float value[8];
ntlVec3Gfx pos[8];
@@ -587,11 +600,8 @@ void IsoSurface::triangulate( void )
// init isolevel vertex
ilv.v = p1 + (p2-p1)*mu; // with subdivs
-#pragma omp critical
- {
- mPoints.push_back( ilv );
- triIndices[e] = (mPoints.size()-1);
- }
+ calcPoints.push_back( ilv );
+ triIndices[e] = (calcPoints.size()-1);
// store vertex
*eVert[ e ] = triIndices[e];
} else {
@@ -601,17 +611,15 @@ void IsoSurface::triangulate( void )
} // along all edges
}
// removed cutoff treatment...
-#pragma omp critical
- {
+
// Create the triangles...
for(int e=0; mcTriTable[cubeIndex][e]!=-1; e+=3) {
- mIndices.push_back( triIndices[ mcTriTable[cubeIndex][e+0] ] );
- mIndices.push_back( triIndices[ mcTriTable[cubeIndex][e+1] ] ); // with subdivs
- mIndices.push_back( triIndices[ mcTriTable[cubeIndex][e+2] ] );
+ calcIndices.push_back( triIndices[ mcTriTable[cubeIndex][e+0] ] );
+ calcIndices.push_back( triIndices[ mcTriTable[cubeIndex][e+1] ] ); // with subdivs
+ calcIndices.push_back( triIndices[ mcTriTable[cubeIndex][e+2] ] );
//errMsg("TTT"," i1"<<mIndices[mIndices.size()-3]<<" "<< " i2"<<mIndices[mIndices.size()-2]<<" "<< " i3"<<mIndices[mIndices.size()-1]<<" "<< mIndices.size() );
- }
- }
} // triangles in edge table?
+ }
}//si
}// sj
@@ -640,7 +648,20 @@ void IsoSurface::triangulate( void )
} // ok, k subdiv loop
// push_back()'s
-// }
+#pragma omp critical
+ {
+ unsigned int size = mIndices.size();
+ // remap indices
+ for(unsigned int j=0; j<calcIndices.size(); j++)
+ {
+ mIndices.push_back(calcIndices[j]+size);
+ }
+ for(unsigned int j=0; j<calcPoints.size(); j++)
+ {
+ mPoints.push_back(calcPoints[j]);
+ }
+ }
+}
//delete [] subdAr;
delete [] arppnt;