NLLIGO::CTransition Class Reference

#include <transition.h>


Detailed Description

A transition template

Author:
Cyril 'Hulud' Corvazier

Nevrax France

Date:
2001

Definition at line 50 of file transition.h.

Public Types

enum  { ZoneEdgeCount = 4, TransitionZoneCount = 9 }
 Some define. More...


Public Member Functions

bool build (const CMaterial &mat0, const CMaterial &mat1, const std::vector< const CZoneTemplate * > &arrayTemplate, const CLigoConfig &config, CLigoError *errors, CLigoError &mainErrors)
bool check (const CZoneTemplate &zoneTemplate, uint transitionNumber, const CLigoConfig &config, CLigoError &errors) const
void serial (NLMISC::IStream &s)
 Serial.


Private Attributes

CZoneEdge _EdgeZone [ZoneEdgeCount]

Static Private Attributes

sint32 TransitionZoneEdges [TransitionZoneCount][4]
 Some static arries.

sint32 TransitionZoneOffset [TransitionZoneCount][2]


Member Enumeration Documentation

anonymous enum
 

Some define.

Enumeration values:
ZoneEdgeCount 
TransitionZoneCount 

Definition at line 55 of file transition.h.

00056         {
00057                 ZoneEdgeCount = 4,
00058                 TransitionZoneCount = 9,
00059         };


Member Function Documentation

bool NLLIGO::CTransition::build const CMaterial mat0,
const CMaterial mat1,
const std::vector< const CZoneTemplate * > &  arrayTemplate,
const CLigoConfig config,
CLigoError errors,
CLigoError mainErrors
 

Build method

We need 9 zone templates to create a transition set

0

1*0000* 1*0000* 1*0000* 1*0000* 1****** 111111*

1

0*1111* 0*1111* 0*1111* 0*1111* 1111* 111111*

2

0*1111* 0*1111* 0*1111* 0*1111* 0*1111*

3

111111* 111111* 111111* 111111* 1111* 0*1111*

4

0000*1* 0000*1* 0000*1* 0000*1* 0000*** 000000*

5

000000* 000000* 000000* 000000* 0000*** 0000*1*

6

000000* 000000* 000000* 000000*

111111*

7

000000* 0000*** 000*11* 00*111* 1111* 111111*

8

000000* 0* 1111*0* 1111*0* 1111*0* 1111*0*

The nine zones must be assembled like this:

Oy

^ | +-+-+-+-+ |5|6|7|8| +-+-+-+-+ |4|3| | | +-+-+-+-+ | |2| | | +-+-+-+-+ |0|1| | | -----------> Ox

Parameters:
tplt0 is the material lingo config file
config is the current lingo config file
arrayTemplate is an array of ligo zone template pointer of size 9. If a pointer is NULL, checks will be done on non NULL pointer but build will not be done.
arrayZone is an array of nel zone pointer of size 9. If a pointer is NULL, checks will be done but build will not be done.
config is the current lingo config file
errors is an array of error structure of size 9. One error structure by zone.
Returns:
true if check success false if problem detected. Build is done if all the 18 pointers are not NULL.

Definition at line 68 of file transition.cpp.

References _EdgeZone, NLLIGO::CMaterial::getEdge(), NLLIGO::CZoneEdge::invert(), NLLIGO::CZoneEdge::isTheSame(), NLLIGO::CLigoError::MainError, sint32, TransitionZoneCount, TransitionZoneEdges, uint, and ZoneEdgeCount.

00070 {
00071         // Check size
00072         if ((arrayTemplate.size() != TransitionZoneCount))
00073         {
00074                 // Error message
00075                 mainErrors.MainError = CLigoError::UnknownError;
00076                 return false;
00077         }
00078 
00079         // Ok ?
00080         bool ok=true;
00081 
00082         // Check zone template edge count
00083         uint i;
00084         for (i=0; i<TransitionZoneCount; i++)
00085         {
00086                 // Must have 4 edges
00087                 if (arrayTemplate[i]&&(arrayTemplate[i]->getEdges ().size()!=4))
00088                 {
00089                         // Error code
00090                         mainErrors.MainError = CLigoError::MustHave4Edges;
00091                         errors[i].MainError = CLigoError::MustHave4Edges;
00092                 }
00093         }
00094 
00095         // continue ?
00096         if (ok)
00097         {
00098                 // Get first edge
00099                 _EdgeZone[0]=mat0.getEdge ();
00100 
00101                 // Get second edge
00102                 _EdgeZone[1]=mat1.getEdge ();
00103 
00104                 // For the two others edges
00105                 for (sint32 k=2; k<(sint32)ZoneEdgeCount; k++)
00106                 {
00107                         // Get the first third edge found
00108                         for (i=0; i<TransitionZoneCount; i++)
00109                         {
00110                                 // This template exist ?
00111                                 if (arrayTemplate[i])
00112                                 {
00113                                         uint j;
00114                                         for (j=0; j<4; j++)
00115                                         {
00116                                                 // Get edge
00117                                                 sint32 edge = TransitionZoneEdges[i][j];
00118 
00119                                                 // The good edge ?
00120                                                 if (((edge==k+1)||(edge==-(k+1))))
00121                                                 {
00122                                                         // Back the ege
00123                                                         _EdgeZone[k]=arrayTemplate[i]->getEdges ()[j];
00124 
00125                                                         // Invert it if negative
00126                                                         if (edge<0)
00127                                                         {
00128                                                                 // Invert
00129                                                                 _EdgeZone[k].invert (config);
00130                                                         }
00131 
00132                                                         // Break
00133                                                         break;
00134                                                 }
00135                                         }
00136                                         if (j<4)
00137                                                 break;
00138                                 }
00139                         }
00140                 }
00141 
00142                 // Get the inverted edges
00143                 CZoneEdge invertedEdges[4];
00144                 for (i=0; i<4; i++)
00145                 {
00146                         // Copy the edge
00147                         invertedEdges[i]=_EdgeZone[i];
00148 
00149                         // Invert it
00150                         invertedEdges[i].invert(config);
00151                 }
00152 
00153                 // false if can't build because some template are missing
00154                 bool build=true;
00155 
00156                 // Now check each zones against the edges
00157                 for (i=0; i<TransitionZoneCount; i++)
00158                 {
00159                         // Template present ?
00160                         if (arrayTemplate[i])
00161                         {
00162                                 // For each edge
00163                                 for (uint j=0; j<4; j++)
00164                                 {
00165                                         // Get the edge number
00166                                         sint32 edge=TransitionZoneEdges[i][j];
00167 
00168                                         // Compare the edge
00169                                         if (edge<0)
00170                                         {
00171                                                 // The same edge ?
00172                                                 if (!invertedEdges[-edge-1].isTheSame (arrayTemplate[i]->getEdges()[j], config, errors[i]))
00173                                                 {
00174                                                         ok=false;
00175                                                 }
00176                                         }
00177                                         else
00178                                         {
00179                                                 // The same edge ?
00180                                                 if (!_EdgeZone[edge-1].isTheSame (arrayTemplate[i]->getEdges()[j], config, errors[i]))
00181                                                 {
00182                                                         ok=false;
00183                                                 }
00184                                         }
00185                                 }
00186                         }
00187                         else
00188                                 // Can't build
00189                                 build=false;
00190                 }
00191 
00192                 // Ok to build ?
00193                 if (ok && build)
00194                 {
00195                 }
00196         }
00197 
00198         // Return error code
00199         return ok;
00200 }

bool NLLIGO::CTransition::check const CZoneTemplate zoneTemplate,
uint  transitionNumber,
const CLigoConfig config,
CLigoError errors
const
 

Check if a transition zone template match with this transition template.

Parameters:
zoneTemplate is a zone template.
transition number is the number of the transition to test (0 ~ 8)
config is the current lingo config file
errors is an error handler filled with error code and message if the method return false.
Returns:
true if check success false if problem detected. Errors are reported in the the error[0].

Definition at line 228 of file transition.cpp.

References _EdgeZone, NLLIGO::CZoneTemplate::getEdges(), NLLIGO::CZoneEdge::invert(), NLLIGO::CZoneEdge::isTheSame(), sint32, TransitionZoneEdges, and uint.

00229 {
00230         // Return value
00231         bool ok = true;
00232 
00233         // For each edge
00234         for (uint j=0; j<4; j++)
00235         {
00236                 // Get the edge number
00237                 sint32 edge=TransitionZoneEdges[transitionNumber][j];
00238 
00239                 // Compare the edge
00240                 if (edge<0)
00241                 {
00242                         // Invert the edge
00243                         CZoneEdge invertedEdges = _EdgeZone[-edge-1];
00244                         invertedEdges.invert(config);
00245 
00246                         // The same edge ?
00247                         if (!invertedEdges.isTheSame (zoneTemplate.getEdges()[j], config, errors))
00248                         {
00249                                 ok=false;
00250                         }
00251                 }
00252                 else
00253                 {
00254                         // The same edge ?
00255                         if (!_EdgeZone[edge-1].isTheSame (zoneTemplate.getEdges()[j], config, errors))
00256                         {
00257                                 ok=false;
00258                         }
00259                 }
00260         }
00261 
00262         // Return status
00263         return ok;
00264 }

void NLLIGO::CTransition::serial NLMISC::IStream s  ) 
 

Serial.

Definition at line 204 of file transition.cpp.

References _EdgeZone, s, uint, uint32, and ZoneEdgeCount.

00205 {
00206         // Serial the main node
00207         s.xmlPush ("LIGO_TRANSITION");
00208 
00209                 // Serial the header
00210                 s.serialCheck ((uint32)'STGL');
00211 
00212                 // Serial the version
00213                 /*sint ver =*/ s.serialVersion (0);
00214 
00215                 // Serial the edgezones
00216                 uint i;
00217                 s.xmlPush ("EDGE_ZONES");
00218                         for (i=0; i<ZoneEdgeCount; i++)
00219                                 s.xmlSerial (_EdgeZone[i], "ELM");
00220                 s.xmlPop ();
00221 
00222         // Close the main node
00223         s.xmlPop ();
00224 }


Field Documentation

CZoneEdge NLLIGO::CTransition::_EdgeZone[ZoneEdgeCount] [private]
 

The 4 Edges that define the transitions set

the 4 transitions are: 0 : *000000* 1 : *111111* 2 : *0*1111* 3 : *0000*1*

Definition at line 209 of file transition.h.

Referenced by build(), check(), and serial().

sint32 NLLIGO::CTransition::TransitionZoneEdges [static, private]
 

Initial value:

{
        {+2, +2, -4, +4},       
        {+4, +2, +2, -3},       
        {+1, +3, +2, -3},       
        {-3, +3, +2, +2},       
        {+1, +1, +3, -4},       
        {+1, +4, -4, +1},       
        {+4, +2, -4, +1},       
        {+4, +2, -3, +1},       
        {+3, -3, +1, +1},       
}
Some static arries.

Definition at line 38 of file transition.cpp.

Referenced by build(), and check().

sint32 NLLIGO::CTransition::TransitionZoneOffset [static, private]
 

Initial value:

{
        {0, 1},         
        {1, 1},         
        {1, 2},         
        {1, 3},         
        {0, 3},         
        {0, 4},         
        {1, 4},         
        {2, 4},         
        {3, 4},         
}

Definition at line 53 of file transition.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 12:51:02 2004 for NeL by doxygen 1.3.6