Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HPCAPPs
OpenFOAM-GPU-v2.0
Commits
55e5a777
Commit
55e5a777
authored
Oct 17, 2024
by
shunbo
Browse files
initial commit
parents
Changes
677
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1699 additions
and
0 deletions
+1699
-0
OpenFOAM-v2112/applications/test/PackedList1/Make/files
OpenFOAM-v2112/applications/test/PackedList1/Make/files
+3
-0
OpenFOAM-v2112/applications/test/PackedList1/Make/options
OpenFOAM-v2112/applications/test/PackedList1/Make/options
+2
-0
OpenFOAM-v2112/applications/test/PackedList1/Test-PackedList1.C
...AM-v2112/applications/test/PackedList1/Test-PackedList1.C
+495
-0
OpenFOAM-v2112/applications/test/PackedList2/Make/files
OpenFOAM-v2112/applications/test/PackedList2/Make/files
+3
-0
OpenFOAM-v2112/applications/test/PackedList2/Make/options
OpenFOAM-v2112/applications/test/PackedList2/Make/options
+2
-0
OpenFOAM-v2112/applications/test/PackedList2/Test-PackedList2.C
...AM-v2112/applications/test/PackedList2/Test-PackedList2.C
+386
-0
OpenFOAM-v2112/applications/test/PatchEdgeFaceWave/Make/files
...FOAM-v2112/applications/test/PatchEdgeFaceWave/Make/files
+3
-0
OpenFOAM-v2112/applications/test/PatchEdgeFaceWave/Make/options
...AM-v2112/applications/test/PatchEdgeFaceWave/Make/options
+7
-0
OpenFOAM-v2112/applications/test/PatchEdgeFaceWave/Test-PatchEdgeFaceWave.C
...lications/test/PatchEdgeFaceWave/Test-PatchEdgeFaceWave.C
+170
-0
OpenFOAM-v2112/applications/test/PatchFunction1/Make/files
OpenFOAM-v2112/applications/test/PatchFunction1/Make/files
+3
-0
OpenFOAM-v2112/applications/test/PatchFunction1/Make/options
OpenFOAM-v2112/applications/test/PatchFunction1/Make/options
+14
-0
OpenFOAM-v2112/applications/test/PatchFunction1/Test-PatchFunction1.C
...12/applications/test/PatchFunction1/Test-PatchFunction1.C
+109
-0
OpenFOAM-v2112/applications/test/PatchFunction1/function1Properties
...2112/applications/test/PatchFunction1/function1Properties
+38
-0
OpenFOAM-v2112/applications/test/PatchTools/Make/files
OpenFOAM-v2112/applications/test/PatchTools/Make/files
+3
-0
OpenFOAM-v2112/applications/test/PatchTools/Make/options
OpenFOAM-v2112/applications/test/PatchTools/Make/options
+9
-0
OpenFOAM-v2112/applications/test/PatchTools/Test-PatchTools.C
...FOAM-v2112/applications/test/PatchTools/Test-PatchTools.C
+298
-0
OpenFOAM-v2112/applications/test/PointEdgeWave/Make/files
OpenFOAM-v2112/applications/test/PointEdgeWave/Make/files
+3
-0
OpenFOAM-v2112/applications/test/PointEdgeWave/Make/options
OpenFOAM-v2112/applications/test/PointEdgeWave/Make/options
+5
-0
OpenFOAM-v2112/applications/test/PointEdgeWave/Test-PointEdgeWave.C
...2112/applications/test/PointEdgeWave/Test-PointEdgeWave.C
+143
-0
OpenFOAM-v2112/applications/test/Polynomial/Make/files
OpenFOAM-v2112/applications/test/Polynomial/Make/files
+3
-0
No files found.
Too many changes to show.
To preserve performance only
677 of 677+
files are displayed.
Plain diff
Email patch
OpenFOAM-v2112/applications/test/PackedList1/Make/files
0 → 100644
View file @
55e5a777
Test-PackedList1.C
EXE = $(FOAM_USER_APPBIN)/Test-PackedList1
OpenFOAM-v2112/applications/test/PackedList1/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/PackedList1/Test-PackedList1.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
Application
Description
\*---------------------------------------------------------------------------*/
#include "uLabel.H"
#include "labelRange.H"
#include "bitSet.H"
#include "FlatOutput.H"
#include "IOstreams.H"
using
namespace
Foam
;
template
<
unsigned
Width
>
inline
Ostream
&
report
(
const
PackedList
<
Width
>&
list
,
bool
showBits
=
false
,
bool
debugOutput
=
false
)
{
Info
<<
list
.
info
();
if
(
showBits
)
{
list
.
printBits
(
Info
,
debugOutput
)
<<
nl
;
}
return
Info
;
}
inline
Ostream
&
report
(
const
bitSet
&
bitset
,
bool
showBits
=
false
,
bool
debugOutput
=
false
)
{
Info
<<
bitset
.
info
();
Info
<<
"all:"
<<
bitset
.
all
()
<<
" any:"
<<
bitset
.
any
()
<<
" none:"
<<
bitset
.
none
()
<<
nl
;
if
(
showBits
)
{
bitset
.
printBits
(
Info
,
debugOutput
)
<<
nl
;
}
return
Info
;
}
// BitOps::printBits((Info<< list1.info()), true) << nl;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
Info
<<
"
\n
test allocation with value
\n
"
;
PackedList
<
3
>
list1
(
5
,
1
);
report
(
list1
);
Info
<<
"
\n
test assign uniform value
\n
"
;
list1
=
3
;
report
(
list1
);
Info
<<
"
\n
test assign uniform value (with overflow)
\n
"
;
list1
=
-
1
;
report
(
list1
);
Info
<<
"
\n
test zero
\n
"
;
list1
=
0
;
report
(
list1
);
Info
<<
"
\n
test set() with default argument (max_value)
\n
"
;
list1
.
set
(
1
);
list1
.
set
(
3
);
report
(
list1
);
Info
<<
"
\n
test unset() with in-range and out-of-range
\n
"
;
list1
.
unset
(
3
);
list1
.
unset
(
100000
);
report
(
list1
);
Info
<<
"
\n
test assign between references
\n
"
;
list1
[
2
]
=
3
;
list1
[
4
]
=
list1
[
2
];
report
(
list1
);
Info
<<
"
\n
set auto-vivify entries
\n
"
;
list1
[
1
]
=
2
;
list1
.
set
(
8
,
2
);
list1
.
set
(
10
,
2
);
list1
.
set
(
14
,
2
);
report
(
list1
);
Info
<<
"values() : "
<<
flatOutput
(
list1
.
unpack
<
char
>
())
<<
nl
<<
"values(5,8) : "
<<
flatOutput
(
list1
.
unpack
<
char
>
(
labelRange
(
5
,
8
)))
<<
nl
;
{
labelList
locations
({
-
5
,
-
2
,
2
,
1
,
8
});
Info
<<
"values at "
<<
flatOutput
(
locations
)
<<
" = "
<<
flatOutput
(
list1
.
unpack
<
char
>
(
locations
))
<<
nl
;
}
Info
<<
"
\n
test operator== between references
\n
"
;
if
(
list1
[
1
]
==
list1
[
8
])
{
Info
<<
"[1] == [8] (expected)
\n
"
;
}
else
{
Info
<<
"[1] != [8] (unexpected)
\n
"
;
}
if
(
list1
[
0
]
!=
list1
[
1
])
{
Info
<<
"[0] != [1] (expected)
\n
"
;
}
else
{
Info
<<
"[0] == [1] (unexpected)
\n
"
;
}
{
const
PackedList
<
3
>&
constLst
=
list1
;
Info
<<
"
\n
test operator[] const with out-of-range index
\n
"
;
report
(
constLst
);
if
(
constLst
[
20
])
{
Info
<<
"[20] is true (unexpected)
\n
"
;
}
else
{
Info
<<
"[20] is false (expected) list size should be unchanged "
<<
"(const)
\n
"
;
}
report
(
constLst
);
Info
<<
"
\n
test operator[] non-const with out-of-range index
\n
"
;
// Expect failure
const
bool
oldThrowingError
=
FatalError
.
throwing
(
true
);
try
{
if
(
list1
[
20
])
{
Info
<<
"[20] is true (unexpected)
\n
"
;
}
else
{
Info
<<
"[20] is false (expected) but list was resized?? "
<<
"(non-const)
\n
"
;
}
}
catch
(
const
Foam
::
error
&
err
)
{
Info
<<
"Failed (expected) "
<<
err
<<
nl
<<
endl
;
}
FatalError
.
throwing
(
oldThrowingError
);
report
(
list1
);
}
{
Info
<<
"
\n
test operator[] with out-of-range index
\n
"
;
// Expect failure
const
bool
oldThrowingError
=
FatalError
.
throwing
(
true
);
try
{
if
(
!
list1
[
20
])
{
Info
<<
"[20] is false, as expected for const-access
\n
"
;
}
}
catch
(
const
Foam
::
error
&
err
)
{
Info
<<
"Failed (expected) "
<<
err
<<
nl
<<
endl
;
}
FatalError
.
throwing
(
oldThrowingError
);
report
(
list1
);
}
Info
<<
"
\n
test resize with value (without reallocation)
\n
"
;
list1
.
resize
(
8
,
list1
.
max_value
);
report
(
list1
);
Info
<<
"
\n
test set() function
\n
"
;
list1
.
set
(
1
,
5
);
report
(
list1
);
Info
<<
"
\n
test assign bool
\n
"
;
list1
=
false
;
report
(
list1
);
Info
<<
"
\n
test assign bool
\n
"
;
list1
=
true
;
report
(
list1
);
Info
<<
"
\n
test resize without value (with reallocation)
\n
"
;
list1
.
resize
(
12
);
report
(
list1
);
Info
<<
"
\n
test resize with value (with reallocation)
\n
"
;
list1
.
resize
(
25
,
list1
.
max_value
);
report
(
list1
);
Info
<<
"
\n
test resize smaller (should not touch allocation)
\n
"
;
list1
.
resize
(
8
);
report
(
list1
);
Info
<<
"
\n
test append() operation
\n
"
;
list1
.
append
(
2
);
list1
.
append
(
3
);
list1
.
append
(
4
);
report
(
list1
);
Info
<<
"
\n
test reserve() operation
\n
"
;
list1
.
reserve
(
32
);
report
(
list1
);
Info
<<
"
\n
test shrink() operation
\n
"
;
list1
.
shrink
();
report
(
list1
);
Info
<<
"
\n
test setCapacity() operation
\n
"
;
list1
.
setCapacity
(
15
);
report
(
list1
);
Info
<<
"
\n
test setCapacity() operation
\n
"
;
list1
.
setCapacity
(
100
);
report
(
list1
);
// Expect failure
{
const
bool
oldThrowingError
=
FatalError
.
throwing
(
true
);
Info
<<
"
\n
test operator[] assignment with auto-vivify
\n
"
;
try
{
list1
[
16
]
=
5
;
list1
[
36
]
=
list1
.
max_value
;
}
catch
(
const
Foam
::
error
&
err
)
{
Info
<<
"Failed (expected) "
<<
err
<<
nl
<<
endl
;
Info
<<
"Using set(...) instead"
<<
nl
;
list1
.
set
(
36
,
list1
.
max_value
);
}
FatalError
.
throwing
(
oldThrowingError
);
report
(
list1
);
}
Info
<<
"
\n
test setCapacity smaller
\n
"
;
list1
.
setCapacity
(
24
);
report
(
list1
);
Info
<<
"
\n
test resize much larger
\n
"
;
list1
.
resize
(
150
);
report
(
list1
);
Info
<<
"
\n
test trim
\n
"
;
list1
.
trim
();
report
(
list1
);
// Add in some misc values
list1
.
set
(
31
,
1
);
list1
.
set
(
32
,
2
);
list1
.
set
(
33
,
3
);
Info
<<
"
\n
test get() method
\n
"
;
Info
<<
"get(10):"
<<
list1
.
get
(
10
)
<<
" and list[10]:"
<<
list1
[
10
]
<<
"
\n
"
;
report
(
list1
);
Info
<<
"
\n
test set() auto-vivify
\n
"
;
Info
<<
"size:"
<<
list1
.
size
()
<<
"
\n
"
;
Info
<<
"list[45]:"
<<
list1
.
get
(
45
)
<<
"
\n
"
;
Info
<<
"size after read:"
<<
list1
.
size
()
<<
"
\n
"
;
list1
.
set
(
45
,
list1
.
max_value
);
Info
<<
"size after write:"
<<
list1
.
size
()
<<
"
\n
"
;
Info
<<
"list[45]:"
<<
list1
[
45
]
<<
"
\n
"
;
list1
.
set
(
49
,
list1
.
get
(
100
));
report
(
list1
);
Info
<<
"
\n
test copy constructor + append
\n
"
;
PackedList
<
3
>
list2
(
list1
);
list2
.
append
(
4
);
Info
<<
"source list:
\n
"
;
report
(
list1
);
Info
<<
"destination list:
\n
"
;
report
(
list2
);
Info
<<
"
\n
test pattern that fills all bits
\n
"
;
PackedList
<
4
>
list3
(
8
,
8
);
label
pos
=
list3
.
size
()
-
1
;
list3
[
pos
--
]
=
list3
.
max_value
;
list3
[
pos
--
]
=
0
;
list3
[
pos
--
]
=
list3
.
max_value
;
report
(
list3
);
Info
<<
"removed final value: "
<<
list3
.
remove
()
<<
endl
;
report
(
list3
);
Info
<<
"list: "
<<
list3
<<
endl
;
List
<
bool
>
list4
(
16
,
false
);
{
// fill with some values
forAll
(
list4
,
i
)
{
list4
[
i
]
=
i
%
3
;
}
const
UList
<
bool
>&
constLst
=
list4
;
Info
<<
"
\n
test operator[] const with out-of-range index
\n
"
;
Info
<<
constLst
<<
endl
;
if
(
constLst
[
100
])
{
Info
<<
"[100] is true (unexpected)
\n
"
;
}
else
{
Info
<<
"[100] is false (expected) "
<<
"list size should be unchanged (const)
\n
"
;
}
Info
<<
constLst
<<
endl
;
}
bitSet
listb
(
list4
);
Info
<<
"copied from bool list "
<<
endl
;
// report(listb);
{
labelList
indices
=
listb
.
toc
();
Info
<<
"indices: "
<<
indices
<<
endl
;
}
Info
<<
nl
<<
"resizing: "
<<
nl
;
{
PackedList
<
1
>
list1
(
81
,
1
);
PackedList
<
3
>
list3
(
27
,
5
);
// ie, 101
Info
<<
"initial"
<<
nl
;
report
(
list1
,
true
);
Info
<<
"initial"
<<
nl
;
report
(
list3
,
true
);
list1
.
resize
(
118
,
1
);
list3
.
resize
(
37
,
3
);
Info
<<
"extend with val"
<<
nl
;
report
(
list1
,
true
);
Info
<<
"extend with val"
<<
nl
;
report
(
list3
,
true
);
list1
.
resize
(
90
,
0
);
list3
.
resize
(
30
,
4
);
Info
<<
"contract with val"
<<
nl
;
report
(
list1
,
true
);
Info
<<
"contract with val"
<<
nl
;
report
(
list3
,
true
);
}
{
bitSet
bits
(
45
);
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
=
true
;
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
unset
(
35
);
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
resize
(
39
);
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
Info
<<
"values:"
<<
flatOutput
(
bits
.
values
())
<<
nl
;
Info
<<
"used:"
<<
flatOutput
(
bits
.
toc
())
<<
nl
;
bits
.
unset
(
labelRange
(
-
15
,
8
));
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
set
(
labelRange
(
-
15
,
100
));
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
set
(
labelRange
(
-
15
,
100
));
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
set
(
labelRange
(
150
,
15
));
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
set
(
labelRange
(
5
));
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
reset
();
bits
.
resize
(
50
);
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
set
(
labelRange
(
4
,
8
));
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
set
(
labelRange
(
30
,
35
));
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
set
(
labelRange
(
80
,
12
));
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
unset
(
labelRange
(
35
,
16
));
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
unset
(
labelRange
(
50
));
bits
.
resize
(
100000
);
bits
.
set
(
labelRange
(
30
,
6
));
bits
[
33
]
=
false
;
Info
<<
"used: "
<<
flatOutput
(
bits
.
toc
())
<<
endl
;
Info
<<
"first: "
<<
bits
.
find_first
()
<<
endl
;
Info
<<
"next: "
<<
bits
.
find_next
(
29
)
<<
endl
;
Info
<<
"next: "
<<
bits
.
find_next
(
30
)
<<
endl
;
Info
<<
"next: "
<<
bits
.
find_next
(
31
)
<<
endl
;
Info
<<
"next: "
<<
bits
.
find_next
(
31
)
<<
endl
;
bits
.
set
(
labelRange
(
80
,
10
));
bits
.
resize
(
100
);
Info
<<
"bits"
<<
nl
;
report
(
bits
,
true
);
bits
.
set
(
labelRange
(
125
,
10
));
Info
<<
"next: "
<<
bits
.
find_next
(
64
)
<<
endl
;
Info
<<
"used: "
<<
flatOutput
(
bits
.
toc
())
<<
endl
;
for
(
const
auto
pos
:
bits
)
{
Info
<<
"have: "
<<
pos
<<
nl
;
}
}
Info
<<
"
\n\n
Done.
\n
"
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/PackedList2/Make/files
0 → 100644
View file @
55e5a777
Test-PackedList2.C
EXE = $(FOAM_USER_APPBIN)/Test-PackedList2
OpenFOAM-v2112/applications/test/PackedList2/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/PackedList2/Test-PackedList2.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
-------------------------------------------------------------------------------
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/>.
Application
Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "boolList.H"
#include "bitSet.H"
#include "HashSet.H"
#include "cpuTime.H"
#include <vector>
#include <unordered_set>
using
namespace
Foam
;
#undef TEST_STD_BOOLLIST
#undef TEST_STD_UNORDERED_SET
template
<
class
T
>
void
printInfo
(
const
std
::
unordered_set
<
T
,
Foam
::
Hash
<
T
>>&
ht
)
{
Info
<<
"std::unordered_set elements:"
<<
ht
.
size
()
<<
" buckets:"
<<
ht
.
bucket_count
()
<<
" load_factor: "
<<
ht
.
load_factor
()
<<
nl
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
const
label
n
=
1000000
;
const
label
nIters
=
1000
;
unsigned
long
sum
=
0
;
bitSet
packed
(
n
,
true
);
boolList
unpacked
(
n
,
true
);
#ifdef TEST_STD_BOOLLIST
std
::
vector
<
bool
>
stdBoolList
(
n
,
true
);
#endif
cpuTime
timer
;
labelHashSet
emptyHash
;
labelHashSet
fullHash
(
1024
);
for
(
label
i
=
0
;
i
<
n
;
i
++
)
{
fullHash
.
insert
(
i
);
}
Info
<<
"populated labelHashSet in "
<<
timer
.
cpuTimeIncrement
()
<<
" s
\n\n
"
;
#ifdef TEST_STD_UNORDERED_SET
std
::
unordered_set
<
label
,
Foam
::
Hash
<
label
>>
emptyStdHash
;
std
::
unordered_set
<
label
,
Foam
::
Hash
<
label
>>
fullStdHash
;
fullStdHash
.
reserve
(
1024
);
for
(
label
i
=
0
;
i
<
n
;
i
++
)
{
fullStdHash
.
insert
(
i
);
}
Info
<<
"populated unordered_set in "
<<
timer
.
cpuTimeIncrement
()
<<
" s
\n\n
"
;
#endif
emptyHash
.
printInfo
(
Info
);
fullHash
.
printInfo
(
Info
);
#ifdef TEST_STD_UNORDERED_SET
printInfo
(
emptyStdHash
);
printInfo
(
fullStdHash
);
#endif
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
packed
.
resize
(
40
);
packed
.
shrink
();
packed
.
resize
(
n
,
1
);
}
Info
<<
"resize/shrink/resize:"
<<
timer
.
cpuTimeIncrement
()
<<
" s
\n\n
"
;
Info
<<
"packed bool size="
<<
packed
.
size
()
<<
nl
;
// Neither of these should affect the size
packed
.
unset
(
2
*
n
-
1
);
packed
.
set
(
2
*
n
-
1
,
0
);
Info
<<
"packed bool size="
<<
packed
.
size
()
<<
nl
;
// set every other bit on:
Info
<<
"set every other bit on and count
\n
"
;
packed
.
storage
()
=
0xAAAAAAAAu
;
// Count packed
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
packed
,
i
)
{
sum
+=
packed
[
i
];
}
}
std
::
cout
<<
"Counting brute-force:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
// Count packed
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
sum
+=
packed
.
count
();
}
std
::
cout
<<
"Counting via count():"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
// Dummy addition
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
unpacked
,
i
)
{
sum
+=
i
+
1
;
}
}
std
::
cout
<<
"Dummy loop:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
" (sum is meaningless)"
<<
nl
;
//
// Read
//
#ifdef TEST_STD_BOOLLIST
// Read stl
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
for
(
unsigned
int
i
=
0
;
i
<
stdBoolList
.
size
();
i
++
)
{
sum
+=
stdBoolList
[
i
];
}
}
std
::
cout
<<
"Reading stdBoolList:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
#endif
// Read unpacked
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
unpacked
,
i
)
{
sum
+=
unpacked
[
i
];
}
}
std
::
cout
<<
"Reading unpacked:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
// Read packed
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
packed
,
i
)
{
sum
+=
packed
.
get
(
i
);
}
}
std
::
cout
<<
"Reading packed using get:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
// Read packed
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
packed
,
i
)
{
sum
+=
packed
[
i
];
}
}
std
::
cout
<<
"Reading packed using reference:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
// Read empty hash
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
unpacked
,
i
)
{
sum
+=
emptyHash
.
found
(
i
);
}
}
std
::
cout
<<
"Reading empty labelHashSet:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
// Read full hash
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
unpacked
,
i
)
{
sum
+=
fullHash
.
found
(
i
);
}
}
std
::
cout
<<
"Reading full labelHashSet:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
#ifdef TEST_STD_UNORDERED_SET
// Read empty stl set
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
unpacked
,
i
)
{
sum
+=
(
emptyStdHash
.
find
(
i
)
!=
emptyStdHash
.
cend
());
}
}
std
::
cout
<<
"Reading empty std::unordered_set:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
// Read full stl set
sum
=
0
;
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
unpacked
,
i
)
{
sum
+=
(
fullStdHash
.
find
(
i
)
!=
fullStdHash
.
cend
());
}
}
std
::
cout
<<
"Reading full std::unordered_set:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
" sum "
<<
sum
<<
nl
;
#endif
Info
<<
"Starting write tests"
<<
nl
;
//
// Write
//
#ifdef TEST_STD_BOOLLIST
// Read stl
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
for
(
unsigned
int
i
=
0
;
i
<
stdBoolList
.
size
();
i
++
)
{
stdBoolList
[
i
]
=
true
;
}
}
Info
<<
"Writing stdBoolList:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
;
#endif
// Write unpacked
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
unpacked
,
i
)
{
unpacked
[
i
]
=
true
;
}
}
Info
<<
"Writing unpacked:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
;
// Write packed
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
packed
,
i
)
{
packed
[
i
]
=
1
;
}
}
Info
<<
"Writing packed using reference:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
;
// Write packed
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
forAll
(
packed
,
i
)
{
packed
.
set
(
i
,
1
);
}
}
Info
<<
"Writing packed using set:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
;
// Write packed
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
packed
=
0
;
}
Info
<<
"Writing packed uniform 0:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
;
// Write packed
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
packed
=
1
;
}
Info
<<
"Writing packed uniform 1:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
;
PackedList
<
3
>
oddPacked
(
n
,
3
);
// Write packed
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
packed
=
0
;
}
Info
<<
"Writing packed<3> uniform 0:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
;
// Write packed
for
(
label
iter
=
0
;
iter
<
nIters
;
++
iter
)
{
packed
=
1
;
}
Info
<<
"Writing packed<3> uniform 1:"
<<
timer
.
cpuTimeIncrement
()
<<
" s"
<<
nl
;
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/PatchEdgeFaceWave/Make/files
0 → 100644
View file @
55e5a777
Test-PatchEdgeFaceWave.C
EXE = $(FOAM_USER_APPBIN)/Test-PatchEdgeFaceWave
OpenFOAM-v2112/applications/test/PatchEdgeFaceWave/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools
OpenFOAM-v2112/applications/test/PatchEdgeFaceWave/Test-PatchEdgeFaceWave.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
-------------------------------------------------------------------------------
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/>.
Description
Test PatchEdgeFaceWave.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "fvMesh.H"
#include "PatchEdgeFaceWave.H"
#include "patchEdgeFaceInfo.H"
#include "patchPatchDist.H"
#include "fvCFD.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addArgument
(
"patch"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
const
polyBoundaryMesh
&
patches
=
mesh
.
boundaryMesh
();
// Get name of patch
const
word
patchName
=
args
[
1
];
const
polyPatch
&
patch
=
patches
[
patchName
];
// 1. Walk from a single edge
{
// Data on all edges and faces
List
<
patchEdgeFaceInfo
>
allEdgeInfo
(
patch
.
nEdges
());
List
<
patchEdgeFaceInfo
>
allFaceInfo
(
patch
.
size
());
// Initial seed
DynamicList
<
label
>
initialEdges
;
DynamicList
<
patchEdgeFaceInfo
>
initialEdgesInfo
;
// Just set an edge on the master
if
(
Pstream
::
master
())
{
label
edgeI
=
0
;
Info
<<
"Starting walk on edge "
<<
edgeI
<<
endl
;
initialEdges
.
append
(
edgeI
);
const
edge
&
e
=
patch
.
edges
()[
edgeI
];
initialEdgesInfo
.
append
(
patchEdgeFaceInfo
(
e
.
centre
(
patch
.
localPoints
()),
0
.
0
)
);
}
// Walk
PatchEdgeFaceWave
<
primitivePatch
,
patchEdgeFaceInfo
>
calc
(
mesh
,
patch
,
initialEdges
,
initialEdgesInfo
,
allEdgeInfo
,
allFaceInfo
,
returnReduce
(
patch
.
nEdges
(),
sumOp
<
label
>
())
);
// Extract as patchField
volScalarField
vsf
(
IOobject
(
"patchDist"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
dimLength
,
Zero
)
);
scalarField
pf
(
vsf
.
boundaryField
()[
patch
.
index
()].
size
());
forAll
(
pf
,
facei
)
{
pf
[
facei
]
=
Foam
::
sqrt
(
allFaceInfo
[
facei
].
distSqr
());
}
vsf
.
boundaryFieldRef
()[
patch
.
index
()]
=
pf
;
Info
<<
"Writing patchDist volScalarField to "
<<
runTime
.
value
()
<<
endl
;
vsf
.
write
();
}
// 2. Use a wrapper to walk from all boundary edges on selected patches
{
labelHashSet
otherPatchIDs
(
identity
(
mesh
.
boundaryMesh
().
size
()));
otherPatchIDs
.
erase
(
patch
.
index
());
Info
<<
"Walking on patch "
<<
patch
.
index
()
<<
" from edges shared with patches "
<<
otherPatchIDs
<<
endl
;
patchPatchDist
pwd
(
patch
,
otherPatchIDs
);
// Extract as patchField
volScalarField
vsf
(
IOobject
(
"otherPatchDist"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
dimLength
,
Zero
)
);
vsf
.
boundaryFieldRef
()[
patch
.
index
()]
=
pwd
;
Info
<<
"Writing otherPatchDist volScalarField to "
<<
runTime
.
value
()
<<
endl
;
vsf
.
write
();
}
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/PatchFunction1/Make/files
0 → 100644
View file @
55e5a777
Test-PatchFunction1.C
EXE = $(FOAM_USER_APPBIN)/Test-PatchFunction1
OpenFOAM-v2112/applications/test/PatchFunction1/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-DFULLDEBUG -g -O0 \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-llagrangianIntermediate \
-lradiationModels \
-lregionModels \
-lfiniteVolume \
-lmeshTools \
-lsampling
OpenFOAM-v2112/applications/test/PatchFunction1/Test-PatchFunction1.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
Application
Test-Function1
Description
Tests Function1
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "PatchFunction1.H"
#include "IOdictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
IOdictionary
function1Properties
(
IOobject
(
"function1Properties"
,
runTime
.
constant
(),
mesh
,
IOobject
::
MUST_READ_IF_MODIFIED
,
IOobject
::
NO_WRITE
)
);
autoPtr
<
PatchFunction1
<
vector
>>
function1
(
PatchFunction1
<
vector
>::
New
(
mesh
.
boundaryMesh
()[
0
],
"function1"
,
function1Properties
)
);
scalar
x0
=
function1Properties
.
get
<
scalar
>
(
"x0"
);
scalar
x1
=
function1Properties
.
get
<
scalar
>
(
"x1"
);
Info
<<
"Data entry type: "
<<
function1
().
type
()
<<
nl
<<
endl
;
Info
<<
"Inputs"
<<
nl
<<
" x0 = "
<<
x0
<<
nl
<<
" x1 = "
<<
x1
<<
nl
<<
endl
;
Info
<<
"Interpolation"
<<
nl
<<
" f(x0) = "
<<
function1
().
value
(
x0
)
<<
nl
<<
" f(x1) = "
<<
function1
().
value
(
x1
)
<<
nl
<<
endl
;
Info
<<
"Integration"
<<
nl
<<
" int(f(x)) lim(x0->x1) = "
<<
function1
().
integrate
(
x0
,
x1
)
<<
nl
<<
endl
;
volVectorField
fld
(
IOobject
(
"value"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
,
false
),
mesh
,
dimensionedVector
(
Zero
)
);
fld
.
boundaryFieldRef
()[
0
]
==
function1
().
value
(
x0
);
fld
.
write
();
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/PatchFunction1/function1Properties
0 → 100644
View file @
55e5a777
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object function1Properties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
x0 0.5;
x1 1;
//- Dictionary notation
function1 uniformValue;
function1Coeffs
{
function1 (0 1 0); //table ((0 (0 0 0))(1 (1 1 1)));
coordinateSystem
{
type cylindrical;
origin (0.05 0.1 0.05);
e3 (0 1 0);
e1 (1 0 0);
}
scale1 table ((0 (0 0 0))(1 (1 1 1)));
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/PatchTools/Make/files
0 → 100644
View file @
55e5a777
Test-PatchTools.C
EXE = $(FOAM_USER_APPBIN)/Test-PatchTools
OpenFOAM-v2112/applications/test/PatchTools/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfileFormats \
-lsurfMesh \
-lmeshTools
OpenFOAM-v2112/applications/test/PatchTools/Test-PatchTools.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
Application
Test-PatchTools
Description
Test app for PatchTools functionality
\*---------------------------------------------------------------------------*/
#include "PatchTools.H"
#include "argList.H"
#include "Time.H"
#include "OBJstream.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//template<class PatchType>
//Foam::tmp<Foam::pointField>
//areaPointNormals
//(
// const polyMesh& mesh,
// const PatchType& p,
// const labelList& meshFaces
//)
//{
// // Assume patch is smaller than the globalData().coupledPatch() (?) so
// // loop over patch meshPoints.
//
// const labelList& meshPoints = p.meshPoints();
//
// const globalMeshData& globalData = mesh.globalData();
// const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
// const Map<label>& coupledPatchMP = coupledPatch.meshPointMap();
// const mapDistribute& map = globalData.globalPointSlavesMap();
// const globalIndexAndTransform& transforms =
// globalData.globalTransforms();
//
//
// // 1. Start off with local (area-weighted) normals
// // (note:without calculating pointNormals
// // to avoid them being stored)
//
// tmp<pointField> textrudeN(new pointField(p.nPoints(), Zero));
// pointField& extrudeN = textrudeN();
// {
// const faceList& localFaces = p.localFaces();
// const vectorField& faceAreas = mesh.faceAreas();
//
// forAll(localFaces, facei)
// {
// const face& f = localFaces[facei];
// const vector& n = faceAreas[meshFaces[facei]];
// forAll(f, fp)
// {
// extrudeN[f[fp]] += n;
// }
// }
// }
//
//
// // Collect local pointFaces
// List<List<point>> pointFaceNormals(map.constructSize());
// {
// const vectorField& faceAreas = mesh.faceAreas();
//
// forAll(meshPoints, patchPointi)
// {
// label meshPointi = meshPoints[patchPointi];
// Map<label>::const_iterator fnd = coupledPatchMP.find(meshPointi);
// if (fnd != coupledPatchMP.end())
// {
// label coupledPointi = fnd();
//
// List<point>& pNormals = pointFaceNormals[coupledPointi];
// const labelList& pFaces = p.pointFaces()[patchPointi];
// pNormals.setSize(pFaces.size());
// forAll(pFaces, i)
// {
// pNormals[i] = faceAreas[meshFaces[pFaces[i]]];
// }
// }
// }
// }
//
// // Pull remote data into local slots
// map.distribute
// (
// transforms,
// pointFaceNormals,
// listTransform()
// );
//
//
// // Combine normals
// const labelListList& slaves = globalData.globalPointSlaves();
// const labelListList& transformedSlaves =
// globalData.globalPointTransformedSlaves();
//
//
// pointField coupledPointNormals(map.constructSize(), Zero);
//
// forAll(meshPoints, patchPointi)
// {
// label meshPointi = meshPoints[patchPointi];
// Map<label>::const_iterator fnd = coupledPatchMP.find(meshPointi);
// if (fnd != coupledPatchMP.end())
// {
// label coupledPointi = fnd();
// const labelList& slaveSlots = slaves[coupledPointi];
// const labelList& transformedSlaveSlots =
// transformedSlaves[coupledPointi];
//
// label nFaces = slaveSlots.size()+transformedSlaveSlots.size();
// if (nFaces > 0)
// {
// // Combine
// point& n = coupledPointNormals[coupledPointi];
//
// n += sum(pointFaceNormals[coupledPointi]);
//
// forAll(slaveSlots, i)
// {
// n += sum(pointFaceNormals[slaveSlots[i]]);
// }
// forAll(transformedSlaveSlots, i)
// {
// n += sum(pointFaceNormals[transformedSlaveSlots[i]]);
// }
//
// // Put back into slave slots
// forAll(slaveSlots, i)
// {
// coupledPointNormals[slaveSlots[i]] = n;
// }
// forAll(transformedSlaveSlots, i)
// {
// coupledPointNormals[transformedSlaveSlots[i]] = n;
// }
// }
// }
// }
//
//
// // Send back
// map.reverseDistribute
// (
// transforms,
// coupledPointNormals.size(),
// coupledPointNormals,
// mapDistribute::transform()
// );
//
//
// // Override patch normals
// forAll(meshPoints, patchPointi)
// {
// label meshPointi = meshPoints[patchPointi];
// Map<label>::const_iterator fnd = coupledPatchMP.find(meshPointi);
// if (fnd != coupledPatchMP.end())
// {
// label coupledPointi = fnd();
// extrudeN[patchPointi] = coupledPointNormals[coupledPointi];
// }
// }
//
// extrudeN /= mag(extrudeN)+VSMALL;
//
// return textrudeN;
//}
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
#include "addTimeOptions.H"
argList
::
addArgument
(
"patch"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createPolyMesh.H"
const
word
patchName
=
args
[
1
];
label
patchi
=
mesh
.
boundaryMesh
().
findPatchID
(
patchName
);
const
polyPatch
&
pp
=
mesh
.
boundaryMesh
()[
patchi
];
const
indirectPrimitivePatch
&
cpp
=
mesh
.
globalData
().
coupledPatch
();
{
OBJstream
str
(
runTime
.
path
()
/
"edgePatchNormals.obj"
);
labelList
patchEdges
;
labelList
coupledEdges
;
bitSet
sameEdgeOrientation
;
PatchTools
::
matchEdges
(
pp
,
cpp
,
patchEdges
,
coupledEdges
,
sameEdgeOrientation
);
const
pointField
en
(
PatchTools
::
edgeNormals
(
mesh
,
pp
,
patchEdges
,
coupledEdges
)
);
forAll
(
en
,
patchEdgeI
)
{
const
edge
&
patchE
=
pp
.
edges
()[
patchEdgeI
];
//str.write(pp.localPoints()[pointi], en[pointi]);
const
point
pt
=
patchE
.
centre
(
pp
.
localPoints
());
str
.
write
(
linePointRef
(
pt
,
pt
+
0
.
1
*
en
[
patchEdgeI
]));
}
}
return
0
;
// {
// OBJstream str(runTime.path()/"unweightedPatchNormals.obj");
//
// const pointField pn
// (
// PatchTools::pointNormals
// (
// mesh,
// pp,
// identity(pp.range())
// )
// );
// forAll(pn, pointi)
// {
// str.write(linePointRef(pp.localPoints()[pointi], pn[pointi]));
// }
// }
// {
// OBJstream str(runTime.path()/"areaWeightedPatchNormals.obj");
//
// const pointField pn
// (
// areaPointNormals
// (
// mesh,
// pp,
// identity(pp.range())
// )
// );
// forAll(pn, pointi)
// {
// str.write(linePointRef(pp.localPoints()[pointi], pn[pointi]));
// }
// }
Pout
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/PointEdgeWave/Make/files
0 → 100644
View file @
55e5a777
Test-PointEdgeWave.C
EXE = $(FOAM_USER_APPBIN)/Test-PointEdgeWave
OpenFOAM-v2112/applications/test/PointEdgeWave/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lmeshTools
OpenFOAM-v2112/applications/test/PointEdgeWave/Test-PointEdgeWave.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
Description
Test pointEdgeWave.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
#include "pointMesh.H"
#include "OSspecific.H"
#include "IFstream.H"
#include "pointEdgePoint.H"
#include "PointEdgeWave.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addArgument
(
"(patches)"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createPolyMesh.H"
const
wordRes
patchSelection
(
args
.
getList
<
wordRe
>
(
1
));
const
polyBoundaryMesh
&
pbm
=
mesh
.
boundaryMesh
();
labelList
patchIDs
(
pbm
.
patchSet
(
patchSelection
).
sortedToc
()
);
Info
<<
"Starting walk from patches "
<<
UIndirectList
<
word
>
(
pbm
.
names
(),
patchIDs
)
<<
nl
<<
endl
;
label
nPoints
=
0
;
forAll
(
patchIDs
,
i
)
{
nPoints
+=
pbm
[
patchIDs
[
i
]].
nPoints
();
}
Info
<<
"Seeding "
<<
returnReduce
(
nPoints
,
sumOp
<
label
>
())
<<
" patch points"
<<
nl
<<
endl
;
// Set initial changed points to all the patch points(if patch present)
List
<
pointEdgePoint
>
wallInfo
(
nPoints
);
labelList
wallPoints
(
nPoints
);
nPoints
=
0
;
forAll
(
patchIDs
,
i
)
{
// Retrieve the patch now we have its index in patches.
const
polyPatch
&
pp
=
pbm
[
patchIDs
[
i
]];
forAll
(
pp
.
meshPoints
(),
ppI
)
{
label
meshPointi
=
pp
.
meshPoints
()[
ppI
];
wallPoints
[
nPoints
]
=
meshPointi
;
wallInfo
[
nPoints
]
=
pointEdgePoint
(
mesh
.
points
()[
meshPointi
],
0
.
0
);
nPoints
++
;
}
}
// Current info on points
List
<
pointEdgePoint
>
allPointInfo
(
mesh
.
nPoints
());
// Current info on edges
List
<
pointEdgePoint
>
allEdgeInfo
(
mesh
.
nEdges
());
PointEdgeWave
<
pointEdgePoint
>
wallCalc
(
mesh
,
wallPoints
,
wallInfo
,
allPointInfo
,
allEdgeInfo
,
mesh
.
nPoints
()
// max iterations
);
pointScalarField
psf
(
IOobject
(
"wallDist"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
pointMesh
::
New
(
mesh
),
dimensionedScalar
(
dimLength
,
Zero
)
);
forAll
(
allPointInfo
,
pointi
)
{
psf
[
pointi
]
=
Foam
::
sqrt
(
allPointInfo
[
pointi
].
distSqr
());
}
Info
<<
"Writing wallDist pointScalarField to "
<<
runTime
.
value
()
<<
endl
;
psf
.
write
();
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/Polynomial/Make/files
0 → 100644
View file @
55e5a777
Test-Polynomial.C
EXE = $(FOAM_USER_APPBIN)/Test-Polynomial
Prev
1
…
11
12
13
14
15
16
17
18
19
…
34
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment