1 | /*!\file GetSolutionFromInputsx
|
---|
2 | * \brief: update datasets using parameter inputs
|
---|
3 | */
|
---|
4 |
|
---|
5 | #include "./GetSolutionFromInputsx.h"
|
---|
6 | #include "../../shared/shared.h"
|
---|
7 | #include "../../toolkits/toolkits.h"
|
---|
8 |
|
---|
9 | void GetSolutionFromInputsx(Vector<IssmDouble>** psolution,FemModel* femmodel){/*{{{*/
|
---|
10 |
|
---|
11 | if(VerboseModule()) _printf0_(" Get solution from inputs\n");
|
---|
12 |
|
---|
13 | /*retrieve parameters: */
|
---|
14 | int analysisenum;
|
---|
15 | femmodel->parameters->FindParam(&analysisenum,AnalysisTypeEnum);
|
---|
16 |
|
---|
17 | /*Get size of vector: */
|
---|
18 | int gsize = femmodel->nodes->NumberOfDofs(GsetEnum);
|
---|
19 | int gsize_local = femmodel->nodes->NumberOfDofsLocal(GsetEnum);
|
---|
20 | if(gsize==0) _error_("Allocating a Vec of size 0 as gsize=0 ");
|
---|
21 |
|
---|
22 | /*Initialize solution: */
|
---|
23 | Vector<IssmDouble>* solution=new Vector<IssmDouble>(gsize_local,gsize);
|
---|
24 |
|
---|
25 | /*Go through elements and plug solution: */
|
---|
26 | Analysis* analysis = EnumToAnalysis(analysisenum);
|
---|
27 | for(Object* & object : femmodel->elements->objects){
|
---|
28 | Element* element=xDynamicCast<Element*>(object);
|
---|
29 | analysis->GetSolutionFromInputs(solution,element);
|
---|
30 | }
|
---|
31 | delete analysis;
|
---|
32 |
|
---|
33 | /*Assemble vector: */
|
---|
34 | solution->Assemble();
|
---|
35 |
|
---|
36 | /*Assign output pointers:*/
|
---|
37 | *psolution=solution;
|
---|
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 | }/*}}}*/
|
---|