mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: remove tabs from files and shorten line-length.
This commit is contained in:
@ -512,7 +512,7 @@ void readCells
|
||||
{
|
||||
label meshPti;
|
||||
lineStr >> meshPti >> meshPti;
|
||||
}
|
||||
}
|
||||
else if (elmType == MSHTRI)
|
||||
{
|
||||
lineStr >> triPoints[0] >> triPoints[1] >> triPoints[2];
|
||||
|
||||
@ -103,7 +103,7 @@ enum {
|
||||
XF_RF_DATA_KTC=105,
|
||||
XF_RF_DATA_VGS_DTRM=106,
|
||||
XF_RF_DATA_VGF_DTRM=107,
|
||||
XF_RF_DATA_RSTRESS=108, /* V4 reynolds stress model */
|
||||
XF_RF_DATA_RSTRESS=108, /* V4 reynolds stress model */
|
||||
XF_RF_DATA_THREAD_RAD_FLUX=109,
|
||||
|
||||
/* mass absorption term for absorbing porous media model */
|
||||
@ -133,12 +133,12 @@ enum {
|
||||
XF_RF_DATA_TKE_M2=126,
|
||||
XF_RF_DATA_TED_M2=127,
|
||||
|
||||
XF_RF_DATA_RUU=128, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RVV=129, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RWW=130, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RUV=131, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RVW=132, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RUW=133, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RUU=128, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RVV=129, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RWW=130, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RUV=131, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RVW=132, /* V5 reynolds stress model */
|
||||
XF_RF_DATA_RUW=133, /* V5 reynolds stress model */
|
||||
|
||||
XF_RF_DATA_DPMS_EROSION=134,
|
||||
XF_RF_DATA_DPMS_ACCRETION=135,
|
||||
@ -271,9 +271,9 @@ chunk.
|
||||
|
||||
EXPAND_50_EQUAL(XF_RF_DATA_UDS_,700), /* user defined scalar */
|
||||
EXPAND_50(XF_RF_DATA_UDS_,_M1=, 750), /* user defined scalar
|
||||
* at fist time level */
|
||||
* at fist time level */
|
||||
EXPAND_50(XF_RF_DATA_UDS_,_M2=, 800), /* user defined scalar
|
||||
* at second time level */
|
||||
* at second time level */
|
||||
XF_RF_DATA_GRANULAR_PRESSURE=910,
|
||||
XF_RF_DATA_GRANULAR_PRESSURE_M1=0,/* never stored but symbol is
|
||||
required */
|
||||
|
||||
@ -1,12 +1,9 @@
|
||||
|
||||
Polygon Reduction Demo
|
||||
By Stan Melax (c) 1998
|
||||
mailto:melax@cs.ualberta.ca
|
||||
http://www.cs.ualberta.ca/~melax
|
||||
Polygon Reduction Demo
|
||||
By Stan Melax (c) 1998
|
||||
mailto:melax@cs.ualberta.ca
|
||||
http://www.cs.ualberta.ca/~melax
|
||||
|
||||
The PC executable bunnylod.exe should run
|
||||
on a standard PC.
|
||||
Just run it and enjoy.
|
||||
Mouse dragging spins the rabbit.
|
||||
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ protected:
|
||||
template<class ObjectType>
|
||||
ObjectType* lookupObjectRefPtr(const word& fieldName) const;
|
||||
|
||||
//- Store the given field in the (sub) objectRegistry under the given name
|
||||
//- Store the field in the (sub) objectRegistry under the given name
|
||||
// Note: sets the fieldName to tfield().name() if not already set
|
||||
template<class ObjectType>
|
||||
bool store
|
||||
|
||||
@ -1,146 +1,146 @@
|
||||
1. OVERVIEW
|
||||
|
||||
This code accompanies the paper:
|
||||
This code accompanies the paper:
|
||||
|
||||
Brian Mirtich, "Fast and Accurate Computation of
|
||||
Polyhedral Mass Properties," journal of graphics
|
||||
tools, volume 1, number 2, 1996.
|
||||
Brian Mirtich, "Fast and Accurate Computation of
|
||||
Polyhedral Mass Properties," journal of graphics
|
||||
tools, volume 1, number 2, 1996.
|
||||
|
||||
It computes the ten volume integrals needed for
|
||||
determining the center of mass, moments of
|
||||
inertia, and products of inertia for a uniform
|
||||
density polyhedron. From this information, a
|
||||
body frame can be computed.
|
||||
It computes the ten volume integrals needed for
|
||||
determining the center of mass, moments of
|
||||
inertia, and products of inertia for a uniform
|
||||
density polyhedron. From this information, a
|
||||
body frame can be computed.
|
||||
|
||||
To compile the program, use an ANSI compiler, and
|
||||
type something like
|
||||
To compile the program, use an ANSI compiler, and
|
||||
type something like
|
||||
|
||||
% cc volInt.c -O2 -lm -o volInt
|
||||
% cc volInt.c -O2 -lm -o volInt
|
||||
|
||||
|
||||
Revision history
|
||||
Revision history
|
||||
|
||||
26 Jan 1996 Program creation.
|
||||
26 Jan 1996 Program creation.
|
||||
|
||||
3 Aug 1996 Corrected bug arising when polyhedron density
|
||||
is not 1.0. Changes confined to function main().
|
||||
Thanks to Zoran Popovic for catching this one.
|
||||
3 Aug 1996 Corrected bug arising when polyhedron density
|
||||
is not 1.0. Changes confined to function main().
|
||||
Thanks to Zoran Popovic for catching this one.
|
||||
|
||||
|
||||
|
||||
2. POLYHEDRON GEOMETRY FILES
|
||||
|
||||
The program reads a data file specified on the
|
||||
command line. This data file describes the
|
||||
geometry of a polyhedron, and has the following
|
||||
format:
|
||||
The program reads a data file specified on the
|
||||
command line. This data file describes the
|
||||
geometry of a polyhedron, and has the following
|
||||
format:
|
||||
|
||||
N
|
||||
N
|
||||
|
||||
x_0 y_0 z_0
|
||||
x_1 y_1 z_1
|
||||
.
|
||||
.
|
||||
.
|
||||
x_{N-1} y_{N-1} z_{N-1}
|
||||
x_0 y_0 z_0
|
||||
x_1 y_1 z_1
|
||||
.
|
||||
.
|
||||
.
|
||||
x_{N-1} y_{N-1} z_{N-1}
|
||||
|
||||
M
|
||||
M
|
||||
|
||||
k1 v_{1,1} v_{1,2} ... v_{1,k1}
|
||||
k2 v_{2,1} v_{2,2} ... v_{2,k2}
|
||||
.
|
||||
.
|
||||
.
|
||||
kM v_{M,1} v_{M,2} ... v_{M,kM}
|
||||
k1 v_{1,1} v_{1,2} ... v_{1,k1}
|
||||
k2 v_{2,1} v_{2,2} ... v_{2,k2}
|
||||
.
|
||||
.
|
||||
.
|
||||
kM v_{M,1} v_{M,2} ... v_{M,kM}
|
||||
|
||||
|
||||
where:
|
||||
N number of vertices on polyhedron
|
||||
x_i y_i z_i x, y, and z coordinates of ith vertex
|
||||
M number of faces on polyhedron
|
||||
ki number of vertices on ith face
|
||||
v_{i,j} jth vertex on ith face
|
||||
where:
|
||||
N number of vertices on polyhedron
|
||||
x_i y_i z_i x, y, and z coordinates of ith vertex
|
||||
M number of faces on polyhedron
|
||||
ki number of vertices on ith face
|
||||
v_{i,j} jth vertex on ith face
|
||||
|
||||
In English:
|
||||
In English:
|
||||
|
||||
First the number of vertices are specified. Next
|
||||
the vertices are defined by listing the 3
|
||||
coordinates of each one. Next the number of faces
|
||||
are specified. Finally, the faces themselves are
|
||||
specified. A face is specified by first giving
|
||||
the number of vertices around the polygonal face,
|
||||
followed by the (integer) indices of these
|
||||
vertices. When specifying indices, note that
|
||||
they must be given in counter-clockwise order
|
||||
(when looking at the face from outside the
|
||||
polyhedron), and the vertices are indexed from 0
|
||||
to N-1 for a polyhedron with N faces.
|
||||
First the number of vertices are specified. Next
|
||||
the vertices are defined by listing the 3
|
||||
coordinates of each one. Next the number of faces
|
||||
are specified. Finally, the faces themselves are
|
||||
specified. A face is specified by first giving
|
||||
the number of vertices around the polygonal face,
|
||||
followed by the (integer) indices of these
|
||||
vertices. When specifying indices, note that
|
||||
they must be given in counter-clockwise order
|
||||
(when looking at the face from outside the
|
||||
polyhedron), and the vertices are indexed from 0
|
||||
to N-1 for a polyhedron with N faces.
|
||||
|
||||
White space can be inserted (or not) as desired.
|
||||
Three example polyhedron geometry files are included:
|
||||
White space can be inserted (or not) as desired.
|
||||
Three example polyhedron geometry files are included:
|
||||
|
||||
cube A cube, 20 units on a side, centered at
|
||||
the origin and aligned with the coordinate axes.
|
||||
cube A cube, 20 units on a side, centered at
|
||||
the origin and aligned with the coordinate axes.
|
||||
|
||||
tetra A tetrahedron formed by taking the convex
|
||||
hull of the origin, and the points (5,0,0),
|
||||
(0,4,0), and (0,0,3).
|
||||
tetra A tetrahedron formed by taking the convex
|
||||
hull of the origin, and the points (5,0,0),
|
||||
(0,4,0), and (0,0,3).
|
||||
|
||||
icosa An icosahedron with vertices lying on the unit
|
||||
sphere, centered at the origin.
|
||||
icosa An icosahedron with vertices lying on the unit
|
||||
sphere, centered at the origin.
|
||||
|
||||
|
||||
|
||||
3. RUNNING THE PROGRAM
|
||||
|
||||
Simply type,
|
||||
Simply type,
|
||||
|
||||
% volInt <polyhedron geometry filename>
|
||||
% volInt <polyhedron geometry filename>
|
||||
|
||||
The program will read in the geometry of the
|
||||
polyhedron, and the print out the ten volume
|
||||
integrals.
|
||||
The program will read in the geometry of the
|
||||
polyhedron, and the print out the ten volume
|
||||
integrals.
|
||||
|
||||
The program also computes some of the mass
|
||||
properties which may be inferred from the volume
|
||||
integrals. A density of 1.0 is assumed, although
|
||||
this may be changed in function main(). The
|
||||
center of mass is computed as well as the inertia
|
||||
tensor relative to a frame with origin at the
|
||||
center of mass. Note, however, that this matrix
|
||||
may not be diagonal. If not, a diagonalization
|
||||
routine must be performed, to determine the
|
||||
orientation of the true body frame relative to
|
||||
the original model frame. The Jacobi method
|
||||
works quite well (see Numerical Recipes in C by
|
||||
Press, et. al.).
|
||||
The program also computes some of the mass
|
||||
properties which may be inferred from the volume
|
||||
integrals. A density of 1.0 is assumed, although
|
||||
this may be changed in function main(). The
|
||||
center of mass is computed as well as the inertia
|
||||
tensor relative to a frame with origin at the
|
||||
center of mass. Note, however, that this matrix
|
||||
may not be diagonal. If not, a diagonalization
|
||||
routine must be performed, to determine the
|
||||
orientation of the true body frame relative to
|
||||
the original model frame. The Jacobi method
|
||||
works quite well (see Numerical Recipes in C by
|
||||
Press, et. al.).
|
||||
|
||||
|
||||
|
||||
4. DISCLAIMERS
|
||||
|
||||
1. The volume integration code has been written
|
||||
to match the development and algorithms presented
|
||||
in the paper, and not with maximum optimization
|
||||
in mind. While inherently very efficient, a few
|
||||
more cycles can be squeezed out of the algorithm.
|
||||
This is left as an exercise. :)
|
||||
1. The volume integration code has been written
|
||||
to match the development and algorithms presented
|
||||
in the paper, and not with maximum optimization
|
||||
in mind. While inherently very efficient, a few
|
||||
more cycles can be squeezed out of the algorithm.
|
||||
This is left as an exercise. :)
|
||||
|
||||
2. Don't like global variables? The three
|
||||
procedures which evaluate the volume integrals
|
||||
can be combined into a single procedure with two
|
||||
nested loops. In addition to providing some
|
||||
speedup, all of the global variables can then be
|
||||
made local.
|
||||
2. Don't like global variables? The three
|
||||
procedures which evaluate the volume integrals
|
||||
can be combined into a single procedure with two
|
||||
nested loops. In addition to providing some
|
||||
speedup, all of the global variables can then be
|
||||
made local.
|
||||
|
||||
3. The polyhedron data structure used by the
|
||||
program is admittedly lame; much better schemes
|
||||
are possible. The idea here is just to give the
|
||||
basic integral evaluation code, which will have
|
||||
to be adjusted for other polyhedron data
|
||||
structures.
|
||||
3. The polyhedron data structure used by the
|
||||
program is admittedly lame; much better schemes
|
||||
are possible. The idea here is just to give the
|
||||
basic integral evaluation code, which will have
|
||||
to be adjusted for other polyhedron data
|
||||
structures.
|
||||
|
||||
4. There is no error checking for the input
|
||||
files. Be careful. Note the hard limits
|
||||
#defined for the number of vertices, number of
|
||||
faces, and number of vertices per faces.
|
||||
4. There is no error checking for the input
|
||||
files. Be careful. Note the hard limits
|
||||
#defined for the number of vertices, number of
|
||||
faces, and number of vertices per faces.
|
||||
|
||||
@ -189,7 +189,7 @@ void Foam::waveModels::Boussinesq::setVelocity
|
||||
const label paddlei = faceToPaddle_[facei];
|
||||
|
||||
const vector Uf = this->Uf
|
||||
(
|
||||
(
|
||||
waveHeight_,
|
||||
waterDepthRef_,
|
||||
xPaddle_[paddlei],
|
||||
|
||||
@ -128,7 +128,7 @@ void Foam::waveModels::StokesI::setLevel
|
||||
{
|
||||
const scalar eta =
|
||||
this->eta
|
||||
(
|
||||
(
|
||||
waveHeight_,
|
||||
waveKx,
|
||||
xPaddle_[paddlei],
|
||||
@ -171,7 +171,7 @@ void Foam::waveModels::StokesI::setVelocity
|
||||
const label paddlei = faceToPaddle_[facei];
|
||||
|
||||
const vector Uf = UfBase
|
||||
(
|
||||
(
|
||||
waveHeight_,
|
||||
waterDepthRef_,
|
||||
waveKx,
|
||||
@ -221,7 +221,7 @@ bool Foam::waveModels::StokesI::readDict(const dictionary& overrideDict)
|
||||
{
|
||||
if (regularWaveModel::readDict(overrideDict))
|
||||
{
|
||||
waveLength_ = waveLength(waterDepthRef_, wavePeriod_);
|
||||
waveLength_ = waveLength(waterDepthRef_, wavePeriod_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ void Foam::waveModels::StokesII::setLevel
|
||||
{
|
||||
const scalar eta =
|
||||
this->eta
|
||||
(
|
||||
(
|
||||
waveHeight_,
|
||||
waterDepthRef_,
|
||||
waveKx,
|
||||
|
||||
@ -672,11 +672,13 @@ Foam::scalar Foam::waveModels::StokesV::eta
|
||||
const scalar theta = kx*x + ky*y - 2.0*mathematical::pi/T*t + phase;
|
||||
|
||||
return
|
||||
(
|
||||
amp1*cos(theta)
|
||||
+ amp2*cos(2*theta)
|
||||
+ amp3*cos(3*theta)
|
||||
+ amp4*cos(4*theta)
|
||||
+ amp5*cos(5*theta);
|
||||
+ amp4*cos(4*theta)
|
||||
+ amp5*cos(5*theta)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -758,9 +760,9 @@ void Foam::waveModels::StokesV::setLevel
|
||||
{
|
||||
const scalar eta =
|
||||
this->eta
|
||||
(
|
||||
(
|
||||
waterDepthRef_,
|
||||
waveKx,
|
||||
waveKx,
|
||||
waveKy,
|
||||
lambda_,
|
||||
wavePeriod_,
|
||||
@ -801,7 +803,7 @@ void Foam::waveModels::StokesV::setVelocity
|
||||
const label paddlei = faceToPaddle_[facei];
|
||||
|
||||
const vector Uf = this->Uf
|
||||
(
|
||||
(
|
||||
waterDepthRef_,
|
||||
waveKx,
|
||||
waveKy,
|
||||
@ -869,11 +871,11 @@ bool Foam::waveModels::StokesV::readDict(const dictionary& overrideDict)
|
||||
|
||||
if (f1 > 0.001 || f2 > 0.001)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
FatalErrorInFunction
|
||||
<< "No convergence for Stokes V wave theory" << nl
|
||||
<< " f1: " << f1 << nl
|
||||
<< " f2: " << f2 << nl
|
||||
<< exit(FatalError);
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -248,7 +248,7 @@ void Foam::waveModels::cnoidal::setLevel
|
||||
{
|
||||
const scalar eta =
|
||||
this->eta
|
||||
(
|
||||
(
|
||||
waveHeight_,
|
||||
m_,
|
||||
waveKx,
|
||||
@ -290,7 +290,7 @@ void Foam::waveModels::cnoidal::setVelocity
|
||||
const label paddlei = faceToPaddle_[facei];
|
||||
|
||||
const vector Uf = this->Uf
|
||||
(
|
||||
(
|
||||
waveHeight_,
|
||||
waterDepthRef_,
|
||||
m_,
|
||||
|
||||
@ -168,19 +168,19 @@ void Foam::waveModel::setAlpha(const scalarField& level)
|
||||
const scalar zMin0 = zMin_[facei] - zMin0_;
|
||||
const scalar zMax0 = zMax_[facei] - zMin0_;
|
||||
|
||||
if (zMax0 < paddleCalc)
|
||||
{
|
||||
alpha_[facei] = 1.0;
|
||||
}
|
||||
else if (zMin0 > paddleCalc)
|
||||
{
|
||||
alpha_[facei] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
scalar dz = paddleCalc - zMin0;
|
||||
alpha_[facei] = dz/(zMax0 - zMin0);
|
||||
}
|
||||
if (zMax0 < paddleCalc)
|
||||
{
|
||||
alpha_[facei] = 1.0;
|
||||
}
|
||||
else if (zMin0 > paddleCalc)
|
||||
{
|
||||
alpha_[facei] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
scalar dz = paddleCalc - zMin0;
|
||||
alpha_[facei] = dz/(zMax0 - zMin0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,11 +217,11 @@ void Foam::waveModel::setPaddlePropeties
|
||||
if ((zMax > paddleCalc) && (zMin < paddleCalc))
|
||||
{
|
||||
scalar dz = paddleCalc - zMin;
|
||||
fraction = dz/(zMax - zMin);
|
||||
fraction = dz/(zMax - zMin);
|
||||
z = z_[facei] - zMin0_;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (zMax < paddleCalc)
|
||||
{
|
||||
@ -230,7 +230,7 @@ void Foam::waveModel::setPaddlePropeties
|
||||
else if ((zMax > paddleCalc) && (zMin < paddleCalc))
|
||||
{
|
||||
scalar dz = paddleCalc - zMin;
|
||||
fraction = dz/(zMax - zMin);
|
||||
fraction = dz/(zMax - zMin);
|
||||
z = waterDepthRef_;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user