Go to the documentation of this file.
40 { interpolationType::RGB,
"rgb" },
41 { interpolationType::HSV,
"hsv" },
42 { interpolationType::DIVERGING,
"diverging" },
79 dict.readEntry(
"table", table_);
80 interpolationTypeNames.readIfPresent(
"interpolate",
dict, interp_);
98 return table_.first().second();
103 return table_.last().second();
110 [](
const pair_type& pr,
const scalar& val)
113 return (pr.
first() <= val);
120 return table_.first().second();
122 else if (idx == table_.size()-1)
125 return table_.last().second();
128 const scalar t0 = table_[idx].first();
129 const scalar t1 = table_[idx+1].first();
131 const scalar
s = (
x - t0)/(t1 - t0);
133 const vector& rgb0 = table_[idx].second();
134 const vector& rgb1 = table_[idx+1].second();
136 if (interp_ == DIVERGING)
140 else if (interp_ == HSV)
154 for (label i=0; i < nColours; ++i)
156 const scalar
x = scalar(i)/scalar(nColours-1);
168 os.
writeEntry(
"interpolate", interpolationTypeNames[interp_]);
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
colourTable(const List< Tuple2< scalar, vector >> &values, const interpolationType interp=interpolationType::RGB)
Copy construct from table values.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
static autoPtr< colourTable > New(Istream &is)
Read as dictionary content.
static const Enum< interpolationType > interpolationTypeNames
Enumeration names for interpolationType.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
vector value(const scalar x) const
Return the colour at x (within 0-1 range)
interpolationType
Internal interpolation type.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
List< Tuple2< scalar, vector > > table(const label nColours) const
Return a discrete lookup table of colours.
virtual Ostream & endBlock()
Write end block group.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Ostream & writeDict(Ostream &os) const
Write as dictionary format.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Base class for generating a colour table from node points.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Various functions to operate on Lists.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
const T1 & first() const noexcept
Return first.