MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
distarray4_node0file.h
1//
2// distarray4_node0file.h
3//
4// Copyright (C) 2002 Edward Valeev
5//
6// Author: Edward Valeev <evaleev@vt.edu>
7// Maintainer: EV
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifndef _chemistry_qc_mbptr12_distarray4_node0file_h
29#define _chemistry_qc_mbptr12_distarray4_node0file_h
30
31#include <unistd.h>
32#include <util/ref/ref.h>
33#include <util/group/memory.h>
34#include <util/misc/registry.h>
35#include <math/distarray4/distarray4.h>
36
37namespace sc {
38
40
53
54 char *filename_;
55 int datafile_;
56
57 // keep track of clones of this object to be able to create unique names
59 Ref<ListOfClones> clonelist_;
60 void set_clonelist(const Ref<ListOfClones>& cl);
61
62 struct PairBlkInfo {
63 // mutable since this data is only cached. offset is the only real data.
64 mutable double* ints_[max_num_te_types]; // blocks corresponding to each operator type
65 mutable bool manage_[max_num_te_types]; // is the buffer managed by me?
66 mutable int refcount_[max_num_te_types]; // number of references
67 off_t offset_; // location in file (in bytes)
68 };
69 PairBlkInfo* pairblk_;
70
72 void init(bool restart);
73 // Check if the file operation went OK
74 void check_filedescr_();
75 // Utility functions
76 int ij_proc(int i, int j) const { return 0;};
77
78 public:
79 DistArray4_Node0File(const char *filename, int num_te_types, int ni, int nj, int nx, int ny,
80 DistArray4Storage storage = DistArray4Storage_XY);
84
85 Ref<DistArray4> clone(const DistArray4Dimensions& dim = DistArray4Dimensions::default_dim());
86
88 void activate();
90 void deactivate();
92 bool data_persistent() const { return true; }
93
94 void store_pair_block(int i, int j, tbint_type oper_type, const double* ints);
95 void store_pair_subblock(int i, int j, tbint_type oper_type,
96 int xstart, int xfence, int ystart, int yfence,
97 const double* ints);
98 const double* retrieve_pair_block(int i, int j, tbint_type oper_type, double* buf = 0) const;
99 void retrieve_pair_subblock(int i, int j, tbint_type oper_type,
100 int xstart, int xfence, int ystart, int yfence,
101 double* buf) const;
103 void release_pair_block(int i, int j, tbint_type oper_type) const;
104
106 bool is_local(int i, int j) const { return (me() == 0);};
108 bool is_avail(int i, int j) const { return (me() == 0);};
110 bool has_access(int proc) const { return (proc == 0);};
111};
112
113}
114
115#endif
116
117// Local Variables:
118// mode: c++
119// c-file-style: "CLJ"
120// End:
DistArray4_Node0File handles transformed integrals stored in file on node 0 (file is a usual POSIX bi...
Definition distarray4_node0file.h:52
void activate()
implementation of DistArray4::activate()
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
void retrieve_pair_subblock(int i, int j, tbint_type oper_type, int xstart, int xfence, int ystart, int yfence, double *buf) const
Retrieves a rectangular subblock of ij block of integrals.
bool is_local(int i, int j) const
Is this block stored locally?
Definition distarray4_node0file.h:106
void store_pair_block(int i, int j, tbint_type oper_type, const double *ints)
Stores an ij pair block of integrals.
void store_pair_subblock(int i, int j, tbint_type oper_type, int xstart, int xfence, int ystart, int yfence, const double *ints)
Stores an rectangular subblock of ij block of integrals.
bool data_persistent() const
implementation of DistArray4::data_persistent()
Definition distarray4_node0file.h:92
void deactivate()
implementation of DistArray4::deactivate()
void release_pair_block(int i, int j, tbint_type oper_type) const
Releases an ij pair block of integrals.
bool is_avail(int i, int j) const
In this implementation blocks are available only on node 0.
Definition distarray4_node0file.h:108
bool has_access(int proc) const
Does this task have access to all the integrals?
Definition distarray4_node0file.h:110
const double * retrieve_pair_block(int i, int j, tbint_type oper_type, double *buf=0) const
Retrieves an ij block of integrals.
Ref< DistArray4 > clone(const DistArray4Dimensions &dim=DistArray4Dimensions::default_dim())
how to clone.
DistArray4 contains a set of one or more distributed dense 4-index arrays.
Definition distarray4.h:94
const DistArray4Storage & storage() const
physical storage of the integrals. The default storage is XY. Storage is not mutable.
Definition distarray4.h:122
int nj() const
Rank of index space j.
Definition distarray4.h:116
int ny() const
Rank of index space y.
Definition distarray4.h:120
unsigned int tbint_type
Types of two-body operators that DistArray4 understands.
Definition distarray4.h:108
int nx() const
Rank of index space x.
Definition distarray4.h:118
int ni() const
Rank of index space i.
Definition distarray4.h:114
int num_te_types() const
The number of types of integrals that are being handled together.
Definition distarray4.h:112
int me() const
rank of this task
Definition distarray4.h:200
A template class that maintains references counts.
Definition ref.h:361
Registry wraps std::map and can be policy-configured to act as a Singleton or a regular object.
Definition registry.h:112
Restores fundamental and user-defined types from images created with StateOut.
Definition statein.h:79
Serializes fundamental and user-defined types.
Definition stateout.h:71
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
Definition distarray4.h:43

Generated at Wed Sep 25 2024 02:45:30 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.