PSCF v1.5.0
Compressor.h
1#ifndef RP_COMPRESSOR_H
2#define RP_COMPRESSOR_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <util/param/ParamComposite.h> // base class
12#include <pscf/backend/TmplDeclare.h> // preprocessor macros
13#include <util/global.h>
14
15// Forward declarations
16namespace Pscf {
17 namespace Rp {
18 template <int D, class T> class System;
19 }
20}
21
22namespace Pscf {
23namespace Rp {
24
25
26 using namespace Util;
27
33 template <int D, class T>
35 {
36
37 public:
38
42 Compressor();
43
50
54 virtual ~Compressor() = default;
55
61 virtual int compress() = 0;
62
71 virtual void clearCache()
72 {}
73
79 virtual void outputTimers(std::ostream& out) const = 0;
80
84 virtual void clearTimers() = 0;
85
89 int mdeCounter() const;
90
91 protected:
92
99
103 System<D,T> const & system() const;
104
109
114
115 private:
116
118 System<D,T>* sysPtr_;
119
120 };
121
122 // Member functions (all inline)
123
124 /*
125 * Return parent system by const reference.
126 */
127 template <int D, class T> inline
129 {
130 UTIL_ASSERT(sysPtr_);
131 return *sysPtr_;
132 }
133
134 /*
135 * Return parent system by non-const reference.
136 */
137 template <int D, class T> inline
139 {
140 UTIL_ASSERT(sysPtr_);
141 return *sysPtr_;
142 }
143
144 // Explicit instantation declarations
145 PSCF_TMPL_DECLARE(Compressor)
146
147} // namespace Rp
148} // namespace Pscf
149#endif
Base class for iterators that impose incompressibility.
Definition Compressor.h:35
virtual void clearCache()
Discard internal data used by the compressor.
Definition Compressor.h:71
void setSystem(System< D, T > &system)
Create association with the parent System.
Compressor()
Default constructor.
virtual void outputTimers(std::ostream &out) const =0
Output report of timing results to stream.
System< D, T > const & system() const
Return parent system by const reference.
Definition Compressor.h:128
virtual void clearTimers()=0
Clear timers.
int mdeCounter() const
Get the number of times the MDE has been solved.
int mdeCounter_
Count how many times MDE has been solved.
Definition Compressor.h:113
virtual int compress()=0
Iterate Langrange multiplier field.
virtual ~Compressor()=default
Destructor.
Base class template for classes that represent a complete system.
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
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.