Skip to content

Commit 63dbb86

Browse files
author
Dmitri Naumov
committed
Merge branch 'SmallFixes_2025_01' into 'master'
Small unsorted fixes See merge request ogs/ogs!5394
2 parents e42fe5f + 1cee270 commit 63dbb86

File tree

6 files changed

+39
-18
lines changed

6 files changed

+39
-18
lines changed

Applications/DataExplorer/VtkVis/VtkCompositeContourFilter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ void VtkCompositeContourFilter::init()
5151
vtkPointData* pointData = dataSet->GetPointData();
5252
if (pointData)
5353
{
54-
pointData->GetScalars()->GetRange(range);
54+
auto* scalars = pointData->GetScalars();
55+
if (scalars)
56+
{
57+
scalars->GetRange(range);
58+
}
5559
}
5660
}
5761
else

Applications/DataExplorer/VtkVis/VtkVisImageItem.cpp

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,37 @@ VtkVisImageItem::~VtkVisImageItem()
6363

6464
void VtkVisImageItem::Initialize(vtkRenderer* renderer)
6565
{
66-
auto* img = dynamic_cast<vtkImageAlgorithm*>(_algorithm);
67-
img->Update();
68-
// VtkGeoImageSource* img = dynamic_cast<VtkGeoImageSource*>(_algorithm);
66+
auto* image = dynamic_cast<vtkImageAlgorithm*>(_algorithm);
67+
if (!image)
68+
{
69+
OGSError::box("Cast to image failed.");
70+
return;
71+
}
72+
image->Update();
6973

7074
double origin[3];
7175
double spacing[3];
7276
double range[2];
73-
img->GetOutput()->GetOrigin(origin);
74-
img->GetOutput()->GetSpacing(spacing);
75-
// img->getRange(range);
76-
img->GetOutput()->GetPointData()->GetScalars()->GetRange(range);
77+
vtkImageData* image_data = image->GetOutput();
78+
if (!image_data)
79+
{
80+
OGSError::box("GetOutput() - Image could not be initialized.");
81+
return;
82+
}
83+
image_data->GetOrigin(origin);
84+
image_data->GetSpacing(spacing);
85+
vtkPointData* point_data = image_data->GetPointData();
86+
if (point_data)
87+
{
88+
auto* scalars = point_data->GetScalars();
89+
if (scalars)
90+
{
91+
scalars->GetRange(range);
92+
}
93+
}
7794
vtkImageShiftScale* scale = vtkImageShiftScale::New();
7895
scale->SetOutputScalarTypeToUnsignedChar();
79-
scale->SetInputConnection(img->GetOutputPort());
96+
scale->SetInputConnection(image->GetOutputPort());
8097
scale->SetShift(-range[0]);
8198
scale->SetScale(255.0 / (range[1] - range[0]));
8299

BaseLib/Error.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
}
2424
#else // OGS_FATAL_ABORT
2525
#include <stdexcept>
26-
#define OGS_FATAL(...) \
27-
{ \
28-
BaseLib::console->critical("{}:{} {}() ", __FILE__, __LINE__, \
29-
__FUNCTION__, fmt::format(__VA_ARGS__)); \
30-
throw std::runtime_error(fmt::format(__VA_ARGS__)); \
26+
#define OGS_FATAL(...) \
27+
{ \
28+
auto const formatted_va_args = fmt::format(__VA_ARGS__); \
29+
BaseLib::console->critical("{}:{} {}() ", __FILE__, __LINE__, \
30+
__FUNCTION__, formatted_va_args); \
31+
throw std::runtime_error(formatted_va_args); \
3132
}
3233
#endif // OGS_FATAL_ABORT

MeshLib/IO/XDMF/transformData.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ std::pair<std::vector<std::size_t>, ParentDataType> transformToXDMFTopology(
396396
{
397397
values.push_back(2);
398398
}
399-
// LINE3 maps to ParentDataType::EDGE_3 -> no special care required
400399
push_cellnode_ids_to_vector(cell);
401400
}
402401
}

MeshLib/IO/XDMF/transformData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ XdmfHdfData transformGeometry(MeshLib::Mesh const& mesh, double const* data_ptr,
5252
* \brief Create meta data for topology used for HDF5 and XDMF
5353
* \param values actual topology values to get size and memory location
5454
* \param parent_data_type XDMF topological element data types as listed in the
55-
* enum ParentDataTypei
55+
* enum ParentDataType
5656
* \param n_files specifies the number of files. If greater
5757
* than 1 it groups the data of each process to n_files \param chunk_size_bytes
5858
* Data will be split into chunks. The parameter specifies the size (in bytes)

web/content/docs/benchmarks/liquid-flow/raster-parameter-based-boundary-conditions/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ condition based on the raster parameter. We start with homogeneous parabolic
3737
problem:
3838
$$
3939
\begin{equation}
40-
s\\;\frac{\partial p}{\partial t} + k\\; \Delta p = q(t,x) \quad \text{in }\Omega
40+
s\;\frac{\partial p}{\partial t} + k\; \Delta p = q(t,x) \quad \text{in }\Omega
4141
\end{equation}
4242
$$
4343
w.r.t boundary conditions
4444
$$
4545
\eqalign{
4646
p(t, x) = g_D(t, x) &\quad \text{on }\Gamma_D,\cr
47-
k\\;{\partial p(x) \over \partial n} = g_N(x) &\quad \text{on }\Gamma_N,
47+
k\;{\partial p(x) \over \partial n} = g_N(x) &\quad \text{on }\Gamma_N,
4848
}$$
4949

5050
The domain $\Omega = [0,1]^3$ is a cube. Dirichlet-type boundary conditions are

0 commit comments

Comments
 (0)