Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Material.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
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  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 #ifndef MATERIAL_H
17 #define MATERIAL_H
18 
19 #include <string>
20 #include <map>
21 #include <iostream>
22 #include <sstream>
23 
24 #include "Base.h"
25 
26 class Material : public Base
27 {
28 public:
30  Material() : Base()
31  {
32  name = "unknown material";
33  isNatural = true;
34  };
36  Material(std::string _name) : Base()
37  {
38  name = _name;
39  isNatural = true;
40  }
42  Material(const Material& other)
43  {
44  name = std::string(other.name);
45  isNatural = other.isNatural;
46  // #ifdef USE_QT
47  // r = other.r;
48  // g = other.g;
49  // b = other.b;
50  // #endif
51  }
52  virtual ~Material() {}
53 
54 public:
55  unsigned int id;
56  bool isNatural;
57 
58  // #ifdef USE_QT
59  // unsigned int r;
60  // unsigned int g;
61  // unsigned int b;
62  // #endif
63 };
64 
69 {
70 
71 public:
77  unsigned int registerNewMaterial(Material* m);
79  Material* requestMaterial(unsigned int key);
81  void print();
82 
83 protected:
84  std::map<unsigned int, Material*> materials;
85  unsigned int counterKey;
86 };
87 
88 #endif
Base class of Event, Material, PostFilter, Ray, Repere, Scene, Shape, Simulation, Source.
Definition: Base.h:25
std::string name
Each instantiated object may be named.
Definition: Base.h:52
A manager class for Material.
Definition: Material.h:69
unsigned int counterKey
Counter of materials into the list.
Definition: Material.h:85
~MaterialManager()
Destructor.
Definition: Material.cpp:18
Material * requestMaterial(unsigned int key)
Return a material from the list by its index.
Definition: Material.cpp:62
MaterialManager()
Constructor.
Definition: Material.h:73
void print()
Print the materials list.
Definition: Material.cpp:47
std::map< unsigned int, Material * > materials
Pointer list to materials.
Definition: Material.h:84
unsigned int registerNewMaterial(Material *m)
Register a new material into the list.
Definition: Material.cpp:26
Material()
Default constructor.
Definition: Material.h:30
virtual ~Material()
Definition: Material.h:52
bool isNatural
Flag to define a natural material.
Definition: Material.h:56
Material(const Material &other)
Copy constructor.
Definition: Material.h:42
unsigned int id
Identification set by the MaterialManager.
Definition: Material.h:55
Material(std::string _name)
Constructor by giving a name to the material.
Definition: Material.h:36