| [3821] | 1 | /*!\file GetSolutionFromInputsx
|
|---|
| 2 | * \brief: update datasets using parameter inputs
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | #include "./GetSolutionFromInputsx.h"
|
|---|
| [3913] | 6 | #include "../../shared/shared.h"
|
|---|
| 7 | #include "../../toolkits/toolkits.h"
|
|---|
| [3821] | 8 |
|
|---|
| [25539] | 9 | void GetSolutionFromInputsx(Vector<IssmDouble>** psolution,FemModel* femmodel){/*{{{*/
|
|---|
| [3821] | 10 |
|
|---|
| [15104] | 11 | if(VerboseModule()) _printf0_(" Get solution from inputs\n");
|
|---|
| [3821] | 12 |
|
|---|
| [23612] | 13 | /*retrieve parameters: */
|
|---|
| 14 | int analysisenum;
|
|---|
| [16675] | 15 | femmodel->parameters->FindParam(&analysisenum,AnalysisTypeEnum);
|
|---|
| [4043] | 16 |
|
|---|
| [3821] | 17 | /*Get size of vector: */
|
|---|
| [23612] | 18 | int gsize = femmodel->nodes->NumberOfDofs(GsetEnum);
|
|---|
| 19 | int gsize_local = femmodel->nodes->NumberOfDofsLocal(GsetEnum);
|
|---|
| [23587] | 20 | if(gsize==0) _error_("Allocating a Vec of size 0 as gsize=0 ");
|
|---|
| [13622] | 21 |
|
|---|
| [3821] | 22 | /*Initialize solution: */
|
|---|
| [23612] | 23 | Vector<IssmDouble>* solution=new Vector<IssmDouble>(gsize_local,gsize);
|
|---|
| [13622] | 24 |
|
|---|
| [3821] | 25 | /*Go through elements and plug solution: */
|
|---|
| [16675] | 26 | Analysis* analysis = EnumToAnalysis(analysisenum);
|
|---|
| [25539] | 27 | for(Object* & object : femmodel->elements->objects){
|
|---|
| 28 | Element* element=xDynamicCast<Element*>(object);
|
|---|
| [16675] | 29 | analysis->GetSolutionFromInputs(solution,element);
|
|---|
| [3971] | 30 | }
|
|---|
| [16675] | 31 | delete analysis;
|
|---|
| [3821] | 32 |
|
|---|
| 33 | /*Assemble vector: */
|
|---|
| [11679] | 34 | solution->Assemble();
|
|---|
| [3821] | 35 |
|
|---|
| 36 | /*Assign output pointers:*/
|
|---|
| 37 | *psolution=solution;
|
|---|
| [25539] | 38 | }/*}}}*/
|
|---|
| 39 |
|
|---|
| 40 | void GetBasalSolutionFromInputsx(Vector<IssmDouble>** psolution,FemModel* femmodel){ /*{{{*/
|
|---|
| 41 |
|
|---|
| 42 | if(VerboseModule()) _printf0_(" Get solution from inputs\n");
|
|---|
| 43 |
|
|---|
| 44 | /*retrieve parameters: */
|
|---|
| 45 | int analysisenum;
|
|---|
| 46 | int domaintype;
|
|---|
| 47 | femmodel->parameters->FindParam(&analysisenum,AnalysisTypeEnum);
|
|---|
| 48 | femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
|
|---|
| 49 | /*Get size of vector: */
|
|---|
| 50 | int gsize = femmodel->nodes->NumberOfDofs(GsetEnum);
|
|---|
| 51 | int gsize_local = femmodel->nodes->NumberOfDofsLocal(GsetEnum);
|
|---|
| 52 | if(gsize==0) _error_("Allocating a Vec of size 0 as gsize=0 ");
|
|---|
| 53 |
|
|---|
| 54 | /*Initialize solution: */
|
|---|
| 55 | Vector<IssmDouble>* solution=new Vector<IssmDouble>(gsize_local,gsize);
|
|---|
| 56 |
|
|---|
| 57 | /*Go through elements and plug solution: */
|
|---|
| 58 | Analysis* analysis = EnumToAnalysis(analysisenum);
|
|---|
| 59 | for(Object* & object : femmodel->elements->objects){
|
|---|
| 60 | Element* element=xDynamicCast<Element*>(object);
|
|---|
| 61 | switch(domaintype){
|
|---|
| 62 | case Domain2DhorizontalEnum:
|
|---|
| 63 | analysis->GetSolutionFromInputs(solution,element);
|
|---|
| 64 | break;
|
|---|
| 65 | case Domain3DEnum:
|
|---|
| 66 | if(!element->IsOnBase()) continue;
|
|---|
| 67 | analysis->GetSolutionFromInputs(solution,element);
|
|---|
| 68 | break;
|
|---|
| 69 | default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
|
|---|
| 70 | }
|
|---|
| 71 | }
|
|---|
| 72 | delete analysis;
|
|---|
| 73 |
|
|---|
| 74 | /*Assemble vector: */
|
|---|
| 75 | solution->Assemble();
|
|---|
| 76 |
|
|---|
| 77 | /*Assign output pointers:*/
|
|---|
| 78 | *psolution=solution;
|
|---|
| 79 | }/*}}}*/
|
|---|