| 1 | /*!\file ProcessParamsx | 
|---|
| 2 | * \brief: process parameters using partitioning vector. | 
|---|
| 3 | * Go through all parameters in the 'parameters' dataset. For each parameter that holds a doublevec (ie, a double* vector synchronized across | 
|---|
| 4 | * the MPI ring of a cluster), partition the vector so that the new node partitioning decided in ModelProcessor is applied. Otherwise, | 
|---|
| 5 | * parameters coming directly from Matlab would be serially partitioned, which means could not be recognized by each individual node or element. | 
|---|
| 6 | * The partition needs to be the parallel partitionting. | 
|---|
| 7 | */ | 
|---|
| 8 |  | 
|---|
| 9 | #include "./ProcessParamsx.h" | 
|---|
| 10 |  | 
|---|
| 11 | #include "../shared/shared.h" | 
|---|
| 12 | #include "../include/macros.h" | 
|---|
| 13 | #include "../toolkits/toolkits.h" | 
|---|
| 14 | #include "../DataSet/DataSet.h" | 
|---|
| 15 | #include "../EnumDefinitions/EnumDefinitions.h" | 
|---|
| 16 |  | 
|---|
| 17 | void ProcessParamsx( Parameters* parameters, Vec  part){ | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | int     i; | 
|---|
| 21 | double *partition        = NULL; | 
|---|
| 22 | int     numberofvertices; | 
|---|
| 23 | Param  *param            = NULL; | 
|---|
| 24 |  | 
|---|
| 25 | /*Need number of vertices to repartition DoubleVecParam objects: */ | 
|---|
| 26 | parameters->FindParam(&numberofvertices,NumberOfVerticesEnum); | 
|---|
| 27 |  | 
|---|
| 28 | /*serialize partition vector: */ | 
|---|
| 29 | if(part)VecToMPISerial(&partition,part); | 
|---|
| 30 |  | 
|---|
| 31 | for(i=0;i<parameters->Size();i++){ | 
|---|
| 32 |  | 
|---|
| 33 | param=(Param*)parameters->GetObjectByOffset(i); | 
|---|
| 34 | param->Process(partition,numberofvertices); | 
|---|
| 35 |  | 
|---|
| 36 | } | 
|---|
| 37 |  | 
|---|
| 38 | /*Free ressources:*/ | 
|---|
| 39 | xfree((void**)&partition); | 
|---|
| 40 |  | 
|---|
| 41 | } | 
|---|