<commit_before>/**
 *
 *  @file TransportFactory.h
 *  Header file defining class TransportFactory
 *     (see \link Cantera::TransportFactory TransportFactory\endlink)
 */

/*
 *  $Author$
 *  $Date$
 *  $Revision$
 *
 *  Copyright 2001 California Institute of Technology
 *
 */

#ifndef CT_TRANFACTORY_H
#define CT_TRANFACTORY_H


// turn off warnings under Windows
#ifdef WIN32
#pragma warning(disable:4786)
#pragma warning(disable:4503)
#endif

// STL includes
#include <vector>
#include <string>
#include <iostream>
#include <new>


// Cantera includes
#include "ct_defs.h"
#include "TransportBase.h"
#include "FactoryBase.h"

#if defined(THREAD_SAFE_CANTERA)
#include <boost/thread/mutex.hpp>
#endif

namespace Cantera {

  /**
   * Struct to hold data read from a transport property database file.
   */
  struct GasTransportData {
    GasTransportData() : speciesName("-"), 
			 geometry(-1), wellDepth(-1.0),
			 diameter(-1.0), 
			 dipoleMoment(-1.0), 
			 polarizability(-1.0),
			 rotRelaxNumber(-1.0) {}
        
    std::string speciesName;
    int geometry;
    doublereal wellDepth;
    doublereal diameter;
    doublereal dipoleMoment;
    doublereal polarizability;
    doublereal rotRelaxNumber;
  };

  // forward references
  class MMCollisionInt;
  class TransportParams;
  class XML_Node;

  /**
   * The purpose of TransportFactory is to create new instances of
   * 'transport managers', which are classes that provide transport
   * properties and are derived from base class
   * Transport. TransportFactory handles all initialization
   * required, including evaluation of collision integrals and
   * generating polynomial fits.  Transport managers can also be
   * created in other ways. @ingroup transportgroup
   * @ingroup transportProps
   */
  class TransportFactory : FactoryBase {

  public:

    /**
     * Return a pointer to a TransportFactory
     * instance. TransportFactory is implemented as a 'singleton',
     * which means that at most one instance may be created. The
     * constructor is private. When a TransportFactory instance is
     * required, call static method factory() to return a pointer
     * to the TransportFactory instance.
     *
     * @code
     * TransportFactory* f;
     * f = TransportFactory::factory();
     * @endcode
     */
    static TransportFactory* factory() {
#if defined(THREAD_SAFE_CANTERA)
      boost::mutex::scoped_lock   lock(transport_mutex) ;
#endif
      if (!s_factory) {
	s_factory = new TransportFactory();
      }
      return s_factory;
    }

    /**
     * Deletes the statically malloced instance.
     */
    virtual void deleteFactory();

    /**
     * Destructor 
     *
     * We do not delete statically
     * created single instance of this class here, because it would
     * create an infinite loop if destructor is called for that
     * single instance. 
     */
    virtual ~TransportFactory();
    

    /// Build a new transport manager
    virtual Transport*
    newTransport(std::string model="", thermo_t* thermo=0, int log_level=0);

    /// Initialize an existing transport manager
    virtual void initTransport(Transport* tr,  
			       thermo_t* thermo=0, int mode=0, int log_level=0);


  private:

    static TransportFactory* s_factory;
#if defined(THREAD_SAFE_CANTERA)
    static boost::mutex transport_mutex ;<commit_msg>Doxygen update - no code change<commit_after>/**
 *  @file TransportFactory.h
 *  Header file defining class TransportFactory
 *     (see \link Cantera::TransportFactory TransportFactory\endlink)
 */
/*
 *  $Author$
 *  $Date$
 *  $Revision$
 *
 *  Copyright 2001 California Institute of Technology
 *
 */

#ifndef CT_TRANFACTORY_H
#define CT_TRANFACTORY_H


// turn off warnings under Windows
#ifdef WIN32
#pragma warning(disable:4786)
#pragma warning(disable:4503)
#endif

// STL includes
#include <vector>
#include <string>
#include <iostream>
#include <new>



// Cantera includes
#include "ct_defs.h"
#include "TransportBase.h"
#include "FactoryBase.h"

#if defined(THREAD_SAFE_CANTERA)
#include <boost/thread/mutex.hpp>
#endif

namespace Cantera {

  /**
   * Struct to hold data read from a transport property database file.
   */
  struct GasTransportData {
    GasTransportData() : speciesName("-"), 
			 geometry(-1), wellDepth(-1.0),
			 diameter(-1.0), 
			 dipoleMoment(-1.0), 
			 polarizability(-1.0),
			 rotRelaxNumber(-1.0) {}

    std::string speciesName;
    int geometry;
    doublereal wellDepth;
    doublereal diameter;
    doublereal dipoleMoment;
    doublereal polarizability;
    doublereal rotRelaxNumber;
  };

  // forward references
  class MMCollisionInt;
  class TransportParams;
  class XML_Node;

 
  //! The purpose of TransportFactory is to create new instances of
  //! 'transport managers', which are classes that provide transport
  //! properties and are derived from base class Transport.
  /*!
   * TransportFactory handles all initialization
   * required, including evaluation of collision integrals and
   * generating polynomial fits.  Transport managers can also be
   * created in other ways.
   *
   * @ingroup transportgroup
   * @ingroup transportProps
   */
  class TransportFactory : FactoryBase {

  public:

    /**
     * Return a pointer to a TransportFactory
     * instance. TransportFactory is implemented as a 'singleton',
     * which means that at most one instance may be created. The
     * constructor is private. When a TransportFactory instance is
     * required, call static method factory() to return a pointer
     * to the TransportFactory instance.
     *
     * @code
     * TransportFactory* f;
     * f = TransportFactory::factory();
     * @endcode
     */
    static TransportFactory* factory() {
#if defined(THREAD_SAFE_CANTERA)
      boost::mutex::scoped_lock   lock(transport_mutex) ;
#endif
      if (!s_factory) {
	s_factory = new TransportFactory();
      }
      return s_factory;
    }


    /**
     * Deletes the statically malloced instance.
     */
    virtual void deleteFactory();

    /**
     * Destructor 
     *
     * We do not delete statically
     * created single instance of this class here, because it would
     * create an infinite loop if destructor is called for that
     * single instance. 
     */
    virtual ~TransportFactory();
    

    /// Build a new transport manager
    virtual Transport*
    newTransport(std::string model="", thermo_t* thermo=0, int log_level=0);

    /// Initialize an existing transport manager
    virtual void initTransport(Transport* tr,  
			       thermo_t* thermo=0, int mode=0, int log_level=0);


  private:

    static TransportFactory* s_factory;
#if defined(THREAD_SAFE_CANTERA)
    static boost::mutex transport_mutex ;
{'fraction_non_alphanumeric': 0.09219330855018587, 'fraction_numerical': 0.008921933085501859, 'mean_word_length': 3.164705882352941, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '7575678', 'n_tokens_mistral': 2002, 'n_tokens_neox': 1875, 'n_words': 610}