Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cutPoly: New polyhedral cutting routines and isoSurface algorithm
A set of routines for cutting polyhedra have been added. These can cut polyhedral cells based on the adjacent point values and an iso-value which defines the surface. The method operates directly on the polyhedral cells; it does not decompose them into tetrahedra at any point. The routines can compute the cut topology as well as integrals of properties above and below the cut surface. An iso-surface algorithm has been added based on these polyhedral cutting routines. It is significantly more robust than the previous algorithm, and produces compact surfaces equivalent to the previous algorithm's maximum filtering level. It is also approximately 3 times faster than the previous algorithm, and 10 times faster when run repeatedly on the same set of cells (this is because some addressing is cached and reused). This algorithm is used by the 'isoSurface', 'distanceSurface' and 'cutPlane' sampled surfaces. The 'cutPlane' sampled surface is a renaming of 'cuttingPlane' to make it consistent with the corresponding packaged function. The name 'cuttingPlane' has been retained for backwards compatibility and can still be used to select a 'cutPlane' surface. The legacy 'plane' surface has been removed. The 'average' keyword has been removed from specification of these sampled surfaces as cell-centred values are no longer used in the generation of or interpolation to an iso-surface. The 'filtering' keyword has also been removed as it relates to options within the previous algorithm. Zone support has been reinstated into the 'isoSurface' sampled surface. Interpolation to all these sampled surfaces has been corrected to exactly match the user-selected interpolation scheme, and the interpolation procedure no longer unnecessarily re-generates data that is already available.
- Loading branch information
Will Bainbridge
committed
Nov 23, 2022
1 parent
9a1eadd
commit 723f522
Showing
89 changed files
with
4,461 additions
and
5,819 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
========= | | ||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
\\ / O peration | Website: https://openfoam.org | ||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation | ||
\\/ M anipulation | | ||
------------------------------------------------------------------------------- | ||
License | ||
This file is part of OpenFOAM. | ||
OpenFOAM is free software: you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
#include "HashList.H" | ||
|
||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
|
||
namespace Foam | ||
{ | ||
template<class Type, class Key, class Hash> | ||
const Key HashList<Type, Key, Hash>::nullKey = Key::null; | ||
} | ||
|
||
|
||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
|
||
template<class Type, class Key, class Hash> | ||
Foam::HashList<Type, Key, Hash>::HashList(const label size) | ||
: | ||
List<Tuple2<Key, Type>>(size, Tuple2<Key, Type>(nullKey, Type())) | ||
{} | ||
|
||
|
||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
|
||
template<class Type, class Key, class Hash> | ||
bool Foam::HashList<Type, Key, Hash>::insert(const Key& k, const Type& t) | ||
{ | ||
List<Tuple2<Key, Type>>& map = *this; | ||
|
||
const label n = map.size(); | ||
|
||
const unsigned h = Hash()(k); | ||
|
||
for (label i = 0; i < n; i ++) | ||
{ | ||
const label hi = (h + i) % n; | ||
|
||
if (map[hi].first() == nullKey) | ||
{ | ||
map[hi] = Tuple2<Key, Type>(k, t); | ||
return true; | ||
} | ||
|
||
if (map[hi].first() == k) | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
FatalErrorInFunction | ||
<< "Hash list is full" | ||
<< exit(FatalError); | ||
|
||
return false; | ||
} | ||
|
||
|
||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // | ||
|
||
template<class Type, class Key, class Hash> | ||
const Type& Foam::HashList<Type, Key, Hash>::operator[](const Key& k) const | ||
{ | ||
const List<Tuple2<Key, Type>>& map = *this; | ||
|
||
const label n = map.size(); | ||
|
||
const unsigned h = Hash()(k); | ||
|
||
for (label i = 0; i < n; i ++) | ||
{ | ||
const label hi = (h + i) % n; | ||
|
||
if (map[hi].first() == k) | ||
{ | ||
return map[hi].second(); | ||
} | ||
} | ||
|
||
FatalErrorInFunction | ||
<< "Hash list does not contain key \"" << k << "\"" | ||
<< exit(FatalError); | ||
|
||
return NullObjectRef<Type>(); | ||
} | ||
|
||
|
||
// ************************************************************************* // |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
========= | | ||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
\\ / O peration | Website: https://openfoam.org | ||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation | ||
\\/ M anipulation | | ||
------------------------------------------------------------------------------- | ||
License | ||
This file is part of OpenFOAM. | ||
OpenFOAM is free software: you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
Class | ||
Foam::HashList | ||
Description | ||
HashList class. Like HashTable, but much less dynamic memory-y. Should be | ||
faster for small sets of non-dynamic primitive types (labels, edges, | ||
points, etc...). It is also much less functional at present. There is no | ||
re-sizing, so you have to make sure it is constructed sufficiently large to | ||
hold all the data that will ever be inserted into it. | ||
SourceFiles | ||
HashList.C | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
#include "List.H" | ||
#include "Tuple2.H" | ||
#include "word.H" | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
#ifndef HashList_H | ||
#define HashList_H | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
namespace Foam | ||
{ | ||
|
||
/*---------------------------------------------------------------------------*\ | ||
Class HashList Declaration | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
template<class Type, class Key=word, class Hash=string::hash> | ||
class HashList | ||
: | ||
private List<Tuple2<Key, Type>> | ||
{ | ||
public: | ||
|
||
// Public Static Member Data | ||
|
||
//- Null key value for unset elements in the list | ||
static const Key nullKey; | ||
|
||
|
||
// Constructors | ||
|
||
//- Construct given a size | ||
HashList(const label size); | ||
|
||
|
||
// Member Functions | ||
|
||
//- Insert into the hash list. Return true if the value was newly | ||
// inserted, or false if it was already there. | ||
bool insert(const Key& k, const Type& t); | ||
|
||
|
||
// Member Operators | ||
|
||
//- Retrieve from the hash list | ||
const Type& operator[](const Key& k) const; | ||
}; | ||
|
||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
} // End namespace Foam | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
#ifdef NoRepository | ||
#include "HashList.C" | ||
#endif | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
#endif | ||
|
||
// ************************************************************************* // |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.