aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vasp/source/opbase.h
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-03-17 04:36:54 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-03-17 04:36:54 +0000
commit3eb7ec9a67e867275b862f9947deafe387012819 (patch)
tree6fd9d9f37721cdd28197ee5c54a3546060bd58af /externals/grill/vasp/source/opbase.h
parentbc6f43fbe1b22b1c2c63a32372126e0eaaaa08b0 (diff)
""
svn path=/trunk/; revision=476
Diffstat (limited to 'externals/grill/vasp/source/opbase.h')
-rw-r--r--externals/grill/vasp/source/opbase.h90
1 files changed, 13 insertions, 77 deletions
diff --git a/externals/grill/vasp/source/opbase.h b/externals/grill/vasp/source/opbase.h
index 3d9b81c6..bba4a3a6 100644
--- a/externals/grill/vasp/source/opbase.h
+++ b/externals/grill/vasp/source/opbase.h
@@ -16,96 +16,32 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "vecblk.h"
#include "opparam.h"
-namespace VecOp {
- typedef BL opfun(OpParam &p);
-
- class C_base {
- public:
- #ifdef FLEXT_THREADS
- static flext::ThrMutex mtx;
- static V Lock() { mtx.Lock(); }
- static V Unlock() { mtx.Unlock(); }
- #else
- static V Lock() {}
- static V Unlock() {}
- #endif
- };
-
- template<class T> class C_run: public C_base {
- public:
- static BL Do(V f(T &v,T a),OpParam &p) { Lock(); fun = f; _D__run<T,C_run<T> >(p); Unlock(); return true; }
- static V run(T &v,T a) { fun(v,a); }
- static V (*fun)(T &v,T a);
- };
- template<class T> V (*C_run<T>::fun)(T &v,T a);
-
- template<class T> class C_cun: public C_base {
- public:
- static BL Do(V f(T &rv,T &iv,T ra,T ia),OpParam &p) { Lock(); fun = f; _D__cun<T,C_cun<T> >(p); Unlock(); return true; }
- static V cun(T &rv,T &iv,T ra,T ia) { fun(rv,iv,ra,ia); }
- static V (*fun)(T &rv,T &iv,T ra,T ia);
- };
- template<class T> V (*C_cun<T>::fun)(T &rv,T &iv,T ra,T ia);
-
- template<class T> class C_rbin: public C_base {
- public:
- static BL Do(V f(T &v,T a,T b),OpParam &p) { Lock(); fun = f; _D__rbin<T,C_rbin<T> >(p); Unlock(); return true; }
- static V rbin(T &v,T a,T b) { fun(v,a,b); }
- static V (*fun)(T &v,T a,T b);
- };
- template<class T> V (*C_rbin<T>::fun)(T &v,T a,T b);
-
- template<class T> class C_cbin: public C_base {
- public:
- static BL Do(V f(T &rv,T &iv,T ra,T ia,T rb,T ib),OpParam &p) { Lock(); fun = f; _D__cbin<T,C_cbin<T> >(p); Unlock(); return true; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T ib) { fun(rv,iv,ra,ia,rb,ib); }
- static V (*fun)(T &rv,T &iv,T ra,T ia,T rb,T ib);
- };
- template<class T> V (*C_cbin<T>::fun)(T &rv,T &iv,T ra,T ia,T rb,T ib);
-
- template<class T> class C_rop: public C_base {
- public:
- static BL Do(V f(T &v,T a,OpParam &p),OpParam &p) { Lock(); fun = f; _D__rop<T,C_rop<T> >(p); Unlock(); return true; }
- static V rop(T &v,T a,OpParam &p) { fun(v,a,p); }
- static V (*fun)(T &v,T a,OpParam &p);
- };
- template<class T> V (*C_rop<T>::fun)(T &v,T a,OpParam &p);
-
- template<class T> class C_cop: public C_base {
- public:
- static BL Do(V f(T &rv,T &iv,T ra,T ia,OpParam &p),OpParam &p) { Lock(); fun = f; _D__cop<T,C_cop<T> >(p); Unlock(); return true; }
- static V cop(T &rv,T &iv,T ra,T ia,OpParam &p) { fun(rv,iv,ra,ia,p); }
- static V (*fun)(T &rv,T &iv,T ra,T ia,OpParam &p);
- };
- template<class T> V (*C_cop<T>::fun)(T &rv,T &iv,T ra,T ia,OpParam &p);
+namespace VaspOp {
+ typedef BL opfun(OpParam &p);
- template<class T> BL _d__run(V fun(T &v,T a),OpParam &p) { return C_run<T>::Do(fun,p); }
- template<class T> BL _d__cun(V fun(T &rv,T &iv,T ra,T ia),OpParam &p) { return C_cun<T>::Do(fun,p); }
- template<class T> BL _d__rbin(V fun(T &v,T a,T b),OpParam &p) { return C_rbin<T>::Do(fun,p); }
- template<class T> BL _d__cbin(V fun(T &rv,T &iv,T ra,T ia,T rb,T ib),OpParam &p) { return C_cbin<T>::Do(fun,p); }
- template<class T> BL _d__rop(V fun(T &v,T a,OpParam &p),OpParam &p) { return C_rop<T>::Do(fun,p); }
- template<class T> BL _d__cop(V fun(T &rv,T &iv,T ra,T ia,OpParam &p),OpParam &p) { return C_cop<T>::Do(fun,p); }
-}
-
+ // -------- prepare vectors and do vector operation -----------
+ // in opvecs.cpp
-namespace VaspOp {
RVecBlock *GetRVecs(const C *op,CVasp &src,CVasp *dst = NULL);
CVecBlock *GetCVecs(const C *op,CVasp &src,CVasp *dst = NULL,BL full = false);
RVecBlock *GetRVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst = NULL,I multi = -1,BL ssize = true);
CVecBlock *GetCVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst = NULL,I multi = -1,BL ssize = true,BL full = false);
- Vasp *DoOp(RVecBlock *vecs,VecOp::opfun *fun,OpParam &p,BL symm = false);
- Vasp *DoOp(CVecBlock *vecs,VecOp::opfun *fun,OpParam &p,BL symm = false);
+ Vasp *DoOp(RVecBlock *vecs,opfun *fun,OpParam &p,BL symm = false);
+ Vasp *DoOp(CVecBlock *vecs,opfun *fun,OpParam &p,BL symm = false);
// -------- transformations -----------------------------------
+ // in opbase.cpp
// unary functions
- Vasp *m_run(OpParam &p,CVasp &src,CVasp *dst,VecOp::opfun fun); // real unary (one vec or real)
- Vasp *m_cun(OpParam &p,CVasp &src,CVasp *dst,VecOp::opfun fun); // complex unary (one vec or complex)
+ Vasp *m_run(OpParam &p,CVasp &src,CVasp *dst,opfun fun); // real unary (one vec or real)
+ Vasp *m_cun(OpParam &p,CVasp &src,CVasp *dst,opfun fun); // complex unary (one vec or complex)
+
// binary functions
- Vasp *m_rbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,VecOp::opfun fun); // real binary (one vec or real)
- Vasp *m_cbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,VecOp::opfun fun); // complex binary (one vec or complex)
+ Vasp *m_rbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,opfun fun); // real binary (one vec or real)
+ Vasp *m_cbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,opfun fun); // complex binary (one vec or complex)
+
}
#endif