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
Development
openfoam
Commits
b7e349a7
Commit
b7e349a7
authored
Nov 24, 2008
by
Mark Olesen
Browse files
Merge commit 'bundle/home' into olesenm
parents
c61868e9
a8550cd0
Changes
45
Hide whitespace changes
Inline
Side-by-side
applications/test/DynamicList/DynamicListTest.C
View file @
b7e349a7
...
...
@@ -43,9 +43,14 @@ int main(int argc, char *argv[])
ldl
[
0
](
3
)
=
3
;
ldl
[
0
](
1
)
=
1
;
ldl
[
0
].
setSize
(
5
);
// increase allocated size
ldl
[
1
].
setSize
(
10
);
// increase allocated size
ldl
[
1
](
2
)
=
2
;
ldl
[
0
].
allocSize
(
5
);
// increase allocated size
ldl
[
1
].
allocSize
(
10
);
// increase allocated size
ldl
[
0
].
reserve
(
15
);
// should increase allocated size
ldl
[
1
].
reserve
(
5
);
// should not decrease allocated size
ldl
[
1
](
3
)
=
2
;
// allocates space and sets value
// this works without a segfault, but doesn't change the list size
ldl
[
0
][
4
]
=
4
;
ldl
[
1
]
=
3
;
...
...
@@ -78,7 +83,7 @@ int main(int argc, char *argv[])
{
dlA
.
append
(
i
);
}
dlA
.
set
Size
(
10
);
dlA
.
alloc
Size
(
10
);
Info
<<
"<dlA>"
<<
dlA
<<
"</dlA>"
<<
nl
<<
"sizes: "
<<
" "
<<
dlA
.
size
()
<<
"/"
<<
dlA
.
allocSize
()
<<
endl
;
...
...
@@ -95,6 +100,14 @@ int main(int argc, char *argv[])
Info
<<
"<dlB>"
<<
dlB
<<
"</dlB>"
<<
nl
<<
"sizes: "
<<
" "
<<
dlB
.
size
()
<<
"/"
<<
dlB
.
allocSize
()
<<
endl
;
// try with a normal list:
List
<
label
>
lstA
;
lstA
.
transfer
(
dlB
);
Info
<<
"Transferred to normal list"
<<
endl
;
Info
<<
"<lstA>"
<<
lstA
<<
"</lstA>"
<<
nl
<<
"sizes: "
<<
" "
<<
lstA
.
size
()
<<
endl
;
Info
<<
"<dlB>"
<<
dlB
<<
"</dlB>"
<<
nl
<<
"sizes: "
<<
" "
<<
dlB
.
size
()
<<
"/"
<<
dlB
.
allocSize
()
<<
endl
;
return
0
;
}
...
...
applications/test/sort/sortListTest.C
View file @
b7e349a7
...
...
@@ -70,6 +70,13 @@ int main(int argc, char *argv[])
Info
<<
"sorted: "
<<
b
<<
endl
;
Info
<<
"indices: "
<<
b
.
indices
()
<<
endl
;
labelList
flatten
;
flatten
.
transfer
(
b
);
Info
<<
"flatten: "
<<
flatten
<<
endl
;
Info
<<
"sorted: "
<<
b
<<
endl
;
Info
<<
"indices: "
<<
b
.
indices
()
<<
endl
;
Info
<<
"End
\n
"
<<
endl
;
return
0
;
...
...
applications/utilities/mesh/manipulation/checkMesh/checkTopology.C
View file @
b7e349a7
...
...
@@ -109,7 +109,7 @@ Foam::label Foam::checkTopology
{
Info
<<
" Number of regions: "
<<
rs
.
nRegions
()
<<
" (OK)."
<<
endl
;
}
else
{
...
...
@@ -214,7 +214,7 @@ Foam::label Foam::checkTopology
const
pointField
&
pts
=
pp
.
points
();
const
labelList
&
mp
=
pp
.
meshPoints
();
boundBox
bb
(
vector
::
zero
,
vector
::
zero
);
boundBox
bb
;
// zero-sized
if
(
returnReduce
(
mp
.
size
(),
sumOp
<
label
>
())
>
0
)
{
bb
.
min
()
=
pts
[
mp
[
0
]];
...
...
applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C
View file @
b7e349a7
...
...
@@ -273,7 +273,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
}
}
return
map
;
return
map
;
}
...
...
@@ -418,11 +418,7 @@ int main(int argc, char *argv[])
// Read point on individual processors to determine merge tolerance
// (otherwise single cell domains might give problems)
boundBox
bb
(
point
(
GREAT
,
GREAT
,
GREAT
),
point
(
-
GREAT
,
-
GREAT
,
-
GREAT
)
);
boundBox
bb
=
boundBox
::
invertedBox
;
for
(
label
procI
=
0
;
procI
<
nProcs
;
procI
++
)
{
...
...
applications/utilities/surface/surfaceCoordinateSystemTransform/surfaceCoordinateSystemTransform.C
View file @
b7e349a7
...
...
@@ -199,7 +199,6 @@ int main(int argc, char *argv[])
if
(
args
.
options
().
found
(
"clean"
))
{
surf
.
cleanup
(
true
);
surf
.
checkOrientation
(
true
);
}
if
(
fromCsys
.
valid
())
...
...
applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
View file @
b7e349a7
...
...
@@ -104,13 +104,19 @@ int main(int argc, char *argv[])
{
triSurface
surf
(
importName
);
Info
<<
"Read surface:"
<<
endl
;
surf
.
writeStats
(
Info
);
Info
<<
endl
;
if
(
args
.
options
().
found
(
"clean"
))
{
Info
<<
"Cleaning up surface"
<<
endl
;
surf
.
cleanup
(
true
);
surf
.
checkOrientation
(
true
);
surf
.
writeStats
(
Info
);
Info
<<
endl
;
}
Info
<<
"writing "
<<
exportName
;
Info
<<
"writing "
<<
exportName
;
if
(
scaleFactor
<=
0
)
{
Info
<<
" without scaling"
<<
endl
;
...
...
@@ -119,6 +125,8 @@ int main(int argc, char *argv[])
{
Info
<<
" with scaling "
<<
scaleFactor
<<
endl
;
surf
.
scalePoints
(
scaleFactor
);
surf
.
writeStats
(
Info
);
Info
<<
endl
;
}
// write sorted by region
...
...
@@ -128,13 +136,19 @@ int main(int argc, char *argv[])
{
UnsortedMeshedSurface
<
face
>
surf
(
importName
);
Info
<<
"Read surface:"
<<
endl
;
surf
.
writeStats
(
Info
);
Info
<<
endl
;
if
(
args
.
options
().
found
(
"clean"
))
{
Info
<<
"Cleaning up surface"
<<
endl
;
surf
.
cleanup
(
true
);
surf
.
checkOrientation
(
true
);
surf
.
writeStats
(
Info
);
Info
<<
endl
;
}
Info
<<
"writing "
<<
exportName
;
Info
<<
"writing "
<<
exportName
;
if
(
scaleFactor
<=
0
)
{
Info
<<
" without scaling"
<<
endl
;
...
...
@@ -143,8 +157,9 @@ int main(int argc, char *argv[])
{
Info
<<
" with scaling "
<<
scaleFactor
<<
endl
;
surf
.
scalePoints
(
scaleFactor
);
surf
.
writeStats
(
Info
);
Info
<<
endl
;
}
surf
.
write
(
exportName
);
}
#if 1
...
...
@@ -152,10 +167,16 @@ int main(int argc, char *argv[])
{
MeshedSurface
<
triFace
>
surf
(
importName
);
Info
<<
"Read surface:"
<<
endl
;
surf
.
writeStats
(
Info
);
Info
<<
endl
;
if
(
args
.
options
().
found
(
"clean"
))
{
Info
<<
"Cleaning up surface"
<<
endl
;
surf
.
cleanup
(
true
);
surf
.
checkOrientation
(
true
);
surf
.
writeStats
(
Info
);
Info
<<
endl
;
}
Info
<<
"writing "
<<
exportName
;
...
...
@@ -167,6 +188,8 @@ int main(int argc, char *argv[])
{
Info
<<
" with scaling "
<<
scaleFactor
<<
endl
;
surf
.
scalePoints
(
scaleFactor
);
surf
.
writeStats
(
Info
);
Info
<<
endl
;
}
surf
.
write
(
exportName
);
}
...
...
@@ -175,10 +198,16 @@ int main(int argc, char *argv[])
{
MeshedSurface
<
face
>
surf
(
importName
);
Info
<<
"Read surface:"
<<
endl
;
surf
.
writeStats
(
Info
);
Info
<<
endl
;
if
(
args
.
options
().
found
(
"clean"
))
{
Info
<<
"Cleaning up surface"
<<
endl
;
surf
.
cleanup
(
true
);
surf
.
checkOrientation
(
true
);
surf
.
writeStats
(
Info
);
Info
<<
endl
;
}
Info
<<
"writing "
<<
exportName
;
...
...
@@ -190,6 +219,8 @@ int main(int argc, char *argv[])
{
Info
<<
" with scaling "
<<
scaleFactor
<<
endl
;
surf
.
scalePoints
(
scaleFactor
);
surf
.
writeStats
(
Info
);
Info
<<
endl
;
}
surf
.
write
(
exportName
);
}
...
...
src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H
View file @
b7e349a7
...
...
@@ -118,18 +118,30 @@ public:
//- Size of the underlying storage.
inline
label
allocSize
()
const
;
// Edit
//- Alter the list size.
// When the new size is greater than the addressed list size, the
//- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will
// otherwise remain untouched.
inline
void
allocSize
(
const
label
);
// CURRENT BEHAVIOUR
//- When the new size is greater than the addressed list size, the
// allocated list sizes is adjusted and the
// addressed size does not change.
// Otherwise the addressed list size is just reduced and the
// allocated size does not change.
//
// PROPOSED BEHAVIOUR
//- Alter the addressed list size.
// New space will be allocated if required.
inline
void
setSize
(
const
label
);
//- Clear the list, i.e. set the size to zero.
//- Reserve allocation space for at least this size.
// Never shrinks the allocated size, use allocSize() for that.
inline
void
reserve
(
const
label
);
//- Clear the addressed list, i.e. set the size to zero.
// Allocated size does not change
inline
void
clear
();
...
...
src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H
View file @
b7e349a7
...
...
@@ -70,12 +70,61 @@ const
}
template
<
class
T
,
unsigned
SizeInc
,
unsigned
SizeMult
,
unsigned
SizeDiv
>
inline
void
Foam
::
DynamicList
<
T
,
SizeInc
,
SizeMult
,
SizeDiv
>::
allocSize
(
const
label
s
)
{
label
nextFree
=
List
<
T
>::
size
();
allocSize_
=
s
;
// truncate addressed size too?
if
(
nextFree
>
allocSize_
)
{
nextFree
=
allocSize_
;
}
// adjust allocated size, and addressed size if necessary
List
<
T
>::
setSize
(
allocSize_
);
List
<
T
>::
size
(
nextFree
);
}
template
<
class
T
,
unsigned
SizeInc
,
unsigned
SizeMult
,
unsigned
SizeDiv
>
inline
void
Foam
::
DynamicList
<
T
,
SizeInc
,
SizeMult
,
SizeDiv
>::
reserve
(
const
label
s
)
{
if
(
s
>
allocSize_
)
{
allocSize_
=
max
(
s
,
label
(
SizeMult
*
allocSize_
/
SizeDiv
+
SizeInc
)
);
// adjust allocated size, leave addressed size untouched
label
nextFree
=
List
<
T
>::
size
();
List
<
T
>::
setSize
(
allocSize_
);
List
<
T
>::
size
(
nextFree
);
}
}
template
<
class
T
,
unsigned
SizeInc
,
unsigned
SizeMult
,
unsigned
SizeDiv
>
inline
void
Foam
::
DynamicList
<
T
,
SizeInc
,
SizeMult
,
SizeDiv
>::
setSize
(
const
label
s
)
{
#if 1
// CURRENT BEHAVIOUR:
// slightly ambiguous about what size the list will actually get
// cannot increase the size of the addressed list (for compatibility
// with List), without automatically adjusting the allocated space!
label
nextFree
=
List
<
T
>::
size
();
if
(
s
<=
nextFree
)
{
...
...
@@ -89,6 +138,22 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
List
<
T
>::
setSize
(
allocSize_
);
}
List
<
T
>::
size
(
nextFree
);
#else
// allocate more space?
if
(
s
>
allocSize_
)
{
allocSize_
=
max
(
s
,
label
(
SizeMult
*
allocSize_
/
SizeDiv
+
SizeInc
)
);
List
<
T
>::
setSize
(
allocSize_
);
}
// adjust addressed size
List
<
T
>::
size
(
s
);
#endif
}
...
...
@@ -153,21 +218,10 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append(const T& e)
// Work on copy free index since gets overwritten by setSize
label
nextFree
=
List
<
T
>::
size
();
nextFree
++
;
reserve
(
nextFree
+
1
);
List
<
T
>::
size
(
nextFree
+
1
);
if
(
nextFree
>
allocSize_
)
{
allocSize_
=
max
(
nextFree
,
label
(
SizeMult
*
allocSize_
/
SizeDiv
+
SizeInc
)
);
List
<
T
>::
setSize
(
allocSize_
);
}
List
<
T
>::
size
(
nextFree
);
this
->
operator
[](
nextFree
-
1
)
=
e
;
this
->
operator
[](
nextFree
)
=
e
;
}
...
...
@@ -201,19 +255,9 @@ inline T& Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator()
)
{
label
nextFree
=
List
<
T
>::
size
();
nextFree
=
max
(
nextFree
,
i
+
1
);
if
(
nextFree
>
allocSize_
)
{
allocSize_
=
max
(
nextFree
,
label
(
SizeMult
*
allocSize_
/
SizeDiv
+
SizeInc
)
);
List
<
T
>::
setSize
(
allocSize_
);
}
reserve
(
nextFree
);
List
<
T
>::
size
(
nextFree
);
return
this
->
operator
[](
i
);
...
...
src/OpenFOAM/containers/Lists/List/List.C
View file @
b7e349a7
...
...
@@ -432,14 +432,20 @@ void Foam::List<T>::transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>& a)
{
// shrink the allocated space to the number of elements used
a
.
shrink
();
a
.
allocSize_
=
0
;
if
(
this
->
v_
)
delete
[]
this
->
v_
;
this
->
size_
=
a
.
size_
;
this
->
v_
=
a
.
v_
;
transfer
(
static_cast
<
List
<
T
>&>
(
a
));
}
a
.
size_
=
0
;
a
.
v_
=
0
;
a
.
allocSize_
=
0
;
// Transfer the contents of the argument SortableList into this List
// and anull the argument list
template
<
class
T
>
void
Foam
::
List
<
T
>::
transfer
(
SortableList
<
T
>&
a
)
{
// shrink away the sort indices
a
.
shrink
();
transfer
(
static_cast
<
List
<
T
>&>
(
a
));
}
...
...
src/OpenFOAM/containers/Lists/List/List.H
View file @
b7e349a7
...
...
@@ -63,7 +63,8 @@ template<class T, label Size> class FixedList;
template
<
class
T
>
class
PtrList
;
template
<
class
T
>
class
SLList
;
template
<
class
T
,
unsigned
SizeInc
,
unsigned
SizeMult
,
unsigned
SizeDiv
>
class
DynamicList
;
class
DynamicList
;
template
<
class
T
>
class
SortableList
;
template
<
class
T
>
class
IndirectList
;
template
<
class
T
>
class
BiIndirectList
;
...
...
@@ -173,6 +174,10 @@ public:
template
<
unsigned
SizeInc
,
unsigned
SizeMult
,
unsigned
SizeDiv
>
void
transfer
(
DynamicList
<
T
,
SizeInc
,
SizeMult
,
SizeDiv
>&
);
//- Transfer the contents of the argument List into this List
// and annull the argument list.
void
transfer
(
SortableList
<
T
>&
);
//- Return subscript-checked element of UList.
inline
T
&
newElmt
(
const
label
);
...
...
src/OpenFOAM/meshes/boundBox/boundBox.C
View file @
b7e349a7
...
...
@@ -27,18 +27,34 @@ License
#include "boundBox.H"
#include "PstreamReduceOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const
Foam
::
boundBox
Foam
::
boundBox
::
greatBox
(
point
(
-
VGREAT
,
-
VGREAT
,
-
VGREAT
),
point
(
VGREAT
,
VGREAT
,
VGREAT
)
);
const
Foam
::
boundBox
Foam
::
boundBox
::
invertedBox
(
point
(
VGREAT
,
VGREAT
,
VGREAT
),
point
(
-
VGREAT
,
-
VGREAT
,
-
VGREAT
)
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
boundBox
::
boundBox
(
const
pointField
&
points
,
const
bool
doReduce
)
:
min_
(
vector
::
zero
),
max_
(
vector
::
zero
)
min_
(
point
::
zero
),
max_
(
point
::
zero
)
{
if
(
points
.
size
()
==
0
)
{
if
(
Pstream
::
parRun
()
&&
doReduce
)
{
// Use values
which
get overwritten by reduce minOp,maxOp below
// Use values
that
get overwritten by reduce minOp,
maxOp below
min_
=
point
(
VGREAT
,
VGREAT
,
VGREAT
);
max_
=
point
(
-
VGREAT
,
-
VGREAT
,
-
VGREAT
);
}
...
...
@@ -89,7 +105,6 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
// Check state of Ostream
os
.
check
(
"Ostream& operator<<(Ostream&, const boundBox&)"
);
return
os
;
}
...
...
@@ -111,7 +126,6 @@ Foam::Istream& Foam::operator>>(Istream& is, boundBox& bb)
// Check state of Istream
is
.
check
(
"Istream& operator>>(Istream&, boundBox&)"
);
return
is
;
}
...
...
src/OpenFOAM/meshes/boundBox/boundBox.H
View file @
b7e349a7
...
...
@@ -48,7 +48,7 @@ Ostream& operator<<(Ostream& os, const boundBox& b);
/*---------------------------------------------------------------------------*\
Class boundBox Declaration
Class boundBox Declaration
\*---------------------------------------------------------------------------*/
class
boundBox
...
...
@@ -61,13 +61,22 @@ class boundBox
public:
// Static data members
//- A very large boundBox: min/max == -/+ VGREAT
static
const
boundBox
greatBox
;
//- A very large inverted boundBox: min/max == +/- VGREAT
static
const
boundBox
invertedBox
;
// Constructors
//- Construct null setting points to zero
//- Construct null
,
setting points to zero
boundBox
()
:
min_
(
vector
::
zero
),
max_
(
vector
::
zero
)
min_
(
point
::
zero
),
max_
(
point
::
zero
)
{}
//- Construct from components
...
...
@@ -77,8 +86,8 @@ public:
max_
(
max
)
{}
//- Construct as the bounding box of the given pointField.
Does
// parallel communication (doReduce = true)
//- Construct as the bounding box of the given pointField.
//
Does
parallel communication (doReduce = true)
boundBox
(
const
pointField
&
points
,
const
bool
doReduce
=
true
);
//- Construct from Istream
...
...
@@ -117,39 +126,26 @@ public:
// Query
//- Intersects other bounding
b
ox?
//- Intersects other bounding
B
ox?
bool
overlaps
(
const
boundBox
&
bb
)
const
{
if
return
(
(
min_
.
x
()
<=
bb
.
max
().
x
())
&&
(
min_
.
y
()
<=
bb
.
max
().
y
())
&&
(
min_
.
z
()
<=
bb
.
max
().
z
())
&&
(
max_
.
x
()
>=
bb
.
min
().
x
())
&&
(
max_
.
y
()
>=
bb
.
min
().
y
())
&&
(
max_
.
z
()
>=
bb
.
min
().
z
())
)
{
return
true
;
}
else
{
return
false
;
}
min_
.
x
()
<=
bb
.
max
().
x
()
&&
max_
.
x
()
>=
bb
.
min
().
x
()
&&
min_
.
y
()
<=
bb
.
max
().
y
()
&&
max_
.
y
()
>=
bb
.
min
().
y
()
&&
min_
.
z
()
<=
bb
.
max
().
z
()
&&
max_
.
z
()
>=
bb
.
min
().
z
()
);
}
//- Contains a point?
bool
contains
(
const
point
&
pt
)
const
{
return
pt
.
x
()
>=
min
().
x
()
&&
pt
.
y
()
>=
min
().
y
()
&&
pt
.
z
()
>=
min
().
z
()
&&
pt
.
x
()
<=
max
().
x
()
&&
pt
.
y
()
<=
max
().
y
()
&&
pt
.
z
()
<=
max
().
z
();
(
pt
.
x
()
>=
min
().
x
()
&&
pt
.
x
()
<=
max
().
x
()
&&
pt
.
y
()
>=
min
().
y
()
&&
pt
.
y
()
<=
max
().
y
()
&&
pt
.
z
()
>=
min
().
z
()
&&
pt
.
z
()
<=
max
().
z
()
);
}
...
...
@@ -173,7 +169,7 @@ public:
};
//- Specify data associated with boundBox type
is
contiguous
//- Specify data associated with boundBox type
are
contiguous
template
<
>
inline
bool
contiguous
<
boundBox
>
()
{
return
contiguous
<
point
>
();}
...
...
src/OpenFOAM/meshes/meshShapes/face/face.C
View file @
b7e349a7
...
...
@@ -119,7 +119,7 @@ Foam::label Foam::face::mostConcaveAngle
}
void
Foam
::
face
::
split
Foam
::
label
Foam
::
face
::
split
(
const
face
::
splitMode
mode
,
const
pointField
&
points
,
...
...
@@ -129,6 +129,8 @@ void Foam::face::split