PSCF v1.3.2
rpc/fts/compressor/Compressor.h
1#ifndef RPC_COMPRESSOR_H
2#define RPC_COMPRESSOR_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <util/param/ParamComposite.h> // base class
12#include <util/global.h>
13
14namespace Pscf {
15namespace Rpc
16{
17
18 template <int D> class System;
19
20 using namespace Util;
21
27 template <int D>
29 {
30
31 public:
32
36 Compressor();
37
44
49
55 virtual int compress() = 0;
56
62 virtual void outputTimers(std::ostream& out) const = 0;
63
67 virtual void clearTimers() = 0;
68
72 int mdeCounter() const;
73
74 protected:
75
79 System<D> const & system() const
80 {
81 UTIL_ASSERT(sysPtr_);
82 return *sysPtr_;
83 }
84
89 {
90 UTIL_ASSERT(sysPtr_);
91 return *sysPtr_;
92 }
93
98
99 private:
100
102 System<D>* sysPtr_;
103
104 };
105
106 // Member functions
107
108 // Default constructor.
109 template <int D>
111 : mdeCounter_(0),
112 sysPtr_(nullptr)
113 { setClassName("Compressor"); }
114
115 // Constructor.
116 template <int D>
118 : mdeCounter_(0),
119 sysPtr_(&system)
120 { setClassName("Compressor"); }
121
122 // Destructor
123 template <int D>
126
127 // Get number of times MDE has been solved.
128 template <int D>
129 inline int Compressor<D>::mdeCounter() const
130 { return mdeCounter_; }
131
132} // namespace Rpc
133} // namespace Pscf
134#endif
System< D > const & system() const
Return const reference to parent system.
System< D > & system()
Return non-const reference to parent system.
virtual void clearTimers()=0
Clear timers.
virtual void outputTimers(std::ostream &out) const =0
Output report of timing results to stream.
int mdeCounter_
Count how many times MDE has been solved.
int mdeCounter() const
Get the number of times the MDE has been solved.
virtual int compress()=0
Iterate Langrange multiplier field.
Main class, representing a complete physical system.
void setClassName(const char *className)
Set class name string.
ParamComposite()
Constructor.
File containing preprocessor macros for error handling.
#define UTIL_ASSERT(condition)
Assertion macro suitable for debugging serial or parallel code.
Definition global.h:75
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.