Flow123d  release_2.2.0-914-gf1a3a4f
intersectionLocal.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file intersectionLocal.h
15  * @brief
16  */
17 
18 #ifndef IntersectionLocalH
19 #define IntersectionLocalH
20 
21 #include <iostream>
22 #include <vector>
23 #include <stdio.h>
24 
25 using namespace std;
26 
27 namespace ngh {
28 
29 //class IntersectionPoint - two vectors of local coords
31 public:
33  : coord1(c1), coord2(c2) {}
35  : coord1(LC.coord1), coord2(LC.coord2) {}
36  inline const std::vector<double> &el1_coord() const
37  {return coord1;}
38  inline const std::vector<double> &el2_coord() const
39  {return coord2;}
40  bool operator ==(const IntersectionPoint&);
41 protected:
44 
45  friend class IntersectionLocal;
47 };
48 IntersectionPoint *interpolate(const IntersectionPoint &A1, const IntersectionPoint &A2, double t);
49 
50 
52 public:
53  typedef enum {
58 
59  IntersectionLocal(IntersectionType i_type);
62 
63  void add_local_coord(const std::vector<double> &coordin1, const std::vector<double> &coordin2); //add coords to i_points
64  void add_local_point(IntersectionPoint *InPoint);
65  void print(FILE *out_file);
66 
67  static int getNumInstances() {
68  return IntersectionLocal::numberInstance;
69  }
70 
71  inline IntersectionType get_type() const
72  {return type; }
73  inline unsigned int n_points() const {
74  return i_points.size();
75  }
76  inline const IntersectionPoint * get_point(const unsigned int index) const
77  {
78  if (index >= i_points.size() ) return NULL;
79  else return i_points[index];
80  }
81 
82 private:
83  static int numberInstance;
84  int id;
85 
86  std::vector<IntersectionPoint *> i_points; //vektor ukazatelu na dvojice lokal. souradnic
87  IntersectionType type;
88 
89 
90  int generateId();
91 };
92 
93 } // namespace ngh
94 
95 #endif /* IntersectionLocalH */
IntersectionType
Selection of intersections of different dimensions.
IntersectionPoint(const std::vector< double > &c1, const std::vector< double > &c2)
unsigned int n_points() const
IntersectionPoint(const IntersectionPoint &LC)
FMT_API void print(std::FILE *f, CStringRef format_str, ArgList args)
Definition: format.cc:489
Definition: abscissa.h:25
const IntersectionPoint * get_point(const unsigned int index) const
IntersectionType get_type() const
std::vector< double > coord1
bool operator==(const Null &, const Null &)
const std::vector< double > & el2_coord() const
std::vector< double > coord2
const std::vector< double > & el1_coord() const
std::vector< IntersectionPoint * > i_points
IntersectionPoint * interpolate(const IntersectionPoint &A1, const IntersectionPoint &A2, double t)