MPQC 2.3.1

- Main Page
- Related Pages
- Classes
- Files

- File List

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     size_t blksize_memgrp_;  // The size of the ij-block in held memory (may be larger than blksize_)
    00054
    00055     struct PairBlkInfo {
    00056       double *ints_[max_num_te_types_];         // blocks corresponding to each operator type
    00057       int refcount_[max_num_te_types_];          // number of references
    00058       distsize_t offset_;    // global Memgrp offset in bytes
    00059     } *pairblk_;
    00060
    00061     // Initialization tasks common to all constructors
    00062     void init();
    00064     int ntasks() const { return mem_->n(); }
    00066     int taskid() const { return mem_->me(); }
    00067
    00068   public:
    00069     R12IntsAcc_MemoryGrp(Ref<MemoryGrp>&, int num_te_types, int ni, int nj, int nx, int ny);
    00070     R12IntsAcc_MemoryGrp(StateIn&);
    00071     ~R12IntsAcc_MemoryGrp();
    00072     void save_data_state(StateOut&);
    00073
    00079     void store_memorygrp(Ref<MemoryGrp>& mem, int ni, const size_t blksize);
    00081     void store_pair_block(int i, int j, double *ints);
    00084     void deactivate();
    00086     double* retrieve_pair_block(int i, int j, tbint_type oper_type);
    00088     void release_pair_block(int i, int j, tbint_type oper_type);
    00090     bool is_local(int i, int j) const { return (ij_proc(i,j) == mem_->me());};
    00092     bool is_avail(int i, int j) const { return true;};
    00094     bool has_access(int proc) const { return true;};
    00096     bool can_restart() const { return false; };
    00097
    00098     // Utility functions
    00099     int ij_index(int i, int j) const { return i*nj_ + j; };
    00100     int ij_proc(int i, int j) const { return ij_index(i,j)%nproc_;};
    00101 };
    00102
    00103 }
    00104
    00105 #endif
    00106
    00107 // Local Variables:
    00108 // mode: c++
    00109 // c-file-style: "CLJ"
    00110 // End: