Back to index

salome-med  6.5.0
MED_Structures.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : MED_Structure.cxx
00024 //  Author : Eugeny NIKOLAEV
00025 //  Module : MED
00026 //
00027 #include "MED_Structures.hxx"
00028 #include "MED_Utilities.hxx"
00029 
00030 #include <cstring>
00031 
00032 using namespace MED;
00033 
00034 namespace MED
00035 {
00036   TInt
00037   GetNbNodes(EGeometrieElement typmai)
00038   {
00039     return typmai%100;
00040   }
00041 
00042   std::string 
00043   GetString(TInt theId, 
00044             TInt theStep, 
00045             const TString& theString)
00046   {
00047     const char* aPos = &theString[theId*theStep];
00048     TInt aSize = std::min(TInt(strlen(aPos)),theStep);
00049     return std::string(aPos,aSize);
00050   }
00051 
00052   void 
00053   SetString(TInt theId, 
00054             TInt theStep, 
00055             TString& theString, 
00056             const std::string& theValue)
00057   {
00058     TInt aSize = std::min(TInt(theValue.size()+1),theStep);
00059     char* aPos = &theString[theId*theStep];
00060     strncpy(aPos,theValue.c_str(),aSize);
00061   }
00062 
00063   void 
00064   SetString(TInt theId, 
00065             TInt theStep, 
00066             TString& theString, 
00067             const TString& theValue)
00068   {
00069     TInt aSize = std::min(TInt(theValue.size()+1),theStep);
00070     char* aPos = &theString[theId*theStep];
00071     const char* aValue = &theValue[0];
00072     strncpy(aPos,aValue,aSize);
00073   }
00074 
00075   TInt
00076   GetDimGaussCoord(EGeometrieElement theGeom)
00077   {
00078     return theGeom/100;
00079   }
00080 
00081   TInt
00082   GetNbRefCoord(EGeometrieElement theGeom)
00083   {
00084     return (theGeom%100);
00085   }
00086 
00087   //---------------------------------------------------------------
00088   PFloatTimeStampValue
00089   CastToFloatTimeStampValue(const PTimeStampValueBase& theTimeStampValue)
00090   {
00091     return theTimeStampValue;
00092   }
00093 
00094   PIntTimeStampValue
00095   CastToIntTimeStampValue(const PTimeStampValueBase& theTimeStampValue)
00096   {
00097     return theTimeStampValue;
00098   }
00099 }
00100 
00101 //---------------------------------------------------------------
00102 TInt
00103 TFamilyInfo
00104 ::GetAttrId(TInt theId) const 
00105 {
00106   return myAttrId[theId];
00107 }
00108 
00109 TInt
00110 TFamilyInfo
00111 ::GetAttrVal(TInt theId) const 
00112 {
00113   return myAttrVal[theId];
00114 }
00115 
00116 void
00117 TFamilyInfo
00118 ::SetAttrId(TInt theId,TInt theVal) 
00119 {
00120   myAttrId[theId] = theVal;
00121 }
00122 
00123 void
00124 TFamilyInfo
00125 ::SetAttrVal(TInt theId,TInt theVal) 
00126 {
00127   myAttrVal[theId] = theVal;
00128 }
00129 
00130 //---------------------------------------------------------------
00131 TInt
00132 TElemInfo
00133 ::GetFamNum(TInt theId) const 
00134 {
00135   return (*myFamNum)[theId];
00136 }
00137 
00138 void
00139 TElemInfo
00140 ::SetFamNum(TInt theId, TInt theVal) 
00141 {
00142   (*myFamNum)[theId] = theVal;
00143   myIsFamNum = eVRAI;
00144 }
00145 
00146 TInt
00147 TElemInfo
00148 ::GetElemNum(TInt theId) const 
00149 {
00150   return (*myElemNum)[theId];
00151 }
00152 
00153 void
00154 TElemInfo
00155 ::SetElemNum(TInt theId, TInt theVal) 
00156 {
00157   (*myElemNum)[theId] = theVal;
00158 }
00159 
00160 //---------------------------------------------------------------
00161 TCCoordSlice 
00162 TNodeInfo
00163 ::GetCoordSlice(TInt theId) const
00164 {
00165   TInt aDim = myMeshInfo->GetSpaceDim();
00166   if(GetModeSwitch() == eFULL_INTERLACE)
00167     return TCCoordSlice(*myCoord, std::slice(theId*aDim, aDim, 1));
00168   else
00169     return TCCoordSlice(*myCoord, std::slice(theId, aDim, aDim));
00170 }
00171 
00172 TCoordSlice 
00173 TNodeInfo
00174 ::GetCoordSlice(TInt theId)
00175 {
00176   TInt aDim = myMeshInfo->GetSpaceDim();
00177   if(GetModeSwitch() == eFULL_INTERLACE)
00178     return TCoordSlice(*myCoord, std::slice(theId*aDim,aDim,1));
00179   else
00180     return TCoordSlice(*myCoord, std::slice(theId,aDim,aDim));
00181 }
00182 
00183 //---------------------------------------------------------------
00184 TCConnSlice 
00185 TCellInfo
00186 ::GetConnSlice(TInt theElemId) const
00187 {
00188   if(GetModeSwitch() == eFULL_INTERLACE)
00189     return TCConnSlice(*myConn, std::slice(GetConnDim()*theElemId, GetNbNodes(myGeom), 1));
00190   else
00191     return TCConnSlice(*myConn, std::slice(theElemId, GetNbNodes(myGeom), GetConnDim()));
00192 }
00193 
00194 TConnSlice 
00195 TCellInfo
00196 ::GetConnSlice(TInt theElemId)
00197 {
00198   if(GetModeSwitch() == eFULL_INTERLACE)
00199     return TConnSlice(*myConn, std::slice(GetConnDim()*theElemId, GetNbNodes(myGeom), 1));
00200   else
00201     return TConnSlice(*myConn, std::slice(theElemId, GetNbNodes(myGeom), GetConnDim()));
00202 }
00203 
00204 
00205 //---------------------------------------------------------------
00206 TInt
00207 TPolygoneInfo
00208 ::GetNbConn(TInt theElemId) const 
00209 {
00210   return (*myIndex)[theElemId + 1] - (*myIndex)[theElemId];
00211 }
00212 
00213 TCConnSlice 
00214 TPolygoneInfo
00215 ::GetConnSlice(TInt theElemId) const
00216 {
00217   return TCConnSlice(*myConn, std::slice((*myIndex)[theElemId] - 1, GetNbConn(theElemId), 1));
00218 }
00219 
00220 TConnSlice 
00221 TPolygoneInfo
00222 ::GetConnSlice(TInt theElemId)
00223 {
00224   return TConnSlice(*myConn, std::slice((*myIndex)[theElemId] - 1, GetNbConn(theElemId), 1));
00225 }
00226 
00227 
00228 //---------------------------------------------------------------
00229 TInt 
00230 TPolyedreInfo
00231 ::GetNbFaces(TInt theElemId) const 
00232 {
00233   return (*myIndex)[theElemId+1] - (*myIndex)[theElemId];
00234 }
00235 
00236 TInt 
00237 TPolyedreInfo
00238 ::GetNbNodes(TInt theElemId) const 
00239 {
00240   TInt aNbNodes = 0;
00241   TInt aNbFaces = GetNbFaces(theElemId);
00242   TInt aStartFaceId = (*myIndex)[theElemId] - 1;
00243   for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
00244     TInt aCurrentId = (*myFaces)[aStartFaceId];
00245     TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
00246     aNbNodes += aDiff;
00247   }
00248   return aNbNodes;
00249 }
00250 
00251 TCConnSliceArr 
00252 TPolyedreInfo
00253 ::GetConnSliceArr(TInt theElemId) const
00254 {
00255   TInt aNbFaces = GetNbFaces(theElemId);
00256   TCConnSliceArr aConnSliceArr(aNbFaces);
00257   TInt aStartFaceId = (*myIndex)[theElemId] - 1;
00258   for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
00259     TInt aCurrentId = (*myFaces)[aStartFaceId];
00260     TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
00261     aConnSliceArr[aFaceId] =
00262       TCConnSlice(*myConn, std::slice(aCurrentId - 1, aDiff, 1));
00263   }
00264   return aConnSliceArr;
00265 }
00266 
00267 TConnSliceArr 
00268 TPolyedreInfo
00269 ::GetConnSliceArr(TInt theElemId)
00270 {
00271   TInt aNbFaces = GetNbFaces(theElemId);
00272   TConnSliceArr aConnSliceArr(aNbFaces);
00273   TInt aStartFaceId = (*myIndex)[theElemId] - 1;
00274   for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
00275     TInt aCurrentId = (*myFaces)[aStartFaceId];
00276     TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
00277     aConnSliceArr[aFaceId] =
00278       TConnSlice(*myConn, std::slice(aCurrentId - 1, aDiff, 1));
00279   }
00280   return aConnSliceArr;
00281 }
00282 
00283 
00284 //---------------------------------------------------------------
00285 TMeshValueBase
00286 ::TMeshValueBase():
00287   myNbElem(0),
00288   myNbComp(0),
00289   myNbGauss(0),
00290   myStep(0)
00291 {}
00292 
00293 void
00294 TMeshValueBase
00295 ::Allocate(TInt theNbElem,
00296            TInt theNbGauss,
00297            TInt theNbComp,
00298            EModeSwitch theMode)
00299 {
00300   myModeSwitch = theMode;
00301   
00302   myNbElem = theNbElem;
00303   myNbGauss = theNbGauss;
00304   myNbComp = theNbComp;
00305   
00306   myStep = theNbComp*theNbGauss;
00307 }
00308 
00309 size_t
00310 TMeshValueBase
00311 ::GetSize() const
00312 {
00313   return myNbElem * myStep;
00314 }
00315     
00316 size_t
00317 TMeshValueBase
00318 ::GetNbVal() const
00319 {
00320   return myNbElem * myNbGauss;
00321 }
00322 
00323 size_t
00324 TMeshValueBase
00325 ::GetNbGauss() const
00326 {
00327   return myNbGauss;
00328 }
00329 
00330 size_t
00331 TMeshValueBase
00332 ::GetStep() const
00333 {
00334   return myStep;
00335 }
00336 
00337 
00338 //---------------------------------------------------------------
00339 TInt
00340 TProfileInfo
00341 ::GetElemNum(TInt theId) const 
00342 {
00343   return (*myElemNum)[theId];
00344 }
00345 
00346 void
00347 TProfileInfo
00348 ::SetElemNum(TInt theId,TInt theVal) 
00349 {
00350   (*myElemNum)[theId] = theVal;
00351 }
00352 
00353 //---------------------------------------------------------------
00354 bool
00355 TGaussInfo::TLess
00356 ::operator()(const TKey& theLeft, const TKey& theRight) const
00357 {
00358   EGeometrieElement aLGeom = boost::get<0>(theLeft);
00359   EGeometrieElement aRGeom = boost::get<0>(theRight);
00360   if(aLGeom != aRGeom)
00361     return aLGeom < aRGeom;
00362 
00363   const std::string& aLStr = boost::get<1>(theLeft);
00364   const std::string& aRStr = boost::get<1>(theRight);
00365   return aLStr < aRStr;
00366 }
00367 
00368 bool
00369 TGaussInfo::TLess
00370 ::operator()(const TGaussInfo& theLeft, const TGaussInfo& theRight) const
00371 {
00372   if(!&theLeft)
00373     return true;
00374 
00375   if(!&theRight)
00376     return false;
00377 
00378   if(theLeft.myGeom != theRight.myGeom)
00379     return theLeft.myGeom < theRight.myGeom;
00380 
00381   if(theLeft.myRefCoord != theRight.myRefCoord)
00382     return theLeft.myRefCoord < theRight.myRefCoord;
00383 
00384   return theLeft.myGaussCoord < theRight.myGaussCoord;
00385 }
00386 
00387 TCCoordSlice 
00388 TGaussInfo
00389 ::GetRefCoordSlice(TInt theId) const
00390 {
00391   if(GetModeSwitch() == eFULL_INTERLACE)
00392     return TCCoordSlice(myRefCoord,std::slice(theId*GetDim(),GetDim(),1));
00393   else
00394     return TCCoordSlice(myRefCoord,std::slice(theId,GetDim(),GetDim()));
00395 }
00396 
00397 TCoordSlice 
00398 TGaussInfo
00399 ::GetRefCoordSlice(TInt theId)
00400 {
00401   if(GetModeSwitch() == eFULL_INTERLACE)
00402     return TCoordSlice(myRefCoord,std::slice(theId*GetDim(),GetDim(),1));
00403   else
00404     return TCoordSlice(myRefCoord,std::slice(theId,GetDim(),GetDim()));
00405 }
00406 
00407 TCCoordSlice 
00408 TGaussInfo
00409 ::GetGaussCoordSlice(TInt theId) const
00410 {
00411   if(GetModeSwitch() == eFULL_INTERLACE)
00412     return TCCoordSlice(myGaussCoord,std::slice(theId*GetDim(),GetDim(),1));
00413   else
00414     return TCCoordSlice(myGaussCoord,std::slice(theId,GetDim(),GetDim()));
00415 }
00416 
00417 TCoordSlice 
00418 TGaussInfo
00419 ::GetGaussCoordSlice(TInt theId)
00420 {
00421   if(GetModeSwitch() == eFULL_INTERLACE)
00422     return TCoordSlice(myGaussCoord,std::slice(theId*GetDim(),GetNbGauss(),1));
00423   else
00424     return TCoordSlice(myGaussCoord,std::slice(theId,GetNbGauss(),GetDim()));
00425 }
00426 
00427 
00428 //---------------------------------------------------------------
00429 TInt
00430 TTimeStampInfo
00431 ::GetNbGauss(EGeometrieElement theGeom) const
00432 {
00433   TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
00434   if(anIter == myGeom2NbGauss.end())
00435     return 1;//EXCEPTION(runtime_error,"TTimeStampInfo::GetNbGauss - myGeom2NbGauss.find(theGeom) fails");
00436 
00437   return anIter->second;
00438 }
00439 
00440 
00441 //---------------------------------------------------------------
00442 // TGrilleInfo structure methods
00443 //---------------------------------------------------------------
00444 const EGrilleType&
00445 TGrilleInfo
00446 ::GetGrilleType() const
00447 {
00448   return myGrilleType;
00449 }
00450 
00451 EGrilleType
00452 TGrilleInfo
00453 ::GetGrilleType()
00454 {
00455   return myGrilleType;
00456 }
00457 
00458 void
00459 TGrilleInfo
00460 ::SetGrilleType(EGrilleType theGrilleType)
00461 {
00462   myGrilleType = theGrilleType;
00463 }
00464 
00465 const
00466 TIndexes&
00467 TGrilleInfo
00468 ::GetMapOfIndexes() const
00469 {
00470   return myIndixes;
00471 }
00472 
00473 TIndexes&
00474 TGrilleInfo
00475 ::GetMapOfIndexes()
00476 {
00477   return myIndixes;
00478 }
00479 
00480 const
00481 TFloatVector&
00482 TGrilleInfo
00483 ::GetIndexes(TInt theAxisNumber) const
00484 {
00485   TIndexes::const_iterator aIter=myIndixes.find(theAxisNumber);
00486   if(aIter==myIndixes.end())
00487     EXCEPTION(std::runtime_error, "const TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber); fails");
00488   return aIter->second;
00489 }
00490 
00491 TFloatVector&
00492 TGrilleInfo
00493 ::GetIndexes(TInt theAxisNumber)
00494 {
00495   TIndexes::iterator aIter=myIndixes.find(theAxisNumber);
00496   if(aIter==myIndixes.end())
00497     EXCEPTION(std::runtime_error, "TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber="<<theAxisNumber<<"); fails");
00498   return aIter->second;
00499 }
00500 
00501 TInt
00502 TGrilleInfo
00503 ::GetNbIndexes(TInt theAxisNumber)
00504 {
00505   const TFloatVector& aVector=GetIndexes(theAxisNumber);
00506   return aVector.size();
00507 }
00508 
00509 TInt
00510 TGrilleInfo
00511 ::GetNbNodes()
00512 {
00513   TInt nbNodes=0;
00514   TInt aDim = myMeshInfo->GetDim();
00515   for(int i=0;i<aDim;i++)
00516     if(nbNodes == 0)
00517       nbNodes = this->GetGrilleStructure()[i];
00518     else
00519       nbNodes = nbNodes*this->GetGrilleStructure()[i];
00520  
00521   return nbNodes;
00522 }
00523 
00524 TInt
00525 TGrilleInfo
00526 ::GetNbCells()
00527 {
00528   TInt nbCells=0;
00529   TInt aDim = myMeshInfo->GetDim();
00530   for(int i=0;i<aDim;i++)
00531     if(nbCells == 0)
00532       nbCells = this->GetGrilleStructure()[i]-1;
00533     else
00534       nbCells = nbCells*(this->GetGrilleStructure()[i]-1);
00535   return nbCells;
00536 }
00537 
00538 TInt
00539 TGrilleInfo
00540 ::GetNbSubCells()
00541 {
00542   TInt nb=0;
00543   TInt aDim = myMeshInfo->GetDim();
00544   switch (aDim) {
00545   case 3:
00546     nb =
00547       (myGrilleStructure[0]  ) * (myGrilleStructure[1]-1) * (myGrilleStructure[2]-1) +
00548       (myGrilleStructure[0]-1) * (myGrilleStructure[1]  ) * (myGrilleStructure[2]-1) +
00549       (myGrilleStructure[0]-1) * (myGrilleStructure[1]-1) * (myGrilleStructure[2]  );
00550     break;
00551   case 2:
00552     nb =
00553       (myGrilleStructure[0]  ) * (myGrilleStructure[1]-1) +
00554       (myGrilleStructure[0]-1) * (myGrilleStructure[1]  );
00555     break;
00556   }
00557   return nb;
00558 }
00559 
00560 EGeometrieElement
00561 TGrilleInfo
00562 ::GetGeom()
00563 {
00564   TInt aDim = myMeshInfo->GetDim();
00565   switch(aDim){
00566   case 1:
00567     return eSEG2;
00568   case 2:
00569     return eQUAD4;
00570   case 3:
00571     return eHEXA8;
00572   default:
00573     return eNONE;
00574   }
00575 }
00576 
00577 EGeometrieElement
00578 TGrilleInfo
00579 ::GetSubGeom()
00580 {
00581   TInt aDim = myMeshInfo->GetDim();
00582   switch(aDim){
00583   case 2:
00584     return eSEG2;
00585   case 3:
00586     return eQUAD4;
00587   }
00588   return eNONE;
00589 }
00590 
00591 EEntiteMaillage
00592 TGrilleInfo
00593 ::GetEntity()
00594 {
00595   return eMAILLE;
00596 }
00597 
00598 EEntiteMaillage
00599 TGrilleInfo
00600 ::GetSubEntity()
00601 {
00602   TInt aDim = myMeshInfo->GetDim();
00603   switch(aDim){
00604   case 2:
00605     return eARETE;
00606   case 3:
00607     return eFACE;
00608   }
00609   return EEntiteMaillage(-1);
00610 }
00611 
00612 const
00613 TIntVector&
00614 TGrilleInfo
00615 ::GetGrilleStructure() const
00616 {
00617   return myGrilleStructure;
00618 }
00619 
00620 TIntVector
00621 TGrilleInfo
00622 ::GetGrilleStructure()
00623 {
00624   return myGrilleStructure;
00625 }
00626 
00627 void
00628 TGrilleInfo
00629 ::SetGrilleStructure(TInt theAxis,TInt theNb)
00630 {
00631   if(theAxis >= 0 && theAxis <=2 && theNb >= 0)
00632   myGrilleStructure[theAxis]=theNb;
00633 }
00634 
00635 const
00636 TNodeCoord&
00637 TGrilleInfo
00638 ::GetNodeCoord() const
00639 {
00640   return myCoord;
00641 }
00642 
00643 TNodeCoord&
00644 TGrilleInfo
00645 ::GetNodeCoord()
00646 {
00647   return myCoord;
00648 }
00649 
00650 TNodeCoord
00651 TGrilleInfo
00652 ::GetCoord(TInt theId)
00653 {
00654   TNodeCoord aCoord;
00655   TInt aDim       = myMeshInfo->GetDim();
00656   TInt aNbNodes   = this->GetNbNodes();
00657   aCoord.resize(aDim);
00658   
00659   if(theId >= aNbNodes)
00660     EXCEPTION(std::runtime_error, "TGrilleInfo::GetCoord - theId out of range");
00661 
00662   if(myGrilleType == eGRILLE_STANDARD){
00663     switch(aDim){
00664     case 3:
00665       aCoord[2] = myCoord[aDim*theId+2];
00666     case 2:
00667       aCoord[1] = myCoord[aDim*theId+1];
00668     case 1:{
00669       aCoord[0] = myCoord[aDim*theId];
00670       break;
00671     }
00672     }
00673   } else {
00674 
00675     TFloatVector aVecX  = this->GetIndexes(0);
00676     TInt nbIndxX        = this->GetNbIndexes(0);
00677     
00678     switch(aDim){
00679     case 1:{
00680       aCoord[0] = aVecX[theId];
00681       break;
00682     }
00683     case 2:{
00684       TFloatVector aVecY = this->GetIndexes(1);
00685       TInt i,j,k;
00686       i = j = k = 0;
00687       i = theId % nbIndxX;
00688       j = theId / nbIndxX;
00689       if(myGrilleType == eGRILLE_CARTESIENNE){
00690         aCoord[0] = aVecX[i];
00691         aCoord[1] = aVecY[j];
00692       } else { // eGRILLE_POLAIRE (cylindrical)
00693         aCoord[0] = aVecX[i] * cos(aVecY[j]);
00694         aCoord[1] = aVecX[i] * sin(aVecY[j]);
00695       }
00696       break;
00697     }
00698     case 3:{
00699       TFloatVector aVecY = this->GetIndexes(1);
00700       TInt nbIndxY       = this->GetNbIndexes(1);
00701       TFloatVector aVecZ = this->GetIndexes(2);
00702       TInt i,j,k;
00703       i = j = k = 0;
00704       
00705       i = theId % nbIndxX;
00706       j = (theId / nbIndxX) % nbIndxY;
00707       k = theId / (nbIndxX*nbIndxY);
00708 
00709       if(myGrilleType == eGRILLE_CARTESIENNE){
00710         aCoord[0] = aVecX[i];
00711         aCoord[1] = aVecY[j];
00712         aCoord[2] = aVecZ[k];
00713       } else { // eGRILLE_POLAIRE (cylindrical)
00714         aCoord[0] = aVecX[i] * cos(aVecY[j]);
00715         aCoord[1] = aVecX[i] * sin(aVecY[j]);
00716         aCoord[2] = aVecZ[k];
00717       }
00718       
00719       break;
00720     }
00721     }
00722   }
00723 
00724   return aCoord;
00725 }
00726 
00727 TIntVector
00728 TGrilleInfo
00729 ::GetConn(TInt theId, const bool isSub)
00730 {
00731   TIntVector anIndexes;
00732   TInt aDim = myMeshInfo->GetDim();
00733 
00734   TInt idx;
00735   TInt iMin, jMin, kMin, iMax, jMax, kMax;
00736   TInt loc[3];
00737 
00738   loc[0] = loc[1] = loc[2] = 0;
00739   iMin = iMax = jMin = jMax = kMin = kMax = 0;
00740 
00741   switch(aDim) {
00742   case 3:
00743     {
00744       TInt nbX = this->GetGrilleStructure()[0];
00745       TInt nbY = this->GetGrilleStructure()[1];
00746       TInt nbZ = this->GetGrilleStructure()[2];
00747       TInt d01 = nbX*nbY, dX = 1, dY = 1, dZ = 1;
00748       if ( isSub )
00749       {
00750         if ( theId < nbX * (nbY-1) * (nbZ-1))
00751         { // face is normal to X axis
00752           dX = 0;
00753         }
00754         else if ( theId < nbX * (nbY-1) * (nbZ-1) + (nbX-1) * nbY * (nbZ-1))
00755         {  // face is normal to Y axis
00756           theId -= nbX * (nbY-1) * (nbZ-1);
00757           dY = 0;
00758         }
00759         else
00760         {
00761           theId -= nbX * (nbY-1) * (nbZ-1) + (nbX-1) * nbY * (nbZ-1);
00762           dZ = 0;
00763         }
00764       }
00765       //else
00766       {
00767         iMin = theId % (nbX - dX);
00768         jMin = (theId / (nbX - dX)) % (nbY - dY);
00769         kMin = theId / ((nbX - dX) * (nbY - dY));
00770         iMax = iMin+dX;
00771         jMax = jMin+dY;
00772         kMax = kMin+dZ;
00773       }
00774       for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
00775         for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
00776           for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
00777           {
00778             idx = loc[0] + loc[1]*nbX + loc[2]*d01;
00779             anIndexes.push_back(idx);
00780           }
00781       break;
00782     }
00783   case 2:
00784     {
00785       TInt nbX = this->GetGrilleStructure()[0];
00786       TInt nbY = this->GetGrilleStructure()[1];
00787       TInt dX = 1, dY = 1;
00788       if ( isSub )
00789       {
00790         if ( theId < nbX * (nbY-1))
00791         { // edge is normal to X axis
00792           dX = 0;
00793         }
00794         else
00795         {
00796           theId -= nbX * (nbY-1);
00797           dY = 0;
00798         }
00799       }
00800       iMin = theId % (nbX-dX);
00801       jMin = theId / (nbX-dX);
00802       iMax = iMin+dX;
00803       jMax = jMin+dY;
00804       for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
00805         for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
00806         {
00807           idx = loc[0] + loc[1]*nbX;
00808           anIndexes.push_back(idx);
00809         }
00810       break;
00811     }
00812   case 1:
00813     {
00814       iMin = theId;
00815       for (loc[0]=iMin; loc[0]<=iMin+1; loc[0]++)
00816       {
00817         idx = loc[0];
00818         anIndexes.push_back(idx);
00819       }
00820       break;
00821     }
00822   }
00823 
00824   return anIndexes;
00825 }
00826 
00827 TInt
00828 TGrilleInfo
00829 ::GetFamNumNode(TInt theId) const 
00830 {
00831   return myFamNumNode[theId];
00832 }
00833 
00834 void
00835 TGrilleInfo
00836 ::SetFamNumNode(TInt theId,TInt theVal) 
00837 {
00838   myFamNumNode[theId] = theVal;
00839 }
00840 
00841 TInt
00842 TGrilleInfo
00843 ::GetFamNum(TInt theId) const 
00844 {
00845   return myFamNum[theId];
00846 }
00847 
00848 void
00849 TGrilleInfo
00850 ::SetFamNum(TInt theId,TInt theVal) 
00851 {
00852   myFamNum[theId] = theVal;
00853 }
00854 
00855 TInt
00856 TGrilleInfo
00857 ::GetFamSubNum(TInt theId) const 
00858 {
00859   return myFamSubNum[theId];
00860 }
00861 
00862 void
00863 TGrilleInfo
00864 ::SetFamSubNum(TInt theId,TInt theVal) 
00865 {
00866   myFamSubNum[theId] = theVal;
00867 }