Liebe Gitlab-Nutzerin, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren


Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

Commit 7cac7d4c authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Work on Rosenbrock methods.

parent 6fbfd7ec
......@@ -515,17 +515,8 @@ namespace AMDiS {
solution->getDOFVector(i)));
}
// Check for serializer
int writeSerialization = 0;
Parameters::get(name + "->write serialization", writeSerialization);
if (writeSerialization) {
MSG("Use are using the obsolete parameter: %s->write serialization\n", name.c_str());
MSG("Please use instead the following parameter: %s->output->write serialization\n", name.c_str());
ERROR_EXIT("Usage of an obsolete parameter (see message above)!\n");
}
Parameters::get(name + "->output->write serialization", writeSerialization);
if (writeSerialization)
fileWriters.push_back(new Serializer<ProblemStatSeq>(this));
}
......
......@@ -45,7 +45,10 @@ namespace AMDiS {
: name(""),
problem(prob),
tsModulo(1),
timestepNumber(-1)
timestepNumber(-1),
appendIndex(0),
indexLength(5),
indexDecimals(3)
{
FUNCNAME("Serializer::Serializer()");
......@@ -55,9 +58,9 @@ namespace AMDiS {
tsModulo);
TEST_EXIT(name != "")("No filename!\n");
#if HAVE_PARALLEL_DOMAIN_AMDIS
name += ".p" + boost::lexical_cast<std::string>(MPI::COMM_WORLD.Get_rank());
#endif
Parameters::get(problem->getName() + "->output->append index", appendIndex);
Parameters::get(problem->getName() + "->output->index length", indexLength);
Parameters::get(problem->getName() + "->output->index decimals", indexDecimals);
}
......@@ -65,15 +68,18 @@ namespace AMDiS {
: name(filename),
problem(prob),
tsModulo(writeEveryIth),
timestepNumber(-1)
timestepNumber(-1),
appendIndex(0),
indexLength(5),
indexDecimals(3)
{
FUNCNAME("Serializer::Serializer()");
TEST_EXIT(name != "")("No filename!\n");
#if HAVE_PARALLEL_DOMAIN_AMDIS
name += ".p" + boost::lexical_cast<std::string>(MPI::COMM_WORLD.Get_rank());
#endif
Parameters::get(problem->getName() + "->output->append index", appendIndex);
Parameters::get(problem->getName() + "->output->index length", indexLength);
Parameters::get(problem->getName() + "->output->index decimals", indexDecimals);
}
......@@ -97,14 +103,35 @@ namespace AMDiS {
TEST_EXIT(adaptInfo)("No AdaptInfo\n");
std::ofstream out(name.c_str());
string filename = name;
if (appendIndex) {
TEST_EXIT(indexLength <= 99)("index lenght > 99\n");
TEST_EXIT(indexDecimals <= 97)("index decimals > 97\n");
TEST_EXIT(indexDecimals < indexLength)("index length <= index decimals\n");
char formatStr[9];
char timeStr[20];
sprintf(formatStr, "%%0%d.%df", indexLength, indexDecimals);
sprintf(timeStr, formatStr, adaptInfo ? adaptInfo->getTime() : 0.0);
filename += string(timeStr);
}
filename += ".ser";
#if HAVE_PARALLEL_DOMAIN_AMDIS
filename += ".p" + boost::lexical_cast<std::string>(MPI::COMM_WORLD.Get_rank());
#endif
std::ofstream out(filename.c_str());
TEST_EXIT(out.is_open())("Cannot open serialization file!\n");
out.write(reinterpret_cast<const char*>(&amdisRevisionNumber), sizeof(int));
problem->serialize(out);
adaptInfo->serialize(out);
out.close();
MSG("problem serialized to %s \n", name.c_str());
MSG("Problem serialized to %s \n", filename.c_str());
}
protected:
......@@ -117,6 +144,16 @@ namespace AMDiS {
/// The problem is serialized every tsModulo-th timestep.
int tsModulo;
/// 0: Don't append time index to filename prefix.
/// 1: Append time index to filename prefix.
int appendIndex;
/// Total length of appended time index.
int indexLength;
/// Number of decimals in time index.
int indexDecimals;
/// Current timestep number.
int timestepNumber;
};
......
......@@ -97,7 +97,7 @@ namespace AMDiS {
public:
/// Constructor.
VecAtQP_ZOT(DOFVectorBase<double> *dv,
AbstractFunction<double, double> *ab);
AbstractFunction<double, double> *ab = NULL);
/// Implementation of \ref OperatorTerm::initElement().
void initElement(const ElInfo* elInfo,
......
......@@ -261,14 +261,16 @@ namespace AMDiS {
#if HAVE_PARALLEL_DOMAIN_AMDIS
if (MPI::COMM_WORLD.Get_rank() == 0) {
VtkWriter vtkWriter(&dataCollectors);
vtkWriter.updateAnimationFile(paraFilename + paraviewParallelFileExt,
vtkWriter.updateAnimationFile(adaptInfo,
paraFilename + paraviewParallelFileExt,
&paraviewAnimationFrames,
filename + ".pvd");
}
#else
VtkWriter vtkWriter(&dataCollectors);
vtkWriter.updateAnimationFile(fn + paraviewFileExt,
vtkWriter.updateAnimationFile(adaptInfo,
fn + paraviewFileExt,
&paraviewAnimationFrames,
filename + ".pvd");
#endif
......
......@@ -35,6 +35,8 @@
namespace AMDiS {
using namespace std;
typedef enum {
NONE = 0,
GZIP = 1,
......@@ -73,19 +75,19 @@ namespace AMDiS {
writeElement = writeElem;
}
std::string getFilename()
string getFilename()
{
return filename;
}
void setFilename(std::string n)
void setFilename(string n)
{
filename = n;
}
protected:
/// Used filename prefix.
std::string filename;
string filename;
int traverseLevel;
......@@ -105,18 +107,18 @@ namespace AMDiS {
{
public:
/// Constructor for a filewriter for one data component.
FileWriter(std::string name, Mesh *mesh, DOFVector<double> *vec);
FileWriter(string name, Mesh *mesh, DOFVector<double> *vec);
/// Constructor for a filewriter with more than one data component.
FileWriter(std::string name,
FileWriter(string name,
Mesh *mesh,
std::vector< DOFVector<double>* > vecs);
vector< DOFVector<double>* > vecs);
/** \brief
* Constructor for a filewriter, when the solution vector is a vector
* of WorldVectors.
*/
FileWriter(std::string name,
FileWriter(string name,
Mesh *mesh,
DOFVector< WorldVector<double> > *vec);
......@@ -137,22 +139,22 @@ namespace AMDiS {
void readParameters();
/// Name of the writer.
std::string name;
string name;
/// AMDiS mesh-file extension.
std::string amdisMeshExt;
string amdisMeshExt;
/// AMDiS solution-file extension.
std::string amdisDataExt;
string amdisDataExt;
/// VTK file extension.
std::string paraviewFileExt;
string paraviewFileExt;
/// Parallel VTK file extension.
std::string paraviewParallelFileExt;
string paraviewParallelFileExt;
/// Periodic file extension.
std::string periodicFileExt;
string periodicFileExt;
/// 0: Don't write AMDiS files; 1: Write AMDiS files.
int writeAMDiSFormat;
......@@ -182,18 +184,16 @@ namespace AMDiS {
int writeArhFormat;
/// camera position for povray script files
std::string povrayCameraLocation;
string povrayCameraLocation;
/// orientation for camera in povray script files
std::string povrayCameraLookAt;
string povrayCameraLookAt;
/// name of the template file that will be prepended to all created *.pov files
std::string povrayTemplate;
string povrayTemplate;
/** \brief
* 0: Don't append time index to filename prefix.
* 1: Append time index to filename prefix.
*/
/// 0: Don't append time index to filename prefix.
/// 1: Append time index to filename prefix.
int appendIndex;
/// Total length of appended time index.
......@@ -205,8 +205,9 @@ namespace AMDiS {
/// Timestep modulo: write only every tsModulo-th timestep!
int tsModulo;
/// Stores all writen filename to a ParaView animation file.
std::vector< std::string > paraviewAnimationFrames;
/// Stores a set of pairs of timepoint and filename to write a ParaView
/// animation file.
vector<pair<double, string> > paraviewAnimationFrames;
///
int timestepNumber;
......@@ -218,7 +219,7 @@ namespace AMDiS {
const FiniteElemSpace *feSpace;
/// Pointers to the vectors which store the solution.
std::vector<DOFVector<double>*> solutionVecs;
vector<DOFVector<double>*> solutionVecs;
/** \brief
* Stores the number of temporal solutions vectors, which have been created
......
......@@ -31,7 +31,9 @@
namespace AMDiS {
int VtkWriter::writeFile(std::string name)
using namespace std;
int VtkWriter::writeFile(string name)
{
FUNCNAME("VtkWriter::writeFile()");
......@@ -50,32 +52,32 @@ namespace AMDiS {
}
{
std::ofstream swapfile(name.c_str(), std::ios::out | std::ios::trunc);
ofstream swapfile(name.c_str(), ios::out | ios::trunc);
TEST_EXIT(swapfile.is_open())
("Cannot open file %s for writing!\n", name.c_str());
swapfile.close();
}
file.push(boost::iostreams::file_descriptor_sink(name, std::ios::trunc));
file.push(boost::iostreams::file_descriptor_sink(name, ios::trunc));
writeFileToStream(file);
return 0;
}
void VtkWriter::writeParallelFile(std::string name, int nRanks,
std::string fnPrefix, std::string fnPostfix)
void VtkWriter::writeParallelFile(string name, int nRanks,
string fnPrefix, string fnPostfix)
{
FUNCNAME("VtkWriter::writeParallelFile()");
boost::iostreams::filtering_ostream file;
{
std::ofstream swapfile(name.c_str(), std::ios::out | std::ios::trunc);
ofstream swapfile(name.c_str(), ios::out | ios::trunc);
TEST_EXIT(swapfile.is_open())
("Cannot open file %s for writing!\n", name.c_str());
swapfile.close();
}
file.push(boost::iostreams::file_descriptor_sink(name, std::ios::trunc));
file.push(boost::iostreams::file_descriptor_sink(name, ios::trunc));
file << "<?xml version=\"1.0\"?>\n";
file << "<VTKFile type=\"PUnstructuredGrid\">\n";
......@@ -97,7 +99,7 @@ namespace AMDiS {
file << " </PPointData>\n";
for (int i = 0; i < nRanks; i++) {
std::stringstream oss;
stringstream oss;
oss << fnPrefix << "-p" << i << "-" << fnPostfix;
boost::filesystem::path filepath(oss.str());
file << " <Piece Source=\""
......@@ -111,38 +113,36 @@ namespace AMDiS {
}
int VtkWriter::updateAnimationFile(std::string valueFilename,
std::vector< std::string > *paraViewAnimationFrames,
std::string animationFilename)
int VtkWriter::updateAnimationFile(AdaptInfo *adaptInfo,
string valueFilename,
vector<pair<double, string > > *paraViewAnimationFrames,
string animationFilename)
{
FUNCNAME("VtkWriter::updateAnimationFile()");
size_t found = valueFilename.find_last_of("/\\");
paraViewAnimationFrames->push_back(valueFilename.substr(found + 1));
paraViewAnimationFrames->push_back(make_pair(adaptInfo->getTime(),
valueFilename.substr(found + 1)));
boost::iostreams::filtering_ostream file;
{
std::ofstream swapfile(animationFilename.c_str(),
std::ios::out | std::ios::trunc);
ofstream swapfile(animationFilename.c_str(),
ios::out | ios::trunc);
TEST_EXIT(swapfile.is_open())
("Cannot open file %s for writing!\n", animationFilename.c_str());
swapfile.close();
}
file.push(boost::iostreams::file_descriptor_sink(animationFilename,
std::ios::trunc));
ios::trunc));
file << "<?xml version=\"1.0\"?>\n";
file << "<VTKFile type=\"Collection\" version=\"0.1\" >" << "\n";
file << "<Collection>\n";
int counter = 0;
std::vector< std::string >::iterator it;
for (it = paraViewAnimationFrames->begin();
it < paraViewAnimationFrames->end();
++it, counter++) {
file << "<DataSet timestep=\"" << counter
<< "\" part=\"0\" file=\"" << (*it) << "\"/>\n";
}
for (vector<pair<double, string> >::iterator it = paraViewAnimationFrames->begin();
it < paraViewAnimationFrames->end(); ++it)
file << "<DataSet timestep=\"" << it->first
<< "\" part=\"0\" file=\"" << it->second << "\"/>\n";
file << "</Collection>\n";
file << "</VTKFile>\n";
......@@ -152,23 +152,23 @@ namespace AMDiS {
void VtkWriter::writeFile(DOFVector<double> *values,
std::string filename,
string filename,
bool writeParallel)
{
FUNCNAME("VtkWriter::writeFile()");
DataCollector dc(values->getFeSpace(), values);
std::vector<DataCollector*> dcList(0);
vector<DataCollector*> dcList(0);
dcList.push_back(&dc);
writeFile(dcList, filename, writeParallel);
}
void VtkWriter::writeFile(std::vector<DOFVector<double>* > &values,
std::string filename,
void VtkWriter::writeFile(vector<DOFVector<double>* > &values,
string filename,
bool writeParallel)
{
std::vector<DataCollector*> dcList(0);
vector<DataCollector*> dcList(0);
for (unsigned int i = 0; i < values.size(); i++)
dcList.push_back(new DataCollector(values[i]->getFeSpace(), values[i]));
writeFile(dcList, filename, writeParallel);
......@@ -178,10 +178,10 @@ namespace AMDiS {
void VtkWriter::writeFile(WorldVector<DOFVector<double>* > &values,
std::string filename,
string filename,
bool writeParallel)
{
std::vector<DataCollector*> dcList(0);
vector<DataCollector*> dcList(0);
for (int i = 0; i < values.getSize(); i++)
dcList.push_back(new DataCollector(values[i]->getFeSpace(), values[i]));
writeFile(dcList, filename, writeParallel);
......@@ -191,7 +191,7 @@ namespace AMDiS {
void VtkWriter::writeFile(DOFVector<WorldVector<double> > *values,
std::string filename,
string filename,
bool writeParallel)
{
WorldVector<DOFVector<double>*> valuesWV;
......@@ -205,10 +205,10 @@ namespace AMDiS {
void VtkWriter::writeFile(SystemVector *values,
std::string filename,
string filename,
bool writeParallel)
{
std::vector<DataCollector*> dcList(0);
vector<DataCollector*> dcList(0);
for (int i = 0; i < values->getSize(); i++)
dcList.push_back(new DataCollector(values->getDOFVector(i)->getFeSpace(),
values->getDOFVector(i)));
......@@ -218,8 +218,8 @@ namespace AMDiS {
}
void VtkWriter::writeFile(std::vector<DataCollector*> &dcList,
std::string filename,
void VtkWriter::writeFile(vector<DataCollector*> &dcList,
string filename,
bool writeParallel)
{
VtkWriter writer(&dcList);
......@@ -230,12 +230,12 @@ namespace AMDiS {
int sPos = filename.find(".vtu");
TEST_EXIT(sPos >= 0)("Failed to find file postfix!\n");
std::string name = filename.substr(0, sPos);
string name = filename.substr(0, sPos);
if (MPI::COMM_WORLD.Get_rank() == 0)
writer.writeParallelFile(name + ".pvtu", MPI::COMM_WORLD.Get_size(), name, ".vtu");
filename = name + "-p" + lexical_cast<std::string>(MPI::COMM_WORLD.Get_rank()) + "-.vtu";
filename = name + "-p" + lexical_cast<string>(MPI::COMM_WORLD.Get_rank()) + "-.vtu";
}
#endif
writer.writeFile(filename);
......
......@@ -36,10 +36,12 @@
namespace AMDiS {
using namespace std;
class VtkWriter
{
public:
VtkWriter(std::vector<DataCollector*> *dc)
VtkWriter(vector<DataCollector*> *dc)
: dataCollector(dc),
compress(NONE)
{
......@@ -48,51 +50,51 @@ namespace AMDiS {
}
/// Writes a ParaView-VTK file.
int writeFile(std::string name);
int writeFile(string name);
/// Writes a pvtu file, which contains the links to all the rank files.
void writeParallelFile(std::string name, int nRanks,
std::string fnPrefix, std::string fnPostfix);
void writeParallelFile(string name, int nRanks,
string fnPrefix, string fnPostfix);
/// May be used to simply write ParaView files.
static void writeFile(DOFVector<double> *values,
std::string filename,
string filename,
bool writeParallel = true);
/// May be used to simply write ParaView files.
static void writeFile(DOFVector<double> &values,
std::string filename,
string filename,
bool writeParallel = true)
{
writeFile(&values, filename, writeParallel);
}
/// May be used to simply write ParaView files with a list of values.
static void writeFile(std::vector<DOFVector<double>*> &values,
std::string filename,
static void writeFile(vector<DOFVector<double>*> &values,
string filename,
bool writeParallel = true);
static void writeFile(WorldVector<DOFVector<double>*> &values,
std::string filename,
string filename,
bool writeParallel = true);
static void writeFile(DOFVector<WorldVector<double> > *values,
std::string filename,
string filename,
bool writeParallel = true);
static void writeFile(DOFVector<WorldVector<double> > &values,
std::string filename,
string filename,
bool writeParallel = true)
{
writeFile(&values, filename, writeParallel);
}
static void writeFile(SystemVector *values,
std::string filename,
string filename,
bool writeParallel = true);
static void writeFile(std::vector<DataCollector*> &dcList,
std::string filename,
static void writeFile(vector<DataCollector*> &dcList,
string filename,
bool writeParallel = true);
/// Set a compressing method for file output.
......@@ -102,9 +104,10 @@ namespace AMDiS {
}
/// Adds a new entry to a ParaView animation file.
static int updateAnimationFile(std::string valueFilename,
std::vector< std::string > *paraViewAnimationFrames,
std::string animationFilename);
static int updateAnimationFile(AdaptInfo *adaptInfo,
string valueFilename,
vector<pair<double, string> > *paraViewAnimationFrames,
string animationFilename);
protected:
/// Writes the VTK file to an arbitrary stream.
template<typename T>
......@@ -139,7 +142,7 @@ namespace AMDiS {
WorldVector<double> coord)
{
for (int i = 0; i < Global::getGeo(WORLD); i++)
file << " " << std::scientific << coord[i];
file << " " << scientific << coord[i];
for (int i = Global::getGeo(WORLD); i < 3; i++)
file << " "<<0.0;
......@@ -147,10 +150,10 @@ namespace AMDiS {
}
/// Writes a world coordinate to a given file.
inline void writeCoord(std::ofstream &file, WorldVector<double> coord)
inline void writeCoord(ofstream &file, WorldVector<double> coord)
{
for (int i = 0; i < Global::getGeo(WORLD); i++)
file << " " << std::scientific << coord[i];
file << " " << scientific << coord[i];
for (int i = Global::getGeo(WORLD); i < 3; i++)
file << " "<<0.0;
......@@ -159,7 +162,7 @@ namespace AMDiS {
private:
/// List of DataCollectors, for each component of the problem one.
std::vector<DataCollector*> *dataCollector;
vector<DataCollector*> *dataCollector;
/** \brief
* Defines if the file has to be compressed for ouput, and with which
......
......@@ -16,6 +16,8 @@
namespace AMDiS {
using namespace std;
template<typename T>
void VtkWriter::writeFileToStream(T &file)
{
......@@ -98,15 +100,15 @@ namespace AMDiS {
template<typename T>
void VtkWriter::writeVertexCoords(T &file)
{
DOFVector< std::list<VertexInfo> > *vertexInfos =
DOFVector<list<VertexInfo> > *vertexInfos =
(*dataCollector)[0]->getVertexInfos();
DOFVector< std::list<VertexInfo> >::Iterator it(vertexInfos, USED_DOFS);
DOFVector<list<VertexInfo> >::Iterator it(vertexInfos, USED_DOFS);
int counter = 0;