Changeset 10367
- Timestamp:
- 10/31/11 10:33:50 (13 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Makefile.am
r10308 r10367 184 184 ./shared/Numerics/cross.cpp\ 185 185 ./shared/Numerics/extrema.cpp\ 186 ./shared/Numerics/XZvectorsToCoordinateSystem.cpp\ 186 187 ./shared/Numerics/UnitConversion.cpp\ 187 188 ./shared/Numerics/PetscOptionsFromAnalysis.cpp\ … … 198 199 ./shared/Elements/GetGlobalDofList.cpp\ 199 200 ./shared/Elements/GetNumberOfDofs.cpp\ 201 ./shared/Elements/CoordinateSystemTransform.cpp\ 200 202 ./shared/String/sharedstring.h\ 201 203 ./toolkits/petsc\ -
issm/trunk/src/c/objects/Elements/Tria.cpp
r10355 r10367 2830 2830 ElementMatrix* Ke2=CreateKMatrixDiagnosticMacAyealFriction(); 2831 2831 ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2); 2832 TransformStiffnessMatrixCoord(Ke,2); 2832 2833 2833 2834 /*clean-up and return*/ … … 3031 3032 } 3032 3033 3034 /*Transform coordinate system*/ 3035 TransformLoadVectorCoord(pe,2); 3036 3033 3037 /*Clean up and return*/ 3034 3038 delete gauss; … … 3188 3192 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 3189 3193 for(i=0;i<NUMVERTICES;i++){ 3190 vx[i]=values[i*NDOF2+0]; 3191 vy[i]=values[i*NDOF2+1]; 3194 /*TEMP*/ 3195 vel[0]=values[i*NDOF2+0]; 3196 vel[1]=values[i*NDOF2+1]; 3197 TransformSolutionCoord(&vel[0],2,i); 3198 vx[i]=vel[0]; 3199 vy[i]=vel[1]; 3192 3200 3193 3201 /*Check solution*/ … … 3281 3289 /*Free ressources:*/ 3282 3290 xfree((void**)&doflist); 3291 } 3292 /*}}}*/ 3293 /*FUNCTION Tria::TransformStiffnessMatrixCoord{{{1*/ 3294 void Tria::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int dim){ 3295 3296 int i,j; 3297 int numnodes = NUMVERTICES; 3298 double *transform = NULL; 3299 double *values = NULL; 3300 3301 /*Copy current stiffness matrix*/ 3302 values=(double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double)); 3303 for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j]; 3304 3305 /*Get Coordinate Systems transform matrix*/ 3306 CoordinateSystemTransform(&transform,nodes,numnodes,dim); 3307 3308 /*Transform matrix: T*Ke*T^t */ 3309 TripleMultiply(transform,numnodes*dim,numnodes*dim,1, 3310 values,Ke->nrows,Ke->ncols,0, 3311 transform,numnodes*dim,numnodes*dim,0, 3312 &Ke->values[0],0); 3313 3314 /*Free Matrix*/ 3315 xfree((void**)&transform); 3316 xfree((void**)&values); 3317 } 3318 /*}}}*/ 3319 /*FUNCTION Tria::TransformLoadVectorCoord{{{1*/ 3320 void Tria::TransformLoadVectorCoord(ElementVector* pe,int dim){ 3321 3322 int i,j; 3323 int numnodes = NUMVERTICES; 3324 double *transform = NULL; 3325 double *values = NULL; 3326 3327 /*Copy current load vector*/ 3328 values=(double*)xmalloc(pe->nrows*sizeof(double)); 3329 for(i=0;i<pe->nrows;i++) values[i]=pe->values[i]; 3330 3331 /*Get Coordinate Systems transform matrix*/ 3332 CoordinateSystemTransform(&transform,nodes,numnodes,dim); 3333 3334 /*Transform matrix: T*pe */ 3335 MatrixMultiply(transform,numnodes*dim,numnodes*dim,1, 3336 values,pe->nrows,1,0, 3337 &pe->values[0],0); 3338 3339 /*Free Matrix*/ 3340 xfree((void**)&transform); 3341 xfree((void**)&values); 3342 } 3343 /*}}}*/ 3344 /*FUNCTION Tria::TransformSolutionCoord{{{1*/ 3345 void Tria::TransformSolutionCoord(double* vel,int dim,int node_index){ 3346 3347 int i,j; 3348 double *transform = NULL; 3349 double *values = NULL; 3350 3351 /*Copy current solution vector*/ 3352 values=(double*)xmalloc(dim*sizeof(double)); 3353 for(i=0;i<dim;i++) values[i]=vel[i]; 3354 3355 /*Get Coordinate Systems transform matrix*/ 3356 CoordinateSystemTransform(&transform,&nodes[node_index],1,dim); 3357 3358 /*Transform matrix: T*pe */ 3359 MatrixMultiply(transform,dim,dim,0, 3360 values,dim,1,0, 3361 vel,0); 3362 3363 /*Free Matrix*/ 3364 xfree((void**)&transform); 3365 xfree((void**)&values); 3283 3366 } 3284 3367 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Tria.h
r10355 r10367 92 92 void GetVectorFromInputs(Vec vector, int name_enum); 93 93 void GetVectorFromResults(Vec vector,int name_enum); 94 95 94 void InputArtificialNoise(int enum_type,double min, double max); 96 95 bool InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums); … … 103 102 void DeleteResults(void); 104 103 void MaterialUpdateFromTemperature(void){_error_("not implemented yet");}; 105 106 104 void Migration(double* sheet_ungrounding); 107 105 void ShelfSync(); 108 106 void PotentialSheetUngrounding(Vec potential_sheet_ungrounding); 109 107 void MigrateGroundingline(); 110 111 108 void RequestedOutput(int output_enum,int step,double time); 112 109 void ListResultsEnums(int** results_enums,int* num_results); … … 193 190 void GetInputValue(double* pvalue,Node* node,int enumtype); 194 191 void GetStrainRate2d(double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input); 195 void InputUpdateFromSolutionOneDof(double* solution,int enum_type);196 void InputUpdateFromSolutionPrognostic(double* solution);197 bool IsInput(int name);198 void SetClone(int* minranks);199 void SurfaceNormal(double* surface_normal, double xyz_list[3][3]);192 void InputUpdateFromSolutionOneDof(double* solution,int enum_type); 193 void InputUpdateFromSolutionPrognostic(double* solution); 194 bool IsInput(int name); 195 void SetClone(int* minranks); 196 void SurfaceNormal(double* surface_normal, double xyz_list[3][3]); 200 197 201 198 … … 211 208 void InputUpdateFromSolutionDiagnosticHoriz( double* solution); 212 209 void InputUpdateFromSolutionDiagnosticHutter( double* solution); 210 void TransformStiffnessMatrixCoord(ElementMatrix* Ke,int dim); 211 void TransformLoadVectorCoord(ElementVector* pe,int dim); 212 void TransformSolutionCoord(double* vel,int dim,int node_index); 213 213 #endif 214 214 -
issm/trunk/src/c/objects/Loads/Icefront.cpp
r10135 r10367 528 528 } 529 529 } 530 /*Transform load vector*/ 531 TransformLoadVectorCoord(pe,2); 530 532 531 533 /*Clean up and return*/ 532 534 delete gauss; 533 535 return pe; 536 } 537 /*}}}*/ 538 /*FUNCTION Icefront::TransformLoadVectorCoord{{{1*/ 539 void Icefront::TransformLoadVectorCoord(ElementVector* pe,int dim){ 540 541 int numnodes = 2; 542 double *transform = NULL; 543 double *values = NULL; 544 545 /*Copy current load matrix*/ 546 values=(double*)xmalloc(pe->nrows*sizeof(double)); 547 for(int i=0;i<pe->nrows;i++) values[i]=pe->values[i]; 548 549 /*Get Coordinate Systems transform matrix*/ 550 CoordinateSystemTransform(&transform,nodes,numnodes,dim); 551 552 /*Transform matrix: T*pe */ 553 MatrixMultiply(transform,numnodes*dim,numnodes*dim,1, 554 values,pe->nrows,1,0, 555 &pe->values[0],0); 556 557 /*Free Matrix*/ 558 xfree((void**)&transform); 559 xfree((void**)&values); 534 560 } 535 561 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Icefront.h
r9883 r10367 80 80 /*}}}*/ 81 81 /*Load management: {{{1*/ 82 void 82 void GetDofList(int** pdoflist,int approximation_enum,int setenum); 83 83 void GetSegmentNormal(double* normal,double xyz_list[2][3]); 84 84 void GetQuadNormal(double* normal,double xyz_list[4][3]); 85 void TransformLoadVectorCoord(ElementVector* pe,int dim); 85 86 #ifdef _HAVE_CONTROL_ 86 87 ElementVector* CreatePVectorAdjointHoriz(void); -
issm/trunk/src/c/objects/Node.cpp
r10245 r10367 43 43 this->sid=node_sid; 44 44 this->analysis_type=analysis_type; 45 for(k=0;k<3;k++) for(l=0;l<3;l++) this->referential[k][l]=1.0; 45 46 /*Initialize coord_system: Identity matrix by default*/ 47 for(k=0;k<3;k++) for(l=0;l<3;l++) this->coord_system[k][l]=0.0; 48 for(k=0;k<3;k++) this->coord_system[k][k]=1.0; 46 49 47 50 /*indexing:*/ … … 54 57 //intialize inputs, and add as many inputs per element as requested: 55 58 this->inputs=new Inputs(); 56 if (iomodel->Data(MeshVertexonbedEnum)) this->inputs->AddInput(new BoolInput(MeshVertexonbedEnum,(IssmBool)iomodel->Data(MeshVertexonbedEnum)[io_index])); 57 if (iomodel->Data(MeshVertexonsurfaceEnum)) this->inputs->AddInput(new BoolInput(MeshVertexonsurfaceEnum,(IssmBool)iomodel->Data(MeshVertexonsurfaceEnum)[io_index])); 58 if (iomodel->Data(MaskVertexonfloatingiceEnum)) this->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,(IssmBool)iomodel->Data(MaskVertexonfloatingiceEnum)[io_index])); 59 if (iomodel->Data(MaskVertexongroundediceEnum)) this->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,(IssmBool)iomodel->Data(MaskVertexongroundediceEnum)[io_index])); 60 if (iomodel->numbernodetoelementconnectivity) this->inputs->AddInput(new IntInput(NumberNodeToElementConnectivityEnum,(IssmInt)iomodel->numbernodetoelementconnectivity[io_index])); 61 if (analysis_type==DiagnosticHorizAnalysisEnum) this->inputs->AddInput(new IntInput(ApproximationEnum,(IssmInt)iomodel->Data(FlowequationVertexEquationEnum)[io_index])); 59 if (iomodel->Data(MeshVertexonbedEnum)) 60 this->inputs->AddInput(new BoolInput(MeshVertexonbedEnum,(IssmBool)iomodel->Data(MeshVertexonbedEnum)[io_index])); 61 if (iomodel->Data(MeshVertexonsurfaceEnum)) 62 this->inputs->AddInput(new BoolInput(MeshVertexonsurfaceEnum,(IssmBool)iomodel->Data(MeshVertexonsurfaceEnum)[io_index])); 63 if (iomodel->Data(MaskVertexonfloatingiceEnum)) 64 this->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,(IssmBool)iomodel->Data(MaskVertexonfloatingiceEnum)[io_index])); 65 if (iomodel->Data(MaskVertexongroundediceEnum)) 66 this->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,(IssmBool)iomodel->Data(MaskVertexongroundediceEnum)[io_index])); 67 if (iomodel->numbernodetoelementconnectivity) 68 this->inputs->AddInput(new IntInput(NumberNodeToElementConnectivityEnum,(IssmInt)iomodel->numbernodetoelementconnectivity[io_index])); 69 if (analysis_type==DiagnosticHorizAnalysisEnum) 70 this->inputs->AddInput(new IntInput(ApproximationEnum,(IssmInt)iomodel->Data(FlowequationVertexEquationEnum)[io_index])); 62 71 63 72 /*set single point constraints: */ … … 72 81 73 82 /*Diagnostic Horiz*/ 83 #ifdef _HAVE_DIAGNOSTIC_ 74 84 if (analysis_type==DiagnosticHorizAnalysisEnum){ 85 86 /*Coordinate system provided, convert to coord_system matrix*/ 87 _assert_(iomodel->Data(DiagnosticReferentialEnum)); 88 XZvectorsToCoordinateSystem(&this->coord_system[0][0],iomodel->Data(DiagnosticReferentialEnum)+io_index*6); 89 75 90 if (dim==3){ 76 91 /*We have a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */ 77 if (!iomodel->Data(MeshVertexonbedEnum)) _error_("iomodel->nodeonbed is NULL");78 if (!iomodel->Data(FlowequationVertexEquationEnum)) _error_("iomodel->vertices_type is NULL");92 _assert_(iomodel->Data(MeshVertexonbedEnum)); 93 _assert_(iomodel->Data(FlowequationVertexEquationEnum)); 79 94 if (iomodel->Data(FlowequationVertexEquationEnum)[io_index]==MacAyealApproximationEnum && !iomodel->Data(MeshVertexonbedEnum)[io_index]){ 80 95 for(k=1;k<=gsize;k++) this->FreezeDof(k); … … 97 112 } 98 113 } 99 100 }114 } 115 #endif 101 116 102 117 /*Diagnostic Hutter*/ … … 202 217 memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid); 203 218 memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 204 memcpy(marshalled_dataset,& referential,9*sizeof(double));marshalled_dataset+=9*sizeof(double);219 memcpy(marshalled_dataset,&coord_system,9*sizeof(double));marshalled_dataset+=9*sizeof(double); 205 220 206 221 /*marshall objects: */ … … 248 263 memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid); 249 264 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 250 memcpy(& referential,marshalled_dataset,9*sizeof(double));marshalled_dataset+=9*sizeof(double);265 memcpy(&coord_system,marshalled_dataset,9*sizeof(double));marshalled_dataset+=9*sizeof(double); 251 266 252 267 /*demarshall objects: */ … … 507 522 } 508 523 /*}}}*/ 524 #ifdef _HAVE_DIAGNOSTIC_ 525 /*FUNCTION Node::GetCoordinateSystem{{{1*/ 526 void Node::GetCoordinateSystem(double* coord_system_out){ 527 528 /*Copy coord_system*/ 529 for(int k=0;k<3;k++) for(int l=0;l<3;l++) coord_system_out[3*k+l]=this->coord_system[k][l]; 530 531 } 532 /*}}}*/ 533 #endif 509 534 /*FUNCTION Node::SetVertexDof {{{1*/ 510 535 void Node::SetVertexDof(int in_dof){ -
issm/trunk/src/c/objects/Node.h
r10143 r10367 30 30 Inputs* inputs; //properties of this node 31 31 int analysis_type; 32 double referential[3][3];32 double coord_system[3][3]; 33 33 34 34 /*Node constructors, destructors {{{1*/ … … 65 65 /*}}}*/ 66 66 /*Node numerical routines {{{1*/ 67 void Configure(DataSet* nodes,Vertices* vertices); 68 void CreateNodalConstraints(Vec ys); 69 void SetCurrentConfiguration(DataSet* nodes,Vertices* vertices); 70 int Sid(void); 71 int GetVertexDof(void); 72 int GetVertexId(void); 73 void SetVertexDof(int in_dof); 74 bool InAnalysis(int analysis_type); 75 int GetApproximation(); 76 int GetNumberOfDofs(int approximation_enum,int setenum); 77 int IsClone(); 78 void ApplyConstraint(int dof,double value); 79 void RelaxConstraint(int dof); 80 void DofInSSet(int dof); 81 void DofInFSet(int dof); 82 int GetDof(int dofindex,int setenum); 83 void CreateVecSets(Vec pv_g,Vec pv_f,Vec pv_s); 84 int GetConnectivity(); 85 void GetDofList(int* poutdoflist,int approximation_enum,int setenum); 86 void GetLocalDofList(int* poutdoflist,int approximation_enum,int setenum); 87 int GetDofList1(void); 88 int GetSidList(void); 67 void Configure(DataSet* nodes,Vertices* vertices); 68 void CreateNodalConstraints(Vec ys); 69 void SetCurrentConfiguration(DataSet* nodes,Vertices* vertices); 70 int Sid(void); 71 int GetVertexDof(void); 72 int GetVertexId(void); 73 #ifdef _HAVE_DIAGNOSTIC_ 74 void GetCoordinateSystem(double* coord_system_out); 75 #endif 76 void SetVertexDof(int in_dof); 77 bool InAnalysis(int analysis_type); 78 int GetApproximation(); 79 int GetNumberOfDofs(int approximation_enum,int setenum); 80 int IsClone(); 81 void ApplyConstraint(int dof,double value); 82 void RelaxConstraint(int dof); 83 void DofInSSet(int dof); 84 void DofInFSet(int dof); 85 int GetDof(int dofindex,int setenum); 86 void CreateVecSets(Vec pv_g,Vec pv_f,Vec pv_s); 87 int GetConnectivity(); 88 void GetDofList(int* poutdoflist,int approximation_enum,int setenum); 89 void GetLocalDofList(int* poutdoflist,int approximation_enum,int setenum); 90 int GetDofList1(void); 91 int GetSidList(void); 89 92 double GetX(); 90 93 double GetY(); 91 94 double GetZ(); 92 95 double GetSigma(); 93 int IsOnBed();94 int IsOnSurface();95 void FreezeDof(int dof);96 int IsFloating();97 int IsGrounded();98 void UpdateSpcs(double* ys);99 void VecMerge(Vec ug, double* vector_serial,int setnum);100 void VecReduce(Vec vector, double* ug_serial,int setnum);96 int IsOnBed(); 97 int IsOnSurface(); 98 void FreezeDof(int dof); 99 int IsFloating(); 100 int IsGrounded(); 101 void UpdateSpcs(double* ys); 102 void VecMerge(Vec ug, double* vector_serial,int setnum); 103 void VecReduce(Vec vector, double* ug_serial,int setnum); 101 104 102 105 /*}}}*/ -
issm/trunk/src/c/shared/Elements/elements.h
r7848 r10367 17 17 int* GetLocalDofList( Node** nodes,int numnodes,int setenum,int approximation_enum); 18 18 int* GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation_enum); 19 void CoordinateSystemTransform(double** ptransform,Node** nodes,int numnodes,int dimension); 19 20 20 21 inline void printarray(double* array,int lines,int cols=1){ -
issm/trunk/src/c/shared/Numerics/numerics.h
r10144 r10367 28 28 double UnitConversion(double value, int direction_enum, int type_enum); 29 29 void PetscOptionsFromAnalysis(Parameters* parameters,int analysis_type); 30 void XZvectorsToCoordinateSystem(double* T,double* xzvectors); 30 31 31 32 #endif //ifndef _NUMERICS_H_ -
issm/trunk/src/c/solutions/issm.cpp
r9761 r10367 107 107 #ifdef _HAVE_CONTROL_ 108 108 #ifdef _HAVE_TAO_ 109 controltao_core(femmodel); 109 //controltao_core(femmodel); 110 control_core(femmodel); 110 111 #else 111 112 control_core(femmodel);
Note:
See TracChangeset
for help on using the changeset viewer.