Points&Forces (survey)
Software tools facilitating the task of surveying architecture
a_fcriteria_in.cxx
Go to the documentation of this file.
1 /*
2 Copyright 2010-2016 Pierre SMARS (smars@yuntech.edu.tw)
3 This program is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program 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
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 #include "a_fcriteria_in.h"
17 #include "a_face_2d4.h"
18 
19 #include "config.h"
20 
21 //---------------------------------------------------------------------------
22 const std::string a_fcriteria_in::help()
23 {
24  std::ostringstream o;
25  o << a_fcriteria::help();
26  o << "***************" << std::endl;
27  o << "a_fcriteria_in:" << std::endl;
28  o << "***************" << std::endl;
29  o << "This class derives from a _fcriteria," << std::endl;
30  o << "it implements a specific resistance criterion:" << std::endl;
31  o << "The excentricity of the resultant of the force on a face is required to remain in between specific bounds" << std::endl;
32  o << "max 'value': specify the bound (default: 1 = pass in the section)" << std::endl;
33  return o.str();
34 }
35 //---------------------------------------------------------------------------
36 bool a_fcriteria_in::ok(const a_face * f0) const
37 {
38  const a_face_2d4 * f = cf_2d4(f0);
39  double exrx = fabs(f->exrx());
40  double exry = fabs(f->exry());
41  // std::cerr << "ex: " << exrx << " " << exry << std::endl;
42  if ((exrx<max_+verysmall_) and (exry <max_+verysmall_))
43  return true;
44  return false;
45 }
46 //---------------------------------------------------------------------------
47 double a_fcriteria_in::penalty(const a_face * f0) const
48 {
49  const a_face_2d4 * f = cf_2d4(f0);
50  double exrx = fabs(f->exrx());
51  double exry = fabs(f->exry());
52  if ((exrx<max_+verysmall_) and (exry <max_+verysmall_))
53  return 0;
54  if (exry>exrx)
55  exrx = exry;
56  return exrx-max_;
57 }
58 //---------------------------------------------------------------------------
a_face_2d4 * cf_2d4(a_face *f)
Definition: a_face_2d4.cxx:26
double exry() const
relative excentricity in y direction (between 0 and 1)
Definition: a_face_2d4.cxx:156
double exrx() const
relative excentricity in x direction (between 0 and 1)
Definition: a_face_2d4.cxx:151
Definition: a_face.h:33
virtual double penalty(const a_face *f) const
return max excentricity if abs is higher than max (1. by default)
virtual bool ok(const a_face *f) const
return true if forces on the face are passing through the face
static const std::string help()
get information about the class
double verysmall_
Definition: a_fcriteria.h:41
static const std::string help()
get information about the class
Definition: a_fcriteria.cxx:22