|
1 | 1 | /***************************************************************************** |
2 | 2 | * |
3 | | -* This file is part of NCrystal (see https://mctools.github.io/ncrystal/) |
4 | | -* |
5 | | -* Copyright 2015-2022 NCrystal developers |
| 3 | +* This file used to be part of NCrystal (https://mctools.github.io/ncrystal/), |
| 4 | +* but since McStas 3.2 (2022) this component is maintained as part of McStas. |
6 | 5 | * |
7 | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | 7 | * you may not use this file except in compliance with the License. |
|
21 | 20 | * |
22 | 21 | * %I |
23 | 22 | * Written by: NCrystal developers |
| 23 | +* Date: 2017 |
24 | 24 | * Version: 1.0.0 |
25 | 25 | * Origin: NCrystal Developers (European Spallation Source ERIC and DTU Nutech) |
26 | 26 | * |
27 | 27 | * McStas sample component for the NCrystal library for thermal neutron transport |
28 | 28 | * (<a href="https://github.com/mctools/ncrystal">www</a>). |
29 | 29 | * |
30 | 30 | * %D |
31 | | -* McStas sample component for the NCrystal scattering library. |
32 | | -* Find more information at <a href="https://github.com/mctools/ncrystal/wiki">the NCrystal wiki</a>. |
33 | | -* In particular, browse the available datafiles at <a href="https://github.com/mctools/ncrystal/wiki/Data-library">Data-library</a> |
34 | | -* and read about the format of the configuration string expected in |
35 | | -* the "cfg" parameter at <a href="https://github.com/mctools/ncrystal/wiki/Using-NCrystal">Using-NCrystal</a>. |
| 31 | +* McStas sample component using the NCrystal library for thermal neutron |
| 32 | +* transport in a single bulk material filling a single simple convex volume |
| 33 | +* (box, sphere or cylinder). |
| 34 | +* |
| 35 | +* The geometrical layout of the volume is determined via the xwidth, yheight, |
| 36 | +* zdepth, and radius parameters, and the material being modelled is determined |
| 37 | +* via an NCrystal configuration string ("cfg-string"). |
36 | 38 | * |
37 | | -* <p/>NCrystal is available under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 license</a>. |
38 | | -* Depending on the configuration choices, optional NCrystal |
39 | | -* modules under different licenses might be enabled, |
40 | | -* see <a href="https://github.com/mctools/ncrystal/blob/master/NOTICE">here</a> for more details. |
| 39 | +* For more information about NCrystal and cfg-strings, refer to the <a href="https://github.com/mctools/ncrystal/wiki">NCrystal wiki</a>. |
| 40 | +* In particular, browse the available datafiles at <a href="https://github.com/mctools/ncrystal/wiki/Data-library">Data-library</a> and read about the |
| 41 | +* format of the cfg-string expected in the "cfg" parameter at <a href="https://github.com/mctools/ncrystal/wiki/Using-NCrystal">Using-NCrystal</a>. |
41 | 42 | * |
42 | | -* Note also that for more complicated geometries, it might be desirable to use |
43 | | -* NCrystal via the McStas Union components instead. |
| 43 | +* For more complicated geometries, it might be desirable to use NCrystal via the |
| 44 | +* McStas Union components instead. |
44 | 45 | * |
45 | | -* <p/>This NCrystal_sample component used to be shipped with NCrystal itself, |
46 | | -* but starting with McStas 3.2 it is shipped along with McStas itself |
47 | | -* (accordingly the components version number is reset to 1.0.0 to avoid |
48 | | -* confusion). As engine it will use whichever NCrystal installation is |
49 | | -* available and associated with the "ncrystal-config" command. |
| 46 | +* Note that the physics backend of this component will be whichever NCrystal |
| 47 | +* installation is available and associated with the "ncrystal-config" command. |
50 | 48 | * |
51 | 49 | * %P |
52 | 50 | * Input parameters: |
|
65 | 63 | *******************************************************************************/ |
66 | 64 |
|
67 | 65 | DEFINE COMPONENT NCrystal_sample |
68 | | -SETTING PARAMETERS (string cfg="void", absorptionmode=1, multscat=1, xwidth=0, yheight=0, zdepth=0, radius=0 ) |
| 66 | +SETTING PARAMETERS (string cfg="void", xwidth=0, yheight=0, zdepth=0, radius=0, absorptionmode=1, multscat=1 ) |
69 | 67 | DEPENDENCY "@NCRYSTALFLAGS@" |
70 | 68 | NOACC /* Notice: you must remove this line if using the legacy McStas 2.x branch. */ |
71 | 69 |
|
@@ -370,24 +368,18 @@ FINALLY |
370 | 368 |
|
371 | 369 | MCDISPLAY |
372 | 370 | %{ |
373 | | - //NB: Future McStas (2.5?) is slated to introduce mcdis_cylinder and |
374 | | - //mcdis_sphere functions, which we at that point should likely use. |
375 | 371 | switch (geoparams.shape) { |
376 | 372 | case NC_CYLINDER: |
377 | | - mcdis_circle("xz", 0, geoparams.dy/2.0, 0, geoparams.rradius); |
378 | | - mcdis_circle("xz", 0, -geoparams.dy/2.0, 0, geoparams.rradius); |
379 | | - mcdis_line(-geoparams.rradius, -geoparams.dy/2.0, 0, -geoparams.rradius, +geoparams.dy/2.0, 0); |
380 | | - mcdis_line(+geoparams.rradius, -geoparams.dy/2.0, 0, +geoparams.rradius, +geoparams.dy/2.0, 0); |
381 | | - mcdis_line(0, -geoparams.dy/2.0, -geoparams.rradius, 0, +geoparams.dy/2.0, -geoparams.rradius); |
382 | | - mcdis_line(0, -geoparams.dy/2.0, +geoparams.rradius, 0, +geoparams.dy/2.0, +geoparams.rradius); |
| 373 | + mcdis_cylinder( 0., 0., 0., |
| 374 | + geoparams.rradius, |
| 375 | + geoparams.dy, |
| 376 | + 0 , 0.0 , 1.0 , 0.0); |
383 | 377 | break; |
384 | 378 | case NC_BOX: |
385 | 379 | mcdis_box(0., 0., 0., geoparams.dx, geoparams.dy, geoparams.dz,0, 0, 1, 0); |
386 | 380 | break; |
387 | 381 | case NC_SPHERE: |
388 | | - mcdis_circle("xy", 0., 0., 0., geoparams.rradius); |
389 | | - mcdis_circle("xz", 0., 0., 0., geoparams.rradius); |
390 | | - mcdis_circle("yz", 0., 0., 0., geoparams.rradius); |
| 382 | + mcdis_sphere(0.0,0.0,0.0,geoparams.rradius); |
391 | 383 | break; |
392 | 384 | }; |
393 | 385 | %} |
|
0 commit comments