source: issm/trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp@ 13798

Last change on this file since 13798 was 13798, checked in by Mathieu Morlighem, 12 years ago

CHG: use dynamic_cast instead of C-style casting

File size: 1.2 KB
Line 
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
11void 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 /*retrive parameters: */
24 parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
25
26 /*Get size of vector: */
27 gsize=nodes->NumberOfDofs(configuration_type,GsetEnum);
28 if (gsize==0) _error_("Allocating a Vec of size 0 as gsize=0 for configuration: " << EnumToStringx(configuration_type));
29
30 /*Initialize solution: */
31 solution=new Vector<IssmDouble>(gsize);
32
33 /*Go through elements and plug solution: */
34 for (i=0;i<elements->Size();i++){
35 element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
36 element->GetSolutionFromInputs(solution);
37 }
38
39 /*Assemble vector: */
40 solution->Assemble();
41
42 /*Assign output pointers:*/
43 *psolution=solution;
44
45}
Note: See TracBrowser for help on using the repository browser.