Skip to content

Commit

Permalink
Make gzip I/O & Sobol RNG dependencies optional
Browse files Browse the repository at this point in the history
In order to take advantage of the gzip I/O functionality for egs_glib
and egs_autoenvelope, and the Sobol RNG functionality for
egs_autoenvelope, users will be required to install the
egspp-geometry-lib-extras from
https://github.com/clrp-code/egspp-geometry-lib-extras/ .
  • Loading branch information
randlet committed Jun 30, 2016
1 parent fafc8da commit 4900ebc
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 29,583 deletions.
25 changes: 22 additions & 3 deletions HEN_HOUSE/egs++/geometry/egs_autoenvelope/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,29 @@ include $(EGS_CONFIG)
include $(SPEC_DIR)egspp.spec
include $(SPEC_DIR)egspp_$(my_machine).conf

DEFS = $(DEF1) -DBUILD_AENVELOPE_DLL -DBUILD_SOBOL_DLL -DBUILD_AE_SOBOL
SOBOL =
SOBOL_DEF =
SOBOL_H =
ifneq ("$(wildcard egs_sobol.cpp)","")
SOBOL = sobol egs_sobol
SOBOL_DEF = -DBUILD_SOBOL_DLL -DBUILD_AE_SOBOL -DHAS_SOBOL
SOBOL_H = sobol.h egs_sobol.h
endif

GZSTREAM =
GZSTREAM_DEF =
GZSTREAM_H =
ifneq ("$(wildcard gzstream.cpp)","")
GZSTREAM = gzstream
GZSTREAM_DEF = -DBUILD_GZSTREAM -DHAS_GZSTREAM
GZSTREAM_H = gzstream.h
endif

DEFS = $(DEF1) -DBUILD_AENVELOPE_DLL $(SOBOL_DEF) $(GZSTREAM_DEF)


library = egs_autoenvelope
lib_files = egs_autoenvelope sobol egs_sobol gzstream
lib_files = egs_autoenvelope $(SOBOL) $(GZSTREAM)

link2_libs = egs_gtransformed egspp

Expand All @@ -21,7 +40,7 @@ include $(SPEC_DIR)egspp_libs.spec
$(make_depend)


$(DSO2)autoenvelope.$(obje): volcor.h gzstream.h \
$(DSO2)autoenvelope.$(obje): volcor.h $(GZSTREAM_H) $(SOBOL_H)\
..$(DSEP)egs_gtransformed$(DSEP)egs_gtransformed.h

$(ABS_DSO)$(libpre)egs_autoenvelope$(libext): volcor.h gzstream.h \
Expand Down
19 changes: 17 additions & 2 deletions HEN_HOUSE/egs++/geometry/egs_autoenvelope/egs_autoenvelope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@
#include <iostream>
#include <fstream>

#include "sobol.h"
#ifdef HAS_SOBOL
#include "sobol.h"
#endif


string EGS_AENVELOPE_LOCAL EGS_AEnvelope::type = "EGS_AEnvelope";
string EGS_AENVELOPE_LOCAL EGS_ASwitchedEnvelope::type = "EGS_ASwitchedEnvelope";


static char EGS_AENVELOPE_LOCAL geom_class_msg[] = "createGeometry(AEnvelope): %s\n";
static char EGS_AENVELOPE_LOCAL base_geom_keyword[] = "base geometry";
static char EGS_AENVELOPE_LOCAL inscribed_geom_keyword[] = "inscribed geometry";
Expand All @@ -63,7 +66,6 @@ EGS_AEnvelope::EGS_AEnvelope(EGS_BaseGeometry *base_geom,
const vector<AEnvelopeAux> inscribed, const string &Name, bool debug, string output_vc_file) :
EGS_BaseGeometry(Name), base_geom(base_geom), debug_info(debug), output_vc(output_vc_file) {


base_geom->ref();
nregbase = base_geom->regions();
is_convex = base_geom->isConvex();
Expand Down Expand Up @@ -688,9 +690,11 @@ void EGS_AEnvelope::writeVolumeCorrection() {
gname.c_str(), output_vc.c_str(), fname.c_str());

if (output_vc == "gzip") {
#ifdef HAS_GZSTREAM
ogzstream outgz(fname.c_str());
writeVCToFile(outgz);
outgz.close();
#endif
}
else {
ofstream out(fname.c_str());
Expand Down Expand Up @@ -920,6 +924,17 @@ extern "C" {
output_vc_file_choice = input->getInput("output volume correction file", vc_file_choices, 0);
string output_vc_file = vc_file_choices[output_vc_file_choice];

#ifndef HAS_GZSTREAM
if (output_vc_file == "gzip") {
egsWarning(
"GZip file output requested but not compiled with gzstream.\n"
"Please recompile with gzstream support.\n"
);
return 0;
}
#endif



string base_geom_name;
int err = input->getInput(base_geom_keyword, base_geom_name);
Expand Down
19 changes: 15 additions & 4 deletions HEN_HOUSE/egs++/geometry/egs_autoenvelope/egs_autoenvelope.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ Volume correction files
By including the `output volume correction file = text # text or gzip`
input key, you can output a volume correction file that will output a file
which includes all of the regions that were found to contain inscribed
geometries and their corrected volumes.
geometries and their corrected volumes. (For the gzip functionality you
must have the egspp-geometry-lib-extras installed: see Optional Features
below).
The volume correction file can then be used in future runs by using a
volume correction block like the following for the inscribed geometry:
Expand Down Expand Up @@ -287,9 +289,10 @@ regions containing inscribed geometries will be discovered. This would
generally happen if your bounding shape is too small to cover the entire
insribed geometry or you choose a density of points that is too low.
By default a Sobol quasi-random number generator is used for volume
correction/region discovery but that can be overridden by including an `rng
definition` block (see example input above)
By default a Sobol quasi-random number generator (if available, see
`Optional Features` below) is used for volume correction/region
discovery but that can be overridden by including an `rng definition`
block (see example input above)
EGS_ASwitchedEnvelope
Expand All @@ -313,6 +316,14 @@ Examples
An example geometry file using an autoenvelope is provided in
seeds_in_xyz_aenv.geom.
Optional Features
-----------------
In order to use the gzip and Sobol functionality you must have the egspp-geometry-lib-extras
installed. Due to NRC licensing requirements this code is distributed separately and
can be obtained from https://github.com/clrp-code/egspp-geometry-lib-extras/ .
*/

using std::vector;
Expand Down
135 changes: 0 additions & 135 deletions HEN_HOUSE/egs++/geometry/egs_autoenvelope/egs_sobol.cpp

This file was deleted.

Loading

0 comments on commit 4900ebc

Please sign in to comment.