Changeset 2591


Ignore:
Timestamp:
11/02/09 14:36:31 (15 years ago)
Author:
Eric.Larour
Message:

Multithreaded ContourToMesh module.

Location:
issm/trunk/src/c
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/ContourToMeshx/ContourToMeshx.cpp

    r1904 r2591  
    11/*! \file  ContourToMeshx.c
    22 */
     3
     4#ifdef HAVE_CONFIG_H
     5        #include "config.h"
     6#else
     7#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
     8#endif
     9
    310
    411#include "./ContourToMeshx.h"
     
    1421
    1522        /*Contour:*/
    16         Contour* contouri=NULL;
    17         int      numgrids;
    18         double*  xc=NULL;
    19         double*  yc=NULL;
    2023        double*  in_nod_serial;
    2124        double   value;
     25
     26        /*threading: */
     27        ContourToMeshxThreadStruct gate;
     28        int num=1;
     29        #ifdef _MULTITHREADING_
     30        num=_NUMTHREADS_;
     31        #endif
     32
    2233
    2334        /*output: */
     
    2839        in_elem=NewVec(nel);
    2940
    30         /*Loop through all contours: */
    31         for (i=0;i<numcontours;i++){
    32                 #ifdef _ISSM_DEBUG_
    33                         printf("\nHandling contour %i/%i\n",i,numcontours);
    34                 #endif
    35                 contouri=*(contours+i);
    36                 numgrids=contouri->nods;
    37                 xc=contouri->x;
    38                 yc=contouri->y;
    39                 IsInPoly(in_nod,xc,yc,numgrids,x,y,nods,edgevalue);
    40         }
     41        /*initialize thread parameters: */
     42        gate.numcontours=numcontours;
     43        gate.contours=contours;
     44        gate.nods=nods;
     45        gate.edgevalue=edgevalue;
     46        gate.in_nod=in_nod;
     47        gate.x=x;
     48        gate.y=y;
     49
     50        /*launch the thread manager with ContourToMeshxt as a core: */
     51        LaunchThread(ContourToMeshxt,(void*)&gate,num);
     52
     53        /*Assemble in_nod: */
     54        VecAssemblyBegin(in_nod);
     55        VecAssemblyEnd(in_nod);
    4156
    4257        /*Get in_nod serialised for next operation: */
     
    5368
    5469        /*Assemble vectors: */
    55         VecAssemblyBegin(in_nod);
    56         VecAssemblyEnd(in_nod);
    5770        VecAssemblyBegin(in_elem);
    5871        VecAssemblyEnd(in_elem);
  • issm/trunk/src/c/ContourToMeshx/ContourToMeshx.h

    r1 r2591  
    1010#include "../objects/objects.h"
    1111
     12/*threading: */
     13typedef struct{
     14
     15        int numcontours;
     16        Contour** contours;
     17        int nods;
     18        int edgevalue;
     19        Vec in_nod;
     20        double* x;
     21        double* y;
     22
     23} ContourToMeshxThreadStruct;
     24
     25
    1226/* local prototypes: */
    1327int ContourToMeshx( Vec* pin_nods,Vec* pin_elem, double* index, double* x, double* y,Contour** contours,int numcontours,char* interptype,int nel,int nods, int edgevalue);
    1428
     29void* ContourToMeshxt(void* vContourToMeshxThreadStruct);
     30
     31
    1532#endif /* _CONTOURTOMESHX_H */
    1633
  • issm/trunk/src/c/ContourToNodesx/ContourToNodesx.cpp

    r1904 r2591  
    3333                xc=contouri->x;
    3434                yc=contouri->y;
    35                 IsInPoly(flags,xc,yc,numgrids,x,y,nods,edgevalue);
     35                IsInPoly(flags,xc,yc,numgrids,x,y,0,nods,edgevalue);
    3636        }
    3737
  • issm/trunk/src/c/Makefile.am

    r2549 r2591  
    263263                                        ./MeshPartitionx/MeshPartitionx.h\
    264264                                        ./ContourToMeshx/ContourToMeshx.cpp\
     265                                        ./ContourToMeshx/ContourToMeshxt.cpp\
    265266                                        ./ContourToMeshx/ContourToMeshx.h\
    266267                                        ./ContourToNodesx/ContourToNodesx.cpp\
     
    561562                                        ./MeshPartitionx/MeshPartitionx.h\
    562563                                        ./ContourToMeshx/ContourToMeshx.cpp\
     564                                        ./ContourToMeshx/ContourToMeshxt.cpp\
    563565                                        ./ContourToMeshx/ContourToMeshx.h\
    564566                                        ./Reducevectorgtosx/Reducevectorgtosx.cpp\
Note: See TracChangeset for help on using the changeset viewer.