Changeset 365
- Timestamp:
- 05/12/09 16:14:22 (16 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Input.cpp
r301 r365 220 220 throw ErrorException(__FUNCT__,"not supported yet!"); 221 221 } 222 223 #undef __FUNCT__ 224 #define __FUNCT__ "Input::Get" 225 Vec Input::Get(int* in_dofs, int in_numdofs){ 226 227 int i,j; 228 int index; 229 double value; 230 extern int my_rank; 231 int count=0; 232 int i0,i1; 233 234 /*output: */ 235 Vec outvector=NULL; 236 int totaldofs=0; 237 238 if (type!=DOUBLEVEC)throw ErrorException(__FUNCT__," trying to recover Petsc vector on non DOUBLEVEC entity!"); 239 240 /*figure out how many dofs are requested: */ 241 totaldofs=0; 242 for(i=0;i<in_numdofs;i++)totaldofs+=in_dofs[i]; 243 244 /*Allocate outvector: */ 245 outvector=NewVec(totaldofs*numberofnodes); 246 247 i0=MPI_Lowerrow(numberofnodes); 248 i1=MPI_Upperrow(numberofnodes); 249 250 for(i=i0;i<i1;i++){ 251 count=0; 252 for(j=0;j<in_numdofs;j++){ 253 if (in_dofs[j]){ 254 index=i*totaldofs+count; 255 value=vector[i*ndof+j]; 256 VecSetValues(outvector,1,&index,&value,INSERT_VALUES); 257 count++; 258 } 259 } 260 } 261 262 /*Assmeble: */ 263 VecAssemblyBegin(outvector); 264 VecAssemblyEnd(outvector); 265 266 267 return outvector; 268 } -
issm/trunk/src/c/objects/Input.h
r246 r365 57 57 void Recover(double* pdouble); 58 58 59 /*get into workspace: */ 60 Vec Get(int* dofs, int numdofs); 61 59 62 }; 60 63 -
issm/trunk/src/c/objects/ParameterInputs.cpp
r246 r365 240 240 return 1; 241 241 } 242 243 #undef __FUNCT__ 244 #define __FUNCT__ "ParameterInputs::Get" 245 Vec ParameterInputs::Get(char* name,int* dofs, int numdofs){ 246 247 int i; 248 Input* input=NULL; 249 int found=0; 250 251 /*output: */ 252 Vec ug=NULL; 253 254 /*Go through dataset, and figure out if an Input 255 * has the name "name": */ 256 for(i=0;i<dataset->Size();i++){ 257 input=(Input*)dataset->GetObjectByOffset(i); 258 259 if (input->IsSameName(name)){ 260 found=1; 261 break; 262 } 263 } 264 265 if(found==0)return NULL; 266 267 /*call submethod: */ 268 ug=input->Get(dofs,numdofs); 269 270 return ug; 271 } -
issm/trunk/src/c/objects/ParameterInputs.h
r246 r365 33 33 int Recover(char* name,double* values, int ndof, int* dofs,int numnodes,void** nodes); //void** because otherwise we get a circular dependency with Node 34 34 35 Vec Get(char* field_name,int* dofs, int numdofs); 36 35 37 /*declaration found in io: */ 36 38 void Init( void* data_handle); -
issm/trunk/src/c/parallel/diagnostic_core_nonlinear.cpp
r256 r365 42 42 int debug=0; 43 43 double eps_rel,eps_abs,yts; 44 int dofs[3]={1,1,0}; //recover vx,vy by default. vz may be. 44 45 45 46 /*Recover parameters: */ … … 58 59 /*Copy loads for backup: */ 59 60 loads=fem->loads->Copy(); 61 62 /*recover input velocities if present: */ 63 if (numberofdofspernode>=3)dofs[2]=1;//only keep vz if running with more than 3 dofs per node 64 ug=inputs->Get("velocity",&dofs[0],3); 65 66 VecDuplicate(ug,&old_ug); 67 VecCopy(ug,old_ug); 60 68 61 69 count=1; -
issm/trunk/src/c/toolkits/mpi/patches/MPI_Lowerrow.cpp
r1 r365 27 27 28 28 } 29 30 31 32 33
Note:
See TracChangeset
for help on using the changeset viewer.