00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "mesh-generic.hh"
00026 #include "g-map-generic.hh"
00027 #include <cassert>
00028 using namespace GMap3d;
00029
00030 #define SUCC(DART) ((((CGMapGeneric*) FMap)->*succ)(DART))
00031
00032 CDart* CMeshGeneric::markTopoSquareIMeshed(int ADim, CDart* ADart,
00033 int ASx, int ASy,
00034 int AMarkNumberX, int AMarkNumberY,
00035 int AReturnedDart)
00036 {
00037 assert(ADim>=0 && ADim<=2);
00038 assert(ADart!=NULL);
00039 assert(ASx>0);
00040 assert(ASy>0);
00041 assert(isTopoSquareIMeshed(ADim, ADart, ASx,ASy));
00042 assert(AMarkNumberX>0);
00043 assert(AMarkNumberY>0);
00044 assert(AReturnedDart>=1 && AReturnedDart<=3);
00045
00046 CDart* returned = NULL;
00047
00048 if (ADim==0)
00049 ASx = ASy = 1;
00050
00051 CDart* (CGMapGeneric::* succ) (CDart*) const =
00052 ADim<2 ? & CGMapGeneric::alpha01 : & CGMapGeneric::alpha0121;
00053
00054 CDart* current = ADart;
00055
00056 for (int round=0; round<2; ++round)
00057 {
00058 FMap->markOrbit(current, ORBIT_23, AMarkNumberX);
00059
00060 for (int i=1; i<ASx; ++i)
00061 current = SUCC(current);
00062
00063 current = FMap->alpha0(current);
00064 FMap->markOrbit(current, ORBIT_23, AMarkNumberX);
00065
00066 if (round==0 && AReturnedDart==1)
00067 returned = current;
00068
00069 if (round==1 && AReturnedDart==2)
00070 returned = current;
00071
00072 current = FMap->alpha1(current);
00073
00074 FMap->markOrbit(current, ORBIT_23, AMarkNumberY);
00075 for (int j=1; j<ASy; ++j)
00076 current = SUCC(current);
00077
00078 current = FMap->alpha0(current);
00079
00080 FMap->markOrbit(current, ORBIT_23, AMarkNumberY);
00081
00082 current = FMap->alpha1(current);
00083
00084 if (round==0 && AReturnedDart==3)
00085 returned = current;
00086 }
00087
00088 return returned;
00089 }
00090
00091 void CMeshGeneric::markTopoCubeIMeshed(int ADim, CDart* ADart,
00092 int ASx, int ASy, int ASz,
00093 int AMarkNumberX,
00094 int AMarkNumberY,
00095 int AMarkNumberZ)
00096 {
00097 assert(ADim>=0 && ADim<=3);
00098 assert(ADart!=NULL);
00099 assert(ASx>0);
00100 assert(ASy>0);
00101 assert(ASz>0);
00102 assert(isTopoCubeIMeshed(ADim, ADart, ASx,ASy,ASz));
00103 assert(AMarkNumberX>0);
00104 assert(AMarkNumberY>0);
00105 assert(AMarkNumberZ>0);
00106
00107 if (ADim==0)
00108 ASx = ASy = ASz = 1;
00109
00110 CDart* current;
00111
00112 current = markTopoSquareIMeshed(ADim, ADart,
00113 ASx,ASy, AMarkNumberX,AMarkNumberY, 3);
00114 markTopoSquareIMeshed(ADim, FMap->alpha12(current),
00115 ASy,ASz, AMarkNumberY,AMarkNumberZ );
00116
00117 current = markTopoSquareIMeshed(ADim, FMap->alpha12(ADart),
00118 ASy,ASz, AMarkNumberY,AMarkNumberZ, 3);
00119 markTopoSquareIMeshed(ADim, FMap->alpha12(current),
00120 ASz,ASx, AMarkNumberZ,AMarkNumberX );
00121
00122 current = markTopoSquareIMeshed(ADim, FMap->alpha1212(ADart),
00123 ASz,ASx, AMarkNumberZ,AMarkNumberX, 3);
00124 markTopoSquareIMeshed(ADim, FMap->alpha12(current),
00125 ASx,ASy, AMarkNumberX,AMarkNumberY );
00126 }
00127
00128 #undef SUCC
00129