b2api
B2000++ API Reference Manual, VERSION 4.6
 
Loading...
Searching...
No Matches
b2property_contact_2d_tube.H
1//------------------------------------------------------------------------
2// b2property_contact_2d_tube.H --
3//
4// written by Thomas Ludwig
5//
6// Copyright (c) 2016
7// SMR Engineering & Development SA
8// 2502 Bienne, Switzerland
9//
10// All Rights Reserved. Proprietary source code. The contents of
11// this file may not be disclosed to third parties, copied or
12// duplicated in any form, in whole or in part, without the prior
13// written permission of SMR.
14//------------------------------------------------------------------------
15
16#ifndef _B2PROPERTY_CONTACT_2D_TUBE_H_
17#define _B2PROPERTY_CONTACT_2D_TUBE_H_
18
19#include "elements/properties/b2property_contact_rb.H"
20#include "model/b2element.H"
21
22namespace b2000 {
23class PropertyContact2DTube : public PropertyContactRB {
24public:
25 bool check(const double coor[3], double coor_target[3]) const {
26 double rcoor[2];
27 sub_2(coor, centre, rcoor);
28
29 const double r = norm_2(rcoor);
30 const bool inside = (r_min > 0 && r <= r_min);
31 const bool outside = (r_max > r_min && r >= r_max);
32
33 if (!inside && !outside) { return false; }
34
35 const double c = (inside ? r_min : r_max) / r;
36 coor_target[0] = centre[0] + centre[0] + c * rcoor[0];
37 coor_target[1] = centre[1] + centre[1] + c * rcoor[1];
38 coor_target[2] = coor[2];
39 return true;
40 }
41
42protected:
43 double centre[2];
44 double r_min;
45 double r_max;
46};
47} // namespace b2000
48
49#endif /* _B2PROPERTY_CONTACT_2D_TUBE_H_ */
Contains the base classes for implementing Finite Elements.
Definition b2boundary_condition.H:32
void sub_2(const T1 v1[2], const T2 v2[2], T3 dest[2])
Definition b2tensor_calculus.H:248
T norm_2(T a[2])
Definition b2tensor_calculus.H:376