PSCF v1.1
|
Read and write fields to file. More...
#include <FieldIo.h>
Public Member Functions | |
FieldIo () | |
Constructor. More... | |
~FieldIo () | |
Destructor. More... | |
void | associate (Domain const &domain, FileMaster const &fileMaster) |
Get and store addresses of associated objects. More... | |
void | readFields (DArray< Field > &fields, std::istream &in) |
Read a set of fields, one per monomer type. More... | |
void | readFields (DArray< Field > &fields, std::string const &filename) |
Read a set of fields, one per monomer type. More... | |
void | writeField (Field const &field, std::ostream &out, bool writeHeader=true) const |
Write a single field to an output stream. More... | |
void | writeField (Field const &field, std::string const &filename, bool writeHeader=true) const |
Write a single field to a file. More... | |
void | writeFields (DArray< Field > const &fields, std::ostream &out, bool writeHeader=true) |
Write a set of fields, one per monomer type, to an output stream. More... | |
void | writeFields (DArray< Field > const &fields, std::string const &filename, bool writeHeader=true) |
Write a set of fields, one per monomer type, to a named file. More... | |
void | writeBlockCFields (Mixture const &mixture, std::ostream &out) |
Write block concentration fields for all blocks to an output stream. More... | |
void | writeBlockCFields (Mixture const &mixture, std::string const &filename) |
Write block concentration fields for all blocks to a named file. More... | |
void | writeVertexQ (Mixture const &mixture, int polymerId, int vertexId, std::ostream &out) |
Write product of incoming q fields for one vertex to stream. More... | |
void | writeVertexQ (Mixture const &mixture, int polymerId, int vertexId, std::string const &filename) |
Write incoming q fields for a specified vertex. More... | |
void | remesh (DArray< Field > const &fields, int nx, std::ostream &out) |
Interpolate an array of fields onto a new mesh and write to stream. More... | |
void | remesh (DArray< Field > const &fields, int nx, std::string const &filename) |
Interpolate an array of fields onto a new mesh and write to file. More... | |
void | extend (DArray< Field > const &fields, int m, std::ostream &out) |
Add points to the end of a field mesh and write to stream. More... | |
void | extend (DArray< Field > const &fields, int m, std::string const &filename) |
Add points to the end of a field mesh and write to a file. More... | |
Read and write fields to file.
Definition at line 27 of file fd1d/misc/FieldIo.h.
Pscf::Fd1d::FieldIo::FieldIo | ( | ) |
Constructor.
Definition at line 34 of file fd1d/misc/FieldIo.cpp.
Pscf::Fd1d::FieldIo::~FieldIo | ( | ) |
Destructor.
Definition at line 40 of file fd1d/misc/FieldIo.cpp.
void Pscf::Fd1d::FieldIo::associate | ( | Domain const & | domain, |
FileMaster const & | fileMaster | ||
) |
Get and store addresses of associated objects.
domain | associated spatial domain |
fileMaster | associated FileMaster (for file paths) |
Definition at line 44 of file fd1d/misc/FieldIo.cpp.
Referenced by Pscf::Fd1d::Sweep::Sweep(), and Pscf::Fd1d::System::System().
Read a set of fields, one per monomer type.
fields | array of fields to read, indexed by monomer id |
in | input stream, open for reading. |
Definition at line 60 of file fd1d/misc/FieldIo.cpp.
References Util::Array< Data >::capacity(), and UTIL_CHECK.
Referenced by Pscf::Fd1d::System::readCommands(), and readFields().
Read a set of fields, one per monomer type.
This function uses the associated FileMaster to open an input file named filename before reading, and closes the file after reading.
fields | array of fields to read, indexed by monomer id. |
filename | name of input file |
Definition at line 51 of file fd1d/misc/FieldIo.cpp.
References Util::FileMaster::openInputFile(), and readFields().
void Pscf::Fd1d::FieldIo::writeField | ( | Field const & | field, |
std::ostream & | out, | ||
bool | writeHeader = true |
||
) | const |
Write a single field to an output stream.
field | field defined on r-space grid (input) |
out | output stream |
writeHeader | write file header iff this bool is true |
Definition at line 102 of file fd1d/misc/FieldIo.cpp.
References Util::Array< Data >::capacity(), and UTIL_CHECK.
Referenced by Pscf::Fd1d::System::writeQ(), Pscf::Fd1d::System::writeQSlice(), and Pscf::Fd1d::System::writeQTail().
void Pscf::Fd1d::FieldIo::writeField | ( | Field const & | field, |
std::string const & | filename, | ||
bool | writeHeader = true |
||
) | const |
Write a single field to a file.
This function uses the associated FileMaster to open an output file named filename before writing, and closes the file after writing.
field | field defined on r-space grid (input) |
filename | output filename |
writeHeader | write file header iff this bool is true |
Definition at line 93 of file fd1d/misc/FieldIo.cpp.
References Util::FileMaster::openOutputFile(), and writeField().
Referenced by writeField().
void Pscf::Fd1d::FieldIo::writeFields | ( | DArray< Field > const & | fields, |
std::ostream & | out, | ||
bool | writeHeader = true |
||
) |
Write a set of fields, one per monomer type, to an output stream.
fields | set of fields to written. |
out | output stream |
writeHeader | write file header iff this bool is true |
Definition at line 127 of file fd1d/misc/FieldIo.cpp.
References Util::Array< Data >::capacity(), and UTIL_CHECK.
Referenced by Pscf::Fd1d::Sweep::outputSolution(), Pscf::Fd1d::System::readCommands(), Pscf::Fd1d::System::writeC(), writeFields(), and Pscf::Fd1d::System::writeW().
void Pscf::Fd1d::FieldIo::writeFields | ( | DArray< Field > const & | fields, |
std::string const & | filename, | ||
bool | writeHeader = true |
||
) |
Write a set of fields, one per monomer type, to a named file.
This function uses the associated FileMaster to open an output file named filename before writing, and closes the file after writing.
fields | array of fields to read, indexed by monomer id |
filename | output filename |
writeHeader | write header iff this bool is true |
Definition at line 118 of file fd1d/misc/FieldIo.cpp.
References Util::FileMaster::openOutputFile(), and writeFields().
void Pscf::Fd1d::FieldIo::writeBlockCFields | ( | Mixture const & | mixture, |
std::ostream & | out | ||
) |
Write block concentration fields for all blocks to an output stream.
mixture | associated Mixture MDE solver object |
out | output stream |
Definition at line 165 of file fd1d/misc/FieldIo.cpp.
References Pscf::MixtureTmpl< TP, TS >::nBlock(), Pscf::MixtureTmpl< TP, TS >::nPolymer(), Pscf::MixtureTmpl< TP, TS >::nSolvent(), Pscf::Fd1d::Domain::nx(), Pscf::MixtureTmpl< TP, TS >::polymer(), and Pscf::MixtureTmpl< TP, TS >::solvent().
Referenced by Pscf::Fd1d::System::readCommands(), Pscf::Fd1d::System::writeBlockC(), and writeBlockCFields().
void Pscf::Fd1d::FieldIo::writeBlockCFields | ( | Mixture const & | mixture, |
std::string const & | filename | ||
) |
Write block concentration fields for all blocks to a named file.
This function uses the associated FileMaster to open an output file named filename before writing, and closes the file after writing.
mixture | associated Mixture MDE solver object |
filename | name of output file |
Definition at line 153 of file fd1d/misc/FieldIo.cpp.
References Util::FileMaster::openOutputFile(), and writeBlockCFields().
void Pscf::Fd1d::FieldIo::writeVertexQ | ( | Mixture const & | mixture, |
int | polymerId, | ||
int | vertexId, | ||
std::ostream & | out | ||
) |
Write product of incoming q fields for one vertex to stream.
mixture | associated Mixture MDE solver object |
polymerId | integer id of polymer species |
vertexId | integer id of vertex (end or junction) |
out | output stream |
Definition at line 212 of file fd1d/misc/FieldIo.cpp.
References Pscf::Vertex::inPropagatorId(), Pscf::PolymerTmpl< Block >::nBlock(), Pscf::MixtureTmpl< TP, TS >::nPolymer(), Pscf::Fd1d::Domain::nx(), Pscf::MixtureTmpl< TP, TS >::polymer(), Util::product(), Pscf::PolymerTmpl< Block >::propagator(), Pscf::Vertex::size(), UTIL_CHECK, and Pscf::PolymerTmpl< Block >::vertex().
Referenced by Pscf::Fd1d::System::readCommands(), and writeVertexQ().
void Pscf::Fd1d::FieldIo::writeVertexQ | ( | Mixture const & | mixture, |
int | polymerId, | ||
int | vertexId, | ||
std::string const & | filename | ||
) |
Write incoming q fields for a specified vertex.
mixture | associated Mixture MDE solver object |
polymerId | integer id of polymer species |
vertexId | integer id of vertex (end or junction) |
filename | name of output file |
Definition at line 199 of file fd1d/misc/FieldIo.cpp.
References Util::FileMaster::openOutputFile(), and writeVertexQ().
Interpolate an array of fields onto a new mesh and write to stream.
fields | field to be remeshed |
nx | number of grid points in new mesh |
out | output stream for remeshed field |
Definition at line 265 of file fd1d/misc/FieldIo.cpp.
References Util::Array< Data >::capacity(), Pscf::Fd1d::Domain::dx(), Pscf::Fd1d::Domain::nx(), UTIL_CHECK, Pscf::Fd1d::Domain::xMax(), and Pscf::Fd1d::Domain::xMin().
Referenced by Pscf::Fd1d::System::readCommands(), and remesh().
void Pscf::Fd1d::FieldIo::remesh | ( | DArray< Field > const & | fields, |
int | nx, | ||
std::string const & | filename | ||
) |
Interpolate an array of fields onto a new mesh and write to file.
fields | field to be remeshed |
nx | number of grid points in new mesh |
filename | name of output file for remeshed field |
Definition at line 252 of file fd1d/misc/FieldIo.cpp.
References Util::FileMaster::openOutputFile(), and remesh().
Add points to the end of a field mesh and write to stream.
Values at the added mesh points are taken to be the same as those at the last mesh point of the original mesh.
fields | array of fields to be extended |
m | number of added grid points |
out | output stream for extended field |
Definition at line 338 of file fd1d/misc/FieldIo.cpp.
References Util::Array< Data >::capacity(), and UTIL_CHECK.
Referenced by extend(), and Pscf::Fd1d::System::readCommands().
void Pscf::Fd1d::FieldIo::extend | ( | DArray< Field > const & | fields, |
int | m, | ||
std::string const & | filename | ||
) |
Add points to the end of a field mesh and write to a file.
Values at the added mesh points are taken to be the same as those at the last mesh point of the original mesh.
fields | field to be remeshed |
m | number of added grid points |
filename | name of output file for remeshed field |
Definition at line 325 of file fd1d/misc/FieldIo.cpp.
References extend(), and Util::FileMaster::openOutputFile().