elec-1.00
 All Classes Namespaces Files Functions Variables Macros
elecConductor.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 /* This file is part of rl-lib
4  *
5  * Copyright (C) 2010, Herve FREZZA-BUET
6  *
7  * Author : Herve Frezza-Buet
8  *
9  * Contributor :
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public
13  * License (GPL) as published by the Free Software Foundation; either
14  * version 3 of the License, or any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24  *
25  * Contact : Herve.Frezza-Buet@supelec.fr
26  *
27  */
28 
29 #include <elecPoint.hpp>
30 #include <elecParams.hpp>
31 #include <elecParticle.hpp>
32 #include <utility>
33 
34 namespace elec {
35  namespace conductor {
36 
40  class Metal {
41  public:
42  double r;
43  unsigned int idf;
44  Metal(double resist) : r(resist) {}
45  virtual ~Metal() {}
49  virtual bool inside(const elec::Point& p) {return false;}
50  virtual std::pair<elec::Point,elec::Point> bounding_box() const = 0;
53  }
54  };
55 
56  class Rectangle : public Metal {
57  public:
59  Rectangle(const elec::Point& min_corner,
60  const elec::Point& max_corner,
61  double r)
62  : Metal(r),
63  min(min_corner),
64  max(max_corner) {}
65  virtual bool inside(const elec::Point& p) {
66  return p.x >= min.x
67  && p.x <= max.x
68  && p.y >= min.y
69  && p.y <= max.y;
70  }
71 
72  virtual std::pair<elec::Point,elec::Point> bounding_box() const {
73  return {min,max};
74  }
75  };
76 
77  class Disk : public Metal {
78  public:
80  double radius;
81  Disk(const elec::Point& C,
82  double R,
83  double r)
84  : Metal(r),
85  center(C),
86  radius(R) {}
87  virtual bool inside(const elec::Point& p) {
88  return elec::d(center,p) <= radius;
89  }
90 
91  virtual std::pair<elec::Point,elec::Point> bounding_box() const {
94  }
95  };
96  }
97 }
virtual bool inside(const elec::Point &p)
Definition: elecConductor.hpp:49
double radius
Definition: elecConductor.hpp:80
elec::Point center
Definition: elecConductor.hpp:79
Definition: elecParticle.hpp:36
elec::Point min
Definition: elecConductor.hpp:58
#define elecCONDUCTOR_VISCOSITY
Definition: elecParams.hpp:33
virtual std::pair< elec::Point, elec::Point > bounding_box() const =0
virtual std::pair< elec::Point, elec::Point > bounding_box() const
Definition: elecConductor.hpp:91
virtual bool inside(const elec::Point &p)
Definition: elecConductor.hpp:87
Disk(const elec::Point &C, double R, double r)
Definition: elecConductor.hpp:81
Point speed
Definition: elecParticle.hpp:38
Metal(double resist)
Definition: elecConductor.hpp:44
Definition: elecConductor.hpp:56
virtual bool inside(const elec::Point &p)
Definition: elecConductor.hpp:65
virtual ~Metal()
Definition: elecConductor.hpp:45
Definition: elecPoint.hpp:35
double r
Definition: elecConductor.hpp:42
virtual std::pair< elec::Point, elec::Point > bounding_box() const
Definition: elecConductor.hpp:72
unsigned int idf
Definition: elecConductor.hpp:43
elec::Point friction(const elec::Particle &p)
Definition: elecConductor.hpp:51
Definition: elecConductor.hpp:40
double y
Definition: elecPoint.hpp:37
double d(const Point &A, const Point &B)
Definition: elecPoint.hpp:136
Rectangle(const elec::Point &min_corner, const elec::Point &max_corner, double r)
Definition: elecConductor.hpp:59
elec::Point max
Definition: elecConductor.hpp:58
double x
Definition: elecPoint.hpp:37
Definition: elecConductor.hpp:77