[1] | 1 | /*! \file Model.cpp
|
---|
| 2 | * \brief Model structure that mirrors the matlab workspace structure. Servers for the serial
|
---|
| 3 | * and parallel runs.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | #ifdef HAVE_CONFIG_H
|
---|
| 7 | #include "config.h"
|
---|
| 8 | #else
|
---|
| 9 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
| 10 | #endif
|
---|
| 11 |
|
---|
| 12 | #include "../shared/shared.h"
|
---|
| 13 | #include "../io/io.h"
|
---|
| 14 | #include "../include/globals.h"
|
---|
| 15 | #include "../include/macros.h"
|
---|
| 16 |
|
---|
| 17 | #include <string.h>
|
---|
| 18 | #include "stdio.h"
|
---|
| 19 |
|
---|
[117] | 20 | #include "./Model.h"
|
---|
[1] | 21 |
|
---|
| 22 |
|
---|
| 23 | /*!--------------------------------------------------
|
---|
| 24 | NewModel
|
---|
| 25 | --------------------------------------------------*/
|
---|
| 26 |
|
---|
| 27 | Model* NewModel(void) {
|
---|
| 28 | /*! create a new Model object */
|
---|
| 29 | Model* model=NULL;
|
---|
| 30 |
|
---|
| 31 | model=(Model*)xmalloc(sizeof(Model));
|
---|
| 32 |
|
---|
| 33 | /*!initialize all pointers to 0: */
|
---|
[962] | 34 | model->name=NULL;
|
---|
[1] | 35 | model->repository=NULL;
|
---|
| 36 | model->meshtype=NULL;
|
---|
[1648] | 37 | model->analysis_type=0;
|
---|
| 38 | model->sub_analysis_type=0;
|
---|
[586] | 39 | model->qmu_analysis=0;
|
---|
| 40 | model->solverstring=NULL;
|
---|
| 41 | model->numberofresponses=0;
|
---|
[765] | 42 | model->numberofvariables=0;
|
---|
[962] | 43 | model->qmu_npart=0;
|
---|
[1] | 44 | model->numberofelements=0;
|
---|
| 45 | model->numberofnodes=0;
|
---|
| 46 | model->x=NULL;
|
---|
| 47 | model->y=NULL;
|
---|
| 48 | model->z=NULL;
|
---|
| 49 | model->elements=NULL;
|
---|
| 50 | model->elements_type=NULL;
|
---|
| 51 | model->numberofnodes2d=0;
|
---|
| 52 | model->elements2d=NULL;
|
---|
[88] | 53 | model->deadgrids=NULL;
|
---|
[1] | 54 | model->numlayers=0;
|
---|
[88] | 55 | model->uppernodes=NULL;
|
---|
[308] | 56 | model->gridonhutter=NULL;
|
---|
[653] | 57 | model->gridonmacayeal=NULL;
|
---|
| 58 | model->gridonpattyn=NULL;
|
---|
[1] | 59 |
|
---|
| 60 | model->vx_obs=NULL;
|
---|
| 61 | model->vy_obs=NULL;
|
---|
| 62 | model->vx=NULL;
|
---|
| 63 | model->vy=NULL;
|
---|
| 64 | model->vz=NULL;
|
---|
| 65 | model->pressure=NULL;
|
---|
[575] | 66 | model->temperature=NULL;
|
---|
| 67 | model->melting=NULL;
|
---|
[1] | 68 | model->elementonbed=NULL;
|
---|
| 69 | model->elementonsurface=NULL;
|
---|
| 70 | model->gridonbed=NULL;
|
---|
| 71 | model->gridonsurface=NULL;
|
---|
[377] | 72 | model->gridonstokes=NULL;
|
---|
| 73 | model->borderstokes=NULL;
|
---|
[1] | 74 | model->thickness=NULL;
|
---|
| 75 | model->surface=NULL;
|
---|
| 76 | model->bed=NULL;
|
---|
| 77 | model->elementoniceshelf=NULL;
|
---|
[1104] | 78 | model->elementonwater=NULL;
|
---|
[387] | 79 | model->gridonicesheet=NULL;
|
---|
[816] | 80 | model->gridoniceshelf=NULL;
|
---|
[1] | 81 |
|
---|
| 82 | model->drag_type=0;
|
---|
| 83 | model->drag=NULL;
|
---|
| 84 | model->p=NULL;
|
---|
[586] | 85 | model->q=NULL;
|
---|
[1] | 86 |
|
---|
| 87 |
|
---|
| 88 | model->numberofsegs_diag=0;
|
---|
[516] | 89 | model->numberofsegs_diag_stokes=0;
|
---|
[1] | 90 | model->segmentonneumann_diag=NULL;
|
---|
[387] | 91 | model->segmentonneumann_diag_stokes=NULL;
|
---|
[1] | 92 | model-> neumannvalues_diag=NULL;
|
---|
| 93 | model-> gridondirichlet_diag=NULL;
|
---|
| 94 | model-> dirichletvalues_diag=NULL;
|
---|
| 95 | //prognostic
|
---|
| 96 | model-> segmentonneumann_prog=NULL;
|
---|
| 97 | model-> neumannvalues_prog=NULL;
|
---|
| 98 | model-> gridondirichlet_prog=NULL;
|
---|
| 99 | model-> dirichletvalues_prog=NULL;
|
---|
| 100 | //prognostic2
|
---|
| 101 | model-> segmentonneumann_prog2=NULL;
|
---|
| 102 | model-> neumannvalues_prog2=NULL;
|
---|
| 103 | //thermal
|
---|
| 104 | model-> gridondirichlet_thermal=NULL;
|
---|
| 105 | model-> dirichletvalues_thermal=NULL;
|
---|
| 106 | model-> geothermalflux=NULL;
|
---|
| 107 |
|
---|
| 108 | /*!materials: */
|
---|
| 109 | model->rho_water=0;
|
---|
| 110 | model->rho_ice=0;
|
---|
[586] | 111 | model->g=0;
|
---|
| 112 | model->n=NULL;
|
---|
[1] | 113 | model->B=NULL;
|
---|
| 114 |
|
---|
| 115 | /*!control methods: */
|
---|
| 116 | model->control_type=NULL;
|
---|
| 117 |
|
---|
| 118 | /*!solution parameters: */
|
---|
| 119 | model->fit=NULL;
|
---|
| 120 | model->meanvel=0;
|
---|
| 121 | model->epsvel=0;
|
---|
| 122 | model->artificial_diffusivity=0;
|
---|
| 123 | model->nsteps=0;
|
---|
| 124 | model->tolx=0;
|
---|
| 125 | model->maxiter=NULL;
|
---|
| 126 | model->mincontrolconstraint=0;
|
---|
| 127 | model->maxcontrolconstraint=0;
|
---|
| 128 | model->debug=0;
|
---|
| 129 | model->plot=0;
|
---|
[1666] | 130 | model->eps_res=0;
|
---|
[1] | 131 | model->eps_rel=0;
|
---|
| 132 | model->eps_abs=0;
|
---|
| 133 | model->dt=0;
|
---|
| 134 | model->ndt=0;
|
---|
| 135 | model->penalty_offset=0;
|
---|
| 136 | model->penalty_melting=0;
|
---|
| 137 | model->penalty_lock=0;
|
---|
| 138 | model->sparsity=0;
|
---|
| 139 | model->connectivity=0;
|
---|
| 140 | model->lowmem=0;
|
---|
| 141 | model->optscal=NULL;
|
---|
| 142 | model->yts=0;
|
---|
| 143 | model->viscosity_overshoot=0;
|
---|
[387] | 144 | model->stokesreconditioning=0;
|
---|
[1] | 145 | model->waitonlock=0;
|
---|
| 146 |
|
---|
| 147 | /*!thermal parameters: */
|
---|
| 148 | model->beta=0;
|
---|
| 149 | model->meltingpoint=0;
|
---|
| 150 | model->latentheat=0;
|
---|
| 151 | model->heatcapacity=0;
|
---|
| 152 | model->thermalconductivity=0;
|
---|
| 153 | model->min_thermal_constraints=0;
|
---|
| 154 | model->mixed_layer_capacity=0;
|
---|
| 155 | model->thermal_exchange_velocity=0;
|
---|
| 156 |
|
---|
| 157 |
|
---|
| 158 | model->numrifts=0;
|
---|
[1628] | 159 | model->riftinfo=NULL;
|
---|
[1] | 160 |
|
---|
| 161 | /*!penalties: */
|
---|
| 162 | model->numpenalties=0;
|
---|
| 163 | model->penalties=NULL;
|
---|
| 164 | model->penaltypartitioning=NULL;
|
---|
| 165 |
|
---|
| 166 | /*!basal: */
|
---|
| 167 | model->melting=NULL;
|
---|
| 168 | model->accumulation=NULL;
|
---|
| 169 |
|
---|
[300] | 170 | /*elements type: */
|
---|
| 171 | model->ishutter=0;
|
---|
| 172 | model->ismacayealpattyn=0;
|
---|
| 173 | model->isstokes=0;
|
---|
| 174 |
|
---|
[586] | 175 |
|
---|
| 176 | model->epart=NULL;
|
---|
| 177 | model->npart=NULL;
|
---|
| 178 | model->my_grids=NULL;
|
---|
| 179 | model->my_bordergrids=NULL;
|
---|
| 180 |
|
---|
[1] | 181 | return model;
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 |
|
---|
| 185 | /*!--------------------------------------------------
|
---|
| 186 | DeleteModel
|
---|
| 187 | --------------------------------------------------*/
|
---|
| 188 |
|
---|
| 189 | void DeleteModel(Model** pmodel){
|
---|
| 190 |
|
---|
| 191 | /*!Recover structure: */
|
---|
| 192 | Model* model = *pmodel;
|
---|
| 193 |
|
---|
| 194 | int i;
|
---|
| 195 |
|
---|
| 196 | /*!Two cases here:
|
---|
| 197 | * - serial mode: matlab's memory manager will take care of delete model when returning from Imp. Do nothing here, so as not to confuse
|
---|
| 198 | * the memory manager.
|
---|
| 199 | * - in parallel, anything the io layer does (FetchData) did needs to be erased explicitely in the model.
|
---|
| 200 | */
|
---|
| 201 |
|
---|
| 202 | #ifdef _PARALLEL_
|
---|
| 203 | xfree((void**)&model->x);
|
---|
| 204 | xfree((void**)&model->y);
|
---|
| 205 | xfree((void**)&model->z);
|
---|
| 206 | xfree((void**)&model->elements);
|
---|
| 207 | xfree((void**)&model->elements_type);
|
---|
[308] | 208 | xfree((void**)&model->gridonhutter);
|
---|
[653] | 209 | xfree((void**)&model->gridonmacayeal);
|
---|
[1] | 210 | if (strcmp(model->meshtype,"3d")==0){
|
---|
| 211 | xfree((void**)&model->elements2d);
|
---|
| 212 | xfree((void**)&model->deadgrids);
|
---|
[88] | 213 | xfree((void**)&model->uppernodes);
|
---|
[653] | 214 | xfree((void**)&model->gridonpattyn);
|
---|
[1] | 215 | }
|
---|
| 216 | xfree((void**)&model->solverstring);
|
---|
| 217 | xfree((void**)&model->elementonbed);
|
---|
| 218 | xfree((void**)&model->elementonsurface);
|
---|
| 219 | xfree((void**)&model->gridonbed);
|
---|
| 220 | xfree((void**)&model->gridonsurface);
|
---|
[377] | 221 | xfree((void**)&model->gridonstokes);
|
---|
| 222 | xfree((void**)&model->borderstokes);
|
---|
[1] | 223 | xfree((void**)&model->thickness);
|
---|
| 224 | xfree((void**)&model->surface);
|
---|
| 225 | xfree((void**)&model->bed);
|
---|
| 226 | xfree((void**)&model->vx_obs);
|
---|
| 227 | xfree((void**)&model->vy_obs);
|
---|
| 228 | xfree((void**)&model->vx);
|
---|
| 229 | xfree((void**)&model->vy);
|
---|
| 230 | xfree((void**)&model->vz);
|
---|
| 231 | xfree((void**)&model->pressure);
|
---|
[575] | 232 | xfree((void**)&model->temperature);
|
---|
| 233 | xfree((void**)&model->melting);
|
---|
[1] | 234 | xfree((void**)&model->drag);
|
---|
| 235 | xfree((void**)&model->p);
|
---|
| 236 | xfree((void**)&model->q);
|
---|
| 237 | xfree((void**)&model->elementoniceshelf);
|
---|
[1104] | 238 | xfree((void**)&model->elementonwater);
|
---|
[387] | 239 | xfree((void**)&model->gridonicesheet);
|
---|
[816] | 240 | xfree((void**)&model->gridoniceshelf);
|
---|
[1] | 241 | xfree((void**)&model->segmentonneumann_diag);
|
---|
[387] | 242 | xfree((void**)&model->segmentonneumann_diag_stokes);
|
---|
[1] | 243 | xfree((void**)&model->neumannvalues_diag);
|
---|
| 244 | xfree((void**)&model->gridondirichlet_diag);
|
---|
| 245 | xfree((void**)&model->dirichletvalues_diag);
|
---|
| 246 | xfree((void**)&model->segmentonneumann_prog);
|
---|
| 247 | xfree((void**)&model->neumannvalues_prog);
|
---|
| 248 | xfree((void**)&model->gridondirichlet_prog);
|
---|
| 249 | xfree((void**)&model->dirichletvalues_prog);
|
---|
| 250 | xfree((void**)&model->segmentonneumann_prog2);
|
---|
| 251 | xfree((void**)&model->neumannvalues_prog2);
|
---|
| 252 | xfree((void**)&model->gridondirichlet_thermal);
|
---|
| 253 | xfree((void**)&model->dirichletvalues_thermal);
|
---|
| 254 | xfree((void**)&model->geothermalflux);
|
---|
| 255 | xfree((void**)&model->melting);
|
---|
| 256 | xfree((void**)&model->accumulation);
|
---|
| 257 | xfree((void**)&model->B);
|
---|
| 258 | xfree((void**)&model->n);
|
---|
| 259 | xfree((void**)&model->fit);
|
---|
| 260 | xfree((void**)&model->optscal);
|
---|
| 261 | xfree((void**)&model->maxiter);
|
---|
| 262 |
|
---|
| 263 |
|
---|
| 264 | /*!Delete structure fields: */
|
---|
| 265 | xfree((void**)&model->repository);
|
---|
| 266 | xfree((void**)&model->meshtype);
|
---|
[962] | 267 | xfree((void**)&model->name);
|
---|
[1] | 268 |
|
---|
[1628] | 269 | xfree((void**)&model->riftinfo);
|
---|
[1] | 270 |
|
---|
| 271 | xfree((void**)&model->penalties);
|
---|
| 272 | xfree((void**)&model->penaltypartitioning);
|
---|
| 273 |
|
---|
| 274 | xfree((void**)&model->control_type);
|
---|
| 275 |
|
---|
[387] | 276 | xfree((void**)&model->epart);
|
---|
| 277 | xfree((void**)&model->npart);
|
---|
| 278 | xfree((void**)&model->my_grids);
|
---|
| 279 | xfree((void**)&model->my_bordergrids);
|
---|
| 280 |
|
---|
[1] | 281 | /*!Delete entire structure: */
|
---|
| 282 | xfree((void**)pmodel);
|
---|
| 283 | #endif
|
---|
| 284 | }
|
---|
| 285 |
|
---|
| 286 | /*!--------------------------------------------------
|
---|
| 287 | ModelInit
|
---|
| 288 | --------------------------------------------------*/
|
---|
| 289 |
|
---|
| 290 | #undef __FUNCT__
|
---|
| 291 | #define __FUNCT__ "ModelInit"
|
---|
| 292 |
|
---|
| 293 | int ModelInit(Model** pmodel,ConstDataHandle model_handle){
|
---|
| 294 |
|
---|
| 295 | int i,j;
|
---|
| 296 |
|
---|
| 297 | /*output: */
|
---|
| 298 | Model* model=NULL;
|
---|
| 299 |
|
---|
| 300 | /*Allocate model: */
|
---|
| 301 | model=NewModel();
|
---|
| 302 |
|
---|
| 303 | /*In ModelInit, we get all the data that is not difficult to get, and that is small: */
|
---|
[962] | 304 | ModelFetchData((void**)&model->name,NULL,NULL,model_handle,"name","String",NULL);
|
---|
[1648] | 305 | ModelFetchData((void**)&model->analysis_type,NULL,NULL,model_handle,"analysis_type","Integer",NULL);
|
---|
| 306 | ModelFetchData((void**)&model->sub_analysis_type,NULL,NULL,model_handle,"sub_analysis_type","Integer",NULL);
|
---|
[586] | 307 | ModelFetchData((void**)&model->qmu_analysis,NULL,NULL,model_handle,"qmu_analysis","Integer",NULL);
|
---|
[1] | 308 | ModelFetchData((void**)&model->meshtype,NULL,NULL,model_handle,"type","String",NULL);
|
---|
| 309 | /*!Get numberofelements and numberofnodes: */
|
---|
| 310 | ModelFetchData((void**)&model->numberofnodes,NULL,NULL,model_handle,"numberofgrids","Integer",NULL);
|
---|
| 311 | ModelFetchData((void**)&model->numberofelements,NULL,NULL,model_handle,"numberofelements","Integer",NULL);
|
---|
| 312 | /*!In case we are running 3d, we are going to need the collapsed and non-collapsed 2d meshes, from which the 3d mesh was extruded: */
|
---|
| 313 | if (strcmp(model->meshtype,"3d")==0){
|
---|
| 314 |
|
---|
| 315 | /*!Deal with 2d mesh: */
|
---|
| 316 | ModelFetchData((void**)&model->numberofelements2d,NULL,NULL,model_handle,"numberofelements2d","Integer",NULL);
|
---|
| 317 | ModelFetchData((void**)&model->numberofnodes2d,NULL,NULL,model_handle,"numberofgrids2d","Integer",NULL);
|
---|
| 318 | ModelFetchData((void**)&model->numlayers,NULL,NULL,model_handle,"numlayers","Integer",NULL);
|
---|
| 319 | }
|
---|
[300] | 320 |
|
---|
[586] | 321 |
|
---|
[300] | 322 | /*elements type: */
|
---|
| 323 | ModelFetchData((void**)&model->ishutter,NULL,NULL,model_handle,"ishutter","Integer",NULL);
|
---|
| 324 | ModelFetchData((void**)&model->ismacayealpattyn,NULL,NULL,model_handle,"ismacayealpattyn","Integer",NULL);
|
---|
[394] | 325 | ModelFetchData((void**)&model->isstokes,NULL,NULL,model_handle,"isstokes","Integer",NULL);
|
---|
[300] | 326 |
|
---|
[1] | 327 | /*!Get drag_type, drag and p,q: */
|
---|
| 328 | ModelFetchData((void**)&model->drag_type,NULL,NULL,model_handle,"drag_type","Integer",NULL);
|
---|
| 329 |
|
---|
| 330 | /*!Get materials: */
|
---|
| 331 | ModelFetchData((void**)&model->rho_water,NULL,NULL,model_handle,"rho_water","Scalar",NULL);
|
---|
| 332 | ModelFetchData((void**)&model->rho_ice,NULL,NULL,model_handle,"rho_ice","Scalar",NULL);
|
---|
| 333 | ModelFetchData((void**)&model->g,NULL,NULL,model_handle,"g","Scalar",NULL);
|
---|
| 334 |
|
---|
| 335 | /*Get control parameters: */
|
---|
| 336 | ModelFetchData((void**)&model->control_type,NULL,NULL,model_handle,"control_type","String",NULL);
|
---|
| 337 |
|
---|
| 338 | /*!Get solution parameters: */
|
---|
| 339 | ModelFetchData((void**)&model->yts,NULL,NULL,model_handle,"yts","Scalar",NULL);
|
---|
| 340 | ModelFetchData((void**)&model->meanvel,NULL,NULL,model_handle,"meanvel","Scalar",NULL);
|
---|
| 341 | ModelFetchData((void**)&model->epsvel,NULL,NULL,model_handle,"epsvel","Scalar",NULL);
|
---|
| 342 | ModelFetchData((void**)&model->debug,NULL,NULL,model_handle,"debug","Integer",NULL);
|
---|
| 343 | ModelFetchData((void**)&model->plot,NULL,NULL,model_handle,"plot","Integer",NULL);
|
---|
| 344 | ModelFetchData((void**)&model->artificial_diffusivity,NULL,NULL,model_handle,"artificial_diffusivity","Integer",NULL);
|
---|
| 345 | ModelFetchData((void**)&model->nsteps,NULL,NULL,model_handle,"nsteps","Integer",NULL);
|
---|
| 346 | ModelFetchData((void**)&model->tolx,NULL,NULL,model_handle,"tolx","Scalar",NULL);
|
---|
| 347 | ModelFetchData((void**)&model->mincontrolconstraint,NULL,NULL,model_handle,"mincontrolconstraint","Scalar",NULL);
|
---|
| 348 | ModelFetchData((void**)&model->maxcontrolconstraint,NULL,NULL,model_handle,"maxcontrolconstraint","Scalar",NULL);
|
---|
[1666] | 349 | ModelFetchData((void**)&model->eps_res,NULL,NULL,model_handle,"eps_res","Scalar",NULL);
|
---|
[1] | 350 | ModelFetchData((void**)&model->eps_rel,NULL,NULL,model_handle,"eps_rel","Scalar",NULL);
|
---|
| 351 | ModelFetchData((void**)&model->eps_abs,NULL,NULL,model_handle,"eps_abs","Scalar",NULL);
|
---|
| 352 | ModelFetchData((void**)&model->dt,NULL,NULL,model_handle,"dt","Scalar",NULL);
|
---|
| 353 | ModelFetchData((void**)&model->ndt,NULL,NULL,model_handle,"ndt","Scalar",NULL);
|
---|
| 354 | ModelFetchData((void**)&model->penalty_offset,NULL,NULL,model_handle,"penalty_offset","Scalar",NULL);
|
---|
| 355 | ModelFetchData((void**)&model->penalty_melting,NULL,NULL,model_handle,"penalty_melting","Scalar",NULL);
|
---|
| 356 | ModelFetchData((void**)&model->penalty_lock,NULL,NULL,model_handle,"penalty_lock","Integer",NULL);
|
---|
| 357 | ModelFetchData((void**)&model->sparsity,NULL,NULL,model_handle,"sparsity","Scalar",NULL);
|
---|
| 358 | ModelFetchData((void**)&model->connectivity,NULL,NULL,model_handle,"connectivity","Integer",NULL);
|
---|
| 359 | ModelFetchData((void**)&model->lowmem,NULL,NULL,model_handle,"lowmem","Integer",NULL);
|
---|
| 360 | ModelFetchData((void**)&model->solverstring,NULL,NULL,model_handle,"solverstring","String",NULL);
|
---|
| 361 | ModelFetchData((void**)&model->viscosity_overshoot,NULL,NULL,model_handle,"viscosity_overshoot","Scalar",NULL);
|
---|
[387] | 362 | ModelFetchData((void**)&model->stokesreconditioning,NULL,NULL,model_handle,"stokesreconditioning","Scalar",NULL);
|
---|
[1] | 363 | ModelFetchData((void**)&model->waitonlock,NULL,NULL,model_handle,"waitonlock","Integer",NULL);
|
---|
| 364 |
|
---|
| 365 | /*!Get thermal parameters: */
|
---|
| 366 | ModelFetchData((void**)&model->beta,NULL,NULL,model_handle,"beta","Scalar",NULL);
|
---|
| 367 | ModelFetchData((void**)&model->meltingpoint,NULL,NULL,model_handle,"meltingpoint","Scalar",NULL);
|
---|
| 368 | ModelFetchData((void**)&model->latentheat,NULL,NULL,model_handle,"latentheat","Scalar",NULL);
|
---|
| 369 | ModelFetchData((void**)&model->heatcapacity,NULL,NULL,model_handle,"heatcapacity","Scalar",NULL);
|
---|
| 370 | ModelFetchData((void**)&model->thermalconductivity,NULL,NULL,model_handle,"thermalconductivity","Scalar",NULL);
|
---|
| 371 | ModelFetchData((void**)&model->min_thermal_constraints,NULL,NULL,model_handle,"min_thermal_constraints","Integer",NULL);
|
---|
| 372 | ModelFetchData((void**)&model->mixed_layer_capacity,NULL,NULL,model_handle,"mixed_layer_capacity","Scalar",NULL);
|
---|
| 373 | ModelFetchData((void**)&model->thermal_exchange_velocity,NULL,NULL,model_handle,"thermal_exchange_velocity","Scalar",NULL);
|
---|
[358] | 374 |
|
---|
[586] | 375 | /*qmu: */
|
---|
| 376 | if(model->qmu_analysis){
|
---|
[765] | 377 | ModelFetchData((void**)&model->numberofvariables,NULL,NULL,model_handle,"numberofvariables","Integer",NULL);
|
---|
[586] | 378 | ModelFetchData((void**)&model->numberofresponses,NULL,NULL,model_handle,"numberofresponses","Integer",NULL);
|
---|
| 379 | ModelFetchData((void**)&model->qmu_npart,NULL,NULL,model_handle,"npart","Integer",NULL);
|
---|
| 380 | }
|
---|
| 381 |
|
---|
[1] | 382 | /*Assign output pointers: */
|
---|
| 383 | *pmodel=model;
|
---|
| 384 |
|
---|
| 385 | return 1;
|
---|
| 386 | }
|
---|
| 387 |
|
---|
| 388 | /*!--------------------------------------------------
|
---|
| 389 | ModelEcho
|
---|
| 390 | --------------------------------------------------*/
|
---|
| 391 | void ModelEcho(Model* model,int which_part,int rank) {
|
---|
| 392 |
|
---|
| 393 | //which_part determines what gets echoed, otherwise, we'll get too much output.
|
---|
| 394 | //1-> penalties
|
---|
| 395 |
|
---|
| 396 | int i,j;
|
---|
| 397 |
|
---|
| 398 | if(which_part==1 && my_rank==rank && (strcmp(model->meshtype,"3d")==0)){
|
---|
| 399 | printf("Model penalties: \n");
|
---|
| 400 | printf(" number of penalties: %i\n",model->numpenalties);
|
---|
| 401 | printf(" grids: \n");
|
---|
| 402 |
|
---|
| 403 | for(i=0;i<model->numpenalties;i++){
|
---|
| 404 | for(j=0;j<model->numlayers;j++){
|
---|
| 405 | printf("%i ",(int)*(model->penalties+model->numlayers*i+j));
|
---|
| 406 | }
|
---|
| 407 | printf("\n");
|
---|
| 408 | }
|
---|
| 409 | }
|
---|
| 410 |
|
---|
| 411 | return;
|
---|
| 412 | }
|
---|