| 1 | /*!\file GetSolutionFromInputsx | 
|---|
| 2 | * \brief: update datasets using  parameter inputs | 
|---|
| 3 | */ | 
|---|
| 4 |  | 
|---|
| 5 | #include "./GetSolutionFromInputsx.h" | 
|---|
| 6 | #include "../../shared/shared.h" | 
|---|
| 7 | #include "../../include/include.h" | 
|---|
| 8 | #include "../../toolkits/toolkits.h" | 
|---|
| 9 | #include "../../EnumDefinitions/EnumDefinitions.h" | 
|---|
| 10 |  | 
|---|
| 11 | void    GetSolutionFromInputsx( Vector<IssmDouble>** psolution, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters){ | 
|---|
| 12 |  | 
|---|
| 13 | /*intermediary: */ | 
|---|
| 14 | int gsize; | 
|---|
| 15 | int i; | 
|---|
| 16 | Element* element=NULL; | 
|---|
| 17 |  | 
|---|
| 18 | int configuration_type; | 
|---|
| 19 |  | 
|---|
| 20 | /*output: */ | 
|---|
| 21 | Vector<IssmDouble>* solution=NULL; | 
|---|
| 22 |  | 
|---|
| 23 | if(VerboseModule()) _pprintLine_("   Get solution from inputs"); | 
|---|
| 24 |  | 
|---|
| 25 | /*retrive parameters: */ | 
|---|
| 26 | parameters->FindParam(&configuration_type,ConfigurationTypeEnum); | 
|---|
| 27 |  | 
|---|
| 28 | /*Get size of vector: */ | 
|---|
| 29 | gsize=nodes->NumberOfDofs(configuration_type,GsetEnum); | 
|---|
| 30 | if (gsize==0) _error_("Allocating a Vec of size 0 as gsize=0 for configuration: " << EnumToStringx(configuration_type)); | 
|---|
| 31 |  | 
|---|
| 32 | /*Initialize solution: */ | 
|---|
| 33 | solution=new Vector<IssmDouble>(gsize); | 
|---|
| 34 |  | 
|---|
| 35 | /*Go through elements and plug solution: */ | 
|---|
| 36 | for (i=0;i<elements->Size();i++){ | 
|---|
| 37 | element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); | 
|---|
| 38 | element->GetSolutionFromInputs(solution); | 
|---|
| 39 | } | 
|---|
| 40 |  | 
|---|
| 41 | /*Assemble vector: */ | 
|---|
| 42 | solution->Assemble(); | 
|---|
| 43 |  | 
|---|
| 44 | /*Assign output pointers:*/ | 
|---|
| 45 | *psolution=solution; | 
|---|
| 46 |  | 
|---|
| 47 | } | 
|---|