SAnsell / CombLayer

MCNP(X) project builder using C++
GNU General Public License v3.0
14 stars 13 forks source link

Removal of NON-signed LinkPoint access in FixedComp #72

Open SAnsell opened 7 years ago

SAnsell commented 7 years ago

The link points can be accessed from a FixedComp in many ways and this leads to inconsistencies.

The points can be accessed via

getSignedLinkPt( long int) ; 
getLinkPt(size_t) 

Axis via

getSignedLinkAxis( long int) ; 
getLinkAxs(size_t) 

and strings via

virtual std::string getSignedLinkString(const long int) const;

  std::string getLinkString(const size_t) const;
  std::string getLinkComplement(const size_t) const;
  std::string getBridgeComplement(const size_t) const;

  std::string getCommonString(const size_t) const;
  std::string getCommonComplement(const size_t) const;

  std::string getMasterString(const size_t) const;
  std::string getMasterComplement(const size_t) const;getLinkString(size_t )

ALL of the NON-Signed calls (taking size_t) are either going to be private OR deleted as soon as possible. Obviously if you are using the signed version you use the convention that sideIndex value of zero is the FixedComp origin, and 1 is the first link point, 2 the second etc , and -1 is the complement of the first link point (axis reversed). etc.

If you were using the old system, size_t sideIndex value of 0, was the first link point, 1, the second etc... This is now depreciated. Obviously as I do this process there is the possibility that errors creep in, please check your models and report or push a patch for any errors please.

I have carried out the first stage of this process removing

 std::string getLinkString(const size_t) const;
  std::string getLinkComplement(const size_t) const;
  std::string getBridgeComplement(const size_t) const;

  std::string getCommonString(const size_t) const;
  std::string getCommonComplement(const size_t) const;

  std::string getMasterString(const size_t) const;
  std::string getMasterComplement(const size_t) const;

If there are any issues please

kbat commented 7 years ago

What am I supposed to do instead of removed getSignedLinkComplement()?

kbat commented 7 years ago

and instead of getBridgeComplement?

SAnsell commented 7 years ago

Ok in principle that should be easy -- but if you have a difficult example please post it!

std::string getLinkString(const size_t)  const;
std::string getLinkComplement(const size_t)   const;

are both accessed via:

std::string getSignedLinkString(const long int index) const;

e.g.

std::string NormalRule=FC.getSignedLinkString(5); 
   std::string NormalRule=FC.getLinkString(4);
   std::string ComplementRule=FC.getSignedLinkString(-5);
   std::string ComplementRule=FC.getLinkComplement(4);

Note the +1 that needs to be added to the signed rule.

Next we have getBridgeComplement:

Actually we also had

getSignedCommonRule(long int)which is the same as getBridgeRule(size_t) adn getBridgeComplement(size_t)in the same way. BUT due to the rarity of use I removed the std::string version and left just the HeadRule version (which can obviously be moved to a string version with getSignedCommonRule(5).display()

Note: that for performance issues we are keeping getLinkString(const size_t) const and getLinkComplement(const size_t)const as private members of FixedComp, but current testMain run shows that replacing them in FixedComp is worth about 30% performance.

Anyone (a) unclear (b) has an edge case that this doesn't work well, (c) thinks I have made a design error -- Please add a comment -- many thanks