#include "bbcreaMaracasVisuManualPaint_Model.h"
#include "bbcreaMaracasVisuPackage.h"
+#include <omp.h>
+
namespace bbcreaMaracasVisu
{
long int index, size=dimX*dimY*dimZ;
+printf("EED ManualPaint_Model::Process A.start\n");
+std::vector<int> lstX;
+std::vector<int> lstY;
+std::vector<int> lstZ;
+ int i,j,k;
+ double value1;
+ double value2;
+ for (index=0; index<size; index++)
+ {
+ GETVALUE2_VTK_CREA(value1,pBIP,sTBIP,index)
+ if (value1>0)
+ {
+ GETVALUE2_VTK_CREA(value2,pI2,sTI2,index)
+ if (value2==0)
+ {
+ i = index % dimX;
+ j = (index % (dimX*dimY)) / dimX;
+ k = index / (dimX*dimY);
+ lstX.push_back(i);
+ lstY.push_back(j);
+ lstZ.push_back(k);
+ } // if value2
+ } // if value1
+ } // for
+printf("EED ManualPaint_Model::Process B.end\n");
+
+size=lstX.size();
long int k1omp=(double)(size-1)*0.0;
long int k2omp=(double)(size-1)*0.2;
long int k3omp=(double)(size-1)*0.4;
long int k4omp=(double)(size-1)*0.6;
long int k5omp=(double)(size-1)*0.8;
long int k6omp=(double)(size-1)*1.0;
-printf("EED ManualPaint_Model::Process ByImagePoints (with openmp) size=%d GrayLevel=%f\n",size,(double)bbGetInputGrayLevel());
-#pragma omp parallel for
+printf("EED ManualPaint_Model::Process ByImagePoints (with openmp) size=%d GrayLevel=%f this=%p\n",size,(double)bbGetInputGrayLevel(),this);
+//omp_set_num_threads( omp_get_max_threads()-1 );
+#pragma omp parallel for
+ for (index=0; index<size; index++)
+ {
+ if ( (k1omp==index) || (k2omp==index) || (k3omp==index) ||
+ (k4omp==index) || (k5omp==index) || (k6omp==index) )
+ {
+ if (size==1)
+ {
+ printf(" 100% (just one element)\n");
+ } else {
+ printf(" %d%% omp_get_num_threads=%d\n", (int)(((double)index/(double)(size-1))*100 ), omp_get_num_threads() );
+ }
+ }// if K#omp
+// double value1;
+// GETVALUE2_VTK_CREA(value1,pBIP,sTBIP,index)
+// if (value1>0)
+// {
+// double value2;
+// GETVALUE2_VTK_CREA(value2,pI2,sTI2,index)
+// if (value2==0)
+// {
+// int i = index % dimX;
+// int j = (index % (dimX*dimY)) / dimX;
+// int k = index / (dimX*dimY);
+ manualpaintmodel->PaintImage(lstX[index],lstY[index],lstZ[index]);
+// // manualpaintmodel->SetUndoImage(); // Probably needed. Here is ok.
+// } // vI2
+// } // vBIP
+ } // for index END openmp
+ manualpaintmodel->Copy_GeneralAuxFill_to_Results();
+
+
+
+
+
+
+
+/* openmp
+long int k1omp=(double)(size-1)*0.0;
+long int k2omp=(double)(size-1)*0.2;
+long int k3omp=(double)(size-1)*0.4;
+long int k4omp=(double)(size-1)*0.6;
+long int k5omp=(double)(size-1)*0.8;
+long int k6omp=(double)(size-1)*1.0;
+printf("EED ManualPaint_Model::Process ByImagePoints (with openmp) size=%d GrayLevel=%f this=%p\n",size,(double)bbGetInputGrayLevel(),this);
+omp_set_num_threads( omp_get_max_threads()-1 );
+#pragma omp parallel for
for (index=0; index<size; index++)
{
if ( (k1omp==index) || (k2omp==index) || (k3omp==index) ||
{
printf(" 100% (just one element)\n");
} else {
- printf(" %d% \n", (int)(((double)index/(double)(size-1))*100 ));
+ printf(" %d%% omp_get_num_threads=%d\n", (int)(((double)index/(double)(size-1))*100 ), omp_get_num_threads() );
}
}// if K#omp
double value1;
// manualpaintmodel->SetUndoImage(); // Probably needed. Here is ok.
} // vI2
} // vBIP
- } // for index
+ } // for index END openmp
manualpaintmodel->Copy_GeneralAuxFill_to_Results();
+*/
/*
int i,j,k;