Skip to content
Snippets Groups Projects
Commit 964755b4 authored by Norihiro Watanabe's avatar Norihiro Watanabe
Browse files

check if the provided values has the same length as _n_components

parent d11697c5
No related branches found
No related tags found
No related merge requests found
......@@ -156,6 +156,8 @@ public:
void initPropertyValue(std::size_t group_id, T const& value)
{
if (_n_components != 1)
OGS_FATAL("Single-component version of initPropertyValue() is called for a multi-components PropertyVector<T*>");
T* p = new T[1];
p[0] = value;
_values[group_id] = p;
......@@ -163,6 +165,9 @@ public:
void initPropertyValue(std::size_t group_id, std::vector<T> const& values)
{
if (_n_components != values.size())
OGS_FATAL("The size of provided values in initPropertyValue() is not same as the number of components in PropertyVector<T*>");
T* p = new T[values.size()];
for (unsigned i=0; i<values.size(); i++)
p[i] = values[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment