Points&Forces (survey)
Software tools facilitating the task of surveying architecture
a_ocriteria_exmax.cxx
Go to the documentation of this file.
1 /*
2 Copyright 2010-2011 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_ocriteria_exmax.h"
17 #include "a_structure.h"
18 #include "a_face_2d4.h"
19 
20 #include "config.h"
21 
22 //---------------------------------------------------------------------------
23 double a_ocriteria_exmax::f(const a_structure * s) const
24 {
25  int nf = 0;
26  double emax = 0.;
27  for (int i=0; i<s->nb(); i++)
28  {
29  const a_block * b = dynamic_cast<const a_block *>(s->b(i));
30  for (int j=0; j<b->ni(); j++)
31  {
32  a_face_2d4 * f = cf_2d4(b->i(j));
33  double ex = fabs(f->exrx());
34  double ey = fabs(f->exry());
35  if (ex>emax)
36  emax = ex;
37  if (ey>emax)
38  emax = ey;
39  }
40  }
41  return emax;
42 }
43 //---------------------------------------------------------------------------
a_face_2d4 * cf_2d4(a_face *f)
Definition: a_face_2d4.cxx:26
a_face * i(const int i)
get pointer to face
Definition: a_block.cxx:148
int ni() const
get number of faces
Definition: a_block.h:83
virtual double f(const a_structure *f) const
return the maximum relative excentricity
structure class
Definition: a_structure.h:33
int nb() const
get number of blocks
Definition: a_structure.h:41
a_block * b(const int i) const
get pointer to the block i