16 #ifndef _A_STRUCTURE_H_
17 #define _A_STRUCTURE_H_
23 #include "a_trianglecloud.h"
24 #include "a_linecloud.h"
39 static const std::string
help();
69 std::vector<int>
out()
const;
71 std::vector<int>
in()
const;
73 std::vector<int>
nodes()
const;
97 void rotate(
int rb,
int f,
const a_point& x,
const a_point& dir,
double r);
99 void rotate(
int b,
int f,
double v,
double r);
101 void slide(
int b,
int f,
double u,
double v);
113 void compute(
const int rb1,
const int rf1,
const double u1,
const double v1,
114 const int rb2,
const int rf2,
const double u2,
const double v2,
115 const int rb3,
const int rf3,
const double u3,
const double v3);
117 double min(
const int face,
118 const int rb1,
const int rf1,
const double u1,
119 const int rb2,
const int rf2,
const double u2,
120 const int rb3,
const int rf3,
const double u3);
122 double mindir(
const a_point & dir,
123 const int rb1,
const int rf1,
double &u1,
124 const int rb2,
const int rf2,
double &u2,
125 const int rb3,
const int rf3,
double &u3);
127 double max(
const int face,
128 const int rb1,
const int rf1,
const double u1,
129 const int rb2,
const int rf2,
const double u2,
130 const int rb3,
const int rf3,
const double u3);
132 void min(
const int rb1,
const int rf1,
133 const int rb2,
const int rf2);
135 void max(
const int rb1,
const int rf1,
136 const int rb2,
const int rf2);
137 void minsteep(
const int rb1,
const int rf1,
138 const int rb2,
const int rf2);
140 virtual void writetri(std::ostream &o)
const;
142 virtual void writeb(std::ostream &o)
const;
144 virtual void writeg(std::ostream &o)
const;
160 bool faceonexit(
const int rb1,
const int rf1,
const int rb2,
const int rf2);
162 void midblock(
const int rb1,
const int rf1,
163 const int rb2,
const int rf2,
167 const int rb1,
const int rf1,
168 const int rb2,
const int rf2);
174 double grad1(
const int rb1,
const int rf1,
175 const int rb2,
const int rf2,
176 const int rb3,
const int rf3,
const double * u);
178 double grad2(
const int rb1,
const int rf1,
179 const int rb2,
const int rf2,
180 const int rb3,
const int rf3,
183 double grad3(
const int rb1,
const int rf1,
184 const int rb2,
const int rf2,
185 const int rb3,
const int rf3,
int rb(const a_block *b) const
get reference of a block (-1 if no block)
std::vector< int > nodes() const
get list of blocks connected to more than 2 other blocks (sources of hyperstaticity)
void rotate(int rb, int f, const a_point &x, const a_point &dir, double r)
rotate of angle r (rad) all blocks connected to rb, around x using axis dir
void penalty_factor(const double v)
set penalty factor
void minsteep(const int rb1, const int rf1, const int rb2, const int rf2)
double max(const int face, const int rb1, const int rf1, const double u1, const int rb2, const int rf2, const double u2, const int rb3, const int rf3, const double u3)
vary force on face to get a maximal objective function, respecting face criteria
void trianglecloud(a_trianglecloud &) const
a_wrench W()
get weight (wrench)
void polyline(a_linecloud &) const
double min(const int face, const int rb1, const int rf1, const double u1, const int rb2, const int rf2, const double u2, const int rb3, const int rf3, const double u3)
vary force on face to get a minimal objective function, respecting face criteria
void restoreexits(std::vector< int > &)
restore face exits situation
a_block * compute(int b, int f)
compute as far as possible the forces on the blocks, starting from block b, entrance face f,...
double V() const
get volume of structure
void clearexternal()
clear all the external face forces
double penalty_factor() const
get penalty factor
bool connected() const
check whether all blocks are connected
bool faceonexit(const int rb1, const int rf1, const int rb2, const int rf2)
check whether rf2 in an exit face
std::vector< int > out() const
get list of extreme blocks (blocks connected only to 1 other block)
void clearall()
clear all the forces on faces
int nb() const
get number of blocks
static const std::string help()
get information about the class
double objectivep() const
get value of objective function + penalty*penalty_factor_
double grad2(const int rb1, const int rf1, const int rb2, const int rf2, const int rb3, const int rf3, const double *u)
grad of objective function + penalty
void slide(int b, int f, double u, double v)
slide of (u,v) all blocks connected to b in the plane of f
virtual void writeb(std::ostream &o) const
write structure in blender format
void clearinternal()
clear all the internal face forces
double potential() const
get potential energy
int add_block(a_block *b)
add a block to the structure
a_wrench ft()
get total force on structure fe+W (wrench)
std::vector< int > in() const
get list of internal blocks (blocks connected at least to 2 other blocks)
double mindir(const a_point &dir, const int rb1, const int rf1, double &u1, const int rb2, const int rf2, double &u2, const int rb3, const int rf3, double &u3)
vary force on faces (in proportion to dir) to get a minimal objective function, respecting face crite...
double Ws() const
get weight (scalar)
a_wrench fe()
get external force on structure (wrench)
void material(a_material *material)
link a material
double grad1(const int rb1, const int rf1, const int rb2, const int rf2, const int rb3, const int rf3, const double *u)
grad of objective function + penalty
bool ok() const
check if forces on face are acceptable
void criteria(a_fcriteria *criteria)
set resistance criteria
a_block * b(const int i) const
get pointer to the block i
void optimise(const bool is_min, const int rb1, const int rf1, const int rb2, const int rf2)
compute inside forces leading to an optimal objective function, respecting face criteria
double grad3(const int rb1, const int rf1, const int rb2, const int rf2, const int rb3, const int rf3, const double *u)
grad of objective function + penalty
void objective(a_ocriteria *objective)
set objective function (used for optimisation)
void link_blocks(int b1, int f1, int b2, int f2)
link 2 blocks: [b1: ref_block1, f1: ref_face1, b2:...]
virtual void writetri(std::ostream &o) const
write a triangle file
friend std::ostream & operator<<(std::ostream &o, const a_structure &s)
double objective() const
get value of objective function
void midblock(const int rb1, const int rf1, const int rb2, const int rf2, a_block *&rb, int &rf)
block and face in between two face blocks
std::vector< a_block * > blocks_
virtual void writeg(std::ostream &o) const
write structure in brlcad format
bool check_block(const int rb) const
check whether references are in range
double penalty() const
penalty value used for optimization
bool check_blockref(const int rb, const int rf) const
check whether references are in range
a_point c() const
get centre of mass
friend std::istream & operator>>(std::istream &i, a_structure &s)
input/output
void storeexits(std::vector< int > &) const
store face exits situation