CellModules
CellBody.hpp
Go to the documentation of this file.
1//'''
2#ifndef BASEPROJECT_CELLBODY_HPP
3#define BASEPROJECT_CELLBODY_HPP
4
5#include <mecacell/mecacell.h>
6#include "CellPlugin.hpp"
7#include "BaseBody.hpp"
8#ifndef MOVABLE
9#include <mecacell/movable.h>
10#endif
11
12/*isigen:insert@includes'''
13 print('\n'.join(["#include \"../../{modulesFolder}/{folderName}/{bodyFileName}.hpp\"".\
14 format(modulesFolder=cellModulesPath,folderName=m,bodyFileName=configJson["Body"]["name"]) for m,configJson in modulesConfigs.items() if "Body" in configJson]))
15 print('\n')
16 '''*/
17
18
19/*isigen:insert@definitions'''
20 print("""\n#ifdef MOVABLE
21 template<typename cell_t>
22 class CellBody : virtual BaseBody<CellPlugin<cell_t> > {bodyNames} {{
23 #else
24 template<typename cell_t>
25 class CellBody : public MecaCell::Movable, virtual BaseBody<CellPlugin<cell_t> > {bodyNames} {{
26 #endif
27 """.format(bodyNames=''.join([", public "+configJson["Namespace"]+"::"+configJson["Body"]["name"]+"<cell_t,CellPlugin<cell_t> >" for configJson in modulesConfigs.values() if "Body" in configJson])))
28 '''*/
29
30private:
31
32#ifndef MOVABLE
35#endif
36
37
38public:
40 CellBody() = default;
41
42 /*isigen:insert@constructor'''
43 bodyNameConstrut = [configJson["Namespace"]+"::"+configJson["Body"]["name"]+"<cell_t, embedded_plugin_t>()" for configJson in modulesConfigs.values() if "Body" in configJson]
44 print("""#ifdef MOVABLE
45 CellBody(cell_t *, MecaCell::Vec pos = MecaCell::Vec::zero())
46 : {bodyNames}
47 {{}}
48 #else""".format(bodyNames=', '.join(bodyNameConstrut)))
49 print("""
50 CellBody(cell_t *, MecaCell::Vec pos = MecaCell::Vec::zero())
51 : MecaCell::Movable(pos) {bodyNames}
52 {{}}
53 #endif""".format(bodyNames=''.join([", "+n for n in bodyNameConstrut])))
54 '''*/
55
56
57 void setCellPlugin(embedded_plugin_t *_cellPlugin){
59 /*isigen:insert@setPluginPropagation'''
60 print('\n'.join([configJson["Namespace"]+"::"+configJson["Body"]["name"]+"<cell_t,embedded_plugin_t>::onCellPluginLinking();" for configJson in modulesConfigs.values() if "Body" in configJson]))
61 '''*/
62
63 }
64#ifndef MOVABLE
65 double getBoundingBoxRadius() const { return radius; }
66 void setRadius(double r) { radius = r; }
67#endif
68
69};
70
71
72#endif //BASEPROJECT_CELLBODY_HPP
73//'''
double getBoundingBoxRadius() const
Definition: CellBody.hpp:65
double radius
Definition: CellBody.hpp:33
MecaCell::Vec pos
Definition: CellBody.hpp:34
void setRadius(double r)
Definition: CellBody.hpp:66
CellBody()=default
void setCellPlugin(embedded_plugin_t *_cellPlugin)
Definition: CellBody.hpp:57
void setCellPlugin(embedded_plugin_t *_cellPlugin)
Definition: BaseBody.hpp:14
general purpose 3D vector/point class.
Definition: vector3D.h:20
static Vector3D zero()
constructs a zero vector
Definition: vector3D.h:170
static constexpr double DEFAULT_CELL_RADIUS
Definition: config.hpp:12