STYLE: remove tabs from files and shorten line-length.

This commit is contained in:
Mark Olesen
2017-04-10 16:11:33 +02:00
parent b257e80d9a
commit 140c5110fe
11 changed files with 162 additions and 163 deletions

View File

@ -512,7 +512,7 @@ void readCells
{ {
label meshPti; label meshPti;
lineStr >> meshPti >> meshPti; lineStr >> meshPti >> meshPti;
} }
else if (elmType == MSHTRI) else if (elmType == MSHTRI)
{ {
lineStr >> triPoints[0] >> triPoints[1] >> triPoints[2]; lineStr >> triPoints[0] >> triPoints[1] >> triPoints[2];

View File

@ -103,7 +103,7 @@ enum {
XF_RF_DATA_KTC=105, XF_RF_DATA_KTC=105,
XF_RF_DATA_VGS_DTRM=106, XF_RF_DATA_VGS_DTRM=106,
XF_RF_DATA_VGF_DTRM=107, 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, XF_RF_DATA_THREAD_RAD_FLUX=109,
/* mass absorption term for absorbing porous media model */ /* mass absorption term for absorbing porous media model */
@ -133,12 +133,12 @@ enum {
XF_RF_DATA_TKE_M2=126, XF_RF_DATA_TKE_M2=126,
XF_RF_DATA_TED_M2=127, XF_RF_DATA_TED_M2=127,
XF_RF_DATA_RUU=128, /* 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_RVV=129, /* V5 reynolds stress model */
XF_RF_DATA_RWW=130, /* 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_RUV=131, /* V5 reynolds stress model */
XF_RF_DATA_RVW=132, /* 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_RUW=133, /* V5 reynolds stress model */
XF_RF_DATA_DPMS_EROSION=134, XF_RF_DATA_DPMS_EROSION=134,
XF_RF_DATA_DPMS_ACCRETION=135, XF_RF_DATA_DPMS_ACCRETION=135,
@ -271,9 +271,9 @@ chunk.
EXPAND_50_EQUAL(XF_RF_DATA_UDS_,700), /* user defined scalar */ EXPAND_50_EQUAL(XF_RF_DATA_UDS_,700), /* user defined scalar */
EXPAND_50(XF_RF_DATA_UDS_,_M1=, 750), /* 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 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=910,
XF_RF_DATA_GRANULAR_PRESSURE_M1=0,/* never stored but symbol is XF_RF_DATA_GRANULAR_PRESSURE_M1=0,/* never stored but symbol is
required */ required */

View File

@ -1,12 +1,9 @@
Polygon Reduction Demo
Polygon Reduction Demo By Stan Melax (c) 1998
By Stan Melax (c) 1998 mailto:melax@cs.ualberta.ca
mailto:melax@cs.ualberta.ca http://www.cs.ualberta.ca/~melax
http://www.cs.ualberta.ca/~melax
The PC executable bunnylod.exe should run The PC executable bunnylod.exe should run
on a standard PC. on a standard PC.
Just run it and enjoy. Just run it and enjoy.
Mouse dragging spins the rabbit. Mouse dragging spins the rabbit.

View File

@ -114,7 +114,7 @@ protected:
template<class ObjectType> template<class ObjectType>
ObjectType* lookupObjectRefPtr(const word& fieldName) const; 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 // Note: sets the fieldName to tfield().name() if not already set
template<class ObjectType> template<class ObjectType>
bool store bool store

View File

@ -1,146 +1,146 @@
1. OVERVIEW 1. OVERVIEW
This code accompanies the paper: This code accompanies the paper:
Brian Mirtich, "Fast and Accurate Computation of Brian Mirtich, "Fast and Accurate Computation of
Polyhedral Mass Properties," journal of graphics Polyhedral Mass Properties," journal of graphics
tools, volume 1, number 2, 1996. tools, volume 1, number 2, 1996.
It computes the ten volume integrals needed for It computes the ten volume integrals needed for
determining the center of mass, moments of determining the center of mass, moments of
inertia, and products of inertia for a uniform inertia, and products of inertia for a uniform
density polyhedron. From this information, a density polyhedron. From this information, a
body frame can be computed. body frame can be computed.
To compile the program, use an ANSI compiler, and To compile the program, use an ANSI compiler, and
type something like 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 3 Aug 1996 Corrected bug arising when polyhedron density
is not 1.0. Changes confined to function main(). is not 1.0. Changes confined to function main().
Thanks to Zoran Popovic for catching this one. Thanks to Zoran Popovic for catching this one.
2. POLYHEDRON GEOMETRY FILES 2. POLYHEDRON GEOMETRY FILES
The program reads a data file specified on the The program reads a data file specified on the
command line. This data file describes the command line. This data file describes the
geometry of a polyhedron, and has the following geometry of a polyhedron, and has the following
format: format:
N N
x_0 y_0 z_0 x_0 y_0 z_0
x_1 y_1 z_1 x_1 y_1 z_1
. .
. .
. .
x_{N-1} y_{N-1} z_{N-1} x_{N-1} y_{N-1} z_{N-1}
M M
k1 v_{1,1} v_{1,2} ... v_{1,k1} k1 v_{1,1} v_{1,2} ... v_{1,k1}
k2 v_{2,1} v_{2,2} ... v_{2,k2} k2 v_{2,1} v_{2,2} ... v_{2,k2}
. .
. .
. .
kM v_{M,1} v_{M,2} ... v_{M,kM} kM v_{M,1} v_{M,2} ... v_{M,kM}
where: where:
N number of vertices on polyhedron N number of vertices on polyhedron
x_i y_i z_i x, y, and z coordinates of ith vertex x_i y_i z_i x, y, and z coordinates of ith vertex
M number of faces on polyhedron M number of faces on polyhedron
ki number of vertices on ith face ki number of vertices on ith face
v_{i,j} jth vertex on ith face v_{i,j} jth vertex on ith face
In English: In English:
First the number of vertices are specified. Next First the number of vertices are specified. Next
the vertices are defined by listing the 3 the vertices are defined by listing the 3
coordinates of each one. Next the number of faces coordinates of each one. Next the number of faces
are specified. Finally, the faces themselves are are specified. Finally, the faces themselves are
specified. A face is specified by first giving specified. A face is specified by first giving
the number of vertices around the polygonal face, the number of vertices around the polygonal face,
followed by the (integer) indices of these followed by the (integer) indices of these
vertices. When specifying indices, note that vertices. When specifying indices, note that
they must be given in counter-clockwise order they must be given in counter-clockwise order
(when looking at the face from outside the (when looking at the face from outside the
polyhedron), and the vertices are indexed from 0 polyhedron), and the vertices are indexed from 0
to N-1 for a polyhedron with N faces. to N-1 for a polyhedron with N faces.
White space can be inserted (or not) as desired. White space can be inserted (or not) as desired.
Three example polyhedron geometry files are included: Three example polyhedron geometry files are included:
cube A cube, 20 units on a side, centered at cube A cube, 20 units on a side, centered at
the origin and aligned with the coordinate axes. the origin and aligned with the coordinate axes.
tetra A tetrahedron formed by taking the convex tetra A tetrahedron formed by taking the convex
hull of the origin, and the points (5,0,0), hull of the origin, and the points (5,0,0),
(0,4,0), and (0,0,3). (0,4,0), and (0,0,3).
icosa An icosahedron with vertices lying on the unit icosa An icosahedron with vertices lying on the unit
sphere, centered at the origin. sphere, centered at the origin.
3. RUNNING THE PROGRAM 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 The program will read in the geometry of the
polyhedron, and the print out the ten volume polyhedron, and the print out the ten volume
integrals. integrals.
The program also computes some of the mass The program also computes some of the mass
properties which may be inferred from the volume properties which may be inferred from the volume
integrals. A density of 1.0 is assumed, although integrals. A density of 1.0 is assumed, although
this may be changed in function main(). The this may be changed in function main(). The
center of mass is computed as well as the inertia center of mass is computed as well as the inertia
tensor relative to a frame with origin at the tensor relative to a frame with origin at the
center of mass. Note, however, that this matrix center of mass. Note, however, that this matrix
may not be diagonal. If not, a diagonalization may not be diagonal. If not, a diagonalization
routine must be performed, to determine the routine must be performed, to determine the
orientation of the true body frame relative to orientation of the true body frame relative to
the original model frame. The Jacobi method the original model frame. The Jacobi method
works quite well (see Numerical Recipes in C by works quite well (see Numerical Recipes in C by
Press, et. al.). Press, et. al.).
4. DISCLAIMERS 4. DISCLAIMERS
1. The volume integration code has been written 1. The volume integration code has been written
to match the development and algorithms presented to match the development and algorithms presented
in the paper, and not with maximum optimization in the paper, and not with maximum optimization
in mind. While inherently very efficient, a few in mind. While inherently very efficient, a few
more cycles can be squeezed out of the algorithm. more cycles can be squeezed out of the algorithm.
This is left as an exercise. :) This is left as an exercise. :)
2. Don't like global variables? The three 2. Don't like global variables? The three
procedures which evaluate the volume integrals procedures which evaluate the volume integrals
can be combined into a single procedure with two can be combined into a single procedure with two
nested loops. In addition to providing some nested loops. In addition to providing some
speedup, all of the global variables can then be speedup, all of the global variables can then be
made local. made local.
3. The polyhedron data structure used by the 3. The polyhedron data structure used by the
program is admittedly lame; much better schemes program is admittedly lame; much better schemes
are possible. The idea here is just to give the are possible. The idea here is just to give the
basic integral evaluation code, which will have basic integral evaluation code, which will have
to be adjusted for other polyhedron data to be adjusted for other polyhedron data
structures. structures.
4. There is no error checking for the input 4. There is no error checking for the input
files. Be careful. Note the hard limits files. Be careful. Note the hard limits
#defined for the number of vertices, number of #defined for the number of vertices, number of
faces, and number of vertices per faces. faces, and number of vertices per faces.

View File

@ -189,7 +189,7 @@ void Foam::waveModels::Boussinesq::setVelocity
const label paddlei = faceToPaddle_[facei]; const label paddlei = faceToPaddle_[facei];
const vector Uf = this->Uf const vector Uf = this->Uf
( (
waveHeight_, waveHeight_,
waterDepthRef_, waterDepthRef_,
xPaddle_[paddlei], xPaddle_[paddlei],

View File

@ -128,7 +128,7 @@ void Foam::waveModels::StokesI::setLevel
{ {
const scalar eta = const scalar eta =
this->eta this->eta
( (
waveHeight_, waveHeight_,
waveKx, waveKx,
xPaddle_[paddlei], xPaddle_[paddlei],
@ -171,7 +171,7 @@ void Foam::waveModels::StokesI::setVelocity
const label paddlei = faceToPaddle_[facei]; const label paddlei = faceToPaddle_[facei];
const vector Uf = UfBase const vector Uf = UfBase
( (
waveHeight_, waveHeight_,
waterDepthRef_, waterDepthRef_,
waveKx, waveKx,
@ -221,7 +221,7 @@ bool Foam::waveModels::StokesI::readDict(const dictionary& overrideDict)
{ {
if (regularWaveModel::readDict(overrideDict)) if (regularWaveModel::readDict(overrideDict))
{ {
waveLength_ = waveLength(waterDepthRef_, wavePeriod_); waveLength_ = waveLength(waterDepthRef_, wavePeriod_);
return true; return true;
} }

View File

@ -119,7 +119,7 @@ void Foam::waveModels::StokesII::setLevel
{ {
const scalar eta = const scalar eta =
this->eta this->eta
( (
waveHeight_, waveHeight_,
waterDepthRef_, waterDepthRef_,
waveKx, waveKx,

View File

@ -672,11 +672,13 @@ Foam::scalar Foam::waveModels::StokesV::eta
const scalar theta = kx*x + ky*y - 2.0*mathematical::pi/T*t + phase; const scalar theta = kx*x + ky*y - 2.0*mathematical::pi/T*t + phase;
return return
(
amp1*cos(theta) amp1*cos(theta)
+ amp2*cos(2*theta) + amp2*cos(2*theta)
+ amp3*cos(3*theta) + amp3*cos(3*theta)
+ amp4*cos(4*theta) + amp4*cos(4*theta)
+ amp5*cos(5*theta); + amp5*cos(5*theta)
);
} }
@ -758,9 +760,9 @@ void Foam::waveModels::StokesV::setLevel
{ {
const scalar eta = const scalar eta =
this->eta this->eta
( (
waterDepthRef_, waterDepthRef_,
waveKx, waveKx,
waveKy, waveKy,
lambda_, lambda_,
wavePeriod_, wavePeriod_,
@ -801,7 +803,7 @@ void Foam::waveModels::StokesV::setVelocity
const label paddlei = faceToPaddle_[facei]; const label paddlei = faceToPaddle_[facei];
const vector Uf = this->Uf const vector Uf = this->Uf
( (
waterDepthRef_, waterDepthRef_,
waveKx, waveKx,
waveKy, waveKy,
@ -869,11 +871,11 @@ bool Foam::waveModels::StokesV::readDict(const dictionary& overrideDict)
if (f1 > 0.001 || f2 > 0.001) if (f1 > 0.001 || f2 > 0.001)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "No convergence for Stokes V wave theory" << nl << "No convergence for Stokes V wave theory" << nl
<< " f1: " << f1 << nl << " f1: " << f1 << nl
<< " f2: " << f2 << nl << " f2: " << f2 << nl
<< exit(FatalError); << exit(FatalError);
} }
return true; return true;

View File

@ -248,7 +248,7 @@ void Foam::waveModels::cnoidal::setLevel
{ {
const scalar eta = const scalar eta =
this->eta this->eta
( (
waveHeight_, waveHeight_,
m_, m_,
waveKx, waveKx,
@ -290,7 +290,7 @@ void Foam::waveModels::cnoidal::setVelocity
const label paddlei = faceToPaddle_[facei]; const label paddlei = faceToPaddle_[facei];
const vector Uf = this->Uf const vector Uf = this->Uf
( (
waveHeight_, waveHeight_,
waterDepthRef_, waterDepthRef_,
m_, m_,

View File

@ -168,19 +168,19 @@ void Foam::waveModel::setAlpha(const scalarField& level)
const scalar zMin0 = zMin_[facei] - zMin0_; const scalar zMin0 = zMin_[facei] - zMin0_;
const scalar zMax0 = zMax_[facei] - zMin0_; const scalar zMax0 = zMax_[facei] - zMin0_;
if (zMax0 < paddleCalc) if (zMax0 < paddleCalc)
{ {
alpha_[facei] = 1.0; alpha_[facei] = 1.0;
} }
else if (zMin0 > paddleCalc) else if (zMin0 > paddleCalc)
{ {
alpha_[facei] = 0.0; alpha_[facei] = 0.0;
} }
else else
{ {
scalar dz = paddleCalc - zMin0; scalar dz = paddleCalc - zMin0;
alpha_[facei] = dz/(zMax0 - zMin0); alpha_[facei] = dz/(zMax0 - zMin0);
} }
} }
} }
@ -217,11 +217,11 @@ void Foam::waveModel::setPaddlePropeties
if ((zMax > paddleCalc) && (zMin < paddleCalc)) if ((zMax > paddleCalc) && (zMin < paddleCalc))
{ {
scalar dz = paddleCalc - zMin; scalar dz = paddleCalc - zMin;
fraction = dz/(zMax - zMin); fraction = dz/(zMax - zMin);
z = z_[facei] - zMin0_; z = z_[facei] - zMin0_;
} }
} }
else else
{ {
if (zMax < paddleCalc) if (zMax < paddleCalc)
{ {
@ -230,7 +230,7 @@ void Foam::waveModel::setPaddlePropeties
else if ((zMax > paddleCalc) && (zMin < paddleCalc)) else if ((zMax > paddleCalc) && (zMin < paddleCalc))
{ {
scalar dz = paddleCalc - zMin; scalar dz = paddleCalc - zMin;
fraction = dz/(zMax - zMin); fraction = dz/(zMax - zMin);
z = waterDepthRef_; z = waterDepthRef_;
} }
} }