PSCF v1.5.0
RGridTrajectoryReader.h
1#ifndef RP_RGRID_TRAJECTORY_READER_H
2#define RP_RGRID_TRAJECTORY_READER_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 "TrajectoryReader.h" // base class
12#include <pscf/field/RField.h> // member
13#include <pscf/math/IntVec.h> // member
14#include <util/containers/DArray.h> // member
15
16#include <pscf/backend/TmplDeclare.h>
17#include <fstream>
18#include <string>
19
20namespace Pscf {
21namespace Rp {
22
23 using namespace Util;
24
35 template <int D, class T>
37 {
38
39 public:
40
47
52
63 void open(std::string filename) override;
64
68 void readHeader() override;
69
75 bool readFrame() override;
76
80 void close() override;
81
82 protected:
83
84 using TrajectoryReader<D,T>::system;
85
86 private:
87
88 // Field configuration
89 DArray< RField<D,T> > wField_;
90
91 // Dimensions of computational mesh (# of points in each direction)
92 IntVec<D> meshDimensions_;
93
94 // Trajectory file.
95 std::ifstream inputfile_;
96
97 // Has wField_ been allocated?
98 bool isAllocated_;
99
103 void allocate();
104
105 };
106
107 // Explicit instantiation declarations
108 PSCF_TMPL_DECLARE(RGridTrajectoryReader)
109
110}
111}
112#endif
An IntVec<D, T> is a D-component vector of elements of integer type T.
Definition IntVec.h:27
bool readFrame() override
Read a single frame from the trajectory file.
RGridTrajectoryReader(System< D, T > &system)
Constructor.
void readHeader() override
Read header of trajectory file (if any).
void close() override
Close the trajectory file.
~RGridTrajectoryReader()=default
Destructor.
void open(std::string filename) override
Open trajectory file and read header, if any.
Base class template for classes that represent a complete system.
TrajectoryReader(System< D, T > &system)
Constructor.
System< D, T > & system()
Return reference to parent system.
Dynamically allocatable contiguous array template.
Definition DArray.h:32
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.