bool OperatorEnergyChannels::initialize(ConfigReader& cr,Simulation& sim,SimulationClasses& simClasses) {
      initialized = true;
      simClasses.logger << "(SEP OP ENERGY CHANNELS) Starting initialization" << endl << write;
      
      // Init base class:
      if (OperatorAccumulationBase::initialize(cr,sim,simClasses) == false) {
	 simClasses.logger << "(SEP OP ENERGY CHANNELS) ERROR: OperatorAccumulationBase failed to initialize!" << endl << write;
	 initialized = false;
      }

      // Create a profiler section name for this DataOperator:
      #if PROFILE_LEVEL > 0
         stringstream ss;
         ss << "Energy Channels" << OperatorAccumulationBase::getOrder();
         profileName = ss.str();
         OperatorAccumulationBase::setProfileName(ss.str());
      #endif
      
      // Get names of instruments:
      vector<string> instrumentNames;
      cr.addComposed(PREFIX+".instrument_names","Names of energy instruments (string).");
      cr.parse();
      cr.get(PREFIX+".instrument_names",instrumentNames);

      //instrumentIndices.push_back(make_pair<size_t,size_t>(0,0));
      for (size_t i=0; i<instrumentNames.size(); ++i) {
	 // Skip empty lines
	 if (instrumentNames[i].size() == 0) continue;

	 // Read config file items for instrument and create it:
	 if (createInstrument(simClasses,cr,instrumentNames[i]) == false) {
	    simClasses.logger << "(SEP OP ENERGY CHANNELS) ERROR: Failed to read required config file items for ";
	    simClasses.logger << "instrument '" << instrumentNames[i] << "'" << endl << write;
	    initialized = false;
	 }
      }

      // Write init status and exit:
      simClasses.logger << "(SEP OP ENERGY CHANNELS) Initialization complete, status is ";
      if (initialized == true) simClasses.logger << "SUCCESS" << endl << write;
      else simClasses.logger << "FAILURE" << endl << write;
      
      return initialized;
   }
Пример #2
0
 bool SpatialSliceOP::addConfigFileItems(ConfigReader& cr) {
    cr.addComposed(prefix+".sliced_coordinate","Sliced coordinate: x/y/z (string).");
    cr.addComposed(prefix+".slice_origin","Origin of 2D spatial mesh slice (float).");
    cr.addComposed(prefix+".slice_geometry","Geometry of output mesh cartesian/cylindrical (string)");
    return true;
 }