Commit a4d9f199 authored by Marc R.'s avatar Marc R.

Merge branch 'BTost/met.3d-01_develop_skew-t_spaghetti-plot' into devel_1_5_skewt

parents d2f30322 abd18a93
......@@ -118,6 +118,7 @@ HEADERS += \
src/system/pipelineconfiguration.h \
src/data/probabltrajectoriessource.h \
src/gxfw/gl/shaderstoragebufferobject.h \
src/actors/skewtactor.h \
src/gxfw/memberselectiondialog.h \
src/gxfw/adddatasetdialog.h \
src/data/derivedmetvarsdatasource.h \
......@@ -222,6 +223,7 @@ SOURCES += \
src/system/pipelineconfiguration.cpp \
src/data/probabltrajectoriessource.cpp \
src/gxfw/gl/shaderstoragebufferobject.cpp \
src/actors/skewtactor.cpp \
src/gxfw/memberselectiondialog.cpp \
src/gxfw/adddatasetdialog.cpp \
src/data/derivedmetvarsdatasource.cpp \
......@@ -302,6 +304,7 @@ OTHER_FILES += \
src/glsl/vsec_marching_squares.fx.glsl \
src/glsl/volume_normalcurves_initpoints.fx.glsl \
src/glsl/hsec_texturedcontours.fx.glsl \
src/glsl/skewtrendering.fx.glsl \
config/cf_stdnames.dat \
config/log4cplus.properties \
src/glsl/north_arrow.fx.glsl \
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
......@@ -4,7 +4,8 @@
** three-dimensional visual exploration of numerical ensemble weather
** prediction data.
**
** Copyright 2015 Marc Rautenhaus
** Copyright 2015-2018 Marc Rautenhaus
** Copyright 2015-2016 Christoph Heidelmann
**
** Computer Graphics and Visualization Group
** Technische Universitaet Muenchen, Garching, Germany
......@@ -52,6 +53,8 @@ uniform bool scaleRadius; // if true, radius will be scaled with
uniform vec3 cameraPosition; // camera position in world space
uniform vec3 cameraUpDir; // camera upward axis
uniform vec2 position; // camera upward axis
uniform int numObsPerTrajectory; // number of "observations" (i.e. points)
uniform bool useTransferFunction; // use transfer function or const col?
uniform vec4 constColour;
......@@ -68,6 +71,12 @@ shader VSmain(in vec3 vertex : 0, out vec4 vs_vertex)
vs_vertex = vec4(vertex.xy, worldZ, vertex.z);
}
shader VSusePosition(in vec3 vertex : 0, out vec4 vs_vertex)
{
// Use 2D position for vertex coordinate
vs_vertex = vec4(position, 0, 1);
}
/*****************************************************************************
*** GEOMETRY SHADER
......@@ -168,7 +177,7 @@ shader FSmain(in GStoFS Input, out vec4 fragColour)
float b = 2.0 * dot(dir, c2p);
float c = dot(c2p, c2p) - Input.gs_radius * Input.gs_radius;
float d = b * b - 4.0 * a * c;
if(d <= 0.0) discard;
if (d <= 0.0) discard;
float t = (-b - sqrt(d)) / (2.0 * a);
// Position at which the ray from quad pixel to sphere centre intersects
......@@ -199,3 +208,10 @@ program Normal
gs(420)=GSmain() : in(points), out(triangle_strip, max_vertices = 4);
fs(420)=FSmain();
};
program UsePosition
{
vs(420)=VSusePosition();
gs(420)=GSmain() : in(points), out(triangle_strip, max_vertices = 4);
fs(420)=FSmain();
};
......@@ -131,6 +131,10 @@ MGLResourcesManager::~MGLResourcesManager()
<< " (" << actorPool[i]->getName().toStdString() << ")"
<< flush);
delete actorPool[i];
if (actorPool[i] == textManager)
{
textManager = nullptr;
}
}
LOG4CPLUS_DEBUG(mlog, "\tactor factory pool" << flush);
......
......@@ -6,6 +6,7 @@
**
** Copyright 2015-2018 Marc Rautenhaus
** Copyright 2016-2018 Bianca Tost
** Copyright 2015-2016 Christoph Heidelmann
**
** Computer Graphics and Visualization Group
** Technische Universitaet Muenchen, Garching, Germany
......@@ -3942,4 +3943,90 @@ bool MNWP3DVolumeActorVariable::setTransferFunctionFromProperty()
}
/******************************************************************************
*******************************************************************************/
/******************************************************************************
*******************************************************************************/
/******************************************************************************
*** MNWPSkewTActorVariable ***
*******************************************************************************/
/******************************************************************************
*** CONSTRUCTOR / DESTRUCTOR ***
*******************************************************************************/
MNWPSkewTActorVariable::MNWPSkewTActorVariable(MNWPMultiVarActor *actor)
: MNWPActorVariable(actor),
color(QColor(0, 0, 0, 255)),
thickness(2.)
{
assert(actor != nullptr);
MQtProperties *properties = actor->getQtProperties();
// Create and initialise QtProperties for the GUI.
// ===============================================
actor->beginInitialiseQtProperties();
QtProperty* renderGroup = getPropertyGroup("rendering");
assert(renderGroup != nullptr);
colorProperty = actor->addProperty(COLOR_PROPERTY, "colour", renderGroup);
properties->mColor()->setValue(colorProperty, color);
thicknessProperty = actor->addProperty(DOUBLE_PROPERTY, "line thickness",
renderGroup);
properties->setDouble(thicknessProperty, thickness, 0., 10., 2, 0.1);
actor->endInitialiseQtProperties();
}
/******************************************************************************
*** PUBLIC METHODS ***
*******************************************************************************/
bool MNWPSkewTActorVariable::onQtPropertyChanged(QtProperty *property)
{
if (MNWPActorVariable::onQtPropertyChanged(property)) return true;
MQtProperties *properties = actor->getQtProperties();
if (property == colorProperty)
{
color = properties->mColor()->value(colorProperty);
return true;
}
else if (property == thicknessProperty)
{
thickness = properties->mDouble()->value(thicknessProperty);
return true;
}
return false;
}
void MNWPSkewTActorVariable::saveConfiguration(QSettings *settings)
{
MNWPActorVariable::saveConfiguration(settings);
settings->setValue("colour", color);
settings->setValue("thickness", thickness);
}
void MNWPSkewTActorVariable::loadConfiguration(QSettings *settings)
{
MNWPActorVariable::loadConfiguration(settings);
MQtProperties *properties = actor->getQtProperties();
properties->mColor()->setValue(colorProperty,
settings->value("colour").value<QColor>());
properties->mDouble()->setValue(thicknessProperty,
settings->value("thickness", 2.).toDouble());
}
} // namespace Met3D
......@@ -6,6 +6,7 @@
**
** Copyright 2015-2018 Marc Rautenhaus
** Copyright 2016-2018 Bianca Tost
** Copyright 2015-2016 Christoph Heidelmann
**
** Computer Graphics and Visualization Group
** Technische Universitaet Muenchen, Garching, Germany
......@@ -178,6 +179,7 @@ public:
MWeatherPredictionDataSource *dataSource;
MVerticalLevelType levelType;
QString variableName;
int numEnsembleMembers;
/* CPU memory object that stores the current data field. */
MStructuredGrid *grid;
......@@ -274,6 +276,7 @@ public slots:
protected:
friend class MNWPVolumeRaycasterActor;
friend class MVerticalRegridProperties;
friend class MSkewTActor;
virtual void releaseDataItems();
virtual void releaseAggregatedDataItems();
......@@ -767,6 +770,29 @@ protected:
private:
};
/**
@brief Variable properties specific to skew-t-diagram.
*/
class MNWPSkewTActorVariable : public MNWPActorVariable
{
public:
MNWPSkewTActorVariable(MNWPMultiVarActor *actor);
bool onQtPropertyChanged(QtProperty *property) override;
void saveConfiguration(QSettings *settings);
void loadConfiguration(QSettings *settings);
QtProperty *colorProperty;
QtProperty *thicknessProperty;
QColor color;
double thickness;
};
} // namespace Met3D
#endif // NWPACTORVARIABLE_H
......@@ -6,6 +6,7 @@
**
** Copyright 2015-2016 Marc Rautenhaus
** Copyright 2016 Bianca Tost
** Copyright 2015-2016 Christoph Heidelmann
**
** Computer Graphics and Visualization Group
** Technische Universitaet Muenchen, Garching, Germany
......@@ -48,7 +49,7 @@
#include "actors/nwpvolumeraycasteractor.h"
#include "actors/nwpsurfacetopographyactor.h"
#include "actors/spatial1dtransferfunction.h"
#include "actors/skewtactor.h"
namespace Met3D
{
......@@ -105,6 +106,7 @@ void MApplicationConfigurationManager::registerActorFactories()
glRM->registerActorFactory(new MTransferFunction1DFactory());
glRM->registerActorFactory(new MSpatial1DTransferFunctionFactory());
glRM->registerActorFactory(new MTrajectoryActorFactory());
glRM->registerActorFactory(new MSkewTActorFactory());
}
......
......@@ -6,6 +6,7 @@
**
** Copyright 2015-2018 Marc Rautenhaus
** Copyright 2015-2018 Michael Kern
** Copyright 2015-2016 Christoph Heidelmann
**
** Computer Graphics and Visualization Group
** Technische Universitaet Muenchen, Garching, Germany
......@@ -532,6 +533,34 @@ double equivalentPotentialTemperature_K_Bolton(
}
float moistAdiabaticLapseRate_K(float T_K, float p_Pa)
{
float TC = T_K - 273.5f;
// Heat of vaporization of water.
float H_v = 1000.f * (2500.8f - 2.36f * TC + 0.0016f
* pow(TC, 2.f) - 0.00006f * pow(TC, 3.f));
// Specific gas constant of dry air.
float R_sd = 287.05f;
// Specific gas constant of water vapor.
float R_sw = 461.51f;
// The dimensionless ratio of the specific gas constant of dry air to the
// specific gas constant for water vapor.
float epsilon = R_sd / R_sw;
// The water vapor pressure of the saturated air.
float e = 6.112f * exp(17.67f * TC / (TC + 243.12f)) * 100.f;
// The mixing ratio of the mass of water vapor to the mass of dry air.
float r = epsilon * (e / (p_Pa - e));
// The specific heat of dry air at constant pressure.
float c_pd = 1004.6f;
float dividend = 1.f + (H_v * r) / ( R_sd * T_K);
float divisor = 1.f + (pow(H_v, 2.f) * r * epsilon)
/ ( c_pd * R_sd * pow(T_K, 2.f));
float tempv = T_K * (1.f + 0.6f * r);
float Rho = p_Pa / (R_sd * tempv);
return (dividend / divisor) / (c_pd * Rho);
}
// Test functions for meteorological computations.
namespace MetRoutinesTests
{
......
......@@ -6,6 +6,7 @@
**
** Copyright 2015-2018 Marc Rautenhaus
** Copyright 2015-2017 Michael Kern
** Copyright 2015-2016 Christoph Heidelmann
**
** Computer Graphics and Visualization Group
** Technische Universitaet Muenchen, Garching, Germany
......@@ -354,6 +355,15 @@ void testEQPT();
}
/**
Calculates the moist adiabatic lapse rate. @see http://en.wikipedia.org/wiki/Lapse_rate
@p T is the temperature in K and @p p the pressure in Pascal.
@return moist adiabatic lapse rate in T(K).
*/
float moistAdiabaticLapseRate_K(float T_K, float p_Pa);
} // namespace Met3D
#endif // METROUTINES_H
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