[asl] 129/177: Add --input option to examples
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Aug 27 09:22:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository asl.
commit 05f2284ebc6b36eb3b00d433b8c12b8fad6589fa
Author: Avtech Scientific <AvtechScientific at users.noreply.github.com>
Date: Thu Jul 30 19:44:20 2015 +0300
Add --input option to examples
---
NEWS.md | 2 +-
README.md | 5 ++---
examples/elastic/poroelastic.cc | 5 ++---
examples/flow/bus_wind.cc | 3 ++-
examples/flow/locomotive.cc | 3 ++-
examples/flow/locomotive_laminar.cc | 37 +++++++++++++++++----------------
examples/flow/locomotive_stability.cc | 16 +++++++-------
examples/heatTransfer/surfaceFlux.cc | 2 +-
examples/massTransferSM/testSMDiff.cc | 2 +-
examples/massTransferSM/testSMDiff3C.cc | 2 +-
examples/massTransferSM/testSMPhi.cc | 2 +-
examples/massTransferSM/testSMPhiBV.cc | 2 +-
src/utilities/aslParametersManager.h | 2 +-
13 files changed, 42 insertions(+), 41 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index d5c6ee3..e8b6065 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,4 +5,4 @@
- supplying cl.hpp, since not provided by OpenCL 2.0
- bug fixes
- improved tests
-- improved application parameters management
\ No newline at end of file
+- improved examples
\ No newline at end of file
diff --git a/README.md b/README.md
index 9701e4d..5fc89c9 100644
--- a/README.md
+++ b/README.md
@@ -35,9 +35,8 @@ Professional consulting, training and integration services are provided by [Avte
### Running an example
1. Go to examples: `cd examples/flow/locomotive`
-2. Copy the .stl input file: `cp ../../../../ASL/examples/input_data/locomotive.stl .`
-3. Run: `./locomotive`. Optionally: change some parameters - `./locomotive --dx 0.1 --dt 2` or write all of them into a file for later editing/reuse - `./locomotive -g bigGrid.ini`. List all available options - `locomotive -h`.
-4. Post-processing: see [step by step example](https://github.com/AvtechScientific/ASL/wiki/User-Guide#post-processing) and the ParaView state file `examples/input_data/locomotive.pvsm`.
+2. Run: `./locomotive --input ../../../../ASL/examples/input_data/locomotive.stl`. Optionally: change some parameters - `./locomotive --input locomotive.stl --dx 0.1 --dt 2` or write all of them into a file for later editing/reuse - `./locomotive -g bigGrid.ini`. List all available options - `locomotive -h`.
+3. Post-processing: see [step by step example](https://github.com/AvtechScientific/ASL/wiki/User-Guide#post-processing) and the ParaView state file `examples/input_data/locomotive.pvsm`.
### Writing your own code using ASL
diff --git a/examples/elastic/poroelastic.cc b/examples/elastic/poroelastic.cc
index 7896983..6f9fef2 100644
--- a/examples/elastic/poroelastic.cc
+++ b/examples/elastic/poroelastic.cc
@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
asl::Parameter<cl_float> hydraulicConductivity("hydraulic_conductivity", "hydraulic conductivity");
asl::Parameter<cl_float> rho("rho", "density");
asl::Parameter<asl::AVec<FlT> > g("g", "gravity vector");
-
+ asl::Parameter<string> input("input", "path to the brain geometry input file");
asl::Parameter<unsigned int> tsim("num_iterations", "number of iterations");
asl::Parameter<unsigned int> tout("num_it_out", "number of iterations between outputs");
@@ -66,8 +66,7 @@ int main(int argc, char* argv[])
std::cout << "Data initialization... ";
- asl::SPDataWithGhostNodesACLData map0(asl::read(appParamsManager.getDir() +
- "brain.vti", 0));
+ asl::SPDataWithGhostNodesACLData map0(asl::read(input.v(), 0));
// asl::Block block(size.v(), dx.v());
asl::Block block(map0->getInternalBlock());
dx.v() = block.dx*1e-3;
diff --git a/examples/flow/bus_wind.cc b/examples/flow/bus_wind.cc
index 7400cc7..2644632 100644
--- a/examples/flow/bus_wind.cc
+++ b/examples/flow/bus_wind.cc
@@ -53,6 +53,7 @@ int main(int argc, char* argv[])
// hardware parameters(platform/device) through command line/parameters file
asl::ApplicationParametersManager appParamsManager("bus_wind",
"1.0");
+ asl::Parameter<string> input("input", "path to the bus geometry input file");
appParamsManager.load(argc, argv);
Param dx(8);
@@ -64,7 +65,7 @@ int main(int argc, char* argv[])
std::cout << "Data initialization... ";
- auto object(asl::readSurface("bus.stl", dx.v(), 1.5,.25,0.,1.,3.,1.));
+ auto object(asl::readSurface(input.v(), dx.v(), 1.5,.25,0.,1.,3.,1.));
asl::Block block(object->getInternalBlock());
diff --git a/examples/flow/locomotive.cc b/examples/flow/locomotive.cc
index 49300b6..107571f 100644
--- a/examples/flow/locomotive.cc
+++ b/examples/flow/locomotive.cc
@@ -101,6 +101,7 @@ int main(int argc, char* argv[])
asl::Parameter<FlT> dt(1., "dt", "time step", "s");
asl::Parameter<FlT> nu(.001, "nu", "kinematic viscosity", "m^2/s");
asl::Parameter<unsigned int> iterations(20001, "iterations", "iterations number");
+ asl::Parameter<string> input("input", "path to the geometry input file");
/* Load previously declared Parameters from command line and/or
parameters file. Use default values if neither is provided. */
@@ -120,7 +121,7 @@ int main(int argc, char* argv[])
cout << "Data initialization... " << flush;
// Read geometry of the locomotive from the file
- auto locomotive(asl::readSurface("locomotive.stl", bl));
+ auto locomotive(asl::readSurface(input.v(), bl));
// Create block for further use
asl::Block block(locomotive->getInternalBlock());
diff --git a/examples/flow/locomotive_laminar.cc b/examples/flow/locomotive_laminar.cc
index fa9778f..5347433 100644
--- a/examples/flow/locomotive_laminar.cc
+++ b/examples/flow/locomotive_laminar.cc
@@ -46,25 +46,25 @@ typedef asl::UValue<double> Param;
using asl::AVec;
using asl::makeAVec;
-asl::SPDistanceFunction generateTunel(asl::Block & bl)
+asl::SPDistanceFunction generateTunnel(asl::Block & bl)
{
double l(bl.getBPosition()[0]-bl.position[0]+bl.dx);
- double rTunel((bl.getBPosition()[2]-bl.position[2])/2.);
+ double rTunnel((bl.getBPosition()[2]-bl.position[2])/2.);
double dx(bl.dx);
asl::AVec<int> size(bl.getSize());
asl::AVec<> center(.5*(bl.getBPosition()+bl.position));
- center[1]=bl.position[1]+.25*rTunel;
+ center[1]=bl.position[1]+.25*rTunnel;
asl::AVec<> centerG(center);
centerG[1]=bl.position[1];
- auto tunel(-(generateDFCylinder(rTunel, makeAVec(l,0.,0.), center) &
+ auto tunnel(-(generateDFCylinder(rTunnel, makeAVec(l,0.,0.), center) &
generateDFPlane(makeAVec(0.,-1.,0.), centerG)));
- return normalize(tunel, dx);
+ return normalize(tunnel, dx);
}
@@ -74,6 +74,7 @@ int main(int argc, char* argv[])
// hardware parameters(platform/device) through command line/parameters file
asl::ApplicationParametersManager appParamsManager("locomotive_laminar",
"1.0");
+ asl::Parameter<string> input("input", "path to the geometry input file");
appParamsManager.load(argc, argv);
Param dx(0.5);
@@ -89,12 +90,12 @@ int main(int argc, char* argv[])
std::cout << "Data initialization..." << endl;
- auto object(asl::readSurface("locomotive.stl", bl));
+ auto locomotive(asl::readSurface(input.v(), bl));
- asl::Block block(object->getInternalBlock());
+ asl::Block block(locomotive->getInternalBlock());
- auto tunelMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
- asl::initData(tunelMap, generateTunel(block));
+ auto tunnelMap(asl::generateDataContainerACL_SP<FlT>(block, 1, 1u));
+ asl::initData(tunnelMap, generateTunnel(block));
auto forceField(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
asl::initData(forceField, makeAVec(0.,0.,0.));
@@ -116,18 +117,18 @@ int main(int argc, char* argv[])
std::vector<asl::SPNumMethod> bc;
std::vector<asl::SPNumMethod> bcV;
- bc.push_back(generateBCVelocity(lbgk, vfTunnel, tunelMap));
- bcV.push_back(generateBCVelocityVel(lbgk, vfTunnel, tunelMap));
-// bcV.push_back(generateBCNoSlipRho(lbgk, tunelMap));
- bc.push_back(generateBCNoSlip(lbgk, object));
- bcV.push_back(generateBCNoSlipVel(lbgk, object));
-// bcV.push_back(generateBCNoSlipRho(lbgk, object));
+ bc.push_back(generateBCVelocity(lbgk, vfTunnel, tunnelMap));
+ bcV.push_back(generateBCVelocityVel(lbgk, vfTunnel, tunnelMap));
+// bcV.push_back(generateBCNoSlipRho(lbgk, tunnelMap));
+ bc.push_back(generateBCNoSlip(lbgk, locomotive));
+ bcV.push_back(generateBCNoSlipVel(lbgk, locomotive));
+// bcV.push_back(generateBCNoSlipRho(lbgk, locomotive));
bc.push_back(generateBCConstantPressureVelocity(lbgk, 1., makeAVec(0.1,0.,0.), {asl::X0, asl::XE}));
initAll(bc);
initAll(bcV);
- auto computeForce(generateComputeSurfaceForce(lbgk, forceField, object));
+ auto computeForce(generateComputeSurfaceForce(lbgk, forceField, locomotive));
computeForce->init();
cout << "Finished" << endl;
@@ -135,8 +136,8 @@ int main(int argc, char* argv[])
asl::Timer timer;
asl::WriterVTKXML writer(appParamsManager.getDir() + "locomotive_laminar");
- writer.addScalars("map", *object);
- writer.addScalars("tunel", *tunelMap);
+ writer.addScalars("locomotive", *locomotive);
+ writer.addScalars("tunnel", *tunnelMap);
writer.addScalars("rho", *lbgk->getRho());
writer.addVector("v", *lbgk->getVelocity());
writer.addVector("force", *forceField);
diff --git a/examples/flow/locomotive_stability.cc b/examples/flow/locomotive_stability.cc
index 53aca08..66bf3f6 100644
--- a/examples/flow/locomotive_stability.cc
+++ b/examples/flow/locomotive_stability.cc
@@ -77,6 +77,7 @@ int main(int argc, char* argv[])
// hardware parameters(platform/device) through command line/parameters file
asl::ApplicationParametersManager appParamsManager("locomotive_stability",
"1.0");
+ asl::Parameter<string> input("input", "path to the geometry input file");
appParamsManager.load(argc, argv);
Param dx(0.25);
@@ -87,10 +88,9 @@ int main(int argc, char* argv[])
std::cout << "Data initialization... ";
-
- auto object(asl::readSurface("locomotive.stl", dx.v(), .5, 1., 0., 1., 2., 4.));
+ auto locomotive(asl::readSurface(input.v(), dx.v(), .5, 1., 0., 1., 2., 4.));
- asl::Block block(object->getInternalBlock());
+ asl::Block block(locomotive->getInternalBlock());
auto forceField(asl::generateDataContainerACL_SP<FlT>(block, 3, 1u));
asl::initData(forceField, makeAVec(0., 0., 0.));
@@ -116,8 +116,8 @@ int main(int argc, char* argv[])
asl::initData(nozzelsMap, generateNozzels(block));
- bc.push_back(generateBCNoSlip(lbgk, object));
- bcV.push_back(generateBCNoSlipVel(lbgk, object));
+ bc.push_back(generateBCNoSlip(lbgk, locomotive));
+ bcV.push_back(generateBCNoSlipVel(lbgk, locomotive));
bc.push_back(generateBCConstantPressureVelocity(lbgk, 1.,
makeAVec(0.1,0.,0.05),
{asl::X0, asl::XE,asl::Y0,asl::YE,asl::Z0,asl::ZE}));
@@ -125,15 +125,15 @@ int main(int argc, char* argv[])
initAll(bc);
initAll(bcV);
- auto computeForce(generateComputeSurfaceForce(lbgk, forceField, object));
+ auto computeForce(generateComputeSurfaceForce(lbgk, forceField, locomotive));
computeForce->init();
std::cout << "Finished" << endl;
std::cout << "Computing..." << endl;
- asl::WriterVTKXML writer("locomotive_stability");
- writer.addScalars("train", *object);
+ asl::WriterVTKXML writer(appParamsManager.getDir() + "locomotive_stability");
+ writer.addScalars("locomotive", *locomotive);
writer.addScalars("nozzels", *nozzelsMap);
writer.addScalars("rho", *lbgk->getRho());
writer.addVector("v", *lbgk->getVelocity());
diff --git a/examples/heatTransfer/surfaceFlux.cc b/examples/heatTransfer/surfaceFlux.cc
index af73487..c4fed8c 100644
--- a/examples/heatTransfer/surfaceFlux.cc
+++ b/examples/heatTransfer/surfaceFlux.cc
@@ -103,7 +103,7 @@ int main(int argc, char* argv[])
std::cout << "Computing..." << flush;
asl::Timer timer;
- asl::WriterVTKXML writer("surfaceFlux");
+ asl::WriterVTKXML writer(appParamsManager.getDir() + "surfaceFlux");
writer.addScalars("map", *ballMapMem);
writer.addScalars("mapE", *ballBMapMem);
writer.addScalars("c", *cField);
diff --git a/examples/massTransferSM/testSMDiff.cc b/examples/massTransferSM/testSMDiff.cc
index 03cd81f..48e55a1 100644
--- a/examples/massTransferSM/testSMDiff.cc
+++ b/examples/massTransferSM/testSMDiff.cc
@@ -97,7 +97,7 @@ int main(int argc, char* argv[])
std::cout << "Computing..." << flush;
asl::Timer timer;
- asl::WriterVTKXML writer("testSMDiff");
+ asl::WriterVTKXML writer(appParamsManager.getDir() + "testSMDiff");
writer.addScalars("c1", *c1Field);
writer.addScalars("c2", *c2Field);
diff --git a/examples/massTransferSM/testSMDiff3C.cc b/examples/massTransferSM/testSMDiff3C.cc
index 7053f4d..3c1a2c9 100644
--- a/examples/massTransferSM/testSMDiff3C.cc
+++ b/examples/massTransferSM/testSMDiff3C.cc
@@ -106,7 +106,7 @@ int main(int argc, char* argv[])
std::cout << "Computing..." << flush;
asl::Timer timer;
- asl::WriterVTKXML writer("testSMDiff3C");
+ asl::WriterVTKXML writer(appParamsManager.getDir() + "testSMDiff3C");
writer.addScalars("c1", *c1Field);
writer.addScalars("c2", *c2Field);
writer.addScalars("c3", *c3Field);
diff --git a/examples/massTransferSM/testSMPhi.cc b/examples/massTransferSM/testSMPhi.cc
index 39543eb..011330c 100644
--- a/examples/massTransferSM/testSMPhi.cc
+++ b/examples/massTransferSM/testSMPhi.cc
@@ -110,7 +110,7 @@ int main(int argc, char* argv[])
std::cout << "Computing..." << flush;
asl::Timer timer;
- asl::WriterVTKXML writer("testSMPhi");
+ asl::WriterVTKXML writer(appParamsManager.getDir() + "testSMPhi");
writer.addScalars("c1", *c1Field);
writer.addScalars("c2", *c2Field);
writer.addScalars("phi", *phiField);
diff --git a/examples/massTransferSM/testSMPhiBV.cc b/examples/massTransferSM/testSMPhiBV.cc
index 51712a8..0fec207 100644
--- a/examples/massTransferSM/testSMPhiBV.cc
+++ b/examples/massTransferSM/testSMPhiBV.cc
@@ -131,7 +131,7 @@ int main(int argc, char* argv[])
std::cout << "Computing..." << flush;
asl::Timer timer;
- asl::WriterVTKXML writer("testSMPhiBV");
+ asl::WriterVTKXML writer(appParamsManager.getDir() + "testSMPhiBV");
writer.addScalars("c1", *c1Field);
writer.addScalars("c2", *c2Field);
writer.addScalars("c1a", *c1aField);
diff --git a/src/utilities/aslParametersManager.h b/src/utilities/aslParametersManager.h
index c9fd4f1..b115cfb 100644
--- a/src/utilities/aslParametersManager.h
+++ b/src/utilities/aslParametersManager.h
@@ -193,4 +193,4 @@ namespace asl
} //namespace asl
-#endif // ASLPARAMETERSMANAGER_H
+#endif // ASLPARAMETERSMANAGER_H
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/asl.git
More information about the debian-science-commits
mailing list