SundanceRegionQuadCombo.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_REGIONQUADCOMBO_H
00032 #define SUNDANCE_REGIONQUADCOMBO_H
00033 
00034 
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceMap.hpp"
00037 #include "Teuchos_Utils.hpp"
00038 #include "SundanceWatchFlag.hpp"
00039 #include "SundanceCellFilterStub.hpp"
00040 #include "SundanceQuadratureFamilyStub.hpp"
00041 #include "SundanceOrderedTuple.hpp"
00042 #include "SundanceOrderedHandle.hpp"
00043 #include "SundanceParametrizedCurve.hpp"
00044 
00045 
00046 namespace Sundance
00047 {
00048 using namespace Teuchos;
00049 
00050 /** */
00051 typedef OrderedTriple<OrderedHandle<CellFilterStub>,
00052                       OrderedHandle<QuadratureFamilyStub>,
00053                       WatchFlag> RegTriple;
00054 /** 
00055  * Expressions may appear in more than one subregions of a problem,
00056  * for instance in an internal domain and also on a boundary. On
00057  * those different subregions, a given expression might be subject
00058  * to different sets of functional derivatives; thus, different
00059  * evaluation regions might have different sparsity patterns. 
00060  * It is therefore necessary to build and store
00061  * sparsity information on a region-by-region basis. 
00062  *
00063  * Class RegionQuadCombo is used as an identifier for regions. The
00064  * only thing it needs to do is to be useable as a key in a STL map.
00065  */
00066 class RegionQuadCombo 
00067 {
00068 public:
00069   /** */
00070   RegionQuadCombo();
00071 
00072   /** */
00073   RegionQuadCombo(const RCP<CellFilterStub>& domain,
00074     const RCP<QuadratureFamilyStub>& quad,
00075     const ParametrizedCurve& paramCurve = ParametrizedCurve::returnDummyCurve(),
00076     const WatchFlag& watch = WatchFlag());
00077 
00078 
00079   /** */
00080   inline bool operator==(const RegionQuadCombo& other) const
00081     {return id_==other.id_;}
00082 
00083   /** */
00084   std::string toString() const ;
00085 
00086   /** */
00087   bool operator<(const RegionQuadCombo& other) const
00088     {return id_ < other.id_;}
00089 
00090   /** */
00091   const RCP<CellFilterStub>& domain() const {return domain_;}
00092 
00093   /** */
00094   const RCP<QuadratureFamilyStub>& quad() const 
00095     {return quad_;}
00096 
00097   /** */
00098   const WatchFlag& watch() const 
00099     {return watch_;}
00100 
00101   /** */
00102    const ParametrizedCurve& paramCurve() const
00103      {return paramCurve_;}
00104 
00105 private:
00106 
00107   /** */
00108   int id_;
00109 
00110   /** */
00111   RCP<CellFilterStub> domain_;
00112 
00113   /** */
00114   RCP<QuadratureFamilyStub> quad_;
00115 
00116   /** Such RQC might have one curve */
00117   ParametrizedCurve paramCurve_;
00118 
00119   /** */
00120   WatchFlag watch_;
00121           
00122   /** */
00123   static int getID(const RCP<CellFilterStub>& domain,
00124     const RCP<QuadratureFamilyStub>& quad,
00125     const WatchFlag& watch);
00126 
00127   /** */
00128   static int topID() {static int rtn=0; return rtn++;}
00129 
00130   /** */
00131   static Map<RegTriple, int>& domainAndQuadToIDMap() ;
00132 };
00133 
00134 }
00135 
00136 namespace std
00137 {
00138 /** \relates Sundance::RegionQuadCombo*/
00139 inline ostream& operator<<(std::ostream& os, 
00140   const Sundance::RegionQuadCombo& c)
00141 {
00142   os << c.toString();
00143   return os;
00144 }
00145 }
00146 
00147 namespace Teuchos
00148 {
00149 /** \relates Sundance::RegionQuadCombo */
00150 inline std::string toString(const Sundance::RegionQuadCombo& h)
00151 {return h.toString();}
00152 
00153 }
00154 
00155 #endif

Site Contact