Skip to content

Commit

Permalink
Remove unneeded Undefined property.
Browse files Browse the repository at this point in the history
The nullptr is probably sufficient in the PropertyArray,
which is an array of pointers, for the property to be
undefined.
  • Loading branch information
endJunction committed Jan 3, 2019
1 parent f42d8b0 commit 9a47f59
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 111 deletions.
8 changes: 0 additions & 8 deletions MaterialLib/MPL/Component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,11 @@ namespace MaterialPropertyLib
{
Component::Component()
{
// This method initializes the component property array with constant
// functions of value zero.
_properties = createDefaultUndefinedProperties();

// Some properties can be initialized by other default properties:
_properties[name] = std::make_unique<Constant>("no_name");
}
Component::Component(std::string const& component_name)
{
// This method initializes the component property array with constant
// functions of value zero.
_properties = createDefaultUndefinedProperties();

// Some properties can be initialized by other default properties:
_properties[name] = std::make_unique<Constant>(component_name);
}
Expand Down
10 changes: 0 additions & 10 deletions MaterialLib/MPL/Medium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ namespace MaterialPropertyLib
{
Medium::Medium(BaseLib::ConfigTree const& config)
{
// Default properties are initialized in the first place, such that
// user-defined properties overwrite those defaults.
//
// A method that creates the default properties of the medium. Currently,
// these defaults is the volume fraction average.
//
// Most properties are fine with the volume fraction average, but
// special-defaults are allowed as well...
_properties = createDefaultUndefinedProperties();

// A name of a medium is entirely optional and has no effects
// other than a small gain of clarity in case several media
// should be defined.
Expand Down
5 changes: 5 additions & 0 deletions MaterialLib/MPL/Medium.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ class Medium
/// The vector that holds the phases.
std::vector<std::unique_ptr<Phase>> _phases;
/// The array that holds the medium properties.
///
/// Currently, these defaults is the volume fraction average.
///
/// Most properties are fine with the volume fraction average, but
/// special-defaults are allowed as well...
PropertyArray _properties;

public:
Expand Down
7 changes: 0 additions & 7 deletions MaterialLib/MPL/Phase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ namespace MaterialPropertyLib
{
Phase::Phase(std::string const& phase_name)
{
// Here, all for all properties listed in the Properties enumerator are
// initialized by mole average functions of value zero. However,
// 'special-default' properties are allowed to be set.
//
// After this, other special properties can be set as exceptional defaults.
_properties = createDefaultUndefinedProperties();

std::array<std::string, 4> allowed_phase_names = {
{"solid", "aqueous liquid", "non-aqueous liquid", "gas"}};

Expand Down
6 changes: 6 additions & 0 deletions MaterialLib/MPL/Phase.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class Phase final
{
private:
std::vector<std::unique_ptr<Component>> _components;

/// Here, all for all properties listed in the Properties enumerator are
/// initialized by mole average functions of value zero. However,
/// 'special-default' properties are allowed to be set.
///
/// After this, other special properties can be set as exceptional defaults.
PropertyArray _properties;

public:
Expand Down
17 changes: 0 additions & 17 deletions MaterialLib/MPL/Properties/Properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,4 @@
*/
#pragma once

#include <memory>
#include "Constant.h"
#include "Undefined.h"

namespace MaterialPropertyLib
{
inline PropertyArray createDefaultUndefinedProperties()
{
PropertyArray properties;
for (std::size_t i = 0; i < numberOfProperties; ++i)
{
properties[i] =
std::make_unique<Undefined>(static_cast<PropertyType>(i));
}

return properties;
}
} // namespace MaterialPropertyLib
38 changes: 0 additions & 38 deletions MaterialLib/MPL/Properties/Undefined.cpp

This file was deleted.

31 changes: 0 additions & 31 deletions MaterialLib/MPL/Properties/Undefined.h

This file was deleted.

0 comments on commit 9a47f59

Please sign in to comment.