Version: 9.12.0
XAO_Field.hxx
Go to the documentation of this file.
1 // Copyright (C) 2013-2023 CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library 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 GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Frederic Pons (OpenCascade)
20 
21 #ifndef __XAO_FIELD_HXX__
22 #define __XAO_FIELD_HXX__
23 
24 #include <string>
25 #include <vector>
26 
27 #include "XAO.hxx"
28 #include "XAO_XaoUtils.hxx"
29 #include "XAO_Step.hxx"
30 
31 #ifdef WIN32
32 #pragma warning(disable:4290) // Warning Exception ...
33 #pragma warning(disable:4251) // Warning dll-interface ...
34 #endif
35 
36 
37 namespace XAO
38 {
39  typedef std::vector<Step*>::iterator stepIterator;
40 
46  {
47  protected:
55  Field(XAO::Dimension dimension,
56  int nbElements, int nbComponents, const std::string& name);
57 
58  public:
68  static Field* createField(XAO::Type type, XAO::Dimension dimension,
69  int nbElements, int nbComponents,
70  const std::string& name = std::string(""));
71 
75  virtual ~Field();
76 
81  virtual XAO::Type getType() = 0;
82 
87  const std::string getName() const
88  {
89  return m_name;
90  }
91 
96  void setName(const std::string& name)
97  {
98  m_name = name;
99  }
100 
106  {
107  return m_dimension;
108  }
109 
114  int countElements() const
115  {
116  return m_nbElements;
117  }
118 
123  int countComponents() const
124  {
125  return m_nbComponents;
126  }
127 
132  int countValues() const
133  {
134  return m_nbElements * m_nbComponents;
135  }
136 
141  int countSteps() const { return m_steps.size(); }
142 
148  const std::string getComponentName(int index);
149 
155  void setComponentName(int componentIndex, const std::string& name);
156 
161  void setComponentsNames(const std::vector<std::string>& names);
162 
168  virtual Step* addNewStep(int number) = 0;
169 
175  bool removeStep(Step* step);
176 
182  bool hasStep(int step);
183 
188  stepIterator begin() { return m_steps.begin(); }
189 
194  stepIterator end() { return m_steps.end(); }
195 
196  protected:
197  void checkComponent(int component) ;
198  void checkStepIndex(int step) ;
199 
200  protected:
202  std::string m_name;
205 
209  std::vector<std::string> m_components;
212 
214  std::vector<Step*> m_steps;
215  };
216 }
217 
218 #endif
#define XAO_EXPORT
Definition: XAO.hxx:31
A geometrical Field.
Definition: XAO_Field.hxx:46
const std::string getName() const
Gets the name of the Field.
Definition: XAO_Field.hxx:87
std::string m_name
The name of the Field.
Definition: XAO_Field.hxx:202
virtual Step * addNewStep(int number)=0
Adds a new step of the same type than the field.
std::vector< std::string > m_components
The components of the field.
Definition: XAO_Field.hxx:209
int m_nbComponents
The number of components.
Definition: XAO_Field.hxx:207
void setName(const std::string &name)
Sets the name of the Field.
Definition: XAO_Field.hxx:96
stepIterator end()
Returns the last step.
Definition: XAO_Field.hxx:194
int m_nbElements
The number of elements.
Definition: XAO_Field.hxx:211
virtual XAO::Type getType()=0
Gets the Type of the field.
int countComponents() const
Gets the number of components.
Definition: XAO_Field.hxx:123
int countElements() const
Gets the number of elements of each step.
Definition: XAO_Field.hxx:114
stepIterator begin()
Returns the first step.
Definition: XAO_Field.hxx:188
int countSteps() const
Gets the number of the steps.
Definition: XAO_Field.hxx:141
XAO::Dimension getDimension() const
Gets the Dimension of the Field.
Definition: XAO_Field.hxx:105
int countValues() const
Gets the number of values for each step.
Definition: XAO_Field.hxx:132
XAO::Dimension m_dimension
The dimension of the Field.
Definition: XAO_Field.hxx:204
std::vector< Step * > m_steps
The list of steps.
Definition: XAO_Field.hxx:214
Base class for steps.
Definition: XAO_Step.hxx:39
Definition: BrepGeometryTest.hxx:26
Dimension
Definition: XAO_XaoUtils.hxx:50
Type
Definition: XAO_XaoUtils.hxx:62
std::vector< Step * >::iterator stepIterator
Definition: XAO_Field.hxx:39