Commits (5)
......@@ -131,6 +131,21 @@ std::pair<double, double> Mesh::MeshWidth() const {
PPM->Max(h_max, commSplit));
}
void Mesh::ExtractMeshWidth() {
auto temp = MeshWidth();
minMeshWidth = temp.first;
maxMeshWidth = temp.second;
}
double Mesh::MaxMeshWidth() const {
return maxMeshWidth;
}
double Mesh::MinMeshWidth() const {
return minMeshWidth;
}
Mesh::~Mesh() { while (CellCount()) RemoveCell(cells()); }
Logging &operator<<(Logging &s, const Mesh &M) {
......@@ -769,3 +784,6 @@ int Mesh::ProcSetsCountGeometryWithoutInfty() const {
}
......@@ -27,7 +27,6 @@ public:
const char *MeshName() const override { return "Meshname not known"; }
};
class Mesh {
int verbose = 1;
......@@ -49,6 +48,10 @@ class Mesh {
std::string olapName;
double maxMeshWidth = 0.0;
double minMeshWidth = 0.0;
protected:
Cells meshCells{};
......@@ -87,6 +90,7 @@ public:
Mesh(double scaling = 1.0, int commSplit = 0) : identifyBnd(false), scaling(scaling),
commSplit(commSplit) {
procSets.SetCommSplit(commSplit);
ExtractMeshWidth();
}
Mesh(const std::string &meshName, const std::string &distName,
......@@ -96,6 +100,7 @@ public:
plevel(plevel), level(level), commSplit(commSplit), scaling(scaling) {
config.get("MeshVerbose", verbose);
procSets.SetCommSplit(commSplit);
ExtractMeshWidth();
}
Mesh(const Mesh &mesh, const MapGeometry &);
......@@ -259,6 +264,12 @@ public:
std::pair<double, double> MeshWidth() const;
void ExtractMeshWidth();
double MaxMeshWidth() const;
double MinMeshWidth() const;
const std::map<CELLTYPE, int> &GetOccurringCellTypes() const {
return occurringCellTypes;
}
......
......@@ -124,3 +124,11 @@ VtuPlot &mpp::deformed_plot(const string &name, const Vector &deformation) {
std::pair<std::string, PlotStatus> mpp::save_plot(const string &filename) {
return {filename, Plotting::status};
}
void mpp::plot_mesh(const Mesh &mesh) {
auto name = mesh.Name();
if(name.empty()) name = "Mesh";
Plotting::InstanceM().AddPlot(name, mesh);
Plotting::InstanceM().SavePlot(name);
Plotting::InstanceM().RemovePlot(name);
}
......@@ -82,6 +82,8 @@ namespace mpp{
std::pair<std::string, PlotStatus> save_plot(const string& filename);
constexpr PlotStatus endp = PlotStatus::CLEAR;
void plot_mesh(const Mesh& mesh);
static string intAsString(int i) {
char buffer[256];
sprintf(buffer, "%04d", i);
......@@ -90,9 +92,4 @@ namespace mpp{
}
}
#define plot_vector(v) mpp::plot(#v) << v << mpp::save_plot(#v)
#define plot_deformed(v, u) mpp::deformed_plot(#v, u) << v << mpp::save_plot(#v)
#define plot_time_vector(v, i) mpp::plot(#v) << v << mpp::save_plot(#v+mpp::intAsString(i))
#define plot_time_deformed(v, u, i) mpp::deformed_plot(#v, u) << v << mpp::save_plot(#v+mpp::intAsString(i))
#endif //PLOTTING_HPP
......@@ -97,8 +97,8 @@ TimeIntegrator *TimeIntegratorCreator::Create() {
return new GenericImplicitMidpointRule(linearSolvers.at(0), linearSolvers.at(1),
linearSolvers.at(2), linearSolvers.at(3));
case CRANK_NICOLSON:
return new CrankNicolson(linearSolvers.at(0), linearSolvers.at(1), linearSolvers.at(2),
linearSolvers.at(3));
return new CrankNicolson(linearSolvers.at(0), linearSolvers.at(1),
linearSolvers.at(2), linearSolvers.at(3));
case DI_RK_ORDER2:
return new DiagonalImplicitRungeKutta2(linearSolvers.at(0), linearSolvers.at(1),
linearSolvers.at(2), linearSolvers.at(3));
......