1 //#**************************************************************
2 //#
3 //# filename:             mbs.h
4 //#
5 //# author:               Gerstmayr Johannes
6 //#
7 //# generated:						July 2004
8 //# description:          Driver and model for timeintegration
9 //#                       Model of a rigid arm and a hydraulic zylinder
10 //# remarks:
11 //#
12 //# Copyright (c) 2003-2013 Johannes Gerstmayr, Linz Center of Mechatronics GmbH, Austrian
13 //# Center of Competence in Mechatronics GmbH, Institute of Technical Mechanics at the
14 //# Johannes Kepler Universitaet Linz, Austria. All rights reserved.
15 //#
16 //# This file is part of HotInt.
17 //# HotInt is free software: you can redistribute it and/or modify it under the terms of
18 //# the HOTINT license. See folder 'licenses' for more details.
19 //#
20 //# bug reports are welcome!!!
21 //# WWW:		www.hotint.org
22 //# email:	bug_reports@hotint.org or support@hotint.org
23 //#***************************************************************************************
24 
25 
26 
27 
28 #ifndef MBS__H
29 #define MBS__H
30 
31 #include "timeint.h"
32 #include "geomelements.h"
33 #include "ElementsAndModelsLibraryInterface.h"
34 
35 class CEDCParser;
36 
37 void TIMBSWarningHandle(const char* warn, int use_instant_message_text=0);
38 
39 //$!YV 2012-11-28:	MultiBodySystem is now the class itself, and MBS is an interface for its functionality,
40 //									which may be required by elements and model functions
41 class MultiBodySystem : public TimeInt
42 {
43 public:
44 	MultiBodySystem();
45 
46 	virtual ~MultiBodySystem();
47 
48 	virtual void Destroy();
49 
ClearSystem()50 	virtual void ClearSystem()
51 	{
52 		Destroy();
53 	};
54 	virtual void InitFirst();
55 	virtual void InitGlobalEDCVariables();
56 
57 	//# Timeint specific derived functions (must)
58 	virtual void PerformComputation();
59 	virtual int ComputeSystem(); //do integration/static computation or eigenmode analysis or other
60 
61 	virtual void PerformSingleStaticDynamicComputation(); // perform single computation
62 	virtual void PerformParameterVariation(); // perform parameter variation
63 	//$!PG 2011-2-22:[DoParameterVariationComputation is needed in PerformParameterVariation()
64 	virtual bool DoParameterVariationComputation(bool const isgeometric, const double par, const double varstep, const double varstepfact, const double varend) const;
65 	//$!PG 2011-2-22:]
66 	//$ YV 2012-11-28[
67 	//virtual int PerformOptimization(MBS* mbs); // perform optimization of parameters using sensor values as cost function (e.g.: Newton, Genetic)
68 	//virtual int PerformSensitivityAnalysis(MBS* mbs); // analyze sensitivity of sensor values with respect to parameters
69 	//$ YV ]
70 	virtual double EvalSensorCostFunctionVal(); // evaluate cost functions of sensors
71 	virtual int ComputeEigenmodes(); // compute eigenmodes of system, rv==0 --> ok, rv==1 --> not ok
72 
73 	virtual int RepeatedlyPerformComputation(int flags=0); //repeatedly call computation (integration) and do pre/postcomputation, sensor evaluation, etc....
74 
75 	virtual int PreComputationOperations(int flags=0); //flag&1==>always set initial conditions;return 1==OK, return 0==FAILED ==> ABORT simulation
76 
77 	virtual void PostComputationOperations(int integrate_rv); //write log messages, so some sensor computations, etc.
78 	virtual void DoFinalSensorEvaluations(); //do final sensor evaluations (min/max/diff, etc.) for sensors after computation
79 	virtual void WriteSolutionVector(); //write solution vector into file if option is set
80 
81 	//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
82 	// initialization
83 
84 	virtual void SetInitialConditions();
85 	virtual void Initialize();
86 	virtual void InitializeAfterConfigLoaded();
87 
88 	//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
89 	// load save files
90 	virtual void OpenFiles(int flag); //flag&1==append
91 	virtual void OpenLogFile(int flag); //flag&1==append
92 	virtual bool LogFileNameChanged();
93 	virtual void CloseLogFile();
94 	virtual void CloseFiles();
95 	virtual int SaveSolutionVector(const mystr& filename); //rv=1 --> OK
96 	virtual int LoadInitialVector(const mystr& filename);  //rv=1 --> OK
97 
98 	//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
99 	//MBS_communication
100 	virtual void SetOptions2EDCOptions(); //copy numbered i/d/t options to EDC Tree options
101 	virtual void SetEDCOptions2Options(); //copy EDC Tree options to numbered i/d/t options
102 
103 	virtual void SetSolverDialogOptions();
104 	virtual void SetComputationSolverOptions();
105 
106 	virtual void SolverOptions2EDC(ElementDataContainer* edc);
107 	virtual void EDC2SolverOptions(const ElementDataContainer* edc);
108 	virtual void EDC2Options(const ElementDataContainer* edc); // implemented in auto - generated file "options_mbs_auto.h"
109 	virtual void Options2EDC(ElementDataContainer* edc); // implemented in  auto - generated file "options_mbs_auto.h"
110 
111 
112 	virtual void GetElementData(int i, int type, int value, ElementDataContainer& edc);
113 	virtual int SetElementData(int i, int type, int value, ElementDataContainer& edc);
114 
GetTimeIntLog()115 	virtual TimeIntLog GetTimeIntLog() const {return log; }
116 
117 	//$AD 2013-07-08: Manipulate Content of arrays in IOElements from 2D Draw Window
118 	virtual void InsertIOElemConNode(int elemnr, int list_idx, int input_nr, Vector2D pos);
119 	virtual void DeleteIOElemConNode(int elemnr, int list_idx);
120 	//$AD 2013-07-10: Change Position of a single element (MBS element, conNode, ...)
121 	virtual void MoveConNode2D(int elemnr, int list_idx, double delta_x, double delta_y);
122 	virtual void MoveElement(int elemnr, double delta_x, double delta_y, double delta_z = 0.);
123 
124 
125 	//call function/perform action in MBS-System:
126 	virtual int CallCompFunction(int action, int option=0, int value=0, ElementDataContainer* edc=NULL);
127 
128 	virtual int CheckSystemConsistency();//check system; rv==0 --> OK, rv==1 --> can not compute, rv==2 --> can not draw and not compute
129 	virtual int CheckConsistencyLTG();
130 	virtual int CheckConsistencyElements();
131 	virtual int CheckConsistencySensors();
132 	virtual int CheckConsistencyNodes();
133 	virtual int CheckConsistencyMaterials();
134 
135 
136 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
137 	//element and file access:
138 	virtual void SaveToFile(mystr filename, int save_options=1);
139 	virtual int LoadFromFile(mystr filename); //return 1 if success, 0 otherwise
IsLoadSaveMode()140 	virtual int IsLoadSaveMode() const {return isloadsavemode;}
141 	//$ YV 2012-12-30: this function was used only in script_parser - moved to script parser
142 	//virtual void LoadError(const mystr& str) {UO()<< "Error in load file: " << str.c_str() << "\n";}
EDCError(const mystr & str)143 	virtual void EDCError(const mystr& str) {UO()<< "Error in element data: " << str.c_str() << "\n";}
144 
145 
146 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
147 	//these functions are called from WCDriver via WinCompInterface:
148 	virtual MBSObjectFactoryInterface * GetObjectFactory();
149 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
150 	//mbs_edc_options
151 	virtual ElementDataContainer* GetMBS_EDC_Options();
152 	virtual const ElementDataContainer* GetMBS_EDC_Options() const;
153 	virtual void SetMBS_EDC_Options(const ElementDataContainer& edc);
154 
155 	virtual ElementDataContainer* GetMBS_EDC_Variables();
156 	virtual const ElementDataContainer* GetMBS_EDC_Variables() const;
157 	virtual void SetMBS_EDC_Variables(const ElementDataContainer& edc);
158 
159 	//get values in MBS_EDC:
160 	virtual void MBS_EDC_TreeGetDouble(double& data, const char* name) const;
161 	virtual void MBS_EDC_TreeGetInt(int& data, const char* name) const;
162 	virtual const char* MBS_EDC_TreeGetString(const char* name) const;
163 	//set values in MBS_EDC:
164 	virtual void MBS_EDC_TreeSetDouble(double data, const char* name);
165 	virtual void MBS_EDC_TreeSetInt(int data, const char* name);
166 	virtual void MBS_EDC_TreeSetString(const char* data, const char* name);
167 
168 	//$ YV 2012-11-28: commented out
169 	//virtual const MBS* GetMBS() const {return this;}
170 
171 	virtual const CMBSParser& MBSParser() const;
172 	virtual CMBSParser& MBSParser();
173 	virtual const CEDCParser& EDCParser() const;
174 	virtual CEDCParser& EDCParser();
175 
176 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
177 	//model data container
GetModelDataContainer()178 	virtual ElementDataContainer* GetModelDataContainer() {return edc_modeldata;}
GetModelDataContainer_args()179 	virtual ElementDataContainer* GetModelDataContainer_args() {return &modeldata_edc_args;}
SetModelDataContainer(const ElementDataContainer & edc)180 	virtual void SetModelDataContainer(const ElementDataContainer& edc)
181 	{
182 		if (edc_modeldata != 0)
183 		{
184 			delete edc_modeldata;
185 			edc_modeldata = 0;
186 		}
187 
188 		edc_modeldata = new ElementDataContainer;
189 
190 		edc_modeldata->CopyFrom(edc);
191 	}
192 	virtual void AddReplaceModelDataEDC(/*const */ElementDataContainer& edc);//$ RL 2011-6-16: function for adding or replacing model data edc with data from file
193 	virtual int ReadModelData(mystr filename); //read model data from file; return 1 in case of success, 0 else
194 	virtual int File2Str(const char* filename, mystr& str); // this function reads a file into a mystr
195 	virtual int File2EDC(const char* filename, ElementDataContainer* edc_file); //this function reads a file and stores it in an edc
196 
197 	virtual int LoadVectorFromFile(const char* filename, int col, ElementDataContainer* return_value);	//$ DR 2013-07-04: reads a column of a file and stores the vector in an edc
198 
199 	// this function reads a stl-file and writes the data in the edc
200 	virtual int STLFile2EDC(char* file, int binary, ElementDataContainer* return_value); //DR 2013-01-14
201 
202 	//this function computes mass, moment of inertia, volume and center of gravity based on the data about the geometry and the material
203 	virtual int ComputeInertia(ElementDataContainer* data, ElementDataContainer* return_value); //$ DR 2013-01-30
204 
205 	//$ YV 2012-12-30: moved this function to femathhelperfunctions.h
206 	//$ RL 2012-7-25:[
207 	/*
208 	virtual int DoesFileExist(mystr filename, int warn = 1);// this function tries to open a file and returns 1 if the file was OK, otherwise 0; if the flag 'warn' is set to 1, an warning text message appears if file was not found
209 	virtual const int DoesFileExist(mystr filename, int warn = 1) const;// this function tries to open a file and returns 1 if the file was OK, otherwise 0; if the flag 'warn' is set to 1, an warning text message appears if file was not found
210 	*/
211 //$ RL 2012-7-25:]
212 	virtual int AddModelData(mystr filename); // add/replace model data to edc_model_data from a file; return 1 in case of success, 0 else
213 	virtual int RemoveVariableFromEDCTree(ElementDataContainer& edc, mystr& varname, int warning); // remove a variable or branch from the edc by name - this is used to prevent ComputationSteps to be written to file and to be remembered from a previous model
IsModelData_Initialized()214 	virtual int IsModelData_Initialized() const {return modeldata_initialized;}
SetModelData_Initialized(int flag)215 	virtual void SetModelData_Initialized(int flag) {modeldata_initialized = flag;}
216 	virtual int AddFileSensor(const char* filename, const mystr sensor_name, const int ncolumns, const int colTime, const int colSignal, const int interpolation=0, const int nrOfHeaderLines=0); // 3 elements are created to "measure" data from columns of a file (time->IOMathFunction->MBSSensor), accurate during whole computation, e.g. sensor data is used during computation not only for viewing
217 	virtual int AddFileSensor2(const char* filename, const mystr sensor_name, const int colTime, const int colSignal, const int interpolation=0, mystr comment = mystr("%"));                     // just one MBSSensor is created to "measure" data from columns of a file, accurate at begin/end of solver time steps, recommended for use e.g. to plot signals from files to compare the solution with the file values
218 
219 	//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
220 	//access to model functions
221 
222 	//$ YV 2013-01-02: some of the functions below are no longer necessary - they are replaced
223 	// by the models library in the elements and models module
224 
225 	//virtual int GetNumberOfModelFunctions() const ;					     //return number of available model functions
226 	//virtual char* GetModelFunctionName(int index0) const;        //return model name string
227 	//virtual char* GetModelFunctionDescription(int index0) const; //return model description string
228 	//virtual int GetModelFunctionOption(int index0) const;				 //return option of model function
229 	//virtual int CallModelFunction(int index0);										//Call model function with index "index0"
230 	virtual int GetModelFunctionsIndex0();
231 
232 	//virtual int CallModelFunction_InitModelData(int index0);			//Call initialization function for model data
233 	//virtual int ModelFunctionHasInitModelData(int index0);
234 
235 	virtual void ModelFunctionChanged();
236 
237 	// this function returns the current hotint version, as defined in "WorkingModule\hotint_version.h",
GetHotintVersion()238 	virtual const HotintVersionInfo& GetHotintVersion() const {return WCDInterface::GetHotintVersion();}
239 
240 	//$ YV 2013-01-02: models library from the models and elements module
241 private:
242 	MBSModelsLibraryInterface * pModelsLibrary;
243 
244 public:
GetModelsLibrary()245 	MBSModelsLibraryInterface * GetModelsLibrary() { return pModelsLibrary; }
SetModelsLibrary(MBSModelsLibraryInterface * pModelsLibrary)246 	void SetModelsLibrary(MBSModelsLibraryInterface * pModelsLibrary) { this->pModelsLibrary = pModelsLibrary; }
247 
248 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
249 
250 	//# output and drawing
251 	virtual void WriteSol();
252 	virtual void DrawSystem();
253 	virtual void DrawSystem2D();
254 
255 
256 	virtual void WriteSolDataInfo();
257 	virtual int ReadSolDataInfo(); // returns number of stored solution data files
258 
259 	virtual void DrawBodies();
260 	virtual void DrawConstraints();
261 	virtual void DrawSensors();
262 	virtual void DrawLoads();
263 	virtual void DrawNodes();
264 
265 	virtual void PrecomputeEvalFunctions(); //$ PG 2012-1-15: precomputation for EvalF(), EvalF2(), EvalG(), EvalM(), and also for CqTLambda() in case of constraints
266 
267 	virtual void EvalF(const Vector& x, Vector& f, double t);  //*first order equations: \dot q=f(q,t), return vector:  len(q)
268 	virtual void EvalG(const Vector& x, Vector& f, double t); //*evaluate constraints: len(z)
269 	virtual void EvalG(const Vector& x, SparseVector& f, double t, IVector& rowind, IVector& clearind); //only for jacobian, rowind and clearind for speedup, rowind must be initialized with zeros and l=f.Length()
270 
271 	virtual void EvalM(const Vector& x, Matrix& m, double t);
272 	virtual void EvalM(const Vector& x, SparseMatrix& m, double t);
273 
274 	virtual void EvalF2(const Vector& x, Vector& f, double t); //*second order equations: M \ddot u = F2(u,\dot u,t), len(u)
275 	virtual void EvalMinvF2(const Vector& x, Vector& f, double t); //*second order equations: M \ddot u = F2(u,\dot u,t), len(u)
276 	virtual void EvalF2(const Vector& x, SparseVector& f, double t,
277 		IVector& rowind, IVector& clearind, IVector& elems); //only for jacobian, rowind and clearind for speedup, rowind must be initialized with zeros and l=f.Length()
278 	virtual void LocalJacobianF2(SparseMatrix& m, Vector& x);
279 	virtual void StaticJacobianF2(SparseMatrix& m, Vector& x); //new version, which replaces local jacobian f2 for static comptutation
280 	virtual void LocalJacobianF2(Matrix& m, Vector& x);  //Compute (df2/dx)
281 	virtual void LocalJacobianG(SparseMatrix& m, Vector& x);
282 	virtual void ComputeSparseMatrixUsage(IVector& usage_per_dof); //compute entries of each row in sparse matrix
283 
284 	virtual double GetKineticEnergy();  //compute kinetic energy of system
285 	virtual double GetPotentialEnergy();//compute potential (strain) energy of system
286 
287 	virtual int GetImplicitSize() const;
288 	virtual int GetSecondOrderSize() const;  //*size of second order equations, len(u)
289 	virtual int GetSecondOrderSize_RS() const;  //*size of second order equations, len(u), after resorting!!!!
290 	virtual int GetFirstOrderSize() const;  //*size of first order equations
291 	virtual int GetResortSize() const;  //*size of first order equations
292 	virtual int GetDataSize() const; //size of data variables for each time step of system
293 
294 	//# Timeint specific derived functions: for discontinuities
295 	virtual void StartTimeStep();
296 	virtual void EndTimeStep();
297 	//function is called when computation of time step is started
298 	virtual double PostNewtonStep(double t);
299 	virtual void PostprocessingStep();
300 	virtual double GetError();
301 
302 	virtual void ComputationFinished(); //$ MaSch 2013-08-08
303 
304 	//virtual int UseSparse() const {return 0;}
ResortActive()305 	virtual int ResortActive() const {return resort_active;}
SetResortActive(int flag)306 	virtual void SetResortActive(int flag) {resort_active = flag;}
ResortMode2()307 	virtual int ResortMode2() const {return 1;}
308 
309 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
310   //# Computation Steps with changing SolverOptions...
311 	//Time mapping
312 	virtual int ParseStepEndTimes();       // parses all EDC for ComputationSteps entries - implemented in MBS
313 	virtual int DoubleCheckWithLoadSettings();
314 	virtual ElementDataContainer* GetComputationStepEDC(int computation_step_number);
315 	virtual int GetMaxLoadSteps() const;   // maximal number of loadsteps from all loads - there MUST be at least that many computation steps...
316   virtual int AddDummyComputationStep(); // additional computationsteps if loadsteps supercede computation steps, interval always 1 sec*
317 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
318   //# Computation Steps with changing SolverOptions...
319   //replace solver options
320 	virtual int ApplyComputationStepSettings(int stepnumber);  // changes the solver options - implemented in MBS
321 
322 
GetJacCol()323 	virtual int GetJacCol()
324 	{
325 		int jc = NLS_GetJacCol();
326 		int ns = GetActTableau()->nstages;
327 		if (ns > 1 && NLS_IsJacFullNewton())
328 		{
329 			return 0;
330 			if (jc > (MBSsos+MBSes)*ns && MBSis != 0)
331 			{
332 				jc = (jc-(MBSsos+MBSes)*ns-1)%MBSis+1+MBSsos+MBSes;
333 			}
334 			else if (jc > (MBSsos)*ns && MBSes!=0)
335 			{
336 				jc = (jc-(MBSsos)*ns-1)%MBSes+1+MBSsos;
337 			}
338 			else if (MBSsos!=0)
339 			{
340 				jc = (jc-1)%MBSsos+1;
341 			}
342 		}
343 		return jc;
344 	}
345 
346 	//add additional drawing objects to scene
Add(const GeomElement & de)347 	virtual int Add(const GeomElement& de)
348 	{
349 		GeomElement* den = de.GetCopy();
350 		return drawelements.Add(den);
351 	}
352 	//add additional drawing objects to scene
Add(const GeomElement & de,int elnum)353 	virtual int Add(const GeomElement& de, int elnum)
354 	{
355 		GeomElement* den = de.GetCopy();
356 		den->SetElnum(elnum);
357 		return drawelements.Add(den);
358 	}
GetDrawElement(int i)359 	virtual GeomElement* GetDrawElement(int i) const {return drawelements(i);}
GetDrawElement(int i)360 	virtual GeomElement* GetDrawElement(int i) {return drawelements(i);}
NDrawElements()361 	virtual int NDrawElements() const {return drawelements.Length();}
362 	virtual void DeleteDrawElement(int i);
363 
364 	virtual void DrawElementAdd();
365 
GetProhibitRedraw()366 	virtual int GetProhibitRedraw() const {return prohibit_redraw;}
SetProhibitRedraw(int i)367 	virtual void SetProhibitRedraw(int i) {prohibit_redraw = i;}
368 
MaxIndex()369 	virtual int MaxIndex() const {return maxindex;};
SetMaxIndex(int i)370 	virtual void SetMaxIndex(int i) {maxindex=i;};
371 	virtual void AddControllerSensors(); // add sensors for all controller objects
372 	//assemble system
373 	//assign degrees of freedom
374 	virtual void Assemble();
375 	virtual void BuildLTGLists();
376 	virtual void LabelIOElementOutputs(); //$ AD: new 2013-02-01 see Log 388
377 	virtual int FilterIOElements(); //$ AD: new 2013-02-25 see log 4??
378 	virtual void ComputeResortVector();
UseDependencies()379 	virtual int UseDependencies() const {return use_dependencies;};
SetUseDependencies(int flag)380 	virtual void SetUseDependencies(int flag) {use_dependencies = flag;};
UseJacobianElementWise()381 	virtual int UseJacobianElementWise() const {return GetSolSet().element_wise_jacobian;}
382 
383 	//element access via graphical interface or for storage:
GetNElements()384 	virtual int GetNElements() const {return NE();}
385 
386 	//add a new element to the system
387 	virtual int AddElement(Element* e);
388 	//add a new body to the system, bodies are sorted such that they are before the joints
389 	//virtual int AddBody(Element* e); //$ DR 2013-05-23 removed deprecated function
390 	//insert an element at position i -> move elements backwards
391 	//virtual void InsertElement(int i, Element* e);	//$ DR 2013-05-23 removed deprecated function
392 	//add a element to the system which is not computed, only for drawing and solution
393 	virtual int AddAuxElement(Element* e);
394 
395 	virtual void DeleteNode(int i);
396 	//add a new node to the system
397 	virtual int AddNode(Node* n);
398 	//add new node to system if it does not exist in body n.body
399 	virtual int AddBodyNode(Node* n);
400 	//add new node to system if it does not exist in searchtree
401 	virtual int AddNode(Node* n, SearchTree& tree);
402 	//add new node to system if it does not exist in searchtree and it does not exist in body n.body
403 	virtual int AddBodyNode(Node* n, SearchTree& tree);
404 	//
GetNode(int i)405 	virtual Node& GetNode(int i)
406 	{
407 		if (i > 0 && i <= NNodes()) return *nodes(i); //$ DR 2013-02-22 added if condition and error handling
408 		else
409 		{
410 			mystr error_msg = mystr("FATAL ERROR: You tried to access the node with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
411 			UO().InstantMessageText(error_msg);
412 			assert(0);
413 			exit(0);
414 		}
415 	}
416 	//
GetNode(int i)417 	virtual const Node& GetNode(int i) const
418 	{
419 		if (i > 0 && i <= NNodes()) return *nodes(i); //$ DR 2013-02-22 added if condition and error handling
420 		else
421 		{
422 			mystr error_msg = mystr("FATAL ERROR: You tried to access the node with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
423 			UO().InstantMessageText(error_msg);
424 			assert(0);
425 			exit(0);
426 		}
427 	}
428 	//
NNodes()429 	virtual int NNodes() const {return nodes.Length();}
430 	//$ DR added the following 2 functions:
GetNodePtr(int i)431 	virtual Node* GetNodePtr(int i)
432 	{
433 		if (i > 0 && i <= NNodes()) return nodes(i);	//$ DR 2013-02-22 update of the error handling
434 		else
435 		{
436 			mystr error_msg = mystr("FATAL ERROR: You tried to access the node with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
437 			UO().InstantMessageText(error_msg);
438 			assert(0);
439 			exit(0);
440 		}
441 	}
442 	//
GetNodePtr(int i)443 	virtual const Node* GetNodePtr(int i) const
444 	{
445 		if (i > 0 && i <= NNodes()) return nodes(i);	//$ DR 2013-02-22 update of the error handling
446 		else
447 		{
448 			mystr error_msg = mystr("FATAL ERROR: You tried to access the node with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
449 			UO().InstantMessageText(error_msg);
450 			assert(0);
451 			exit(0);
452 		}
453 	}
454 	//
455 	virtual void DeleteElement(int i);
456 	//
GetElement(int i)457 	virtual Element& GetElement(int i) //$ DR 2013-02-22 added if condition and error handling
458 	{
459 		if (i > 0 && i <= NE())	return *elements(i);
460 		else
461 		{
462 			mystr error_msg = mystr("FATAL ERROR: You tried to access the element with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
463 			UO().InstantMessageText(error_msg);
464 			assert(0);
465 			exit(0);
466 		}
467 	}
468 	//
GetElement(int i)469 	virtual const Element& GetElement(int i) const
470 	{
471 		if (i > 0 && i <= NE())	return *elements(i); //$ DR 2013-02-22 added if condition and error handling
472 		else
473 		{
474 			mystr error_msg = mystr("FATAL ERROR: You tried to access the element with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
475 			UO().InstantMessageText(error_msg);
476 			assert(0);
477 			exit(0);
478 		}
479 	}
480 	//
GetElementPtr(int i)481 	virtual Element* GetElementPtr(int i)
482 	{
483 		if (i > 0 && i <= NE()) return elements(i); //$ DR 2013-02-22 update of the error handling
484 		else
485 		{
486 			mystr error_msg = mystr("FATAL ERROR: You tried to access the element with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
487 			UO().InstantMessageText(error_msg);
488 			assert(0);
489 			exit(0);
490 			//return 0;
491 		}
492 	}
493 	//
GetElementPtr(int i)494 	virtual const Element* GetElementPtr(int i) const
495 	{
496 		if (i > 0 && i <= NE()) return elements(i); //$ DR 2013-02-22 update of the error handling
497 		else
498 		{
499 			mystr error_msg = mystr("FATAL ERROR: You tried to access the element with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
500 			UO().InstantMessageText(error_msg);
501 			assert(0);
502 			exit(0);
503 			//return 0;
504 		}
505 	}
506 	//
GetAuxElement(int i)507 	virtual Element& GetAuxElement(int i)
508 	{
509 		if (i > 0 && i <= NAuxE()) return *auxelements(i); //$ DR 2013-02-22 added if condition and error handling
510 		else
511 		{
512 			mystr error_msg = mystr("FATAL ERROR: You tried to access the aux-element with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
513 			UO().InstantMessageText(error_msg);
514 			assert(0);
515 			exit(0);
516 		}
517 	}
518 	//
GetAuxElement(int i)519 	virtual const Element& GetAuxElement(int i) const
520 	{
521 		if (i > 0 && i <= NAuxE()) return *auxelements(i); //$ DR 2013-02-22 added if condition and error handling
522 		else
523 		{
524 			mystr error_msg = mystr("FATAL ERROR: You tried to access the aux-element with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
525 			UO().InstantMessageText(error_msg);
526 			assert(0);
527 			exit(0);
528 		}
529 	}
530 	//
GetAuxElementPtr(int i)531 	virtual Element* GetAuxElementPtr(int i)
532 	{
533 		if (i > 0 && i <= NAuxE()) return auxelements(i);  //$ DR 2013-02-22 update of the error handling
534 		else
535 		{
536 			mystr error_msg = mystr("FATAL ERROR: You tried to access the aux-element with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
537 			UO().InstantMessageText(error_msg);
538 			assert(0);
539 			exit(0);
540 			//return 0;
541 		}
542 	}
543 	//
GetAuxElementPtr(int i)544 	virtual const Element* GetAuxElementPtr(int i) const
545 	{
546 		if (i > 0 && i <= NAuxE()) return auxelements(i); //$ DR 2013-02-22 update of the error handling
547 		else
548 		{
549 			mystr error_msg = mystr("FATAL ERROR: You tried to access the aux-element with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
550 			UO().InstantMessageText(error_msg);
551 			assert(0);
552 			exit(0);
553 			//return 0;
554 		}
555 	}
556 	//
557 
NE()558 	virtual int NE() const {return elements.Length();}
NAuxE()559 	virtual int NAuxE() const {return auxelements.Length();}
560 	virtual int NConstraints() const;
561 
562 
GetXact(int i)563 	virtual const double& GetXact(int i) const
564 	{
565 		return xact(i);
566 	}
GetXact(int i)567 	virtual double& GetXact(int i)
568 	{
569 		return xact(i);
570 	}
571 
GetXact()572 	virtual const Vector& GetXact() const {return xact;};
573 	//virtual Vector& GetXact() {return xact;};
574 	//get actual state from timeint
SetActState(const Vector & x)575 	virtual void SetActState(const Vector& x)
576 	{
577 		xact.LinkWith(x);
578 	}
SetActState(double * ptr,int len)579 	virtual void SetActState(double* ptr, int len)
580 	{
581 		xact.LinkWith(ptr, len);
582 	}
583 	virtual void SetGlobalInitConditions(Vector& x0);
584 
585 	virtual void SetGlobalInitData(Vector& xdata);
586 
GetMagnifyYZ()587 	virtual double GetMagnifyYZ() const {return magnify_yz;};
SetMagnifyYZ(double amagyz)588 	virtual void SetMagnifyYZ(double amagyz) {magnify_yz = amagyz;}
589 
GetResortVector()590 	virtual const IVector& GetResortVector() const {return resortvector;}
GetResortVector()591 	virtual IVector& GetResortVector() {return resortvector;}
592 
593 
594 	virtual void ComputeMaxSparseBandwidth();
MaxSparseBandwidth()595 	virtual int MaxSparseBandwidth() const {return elementbandwidth;} //default value
596 
597 	virtual void ComputeGyroscopicMatrix(SparseMatrix& gy); // $ MSax 2013-07-25 : added
598 
SetTransformJacApply(int i)599 	virtual void SetTransformJacApply(int i) {transformJacApply = i;};
600 	virtual int TransformJacApply() const;
601 	virtual void ApplyTransform(const Vector& v, Vector& Av, int mode); //compute Av=A^T*v in mode==0 and Av=A*v in mode==1
602 
603 	//useroutput
604 	mutable UserOutput uout;
605 
606 	virtual Box3D GetBoundingBoxD() const;
GetSceneMaxAbsCoordinate()607 	virtual float GetSceneMaxAbsCoordinate() { return (float)(GetBoundingBoxD().Radius() + GetBoundingBoxD().Center().Norm());} //for zoom all
608 
SetCenterObject(int co,const Vector3D & offset)609 	virtual void SetCenterObject(int co, const Vector3D& offset) {centerobject = co; centerobject_offset = offset;} //camera moves with object
GetCenterObject()610 	virtual int GetCenterObject() const {return centerobject;}
GetCenterObjectOffset()611 	virtual Vector3D GetCenterObjectOffset() const {return centerobject_offset;}
CharacteristicLength()612 	virtual double CharacteristicLength() const {return 1;} //scale dimensions, if atomistic (1e-10) or galactic dimensions (1e10)
613 
TestCnt()614 	virtual int TestCnt() const {return log.testcnt;}
615 
616 	//solver settings for
617 	//$ YV 2012-11-29
618 	//virtual const SolverSettings& MBSSolSet() const {return solset;}
619 	//virtual SolverSettings& MBSSolSet() {return solset;}
620 
621 	virtual int AddSensor(Sensor * s);
622 	//
GetSensor(int i)623 	virtual Sensor & GetSensor(int i)
624 	{
625 		if (i > 0 && i <= NSensors())	return *sensors(i);	//$ DR 2013-02-22 added if condition and error handling
626 		else
627 		{
628 			mystr error_msg = mystr("FATAL ERROR: You tried to access the sensor with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
629 			UO().InstantMessageText(error_msg);
630 			assert(0);
631 			exit(0);
632 		}
633 	}
634 	//
GetSensor(int i)635 	virtual const Sensor & GetSensor(int i) const
636 	{
637 		if (i > 0 && i <= NSensors())	return *sensors(i);	//$ DR 2013-02-22 added if condition and error handling
638 		else
639 		{
640 			mystr error_msg = mystr("FATAL ERROR: You tried to access the sensor with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
641 			UO().InstantMessageText(error_msg);
642 			assert(0);
643 			exit(0);
644 		}
645 	}
646 	//
GetSensorPtr(int i)647 	virtual Sensor* GetSensorPtr(int i)
648 	{
649 		if (i > 0 && i <= NSensors()) return sensors(i);	//$ DR 2013-02-22 update of the error handling
650 		else
651 		{
652 			mystr error_msg = mystr("FATAL ERROR: You tried to access the sensor with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
653 			UO().InstantMessageText(error_msg);
654 			assert(0);
655 			exit(0);
656 			//return 0;
657 		}
658 	}
659 
GetSensorPtr(int i)660 	virtual const Sensor* GetSensorPtr(int i) const
661 	{
662 		if (i > 0 && i <= NSensors()) return sensors(i);  //$ DR 2013-02-22 update of the error handling
663 		else
664 		{
665 			mystr error_msg = mystr("FATAL ERROR: You tried to access the sensor with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
666 			UO().InstantMessageText(error_msg);
667 			assert(0);
668 			exit(0);
669 			//return 0;
670 		}
671 	}
672 
673 
NSensors()674 	virtual int NSensors() const {return sensors.Length();}
675 	//
676 	virtual void DeleteSensor(int i);
677 
678 	//$ DR 2012-10:[ loads moved from element to mbs
679 	virtual int AddLoad(const MBSLoad& li);
GetLoad(int i)680 	virtual MBSLoad& GetLoad(int i)
681 	{
682 		if (i > 0 && i <= NLoads())	return *loads(i);	//$ DR 2013-02-22 added if condition and error handling
683 		else
684 		{
685 			mystr error_msg = mystr("FATAL ERROR: You tried to access the load with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
686 			UO().InstantMessageText(error_msg);
687 			assert(0);
688 			exit(0);
689 		}
690 	}
GetLoad(int i)691 	virtual const MBSLoad& GetLoad(int i) const
692 	{
693 		if (i > 0 && i <= NLoads())	return *loads(i);	//$ DR 2013-02-22 added if condition and error handling
694 		else
695 		{
696 			mystr error_msg = mystr("FATAL ERROR: You tried to access the load with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
697 			UO().InstantMessageText(error_msg);
698 			assert(0);
699 			exit(0);
700 		}
701 	}
702 	virtual void DeleteLoad(int i);
NLoads()703 	virtual int NLoads() const {return loads.Length();}
GetLoadPtr(int i)704 	virtual MBSLoad* GetLoadPtr(int i)
705 	{
706 		if (i > 0 && i <= NLoads()) return loads(i); //$ DR 2013-02-22 update of the error handling
707 		else
708 		{
709 			mystr error_msg = mystr("FATAL ERROR: You tried to access the load with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
710 			UO().InstantMessageText(error_msg);
711 			assert(0);
712 			exit(0);
713 			//return 0;
714 		}
715 	}
GetLoadPtr(int i)716 	virtual const MBSLoad* GetLoadPtr(int i) const
717 	{
718 		if (i > 0 && i <= NLoads()) return loads(i); //$ DR 2013-02-22 update of the error handling
719 		else
720 		{
721 			mystr error_msg = mystr("FATAL ERROR: You tried to access the load with number ") +mystr(i) + mystr(", which does not exist! HOTINT will close now.");
722 			UO().InstantMessageText(error_msg);
723 			assert(0);
724 			exit(0);
725 			//return 0;
726 		}
727 	}
728 	//$ DR 2012-10:] loads moved from element to mbs
729 
730 
731 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
732   // access functions for Sensor / PlotTool (Plottool has no classes MBS, Sensor, etc included)
733 	virtual TArray<double>* GetSensorValuesArrayPtr(int i);  // get the i-th sensors (as registered in mbs) own stored values from internal array
734 	virtual TArray<double>* GetSensorTimesArrayPtr(int i);   // get the i-th sensors (as registered in mbs) own stored times from internal array
735 	virtual mystr GetSensorName(int i);                      // get the i-th sensors (as registered in mbs) name
736 	virtual int GetSensorNumber(mystr& name);                // get the number of the (first) sensor that matches the sensorname
737 
738 	//add sensor for the 6 rigid body degrees of freedom:
739 	virtual void AddRigidBodyDOFSensor(int bodynum, const Vector3D& pos_rel, mystr general_str);
740 
741 	//add sensor for the 3 rigid 2d body degrees of freedom:
742 	//virtual void AddRigid2DBodyDOFSensor(int bodynum, mystr general_str, int usepos = 1, int usevel = 0, int displacement = 0); // old version
743 	virtual void AddRigid2DBodyDOFSensor(int bodynum, Vector2D& pos_rel, mystr general_str, int usepos = 1, int usevel = 0, int displacement = 0);
744 
745 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
746 	//
747 	virtual int AddMaterial(const Material& m);
748 	//
GetMaterial(int i)749 	virtual Material& GetMaterial(int i)
750 	{
751 		if (i > 0 && i <= NMaterials()) return *materials(i); //$ DR 2013-02-22 added if condition and error handling
752 		else
753 		{
754 			mystr error_msg = mystr("FATAL ERROR: You tried to access a material or beam property, which does not exist! HOTINT will close now.");
755 			UO().InstantMessageText(error_msg);
756 			assert(0);
757 			exit(0);
758 		}
759 	}
760 	//
GetMaterial(int i)761 	virtual const Material& GetMaterial(int i) const
762 	{
763 		if (i > 0 && i <= NMaterials()) return *materials(i); //$ DR 2013-02-22 added if condition and error handling
764 		else
765 		{
766 			mystr error_msg = mystr("FATAL ERROR: You tried to access a material or beam property, which does not exist! HOTINT will close now.");
767 			UO().InstantMessageText(error_msg);
768 			assert(0);
769 			exit(0);
770 		}
771 	}
772 	//
NMaterials()773 	virtual int NMaterials() const {return materials.Length();}
774 	//
775 	virtual int DeleteMaterial(int i); //returns 1 if successful
776 	//
GetMaterialPtr(int i)777 	virtual Material* GetMaterialPtr(int i)
778 	{
779 		if (i > 0 && i <= NMaterials()) return materials(i);  //$ DR 2013-02-22 update of the error handling
780 		else
781 		{
782 			mystr error_msg = mystr("FATAL ERROR: You tried to access a material or beam property, which does not exist! HOTINT will close now.");
783 			UO().InstantMessageText(error_msg);
784 			assert(0);
785 			exit(0);
786 			//return 0;
787 		}
788 	}
789 	//
GetMaterialPtr(int i)790 	virtual const Material* GetMaterialPtr(int i) const
791 	{
792 		if (i > 0 && i <= NMaterials()) return materials(i);  //$ DR 2013-02-22 update of the error handling
793 		else
794 		{
795 			mystr error_msg = mystr("FATAL ERROR: You tried to access a material or beam property, which does not exist! HOTINT will close now.");
796 			UO().InstantMessageText(error_msg);
797 			assert(0);
798 			exit(0);
799 			//return 0;
800 		}
801 	}
802 
803 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
804 
GetVarparameter()805 	virtual const double& GetVarparameter() const {return varparameter;};
GetVarparameter()806 	virtual double& GetVarparameter() {return varparameter;};
GetVarparameter2()807 	virtual const double& GetVarparameter2() const {return varparameter2;};
GetVarparameter2()808 	virtual double& GetVarparameter2() {return varparameter2;};
809 
SetPtr2PerformComputation_Function(int (* ptr2PerformComputation_FunctionI)(MBS *))810 	virtual void SetPtr2PerformComputation_Function(int(*ptr2PerformComputation_FunctionI)(MBS*)) {ptr2PerformComputation_Function = ptr2PerformComputation_FunctionI;}
CallPtr2PerformComputation_Function(MBS * mbs)811 	virtual int CallPtr2PerformComputation_Function(MBS* mbs) {return ptr2PerformComputation_Function(mbs);}
812 
813 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
814 	//Methods used by some old-style models (don't use anymore!)
SetShowelem(const int __se)815 	virtual void SetShowelem(const int __se) { showelem  = __se; }  // depreciated
SetShowelem2(const int __se)816 	virtual void SetShowelem2(const int __se) { showelem2 = __se; }  // depreciated
SetShowelem3(const int __se)817 	virtual void SetShowelem3(const int __se) { showelem3 = __se; }  // depreciated
818 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
819 
820 	//for animation driver:
GetObjData(int row,int col)821 	virtual double GetObjData(int row, int col) const
822 	{
823 		int r = row+1;
824 		if (r < 1) r = 1;
825 		if (r > objdata.Getrows()) r = objdata.Getrows();
826 
827 		return objdata(r,col);
828 	}
GetObjDataStepSize()829 	virtual double GetObjDataStepSize() const {return objdata_stepsize;}
830 
831 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
832 	//general solution file: header functions
WriteSolutionFileHeader()833 	virtual int WriteSolutionFileHeader() const {return GetSolSet().sol_write_sol_file_header && !isSolutionFileHeaderWritten;}
WriteSolParFileHeader()834 	virtual int WriteSolParFileHeader() const {return GetSolSet().sol_write_sol_file_header && !isSolParFileHeaderWritten;}
835 	virtual mystr GetSolutionFileHeaderString(); // returns the header string
836   virtual mystr GetSolParFileHeaderString(); // returns the header string for SolParFile
837 	virtual mystr GetSolutionDataInfoFileHeaderString(); // returns the header string for the solution-data info file
838 
SolFile()839 	virtual ofstream& SolFile() {return sol;}
SolParFile()840 	virtual ofstream& SolParFile() {return solpar;}
LogFile()841 	virtual ofstream& LogFile() {return logout;}
842 
843 	//* YV added
844 	//{
845 	// actually selected field variable for contour plotting (NULL if body color is to be painted)
846 	FieldVariableDescriptor * GetActualPostProcessingFieldVariable();
GetEigenValue(int index)847 	virtual double GetEigenValue(int index) const // eigenvalues are stored in this vector
848 	{
849 		if(eigval.Length() == 0)
850 		{
851 			return 0.; // if not computed, set to zero
852 		}
853 		return eigval(index);
854 	}
DoFinalEigenValueComputation()855 	virtual int DoFinalEigenValueComputation()
856 	{
857 		return mbs_edc_options->TreeGetInt("SolverOptions.Solution.Sensor.postproc_compute_eigenvalues",0);
858 	}
StopByElement()859 	virtual void StopByElement(){ simulationStatus.SetStatusFlag(TSimulationStoppedByElement); TIFinished(); } //$ MS + RL 2012-2-29: //$ MsSch 2013-08-19
GetSimulationStatus()860 	virtual SimulationStatus & GetSimulationStatus() { return simulationStatus; } //$ MaSch 2013-08-19
861 private:
862 	int indexOfActualPostProcessingFieldVariable;		// is synchronized with TOption(107)
863 
864 public:
GetIndexOfActualPostProcessingFieldVariable()865 	virtual int GetIndexOfActualPostProcessingFieldVariable() { return indexOfActualPostProcessingFieldVariable; }
866 	virtual void SetIndexOfActualPostProcessingFieldVariable(int index);
867 
868 	//$ MS + RL 2012-2-29: virtual int IscoreComputationFinished() { return coreComputationFinished; } //$ MS 2011-3-16:
869 	//}
870 
871 	//$ AD: new 2013-02-25: functions that let MBS respond to a key or mouse input ( triggered by IOBlocks or GLDrawWindow )
872 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
873 	//functions for response on Input by key or mouse
874 	virtual int RespondToKey(int key);
875 	//virtual void RespondToMouse(double x, double y);
876 
877 private:
878 	//actual solution vector (mirror from timeint)
879 	Vector xact;
880 
881 	//storage for elements, nodes, sensors, etc.:
882 	TArray<Element*> elements;
883 	TArray<Element*> auxelements;
884 	TArray<Node*> nodes;
885 	TArray<Sensor*> sensors;		//$ YV 2012-06: Sensor base class is used instead of MBSSensor
886 	TArray<GeomElement*> drawelements;
887 	TArray<Material*> materials;
888 	TArray<MBSLoad*> loads;			//$ DR 2012-10: loads moved from element to mbs
889 	TArray<int> ioelements;    //$ AD: shortlist containing the elementnumbers of IOElements ( function FilterIOElements() )
890 
891 	// YV, 17.11.10
892 	// list of field variables, which are available for post-processing (contour plotting) and for the sensors
893 	TArray<FieldVariableDescriptor> availableFieldVariables;
894 	// the list is built by asking all the existing elements at the assembly stage (is called from Assemble())
895 	void CollectAvailableFieldVariables();
896 	// the list should be available to the user interface
GetAvailableFieldVariables()897 	virtual const TArray<FieldVariableDescriptor> & GetAvailableFieldVariables() { return availableFieldVariables; }
898 
899 	//temporary vectors:
900 	Vector tempf;   //for LocalJacobianF2
901 	Matrix tempm;   //for LocalJacobianF2
902 	IVector colref; //for LocalJacobianF2 and G
903 
904 	//+++++++++++++++++
905 	int maxindex;  // maximum index of a set of DAE == maximum number of necessary differentiations such that the resulting system contains no algebraic equations
906 	int elementbandwidth;
907 
908 	int MBSsos, MBSes, MBSis, MBSss;
909 	int resortsize_add;
910 	int resort_active;
911 	int transformJacApply; //transformation of Jacobian according to ACRS formulation
912 	int isfirstcomputation;
913 	int isinconsistent; //0 --> OK, 1 --> can not compute, 2 --> can not draw and not compute
914 	int use_dependencies;
915 	int isloadsavemode;
916 
917 	//time integration parameters:
918 	//SolverSettings mbssolset;
919 
920 	//sensor:
921 	int showelem;  //depreciated
922 	int showelem2; //depreciated
923 	int showelem3; //depreciated
924 
925 	//drawing
926 	double magnify_yz; // in order to make thin lines visible!!!
927 	int prohibit_redraw; //do not redraw if this flag is set
928 
929 	int centerobject;							//use this element to center the computation
930 	Vector3D centerobject_offset; //use this offset relative to object center
931 
932 	//cutting planes  //$ PG 2012-4-8:[ Cutting plane may also be handled by OpenGL directly (if ViewingOptions.CuttingPlane.use_open_gl is set to true)
933 	TArray<Vector3D> ncut;    //normal vector of cutting plane i (i=1,..,n_cutting_planes   -   cut objects which are in front of plane w.r.t. ncut)
934 	TArray<Vector3D> pcut;    //distance of cutting plane i from origin multiplied with normal vector
935 	IVector use_cutting_plane;   //switch on(1)/off(0) cutting plane i
936 public:
937 	int UseCuttingPlanes();   //sets ncut, pcut, use_cutting_plane according to EDC-options, and returns if any of the n_cutting_planes is indeed used
938 	int CuttingPlanesAllow(const Vector3D& pos);   // returns, if object (with golbal reference position pos) is allowed for drawing due to cutting planes
939 
940 private:
941 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
942 	double varparameter;
943 	double varparameter2;
944 	int (*ptr2PerformComputation_Function)(MBS*); //set this pointer, in order to make a user/customized computation function
945 	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
946 	Vector eigval; // eigenvalues are stored in this vector [rad/s]
947 	//+++++++++++++++++++++++++++++++++++
948 	//file in/output:
949 public:
950 	ofstream sol; //general solution file
951 	ofstream solpar; //general solution file for parametric investigations
952 private:
953 	ofstream stateout; //file to save last step of computation
954 	ifstream statein;	 //file to open first step
955 
956 	Vector stored_initialconditions; //if these initial conditions are set,
957 	//																 at every run of the computation, the initial conditions are set
958 
959 
960 	//animation driver: (special viewer mode, not generally used in HOTINT)
961 	Matrix objdata;						//AnimationFile, contains objdata for n objects
962 	double objdata_stepsize;	//AnimationFile stepsize
963 
964 	ElementDataContainer* edc_modeldata; //use this container to modify/load/save your model data!
965 	ElementDataContainer* mbs_edc_options; //these options are a mirror of the old options in ti_misc.cpp; only edit these options; they are copied to the timeint i/d/toptions before simulation start
966 
967 	ElementDataContainer* mbs_edc_global_variables; //this container contains global variables: e.g. "pi", physical constants; evtl. material constants
968 
969 	ElementDataContainer modeldata_edc_args; //arguments for modeldata from hotint startup
970 	ElementDataContainer mbs_edc_args; //arguments for mbsedc from hotint startup
971 
972 	//++++++++++++++++++++++++++++++++++++++++
973 	//parsing:
974 	CMBSParser* mbs_parser; //this is a mathematical object parser, which parses mathematical objects (e.g. "1+sin(2*pi*x)"); the evaluation of parsed objects is efficient
975 
976 	CEDCParser* edc_parser; //this is the parser for EDC-input files for HOTINT, which contains hierarchical data structures, commands and can contain parsable mathematical objects
977 
978 	int modeldata_initialized; //if model is called first time-->initialize model data before, afterwards reused and can be changed in windows interface
979 	int isSolutionFileHeaderWritten; // is set to 1 when header is already written ==> transfer this variable into mbsedc
980 	int isSolParFileHeaderWritten; // is set to 1 when header is already written ==> transfer this variable into mbsedc
981 
982 	//$ MS + RL 2012-2-29: int coreComputationFinished; //$ MS 2011-3-16: is set to 1 when Time-Integration is finished and set to 0 when Time-Integration is started
983 	//TSimulationStatus simulationStatus; //$ YV 2012-11-28
984 	SimulationStatus simulationStatus; //$ MaSch 2013-08-19
985 
986 	//$ YV 2012-12-12: added
987 	virtual double EvaluateParsedFunction1D(const mystr & parsedFunctionExpression, const mystr & parsedFunctionVariables, double t);
988 	virtual double ExpressionToDouble(mystr & expression);
989 
990 	//$ DR 2013-01-14: added as new interface to script parser
991 	virtual int ExecuteParserCommand(mystr & command, TArray<ElementDataContainer*>& parameter_EDCs, ElementData& return_value, int option);
992 
993 //$ YV 2013-01-02: integration rules live now with the elements; the library is a static member of FiniteElementGeneric
994 /*
995 private:
996 	IntegrationRulesLibrary integrationRulesLibrary;
997 public:
998 	IntegrationRulesLibrary * GetIntegrationRulesLibrary() { return &integrationRulesLibrary; }
999 */
1000 
1001 	//$ MaSch 2013-08-26
1002 	//++++++++++++++++++++++++++++++++++++++++
1003 	//TCP/IP:
1004 	private:
1005 		TCPIPHotInt* serversocket;
1006 	public:
GetServerSocket()1007 		virtual TCPIPHotInt* & GetServerSocket() {return serversocket;}
1008 
1009 };
1010 
1011 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1012 //$JG2012-01-27: put the following into CEDCParser class!
1013 //transform edc into string, works already for TreeEDCs!
1014 //void EDC2String(const ElementDataContainer& edc, mystr& str, const mystr& indent = "");
1015 //transforms string into edc until a keyword is read, returns remaining string:
1016 //int String2EDC(MBS* mbs, mystr& str, ElementDataContainer& edc, ElementDataContainer& testedc);
1017 //
1018 ////transforms a string automatically into a tree edc; only accepts: double, string (""), vector, matrix
1019 //int String2TreeEDC(MBS* mbs, mystr str, ElementDataContainer& edc);
1020 //int String2TreeEDC_SIM(MBS* mbs, mystr& str, ElementDataContainer& edc);
1021 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1022 
1023 
1024 #endif
1025