Skip to content
Snippets Groups Projects
FiniteElemSpace.h 3.26 KiB
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ==  http://www.amdis-fem.org                                              ==
// ==                                                                        ==
// ============================================================================
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.



/** \file FiniteElemSpace.h */

/** \defgroup FEMSpace FEMSpace
 * @{ <img src="femspace.png"> @}
 */

#ifndef AMDIS_FINITEELEMSPACE_H
#define AMDIS_FINITEELEMSPACE_H

#include <string>
#include <vector>
#include "AMDiS_fwd.h"

namespace AMDiS {

  using namespace std;

  /** \ingroup FEMSpace
   * \brief
   * A FiniteElemSpace is a triple of a DOFAdmin and a set of BasisFunction on a mesh.
   */
  class FiniteElemSpace
  {
  public:
    /// Create an empty fe space.
    FiniteElemSpace();

    ///
    static FiniteElemSpace *provideFeSpace(DOFAdmin *admin,
					   const BasisFunction *basFcts,
					   Mesh *mesh,
					   string name = "");

#if DEBUG
    /// For debugging it may be useful to get some FE space for a given mesh at a 
    /// position in code where it is not possible to access the FE space directly. The
    /// function assumes that there is only one FE space defined for the mesh.

    static FiniteElemSpace *provideFeSpace(Mesh *mesh);
#endif

    /// Destructor.
    ~FiniteElemSpace();
    
    FiniteElemSpace& operator=(const FiniteElemSpace& feSpace);

    /// Returns \ref name.
    inline string getName() const 
    { 
      return name;
    }

    /// Returns \ref admin.
    inline DOFAdmin* getAdmin() const 
    { 
      return admin;
    }

    /// Set a new DOF admin.
    inline void setAdmin(DOFAdmin* a) 
    {
      admin = a;
    }

    /// Returns \ref basFcts
    inline const BasisFunction* getBasisFcts() const 
    { 
      return basFcts;
    }

    /// Returns \ref mesh
    inline Mesh* getMesh() const 
    { 
      return mesh; 
    }

    int calcMemoryUsage();

    static void clear();

    /// Returns for a set of FE spaces that FE space having basis functions with
    /// the highest degree.
    static const FiniteElemSpace* 
    getHighest(vector<const FiniteElemSpace*>& feSpaces);
  
  protected:
    /** \brief
     * Constructs a FiniteElemSpace with name name_ and the given DOFAdmin,
     * BasisFunction and Mesh.
     */
    FiniteElemSpace(DOFAdmin* admin,
		    const BasisFunction* basisFcts, 
		    Mesh* mesh,
		    string name = "");

  protected:
    /// Name of this FiniteElemSpace.
    const string name;

    /// DOFAdmin corresponding to this FiniteElemSpace.
    DOFAdmin* admin;

    /// Set of BasisFunction of this FiniteElemSpace.
    const BasisFunction* basFcts;

    /// The Mesh this FiniteElemSpace belongs to.
    Mesh* mesh;

    ///
    static vector<FiniteElemSpace*> feSpaces;
  };

}

#endif  // !_FINITEELEMSPACE_H_