<commit_before>/*
 * Program.hpp
 *
 *  Created on: 08.03.2016
 *      Author: hartung
 */

#ifndef INCLUDE_INITIALIZATION_PROGRAM_HPP_
#define INCLUDE_INITIALIZATION_PROGRAM_HPP_

#include "IConfigurationReader.hpp"
#include "CommandLineArgs.hpp"
#include "Plans.hpp"

namespace Initialization
{

    class Program
    {
     public:

        Program(const CommandLineArgs & cla);

        Program(int * argc, char **argv[]);

        virtual ~Program();

        void initialize();

        void deinitialize();

        void simulate();

        Simulation::AbstractSimulationSPtr getSimulation();

        void printProgramInfo(const ProgramPlan & in) const;

        /*! \brief Returns true, if the program is used as server. */
        bool isSimulationServer() const;

        /*! \brief Returns the port to use for the simulation. */
        int getSimulationServerPort() const;

     private:

        bool _isInitialized;
        bool _usingMPI;
        bool _usingOMP;

        CommandLineArgs _commandLineArgs;
        ProgramPlan _pp;<commit_msg>Readded docu and refactored member name<commit_after>/*
 * Program.hpp
 *
 *  Created on: 08.03.2016
 *      Author: hartung
 */

#ifndef INCLUDE_INITIALIZATION_PROGRAM_HPP_
#define INCLUDE_INITIALIZATION_PROGRAM_HPP_

#include "IConfigurationReader.hpp"
#include "CommandLineArgs.hpp"
#include "Plans.hpp"

namespace Initialization
{

    /**
     * Docu...
     *
     * If ParallelFMU serves as network server, a NetworkPlan is added to the simulation plans of the ProgramPlan.
     *
     */
    class Program
    {
     public:

        Program(const CommandLineArgs & cla);

        Program(int * argc, char **argv[]);

        virtual ~Program();

        /** \brief Initializes the program.
         * The ProgramPlan is created from the configuration file.
         * MPI is initialized, if used.
         * Network connection is established, if ParallelFMU is used as server.
         * The simulations are created (but not initialized!).
         */
        void initialize();

        void deinitialize();

        /** \brief Runs the simulations.
         *
         * The simulations are initialized and than run/executed.
         */
        void simulate();

        /**
         * Returns a shared pointer to the simulations.
         * If OpenMP is used, a shared pointer to the simulation i-th simulation is returned, where i is the OpenMP thread number.
         */
        Simulation::AbstractSimulationSPtr getSimulation();

        void printProgramInfo(const ProgramPlan & in) const;

        /*! \brief Returns true, if the program is used as server. */
        bool isSimulationServer() const;

        /*! \brief Returns the port to use for the simulation. */
        int getSimulationServerPort() const;

     private:

        bool _isInitialized;
        bool _usingMPI;
        bool _usingOMP;

        CommandLineArgs _commandLineArgs;
        ProgramPlan _progPlan;
{'fraction_non_alphanumeric': 0.0835306053432533, 'fraction_numerical': 0.005410889414947582, 'mean_word_length': 2.3767123287671232, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2957281', 'n_tokens_mistral': 839, 'n_tokens_neox': 782, 'n_words': 255}