mirror of
https://github.com/nasa/trick.git
synced 2024-12-23 15:02:25 +00:00
19025d77ad
Reorganized. Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory. Created a libexec directory that holds all of the executables that users don't need to execute directly. Changed all of the executables remaining in bin to start with "trick-". In the sim_services directories changed all source files to find the Trick headers in their new location. Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level. Moved the makefiles, docs, man, and other architecture independent files into a top level share directory. Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on. refs #63
84 lines
2.7 KiB
C++
84 lines
2.7 KiB
C++
/*
|
|
PURPOSE: (Monte carlo structures)
|
|
REFERENCE: (Trick Users Guide)
|
|
ASSUMPTIONS AND LIMITATIONS: (None)
|
|
PROGRAMMERS: ((Keith Vetter) (LinCom) (7/2003))
|
|
*/
|
|
|
|
#ifndef MONTEVARFILE_HH
|
|
#define MONTEVARFILE_HH
|
|
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <string>
|
|
|
|
#include "trick/MonteVar.hh"
|
|
|
|
namespace Trick {
|
|
|
|
/**
|
|
* A variable whose values are read from a file. Values should be listed in columns. Multiple variables
|
|
* may utilize the same file, and even the same column (resulting in identical values). For example,
|
|
* the following file could be used to populate two MonteVarFiles:
|
|
*
|
|
* @code
|
|
* #values.txt: MonteVarFile variable values
|
|
* 1 10
|
|
* 2 20
|
|
* 3 30
|
|
* 4 40
|
|
* 5 50
|
|
* @endcode
|
|
*
|
|
* One could then create two variables as such:
|
|
*
|
|
* @code
|
|
* MonteVarFile *variable1 = new MonteVarFile(string("ball.obj.state.input.position[0]"), string("RUN_example/values.txt"), 1);
|
|
* MonteVarFile *variable2 = new MonteVarFile(string("ball.obj.state.input.position[1]"), string("RUN_example/values.txt"), 2);
|
|
* @endcode
|
|
*
|
|
* <code>variable1</code>'s values will progress starting from 1, through 2, 3, 4, and 5.
|
|
* <code>variable2</code>'s values will be 10, 20, 30, 40, 50.
|
|
* Note that the column number begins at 1, not 0.
|
|
*
|
|
* @author Alex Lin
|
|
* @author Donna Panter
|
|
* @author Derek Bankieris
|
|
*
|
|
* @date August 2010
|
|
*/
|
|
class MonteVarFile : public Trick::MonteVar {
|
|
|
|
protected:
|
|
/** The name of the file containing this variable's values. */
|
|
std::string file_name; /**< \n trick_units(--) */
|
|
|
|
/** The column within the file correpsonding to this variable. */
|
|
unsigned int column; /**< \n trick_units(--) */
|
|
|
|
/** The input file stream. */
|
|
std::ifstream *input_file_stream; /**< \n trick_units(--) */
|
|
|
|
/** A character buffer. */
|
|
char *buffer; /**< \n trick_units(--) */
|
|
|
|
public:
|
|
/**
|
|
* Constructs a MonteVarFile with the specified name, file name, column, and units.
|
|
*
|
|
* @param name the fully qualified name of the simulation variable to which this MonteVarFile refers
|
|
* @param file_name the name of the file containing this variable's values
|
|
* @param column the column (starting at 1) within the file corresponding to this variable
|
|
* @param unit this variable's units
|
|
*/
|
|
MonteVarFile(std::string name, std::string file_name, unsigned int column, std::string unit = "");
|
|
|
|
protected:
|
|
virtual std::string get_next_value();
|
|
|
|
} ;
|
|
|
|
} ;
|
|
|
|
#endif
|