ASL
0.1.7
Advanced Simulation Library
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
levelSet
levelSetNormalGrowth.cc
Go to the documentation of this file.
1
/*
2
* Advanced Simulation Library <http://asl.org.il>
3
*
4
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5
*
6
*
7
* This file is part of Advanced Simulation Library (ASL).
8
*
9
* ASL is free software: you can redistribute it and/or modify it
10
* under the terms of the GNU Affero General Public License as
11
* published by the Free Software Foundation, version 3 of the License.
12
*
13
* ASL is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Affero General Public License for more details.
17
*
18
* You should have received a copy of the GNU Affero General Public License
19
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
20
*
21
*/
22
23
27
28
#include <
aslDataInc.h
>
29
#include <
writers/aslVTKFormatWriters.h
>
30
#include <
num/aslLSNormalGrowth.h
>
31
#include <
utilities/aslTimer.h
>
32
#include <
utilities/aslParametersManager.h
>
33
#include <
math/aslTemplates.h
>
34
#include <
acl/aclMath/aclVectorOfElements.h
>
35
#include <
acl/aclUtilities.h
>
36
#include <
aslGeomInc.h
>
37
38
39
typedef
float
FlT
;
40
//typedef double FlT;
41
typedef
asl::UValue<FlT>
Param
;
42
acl::TypeID
type
(
acl::typeToTypeID<FlT>
());
43
44
45
int
main
(
int
argc,
char
* argv[])
46
{
47
asl::ApplicationParametersManager
appParamsManager(
"levelSetNormalGrowth"
,
48
"1.0"
);
49
50
asl::Parameter<asl::AVec<int>
> size(
asl::makeAVec<int>
(100, 100, 100),
"size"
,
"size"
);
51
asl::Parameter<FlT>
dx(1.0,
"dx"
,
"dx"
);
52
asl::Parameter<FlT>
dt(1.0,
"dt"
,
"dt"
);
53
asl::Parameter<FlT>
superS(0.2,
"superS"
,
"super saturation"
);
54
asl::Parameter<FlT>
radius(10.5,
"radius"
,
"initial radius"
);
55
56
57
asl::Parameter<cl_uint>
nIterations(100,
"nIterations"
,
"Number of iterations"
);
58
asl::Parameter<cl_uint>
nItOut(10,
"nItOut"
,
"Number of iterations for output"
);
59
60
appParamsManager.
load
(argc, argv);
61
62
std::cout <<
"Data initialization..."
;
63
64
asl::Block
block(size.
v
(), dx.v());
65
auto
levelSet(
asl::generateDataContainerACL_SP<FlT>
(block, 1, 1u));
66
67
asl::AVec<>
center(
asl::AVec<FlT>
(size.
v
())*
FlT
(.5));
68
69
auto
sphere1(generateDFSphere(radius.
v
(), center*.8));
70
auto
sphere2(generateDFSphere(radius.
v
(), center*1.2));
71
asl::initData
(levelSet, normalize(sphere1 | sphere2, dx.v()));
72
73
auto
superSaturation(
asl::generateDataContainerConst_SP
(block, superS.
v
(), 1u));
74
75
76
asl::WriterVTKXML
writer(appParamsManager.
getDir
() +
"levelSetNormalGrowth"
);
77
writer.
addScalars
(
"levelSet"
, *levelSet);
78
79
std::cout <<
"Finished"
<< endl;
80
81
std::cout <<
"Numerics initialization..."
<< flush;
82
83
auto
lsNum(std::make_shared<asl::LSNormalGrowth>(levelSet, superSaturation));
84
85
lsNum->init();
86
87
std::cout <<
"Finished"
<< endl;
88
std::cout <<
"Computing..."
;
89
asl::Timer
timer;
90
91
writer.
write
();
92
93
timer.
start
();
94
for
(
unsigned
int
i(0); i < nIterations.
v
(); ++i)
95
{
96
lsNum->execute();
97
if
(!(i % nItOut.
v
()))
98
writer.
write
();
99
}
100
timer.
stop
();
101
102
cout <<
"Finished"
<< endl;
103
104
cout <<
"Computation statistic:"
<< endl;
105
cout <<
"Real Time = "
<< timer.
realTime
() <<
"; Processor Time = "
106
<< timer.
processorTime
() <<
"; Processor Load = "
107
<< timer.
processorLoad
() * 100 <<
"%"
<< endl;
108
109
return
0;
110
}
aclUtilities.h
aclVectorOfElements.h
FlT
float FlT
Definition
acousticWaves.cc:40
aslDataInc.h
aslGeomInc.h
aslLSNormalGrowth.h
aslParametersManager.h
aslTemplates.h
aslTimer.h
aslVTKFormatWriters.h
asl::AVec
Definition
aslVectorsDynamicLength.h:40
asl::ApplicationParametersManager
Definition
aslParametersManager.h:159
asl::ApplicationParametersManager::load
void load(int argc, char *argv[])
asl::Block
Definition
aslBlocks.h:57
asl::Parameter
Definition
aslParametersManager.h:45
asl::Parameter::v
const T & v() const
Definition
aslParametersManager.h:179
asl::ParametersManager::getDir
std::string getDir()
asl::Timer
Definition
aslTimer.h:34
asl::Timer::realTime
const double realTime() const
Definition
aslTimer.h:45
asl::Timer::stop
void stop()
Definition
aslTimer.h:44
asl::Timer::processorTime
const double processorTime() const
Definition
aslTimer.h:46
asl::Timer::start
void start()
Definition
aslTimer.h:43
asl::Timer::processorLoad
const double processorLoad() const
Definition
aslTimer.h:47
asl::UValue
Updatable value. This class stores value and its TimeStamp.
Definition
aslUValue.h:35
asl::Writer::addScalars
void addScalars(std::string name, AbstractData &data)
asl::WriterVTKXML
Definition
aslVTKFormatWriters.h:42
asl::WriterVTKXML::write
void write()
Param
asl::UValue< FlT > Param
Definition
cubeGravity.cc:43
asl::generateDataContainerACL_SP
SPDataWrapperACLData generateDataContainerACL_SP(const Block &b, unsigned int n=1)
generates pointer to ACL Data field with n components
asl::generateDataContainerConst_SP
SPDataWithGhostNodesACL generateDataContainerConst_SP(const Block &b, T a, unsigned int gN)
type
acl::TypeID type(acl::typeToTypeID< FlT >())
acl::typeToTypeID
constexpr const TypeID typeToTypeID()
acl::TypeID
TypeID
Definition
aclTypes.h:39
asl::makeAVec
AVec< T > makeAVec(T a1)
Definition
aslVectorsDynamicLength.h:176
asl::initData
void initData(SPAbstractData d, double a)
main
int main()
Definition
testABDFormat.cc:126
Generated by
1.17.0