mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: fix/correct some tests. Remove useless tests
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,11 +28,12 @@ License
|
|||||||
|
|
||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
#include "List.H"
|
#include "List.H"
|
||||||
#include "SortableList.H"
|
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "StringStream.H"
|
#include "StringStream.H"
|
||||||
|
#include "ListOps.H"
|
||||||
|
#include "flipOp.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -209,12 +210,16 @@ int main()
|
|||||||
<< "/" << table1.keys().size()
|
<< "/" << table1.keys().size()
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
SortableList<word> sortKeys
|
List<word> sortKeys
|
||||||
// DynamicList<word> sortKeys
|
(
|
||||||
|
ListOps::create<word>
|
||||||
(
|
(
|
||||||
table1.keys().begin(),
|
table1.keys().begin(),
|
||||||
table1.keys().end()
|
table1.keys().end(),
|
||||||
|
noOp{}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
sort(sortKeys);
|
||||||
Info<<"sortKeys: " << flatOutput(sortKeys) << nl;
|
Info<<"sortKeys: " << flatOutput(sortKeys) << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,8 @@ Description
|
|||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "ITstream.H"
|
#include "ITstream.H"
|
||||||
|
#include "ListOps.H"
|
||||||
|
#include "flipOp.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -109,7 +111,7 @@ void doTest
|
|||||||
<< nl
|
<< nl
|
||||||
<< "====" << nl << endl;
|
<< "====" << nl << endl;
|
||||||
|
|
||||||
ITstream its(name, input);
|
ITstream its(input);
|
||||||
Info<< "got " << its.size() << " tokens - index at "
|
Info<< "got " << its.size() << " tokens - index at "
|
||||||
<< its.tokenIndex() << endl;
|
<< its.tokenIndex() << endl;
|
||||||
|
|
||||||
@ -164,7 +166,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
string stringInput("( string ; input \"string\" to tokenize )");
|
string stringInput("( string ; input \"string\" to tokenize )");
|
||||||
|
|
||||||
List<char> listInput(stringInput.cbegin(), stringInput.cend());
|
List<char> listInput
|
||||||
|
(
|
||||||
|
ListOps::create<char>
|
||||||
|
(
|
||||||
|
stringInput.cbegin(),
|
||||||
|
stringInput.cend(),
|
||||||
|
Foam::noOp{}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
doTest("empty", "", true, true);
|
doTest("empty", "", true, true);
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
Test-alloc.C
|
|
||||||
/*
|
|
||||||
Test-new.C
|
|
||||||
Test-malloc.C
|
|
||||||
Test.C
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-alloc
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
/* EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude */
|
|
||||||
/* EXE_LIBS = -lfiniteVolume */
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int *ptrs[500000];
|
|
||||||
|
|
||||||
// for (;;);
|
|
||||||
|
|
||||||
cerr << "allocating ints\n";
|
|
||||||
|
|
||||||
for (int i=0; i<500000; i++)
|
|
||||||
{
|
|
||||||
ptrs[i] = new int[1];
|
|
||||||
delete[] ptrs[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (;;);
|
|
||||||
|
|
||||||
cerr << "allocating double\n";
|
|
||||||
|
|
||||||
double* array = new double[500000];
|
|
||||||
|
|
||||||
for (;;);
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
#include "stream.h"
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
int *ptrs[500000];
|
|
||||||
|
|
||||||
cerr << "allocating ints\n";
|
|
||||||
|
|
||||||
for (int i=0; i<500000; i++)
|
|
||||||
{
|
|
||||||
ptrs[i] = (int*)malloc(sizeof(int));
|
|
||||||
}
|
|
||||||
|
|
||||||
// for (;;);
|
|
||||||
|
|
||||||
cerr << "deallocating ints\n";
|
|
||||||
|
|
||||||
for (i=0; i<500000; i++)
|
|
||||||
{
|
|
||||||
free(ptrs[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
cerr << "allocating double\n";
|
|
||||||
|
|
||||||
double* array = (double*)malloc(500000*sizeof(double));
|
|
||||||
|
|
||||||
for (;;);
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
#include <stream.h>
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
int* intPtrs[500000];
|
|
||||||
|
|
||||||
cerr << "allocating ints\n";
|
|
||||||
|
|
||||||
for (int i=0; i<500000; i++)
|
|
||||||
{
|
|
||||||
intPtrs[i] = new int[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
cerr << "allocated ints\n";
|
|
||||||
|
|
||||||
cerr << "deallocating ints\n";
|
|
||||||
|
|
||||||
for (i=0; i<500000; i++)
|
|
||||||
{
|
|
||||||
delete[] intPtrs[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
cerr << "deallocated ints\n";
|
|
||||||
|
|
||||||
cerr << "alloacting doubles\n";
|
|
||||||
|
|
||||||
double* doubles = new double[500000];
|
|
||||||
|
|
||||||
for (;;);
|
|
||||||
}
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
class Int
|
|
||||||
{
|
|
||||||
int I;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Int(){}
|
|
||||||
|
|
||||||
operator int()
|
|
||||||
{
|
|
||||||
return I;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
class List : public T
|
|
||||||
{
|
|
||||||
T* v;
|
|
||||||
int sz;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
List()
|
|
||||||
{
|
|
||||||
v = new T[sz=10];
|
|
||||||
}
|
|
||||||
|
|
||||||
List(int s)
|
|
||||||
{
|
|
||||||
v = new T[sz=s];
|
|
||||||
}
|
|
||||||
|
|
||||||
~List()
|
|
||||||
{
|
|
||||||
delete[] v;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int size() const;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline int List<T>::size() const
|
|
||||||
{
|
|
||||||
return sz;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include <stream.h>
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
typedef List<Int> intList;
|
|
||||||
|
|
||||||
intList list(10);
|
|
||||||
|
|
||||||
cout << list.size() << "\n";
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -390,7 +390,7 @@ int main(int argc, char *argv[])
|
|||||||
// Info<< list5 << " indices: " << list5.toc() << nl;
|
// Info<< list5 << " indices: " << list5.toc() << nl;
|
||||||
|
|
||||||
Info<< "\nassign from indices\n";
|
Info<< "\nassign from indices\n";
|
||||||
list4.read
|
list4.readList
|
||||||
(
|
(
|
||||||
IStringStream
|
IStringStream
|
||||||
(
|
(
|
||||||
|
|||||||
@ -58,6 +58,8 @@ int main(int argc, char *argv[])
|
|||||||
Info<< fvc::div(U);
|
Info<< fvc::div(U);
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -187,9 +187,7 @@ int main(int argc, char *argv[])
|
|||||||
Sout.precision(16);
|
Sout.precision(16);
|
||||||
|
|
||||||
const scalar SMALLS(1e-6);
|
const scalar SMALLS(1e-6);
|
||||||
const vector SMALLV(SMALLS, SMALLS, SMALLS);
|
|
||||||
const scalar GREATS(1e6);
|
const scalar GREATS(1e6);
|
||||||
const vector GREATV(GREATS, GREATS, GREATS);
|
|
||||||
|
|
||||||
// scalarField summation
|
// scalarField summation
|
||||||
{
|
{
|
||||||
@ -203,9 +201,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
// vectorField summation
|
// vectorField summation
|
||||||
{
|
{
|
||||||
vectorField vfield(10, SMALLV);
|
vectorField vfield(10, vector::uniform(SMALLS));
|
||||||
|
|
||||||
vfield[8] = GREATV;
|
vfield[8] = vector::uniform(GREATS);
|
||||||
vfield[9] = -vfield[8];
|
vfield[9] = -vfield[8];
|
||||||
Info<< "vectorField:" << vfield.size() << nl
|
Info<< "vectorField:" << vfield.size() << nl
|
||||||
<< " sum :" << sum(vfield) << nl
|
<< " sum :" << sum(vfield) << nl
|
||||||
@ -213,9 +211,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
// sphericalTensorField summation
|
// sphericalTensorField summation
|
||||||
{
|
{
|
||||||
sphericalTensorField tfield(10, SMALLS);
|
sphericalTensorField tfield(10, sphericalTensor(SMALLS));
|
||||||
|
|
||||||
tfield[8] = GREATS;
|
tfield[8] = sphericalTensor(GREATS);
|
||||||
tfield[9] = -tfield[8];
|
tfield[9] = -tfield[8];
|
||||||
Info<< "sphericalTensorField:" << tfield.size() << nl
|
Info<< "sphericalTensorField:" << tfield.size() << nl
|
||||||
<< " sum :" << sum(tfield) << nl
|
<< " sum :" << sum(tfield) << nl
|
||||||
@ -243,7 +241,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,6 +60,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,8 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,8 @@ int main()
|
|||||||
phi.write("phi", "xmgr");
|
phi.write("phi", "xmgr");
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -60,6 +60,8 @@ int main()
|
|||||||
);
|
);
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -157,7 +157,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
ITstream input
|
ITstream input
|
||||||
(
|
(
|
||||||
"input",
|
|
||||||
"(plain list with some with list duplicates)"
|
"(plain list with some with list duplicates)"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -74,6 +74,9 @@ int main(void)
|
|||||||
Info.operator Foam::OSstream&() << "stop" << endl;
|
Info.operator Foam::OSstream&() << "stop" << endl;
|
||||||
|
|
||||||
static_cast<OSstream&>(Info) << "\nEnd\n" << nl;
|
static_cast<OSstream&>(Info) << "\nEnd\n" << nl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -79,8 +79,7 @@ int main(int argc, char *argv[])
|
|||||||
"hij_",
|
"hij_",
|
||||||
};
|
};
|
||||||
|
|
||||||
labelRange range(-10, 40);
|
labelList values(identity(40, -10));
|
||||||
labelList values(range.begin(), range.end());
|
|
||||||
|
|
||||||
Info<<"words: " << flatOutput(words) << endl;
|
Info<<"words: " << flatOutput(words) << endl;
|
||||||
Info<<"values: " << flatOutput(values) << endl;
|
Info<<"values: " << flatOutput(values) << endl;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -60,7 +60,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
{
|
{
|
||||||
Info<< nl;
|
Info<< nl;
|
||||||
for (const word& item : readDir(".", listType))
|
for (const auto& item : readDir(".", listType))
|
||||||
{
|
{
|
||||||
Info<< " " << item << nl;
|
Info<< " " << item << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude \
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
|
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
-lsurfMesh \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lsampling \
|
-lsampling \
|
||||||
-lgeometricVoF
|
-lgeometricVoF
|
||||||
|
|||||||
@ -74,7 +74,7 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
Info<< "create field phi\n" << endl;
|
Info<< "create field phi\n" << endl;
|
||||||
surfaceScalarField phi = fvc::interpolate(U) & mesh.Sf();
|
surfaceScalarField phi(fvc::interpolate(U) & mesh.Sf());
|
||||||
|
|
||||||
dictionary dict = mesh.solverDict(alpha1.name());
|
dictionary dict = mesh.solverDict(alpha1.name());
|
||||||
|
|
||||||
@ -120,6 +120,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Time " << runTime.cpuTimeIncrement() << endl;
|
Info<< "Time " << runTime.cpuTimeIncrement() << endl;
|
||||||
|
|
||||||
|
#if 0
|
||||||
distFunc.constructRDF
|
distFunc.constructRDF
|
||||||
(
|
(
|
||||||
surf->interfaceCell(),
|
surf->interfaceCell(),
|
||||||
@ -128,6 +129,7 @@ int main(int argc, char *argv[])
|
|||||||
2,
|
2,
|
||||||
exchangeFields_
|
exchangeFields_
|
||||||
);
|
);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -94,6 +94,8 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< "\nEnd" << endl;
|
Info<< "\nEnd" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,7 @@ void testDivide(const List<Tuple2<T, scalar>>& list)
|
|||||||
|
|
||||||
void testModulo(const List<Tuple2<scalar, scalar>>& list)
|
void testModulo(const List<Tuple2<scalar, scalar>>& list)
|
||||||
{
|
{
|
||||||
const scalarModuloOp<> bop;
|
const scalarModuloOp<scalar> bop;
|
||||||
|
|
||||||
for (const auto& pair : list)
|
for (const auto& pair : list)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -189,4 +189,6 @@ int main()
|
|||||||
|
|
||||||
Snull<< sf4[1] << endl << endl;
|
Snull<< sf4[1] << endl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,4 +36,6 @@ int main()
|
|||||||
|
|
||||||
Snull<< vf4[1] << endl << endl;
|
Snull<< vf4[1] << endl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,6 +119,8 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< "\nEnd" << endl;
|
Info<< "\nEnd" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ void exptl_reading(Istream& is, wordRes& list)
|
|||||||
|
|
||||||
bool testReadList_wordRes(const std::string& input)
|
bool testReadList_wordRes(const std::string& input)
|
||||||
{
|
{
|
||||||
ITstream is("input", input);
|
ITstream is(input);
|
||||||
wordRes list;
|
wordRes list;
|
||||||
|
|
||||||
exptl_reading(is, list);
|
exptl_reading(is, list);
|
||||||
|
|||||||
Reference in New Issue
Block a user