53int main(
int argc,
char *argv[])
57 "Testing, pre-processing, filtering of surface field data"
71 "Field <scalar> to process (default: T)"
78 "Input format (default: ensight)"
84 const int optVerbose =
args.verbose();
86 const word readFileType
88 args.getOrDefault<
word>(
"read-format",
"ensight")
92 label filterSweeps_(1);
93 scalar filterRadius_(0);
94 args.readIfPresent(
"sweeps", filterSweeps_);
95 args.readIfPresent(
"radius", filterRadius_);
98 <<
"Filter: radius=" << filterRadius_
99 <<
" sweeps=" << filterSweeps_ <<
endl;
102 if ((filterSweeps_ < 1) || (filterRadius_ <= VSMALL))
109 args.readIfPresent(
"field", fieldName);
116 auto& reader = readerPtr_();
118 const label fieldIndex = reader.fieldNames(0).find(fieldName);
119 if (fieldIndex == -1)
122 <<
"Unable to find field name: " << fieldName
123 <<
" in list of available fields: " << reader.fieldNames(0)
132 << geom.
nPoints() <<
" points in "
137 PatchFunction1Types::FilterField::debug = optVerbose;
139 fieldFilter.
reset(geom, filterRadius_);
141 Info<<
nl <<
"Built weights/addressing "
144 Info<<
nl <<
"Processing " << reader.times().size() <<
" times" <<
nl;
155 tfield = fieldFilter.
evaluate(tfield, filterSweeps_);
168 writer.writeCellData(fieldName, tfield());
171 Info<<
nl <<
"Smoothing/writing "
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edgesCentres")))
The FilterField helper class provides a multi-sweep median filter for a Field of data associated with...
tmp< Field< Type > > evaluate(const tmp< Field< Type > > &tinput, const label nSweeps) const
Return the median smoothed field.
void reset()
Reset to unweighted (pass-through).
label nPoints() const
Number of points supporting patch faces.
label nFaces() const noexcept
Number of faces in the patch.
const Field< point_type > & points() const noexcept
Return reference to global points.
Extract command arguments and options from the supplied argc and argv parameters.
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static void noCheckProcessorDirectories()
Disable checking of processor directories.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Starts timing and returns elapsed time from start. Uses std::chrono::high_resolution_clock for better...
double timeIncrement() const
The time [seconds] since the last call to elapsedTime(), timeIncrement() or resetTime(),...
A class for handling file names.
A traits class, which is primarily used for primitives and vector-space.
static autoPtr< surfaceReader > New(const word &readType, const fileName &fName, const dictionary &options=dictionary())
Return a reference to the selected surfaceReader.
A class for managing temporary objects.
Write faces/points (optionally with fields) as a vtp file or a legacy vtk file.
A class for handling words, derived from Foam::string.
static word printf(const char *fmt, const PrimitiveType &val)
Use a printf-style formatter for a primitive.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< instant > instantList
List of instants.
Ostream & endl(Ostream &os)
Add newline and flush stream.
MeshedSurface< face > meshedSurface
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
Specialisations of Field<T> for scalar, vector and tensor.
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.