Commit 6ee1c6b6 authored by Praetorius, Simon's avatar Praetorius, Simon

some updates of extensions

parent 98cba830
......@@ -323,6 +323,9 @@ protected:
// erase the rows for all first indices
for (size_t i = 0; i < indices.size(); i++) {
if (indices[i].first == indices[i].second)
continue;
if (asmMatrix) {
c_type cursor(begin<tag::row>(m)+indices[i].first);
for (ic_type icursor(begin<tag::nz>(cursor)), icend(end<tag::nz>(cursor)); icursor != icend; ++icursor) {
......@@ -341,11 +344,15 @@ protected:
matrix::inserter<Matrix, update_plus<double> > ins(m);
if (row == col) {
for (size_t i = 0; i < indices.size(); i++) {
if (indices[i].first == indices[i].second)
continue;
ins[indices[i].first][indices[i].first] << 1.0;
ins[indices[i].first][indices[i].second] << -1.0;
}
}
for (size_t i = 0; i < indices.size(); i++) {
if (indices[i].first == indices[i].second)
continue;
for (size_t j = 0; j < row_values[i].size(); j++) {
ins[indices[i].second][row_values[i][j].first] << row_values[i][j].second;
}
......
......@@ -247,16 +247,8 @@ public:
void markElements(Flag &markFlag)
{
FUNCNAME("RefinementLevelDOF::markElements()");
const DOFAdmin* admin = feSpace->getAdmin();
const BasisFunction *basFcts = feSpace->getBasisFcts();
int numBasFcts = basFcts->getNumber();
DegreeOfFreedom *localIndices = new DegreeOfFreedom[numBasFcts];
FixVec<WorldVector<double>, VERTEX> coords(mesh->getDim(), NO_INIT);
double meanValue;
FUNCNAME("RefinementLevelDOFList::markElements()");
bool elMarkRefine = false, elMarkCoarsen = false;
std::vector<ElementFunctionDOFVec<double>*> elFcts;
......@@ -291,8 +283,6 @@ public:
markFlag= 1;
if(elMarkCoarsen)
markFlag|= 2;
delete [] localIndices;
};
private:
std::vector<DOFVector<double>*> vecs;
......
......@@ -113,6 +113,9 @@ namespace AMDiS {
(*it_results[i])++;
}
}
MSG("VTU file read from: %s\n", filename.c_str());
}
} // end namespace VtuReader
......
......@@ -47,7 +47,7 @@ Flag BaseProblem<ProblemType>::initDataFromFile(AdaptInfo *adaptInfo)
std::string readFormat = "arh";
Initfile::get(name + "->read format", readFormat, 2);
if (readFormat != "arh" && readFormat != "dat" && readFormat != "vtu") {
if (readFormat != "arh" && readFormat != "dat" && readFormat != "vtu" && readFormat != "multi-vtu") {
WARNING("You can not read data from formats other than .arh, .dat or .vtu! The .arh-format is selected.\n");
}
......@@ -98,17 +98,63 @@ Flag BaseProblem<ProblemType>::initDataFromFile(AdaptInfo *adaptInfo)
if (arh_idx >= 0) {
ArhReader::read(filenames[arh_idx], prob->getMesh());
}
if (vtu_idx >= 0) {
if (vtu_idx >= 0) {
std::vector<int> readComponents;
Initfile::get(name + "->read components", readComponents);
if (readComponents.size() == 0)
for (size_t i = 0; i < prob->getNumComponents(); i++)
readComponents.push_back(i);
std::vector<DOFVector<double>*> solutions;
std::vector<std::string> names;
for (size_t i = 0; i < prob->getNumComponents(); i++) {
solutions.push_back(prob->getSolution()->getDOFVector(i));
names.push_back(prob->getComponentName(i));
for (size_t i = 0; i < readComponents.size(); i++) {
solutions.push_back(prob->getSolution()->getDOFVector(readComponents[i]));
names.push_back(prob->getComponentName(readComponents[i]));
}
VtuReader::readValue(filenames[vtu_idx], prob->getMesh(), solutions, names);
} else
throw(std::runtime_error("You have to specify a .vtu file!"));
}
else if (readFormat == "multi-vtu") {
size_t numFiles = 0;
Initfile::get(name + "->number of files", numFiles);
for (size_t n; n < numFiles; n++) {
std::vector<std::string> filenames;
Initfile::get(name + "->value file[" + boost::lexical_cast<std::string>(n) + "]", filenames);
if (filenames.size() == 0)
return initFlag;
int arh_idx = -1, vtu_idx = -1;
for (size_t i = 0; i < filenames.size(); i++) {
if (!file_exists(filenames[i]))
throw(std::runtime_error("The file '" + filenames[i] + "' does not exist!"));
if (filenames[i].find(".vtu") != std::string::npos)
vtu_idx = i;
else if (filenames[i].find(".arh") != std::string::npos)
arh_idx = i;
else
throw(std::runtime_error("The file '" + filenames[i] + "' must have the extension .arh or .vtu!"));
}
if (arh_idx >= 0) {
ArhReader::read(filenames[arh_idx], prob->getMesh());
}
if (vtu_idx >= 0) {
std::vector<int> readComponents;
Initfile::get(name + "->read components[" + boost::lexical_cast<std::string>(n) + "]", readComponents);
if (readComponents.size() == 0)
for (size_t i = 0; i < prob->getNumComponents(); i++)
readComponents.push_back(i);
std::vector<DOFVector<double>*> solutions;
std::vector<std::string> names;
for (size_t i = 0; i < readComponents.size(); i++) {
solutions.push_back(prob->getSolution()->getDOFVector(readComponents[i]));
names.push_back(prob->getComponentName(readComponents[i]));
}
VtuReader::readValue(filenames[vtu_idx], prob->getMesh(), solutions, names);
} else
throw(std::runtime_error("You have to specify a .vtu file!"));
}
}
else {
throw(std::runtime_error("Parameter 'read data from file' set to 'true', but no parameter 'read format' specified!"));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment