Changeset 8799
- Timestamp:
- 07/05/11 16:45:48 (14 years ago)
- Location:
- issm/trunk/src/c/modules
- Files:
-
- 6 added
- 3 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp
r8798 r8799 323 323 case IsMacAyealPattynEnum : return "IsMacAyealPattyn"; 324 324 case IsStokesEnum : return "IsStokes"; 325 case KffEnum : return "Kff";326 325 case LatentHeatEnum : return "LatentHeat"; 327 326 case LowmemEnum : return "Lowmem"; -
issm/trunk/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp
r6580 r8799 3 3 */ 4 4 5 #include "../VecMergex/VecMergex.h" 5 6 #include "./Mergesolutionfromftogx.h" 6 7 7 void Mergesolutionfromftogx( Vec* pug, Vec uf, Vec ys, Node Sets* nodesets,bool flag_ys0){8 void Mergesolutionfromftogx( Vec* pug, Vec uf, Vec ys, Nodes* nodes, Parameters* parameters, bool flag_ys0){ 8 9 9 10 /*output: */ 10 11 Vec ug=NULL; 11 Vec ys0=NULL; 12 int ug_local_size; 13 12 13 /*intermediary: */ 14 int configuration_type; 15 int analysis_type; 16 int gsize,fsize,ssize; 17 14 18 /*Display message*/ 15 19 _printf_(VerboseModule()," Merging solution vector from fset to gset\n"); 16 20 17 /*Merge f set back into g set: */ 18 ug=NewVec(nodesets->GetGSize()); 19 if(uf) VecMerge(ug,uf,nodesets->GetPV_F(),nodesets->GetFSize()); 21 /*first, get gsize, fsize and ssize: */ 22 parameters->FindParam(&configuration_type,ConfigurationTypeEnum); 23 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 24 gsize=nodes->NumberOfDofs(configuration_type,GsetEnum); 25 fsize=nodes->NumberOfDofs(configuration_type,FsetEnum); 26 ssize=nodes->NumberOfDofs(configuration_type,SsetEnum); 20 27 21 /*merge single point constraints into g set: */ 22 if(ys){ 23 if (flag_ys0){ 24 25 /*Create ys0, full of 0: */ 26 VecDuplicate(ys,&ys0); 27 VecSet(ys0,0.0); 28 VecAssemblyBegin(ys0); 29 VecAssemblyEnd(ys0); 30 31 VecMerge(ug,ys0,nodesets->GetPV_S(),nodesets->GetSSize()); 32 } 33 else{ 34 VecMerge(ug,ys,nodesets->GetPV_S(),nodesets->GetSSize()); 28 /*serialize uf and ys: those two vectors will be indexed by the nodes, who are the only ones 29 *that know which values should be plugged into ug and where: */ 30 if(ssize){ 31 if(flag_ys0){ 32 VecSet(ys,0.0); 35 33 } 36 34 } 37 35 38 /*Free ressources:*/ 39 VecFree(&ys0); 36 /*initialize ug: */ 37 ug=NewVec(gsize); 38 39 /*Merge f set back into g set: */ 40 if(fsize){ 41 VecMergex(ug,uf,nodes,parameters,FsetEnum); 42 } 43 44 /*Merge s set back into g set: */ 45 if(ssize){ 46 VecMergex(ug,ys,nodes,parameters,SsetEnum); 47 } 40 48 41 49 /*Assign correct pointer*/ -
issm/trunk/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.h
r6580 r8799 9 9 10 10 /* local prototypes: */ 11 void Mergesolutionfromftogx( Vec* pug, Vec uf, Vec ys, NodeSets* nodesets,bool flag_ys0=false);11 void Mergesolutionfromftogx( Vec* pug, Vec uf, Vec ys, Nodes* nodes, Parameters* parameters, bool flag_ys0=false); 12 12 13 13 #endif /* _MERGESOLUTIONFROMFTOGX_H */ -
issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp
r8487 r8799 77 77 parameters->AddObject(new BoolParam(WaitOnLockEnum,iomodel->waitonlock)); 78 78 parameters->AddObject(new IntParam(NumberOfElementsEnum,iomodel->numberofelements)); 79 parameters->AddObject(new BoolParam(KffEnum,iomodel->kff));80 79 parameters->AddObject(new BoolParam(IoGatherEnum,iomodel->io_gather)); 81 80 parameters->AddObject(new IntParam(GroundingLineMigrationEnum,iomodel->gl_migration)); -
issm/trunk/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp
r6580 r8799 6 6 #include "./Reducevectorgtofx.h" 7 7 8 void Reducevectorgtofx(Vec* puf, Vec ug, Node Sets* nodesets,Parameters* parameters){8 void Reducevectorgtofx(Vec* puf, Vec ug, Nodes* nodes,Parameters* parameters){ 9 9 10 10 /*output: */ 11 11 Vec uf=NULL; 12 12 13 /*what type of partitioning: */ 14 bool kffpartitioning=false; 13 /*variables: */ 14 int i; 15 int analysis_type; 16 int configuration_type; 17 int fsize; 18 double* ug_serial=NULL; 15 19 16 /*find parameter: */ 17 parameters->FindParam(&kffpartitioning,KffEnum); 20 /*first figure out fsize: */ 21 parameters->FindParam(&configuration_type,ConfigurationTypeEnum); 22 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 23 fsize=nodes->NumberOfDofs(configuration_type,FsetEnum); 18 24 19 if(nodesets){ 25 if(fsize==0){ 26 uf=NULL; 27 } 28 else{ 29 /*allocate: */ 30 uf=NewVec(fsize); 20 31 21 if (nodesets->GetGSize() && nodesets->GetFSize()){ 22 VecPartition(&uf,ug,nodesets->GetPV_F(),nodesets->GetFSize(),kffpartitioning); 32 if(nodes->NumberOfNodes(analysis_type)){ 33 34 /*serialize ug, so nodes can index into it: */ 35 VecToMPISerial(&ug_serial,ug); 36 37 /*Go through all nodes, and ask them to retrieve values from ug, and plug them into uf: */ 38 for(i=0;i<nodes->Size();i++){ 39 40 Node* node=(Node*)nodes->GetObjectByOffset(i); 41 42 /*Check that this node corresponds to our analysis currently being carried out: */ 43 if (node->InAnalysis(analysis_type)){ 44 45 /*For this object, reduce values for enum set Fset: */ 46 node->VecReduce(uf,ug_serial,FsetEnum); 47 } 48 } 49 23 50 } 24 51 } 25 52 53 /*Assemble vector: */ 54 VecAssemblyBegin(uf); 55 VecAssemblyEnd(uf); 56 57 58 /*Free ressources:*/ 59 xfree((void**)&ug_serial); 60 26 61 /*Assign output pointers:*/ 27 62 *puf=uf; -
issm/trunk/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.h
r5787 r8799 10 10 11 11 /* local prototypes: */ 12 void Reducevectorgtofx(Vec* puf, Vec ug, NodeSets* nodesets,Parameters* parameters);12 void Reducevectorgtofx(Vec* puf, Vec ug, Nodes* nodes,Parameters* parameters); 13 13 14 14 #endif /* _REDUCEVECTORGTOFX_H */ -
issm/trunk/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp
r5787 r8799 6 6 #include "./Reducevectorgtosx.h" 7 7 8 void Reducevectorgtosx( Vec* pys, Vec yg, NodeSets* nodesets,Parameters* parameters){8 void Reducevectorgtosx(Vec* pys, Vec yg, Nodes* nodes,Parameters* parameters){ 9 9 10 10 /*output: */ 11 11 Vec ys=NULL; 12 12 13 /*what type of partitioning: */ 14 bool kffpartitioning=false; 13 /*variables: */ 14 int i; 15 int analysis_type; 16 int configuration_type; 17 int ssize; 18 double* yg_serial=NULL; 15 19 16 /*find parameter: */ 17 parameters->FindParam(&kffpartitioning,KffEnum); 20 /*first figure out ssize: */ 21 parameters->FindParam(&configuration_type,ConfigurationTypeEnum); 22 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 23 ssize=nodes->NumberOfDofs(configuration_type,SsetEnum); 18 24 19 if(nodesets){ 20 if (nodesets->GetGSize() && nodesets->GetSSize()){ 21 VecPartition(&ys,yg,nodesets->GetPV_S(),nodesets->GetSSize(),kffpartitioning); 25 if(ssize==0){ 26 ys=NULL; 27 } 28 else{ 29 /*allocate: */ 30 ys=NewVec(ssize); 31 32 if(nodes->NumberOfNodes(analysis_type)){ 33 34 /*serialize yg, so nodes can index into it: */ 35 VecToMPISerial(&yg_serial,yg); 36 37 /*Go throygh all nodes, and ask them to retrieve values from yg, and plyg them into ys: */ 38 for(i=0;i<nodes->Size();i++){ 39 40 Node* node=(Node*)nodes->GetObjectByOffset(i); 41 42 /*Check that this node corresponds to our analysis currently being carried out: */ 43 if (node->InAnalysis(analysis_type)){ 44 45 /*For this object, reduce values for enum set Fset: */ 46 node->VecReduce(ys,yg_serial,SsetEnum); 47 } 48 } 22 49 } 23 50 } 24 25 /*Assign output pointer:*/ 51 52 /*Assemble vector: */ 53 VecAssemblyBegin(ys); 54 VecAssemblyEnd(ys); 55 56 /*Free ressources:*/ 57 xfree((void**)&yg_serial); 58 59 /*Assign output pointers:*/ 26 60 *pys=ys; 27 61 } -
issm/trunk/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h
r5787 r8799 10 10 11 11 /* local prototypes: */ 12 void Reducevectorgtosx( Vec* pys, Vec yg, NodeSets* nodesets,Parameters* parameters);12 void Reducevectorgtosx(Vec* pys, Vec yg, Nodes* nodes,Parameters* parameters); 13 13 14 14 #endif /* _REDUCEVECTORGTOSX_H */ -
issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp
r8798 r8799 321 321 else if (strcmp(name,"IsMacAyealPattyn")==0) return IsMacAyealPattynEnum; 322 322 else if (strcmp(name,"IsStokes")==0) return IsStokesEnum; 323 else if (strcmp(name,"Kff")==0) return KffEnum;324 323 else if (strcmp(name,"LatentHeat")==0) return LatentHeatEnum; 325 324 else if (strcmp(name,"Lowmem")==0) return LowmemEnum; -
issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
r7391 r8799 9 9 #include "../../EnumDefinitions/EnumDefinitions.h" 10 10 11 void SystemMatricesx(Mat* pK gg, Mat* pKff, Mat* pKfs, Vec* ppg, Vec* ppf, Vec* pdg, Vec* pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){11 void SystemMatricesx(Mat* pKff, Mat* pKfs, Vec* ppf, Vec* pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){ 12 12 13 13 /*intermediary: */ 14 14 int i,j; 15 int gsize,fsize,ssize;15 int fsize,ssize; 16 16 int connectivity, numberofdofspernode; 17 17 int analysis_type, configuration_type; 18 18 Element *element = NULL; 19 19 Load *load = NULL; 20 bool buildkff=false;21 20 22 21 /*output: */ 23 Mat Kgg = NULL;24 22 Mat Kff = NULL; 25 23 Mat Kfs = NULL; 26 Vec pg = NULL;27 24 Vec pf = NULL; 28 Vec dg=NULL;29 25 Vec df=NULL; 30 26 double kmax = 0; … … 37 33 parameters->FindParam(&configuration_type,ConfigurationTypeEnum); 38 34 parameters->FindParam(&connectivity,ConnectivityEnum); 39 parameters->FindParam(&buildkff,KffEnum);40 35 41 /*Get size of matrix: */ 42 gsize=nodes->NumberOfDofs(configuration_type,GsetEnum); 36 /*Get size of matrices: */ 43 37 fsize=nodes->NumberOfDofs(configuration_type,FsetEnum); 44 38 ssize=nodes->NumberOfDofs(configuration_type,SsetEnum); … … 54 48 if(kflag){ 55 49 56 if(!buildkff){ 57 Kgg=NewMat(gsize,gsize,connectivity,numberofdofspernode); 58 dg=NewVec(gsize); 59 } 60 else{ 61 Kff=NewMat(fsize,fsize,connectivity,numberofdofspernode); 62 Kfs=NewMat(fsize,ssize,connectivity,numberofdofspernode); 63 df=NewVec(fsize); 64 } 50 Kff=NewMat(fsize,fsize,connectivity,numberofdofspernode); 51 Kfs=NewMat(fsize,ssize,connectivity,numberofdofspernode); 52 df=NewVec(fsize); 65 53 66 54 /*Fill stiffness matrix from elements: */ 67 55 for (i=0;i<elements->Size();i++){ 68 56 element=(Element*)elements->GetObjectByOffset(i); 69 element->CreateKMatrix(K gg,Kff,Kfs,dg,df);57 element->CreateKMatrix(Kff,Kfs,df); 70 58 } 71 59 … … 73 61 for (i=0;i<loads->Size();i++){ 74 62 load=(Load*)loads->GetObjectByOffset(i); 75 if (load->InAnalysis(configuration_type)) load->CreateKMatrix(K gg,Kff,Kfs);63 if (load->InAnalysis(configuration_type)) load->CreateKMatrix(Kff,Kfs); 76 64 } 77 65 78 66 /*Assemble matrix and doftypes and compress matrix to save memory: */ 79 if(!buildkff){ 80 MatAssemblyBegin(Kgg,MAT_FINAL_ASSEMBLY); 81 MatAssemblyEnd(Kgg,MAT_FINAL_ASSEMBLY); 82 #if _PETSC_VERSION_ == 2 83 MatCompress(Kgg); 84 #endif 85 VecAssemblyBegin(dg); 86 VecAssemblyEnd(dg); 87 } 88 else{ 89 MatAssemblyBegin(Kff,MAT_FINAL_ASSEMBLY); 90 MatAssemblyEnd(Kff,MAT_FINAL_ASSEMBLY); 91 #if _PETSC_VERSION_ == 2 92 MatCompress(Kff); 93 #endif 67 MatAssemblyBegin(Kff,MAT_FINAL_ASSEMBLY); 68 MatAssemblyEnd(Kff,MAT_FINAL_ASSEMBLY); 69 #if _PETSC_VERSION_ == 2 70 MatCompress(Kff); 71 #endif 94 72 95 MatAssemblyBegin(Kfs,MAT_FINAL_ASSEMBLY); 96 MatAssemblyEnd(Kfs,MAT_FINAL_ASSEMBLY); 97 #if _PETSC_VERSION_ == 2 98 MatCompress(Kfs); 99 #endif 100 VecAssemblyBegin(df); 101 VecAssemblyEnd(df); 102 } 73 MatAssemblyBegin(Kfs,MAT_FINAL_ASSEMBLY); 74 MatAssemblyEnd(Kfs,MAT_FINAL_ASSEMBLY); 75 #if _PETSC_VERSION_ == 2 76 MatCompress(Kfs); 77 #endif 78 VecAssemblyBegin(df); 79 VecAssemblyEnd(df); 103 80 104 81 } … … 106 83 if(pflag){ 107 84 108 if(!buildkff)pg=NewVec(gsize); 109 else pf=NewVec(fsize); 85 pf=NewVec(fsize); 110 86 111 87 /*Fill right hand side vector, from elements: */ 112 88 for (i=0;i<elements->Size();i++){ 113 89 element=(Element*)elements->GetObjectByOffset(i); 114 element->CreatePVector(p g,pf);90 element->CreatePVector(pf); 115 91 } 116 92 … … 118 94 for (i=0;i<loads->Size();i++){ 119 95 load=(Load*)loads->GetObjectByOffset(i); 120 if (load->InAnalysis(configuration_type)) load->CreatePVector(p g,pf);96 if (load->InAnalysis(configuration_type)) load->CreatePVector(pf); 121 97 } 122 98 123 if(!buildkff){ 124 VecAssemblyBegin(pg); 125 VecAssemblyEnd(pg); 126 } 127 else{ 128 VecAssemblyBegin(pf); 129 VecAssemblyEnd(pf); 130 } 99 VecAssemblyBegin(pf); 100 VecAssemblyEnd(pf); 131 101 } 132 102 133 103 /*Now, figure out maximum value of K_gg, so that we can penalize it correctly: */ 134 if(!buildkff)MatNorm(Kgg,NORM_INFINITY,&kmax); 135 else MatNorm(Kff,NORM_INFINITY,&kmax); 104 MatNorm(Kff,NORM_INFINITY,&kmax); 136 105 137 106 /*Now, deal with penalties*/ … … 141 110 for (i=0;i<loads->Size();i++){ 142 111 load=(Load*)loads->GetObjectByOffset(i); 143 if (load->InAnalysis(configuration_type)) load->PenaltyCreateKMatrix(K gg,Kff,Kfs,kmax);112 if (load->InAnalysis(configuration_type)) load->PenaltyCreateKMatrix(Kff,Kfs,kmax); 144 113 } 145 114 146 115 /*Assemble matrix and compress matrix to save memory: */ 147 if(!buildkff){ 148 MatAssemblyBegin(Kgg,MAT_FINAL_ASSEMBLY); 149 MatAssemblyEnd(Kgg,MAT_FINAL_ASSEMBLY); 150 #if _PETSC_VERSION_ == 2 151 MatCompress(Kgg); 152 #endif 153 } 154 else{ 155 MatAssemblyBegin(Kff,MAT_FINAL_ASSEMBLY); 156 MatAssemblyEnd(Kff,MAT_FINAL_ASSEMBLY); 157 #if _PETSC_VERSION_ == 2 158 MatCompress(Kff); 159 #endif 116 MatAssemblyBegin(Kff,MAT_FINAL_ASSEMBLY); 117 MatAssemblyEnd(Kff,MAT_FINAL_ASSEMBLY); 118 #if _PETSC_VERSION_ == 2 119 MatCompress(Kff); 120 #endif 160 121 161 MatAssemblyBegin(Kfs,MAT_FINAL_ASSEMBLY); 162 MatAssemblyEnd(Kfs,MAT_FINAL_ASSEMBLY); 163 #if _PETSC_VERSION_ == 2 164 MatCompress(Kfs); 165 #endif 166 } 122 MatAssemblyBegin(Kfs,MAT_FINAL_ASSEMBLY); 123 MatAssemblyEnd(Kfs,MAT_FINAL_ASSEMBLY); 124 #if _PETSC_VERSION_ == 2 125 MatCompress(Kfs); 126 #endif 167 127 } 168 128 … … 173 133 for (i=0;i<loads->Size();i++){ 174 134 load=(Load*)loads->GetObjectByOffset(i); 175 if (load->InAnalysis(configuration_type)) load->PenaltyCreatePVector(p g,pf,kmax);135 if (load->InAnalysis(configuration_type)) load->PenaltyCreatePVector(pf,kmax); 176 136 } 177 137 178 if(!buildkff){ 179 VecAssemblyBegin(pg); 180 VecAssemblyEnd(pg); 181 } 182 else{ 183 VecAssemblyBegin(pf); 184 VecAssemblyEnd(pf); 185 } 138 VecAssemblyBegin(pf); 139 VecAssemblyEnd(pf); 186 140 } 187 141 188 142 /*Assign output pointers: */ 189 if(pKgg) *pKgg=Kgg;190 143 if(pKff) *pKff=Kff; 191 144 if(pKfs) *pKfs=Kfs; 192 if(ppg) *ppg=pg;193 145 if(ppf) *ppf=pf; 194 if(pdg) *pdg=dg;195 146 if(pdf) *pdf=df; 196 147 if(pkmax) *pkmax=kmax; -
issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.h
r7391 r8799 10 10 11 11 /* local prototypes: */ 12 void SystemMatricesx(Mat* pK gg, Mat* pKff, Mat* pKfs, Vec* ppg, Vec* ppf, Vec* pdg, Vec* pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,12 void SystemMatricesx(Mat* pKff, Mat* pKfs, Vec* ppf, Vec* pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters, 13 13 bool kflag=true,bool pflag=true,bool penalty_kflag=true,bool penalty_pflag=true); 14 14 -
issm/trunk/src/c/modules/modules.h
r8711 r8799 12 12 #include "./Bamgx/Bamgx.h" 13 13 #include "./BamgConvertMeshx/BamgConvertMeshx.h" 14 #include "./BuildNodeSetsx/BuildNodeSetsx.h"15 14 #include "./Chacox/Chacox.h" 16 15 #include "./ComputeBasalStressx/ComputeBasalStressx.h" … … 87 86 #include "./PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.h" 88 87 #include "./Qmux/Qmux.h" 89 #include "./Reduceloadfromgtofx/Reduceloadfromgtofx.h"90 88 #include "./Reduceloadx/Reduceloadx.h" 91 #include "./Reducematrixfromgtofx/Reducematrixfromgtofx.h"92 89 #include "./Reducevectorgtosx/Reducevectorgtosx.h" 93 90 #include "./Reducevectorgtofx/Reducevectorgtofx.h" … … 104 101 #include "./ThicknessAbsGradientx/ThicknessAbsGradientx.h" 105 102 #include "./UpdateVertexPositionsx/UpdateVertexPositionsx.h" 103 #include "./UpdateSpcsx/UpdateSpcsx.h" 106 104 #include "./VerticesDofx/VerticesDofx.h" 105 #include "./VecMergex/VecMergex.h" 107 106 108 107 #endif
Note:
See TracChangeset
for help on using the changeset viewer.