Changeset 10571
- Timestamp:
- 11/10/11 09:32:40 (13 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp ¶
r9650 r10571 12 12 void InputUpdateFromDakotax(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,double* variables,char* *variables_descriptors,int numvariables){ 13 13 14 int i,j,k ;14 int i,j,k,l; 15 15 int dummy; 16 16 17 17 int numberofvertices; 18 int nrows; 19 int ncols; 18 20 int npart; 19 21 double *qmu_part = NULL; … … 53 55 54 56 /*Now, pick up the parameter corresponding to root: */ 55 parameters->FindParam(¶meter, NULL,StringToEnumx(root));57 parameters->FindParam(¶meter,&nrows,&ncols,StringToEnumx(root)); 56 58 57 /*We've got the parameter, we need to update it using qmu_part (a partitioning vector), and the distributed_values: */ 59 /*We've got the parameter, we need to update it using qmu_part (a partitioning vector), 60 * and the distributed_values. Two cases: we either have a nrows=numberofvertices, in 61 * which case our parameter is a vector, or nrows=numberofvertices+1, in which case, 62 * our parameter is a transient vector. Deal with both cases accordingly: */ 58 63 for(k=0;k<numberofvertices;k++){ 59 parameter[k]=parameter[k]*distributed_values[(int)qmu_part[k]]; 64 for(l=0;l<ncols;l++){ 65 *(parameter+ncols*k+l)=*(parameter+ncols*k+l)*distributed_values[(int)qmu_part[k]]; 66 } 60 67 } 61 68 62 69 #ifdef _DEBUG_ 63 PetscSynchronizedPrintf(MPI_COMM_WORLD,"Parameter vector:");70 PetscSynchronizedPrintf(MPI_COMM_WORLD,"Parameter matrix:"); 64 71 PetscSynchronizedFlush(MPI_COMM_WORLD); 65 for( k=0;k<numberofvertices;k++){66 PetscSynchronizedPrintf(MPI_COMM_WORLD," node %i value %g\n",k+1,parameter[k]);72 for(l=0;l<ncols;l++){ 73 PetscSynchronizedPrintf(MPI_COMM_WORLD," time %i\n",l); 67 74 PetscSynchronizedFlush(MPI_COMM_WORLD); 75 76 for(k=0;k<numberofvertices;k++){ 77 PetscSynchronizedPrintf(MPI_COMM_WORLD," node %i value %g\n",k+1,*(parameter+k*ncols+l)); 78 PetscSynchronizedFlush(MPI_COMM_WORLD); 79 } 68 80 } 69 81 PetscSynchronizedPrintf(MPI_COMM_WORLD," descriptor: %s root %s enum: %i\n",descriptor,root,StringToEnumx(root)); … … 72 84 73 85 74 /*Update inputs using the parameter vector: */75 InputUpdateFrom VectorDakotax( elements,nodes, vertices,loads, materials, parameters, parameter,StringToEnumx(root), VertexEnum);86 /*Update inputs using the parameter matrix: */ 87 InputUpdateFromMatrixDakotax( elements,nodes, vertices,loads, materials, parameters, parameter, nrows,ncols,StringToEnumx(root), VertexEnum); 76 88 77 89 /*increment i to skip the distributed values just collected: */ -
TabularUnified issm/trunk/src/c/modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp ¶
r10566 r10571 56 56 int numberofresponses; 57 57 int numberofvertices; 58 int nrows; 59 int ncols; 58 60 59 61 /*}}}*/ … … 123 125 124 126 /*Recover data: */ 125 iomodel->FetchData(&dakota_parameter, NULL,NULL,StringToEnumx(tag));127 iomodel->FetchData(&dakota_parameter,&nrows,&ncols,StringToEnumx(tag)); 126 128 127 129 /*Convert units: */ 128 UnitConversion(dakota_parameter,n umberofvertices,ExtToIuEnum,StringToEnumx(tag));130 UnitConversion(dakota_parameter,nrows*ncols,ExtToIuEnum,StringToEnumx(tag)); 129 131 130 132 /*Add to parameters: */ 131 parameters->AddObject(new Double VecParam(StringToEnumx(tag),dakota_parameter,numberofvertices));133 parameters->AddObject(new DoubleMatParam(StringToEnumx(tag),dakota_parameter,nrows,ncols)); 132 134 133 135 /*Free ressources:*/ -
TabularUnified issm/trunk/src/c/objects/Elements/Penta.h ¶
r10514 r10571 74 74 void InputUpdateFromVectorDakota(double* vector, int name, int type); 75 75 void InputUpdateFromVectorDakota(int* vector, int name, int type); 76 void InputUpdateFromMatrixDakota(double* matrix, int nows, int ncols, int name, int type); 76 77 #endif 77 78 void InputUpdateFromIoModel(int index, IoModel* iomodel); -
TabularUnified issm/trunk/src/c/objects/Elements/Tria.cpp ¶
r10565 r10571 4980 4980 } 4981 4981 /*}}}*/ 4982 /*FUNCTION Tria::InputUpdateFromVectorMatrix(double* matrix, int nrows, int ncols, int name, int type);{{{1*/ 4983 void Tria::InputUpdateFromVectorMatrix(double* matrix, int nrows, int ncols, int name, int type){ 4984 4985 int i,j,t; 4986 4987 /*Check that name is an element input*/ 4988 if (!IsInput(name)) return; 4989 4990 switch(type){ 4991 4992 case VertexEnum: 4993 4994 double values[3]; 4995 double time; 4996 4997 /*Ok, create transient input: */ 4998 for(t=0;t<ncols;t++){ //ncols is the number of times 4999 5000 /*create input values: */ 5001 for(i=0;i<3;i++){ 5002 row=this->nodes[i]->GetSidList(); 5003 values[i]=(double)matrix[ncols*row+t]; 5004 } 5005 5006 /*time? :*/ 5007 time=(double)matrix[(nrows-1)*ncols+t]*yts; 5008 5009 if(t==0) transientinput=new TransientInput(vector_enum); 5010 transientinput->AddTimeInput(new TriaVertexInput(vector_enum,nodeinputs),time); 5011 } 5012 this->inputs->AddInput(transientinput); 5013 break; 5014 5015 default: 5016 _error_("type %i (%s) not implemented yet",type,EnumToStringx(type)); 5017 } 5018 5019 } 5020 /*}}}*/ 4982 5021 #endif 4983 5022 -
TabularUnified issm/trunk/src/c/objects/Elements/Tria.h ¶
r10440 r10571 66 66 #ifdef _HAVE_DAKOTA_ 67 67 void InputUpdateFromVectorDakota(double* vector, int name, int type); 68 void InputUpdateFromVectorDakota(double* vector, int name, int type); 68 69 void InputUpdateFromVectorDakota(int* vector, int name, int type); 69 70 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 71 void InputUpdateFromMatrixDakota(double* matrix, int nows, int ncols, int name, int type); 70 72 #endif 71 73 void InputUpdateFromConstant(double constant, int name);
Note:
See TracChangeset
for help on using the changeset viewer.