3
3
4
4
* File: essBuild/Box.cxx
5
5
*
6
- * Copyright (c) 2004-2021 by Konstantin Batkov
6
+ * Copyright (c) 2004-2022 by Konstantin Batkov
7
7
*
8
8
* This program is free software: you can redistribute it and/or modify
9
9
* it under the terms of the GNU General Public License as published by
@@ -308,9 +308,20 @@ Box::getLayerSurf(const size_t layerIndex,
308
308
\return Surface string
309
309
*/
310
310
{
311
- ELog::RegMethod RegA (" Box" ," getLinkSurf " );
311
+ ELog::RegMethod RegA (" Box" ," getLayerSurf " );
312
312
313
- throw ColErr::AbsObjMethod (" Not implemented yet - do it similar to DiskPreMod?" );
313
+ if (layerIndex>nLayers)
314
+ throw ColErr::IndexError<size_t >(layerIndex,nLayers," layerIndex" );
315
+
316
+ const int uSIndex (std::abs (static_cast <int >(sideIndex)));
317
+ const int signValue ((sideIndex>0 ) ? 1 : -1 );
318
+ const int SI (10 *static_cast <int >(layerIndex)+buildIndex);
319
+
320
+
321
+ if (uSIndex<1 || uSIndex>6 )
322
+ throw ColErr::IndexError<long int >(sideIndex,6 ," sideIndex" );
323
+
324
+ return signValue*SMap.realSurf (SI+uSIndex);
314
325
}
315
326
316
327
@@ -320,7 +331,7 @@ Box::getLayerString(const size_t layerIndex,
320
331
/* !
321
332
Given a side and a layer calculate the layer string
322
333
\param layerIndex :: layer, 0 is inner moderator [0-4]
323
- \param sideIndex :: Side [0-3 ]
334
+ \param sideIndex :: Side [1-6 ]
324
335
\return Surface string
325
336
*/
326
337
{
@@ -331,44 +342,40 @@ Box::getLayerString(const size_t layerIndex,
331
342
332
343
const int SI (10 *static_cast <int >(layerIndex)+buildIndex);
333
344
334
- std::string Out ;
345
+ HeadRule HR ;
335
346
const long int uSIndex (std::abs (sideIndex));
336
347
switch (uSIndex)
337
348
{
338
349
case 1 :
339
- Out =ModelSupport::getComposite (SMap,SI," -1 " );
350
+ HR =ModelSupport::getHeadRule (SMap,SI," -1 " );
340
351
break ;
341
352
case 2 :
342
- Out =ModelSupport::getComposite (SMap,SI," 2 " );
353
+ HR =ModelSupport::getHeadRule (SMap,SI," 2 " );
343
354
break ;
344
355
case 3 :
345
- Out =ModelSupport::getComposite (SMap,SI," -3 " );
356
+ HR =ModelSupport::getHeadRule (SMap,SI," -3 " );
346
357
break ;
347
358
case 4 :
348
- Out =ModelSupport::getComposite (SMap,SI," 4 " );
359
+ HR =ModelSupport::getHeadRule (SMap,SI," 4 " );
349
360
break ;
350
361
case 5 :
351
- Out =ModelSupport::getComposite (SMap,SI," -5 " );
362
+ HR =ModelSupport::getHeadRule (SMap,SI," -5 " );
352
363
break ;
353
364
case 6 :
354
- Out =ModelSupport::getComposite (SMap,SI," 6 " );
365
+ HR =ModelSupport::getHeadRule (SMap,SI," 6 " );
355
366
break ;
356
367
default :
357
368
throw ColErr::IndexError<long int >(sideIndex,6 ," sideIndex" );
358
369
}
359
370
if (sideIndex<0 )
360
- {
361
- HeadRule HR (Out);
362
- HR.makeComplement ();
363
- return HR.display ();
364
- }
371
+ HR.makeComplement ();
365
372
366
- return Out ;
373
+ return HR. display () ;
367
374
}
368
375
369
376
Geometry::Vec3D
370
377
Box::getSurfacePoint (const size_t layerIndex,
371
- const long int sideIndex) const
378
+ const long int sideIndex) const
372
379
/* !
373
380
Given a side and a layer calculate the surface point
374
381
\param layerIndex :: layer, 0 is inner moderator
0 commit comments