<commit_before>#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
//MR CHANGE
#include <cstring>
//MR CHANGE END

#include "Input.h"
#include "common_c.h"

using namespace std; //::cout;
void print_error_code(int ierr);
int input_fform(char inpfname[]);
int SONFATH=0;
extern "C" char phasta_iotype[80];

extern "C" {

  int input_fform_(char inpfname[]) {
    return input_fform(inpfname);
  }

}

int input_fform(char inpfname[])
{

  int ierr = 0 ;
  int i,j;
  char* path_to_config = 0 ;
  char complete_filename[256];

  try {
    // get the input file stream
    path_to_config = getenv("PHASTA_CONFIG");
    if(path_to_config) strcpy(complete_filename, path_to_config);
    else strcpy(complete_filename,".");
    strcat(complete_filename, "/input.config");
    if(workfc.myrank==workfc.master) {
      printf("\n Complete Filename: %s \n", complete_filename);
      printf("\n Local Config: %s \n\n", inpfname);
    }
    string def(complete_filename);
    Input inp(inpfname,def);

#ifdef AMG
    
	// AMG PARAMETERS 
	
	if ((string)inp.GetValue("Employ AMG") == "True" ) {
	  
	    amgvari.irun_amg = 1;

        amgvari.irun_amg_prec = inp.GetValue("Run AMG As CG-preconditioner");

        amgvarr.strong_eps       = inp.GetValue("Strong Criterion Eps");
        
        amgvarr.ramg_eps         = inp.GetValue("AMG Convergence Eps");
        
        amgvarr.ramg_relax       = inp.GetValue("AMG Relaxation Omega");        
        amgvarr.ramg_trunc       = inp.GetValue("AMG Truncation Set");
        
        amgvari.iamg_verb        = inp.GetValue("AMG Verbosity");
        
        amgvari.iamg_neg_sten    = inp.GetValue("AMG Neg_Sten");           

        amgvari.iamg_nlevel      = inp.GetValue("AMG Nlevel"); 
        
        amgvari.iamg_c_solver  = inp.GetValue("AMG Coarsest Solver");
        
        amgvari.iamg_init = 0;
        amgvari.iamg_setup_frez = inp.GetValue("AMG Freeze Setup");
        if ((string)inp.GetValue("AMG Interpolation Type")=="Standard")
            amgvari.iamg_interp = 1;
        else
            amgvari.iamg_interp = 0;
        amgvari.maxnev = inp.GetValue("AMG GGB nev");
        amgvari.maxncv = inp.GetValue("AMG GGB ncv");
        
        if ((string)inp.GetValue("AMG Smoother Type")=="Gauss-Seidel")
            amgvari.iamg_smoother = 1;
        else if ((string)inp.GetValue("AMG Smoother Type")=="ChebyShev")
            amgvari.iamg_smoother = 2;
        else if ((string)inp.GetValue("AMG Smoother Type")=="MLS")
            amgvari.iamg_smoother = 3;
        amgvarr.ramg_chebyratio       = inp.GetValue("AMG Chebyshev Eigenvalue ratio");

        amgvari.mlsdeg = inp.GetValue("AMG MLS Degree");
        amgvari.iamg_reduce = inp.GetValue("AMG Run Reduced Serial");
	}	
#endif    

/////////////////////////////chen Sep 25 2009  Flow Control Parameters ////////
// Take BC from IC at inlet
      ctrlvari.iI2Binlet = (int)inp.GetValue("Take BC from IC at Inlet");
      if(ctrlvari.iI2Binlet > 0 )
        {
         ctrlvar.inletVelX = inp.GetValue("Inlet Bulk x Velocity");
        }
// set uniform outlet pressure
      ctrlvari.isetOutPres = (int)inp.GetValue("Set Outlet Pressure");
      if(ctrlvari.isetOutPres > 0 )
        {
         ctrlvar.outPres1 = inp.GetValue("Uniform Outlet Pressure");
        }
// set initial condition
      ctrlvari.isetInitial=(int)inp.GetValue("Specify Initial Conditions");
      if(ctrlvari.isetInitial==1)
        {
         ctrlvar.xvel_ini=inp.GetValue("Initial X Velocity");
         ctrlvar.yvel_ini=inp.GetValue("Initial Y Velocity");
         ctrlvar.zvel_ini=inp.GetValue("Initial Z Velocity");
         ctrlvar.temp_ini=inp.GetValue("Initial Temp");
         ctrlvar.pres_ini=inp.GetValue("Initial Pressure");
         ctrlvar.evis_ini=inp.GetValue("Initial Scalar 1");
        }
      
///////////////////////////////////////////////////////////////////////////////


    // Disabled Features 

    conpar.iALE = inp.GetValue("iALE");
    conpar.icoord = inp.GetValue("icoord");
    conpar.irs = inp.GetValue("irs");
    conpar.iexec = inp.GetValue("iexec");
    timpar.ntseq = inp.GetValue("ntseq");
    solpar.imap = inp.GetValue("imap");


    // Solution Control Keywords

    if((string)inp.GetValue("Equation of State") == "Incompressible") matdat.matflg[0][0] =-1 ;
    if((string)inp.GetValue("Equation of State") == "Compressible") matdat.matflg[0][0] =0;
    inpdat.Delt[0] = inp.GetValue("Time Step Size");
    inpdat.timestart = inp.GetValue("Beginning Time");
    inpdat.nstep[0] = inp.GetValue("Number of Timesteps");
    if((string)inp.GetValue("Viscous Control")=="Viscous") conpar.navier=1 ; else conpar.navier=0;
   
    if ((string)inp.GetValue("Turbulence Model") == "No-Model" ) {
      turbvari.irans = 0;
      turbvari.iles  = 0;
    } else if ((string)inp.GetValue("Turbulence Model") == "LES" ) {
      turbvari.iles  = 1;
      turbvari.irans = 0;
    } else if ((string)inp.GetValue("Turbulence Model") == "RANS-SA" ) {
      turbvari.iles  = 0;
      turbvari.irans = -1;
    } else if ((string)inp.GetValue("Turbulence Model") == "RANS" ) {
      turbvari.iles  = 0;
      turbvari.irans = -1; // assume S-A for backward compatibility
    } else if ((string)inp.GetValue("Turbulence Model") == "RANS-KE" ) {
      turbvari.iles  = 0;
      turbvari.irans = -2;
    } else if ((string)inp.GetValue("Turbulence Model") == "DES97" ) {
      turbvari.iles  = -1;
      turbvari.irans = -1;
    } else if ((string)inp.GetValue("Turbulence Model") == "DDES" ) {
      turbvari.iles  = -2;<commit_msg>Revert "add start time parameter"<commit_after>#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
//MR CHANGE
#include <cstring>
//MR CHANGE END

#include "Input.h"
#include "common_c.h"

using namespace std; //::cout;
void print_error_code(int ierr);
int input_fform(char inpfname[]);
int SONFATH=0;
extern "C" char phasta_iotype[80];

extern "C" {

  int input_fform_(char inpfname[]) {
    return input_fform(inpfname);
  }

}

int input_fform(char inpfname[])
{

  int ierr = 0 ;
  int i,j;
  char* path_to_config = 0 ;
  char complete_filename[256];

  try {
    // get the input file stream
    path_to_config = getenv("PHASTA_CONFIG");
    if(path_to_config) strcpy(complete_filename, path_to_config);
    else strcpy(complete_filename,".");
    strcat(complete_filename, "/input.config");
    if(workfc.myrank==workfc.master) {
      printf("\n Complete Filename: %s \n", complete_filename);
      printf("\n Local Config: %s \n\n", inpfname);
    }
    string def(complete_filename);
    Input inp(inpfname,def);

#ifdef AMG
    
	// AMG PARAMETERS 
	
	if ((string)inp.GetValue("Employ AMG") == "True" ) {
	  
	    amgvari.irun_amg = 1;

        amgvari.irun_amg_prec = inp.GetValue("Run AMG As CG-preconditioner");

        amgvarr.strong_eps       = inp.GetValue("Strong Criterion Eps");
        
        amgvarr.ramg_eps         = inp.GetValue("AMG Convergence Eps");
        
        amgvarr.ramg_relax       = inp.GetValue("AMG Relaxation Omega");        
        amgvarr.ramg_trunc       = inp.GetValue("AMG Truncation Set");
        
        amgvari.iamg_verb        = inp.GetValue("AMG Verbosity");
        
        amgvari.iamg_neg_sten    = inp.GetValue("AMG Neg_Sten");           

        amgvari.iamg_nlevel      = inp.GetValue("AMG Nlevel"); 
        
        amgvari.iamg_c_solver  = inp.GetValue("AMG Coarsest Solver");
        
        amgvari.iamg_init = 0;
        amgvari.iamg_setup_frez = inp.GetValue("AMG Freeze Setup");
        if ((string)inp.GetValue("AMG Interpolation Type")=="Standard")
            amgvari.iamg_interp = 1;
        else
            amgvari.iamg_interp = 0;
        amgvari.maxnev = inp.GetValue("AMG GGB nev");
        amgvari.maxncv = inp.GetValue("AMG GGB ncv");
        
        if ((string)inp.GetValue("AMG Smoother Type")=="Gauss-Seidel")
            amgvari.iamg_smoother = 1;
        else if ((string)inp.GetValue("AMG Smoother Type")=="ChebyShev")
            amgvari.iamg_smoother = 2;
        else if ((string)inp.GetValue("AMG Smoother Type")=="MLS")
            amgvari.iamg_smoother = 3;
        amgvarr.ramg_chebyratio       = inp.GetValue("AMG Chebyshev Eigenvalue ratio");

        amgvari.mlsdeg = inp.GetValue("AMG MLS Degree");
        amgvari.iamg_reduce = inp.GetValue("AMG Run Reduced Serial");
	}	
#endif    

/////////////////////////////chen Sep 25 2009  Flow Control Parameters ////////
// Take BC from IC at inlet
      ctrlvari.iI2Binlet = (int)inp.GetValue("Take BC from IC at Inlet");
      if(ctrlvari.iI2Binlet > 0 )
        {
         ctrlvar.inletVelX = inp.GetValue("Inlet Bulk x Velocity");
        }
// set uniform outlet pressure
      ctrlvari.isetOutPres = (int)inp.GetValue("Set Outlet Pressure");
      if(ctrlvari.isetOutPres > 0 )
        {
         ctrlvar.outPres1 = inp.GetValue("Uniform Outlet Pressure");
        }
// set initial condition
      ctrlvari.isetInitial=(int)inp.GetValue("Specify Initial Conditions");
      if(ctrlvari.isetInitial==1)
        {
         ctrlvar.xvel_ini=inp.GetValue("Initial X Velocity");
         ctrlvar.yvel_ini=inp.GetValue("Initial Y Velocity");
         ctrlvar.zvel_ini=inp.GetValue("Initial Z Velocity");
         ctrlvar.temp_ini=inp.GetValue("Initial Temp");
         ctrlvar.pres_ini=inp.GetValue("Initial Pressure");
         ctrlvar.evis_ini=inp.GetValue("Initial Scalar 1");
        }
      
///////////////////////////////////////////////////////////////////////////////


    // Disabled Features 

    conpar.iALE = inp.GetValue("iALE");
    conpar.icoord = inp.GetValue("icoord");
    conpar.irs = inp.GetValue("irs");
    conpar.iexec = inp.GetValue("iexec");
    timpar.ntseq = inp.GetValue("ntseq");
    solpar.imap = inp.GetValue("imap");


    // Solution Control Keywords

    if((string)inp.GetValue("Equation of State") == "Incompressible") matdat.matflg[0][0] =-1 ;
    if((string)inp.GetValue("Equation of State") == "Compressible") matdat.matflg[0][0] =0;
    inpdat.Delt[0] = inp.GetValue("Time Step Size");
    inpdat.nstep[0] = inp.GetValue("Number of Timesteps");
    if((string)inp.GetValue("Viscous Control")=="Viscous") conpar.navier=1 ; else conpar.navier=0;
   
    if ((string)inp.GetValue("Turbulence Model") == "No-Model" ) {
      turbvari.irans = 0;
      turbvari.iles  = 0;
    } else if ((string)inp.GetValue("Turbulence Model") == "LES" ) {
      turbvari.iles  = 1;
      turbvari.irans = 0;
    } else if ((string)inp.GetValue("Turbulence Model") == "RANS-SA" ) {
      turbvari.iles  = 0;
      turbvari.irans = -1;
    } else if ((string)inp.GetValue("Turbulence Model") == "RANS" ) {
      turbvari.iles  = 0;
      turbvari.irans = -1; // assume S-A for backward compatibility
    } else if ((string)inp.GetValue("Turbulence Model") == "RANS-KE" ) {
      turbvari.iles  = 0;
      turbvari.irans = -2;
    } else if ((string)inp.GetValue("Turbulence Model") == "DES97" ) {
      turbvari.iles  = -1;
      turbvari.irans = -1;
    } else if ((string)inp.GetValue("Turbulence Model") == "DDES" ) {
      turbvari.iles  = -2;
{'fraction_non_alphanumeric': 0.15980629539951574, 'fraction_numerical': 0.009505873912653574, 'mean_word_length': 2.56864, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7125197', 'n_tokens_mistral': 4139, 'n_tokens_neox': 3993, 'n_words': 730}