Skip to content

Commit

Permalink
Fix visualisation of box-shaped sample in McStas component
Browse files Browse the repository at this point in the history
  • Loading branch information
tkittel committed Feb 7, 2018
1 parent 6dd1504 commit abecb85
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.9.6 2018-02-07
* Fix visualisation of box-shaped sample in McStas component.
* Rename McStas component parameter multscatt to multscat.

v0.9.5 2018-02-05
* Add support for python3 (github issue #6).

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.5
0.9.6
1 change: 1 addition & 0 deletions ncrystal_core/include/NCrystal/NCScatterComp.hh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace NCrystal {
size_t nComponents() const { return m_calcs.size(); }
const Scatter * component(size_t i) const { return m_calcs.at(i).scatter; }
Scatter * component(size_t i) { return m_calcs.at(i).scatter; }
double scale(size_t i) const { return m_calcs.at(i).scale; }

virtual double crossSection(double ekin, const double (&neutron_direction)[3] ) const;

Expand Down
6 changes: 3 additions & 3 deletions ncrystal_core/include/NCrystal/NCVersion.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

#define NCRYSTAL_VERSION_MAJOR 0
#define NCRYSTAL_VERSION_MINOR 9
#define NCRYSTAL_VERSION_PATCH 5
#define NCRYSTAL_VERSION 9005 /* (1000000*MAJOR+1000*MINOR+PATCH) */
#define NCRYSTAL_VERSION_STR "0.9.5"
#define NCRYSTAL_VERSION_PATCH 6
#define NCRYSTAL_VERSION 9006 /* (1000000*MAJOR+1000*MINOR+PATCH) */
#define NCRYSTAL_VERSION_STR "0.9.6"

#endif
6 changes: 3 additions & 3 deletions ncrystal_core/include/NCrystal/ncrystal.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ extern "C" {
/* NCrystal version info: */
#define NCRYSTAL_VERSION_MAJOR 0
#define NCRYSTAL_VERSION_MINOR 9
#define NCRYSTAL_VERSION_PATCH 5
#define NCRYSTAL_VERSION 9005 /* (1000000*MAJOR+1000*MINOR+PATCH) */
#define NCRYSTAL_VERSION_STR "0.9.5"
#define NCRYSTAL_VERSION_PATCH 6
#define NCRYSTAL_VERSION 9006 /* (1000000*MAJOR+1000*MINOR+PATCH) */
#define NCRYSTAL_VERSION_STR "0.9.6"
int ncrystal_version(); /* returns NCRYSTAL_VERSION */
const char * ncrystal_version_str(); /* returns NCRYSTAL_VERSION_STR */

Expand Down
6 changes: 3 additions & 3 deletions ncrystal_core/src/NCScatterComp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ bool NCrystal::ScatterComp::Component::operator<(const NCrystal::ScatterComp::Co
return o.threshold_lower > threshold_lower;
}

void NCrystal::ScatterComp::addComponent(Scatter* scat, double frac )
void NCrystal::ScatterComp::addComponent(Scatter* scat, double thescale )
{
if (!scat)
NCRYSTAL_THROW(BadInput,"ScatterComp::addComponent Got NULL scatter.");
if (frac<0.0)
if (thescale<0.0)
NCRYSTAL_THROW(BadInput,"ScatterComp::addComponent Component scale is negative.");
std::vector<Component>::const_iterator it(m_calcs.begin()), itE(m_calcs.end());
for (;it!=itE;++it) {
Expand All @@ -55,7 +55,7 @@ void NCrystal::ScatterComp::addComponent(Scatter* scat, double frac )
m_calcs.reserve(m_calcs.size()+1);
scat->validate();
Component c;
c.scale = frac;
c.scale = thescale;
c.scatter = scat;
scat->domain(c.threshold_lower,c.threshold_upper);
if (m_calcs.empty() || c.threshold_lower < m_threshold_lower)
Expand Down
15 changes: 7 additions & 8 deletions ncrystal_mcstas/NCrystal_sample.comp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* %I
*
* Written by: NCrystal developers
* Version: 0.9.5
* Version: 0.9.6
* Origin: NCrystal Developers (European Spallation Source ERIC and DTU Nutech)
*
* McStas sample component for the NCrystal scattering library. Find more
Expand All @@ -49,7 +49,7 @@
* Input parameters:
* cfg: [str] NCrystal material configuration string (details <a href="https://github.com/mctools/ncrystal/wiki/Using-NCrystal">on this page</a>).
* absorptionmode: [0|1|2] 0 : disable absorption. 1 : enable absorption via intensity reduction. 2 : enable absorption by terminating the tracking.
* multscatt: [0|1] 0 : disable multiple scattering. 1 : enable multiple scattering
* multscat: [0|1] 0 : disable multiple scattering. 1 : enable multiple scattering
* xwidth: [m] x-dimension (width) of sample, if box shape is desired
* yheight: [m] y-dimension (height) of sample, if box or cylinder shape is desired
* zdepth: [m] z-dimension (depth) of sample, if box shape is desired
Expand All @@ -61,7 +61,7 @@
*******************************************************************************/

DEFINE COMPONENT NCrystal_sample
SETTING PARAMETERS (string cfg = "" , absorptionmode = 1, multscatt=1, xwidth=0, yheight=0, zdepth=0, radius = 0 )
SETTING PARAMETERS (string cfg = "" , absorptionmode = 1, multscat=1, xwidth=0, yheight=0, zdepth=0, radius = 0 )
OUTPUT PARAMETERS (params, geoparams)/*not really intended for output, but here for multi-instance support*/
DEPENDENCY "-Wl,-rpath,NCrystalLink/lib -LNCrystalLink/lib -lNCrystal -INCrystalLink/include"

Expand Down Expand Up @@ -285,7 +285,7 @@ TRACE

SCATTER;/* update mcstas scatter counter and potentially enable trajectory visualisation */

if(!multscatt)
if(!multscat)
break;

//must update x-sects if energy changed or processes are oriented:
Expand All @@ -311,7 +311,8 @@ FINALLY

MCDISPLAY
%{
mcdis_magnify("xyz");
//NB: Future McStas (2.5?) is slated to introduce mcdis_cylinder and
//mcdis_sphere functions, which we at that point should likely use.
switch (geoparams.shape) {
case NC_CYLINDER:
mcdis_circle("xz", 0, geoparams.dy/2.0, 0, geoparams.radius);
Expand All @@ -322,9 +323,7 @@ MCDISPLAY
mcdis_line(0, -geoparams.dy/2.0, +geoparams.radius, 0, +geoparams.dy/2.0, +geoparams.radius);
break;
case NC_BOX:
mcdis_rectangle("xy", 0., 0., 0., geoparams.dx, geoparams.dy);
mcdis_rectangle("xz", 0., 0., 0., geoparams.dx, geoparams.dz);
mcdis_rectangle("yz", 0., 0., 0., geoparams.dy, geoparams.dz);
mcdis_box(0., 0., 0., geoparams.dx, geoparams.dy, geoparams.dz);
break;
case NC_SPHERE:
mcdis_circle("xy", 0., 0., 0., geoparams.radius);
Expand Down
2 changes: 1 addition & 1 deletion ncrystal_python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

__license__ = "Apache 2.0, http://www.apache.org/licenses/LICENSE-2.0"
__copyright__ = "Copyright 2017"
__version__ = '0.9.5'
__version__ = '0.9.6'
__status__ = "Production"
__author__ = "NCrystal developers (Thomas Kittelmann, Xiao Xiao Cai)"
__copyright__ = "Copyright 2015-2017 %s"%__author__
Expand Down

0 comments on commit abecb85

Please sign in to comment.