⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmdsclasses.h

📁 XMDS is a code generator that integrates equations. You write them down in human readable form in a
💻 H
📖 第 1 页 / 共 4 页
字号:
/*  Copyright (C) 2000-2004  Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane  This file is part of xmds.   This program is free software; you can redistribute it and/or  modify it under the terms of the GNU General Public License  as published by the Free Software Foundation; either version 2  of the License, or (at your option) any later version.  This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License for more details.  You should have received a copy of the GNU General Public License  along with this program; if not, write to the Free Software  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*//*  $Id: xmdsclasses.h,v 1.34 2004/10/21 09:40:54 paultcochrane Exp $*//*! @file xmdsclasses.h  @brief Classes used in xmds  More detailed explanation...*/#include <string>#ifndef LIST#include<list>#define LIST#endif/*! @def DEBUG  @brief Macro set to output debugging information  Set DEBUG to 1 for full debugging output  Set DEBUG to 0 to turn debugging off.*///#define DEBUG 1// *****************************************************************************// *****************************************************************************//                              xmdsElement// *****************************************************************************// *****************************************************************************class xmdsSimulation;//! Class representing an element in an xmds simulationclass xmdsElement :     public xmdsUtility {public :  //! Constructor of xmdsElement object  xmdsElement(              const xmdsSimulation *const yourSimulation,              const bool& yourVerboseMode);  ~xmdsElement();  //!< xmdsElement destructor  // This was in protected!  //! Returns the xmds simulation  const xmdsSimulation* simulation() const;protected :  //! Writes the defines of output C++ code  virtual void writeDefines(                            FILE *const outfile) const;  //! Writes the global variables to output C++ code  virtual void writeGlobals(                            FILE *const outfile) const;  //! Writes the prototypes of the C++ code  virtual void writePrototypes(                               FILE *const outfile) const;  //! Writes the routines of the xmds C++ code  virtual void writeRoutines(                             FILE *const outfile) const;  //! Adds a child  void addChild(                const xmdsElement *const newChild);  //! Determines if output is verbose  bool verbose() const;private :  const xmdsSimulation *const mySimulation;  //!< The main simulation object  const bool myVerbose;                      //!< Variable describing if the output should be verbose or not  list<const xmdsElement*> myChildList;      //!< List of child elements  //! Parse the XMLString inString and generate the output list of XML strings outXMLStringList  void parseXMLString(                      const XMLString *const inString,                      list<XMLString>& outXMLStringList);};// ******************************************************************************// ******************************************************************************//                              xmdsGlobals// ******************************************************************************// ******************************************************************************//! Class containing the parameters used to control an entire xmds simulationclass xmdsGlobals : public xmdsElement {public :  //! Constructor of xmdsGlobals object  xmdsGlobals(              const xmdsSimulation *const yourSimulation,              const bool& yourVerboseMode);  //! Destructor  ~xmdsGlobals();  //! Processes an element  void processElement(                      const Element *const yourElement);private :  XMLString myGlobalsCode;  //!< The XMLString containing the code entered in the globals section  //! Writes the globals code to the output file  void writeGlobals(                    FILE *const outfile) const;};// *****************************************************************************// *****************************************************************************//                              dimension// *****************************************************************************// *****************************************************************************//! Structure containing dimension parametersstruct dimensionStruct {  XMLString name;        //!< The name of the dimension  unsigned long lattice; //!< The lattice of the dimension  domainStruct domain;   //!< The structure of the domain's dimension};// *****************************************************************************// *****************************************************************************//                              xmdsFieldGeometry// *****************************************************************************// *****************************************************************************//! xmds field geometry classclass xmdsFieldGeometry {public :  //! Clears the dimensions list  void clear();  //! Returns the number of dimensions  unsigned long nDims() const;  //! Returns the dimension of the field geometry as a dimensionStruct  const dimensionStruct* dimension(                                   const unsigned long& index) const;  //! Sets the dimension of the field geometry  void setDimension(                    const unsigned long& index,                    const dimensionStruct& newDimension);  //! Adds a dimension to the field geometry  void addDimension(                    const dimensionStruct& newDimension);  //! Gets dimension number  /*! Why in the crap is this called getDimNumber if it returns boolean?    And if it actually does return the dimension number then why    does it return boolean?  */  bool getDimNumber(                    const XMLString& dimName,                    unsigned long& dimNumber) const;  //! Returns the full space  unsigned long fullSpace() const;private :  list<dimensionStruct> myDimensionsList;  //!< The list of the dimensions of the field};// *****************************************************************************// *****************************************************************************//                              xmdsField// *****************************************************************************// *****************************************************************************//! Enumerator of the different kinds of type a vector can beenum xmdsVectorType {  COMPLEX       = 0,  DOUBLE        = 1};class xmdsVector;class xmdsVectorElement;//! xmds field classclass xmdsField : public xmdsElement {public :  //! Constructor of xmdsField object  xmdsField(            const xmdsSimulation *const yourSimulation,            const bool& yourVerboseMode);  //! Destructor  ~xmdsField();  //! Processes the xmds element  void processElement(                      const Element *const yourElement);  //! Processes the vectors in the vector names list  void processVectors(                      const list<XMLString>& vectorNamesList,                      const unsigned long& space) const;  //! The output sample count (but doesn't return anything... Why?)  void outputSampleCount() const;  //! Determines if needs FFTW plans  bool needsFFTWPlans() const;  //! Writes the initialisation calls to the C++ file  virtual void writeInitialisationCalls(                                        FILE *const outfile,                                        const char *const indent) const;  //! Writes the sample calls to the C++ file  void writeSampleCalls(                        FILE *const outfile,                        const char *const indent) const;  //! Assigns the active vector pointers  void assignActiveVectorPointers(                                  FILE *const outfile,                                  const char *const tempVectorName) const;  //! Returns the name of the field(?)  const XMLString* name() const;  //! Returns the field geometry  const xmdsFieldGeometry* geometry() const;  //! Gets the vector?  /*!     Why does this return boolean if it gets the vector?  */  bool getVector(                 const XMLString& vectorName,                 const xmdsVector*& theVector) const;  //! Returns the vector names in a list  void vectorNames(                   list<XMLString>& vectorNamesList) const;  //! Converts the vectors to the relevant space  void vectors2space(                     FILE *const outfile,                     const unsigned long& space,                     const list<XMLString>& vectorNamesList,                     const char *const indent) const;  //! Opens the loops  void openLoops(                 FILE *const outfile,                 unsigned long space,                 const list<XMLString>& vectorNamesList) const;  //! Closes the loops  void closeLoops(                  FILE *const outfile,                  unsigned long space,                  const list<XMLString>& vectorNamesList) const;  //! Writes the plan creation calls for fftw  void writePlanCreationCalls(                              FILE *const outfile,                              const bool& useFFTWMeasure,                              const bool& useWisdom) const;  //! Writes the plan deletion calls for fftw  void writePlanDeletionCalls(                              FILE *const outfile) const;  //! Creats an xmds vector  xmdsVector* createxmdsVector();protected:  //! Writes defines to outfile  void writeDefines(                    FILE *const outfile) const;  //! Writes global variables to outfile  void writeGlobals(                    FILE *const outfile) const;  //! Writes function prototypes to outfile  void writePrototypes(                       FILE *const outfile) const;  //! Writes simulation routines to outfile  void writeRoutines(                     FILE *const outfile) const;  //! Sets the name of the field  void setName(               const XMLString& yourName);  //! Sets the geometry of the field  void setGeometry(                   const xmdsFieldGeometry& yourGeometry);private :  XMLString                 myName;           //!< The name of the field  xmdsFieldGeometry         myGeometry;       //!< The field geometry  list<const xmdsVector*>   myVectorsList;    //!< The list of vectors in the field  list<unsigned long>       mySamplesList;    //!< The list of samples of the field  mutable bool              myNeedsFFTWPlans; //!< Whether or not the field needs the fftw plans  //! Creates an xmds vector element  xmdsVectorElement* createxmdsVectorElement();};// *****************************************************************************// *****************************************************************************//                              xmdsVector// *****************************************************************************// *****************************************************************************//! xmds vector classclass xmdsVector {public :  //! Constructor for xmdsVector object  xmdsVector(             const xmdsField *const yourField);  //! Destructor  virtual ~xmdsVector();  //! Writes relevant #defines out to file  void writeDefines(                    FILE *const outfile) const;  //! Writes relevant global variable declarations to file  void writeGlobals(                    FILE *const outfile) const;  //! Writes function prototypes to file  void writePrototypes(                       FILE *const outfile) const;  //! Writes the function routines to file  void writeRoutines(                     FILE *const outfile) const;  //! Writes the initialisation call  void writeInitialisationCall(                               FILE *const outfile,                               const char *const indent) const;  //! I think this grabs the xmds simulation name  const XMLString* name() const;  //! Sets the name of something, possibly the xmds simulation name  void setName(               const XMLString& yourName);  //! Returns the vector type of an xmds vector  xmdsVectorType vectorType() const;  //! Sets the vector type (duh!)  void setVectorType(                     const xmdsVectorType& yourType);  //! Obtains the number of components (possibly in the xmds simulation)  unsigned long nComponents() const;  //! Obtains the name of the component  const XMLString* componentName(                                 const unsigned long& index) const;  //! Gets the component  bool getComponent(                    const XMLString& ofName,                    unsigned long& index) const;  //! Sets a component  void setComponents(                     const list<XMLString>& yourComponentsNamesList);  //! Determines if the FFTW routines are needed  bool needsFFTWRoutines() const;  //! Sets whether the FFTW routines are needed  void setNeedsFFTWRoutines() const;  //! Determines the initial space for the xmds vector (x-space or k-space)  unsigned long initialSpace() const;  //! Sets the initial space to x-space or k-space  void setInitialSpace(                       const unsigned long& yourInitialSpace);protected:  //! Writes the initialise routine  virtual void writeInitialiseRoutine(                                      FILE *const outfile) const;  //! Obtains an instance of the xmdsField object  const xmdsField* field() const;  //! Returns true if the space at index is the initial space (I think...)  bool space(             const long unsigned int& index) const;private :

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -