<commit_before>/*! \file DegRateNuclide.cpp
    \brief Implements the DegRateNuclide class used by the Generic Repository 
    \author <NAME>
 */
#include <iostream>
#include <fstream>
#include <deque>
#include <time.h>
#include <assert.h>
#include <boost/lexical_cast.hpp>

#include "CycException.h"
#include "Logger.h"
#include "Timer.h"
#include "DegRateNuclide.h"
#include "Material.h"

using namespace std;
using boost::lexical_cast;

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DegRateNuclide::DegRateNuclide():
  deg_rate_(0),
  bc_type_(LAST_BC_TYPE),
  v_(0),
  tot_deg_(0),
  last_degraded_(-1)
{
  wastes_ = deque<mat_rsrc_ptr>();

  set_geom(GeometryPtr(new Geometry()));
  last_updated_=0;

  vec_hist_ = VecHist();
  conc_hist_ = ConcHist();
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DegRateNuclide::DegRateNuclide(QueryEngine* qe):
  deg_rate_(0),
  bc_type_(LAST_BC_TYPE),
  v_(0),
  tot_deg_(0),
  last_degraded_(-1)
{
  wastes_ = deque<mat_rsrc_ptr>();
  vec_hist_ = VecHist();
  conc_hist_ = ConcHist();

  set_geom(GeometryPtr(new Geometry()));
  last_updated_=0;

  initModuleMembers(qe);
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DegRateNuclide::~DegRateNuclide(){
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DegRateNuclide::initModuleMembers(QueryEngine* qe){
  set_v(lexical_cast<double>(qe->getElementContent("advective_velocity")));
  set_deg_rate(lexical_cast<double>(qe->getElementContent("degradation")));
  QueryEngine* bc_type_qe = qe->queryElement("bc_type");
  string bc_type_string;
  list <string> choices;
  list <string>::iterator it;
  choices.push_back("SOURCE_TERM");
  choices.push_back("NEUMANN");
  choices.push_back("CAUCHY");
  for( it=choices.begin(); it!=choices.end(); ++it) {
    if( bc_type_qe->nElementsMatchingQuery(*it) == 1){
      set_bc_type(enumerateBCType(*it));
    }
  }
  LOG(LEV_DEBUG2,"GRDRNuc") << "The DegRateNuclide Class initModuleMembers(qe) function has been called";;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NuclideModelPtr DegRateNuclide::copy(const NuclideModel& src){
  const DegRateNuclide* src_ptr = dynamic_cast<const DegRateNuclide*>(&src);

  set_deg_rate(src_ptr->deg_rate());
  set_bc_type(src_ptr->bc_type());
  set_v(src_ptr->v());
  set_tot_deg(0);
  set_last_degraded(-1);

  // copy the geometry AND the centroid. It should be reset later.
  set_geom(GeometryPtr(new Geometry()));
  geom_->copy(src_ptr->geom(), src_ptr->geom()->centroid());

  wastes_ = deque<mat_rsrc_ptr>();
  vec_hist_ = VecHist();
  conc_hist_ = ConcHist();<commit_msg>completing bc switch in deg rate mixed cell<commit_after>/*! \file DegRateNuclide.cpp
    \brief Implements the DegRateNuclide class used by the Generic Repository 
    \author <NAME>
 */
#include <iostream>
#include <fstream>
#include <deque>
#include <time.h>
#include <assert.h>
#include <boost/lexical_cast.hpp>

#include "CycException.h"
#include "Logger.h"
#include "Timer.h"
#include "DegRateNuclide.h"
#include "Material.h"

using namespace std;
using boost::lexical_cast;

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DegRateNuclide::DegRateNuclide():
  deg_rate_(0),
  bc_type_(LAST_BC_TYPE),
  v_(0),
  tot_deg_(0),
  last_degraded_(-1)
{
  wastes_ = deque<mat_rsrc_ptr>();

  set_geom(GeometryPtr(new Geometry()));
  last_updated_=0;

  vec_hist_ = VecHist();
  conc_hist_ = ConcHist();
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DegRateNuclide::DegRateNuclide(QueryEngine* qe):
  deg_rate_(0),
  bc_type_(LAST_BC_TYPE),
  v_(0),
  tot_deg_(0),
  last_degraded_(-1)
{
  wastes_ = deque<mat_rsrc_ptr>();
  vec_hist_ = VecHist();
  conc_hist_ = ConcHist();

  set_geom(GeometryPtr(new Geometry()));
  last_updated_=0;

  initModuleMembers(qe);
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DegRateNuclide::~DegRateNuclide(){
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DegRateNuclide::initModuleMembers(QueryEngine* qe){
  set_v(lexical_cast<double>(qe->getElementContent("advective_velocity")));
  set_deg_rate(lexical_cast<double>(qe->getElementContent("degradation")));
  QueryEngine* bc_type_qe = qe->queryElement("bc_type");
  string bc_type_string;
  list <string> choices;
  list <string>::iterator it;
  choices.push_back("CAUCHY");
  choices.push_back("DIRICHLET");
  choices.push_back("SOURCE_TERM");
  choices.push_back("NEUMANN");
  for( it=choices.begin(); it!=choices.end(); ++it) {
    if( bc_type_qe->nElementsMatchingQuery(*it) == 1){
      set_bc_type(enumerateBCType(*it));
    }
  }
  LOG(LEV_DEBUG2,"GRDRNuc") << "The DegRateNuclide Class initModuleMembers(qe) function has been called";;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NuclideModelPtr DegRateNuclide::copy(const NuclideModel& src){
  const DegRateNuclide* src_ptr = dynamic_cast<const DegRateNuclide*>(&src);

  set_deg_rate(src_ptr->deg_rate());
  set_bc_type(src_ptr->bc_type());
  set_v(src_ptr->v());
  set_tot_deg(0);
  set_last_degraded(-1);

  // copy the geometry AND the centroid. It should be reset later.
  set_geom(GeometryPtr(new Geometry()));
  geom_->copy(src_ptr->geom(), src_ptr->geom()->centroid());

  wastes_ = deque<mat_rsrc_ptr>();
  vec_hist_ = VecHist();
  conc_hist_ = ConcHist();
{'fraction_non_alphanumeric': 0.2066594281577995, 'fraction_numerical': 0.005066956207021353, 'mean_word_length': 2.729419703103914, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 60, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6237330', 'n_tokens_mistral': 2297, 'n_tokens_neox': 2209, 'n_words': 299}