40 { interpolationType::RGB,
"rgb" },
42 { interpolationType::DIVERGING,
"diverging" },
50 const List<Tuple2<scalar, vector>>& values,
51 const interpolationType interp
62 const interpolationType interp
65 table_(std::move(values)),
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_]);
169 os.writeEntry(
"table", table_);
Various functions to operate on Lists.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
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
Access the first element.
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.
Base class for generating a colour table from node points.
vector value(const scalar x) const
Return the colour at x. The input is clipped to 0-1 range.
Ostream & writeDict(Ostream &os) const
Write as dictionary format.
static autoPtr< colourTable > New(Istream &is)
Read as dictionary content.
Tuple2< scalar, vector > pair_type
The data lookup type.
colourTable(const List< Tuple2< scalar, vector > > &values, const interpolationType interp=interpolationType::RGB)
Copy construct from table values.
static const Enum< interpolationType > interpolationTypeNames
Enumeration names for interpolationType.
List< Tuple2< scalar, vector > > table(const label nColours) const
Return a discrete lookup table of colours.
interpolationType
Internal interpolation type.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
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))
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.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).