|
| 1 | +/********************************************************************* |
| 2 | + CombLayer : MNCPX Input builder |
| 3 | + |
| 4 | + * File: Main/bilbau.cxx |
| 5 | +* |
| 6 | + * Copyright (c) 2004-2013 by Stuart Ansell |
| 7 | + * |
| 8 | + * This program is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation, either version 3 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | + * |
| 21 | + ****************************************************************************/ |
| 22 | +#include <fstream> |
| 23 | +#include <iomanip> |
| 24 | +#include <iostream> |
| 25 | +#include <sstream> |
| 26 | +#include <cmath> |
| 27 | +#include <complex> |
| 28 | +#include <list> |
| 29 | +#include <vector> |
| 30 | +#include <set> |
| 31 | +#include <map> |
| 32 | +#include <string> |
| 33 | +#include <algorithm> |
| 34 | +#include <boost/array.hpp> |
| 35 | +#include <boost/shared_ptr.hpp> |
| 36 | + |
| 37 | +#include "Exception.h" |
| 38 | +#include "MersenneTwister.h" |
| 39 | +#include "FileReport.h" |
| 40 | +#include "NameStack.h" |
| 41 | +#include "RegMethod.h" |
| 42 | +#include "GTKreport.h" |
| 43 | +#include "OutputLog.h" |
| 44 | +#include "BaseVisit.h" |
| 45 | +#include "BaseModVisit.h" |
| 46 | +#include "surfRegister.h" |
| 47 | +#include "objectRegister.h" |
| 48 | +#include "InputControl.h" |
| 49 | +#include "MatrixBase.h" |
| 50 | +#include "Matrix.h" |
| 51 | +#include "Tensor.h" |
| 52 | +#include "Vec3D.h" |
| 53 | +#include "inputParam.h" |
| 54 | +#include "Triple.h" |
| 55 | +#include "NRange.h" |
| 56 | +#include "NList.h" |
| 57 | +#include "Tally.h" |
| 58 | +#include "TallyCreate.h" |
| 59 | +#include "Transform.h" |
| 60 | +#include "Quaternion.h" |
| 61 | +#include "localRotate.h" |
| 62 | +#include "masterRotate.h" |
| 63 | +#include "Surface.h" |
| 64 | +#include "Quadratic.h" |
| 65 | +#include "Plane.h" |
| 66 | +#include "Cylinder.h" |
| 67 | +#include "Line.h" |
| 68 | +#include "Rules.h" |
| 69 | +#include "surfIndex.h" |
| 70 | +#include "Code.h" |
| 71 | +#include "varList.h" |
| 72 | +#include "FuncDataBase.h" |
| 73 | +#include "HeadRule.h" |
| 74 | +#include "Object.h" |
| 75 | +#include "Qhull.h" |
| 76 | +#include "ModeCard.h" |
| 77 | +#include "PhysCard.h" |
| 78 | +#include "LSwitchCard.h" |
| 79 | +#include "PhysImp.h" |
| 80 | +#include "KGroup.h" |
| 81 | +#include "Source.h" |
| 82 | +#include "KCode.h" |
| 83 | +#include "PhysicsCards.h" |
| 84 | +#include "BasicWWE.h" |
| 85 | +#include "MainProcess.h" |
| 86 | +#include "SimProcess.h" |
| 87 | +#include "SimInput.h" |
| 88 | +#include "SurInter.h" |
| 89 | +#include "Simulation.h" |
| 90 | +#include "SimPHITS.h" |
| 91 | +#include "PointWeights.h" |
| 92 | +#include "ContainedComp.h" |
| 93 | +#include "ContainedGroup.h" |
| 94 | +#include "LinkUnit.h" |
| 95 | +#include "FixedComp.h" |
| 96 | +#include "LinearComp.h" |
| 97 | +#include "mainJobs.h" |
| 98 | +#include "Volumes.h" |
| 99 | +#include "DefPhysics.h" |
| 100 | +#include "variableSetup.h" |
| 101 | +#include "ImportControl.h" |
| 102 | +#include "SourceCreate.h" |
| 103 | +#include "SourceSelector.h" |
| 104 | +#include "TallySelector.h" |
| 105 | +#include "World.h" |
| 106 | + |
| 107 | +#include "makeBib.h" |
| 108 | + |
| 109 | +MTRand RNG(12345UL); |
| 110 | + |
| 111 | +///\cond STATIC |
| 112 | +namespace ELog |
| 113 | +{ |
| 114 | + ELog::OutputLog<EReport> EM; |
| 115 | + ELog::OutputLog<FileReport> FM("Spectrum.log"); |
| 116 | + ELog::OutputLog<FileReport> RN("Renumber.txt"); ///< Renumber |
| 117 | + ELog::OutputLog<StreamReport> CellM; |
| 118 | +} |
| 119 | +///\endcond STATIC |
| 120 | + |
| 121 | +int |
| 122 | +main(int argc,char* argv[]) |
| 123 | +{ |
| 124 | + int exitFlag(0); // Value on exit |
| 125 | + ELog::RegMethod RControl("","main"); |
| 126 | + mainSystem::activateLogging(RControl); |
| 127 | + |
| 128 | + std::string Oname; |
| 129 | + std::vector<std::string> Names; |
| 130 | + std::map<std::string,std::string> Values; |
| 131 | + std::map<std::string,std::string> AddValues; |
| 132 | + std::map<std::string,double> IterVal; // Variable to iterate |
| 133 | + |
| 134 | + // PROCESS INPUT: |
| 135 | + |
| 136 | + InputControl::mainVector(argc,argv,Names); |
| 137 | + mainSystem::inputParam IParam; |
| 138 | + createBilbauInputs(IParam); |
| 139 | + |
| 140 | + const int iteractive(IterVal.empty() ? 0 : 1); |
| 141 | + Simulation* SimPtr=createSimulation(IParam,Names,Oname); |
| 142 | + if (!SimPtr) return -1; |
| 143 | + |
| 144 | + // The big variable setting |
| 145 | + setVariable::BilbauVariables(SimPtr->getDataBase()); |
| 146 | + InputModifications(SimPtr,IParam,Names); |
| 147 | + mainSystem::setVariables(*SimPtr,IParam,Names); |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + // Definitions section |
| 152 | + int MCIndex(0); |
| 153 | + const int multi=IParam.getValue<int>("multi"); |
| 154 | + try |
| 155 | + { |
| 156 | + while(MCIndex<multi) |
| 157 | + { |
| 158 | + if (MCIndex) |
| 159 | + { |
| 160 | + ELog::EM.setActive(4); // write error only |
| 161 | + ELog::FM.setActive(4); |
| 162 | + ELog::RN.setActive(0); |
| 163 | + |
| 164 | + // if (iteractive) |
| 165 | + // mainSystem::incRunTimeVariable |
| 166 | + // (SimPtr->getDataBase(),IterVal); |
| 167 | + } |
| 168 | + |
| 169 | + SimPtr->resetAll(); |
| 170 | + |
| 171 | + bibSystem::makeBib BibObj; |
| 172 | + World::createOuterObjects(*SimPtr); |
| 173 | + BibObj.build(SimPtr,IParam); |
| 174 | + |
| 175 | + SDef::sourceSelection(*SimPtr,IParam); |
| 176 | + |
| 177 | + SimPtr->removeComplements(); |
| 178 | + SimPtr->removeDeadCells(); // Generic |
| 179 | + SimPtr->removeDeadSurfaces(0); |
| 180 | + |
| 181 | + SimPtr->removeOppositeSurfaces(); |
| 182 | + |
| 183 | + ModelSupport::setDefaultPhysics(*SimPtr,IParam); |
| 184 | + const int renumCellWork=tallySelection(*SimPtr,IParam); |
| 185 | + SimPtr->masterRotation(); |
| 186 | + if (createVTK(IParam,SimPtr,Oname)) |
| 187 | + { |
| 188 | + delete SimPtr; |
| 189 | + ModelSupport::objectRegister::Instance().reset(); |
| 190 | + return 0; |
| 191 | + } |
| 192 | + if (IParam.flag("endf")) |
| 193 | + SimPtr->setENDF7(); |
| 194 | + createMeshTally(IParam,SimPtr); |
| 195 | + SimProcess::importanceSim(*SimPtr,IParam); |
| 196 | + |
| 197 | + SimProcess::inputPatternSim(*SimPtr,IParam); // energy cut etc |
| 198 | + |
| 199 | + if (IParam.flag("cinder")) |
| 200 | + SimPtr->setForCinder(); |
| 201 | + |
| 202 | + // Cut energy tallies: |
| 203 | + if (IParam.flag("ECut")) |
| 204 | + SimPtr->setEnergy(IParam.getValue<double>("ECut")); |
| 205 | + |
| 206 | + if (renumCellWork) |
| 207 | + tallyRenumberWork(*SimPtr,IParam); |
| 208 | + tallyModification(*SimPtr,IParam); |
| 209 | + |
| 210 | + // Ensure we done loop |
| 211 | + do |
| 212 | + { |
| 213 | + SimProcess::writeIndexSim(*SimPtr,Oname,MCIndex); |
| 214 | + MCIndex++; |
| 215 | + } |
| 216 | + while(!iteractive && MCIndex<multi); |
| 217 | + } |
| 218 | + if (IParam.flag("cinder")) |
| 219 | + SimPtr->writeCinder(); |
| 220 | + ModelSupport::calcVolumes(SimPtr,IParam); |
| 221 | + ModelSupport::objectRegister::Instance().write("ObjectRegister.txt"); |
| 222 | + } |
| 223 | + catch (ColErr::ExitAbort& EA) |
| 224 | + { |
| 225 | + if (!EA.pathFlag()) |
| 226 | + ELog::EM<<"Exiting from "<<EA.what()<<ELog::endCrit; |
| 227 | + exitFlag=-2; |
| 228 | + } |
| 229 | + catch (ColErr::ExBase& A) |
| 230 | + { |
| 231 | + ELog::EM<<"EXCEPTION FAILURE :: " |
| 232 | + <<A.what()<<ELog::endCrit; |
| 233 | + exitFlag= -1; |
| 234 | + } |
| 235 | + delete SimPtr; |
| 236 | + ModelSupport::objectRegister::Instance().reset(); |
| 237 | + ModelSupport::surfIndex::Instance().reset(); |
| 238 | + return exitFlag; |
| 239 | +} |
0 commit comments