All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
interface_integrator.h
1 /* Copyright (C) 2013 Markus Schneider
2 
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 
17  *
18  * Contact:
19  * markus.ms.schneider@live.de
20  *
21  */
22 
23 #ifndef _INTERFACE_INTEGRATOR_H_
24 #define _INTERFACE_INTEGRATOR_H_
25 
26 #include <mbsim/integrators/integrator.h>
27 
28 namespace MBSimControl {
29  class Signal;
30  class ExternSignalSource;
31 }
32 
33 namespace MBSimInterface {
34 
35  class MBSimServer;
36 
39  class InterfaceIntegrator : public MBSimIntegrator::Integrator {
40 
41  protected:
42  std::ofstream integPlot;
43 
44  public:
45 
48 
49  void setMBSimServer(MBSimServer* m_) {mbsimServer=m_; }
50 
51  void integrate(MBSim::DynamicSystemSolver& system);
52 
53  virtual void initializeUsingXML(xercesc::DOMElement *element);
54  virtual xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *element);
55 
56  virtual std::string getType() const { return "InterfaceIntegrator"; }
57 
58  void integratorCommunication(const char* requestIdentifier, const char* interface2mbsim, unsigned int interface2mbsimLength, std::ostringstream* mbsim2interface);
59  bool getExitRequest() {return exitRequest; }
60 
61  private:
62  // get values
63  void getz(double** z_);
64  void getzdot(double** zdot_);
65  void getsv(double** sv_);
66 
67  // set values
68  void setTime(double t_) {t=t_; }
69  void setz(const fmatvec::Vec& z_) {z << z_; }
70 
71  // internal routines
72  int zSize, svSize;
73  double t;
74  fmatvec::Vec z, zd, sv;
75  fmatvec::VecInt jsv;
76 
77  bool printCommunication;
78 
79  void dumpMemory(std::ostringstream *out, void *p, unsigned int N);
80  void double2str(std::ostringstream *out, double *p, unsigned int N);
81  void int2str(std::ostringstream *out, int *p, unsigned int N);
82 
83  bool exitRequest;
84 
85  MBSimServer* mbsimServer;
86  std::vector<std::string> outputSignalRef, inputSignalRef, outputSignalName, inputSignalName;
87  std::vector<MBSimControl::Signal*> outputSignal;
88  std::vector<MBSimControl::ExternSignalSource*> inputSignal;
89  fmatvec::VecInt outputSignalSize, inputSignalSize;
90  void resolveInputOutputNames();
91  fmatvec::Vec outputVector, inputVector;
92  };
93 }
94 
95 #endif // _SERVER_INTEGRATOR_H_
Definition: mbsim_server.h:34
Dummy-Integrator InterfaceIntegrator This integrator is an interface for other integration tool...
Definition: interface_integrator.h:39

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML