Points&Forces (survey)
Software tools facilitating the task of surveying architecture
a_ocriteria_ex.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_ex.h"
17 #include "a_structure.h"
18 #include "a_face_2d4.h"
19 
20 #include "a_debug.h"
21 
22 //---------------------------------------------------------------------------
23 double a_ocriteria_ex::f(const a_structure * s) const
24 {
25  int nf = 0;
26  double etot;
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 //CL(.)
33  a_face_2d4 * f = cf_2d4(b->i(j));
34  double ex = fabs(f->exrx());
35  double ey = fabs(f->exry());
36  if (ey>ex)
37  ex = ey;
38  etot += ex;
39  nf++;
40  }
41  }
42 //VE(etot)
43 //VE(nf)
44 //VE(etot/nf)
45  return etot/nf;
46 }
47 //---------------------------------------------------------------------------
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 average 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