runtime dynamic link library and geometryPhasicFlow modification
This commit is contained in:
parent
eef3906a7e
commit
7fec15e3dc
|
@ -38,6 +38,7 @@ Timer/Timers.cpp
|
||||||
repository/Time/Time.cpp
|
repository/Time/Time.cpp
|
||||||
repository/Time/timeControl.cpp
|
repository/Time/timeControl.cpp
|
||||||
repository/systemControl/systemControl.cpp
|
repository/systemControl/systemControl.cpp
|
||||||
|
repository/systemControl/dynamicLinkLibs.cpp
|
||||||
repository/repository/repository.cpp
|
repository/repository/repository.cpp
|
||||||
repository/IOobject/objectFile.cpp
|
repository/IOobject/objectFile.cpp
|
||||||
repository/IOobject/IOobject.cpp
|
repository/IOobject/IOobject.cpp
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
#include "dynamicLinkLibs.hpp"
|
||||||
|
#include "List.hpp"
|
||||||
|
#include "streams.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
pFlow::dynamicLinkLibs::dynamicLinkLibs(
|
||||||
|
const dictionary &dict,
|
||||||
|
word libList)
|
||||||
|
{
|
||||||
|
|
||||||
|
wordList libNames;
|
||||||
|
if(dict.containsDataEntry(libList))
|
||||||
|
{
|
||||||
|
libNames = dict.getVal<wordList>(libList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
REPORT(1)<< "libs are "<< greenText(libNames)<<endREPORT;
|
||||||
|
|
||||||
|
for(auto libName:libNames)
|
||||||
|
{
|
||||||
|
auto* hndl = open(libName);
|
||||||
|
|
||||||
|
if(hndl)
|
||||||
|
{
|
||||||
|
libs_.insertIf(libName, hndl);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pFlow::dynamicLinkLibs::~dynamicLinkLibs()
|
||||||
|
{
|
||||||
|
for(auto &lib:libs_)
|
||||||
|
{
|
||||||
|
if( lib.second && dlclose(lib.second) != 0)
|
||||||
|
{
|
||||||
|
warningInFunction<< "could not close lib "<<lib.first<<endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void* pFlow::dynamicLinkLibs::open(word libName)
|
||||||
|
{
|
||||||
|
REPORT(2)<<"Loading "<< greenText(libName)<<endREPORT;
|
||||||
|
|
||||||
|
void* handle = dlopen(libName.c_str(), RTLD_LAZY|RTLD_GLOBAL);
|
||||||
|
|
||||||
|
if(!handle)
|
||||||
|
{
|
||||||
|
warningInFunction<< "could not open lib "<< libName<<endl;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return handle;
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*------------------------------- phasicFlow ---------------------------------
|
||||||
|
O C enter of
|
||||||
|
O O E ngineering and
|
||||||
|
O O M ultiscale modeling of
|
||||||
|
OOOOOOO F luid flow
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Copyright (C): www.cemf.ir
|
||||||
|
email: hamid.r.norouzi AT gmail.com
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Licence:
|
||||||
|
This file is part of phasicFlow code. It is a free software for simulating
|
||||||
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
||||||
|
the terms of GNU General Public License v3 or any other later versions.
|
||||||
|
|
||||||
|
phasicFlow is distributed to help others in their research in the field of
|
||||||
|
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef __dynamicLinkLibs_hpp__
|
||||||
|
#define __dynamicLinkLibs_hpp__
|
||||||
|
|
||||||
|
|
||||||
|
#include "hashMap.hpp"
|
||||||
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
|
namespace pFlow
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
class dynamicLinkLibs
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
wordHashMap<void*> libs_;
|
||||||
|
|
||||||
|
void* open(word libName);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
dynamicLinkLibs(const dictionary &dict, word libList = "libs");
|
||||||
|
|
||||||
|
~dynamicLinkLibs();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // pFlow
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __dynamicLinkLibs_hpp__
|
|
@ -135,6 +135,7 @@ pFlow::systemControl::systemControl
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
libs_(settingsDict_),
|
||||||
outFilePrecision_(
|
outFilePrecision_(
|
||||||
settingsDict_.getValOrSet("outFilePrecision", static_cast<size_t>(6))
|
settingsDict_.getValOrSet("outFilePrecision", static_cast<size_t>(6))
|
||||||
),
|
),
|
||||||
|
@ -205,6 +206,7 @@ pFlow::systemControl::systemControl(
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
libs_(settingsDict_),
|
||||||
Time_
|
Time_
|
||||||
(
|
(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -33,6 +33,7 @@ Licence:
|
||||||
#include "dictionary.hpp"
|
#include "dictionary.hpp"
|
||||||
#include "box.hpp"
|
#include "box.hpp"
|
||||||
#include "Timers.hpp"
|
#include "Timers.hpp"
|
||||||
|
#include "dynamicLinkLibs.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
{
|
{
|
||||||
|
@ -49,6 +50,8 @@ protected:
|
||||||
// - path to top-level folder
|
// - path to top-level folder
|
||||||
const fileSystem topLevelFolder_;
|
const fileSystem topLevelFolder_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// - settings folder repository
|
// - settings folder repository
|
||||||
repository settings_;
|
repository settings_;
|
||||||
|
|
||||||
|
@ -58,6 +61,9 @@ protected:
|
||||||
// - settingsDict fileDictionary
|
// - settingsDict fileDictionary
|
||||||
dictionary& settingsDict_;
|
dictionary& settingsDict_;
|
||||||
|
|
||||||
|
// - extra libs to be loaded
|
||||||
|
dynamicLinkLibs libs_;
|
||||||
|
|
||||||
// - precision for writing to file
|
// - precision for writing to file
|
||||||
size_t outFilePrecision_ = 6;
|
size_t outFilePrecision_ = 6;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
|
|
||||||
set(SourceFiles
|
set(SourceFiles
|
||||||
vtkFile.cpp
|
|
||||||
readFromTimeFolder.cpp
|
readFromTimeFolder.cpp
|
||||||
readControlDict.cpp
|
readControlDict.cpp
|
||||||
|
vtkFile/vtkFile.cpp
|
||||||
|
geometryPhasicFlow/Wall/Wall.cpp
|
||||||
|
geometryPhasicFlow/planeWall/planeWall.cpp
|
||||||
|
geometryPhasicFlow/stlWall/stlWall.cpp
|
||||||
|
geometryPhasicFlow/cylinderWall/cylinderWall.cpp
|
||||||
|
geometryPhasicFlow/cuboidWall/cuboidWall.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(link_libs Kokkos::kokkos phasicFlow Particles Geometry)
|
set(link_libs Kokkos::kokkos phasicFlow Particles Geometry)
|
||||||
|
|
|
@ -22,9 +22,9 @@ Licence:
|
||||||
#ifndef __Wall_hpp__
|
#ifndef __Wall_hpp__
|
||||||
#define __Wall_hpp__
|
#define __Wall_hpp__
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "virtualConstructor.hpp"
|
#include "virtualConstructor.hpp"
|
||||||
#include "Vectors.hpp"
|
|
||||||
#include "dictionary.hpp"
|
#include "dictionary.hpp"
|
||||||
|
|
||||||
namespace pFlow
|
namespace pFlow
|
||||||
|
@ -42,7 +42,7 @@ class Wall
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
realx3x3Vector triangles_;
|
std::vector<realx3x3> triangles_;
|
||||||
|
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public:
|
||||||
//// - Methods
|
//// - Methods
|
||||||
|
|
||||||
// -
|
// -
|
||||||
const realx3x3Vector& triangles()const
|
const auto& triangles()const
|
||||||
{
|
{
|
||||||
return triangles_;
|
return triangles_;
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
#include "cylinderWall.hpp"
|
#include "cylinderWall.hpp"
|
||||||
|
#include "Vectors.hpp"
|
||||||
#include "line.hpp"
|
#include "line.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
|
|
||||||
set(source_files
|
set(source_files
|
||||||
geometryPhasicFlow.cpp
|
geometryPhasicFlow.cpp
|
||||||
Wall/Wall.cpp
|
|
||||||
planeWall/planeWall.cpp
|
|
||||||
stlWall/stlWall.cpp
|
|
||||||
cylinderWall/cylinderWall.cpp
|
|
||||||
cuboidWall/cuboidWall.cpp
|
|
||||||
)
|
)
|
||||||
set(link_lib phasicFlow Geometry Kokkos::kokkos Utilities)
|
set(link_lib phasicFlow Geometry Kokkos::kokkos Utilities)
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ Licence:
|
||||||
|
|
||||||
#include "systemControl.hpp"
|
#include "systemControl.hpp"
|
||||||
#include "Wall.hpp"
|
#include "Wall.hpp"
|
||||||
|
#include "Vectors.hpp"
|
||||||
#include "multiTriSurface.hpp"
|
#include "multiTriSurface.hpp"
|
||||||
#include "geometryMotion.hpp"
|
#include "geometryMotion.hpp"
|
||||||
#include "commandLine.hpp"
|
#include "commandLine.hpp"
|
||||||
|
@ -34,6 +35,7 @@ using pFlow::objectFile;
|
||||||
using pFlow::wordVector;
|
using pFlow::wordVector;
|
||||||
using pFlow::Wall;
|
using pFlow::Wall;
|
||||||
using pFlow::geometry;
|
using pFlow::geometry;
|
||||||
|
using pFlow::realx3x3Vector;
|
||||||
using pFlow::multiTriSurface;
|
using pFlow::multiTriSurface;
|
||||||
using pFlow::commandLine;
|
using pFlow::commandLine;
|
||||||
|
|
||||||
|
@ -92,7 +94,9 @@ int main( int argc, char* argv[] )
|
||||||
auto& wall = wallPtr();
|
auto& wall = wallPtr();
|
||||||
REPORT(1)<<"wall type is "<<greenText(wall.typeName())<<'\n'<<endREPORT;
|
REPORT(1)<<"wall type is "<<greenText(wall.typeName())<<'\n'<<endREPORT;
|
||||||
|
|
||||||
surface.addTriSurface(wall.name(), wall.triangles());
|
realx3x3Vector trinalges(wall.name());
|
||||||
|
trinalges = wall.triangles();
|
||||||
|
surface.addTriSurface(wall.name(), trinalges);
|
||||||
materials.push_back(wall.materialName());
|
materials.push_back(wall.materialName());
|
||||||
motion.push_back(wall.motionName());
|
motion.push_back(wall.motionName());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue