Skip to content

Commit

Permalink
Integrate Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
janmayer committed Feb 28, 2020
1 parent 6882cbc commit fa547e9
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 8 deletions.
45 changes: 45 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
language: cpp
os: linux
dist: bionic
sudo: required

addons:
apt:
sources:
- sourceline: "ppa:ubuntu-toolchain-r/test"
update: true
packages:
- libxerces-c3.2
- libxerces-c-dev
- expat
- libexpat1-dev
- assimp-utils
- libassimp-dev
- libassimp-doc
- libassimp4
- libtet1.5
- libtet1.5-dev
- tetgen
- gcc-9
- g++-9
#- geant4

before_install:
- CC=gcc-9 && CXX=g++-9

install:
- cd ${TRAVIS_BUILD_DIR}/..
- wget https://www.ikp.uni-koeln.de/~jmayer/github/geant4_10.5.1_amd64.deb
- sudo dpkg -i geant4_10.5.1_amd64.deb
- source /usr/bin/geant4.sh
- git clone -b v1.1 https://github.com/christopherpoole/CADMesh.git ${TRAVIS_BUILD_DIR}/../CADMesh-src
- cd ${TRAVIS_BUILD_DIR}/../CADMesh-src
- mkdir build && cd build
- cmake .. -DWITH_SYS_ASSIMP=ON -DWITH_SYS_TETGEN=ON
- make -j8
- sudo make install
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/

script:
- cd $TRAVIS_BUILD_DIR
- ./G4Batch.sh
7 changes: 5 additions & 2 deletions G4Batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ cd ..


## Set CAD Directory
export G4HORUS_CAD_DIR=`pwd`/cad

if [ -z "${G4HORUS_CAD_DIR}" ]
then
export G4HORUS_CAD_DIR=`pwd`/cad
fi
echo "CAD Dir: ${G4HORUS_CAD_DIR}"

## Create output dir and run full simulation
mkdir -p out
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# G4Horus

[![Build Status](https://travis-ci.org/janmayer/G4Horus.svg?branch=master)](https://travis-ci.org/janmayer/G4Horus)

An implementation of the HORUS High-Purity Germanium (HPGe) γ-ray spectrometer and associated equipment in Geant4.

![G4Horus Default Geometry](doc/g4horus.png)
Expand Down
11 changes: 6 additions & 5 deletions src/geometries/CADElement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ CADElement::CADElement(std::string filename, const std::string& material, const
: fFilename(std::move(filename))
, fLV(nullptr)
{
std::cout << "CADElement: Meshing " << GetCadFile(fFilename) << std::endl;
auto mesh = CADMesh(GetCadFile(fFilename));
const auto file = GetCadFile(fFilename);
std::cout << "CADElement: Meshing " << fFilename << "(" << file << ") ..." << std::endl;
// This Version of Cadmesh wants and non-const char ...
auto mesh = CADMesh(const_cast<char*>(file.c_str()));
mesh.SetScale(mm);
fLV = new G4LogicalVolume(mesh.TessellatedMesh(), G4Material::GetMaterial(material), fFilename + "_lV");
auto va = G4VisAttributes(color);
Expand All @@ -21,7 +23,7 @@ void CADElement::Place(G4LogicalVolume* worldLV, G4RotationMatrix* rot, const G4
new G4PVPlacement(rot, trans, fLV, fFilename + "_pV", worldLV, false, 0, checkOverlaps);
}

char* CADElement::GetCadFile(const std::string& filename) const
std::string CADElement::GetCadFile(const std::string& filename) const
{
std::string loc;
const char* path = std::getenv("G4HORUS_CAD_DIR");
Expand All @@ -30,6 +32,5 @@ char* CADElement::GetCadFile(const std::string& filename) const
} else {
loc = std::string(path) + "/" + filename + ".stl";
}
// This Version of Cadmesh wants and non-const char ...
return const_cast<char*>(loc.c_str());
return loc;
}
2 changes: 1 addition & 1 deletion src/geometries/CADElement.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CADElement {
};

private:
char* GetCadFile(const std::string& filename) const;
std::string GetCadFile(const std::string& filename) const;

const std::string fFilename;
G4LogicalVolume* fLV;
Expand Down

0 comments on commit fa547e9

Please sign in to comment.