Sundance.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #ifndef SUNDANCE_H
00032 #define SUNDANCE_H
00033 
00034 /* Utilities */
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceOut.hpp"
00037 #include "SundancePathUtils.hpp"
00038 #include "Teuchos_Time.hpp"
00039 #include "Teuchos_GlobalMPISession.hpp"
00040 #include "Teuchos_TimeMonitor.hpp"
00041 #include "Teuchos_ParameterList.hpp"
00042 #include "Teuchos_ParameterXMLFileReader.hpp"
00043 #include "Teuchos_CommandLineProcessor.hpp"
00044 
00045 /* Symbolics */
00046 #include "SundanceTestFunction.hpp"
00047 #include "SundanceUnknownFunction.hpp"
00048 #include "SundanceDiscreteSpace.hpp"
00049 #include "SundanceDiscreteFunction.hpp"
00050 #include "SundanceEssentialBC.hpp"
00051 #include "SundanceIntegral.hpp"
00052 #include "SundanceDerivative.hpp"
00053 #include "SundanceCoordExpr.hpp"
00054 #include "SundanceCellDiameterExpr.hpp"
00055 #include "SundanceCurveNormExpr.hpp"
00056 #include "SundanceCellVectorExpr.hpp"
00057 #include "SundanceStdMathOps.hpp"
00058 #include "SundanceParameter.hpp"
00059 #include "SundancePointwiseUserDefFunctor.hpp"
00060 #include "SundanceUserDefFunctor.hpp"
00061 #include "SundanceUserDefOp.hpp"
00062 #include "SundanceVectorCalculus.hpp"
00063 
00064 /* Parametrized Curves */
00065 #include "SundanceCircle.hpp"
00066 #include "SundanceBox2D.hpp"
00067 #include "SundanceDummyParametrizedCurve.hpp"
00068 #include "SundanceParamCurveIntegral.hpp"
00069 #include "SundanceParametrizedCurve.hpp"
00070 
00071 /* Meshes */
00072 #include "SundanceMesh.hpp"
00073 #include "SundanceMeshType.hpp"
00074 #include "SundanceBasicSimplicialMeshType.hpp"
00075 #include "SundanceMeshSource.hpp"
00076 #include "SundanceMeshTransformation.hpp"
00077 #include "SundancePartitionedLineMesher.hpp"
00078 #include "SundanceExtrusionMeshTransformation.hpp"
00079 #include "SundancePartitionedRectangleMesher.hpp"
00080 #include "SundanceSerialPartitionerBase.hpp"
00081 #include "SundanceFileIOChacoPartitioner.hpp"
00082 #include "SundanceTriangleMeshReader.hpp"
00083 #include "SundanceExodusNetCDFMeshReader.hpp"
00084 #include "SundanceExodusMeshReader.hpp"
00085 #include "SundanceMeshBuilder.hpp"
00086 #include "SundanceBamgMeshReader.hpp"
00087 #include "SundanceHNMesher2D.hpp"
00088 #include "SundanceHNMeshType2D.hpp"
00089 #include "SundanceHNMesher3D.hpp"
00090 #include "SundanceHNMeshType3D.hpp"
00091 
00092 
00093 #ifdef HAVE_SUNDANCE_PEANO
00094   #ifdef HAVE_SUNDANCE_PEANO_NO_2D
00095   #else
00096     #include "SundancePeanoMeshType2D.hpp"
00097     #include "SundancePeanoMesher2D.hpp"
00098   #endif
00099   #ifdef HAVE_SUNDANCE_PEANO_NO_3D
00100   #else
00101     #include "SundancePeanoMeshType3D.hpp"
00102     #include "SundancePeanoMesher3D.hpp"
00103   #endif
00104 #endif
00105 
00106 /* Mesh refinement*/
00107 #include "SundanceRefinementBase.hpp"
00108 #include "SundanceRefinementClass.hpp"
00109 
00110 /* Cell filters */
00111 #include "SundanceCellFilter.hpp"
00112 #include "SundanceMaximalCellFilter.hpp"
00113 #include "SundanceBoundaryCellFilter.hpp"
00114 #include "SundanceDimensionalCellFilter.hpp"
00115 #include "SundancePositionalCellPredicate.hpp"
00116 #include "SundanceDomainDefinition.hpp"
00117 
00118 /* Writers */
00119 #include "SundanceFieldWriter.hpp"
00120 #include "SundanceMatlabWriter.hpp"
00121 #include "SundanceVerboseFieldWriter.hpp"
00122 #include "SundanceTriangleWriter.hpp"
00123 #include "SundanceVTKWriter.hpp"
00124 #include "SundanceExodusWriter.hpp"
00125 
00126 
00127 /* FE  */
00128 #include "SundanceBasisFamily.hpp"
00129 #include "SundanceBernstein.hpp"
00130 #include "SundanceQuadratureFamily.hpp"
00131 #include "SundanceLagrange.hpp"
00132 #include "SundanceGaussianQuadrature.hpp"
00133 #include "SundanceFeketeQuadrature.hpp"
00134 
00135 /* Spectral */
00136 #include "SundanceHermiteSpectralBasis.hpp"
00137 
00138 /* Problem level classes */
00139 #include "SundanceCoordinateSystem.hpp"
00140 #include "SundanceLinearProblem.hpp"
00141 #include "SundanceLinearEigenproblem.hpp"
00142 #include "SundanceL2Projector.hpp"
00143 #include "SundanceNonlinearProblem.hpp"
00144 #include "SundanceFunctionalEvaluator.hpp"
00145 #include "SundanceFunctional.hpp"
00146 #include "SundanceRivaraDriver.hpp"
00147 #include "SundanceExprFieldWrapper.hpp"
00148 #include "SundanceNitscheBC.hpp"
00149 #include "SundanceBlock.hpp"
00150 
00151 
00152 /* Solvers & stuff */
00153 #include "TSFVectorType.hpp"
00154 #include "TSFEpetraVectorType.hpp"
00155 #include "TSFEpetraMatrixMatrixProduct.hpp"
00156 #include "TSFEpetraMatrixMatrixSum.hpp"
00157 #include "TSFEpetraMatrixOps.hpp"
00158 #include "TSFBICGSTABSolverDecl.hpp"
00159 #include "TSFAztecSolver.hpp"
00160 #include "TSFLinearSolverImpl.hpp"
00161 #include "TSFLinearCombinationImpl.hpp"
00162 #include "TSFLinearSolverBuilder.hpp"
00163 #include "TSFMLOperator.hpp"
00164 #include "TSFParameterListPreconditionerFactory.hpp"
00165 #include "SundancePCDPreconditioner.hpp"
00166 #include "TSFEpetraMatrixMatrixProduct.hpp"
00167 #include "TSFEpetraMatrixMatrixSum.hpp"
00168 #include "TSFEpetraMatrixOps.hpp"
00169 
00170 
00171 
00172 /* Nonlinear solvers */
00173 #include "NOX.H"
00174 #include "NOX_Common.H"
00175 #include "NOX_Utils.H"
00176 #include "TSFNOXSolver.H"
00177 
00178 /* Eigensolvers */
00179 #include "TSFAnasaziEigensolverDecl.hpp"
00180 #include "TSFEigensolver.hpp"
00181 
00182 
00183 /* Atomistic/continuum */
00184 #include "SundanceAToCDensitySampler.hpp"
00185 #include "SundanceCToAInterpolator.hpp"
00186 
00187 
00188 /* do explicit qualification of List to avoid conflicts
00189  * with the unfriendly lack of namespaces in MPI2C++
00190  */
00191 
00192 namespace Sundance
00193 {
00194 
00195 using namespace TSFExtendedOps;
00196 using namespace TSFExtended;
00197 using namespace Teuchos;
00198 using Sundance::List;
00199 
00200 
00201 /**
00202  * Class Sundance provides several static methods for
00203  * managing the environment of a simulation. Every simulation code
00204  * should begin with a call to Sundance::init() and end with
00205  * a call to Sundance::finalize().
00206  */
00207 class SundanceGlobal
00208 {
00209 public:
00210 
00211   /** */
00212   static void setOption(const std::string& optionName,
00213     int& value,
00214     const std::string& helpMsg);
00215 
00216   /** */
00217   static void setOption(const std::string& optionName,
00218     std::string& value,
00219     const std::string& helpMsg);
00220 
00221   /** */
00222   static void setOption(const std::string& optionName,
00223     double& value,
00224     const std::string& helpMsg);
00225 
00226   /** */
00227   static void setOption(const std::string& optionTrueName,
00228     const std::string& optionFalseName,
00229     bool& value,
00230     const std::string& helpMsg);
00231 
00232 
00233   /** 
00234    * Do initialization steps such as starting MPI (if necessary), 
00235    * parsing the Unix command
00236    * line, and reading runtime options from the configuration file.
00237    * MPI is initialized through a call to Teuchos::GlobalMPISession, 
00238    * which in turn checks whether MPI needs initialization and calls
00239    * MPI_Init() if necessary. If some other library you're using has
00240    * its own MPI initialization system, it is thus perfectly safe to
00241    * call Sundance::init() as well.
00242    */
00243   static int init(int* argc, char*** argv);
00244     
00245   /** 
00246    * Do finalization steps such as calling MPI_finalize() (if necessary),
00247    * and collecting and printing timing information.
00248    */
00249   static int finalize();
00250     
00251   /** */
00252   static void handleException(std::exception& e);
00253 
00254   /** */
00255   static Teuchos::FancyOStream& os() ;
00256 
00257 
00258   /** */
00259   static bool passFailTest(bool pass);
00260 
00261   /** */
00262   static bool passFailTest(double error, double tol);
00263 
00264   /** */
00265   static bool passFailTest(const std::string& statusMsg,
00266     bool status, double error, double tol);
00267 
00268 
00269   /** Set to true if a message should be written by each processor
00270    * at startup. */
00271   static bool& showStartupMessage();
00272 
00273   /** Decide whether to skip timing outputs to work around
00274    * a trilinos 6.0.x bug */
00275   static bool& skipTimingOutput()
00276     {static bool rtn=false; return rtn;}
00277 
00278   /** */
00279   static int& testStatus() {static int rtn = -1; return rtn;}
00280 
00281 
00282 
00283   static CommandLineProcessor& clp()
00284     {static CommandLineProcessor rtn; return rtn;}
00285 private:
00286   static bool checkTest(double error, double tol);
00287 
00288 
00289   static RCP<GlobalMPISession> globalMPISession(int* argc, char*** argv)
00290     {
00291       static RCP<GlobalMPISession> rtn 
00292         = rcp(new GlobalMPISession(argc, argv, &std::cerr)); 
00293       return rtn;
00294     }
00295 };
00296 
00297 
00298 /** \relates SundanceGlobal */
00299 void handleException(std::exception& e);
00300 
00301 /** \relates SundanceGlobal */
00302 bool passFailTest(bool pass);
00303 
00304 /** \relates SundanceGlobal */
00305 bool passFailTest(double error, double tol);
00306 
00307 /** \relates SundanceGlobal */
00308 bool passFailTest(const std::string& statusMsg,
00309   bool status, double error, double tol);
00310 
00311 /** \relates SundanceGlobal */
00312 int& testStatus() ;
00313 
00314 /** \relates SundanceGlobal */
00315 CommandLineProcessor& clp() ;
00316 
00317 /** \relates SundanceGlobal */
00318 int init(int* argc, char*** argv);
00319 
00320 /** \relates SundanceGlobal */
00321 int finalize();
00322 
00323 
00324 /** */
00325 void setOption(const std::string& optionName,
00326   int& value,
00327   const std::string& helpMsg);
00328 
00329 /** */
00330 void setOption(const std::string& optionName,
00331   std::string& value,
00332   const std::string& helpMsg);
00333 
00334 /** */
00335 void setOption(const std::string& optionName,
00336   double& value,
00337   const std::string& helpMsg);
00338 
00339 /** */
00340 void setOption(const std::string& optionTrueName,
00341   const std::string& optionFalseName,
00342   bool& value,
00343   const std::string& helpMsg);
00344 
00345 }
00346 
00347 
00348 
00349 
00350 #endif
00351 

Site Contact