4 * Created on: 23 janv. 2012
9 #include "CdmathException.hxx"
15 //----------------------------------------------------------------------
17 //----------------------------------------------------------------------
21 _groupNames=std::vector<std::string>(0);
29 //----------------------------------------------------------------------
30 Face::Face( const Face& face )
31 //----------------------------------------------------------------------
33 _measure = face.getMeasure() ;
34 _region=face.getRegion();
35 _groupNames=face.getGroupNames();
36 _point = face.getBarryCenter();
37 _numberOfCells = face.getNumberOfCells() ;
38 _numberOfNodes = face.getNumberOfNodes() ;
39 _nodesId=face.getNodesId();
40 _cellsId=face.getCellsId();
46 //----------------------------------------------------------------------
47 Face::Face( const int numberOfNodes, const int numberOfCells, const double measure, const Point p, double xN, double yN, double zN )
48 //----------------------------------------------------------------------
51 _numberOfNodes = numberOfNodes ;
52 _numberOfCells = numberOfCells ;
53 _nodesId = std::vector< int >(_numberOfNodes,0);
54 _cellsId = std::vector< int >(_numberOfCells,0);
62 _groupNames=std::vector<std::string>(1,"Boundary");
63 else if(numberOfCells>=2)//On a graph geometry (spaceDim>meshDim), a face is a node and can have more than 2 cell neighbour
64 _groupNames=std::vector<std::string>(0);
67 cout<<"Error, trying to create a face with "<< numberOfCells <<" cell neighbours"<<endl;
68 throw CdmathException("A face must have at least one cell neighbour (MEDCoupling philosophy)");
72 //----------------------------------------------------------------------
74 //----------------------------------------------------------------------
79 Face::getRegion(void) const
85 Face::getXN(void) const
91 Face::getYN(void) const
97 Face::getZN(void) const
102 std::vector<std::string>
103 Face::getGroupNames(void) const
109 Face::getGroupName(int igroup) const
111 if(igroup<_groupNames.size())
112 return _groupNames[igroup];
115 std::cout<<"Error Face::getGroupName(int igroup), group number "<<igroup+1<<" requested"<<std::endl;
116 std::cout<<"Face belongs to "<< _groupNames.size() <<" groups"<<std::endl;
117 throw CdmathException("Face has no group with number igroup");
122 Face::setGroupName(const string groupName)
124 _groupNames.insert(_groupNames.begin(),groupName);
131 if (_region==0 || _numberOfCells==1)
136 //----------------------------------------------------------------------
138 Face::getBarryCenter( void ) const
139 //----------------------------------------------------------------------
144 //----------------------------------------------------------------------
146 Face::x( void ) const
147 //----------------------------------------------------------------------
152 //----------------------------------------------------------------------
154 Face::y( void ) const
155 //----------------------------------------------------------------------
160 //----------------------------------------------------------------------
162 Face::z( void ) const
163 //----------------------------------------------------------------------
168 //----------------------------------------------------------------------
170 Face::getCellsId( void ) const
171 //----------------------------------------------------------------------
176 //----------------------------------------------------------------------
178 Face::getNodesId( void ) const
179 //----------------------------------------------------------------------
184 //----------------------------------------------------------------------
186 Face::getMeasure( void ) const
187 //----------------------------------------------------------------------
192 //----------------------------------------------------------------------
194 Face::getNumberOfCells( void ) const
195 //----------------------------------------------------------------------
197 return _numberOfCells ;
200 //----------------------------------------------------------------------
202 Face::getNumberOfNodes( void ) const
203 //----------------------------------------------------------------------
205 return _numberOfNodes ;
208 //----------------------------------------------------------------------
210 Face::addCellId(const int numCell, const int cellId )
211 //----------------------------------------------------------------------
213 _cellsId[numCell] = cellId ;
215 //----------------------------------------------------------------------
217 Face::addNodeId(const int numNode, const int nodeId )
218 //----------------------------------------------------------------------
220 _nodesId[numNode] = nodeId ;
223 //----------------------------------------------------------------------
225 Face::operator= ( const Face& face )
226 //----------------------------------------------------------------------
228 _measure = face.getMeasure() ;
229 _point = face.getBarryCenter() ;
230 _numberOfCells = face.getNumberOfCells() ;
231 _numberOfNodes = face.getNumberOfNodes() ;
232 _nodesId=face.getNodesId();
233 _cellsId=face.getCellsId();
234 _groupNames=face.getGroupNames();
235 _region=face.getRegion();
241 //------------------------------------------------------------------------
243 Face::getNodeId(int localId) const
244 //------------------------------------------------------------------------
246 if(localId<_numberOfNodes)
247 return _nodesId[localId];
250 std::cout<< "Local id requested : "<< localId<<" total number of nodes= "<<_numberOfNodes<<std::endl;
251 throw CdmathException("Face::getNodeId : incorrect node local id");
254 //------------------------------------------------------------------------
256 Face::getCellId(int localId) const
257 //------------------------------------------------------------------------
259 if(localId<_numberOfCells)
260 return _cellsId[localId];
263 std::cout<< "Local id requested : "<< localId<<" total number of cells= "<<_numberOfCells<<std::endl;
264 throw CdmathException("Face::getCellId : incorrect cell local id");