<commit_before>#include "reprocess_facility.h"



namespace reprocess {

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ReprocessFacility::ReprocessFacility(cyclus::Context* ctx)
        : cyclus::Facility(ctx) {};

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    std::string ReprocessFacility::str() {
      return Facility::str();
    }

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    void ReprocessFacility::Tick() {
    //inventory check is done in this phase, inventories initialized in the beginning of simulation
    	//std::cout << std::endl << std::endl << "~~tick~~" << std::endl;
    	//std::cout << "Input inventory: " << input_inventory.quantity() << std::endl;
    	//std::cout << "Waste inventory: " << waste_inventory.quantity() << std::endl;
    	/*for(int i = 0; i < out_inventory.size(); i++){
    	  std::cout << "Out inventory " << i << ": " << out_inventory[i].quantity() << std::endl;
    	}*/

    	//check to see beginning of simulation
    	if(pi != 3.141592){
    	  pi = 3.141592;
    	  int nucid = 0; //for erroneous inputs this could be a long int
    	  double eff;
    	  std::string line;
    	  //populate out_commods, out_eff from input, initiate each associated output_inventory
    	  std::ifstream fin(repro_input_path);
           if(!fin.good()){
             std::cout << "Error! Failed reading reprocessing plant input file." << '\n';
             std::cout << "  Given path: " << repro_input_path << '\n';
             std::cout << "  Please correct the path in cyclus input file for repro_input_path variable." << '\n';
           }
           //reads the input file and populates out_eff with the read values
	  while(getline(fin, line)){
	    if(line.find("BEGIN") == 0){
	      cyclus::toolkit::ResourceBuff temp_pass;
	      out_inventory.push_back(temp_pass); //initializes the corresponding inventory
	      std::map<int, double> tempmap;
	      while(getline(fin, line)){
	        std::istringstream iss(line);
	        if(line.find("END") == 0){break;}
	        iss >> nucid >> eff;
	        if(nucid < 10000000 || nucid > 2000000000){
	          std::cout << "Error reading isotope identifier in reprocess facility." << '\n';
	          std::cout << "Isotope: " << nucid << " isn't in the form 'zzaaammmm'." << '\n';
	        }
	        if(eff < 0 || eff > 1){
	          std::cout << "Error in isotope removal efficiency in reprocess facility." << '\n';
	          std::cout << "  Efficiency is set to " << eff << " for " << nucid << "." << '\n';
	        }
	        tempmap[nucid] = eff;
	      }
	    out_eff.push_back(tempmap);
	    }

	  }
         if(out_eff.size() == 0){<commit_msg>improved reprocess facility output and updated open cycle example<commit_after>#include "reprocess_facility.h"



namespace reprocess {

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ReprocessFacility::ReprocessFacility(cyclus::Context* ctx)
        : cyclus::Facility(ctx) {};

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    std::string ReprocessFacility::str() {
      return Facility::str();
    }

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    void ReprocessFacility::Tick() {
    //inventory check is done in this phase, inventories initialized in the beginning of simulation
    	//std::cout << std::endl << std::endl << "~~tick~~" << std::endl;
    	//std::cout << "Input inventory: " << input_inventory.quantity() << std::endl;
    	//std::cout << "Waste inventory: " << waste_inventory.quantity() << std::endl;
    	/*for(int i = 0; i < out_inventory.size(); i++){
    	  std::cout << "Out inventory " << i << ": " << out_inventory[i].quantity() << std::endl;
    	}*/

    	//check to see beginning of simulation
    	if(pi != 3.141592){
    	  pi = 3.141592;
    	  int nucid = 0; //for erroneous inputs this could be a long int
    	  double eff;
    	  std::string line;
    	  //populate out_commods, out_eff from input, initiate each associated output_inventory
    	  std::ifstream fin(repro_input_path);
           if(!fin.good()){
             std::cout << "Error! Failed reading reprocessing plant input file." << '\n';
             std::cout << "  Given path: " << repro_input_path << '\n';
             std::cout << "  Please correct the path in cyclus input file for repro_input_path variable." << '\n';
           } else {
             std::cout << "Reprocess facility starting (ID:" << id() << ") reading input " << repro_input_path << std::endl;
           }
           //reads the input file and populates out_eff with the read values
          while(getline(fin, line)){
            if(line.find("BEGIN") == 0){
              cyclus::toolkit::ResourceBuff temp_pass;
              out_inventory.push_back(temp_pass); //initializes the corresponding inventory
              std::map<int, double> tempmap;
              while(getline(fin, line)){
                std::istringstream iss(line);
                if(line.find("END") == 0){break;}
                iss >> nucid >> eff;
                //std::cout << " read input: " << nucid << "  " << eff << std::endl;
                if(nucid < 10000000 || nucid > 2000000000){
                  std::cout << "Error reading isotope identifier in reprocess facility." << '\n';
                  std::cout << "Isotope: " << nucid << " isn't in the form 'zzaaammmm'." << '\n';
                }
                if(eff < 0 || eff > 1){
                  std::cout << "Error in isotope removal efficiency in reprocess facility." << '\n';
                  std::cout << "  Efficiency is set to " << eff << " for " << nucid << "." << '\n';
                }
                tempmap[nucid] = eff;
              }
            out_eff.push_back(tempmap);
            }

          }
         if(out_eff.size() == 0){
{'fraction_non_alphanumeric': 0.18352941176470589, 'fraction_numerical': 0.01310924369747899, 'mean_word_length': 1.7691949744067008, 'pattern_counts': {'":': 2, '<': 175, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2728638', 'n_tokens_mistral': 2013, 'n_tokens_neox': 1869, 'n_words': 430}