Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

r12ia_memgrp.h

00001 //
00002 // r12ia_memgrp.h
00003 //
00004 // Copyright (C) 2002 Edward Valeev
00005 //
00006 // Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
00007 // Maintainer: EV
00008 //
00009 // This file is part of the SC Toolkit.
00010 //
00011 // The SC Toolkit is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Library General Public License as published by
00013 // the Free Software Foundation; either version 2, or (at your option)
00014 // any later version.
00015 //
00016 // The SC Toolkit is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Library General Public License
00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00024 //
00025 // The U.S. Government is granted a limited license as per AL 91-7.
00026 //
00027 
00028 #ifndef _chemistry_qc_mbptr12_r12ia_memgrp_h
00029 #define _chemistry_qc_mbptr12_r12ia_memgrp_h
00030 
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034 
00035 #include <util/ref/ref.h>
00036 #include <util/group/memory.h>
00037 #include <chemistry/qc/mbptr12/r12ia.h>
00038 
00039 namespace sc {
00040 
00042 // R12IntsAcc_MemoryGrp handles transformed integrals held in memory
00043 // by MemoryGrp
00044 //
00045 // The ordering of integrals in MemoryGrp buffers is not specified
00046 // to avoid having to reorder integrals
00047 // Each pair block has size of num_te_types*nbasis1*nbasis2
00048 
00049 class R12IntsAcc_MemoryGrp: public R12IntsAcc {
00050 
00051     Ref<MemoryGrp> mem_; // The MemoryGrp used by this accumulator to store integrals
00052     int nproc_;
00053 
00054     struct PairBlkInfo {
00055       double *ints_[max_num_te_types_];         // blocks corresponding to each operator type
00056       int refcount_[max_num_te_types_];          // number of references
00057       distsize_t offset_;    // global Memgrp offset in bytes
00058     } *pairblk_;
00059 
00060   public:
00061     R12IntsAcc_MemoryGrp(Ref<MemoryGrp>&, int num_te_types, int nbasis1, int nbasis2, int nocc, int nfzc);
00062     ~R12IntsAcc_MemoryGrp();
00063 
00067     void store_memorygrp(Ref<MemoryGrp>& mem, int ni);
00069     void store_pair_block(int i, int j, double *ints);
00072     void deactivate();
00074     double* retrieve_pair_block(int i, int j, tbint_type oper_type);
00076     void release_pair_block(int i, int j, tbint_type oper_type);
00078     bool is_local(int i, int j) const { return (ij_proc(i,j) == mem_->me());};
00080     bool is_avail(int i, int j) const { return true;};
00082     bool has_access(int proc) const { return true;};
00084     bool can_restart() const { return false; };
00085 
00086     // Utility functions
00087     int ij_index(int i, int j) const { return i*nocc_act_ + j; };
00088     int ij_proc(int i, int j) const { return ij_index(i,j)%nproc_;};
00089 };
00090 
00091 }
00092 
00093 #endif
00094 
00095 // Local Variables:
00096 // mode: c++
00097 // c-file-style: "CLJ"
00098 // End:

Generated at Fri Dec 26 11:16:33 2003 for MPQC 2.2.1 using the documentation package Doxygen 1.2.14.