Skip to content
Snippets Groups Projects

added const overload for operator [] in matrix view, added stddef.h include,...

Merged Oliver Heidmann requested to merge m300433/develop into develop
1 file
+ 18
16
Compare changes
  • Side-by-side
  • Inline
+ 18
16
@@ -8,6 +8,8 @@
#include <cdi.h>
#include <mutex>
#include "pipe.h"
#include "cdo_output.h"
#include "cthread_debug.h"
@@ -71,23 +73,23 @@ pipe_t::pipe_inq_timestep(int p_tsID)
{
if (EOP)
{
Debug(PIPE, name.c_str(), " EOP");
Debug(PIPE, "%s EOP",name.c_str());
break;
}
if (hasdata)
{
Debug(PIPE, name.c_str(), " has data");
Debug(PIPE, "%s has data", name.c_str());
hasdata = false;
data_d = nullptr;
data_f = nullptr;
data_is_float = false;
read_cond.notify_all();
}
else { Debug(PIPE, "%s has no data", name); }
Debug(PIPE && !hasdata, "%s has no data", name);
recInq_cond.notify_all(); /* o.k. ??? */
Debug(PIPE, name.c_str(), " wait of tsDef_cond");
Debug(PIPE, "%s wait of tsDef_cond", name.c_str());
tsDef_cond.wait(lock);
}
@@ -125,7 +127,7 @@ pipe_t::pipe_inq_vlist(int &p_vlistID)
while (p_vlistID == -1 && nwaitcycles < maxWaitCycles && !EOP)
{
time_to_wait += timeOut;
Debug(PIPE, name.c_str(), " wait of vlistDef_cond");
Debug(PIPE,"%s wait of vlistDef_cond", name.c_str());
vlistDef_cond.wait_for(lock, time_to_wait);
nwaitcycles++;
}
@@ -170,7 +172,7 @@ pipe_t::pipe_def_timestep(int p_vlistID, int p_tsID)
Debug(PIPE, "EOP");
break;
}
Debug(PIPE, name.c_str(), " wait of tsInq_cond (p_tsID ", p_tsID, " ", tsIDr, ")");
Debug(PIPE, " wait of tsInq_cond (p_tsID %d %d)", name.c_str(), p_tsID, tsIDr);
tsInq_cond.wait(lock);
}
}
@@ -182,7 +184,7 @@ pipe_t::pipe_inq_record(int *p_varID, int *p_levelID)
{
std::scoped_lock lock(m_mutex);
Debug(PIPE, name.c_str(), " has no data ", recIDr, " ", recIDw);
Debug(PIPE,"%s has no data %d %d ", name.c_str(), recIDr, " ", recIDw);
if (hasdata || usedata)
{
hasdata = false;
@@ -200,7 +202,7 @@ pipe_t::pipe_inq_record(int *p_varID, int *p_levelID)
usedata = true;
recIDr++;
Debug(PIPE, name.c_str(), "recID", recIDr, " ", recIDw);
Debug(PIPE, "%s recID: r=%d w=%d", name.c_str(), recIDr, recIDw);
while (recIDw != recIDr)
{
@@ -237,7 +239,7 @@ pipe_t::pipe_def_record(int p_varID, int p_levelID)
{
std::scoped_lock lock(m_mutex);
Debug(PIPE, name.c_str(), " has data ", recIDr, " ", recIDw); //<- TODO: rethink positioning
Debug(PIPE, "%s has data %d", name.c_str(), recIDr, recIDw); //<- TODO: rethink positioning
if (hasdata)
{
hasdata = false;
@@ -255,7 +257,7 @@ pipe_t::pipe_def_record(int p_varID, int p_levelID)
recIDw++;
varID = p_varID;
levelID = p_levelID;
Debug(PIPE, name.c_str(), "recID", recIDr, " ", recIDw);
Debug(PIPE, "%s recIDs: r=%d w=%d", name.c_str(), recIDr, recIDw);
}
recDef_cond.notify_all();
@@ -265,7 +267,7 @@ pipe_t::pipe_def_record(int p_varID, int p_levelID)
{
if (tsIDw != tsIDr) break;
if (EOP) break;
Debug(PIPE, name.c_str(), "wait of recInq_cond ", recIDr);
Debug(PIPE, "%s wait of recInq_cond %d", name.c_str(), recIDr);
recInq_cond.wait(lock);
}
}
@@ -322,14 +324,14 @@ pipe_t::pipe_read_record(int p_vlistID, double *const p_data, size_t *const p_nm
std::unique_lock<std::mutex> lock(m_mutex);
while (!hasdata)
{
Debug(PIPE, name.c_str(), " wait of write_cond");
Debug(PIPE,"%s wait of write_cond", name.c_str());
write_cond.wait(lock);
}
if (hasdata) { nvals = pipe_read_pipe_record(p_data, p_vlistID, p_nmiss); }
else { cdo_abort("data type %d not implemented", hasdata); }
Debug(PIPE, name.c_str(), " read record ", recIDr);
Debug(PIPE, "%s read record %d",name.c_str(), recIDr);
hasdata = false;
data_d = nullptr;
@@ -350,14 +352,14 @@ pipe_t::pipe_read_record(int p_vlistID, float *const p_data, size_t *const p_nmi
std::unique_lock<std::mutex> lock(m_mutex);
while (!hasdata)
{
Debug(PIPE, name.c_str(), " wait of write_cond");
Debug(PIPE, "%s wait of write_cond", name.c_str());
write_cond.wait(lock);
}
if (hasdata) { nvals = pipe_read_pipe_record(p_data, p_vlistID, p_nmiss); }
else { cdo_abort("data type %d not implemented", hasdata); }
Debug(PIPE, name.c_str(), " read record ", recIDr);
Debug(PIPE, "%s read record %d", name.c_str(), recIDr);
hasdata = false;
data_f = nullptr;
@@ -379,7 +381,7 @@ pipe_t::wait_for_read()
{
write_cond.notify_all();
Debug(PIPE, "%s write record $d", name, recIDw);
Debug(PIPE, "%s write record %d", name, recIDw);
std::unique_lock<std::mutex> lock(m_mutex);
while (hasdata)
Loading