mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: handle all lagrangian fields in pv reader (issue #585)
- previous only checked for clouds at the last instance and only detected lagrangian fields from the first cloud. Now check for clouds at all instances and detect all of their fields as well.
This commit is contained in:
@ -160,13 +160,59 @@ public:
|
||||
const std::string& datasetName
|
||||
);
|
||||
|
||||
//- Add names to array selection
|
||||
template<class StringType>
|
||||
static label addToArray
|
||||
(
|
||||
vtkDataArraySelection* select,
|
||||
const std::string& prefix,
|
||||
const UList<StringType>& names
|
||||
);
|
||||
|
||||
//- Add names to array selection
|
||||
template<class StringType>
|
||||
static label addToArray
|
||||
(
|
||||
vtkDataArraySelection* select,
|
||||
const UList<StringType>& names,
|
||||
const std::string& suffix = string::null
|
||||
);
|
||||
|
||||
//- Add objects of Type to array selection
|
||||
template<class Type>
|
||||
static label addToSelection
|
||||
(
|
||||
vtkDataArraySelection* select,
|
||||
const std::string& prefix,
|
||||
const IOobjectList& objects
|
||||
);
|
||||
|
||||
//- Add objects of Type to array selection
|
||||
template<class Type>
|
||||
static label addToSelection
|
||||
(
|
||||
vtkDataArraySelection* select,
|
||||
const IOobjectList& objects,
|
||||
const std::string& prefix = string::null
|
||||
const std::string& suffix = string::null
|
||||
);
|
||||
|
||||
//- Add objects of Type to array selection
|
||||
template<class Type>
|
||||
static label addToSelection
|
||||
(
|
||||
vtkDataArraySelection* select,
|
||||
const std::string& prefix,
|
||||
const HashTable<wordHashSet>& objects
|
||||
);
|
||||
|
||||
|
||||
//- Add objects of Type to array selection
|
||||
template<class Type>
|
||||
static label addToSelection
|
||||
(
|
||||
vtkDataArraySelection* select,
|
||||
const HashTable<wordHashSet>& objects,
|
||||
const std::string& suffix = string::null
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -28,29 +28,119 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class StringType>
|
||||
Foam::label Foam::foamPvCore::addToArray
|
||||
(
|
||||
vtkDataArraySelection *select,
|
||||
const std::string& prefix,
|
||||
const UList<StringType>& names
|
||||
)
|
||||
{
|
||||
if (prefix.empty())
|
||||
{
|
||||
for (const auto& name : names)
|
||||
{
|
||||
select->AddArray(name.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& name : names)
|
||||
{
|
||||
select->AddArray((prefix + name).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return names.size();
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
Foam::label Foam::foamPvCore::addToArray
|
||||
(
|
||||
vtkDataArraySelection *select,
|
||||
const UList<StringType>& names,
|
||||
const std::string& suffix
|
||||
)
|
||||
{
|
||||
if (suffix.empty())
|
||||
{
|
||||
for (const auto& name : names)
|
||||
{
|
||||
select->AddArray(name.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& name : names)
|
||||
{
|
||||
select->AddArray((name + suffix).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return names.size();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::label Foam::foamPvCore::addToSelection
|
||||
(
|
||||
vtkDataArraySelection *select,
|
||||
const std::string& prefix,
|
||||
const IOobjectList& objects
|
||||
)
|
||||
{
|
||||
return addToArray(select, prefix, objects.sortedNames(Type::typeName));
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::label Foam::foamPvCore::addToSelection
|
||||
(
|
||||
vtkDataArraySelection *select,
|
||||
const IOobjectList& objects,
|
||||
const std::string& prefix
|
||||
const std::string& suffix
|
||||
)
|
||||
{
|
||||
const wordList names = objects.sortedNames(Type::typeName);
|
||||
return addToArray(select, objects.sortedNames(Type::typeName), suffix);
|
||||
}
|
||||
|
||||
forAll(names, i)
|
||||
|
||||
template<class Type>
|
||||
Foam::label Foam::foamPvCore::addToSelection
|
||||
(
|
||||
vtkDataArraySelection *select,
|
||||
const std::string& prefix,
|
||||
const HashTable<wordHashSet>& objects
|
||||
)
|
||||
{
|
||||
auto iter = objects.cfind(Type::typeName);
|
||||
|
||||
if (iter.found())
|
||||
{
|
||||
if (prefix.empty())
|
||||
{
|
||||
select->AddArray(names[i].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
select->AddArray((prefix + names[i]).c_str());
|
||||
}
|
||||
return addToArray(select, prefix, iter.object().sortedToc());
|
||||
}
|
||||
|
||||
return names.size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::label Foam::foamPvCore::addToSelection
|
||||
(
|
||||
vtkDataArraySelection *select,
|
||||
const HashTable<wordHashSet>& objects,
|
||||
const std::string& suffix
|
||||
)
|
||||
{
|
||||
auto iter = objects.cfind(Type::typeName);
|
||||
|
||||
if (iter.found())
|
||||
{
|
||||
return addToArray(select, iter.object().sortedToc(), suffix);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user