Paramotopy
parallel parameter homotopy through bertini
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions
step2readandwrite.hpp File Reference
#include <mpi.h>
#include "step1_funcs.hpp"
#include "mtrand.hpp"
#include "random.hpp"
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <vector>
#include <map>
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
#include "step2_funcs.hpp"
#include "timing.hpp"
#include <gmp.h>
#include "bertini.h"

Go to the source code of this file.

Macros

#define __STEP2READANDWRITE_H__
 

Functions

void computeNumDenom (char **numer, char **denom, char *s)
 
void getTermination_OpenMC (std::ifstream &mc_in_stream, std::ofstream &mc_out_stream, int &terminationint, std::vector< int > &KVector, runinfo &paramotopy_info, ProgSettings &paramotopy_settings)
 
int GetStart (boost::filesystem::path dir, std::string &start, std::string startfilename)
 
int GetLastNumSent (boost::filesystem::path base_dir, std::vector< int > &lastnumsent, int numprocs)
 
void ReadDotOut (std::vector< std::string > &Numoutvector, std::vector< std::string > &arroutvector, std::vector< std::string > &degoutvector, std::vector< std::string > &namesoutvector, std::vector< std::string > &configvector, std::vector< std::string > &funcinputvector, std::vector< std::string > &preproc_datavector)
 
void WriteDotOut (std::vector< std::string > &arroutvector, std::vector< std::string > &degoutvector, std::vector< std::string > &namesoutvector, std::vector< std::string > &configvector, std::vector< std::string > &funcinputvector, std::vector< std::string > &preproc_datavector)
 
void WriteNumDotOut (std::vector< std::string > Numoutvector, std::vector< std::pair< double, double > > AllParams, int numparam, bool standardstep2)
 
int GetMcNumLines (boost::filesystem::path base_dir, int numparam)
 

Macro Definition Documentation

#define __STEP2READANDWRITE_H__

Definition at line 21 of file step2readandwrite.hpp.

Function Documentation

void computeNumDenom ( char **  numer,
char **  denom,
char *  s 
)

the computeNumdenom function is in the bertini library, but not the headers, hence its inclusion here. it takes in a character array, and pointers which return the numerator and denominator of the number. We pass the input by casting via (char *)

Parameters
sthe number to be converted to rational form
Returns
numer the numerator
denom the denomenator
int GetLastNumSent ( boost::filesystem::path  base_dir,
std::vector< int > &  lastnumsent,
int  numprocs 
)

Deprecated. Gets the highest index set on a previous attempt at the run.

Parameters
base_dirDirectory in which to look for the lastnumsent0,1 files
lastnumsentMutable vector in which to place the lastnumsent info read in by this function
numprocsNumber of processors in this attempt.
int GetMcNumLines ( boost::filesystem::path  base_dir,
int  numparam 
)

Gets the number of lines in the mc file. essentially reads the top line of the file.

Parameters
base_dirThe directory in which to look for the mcfile.
numparamNumber of parameters in the problem. Deprecated?
Returns
terminationint - The number of parameter points in the file. Note that this could acceptably be smaller than the actual number, but not larger.

Definition at line 167 of file step2readandwrite.cpp.

Referenced by master_process::GetTerminationInt(), and failinfo::PerformAnalysis().

Here is the caller graph for this function:

int GetStart ( boost::filesystem::path  dir,
std::string &  start,
std::string  startfilename 
)

reads in the start file to memory

Parameters
dirThe directory in which to read the start file
startMUTABLE String containing the start file
startfilenameThe name of the start file. This is a user-set name.

Definition at line 10 of file step2readandwrite.cpp.

Referenced by failinfo::new_step_one(), and master_process::SendStart().

Here is the caller graph for this function:

void getTermination_OpenMC ( std::ifstream &  mc_in_stream,
std::ofstream &  mc_out_stream,
int &  terminationint,
std::vector< int > &  KVector,
runinfo paramotopy_info,
ProgSettings paramotopy_settings 
)

gets the number of points in the parameter set, and opens the mc_out_stream file (if applicable). for both the user-defined style and the computer-generated.

Parameters
mc_in_streamMUTABLE the stream for reading parameter points in the case of user-defined parameter points.
mc_out_streamMUTABLE the stream for WRITING parameter points in case of computer-generated points.
terminationintMUTABLE the number of points in the solve
KVectorvector of indices, for conversion from an integer to an index vector.
paramotopy_infothe parsed input file.
paramotopy_settingsthe bertini and paramotopy settings for the current run.
void ReadDotOut ( std::vector< std::string > &  Numoutvector,
std::vector< std::string > &  arroutvector,
std::vector< std::string > &  degoutvector,
std::vector< std::string > &  namesoutvector,
std::vector< std::string > &  configvector,
std::vector< std::string > &  funcinputvector,
std::vector< std::string > &  preproc_datavector 
)

Reads in all .out files, into mutable vectors of strings. Assumes the process is working in the directory containing the files.

Parameters
NumoutvectorStores the num.out file.
arroutvectorStores the arr.out file.
degoutvectorStores the deg.out file.
namesoutvectorStores the names.out file.
configvectorStores the config file.
funcinputvectorStores the func_input file.
preproc_datavectorStore the preproc_data file.
void WriteDotOut ( std::vector< std::string > &  arroutvector,
std::vector< std::string > &  degoutvector,
std::vector< std::string > &  namesoutvector,
std::vector< std::string > &  configvector,
std::vector< std::string > &  funcinputvector,
std::vector< std::string > &  preproc_datavector 
)

Writes to disk the .out files, but not num.out. This function needs only be called once, and the process must be in the correct directory.

Parameters
arroutvectorStores the arr.out file.
degoutvectorStores the deg.out file.
namesoutvectorStores the names.out file.
configvectorStores the config file.
funcinputvectorStores the func_input file.
preproc_datavectorStores the preproc_data file.
void WriteNumDotOut ( std::vector< std::string >  Numoutvector,
std::vector< std::pair< double, double > >  AllParams,
int  numparam,
bool  standardstep2 
)

Writes the num.out file for the bertini solve. We overwrite the appropriate places of the original file with the current parameter values.

Parameters
NumoutvectorStores the num.out file, as read in by ReadDotOut.
AllParamsThe current parameter values.
numparamThe numbers of parameters in the problem.
standardstep2Flag to indicate if a parameter continuation run is done * or if a default bertini run is done on multiple parameter points