Actual source code: Coaster.hh
1: #ifndef included_ALE_Coaster_hh
2: #define included_ALE_Coaster_hh
4: #include <petsc.h>
6: #ifndef included_ALE_hh
7: #include <ALE.hh>
8: #endif
10: namespace ALE {
12: // Base class for all distributed ALE classes
13: class Coaster {
14: protected:
15: //
16: MPI_Comm comm;
17: int32_t commRank;
18: int32_t commSize;
19: PetscObject petscObj;
20: int32_t verbosity;
21: int _lock;
22: void __checkLock(){if(this->_lock > 0) {throw(ALE::Exception("Mutating method attempted on a locked Coaster"));}};
23: public:
24: //
25: Coaster() : petscObj(NULL) {this->clear();};
26: Coaster(MPI_Comm c) : petscObj(NULL) {this->clear(); this->setComm(c);};
27: Coaster(const Coaster& coaster);
28: virtual ~Coaster(){this->clear();};
29: //
30: virtual Coaster& clear();
31: virtual Coaster& getLock();
32: virtual Coaster& releaseLock();
33: virtual bool isLocked(){return (this->_lock > 0);};
34: virtual void assertLock(bool status);
35: //
36: virtual void setComm(MPI_Comm comm);
37: MPI_Comm getComm() const{ return this->comm;};
38: int32_t getCommSize() const {return this->commSize;};
39: int32_t getCommRank() const {return this->commRank;};
40: void setVerbosity(int32_t v){this->verbosity = v;};
41: int32_t getVerbosity() const {return this->verbosity;};
42: virtual void view(const char *name);
43: //
44: friend void CHKCOMM(Coaster& obj);
45: friend void CHKCOMMS(Coaster& obj1, Coaster& obj2);
46: };
47: } // namespace ALE
49: #endif