40 { interpolationType::RGB,
"rgb" },
41 { interpolationType::HSV,
"hsv" },
42 { interpolationType::DIVERGING,
"diverging" },
50 const List<Tuple2<scalar, vector>>&
values,
51 const interpolationType interp
62 const interpolationType interp
73 const interpolationType interp
79 dict.readEntry(
"table", table_);
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)
152 List<Tuple2<scalar, vector>> lut(nColours);
154 for (label i=0; i < nColours; ++i)
156 const scalar
x = scalar(i)/scalar(nColours-1);
168 os.
writeEntry(
"interpolate", interpolationTypeNames[interp_]);
vector value(const scalar x) const
Return the colour at x. The input is clipped to 0-1 range.
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
Binary search to find the index of the last element in a sorted list that is less than value...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Various functions to operate on Lists.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
List< Tuple2< scalar, vector > > table(const label nColours) const
Return a discrete lookup table of colours.
virtual Ostream & endBlock()
Write end block group.
colourTable(const List< Tuple2< scalar, vector >> &values, const interpolationType interp=interpolationType::RGB)
Copy construct from table values.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
static const Enum< interpolationType > interpolationTypeNames
Enumeration names for interpolationType.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
interpolationType
Internal interpolation type.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
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))
Ostream & writeDict(Ostream &os) const
Write as dictionary format.
static autoPtr< colourTable > New(Istream &is)
Read as dictionary content.