MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
shape.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/shape.h,v 1.24 2017/01/12 14:46:10 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 /* Classe di forme pluridimensionali */
33 
34 #ifndef SHAPE_H
35 #define SHAPE_H
36 
37 #include "ac/f2c.h"
38 
39 #include "myassert.h"
40 #include "mynewmem.h"
41 #include "output.h"
42 
43 
44 /* Classe base:
45  * una class Shape puo' restituire un reale in funzione di un insieme di reali
46  * per un reale solo si ha una forma monodimensionale, per due una forma
47  * bidimensionale.
48  */
49 
50 class Shape {
51 public:
52  virtual ~Shape(void);
53 
54  virtual doublereal dGet(doublereal d1, doublereal d2 = 0.) const = 0;
55  virtual std::ostream& Restart(std::ostream& out) const = 0;
56 };
57 
58 /* Possessore di puntatore a shape.
59  * Questo oggetto consente un uso comodo di shapes senza alcuna conoscenza
60  * sulla loro natura.
61  * Viene costruito con un puntatore a Shape di natura qualsiasi.
62  * Lui consente l'accesso in lettura
63  * ed assicura la corretta distruzione della shape.
64  */
65 
66 class ShapeOwner {
67 protected:
68  const Shape* pShape;
69 
70 public:
71  ShapeOwner(const Shape* pS);
72 
73  virtual ~ShapeOwner(void);
74 
75  virtual doublereal dGet(doublereal d) const;
76 
77  virtual doublereal dGet(doublereal d1, doublereal d2) const;
78 
79  virtual const Shape* pGetShape(void) const;
80 };
81 
82 /* Classe base delle forme monodimensionali:
83  * una forma monodimensionale restituisce un reale in funzione
84  * di un altro reale.
85  */
86 
87 class Shape1D : public Shape {
88 public:
89  virtual ~Shape1D(void);
90 };
91 
92 // public because needed outside
93 class ConstShape1D : public Shape1D {
94 protected:
96 
97 public:
99 
100  ~ConstShape1D(void);
101 
102  doublereal dGet(doublereal /* d */ , doublereal = 0.) const;
103 
104  std::ostream& Restart(std::ostream& out) const;
105 };
106 
107 /* Classe base delle forme bidimensionali:
108  * una forma monodimensionale restituisce un reale in funzione
109  * di due reali.
110  */
111 
112 class Shape2D : public Shape {
113 public:
114  virtual ~Shape2D(void);
115 };
116 
117 extern Shape* ReadShape(MBDynParser& HP);
118 
119 #endif // SHAPE_H
120 
ConstShape1D(doublereal d)
Definition: shape.cc:82
doublereal dConst
Definition: shape.h:95
virtual std::ostream & Restart(std::ostream &out) const =0
virtual const Shape * pGetShape(void) const
Definition: shape.cc:72
Definition: shape.h:87
virtual ~Shape(void)
Definition: shape.cc:40
std::ostream & Restart(std::ostream &out) const
Definition: shape.cc:100
virtual doublereal dGet(doublereal d) const
Definition: shape.cc:60
doublereal dGet(doublereal, doublereal=0.) const
Definition: shape.cc:94
const Shape * pShape
Definition: shape.h:68
ShapeOwner(const Shape *pS)
Definition: shape.cc:45
virtual doublereal dGet(doublereal d1, doublereal d2=0.) const =0
virtual ~Shape2D(void)
Definition: shape.cc:241
~ConstShape1D(void)
Definition: shape.cc:88
Definition: shape.h:112
double doublereal
Definition: colamd.c:52
virtual ~ShapeOwner(void)
Definition: shape.cc:51
Shape * ReadShape(MBDynParser &HP)
Definition: shape.cc:298
Definition: shape.h:50
virtual ~Shape1D(void)
Definition: shape.cc:77