v0.8.16
AuxPETSc.hpp
Go to the documentation of this file.
1 /** \file AuxPETSc.hpp
2  * \brief Auxuliary MoFEM-PETSc structures
3  */
4 
5 /* This file is part of MoFEM.
6  * MoFEM is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
18 
19 #ifndef __AUXPETSC_HPP__
20 #define __AUXPETSC_HPP__
21 
22 namespace MoFEM {
23 
24  struct PairNameFEMethodPtr: public std::pair<std::string,FEMethod*> {
25  PairNameFEMethodPtr(std::string name,FEMethod *ptr):
26  std::pair<std::string,FEMethod*>(name,ptr) {
27  }
28  PairNameFEMethodPtr(std::string name,boost::shared_ptr<FEMethod>& ptr):
29  std::pair<std::string,FEMethod*>(name,ptr.get()),
30  fePtr(ptr) {
31  }
32  virtual ~PairNameFEMethodPtr() {}
33  private:
34  boost::shared_ptr<FEMethod> fePtr;
35  };
36 
37  struct BasicMethodPtr {
39  rawPtr(ptr) {}
40  BasicMethodPtr(boost::shared_ptr<BasicMethod>& ptr):
41  rawPtr(ptr.get()),
42  bmPtr(ptr) {}
43  BasicMethodPtr(boost::shared_ptr<FEMethod>& ptr):
44  rawPtr(ptr.get()),
45  bmPtr(ptr) {}
46  inline BasicMethod& operator*() const { return *rawPtr; };
47  inline BasicMethod* operator->() const { return rawPtr; }
48  private:
50  boost::shared_ptr<BasicMethod> bmPtr;
51  };
52 
53  typedef std::vector<PairNameFEMethodPtr> FEMethodsSequence;
54  typedef std::vector<BasicMethodPtr> BasicMethodsSequence;
55 
56 }
57 
58 #endif // __AUXPETSC_HPP__
BasicMethodPtr(BasicMethod *ptr)
Definition: AuxPETSc.hpp:38
structure for User Loop Methods on finite elementsIt can be used to calculate stiffness matrices...
virtual ~PairNameFEMethodPtr()
Definition: AuxPETSc.hpp:32
STL namespace.
BasicMethodPtr(boost::shared_ptr< FEMethod > &ptr)
Definition: AuxPETSc.hpp:43
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
BasicMethod * rawPtr
Definition: AuxPETSc.hpp:49
std::vector< BasicMethodPtr > BasicMethodsSequence
Definition: AuxPETSc.hpp:54
PairNameFEMethodPtr(std::string name, boost::shared_ptr< FEMethod > &ptr)
Definition: AuxPETSc.hpp:28
BasicMethodPtr(boost::shared_ptr< BasicMethod > &ptr)
Definition: AuxPETSc.hpp:40
std::vector< PairNameFEMethodPtr > FEMethodsSequence
Definition: AuxPETSc.hpp:53
BasicMethod * operator->() const
Definition: AuxPETSc.hpp:47
boost::shared_ptr< BasicMethod > bmPtr
Definition: AuxPETSc.hpp:50
boost::shared_ptr< FEMethod > fePtr
Definition: AuxPETSc.hpp:34
Data structure to exchange data between mofem and User Loop Methods.It allows to exchange data betwee...
BasicMethod & operator*() const
Definition: AuxPETSc.hpp:46
PairNameFEMethodPtr(std::string name, FEMethod *ptr)
Definition: AuxPETSc.hpp:25