#4683 clang-format on all files in ApplicationCode

This commit is contained in:
Magne Sjaastad
2019-09-06 10:40:57 +02:00
parent 3a317504bb
commit fe9e567825
2092 changed files with 117952 additions and 111846 deletions

View File

@@ -30,28 +30,28 @@
#include "cafPdmUiListEditor.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT(RimTensorResults, "RimTensorResults");
CAF_PDM_SOURCE_INIT( RimTensorResults, "RimTensorResults" );
namespace caf
{
template<>
template <>
void AppEnum<RimTensorResults::TensorColors>::setUp()
{
addItem(RimTensorResults::WHITE_GRAY_BLACK, "WHITE_GRAY_BLACK", "White, Gray, Black");
addItem(RimTensorResults::ORANGE_BLUE_WHITE, "ORANGE_BLUE_WHITE", "Orange, Blue, White");
addItem(RimTensorResults::MAGENTA_BROWN_GRAY, "MAGENTA_BROWN_GRAY", "Magenta, Brown, Gray");
addItem(RimTensorResults::RESULT_COLORS, "RESULT_COLORS", "Result Colors");
addItem( RimTensorResults::WHITE_GRAY_BLACK, "WHITE_GRAY_BLACK", "White, Gray, Black" );
addItem( RimTensorResults::ORANGE_BLUE_WHITE, "ORANGE_BLUE_WHITE", "Orange, Blue, White" );
addItem( RimTensorResults::MAGENTA_BROWN_GRAY, "MAGENTA_BROWN_GRAY", "Magenta, Brown, Gray" );
addItem( RimTensorResults::RESULT_COLORS, "RESULT_COLORS", "Result Colors" );
setDefault(RimTensorResults::WHITE_GRAY_BLACK);
setDefault( RimTensorResults::WHITE_GRAY_BLACK );
}
template<>
template <>
void AppEnum<RimTensorResults::ScaleMethod>::setUp()
{
addItem(RimTensorResults::RESULT, "RESULT", "Result");
addItem(RimTensorResults::CONSTANT, "CONSTANT", "Constant");
addItem( RimTensorResults::RESULT, "RESULT", "Result" );
addItem( RimTensorResults::CONSTANT, "CONSTANT", "Constant" );
setDefault(RimTensorResults::RESULT);
setDefault( RimTensorResults::RESULT );
}
} // namespace caf
@@ -60,39 +60,39 @@ void AppEnum<RimTensorResults::ScaleMethod>::setUp()
//--------------------------------------------------------------------------------------------------
RimTensorResults::RimTensorResults()
{
CAF_PDM_InitObject("Element Tensor Results", ":/CellResult.png", "", "");
CAF_PDM_InitObject( "Element Tensor Results", ":/CellResult.png", "", "" );
CAF_PDM_InitFieldNoDefault(&arrowColorLegendConfig, "LegendDefinition", "Color Legend", "", "", "");
CAF_PDM_InitFieldNoDefault( &arrowColorLegendConfig, "LegendDefinition", "Color Legend", "", "", "" );
this->arrowColorLegendConfig = new RimRegularLegendConfig();
arrowColorLegendConfig.uiCapability()->setUiHidden(true);
arrowColorLegendConfig.uiCapability()->setUiHidden( true );
CAF_PDM_InitField(&m_resultFieldName, "ResultVariable", QString("ST"), "Value", "", "", "");
m_resultFieldName.uiCapability()->setUiHidden(true);
CAF_PDM_InitField( &m_resultFieldName, "ResultVariable", QString( "ST" ), "Value", "", "", "" );
m_resultFieldName.uiCapability()->setUiHidden( true );
CAF_PDM_InitField(&m_resultFieldNameUiField, "ResultVariableUI", QString("ST"), "Value", "", "", "");
CAF_PDM_InitField( &m_resultFieldNameUiField, "ResultVariableUI", QString( "ST" ), "Value", "", "", "" );
m_resultFieldNameUiField.xmlCapability()->disableIO();
CAF_PDM_InitField(&m_showTensors, "ShowTensors", false, "", "", "", "");
CAF_PDM_InitField( &m_showTensors, "ShowTensors", false, "", "", "", "" );
CAF_PDM_InitField(&m_principal1, "Principal1", true, "Principal 1", "", "", "");
CAF_PDM_InitField(&m_principal2, "Principal2", true, "Principal 2", "", "", "");
CAF_PDM_InitField(&m_principal3, "Principal3", true, "Principal 3", "", "", "");
CAF_PDM_InitField( &m_principal1, "Principal1", true, "Principal 1", "", "", "" );
CAF_PDM_InitField( &m_principal2, "Principal2", true, "Principal 2", "", "", "" );
CAF_PDM_InitField( &m_principal3, "Principal3", true, "Principal 3", "", "", "" );
CAF_PDM_InitField(&m_threshold, "Threshold", 0.0f, "Threshold", "", "", "");
CAF_PDM_InitField( &m_threshold, "Threshold", 0.0f, "Threshold", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_vectorColor, "VectorColor", "Color", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_scaleMethod, "ScaleMethod", "Scale Method", "", "", "");
CAF_PDM_InitField(&m_sizeScale, "SizeScale", 1.0f, "Size Scale", "", "", "");
CAF_PDM_InitField(&m_rangeMode,
"RangeType",
RimRegularLegendConfig::RangeModeEnum(RimRegularLegendConfig::AUTOMATIC_ALLTIMESTEPS),
"Range Type",
"",
"Switches between automatic and user defined range",
"");
CAF_PDM_InitFieldNoDefault( &m_vectorColor, "VectorColor", "Color", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_scaleMethod, "ScaleMethod", "Scale Method", "", "", "" );
CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0f, "Size Scale", "", "", "" );
CAF_PDM_InitField( &m_rangeMode,
"RangeType",
RimRegularLegendConfig::RangeModeEnum( RimRegularLegendConfig::AUTOMATIC_ALLTIMESTEPS ),
"Range Type",
"",
"Switches between automatic and user defined range",
"" );
m_resultFieldNameUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
m_resultFieldNameUiField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
m_resultFieldNameUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
m_resultFieldNameUiField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
}
//--------------------------------------------------------------------------------------------------
@@ -105,18 +105,18 @@ RimTensorResults::~RimTensorResults() {}
//--------------------------------------------------------------------------------------------------
RigFemResultAddress RimTensorResults::selectedTensorResult() const
{
return RigFemResultAddress(resultPositionType(), m_resultFieldName().toStdString(), "");
return RigFemResultAddress( resultPositionType(), m_resultFieldName().toStdString(), "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTensorResults::setShowTensors(bool enableTensors)
void RimTensorResults::setShowTensors( bool enableTensors )
{
m_showTensors = enableTensors;
updateConnectedEditors();
updateUiIconFromState(enableTensors);
updateUiIconFromState( enableTensors );
}
//--------------------------------------------------------------------------------------------------
@@ -186,29 +186,29 @@ RimTensorResults::ScaleMethod RimTensorResults::scaleMethod() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTensorResults::mappingRange(double* min, double* max) const
void RimTensorResults::mappingRange( double* min, double* max ) const
{
*min = cvf::UNDEFINED_DOUBLE;
*max = cvf::UNDEFINED_DOUBLE;
if (scaleMethod() == RESULT)
if ( scaleMethod() == RESULT )
{
Rim3dView* view = nullptr;
firstAncestorOrThisOfType(view);
firstAncestorOrThisOfType( view );
int currentTimeStep = view->currentTimeStep();
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(view);
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
RigFemPartResultsCollection* resultCollection = geoMechView->geoMechCase()->geoMechData()->femPartResults();
if (!resultCollection) return;
if ( !resultCollection ) return;
if (m_rangeMode == RimRegularLegendConfig::AUTOMATIC_ALLTIMESTEPS)
if ( m_rangeMode == RimRegularLegendConfig::AUTOMATIC_ALLTIMESTEPS )
{
resultCollection->minMaxScalarValuesOverAllTensorComponents(selectedTensorResult(), min, max);
resultCollection->minMaxScalarValuesOverAllTensorComponents( selectedTensorResult(), min, max );
}
else if (m_rangeMode == RimRegularLegendConfig::AUTOMATIC_CURRENT_TIMESTEP)
else if ( m_rangeMode == RimRegularLegendConfig::AUTOMATIC_CURRENT_TIMESTEP )
{
resultCollection->minMaxScalarValuesOverAllTensorComponents(selectedTensorResult(), currentTimeStep, min, max);
resultCollection->minMaxScalarValuesOverAllTensorComponents( selectedTensorResult(), currentTimeStep, min, max );
}
}
}
@@ -218,10 +218,12 @@ void RimTensorResults::mappingRange(double* min, double* max) const
//--------------------------------------------------------------------------------------------------
std::vector<RigFemResultAddress> RimTensorResults::observedResults() const
{
RigFemResultAddress mainResult = selectedTensorResult();
std::vector<RigFemResultAddress> tensorComponents = RigFemPartResultsCollection::tensorComponentAddresses(mainResult);
std::vector<RigFemResultAddress> principleComponents = RigFemPartResultsCollection::tensorPrincipalComponentAdresses(mainResult);
tensorComponents.insert(tensorComponents.end(), principleComponents.begin(), principleComponents.end());
RigFemResultAddress mainResult = selectedTensorResult();
std::vector<RigFemResultAddress> tensorComponents = RigFemPartResultsCollection::tensorComponentAddresses(
mainResult );
std::vector<RigFemResultAddress> principleComponents = RigFemPartResultsCollection::tensorPrincipalComponentAdresses(
mainResult );
tensorComponents.insert( tensorComponents.end(), principleComponents.begin(), principleComponents.end() );
return tensorComponents;
}
@@ -247,9 +249,9 @@ QString RimTensorResults::resultFieldName() const
std::vector<std::string> RimTensorResults::getResultMetaDataForUIFieldSetting()
{
std::vector<std::string> fieldNames;
fieldNames.push_back("SE");
fieldNames.push_back("ST");
fieldNames.push_back("E");
fieldNames.push_back( "SE" );
fieldNames.push_back( "ST" );
fieldNames.push_back( "E" );
return fieldNames;
}
@@ -257,21 +259,21 @@ std::vector<std::string> RimTensorResults::getResultMetaDataForUIFieldSetting()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTensorResults::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
void RimTensorResults::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if (changedField == &m_resultFieldNameUiField)
if ( changedField == &m_resultFieldNameUiField )
{
m_resultFieldName = fieldNameFromUi(m_resultFieldNameUiField);
m_resultFieldName = fieldNameFromUi( m_resultFieldNameUiField );
}
else if (changedField == &m_showTensors)
else if ( changedField == &m_showTensors )
{
setShowTensors(m_showTensors);
setShowTensors( m_showTensors );
}
RimGeoMechView* view;
firstAncestorOrThisOfType(view);
firstAncestorOrThisOfType( view );
view->loadDataAndUpdate();
}
@@ -286,29 +288,30 @@ caf::PdmFieldHandle* RimTensorResults::objectToggleField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimTensorResults::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
QList<caf::PdmOptionItemInfo> RimTensorResults::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
*useOptionsOnly = true;
if (fieldNeedingOptions == &m_resultFieldNameUiField)
if ( fieldNeedingOptions == &m_resultFieldNameUiField )
{
std::vector<std::string> fieldCompNames = getResultMetaDataForUIFieldSetting();
for (size_t oIdx = 0; oIdx < fieldCompNames.size(); ++oIdx)
for ( size_t oIdx = 0; oIdx < fieldCompNames.size(); ++oIdx )
{
options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(fieldCompNames[oIdx]),
QString::fromStdString(fieldCompNames[oIdx])));
options.push_back( caf::PdmOptionItemInfo( QString::fromStdString( fieldCompNames[oIdx] ),
QString::fromStdString( fieldCompNames[oIdx] ) ) );
}
}
else if (fieldNeedingOptions == &m_rangeMode)
else if ( fieldNeedingOptions == &m_rangeMode )
{
options.push_back(caf::PdmOptionItemInfo(RimRegularLegendConfig::RangeModeEnum::uiText(RimRegularLegendConfig::AUTOMATIC_ALLTIMESTEPS),
RimRegularLegendConfig::AUTOMATIC_ALLTIMESTEPS));
options.push_back(
caf::PdmOptionItemInfo(RimRegularLegendConfig::RangeModeEnum::uiText(RimRegularLegendConfig::AUTOMATIC_CURRENT_TIMESTEP),
RimRegularLegendConfig::AUTOMATIC_CURRENT_TIMESTEP));
options.push_back( caf::PdmOptionItemInfo( RimRegularLegendConfig::RangeModeEnum::uiText(
RimRegularLegendConfig::AUTOMATIC_ALLTIMESTEPS ),
RimRegularLegendConfig::AUTOMATIC_ALLTIMESTEPS ) );
options.push_back( caf::PdmOptionItemInfo( RimRegularLegendConfig::RangeModeEnum::uiText(
RimRegularLegendConfig::AUTOMATIC_CURRENT_TIMESTEP ),
RimRegularLegendConfig::AUTOMATIC_CURRENT_TIMESTEP ) );
}
return options;
@@ -317,29 +320,29 @@ QList<caf::PdmOptionItemInfo> RimTensorResults::calculateValueOptions(const caf:
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTensorResults::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimTensorResults::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add(&m_resultFieldNameUiField);
uiOrdering.add( &m_resultFieldNameUiField );
caf::PdmUiGroup* visibilityGroup = uiOrdering.addNewGroup("Visibility");
visibilityGroup->add(&m_principal1);
visibilityGroup->add(&m_principal2);
visibilityGroup->add(&m_principal3);
visibilityGroup->add(&m_threshold);
caf::PdmUiGroup* visibilityGroup = uiOrdering.addNewGroup( "Visibility" );
visibilityGroup->add( &m_principal1 );
visibilityGroup->add( &m_principal2 );
visibilityGroup->add( &m_principal3 );
visibilityGroup->add( &m_threshold );
caf::PdmUiGroup* vectorColorsGroup = uiOrdering.addNewGroup("Vector Colors");
vectorColorsGroup->add(&m_vectorColor);
caf::PdmUiGroup* vectorColorsGroup = uiOrdering.addNewGroup( "Vector Colors" );
vectorColorsGroup->add( &m_vectorColor );
caf::PdmUiGroup* vectorSizeGroup = uiOrdering.addNewGroup("Vector Size");
vectorSizeGroup->add(&m_sizeScale);
vectorSizeGroup->add(&m_scaleMethod);
caf::PdmUiGroup* vectorSizeGroup = uiOrdering.addNewGroup( "Vector Size" );
vectorSizeGroup->add( &m_sizeScale );
vectorSizeGroup->add( &m_scaleMethod );
if (m_scaleMethod == RESULT)
if ( m_scaleMethod == RESULT )
{
vectorSizeGroup->add(&m_rangeMode);
vectorSizeGroup->add( &m_rangeMode );
}
uiOrdering.skipRemainingFields(true);
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
@@ -347,20 +350,20 @@ void RimTensorResults::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering
//--------------------------------------------------------------------------------------------------
void RimTensorResults::initAfterRead()
{
m_resultFieldNameUiField = uiFieldName(m_resultFieldName());
m_resultFieldNameUiField = uiFieldName( m_resultFieldName() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTensorResults::defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute)
void RimTensorResults::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if (field == &m_resultFieldNameUiField)
if ( field == &m_resultFieldNameUiField )
{
caf::PdmUiListEditorAttribute* listEditAttr = dynamic_cast<caf::PdmUiListEditorAttribute*>(attribute);
if (listEditAttr)
caf::PdmUiListEditorAttribute* listEditAttr = dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute );
if ( listEditAttr )
{
listEditAttr->m_heightHint = 50;
}
@@ -370,11 +373,11 @@ void RimTensorResults::defineEditorAttribute(const caf::PdmFieldHandle* field,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimTensorResults::uiFieldName(const QString& fieldName)
QString RimTensorResults::uiFieldName( const QString& fieldName )
{
if (fieldName == "NE")
if ( fieldName == "NE" )
{
return QString("E");
return QString( "E" );
}
return fieldName;
@@ -383,11 +386,11 @@ QString RimTensorResults::uiFieldName(const QString& fieldName)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimTensorResults::fieldNameFromUi(const QString& uiFieldName)
QString RimTensorResults::fieldNameFromUi( const QString& uiFieldName )
{
if (uiFieldName == "E")
if ( uiFieldName == "E" )
{
return QString("NE");
return QString( "NE" );
}
return uiFieldName;
@@ -396,9 +399,9 @@ QString RimTensorResults::fieldNameFromUi(const QString& uiFieldName)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTensorResults::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
void RimTensorResults::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
if (m_vectorColor() != RESULT_COLORS)
if ( m_vectorColor() != RESULT_COLORS )
{
uiTreeOrdering.skipRemainingChildren();
}