documentation added, sample in property.hpp
This commit is contained in:
parent
633f121842
commit
3d2e242594
|
@ -38,6 +38,8 @@ bin/**
|
||||||
lib/**
|
lib/**
|
||||||
test*/**
|
test*/**
|
||||||
**/**notnow
|
**/**notnow
|
||||||
|
doc/code-documentation/
|
||||||
|
|
||||||
# all possible time folders
|
# all possible time folders
|
||||||
**/[0-9]
|
**/[0-9]
|
||||||
**/[0-9][0-9]
|
**/[0-9][0-9]
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,61 @@
|
||||||
|
#titlearea
|
||||||
|
{
|
||||||
|
background-color: rgb(243, 243, 243);
|
||||||
|
height: 120px;
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectlogo
|
||||||
|
{
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#titlearea, #projectname, #projectbrief, #projectnumber
|
||||||
|
{
|
||||||
|
font-family: Lato, "Helvetica Neue", Helvetica, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectname
|
||||||
|
{
|
||||||
|
font-size: 220%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectname a
|
||||||
|
{
|
||||||
|
color: rgba(0, 0, 0, 0.75);
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectname a:hover, #projectbrief a:hover
|
||||||
|
{
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgba(0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectbrief
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectbrief a
|
||||||
|
{
|
||||||
|
color: rgba(0, 0, 0, 0.65);
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectnumber a
|
||||||
|
{
|
||||||
|
font-size: 160%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#titlearea::before
|
||||||
|
{
|
||||||
|
padding-left: 300px;
|
||||||
|
position: absolute;
|
||||||
|
left: 18%;
|
||||||
|
top: 40px;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
-webkit-transform: translateY(-50%);
|
||||||
|
-ms-transform: translateY(-50%);
|
||||||
|
content: "C++ Source Code Documentation";
|
||||||
|
font-size: 180%;
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||||
|
<ul>
|
||||||
|
$navpath
|
||||||
|
<li class="footer">$generatedby
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!--END GENERATE_TREEVIEW-->
|
||||||
|
<!--BEGIN !GENERATE_TREEVIEW-->
|
||||||
|
<hr class="footer"/><address class="footer"><small>
|
||||||
|
$generatedby  <a href="http://www.doxygen.org/index.html">
|
||||||
|
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
|
||||||
|
</a> $doxygenversion
|
||||||
|
</small></address>
|
||||||
|
<!--END !GENERATE_TREEVIEW-->
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,54 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||||
|
<meta name="generator" content="Doxygen $doxygenversion"/>
|
||||||
|
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||||
|
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
|
||||||
|
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||||
|
$treeview
|
||||||
|
$search
|
||||||
|
$mathjax
|
||||||
|
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
|
||||||
|
$extrastylesheet
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||||
|
|
||||||
|
<!--BEGIN TITLEAREA-->
|
||||||
|
<div id="titlearea">
|
||||||
|
<table cellspacing="0" cellpadding="0">
|
||||||
|
<tbody>
|
||||||
|
<tr style="height: 56px;">
|
||||||
|
<!--BEGIN PROJECT_LOGO-->
|
||||||
|
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
|
||||||
|
<!--END PROJECT_LOGO-->
|
||||||
|
<!--BEGIN PROJECT_NAME-->
|
||||||
|
<td id="projectalign" style="padding-left: 0.5em;">
|
||||||
|
<div id="projectname"><a href="https://cemf.ir">$projectname</a>
|
||||||
|
<!--BEGIN PROJECT_NUMBER--> <span id="projectnumber"><a href="https://cemf.ir">$projectnumber</a></span><!--END PROJECT_NUMBER-->
|
||||||
|
</div>
|
||||||
|
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief"><a href="www.github.com/PhasicFlow">$projectbrief</a></div><!--END PROJECT_BRIEF-->
|
||||||
|
</td>
|
||||||
|
<!--END PROJECT_NAME-->
|
||||||
|
<!--BEGIN !PROJECT_NAME-->
|
||||||
|
<!--BEGIN PROJECT_BRIEF-->
|
||||||
|
<td style="padding-left: 0.5em;">
|
||||||
|
<div id="projectbrief">$projectbrief</div>
|
||||||
|
</td>
|
||||||
|
<!--END PROJECT_BRIEF-->
|
||||||
|
<!--END !PROJECT_NAME-->
|
||||||
|
<!--BEGIN DISABLE_INDEX-->
|
||||||
|
<!--BEGIN SEARCHENGINE-->
|
||||||
|
<td>$searchbox</td>
|
||||||
|
<!--END SEARCHENGINE-->
|
||||||
|
<!--END DISABLE_INDEX-->
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<!--END TITLEAREA-->
|
||||||
|
<!-- end header part -->
|
|
@ -1,53 +0,0 @@
|
||||||
# How to build PhasicFlow?
|
|
||||||
PhasicFlow uses CMake as the build system. you need to have CMake-3.22 or higher installed on your machine. you can either use the command line for setting-up the build system, or use `cmake-gui` to setup your build system through the GUI.
|
|
||||||
### Step 1:
|
|
||||||
Make sure you have installed all the required packages on your computer (tbb and CMake and compilers).
|
|
||||||
### Step 2: Cloning Kokkos
|
|
||||||
It is assumed that Kokkos source is located in the home folder of your OS. Clone the current version of Kokkos into your home folder:
|
|
||||||
|
|
||||||
```
|
|
||||||
cd ~
|
|
||||||
mkdir Kokkos
|
|
||||||
cd Kokkos
|
|
||||||
git clone https://github.com/kokkos/kokkos.git
|
|
||||||
```
|
|
||||||
|
|
||||||
or simply download and extract the source code of Kokkos in `~/Kokkos` folder. In the end, the top level CMakeLists.txt file should be located in `~/Kokkos/kokkos` folder.
|
|
||||||
|
|
||||||
### Step 3: Cloning PhasicFlow
|
|
||||||
Create the PhasicFlow folder in your home folder and then clone the source code into that folder:
|
|
||||||
|
|
||||||
```
|
|
||||||
cd ~
|
|
||||||
mkdir PhasicFlow
|
|
||||||
cd PhasicFlow
|
|
||||||
git clone https://github.com/hamidrezanorouzi/phasicFlow.git
|
|
||||||
```
|
|
||||||
### Step 4: Environmental variables
|
|
||||||
In the terminal enter the following command:
|
|
||||||
|
|
||||||
`gedit ~/.bashrc`
|
|
||||||
|
|
||||||
and add the following line to the end of file, save and close it.
|
|
||||||
|
|
||||||
source $HOME/PhasicFlow/phasicFlow/cmake/bashrc
|
|
||||||
|
|
||||||
close the terminal.
|
|
||||||
|
|
||||||
### Step 5: Building PhasicFlow
|
|
||||||
Follow one of the followings to build PhasicFlow for one mode of execution.
|
|
||||||
#### Serial build for CPU
|
|
||||||
Open a new terminal and enter the following commands:
|
|
||||||
```
|
|
||||||
cd ~/PhasicFlow/phasicFlow/build
|
|
||||||
cmake ../ -DpFlow_Build_Serial=On
|
|
||||||
make install
|
|
||||||
```
|
|
||||||
For faster builds, use `make install -j`. This will use all the CPU cores on your computer for building.
|
|
||||||
#### OpenMP build for CPU
|
|
||||||
|
|
||||||
#### GPU build for parallel execution on CUDA-enabled GPUs
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
After building, `bin`, `include`, and `lib` folders will be created in `~/PhasicFlow/phasicFlow/` folder. Now you are ready to use PhasicFlow.
|
|
|
@ -17,8 +17,6 @@ Licence:
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __property_hpp__
|
#ifndef __property_hpp__
|
||||||
#define __property_hpp__
|
#define __property_hpp__
|
||||||
|
|
||||||
|
@ -30,82 +28,116 @@ Licence:
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// forward
|
||||||
class dictionary;
|
class dictionary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* property holds the pure properties of materials.
|
||||||
|
*
|
||||||
|
* This class holds a list of all materials name and their densities that are
|
||||||
|
* used in the simulation: for walls and particles.
|
||||||
|
*/
|
||||||
class property
|
class property
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// - protected data members
|
||||||
|
|
||||||
|
/// pointer to the dictionary, if it is constructed from a file/dictionary
|
||||||
uniquePtr<dictionary> dict_ = nullptr;
|
uniquePtr<dictionary> dict_ = nullptr;
|
||||||
|
|
||||||
// - name of materials
|
/// list of name of materials
|
||||||
wordVector materials_;
|
wordVector materials_;
|
||||||
|
|
||||||
// - density of materials
|
/// list of density of materials
|
||||||
realVector densities_;
|
realVector densities_;
|
||||||
|
|
||||||
// fast mapping from name to index
|
/// rapid mapping from name to index
|
||||||
wordHashMap<uint32> nameIndex_;
|
wordHashMap<uint32> nameIndex_;
|
||||||
|
|
||||||
// - number of properties
|
/// number of materials
|
||||||
uint32 numMaterials_ = 0;
|
uint32 numMaterials_ = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// - protected member functions
|
||||||
|
|
||||||
|
/// read from dict
|
||||||
bool readDictionary(const dictionary& dict);
|
bool readDictionary(const dictionary& dict);
|
||||||
|
|
||||||
|
/// write to dict
|
||||||
bool writeDictionary(dictionary& dict)const;
|
bool writeDictionary(dictionary& dict)const;
|
||||||
|
|
||||||
|
/// creates a mapp
|
||||||
bool makeNameIndex();
|
bool makeNameIndex();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// type info
|
/// Type info
|
||||||
TypeInfoNV("property");
|
TypeInfoNV("property");
|
||||||
|
|
||||||
// - emptry, for reading from file
|
|
||||||
|
// - Constructors
|
||||||
|
|
||||||
|
/// Emptry constructor, used for reading from a file
|
||||||
property(){}
|
property(){}
|
||||||
|
|
||||||
property(const wordVector& materils, const realVector& densities);
|
/// Constructe from materials and densities
|
||||||
|
property(const wordVector& materials, const realVector& densities);
|
||||||
|
|
||||||
|
/// Construct from file
|
||||||
property(const fileSystem& file);
|
property(const fileSystem& file);
|
||||||
|
|
||||||
|
/// Construct from dictionary dict
|
||||||
property(const dictionary& dict);
|
property(const dictionary& dict);
|
||||||
|
|
||||||
|
/// Default copy
|
||||||
property(const property& ) = default;
|
property(const property& ) = default;
|
||||||
|
|
||||||
|
/// Default move
|
||||||
property(property&& ) = default;
|
property(property&& ) = default;
|
||||||
|
|
||||||
|
/// Default copy assignment
|
||||||
property& operator= (const property&) = default;
|
property& operator= (const property&) = default;
|
||||||
|
|
||||||
|
/// Default move assignment
|
||||||
property& operator= (property&&) = default;
|
property& operator= (property&&) = default;
|
||||||
|
|
||||||
|
/// Default destructor
|
||||||
~property() = default;
|
~property() = default;
|
||||||
|
|
||||||
//// - Methods
|
|
||||||
|
|
||||||
|
// - Methods
|
||||||
|
|
||||||
|
/// Return dictionary
|
||||||
inline const auto& dict()const
|
inline const auto& dict()const
|
||||||
{
|
{
|
||||||
return dict_();
|
return dict_();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return number of materials
|
||||||
inline auto numMaterials()const
|
inline auto numMaterials()const
|
||||||
{
|
{
|
||||||
return numMaterials_;
|
return numMaterials_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return list of material names
|
||||||
inline const auto& materials()const{
|
inline const auto& materials()const{
|
||||||
return materials_;
|
return materials_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - return densities
|
/// Return the list of densities
|
||||||
inline const auto& densities()const{
|
inline const auto& densities()const{
|
||||||
return densities_;
|
return densities_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return the material name of material i
|
||||||
inline const word& material(uint32 i)const
|
inline const word& material(uint32 i)const
|
||||||
{
|
{
|
||||||
return materials_[i];
|
return materials_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the name of material i.
|
||||||
|
/// Return true, if i is in the range and otherwise false
|
||||||
inline bool material(uint32 i, word& name)const
|
inline bool material(uint32 i, word& name)const
|
||||||
{
|
{
|
||||||
if(i<numMaterials_)
|
if(i<numMaterials_)
|
||||||
|
@ -120,11 +152,14 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return density of material i
|
||||||
inline real density(uint32 i)const
|
inline real density(uint32 i)const
|
||||||
{
|
{
|
||||||
return densities_[i];
|
return densities_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the density of material i.
|
||||||
|
/// Return true, if i is in the range and otherwise false
|
||||||
inline bool density(uint32 i, real& rho)const
|
inline bool density(uint32 i, real& rho)const
|
||||||
{
|
{
|
||||||
if(i<numMaterials_)
|
if(i<numMaterials_)
|
||||||
|
@ -139,6 +174,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the name of material in index idx
|
||||||
|
/// Return true, if the name found, otherwise false
|
||||||
inline bool nameToIndex(const word& name, uint32& idx)const
|
inline bool nameToIndex(const word& name, uint32& idx)const
|
||||||
{
|
{
|
||||||
if(auto[iter, found] = nameIndex_.findIf(name); found )
|
if(auto[iter, found] = nameIndex_.findIf(name); found )
|
||||||
|
@ -155,13 +192,13 @@ public:
|
||||||
|
|
||||||
//// - IO operatoins
|
//// - IO operatoins
|
||||||
|
|
||||||
// - read from dictionary
|
/// Read from dictionary
|
||||||
bool read(const dictionary& dict)
|
bool read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
return readDictionary(dict);
|
return readDictionary(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - write to dictionary
|
/// Write to dictionary
|
||||||
bool write(dictionary& dict)const
|
bool write(dictionary& dict)const
|
||||||
{
|
{
|
||||||
return writeDictionary(dict);
|
return writeDictionary(dict);
|
||||||
|
|
|
@ -42,7 +42,7 @@ bool pFlow::cylinderRegion::isInside
|
||||||
|
|
||||||
pFlow::realx3 pFlow::cylinderRegion::peek()const
|
pFlow::realx3 pFlow::cylinderRegion::peek()const
|
||||||
{
|
{
|
||||||
for(int32 i=0; i<100;i++)
|
for(int32 i=0; i<500;i++)
|
||||||
{
|
{
|
||||||
auto p =
|
auto p =
|
||||||
random_.randomNumber(cylinder_.minPoint(), cylinder_.maxPoint());
|
random_.randomNumber(cylinder_.minPoint(), cylinder_.maxPoint());
|
||||||
|
|
Loading…
Reference in New Issue