Merge branch 'develop' into MPI
This commit is contained in:
commit
1321e6340e
|
@ -28,7 +28,7 @@ Licence:
|
|||
#include "span.hpp"
|
||||
#include "iOstream.hpp"
|
||||
#include "iIstream.hpp"
|
||||
#include "createDataIO.hpp"
|
||||
#include "dataIO.hpp"
|
||||
#include "pFlowProcessors.hpp"
|
||||
|
||||
namespace pFlow
|
||||
|
@ -82,8 +82,8 @@ bool writeSpan(
|
|||
const IOPattern& iop)
|
||||
{
|
||||
|
||||
auto ioPtr = createDataIO<T>(pFlowProcessors().localRunTypeName(), iop);
|
||||
|
||||
auto ioPtr = dataIO<T>::create(iop);
|
||||
|
||||
if(!ioPtr)
|
||||
{
|
||||
fatalErrorInFunction;
|
||||
|
@ -141,8 +141,8 @@ bool readStdVector
|
|||
const IOPattern& iop
|
||||
)
|
||||
{
|
||||
auto ioPtr = createDataIO<T>(pFlowProcessors().localRunTypeName(), iop);
|
||||
|
||||
auto ioPtr = dataIO<T>::create(iop);
|
||||
|
||||
if(!ioPtr)
|
||||
{
|
||||
fatalErrorInFunction;
|
||||
|
|
|
@ -258,3 +258,32 @@ bool pFlow::dataIO<T>::readData
|
|||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
pFlow::uniquePtr<pFlow::dataIO<T>>
|
||||
pFlow::dataIO<T>::create(const IOPattern& iop)
|
||||
{
|
||||
|
||||
word dataIOType = angleBracketsNames2(
|
||||
"dataIO",
|
||||
getTypeName<T>(),
|
||||
pFlowProcessors().localRunTypeName());
|
||||
|
||||
if(IOPatternvCtorSelector_.search(dataIOType))
|
||||
{
|
||||
return IOPatternvCtorSelector_[dataIOType](iop);
|
||||
}
|
||||
else
|
||||
{
|
||||
printKeys
|
||||
(
|
||||
fatalError << "Ctor Selector "<< dataIOType << " does not exist. \n"
|
||||
<<"Avaiable ones are: \n\n"
|
||||
,
|
||||
IOPatternvCtorSelector_
|
||||
);
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -28,6 +28,8 @@ Licence:
|
|||
#include "IOPattern.hpp"
|
||||
#include "iOstream.hpp"
|
||||
#include "iIstream.hpp"
|
||||
#include "virtualConstructor.hpp"
|
||||
#include "pFlowProcessors.hpp"
|
||||
|
||||
|
||||
|
||||
|
@ -98,6 +100,14 @@ public:
|
|||
|
||||
virtual ~dataIO() = default;
|
||||
|
||||
create_vCtor
|
||||
(
|
||||
dataIO,
|
||||
IOPattern,
|
||||
(const IOPattern& iop),
|
||||
(iop)
|
||||
);
|
||||
|
||||
/// Write data to the end of file from all processors.
|
||||
/// This method should be called from all processors.
|
||||
bool writeData(iOstream& os, span<T> data);
|
||||
|
@ -106,6 +116,9 @@ public:
|
|||
iIstream& is,
|
||||
std::vector<T>& data);
|
||||
|
||||
static
|
||||
uniquePtr<dataIO> create(const IOPattern& iop);
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -123,6 +136,6 @@ iOstream& operator<<(iOstream& os, const span<T>& s)
|
|||
|
||||
}
|
||||
|
||||
#include "dataIOTemplate.cpp"
|
||||
#include "dataIO.cpp"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,12 @@ class dataIORegular
|
|||
:
|
||||
public dataIO<T>
|
||||
{
|
||||
public:
|
||||
|
||||
using DataIORegularType = dataIORegular<T>;
|
||||
|
||||
using DataIOType = dataIO<T>;
|
||||
|
||||
protected:
|
||||
|
||||
bool gatherData(span<T> data ) override
|
||||
|
@ -41,7 +47,7 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
TypeInfo("dataIO<regular>");
|
||||
TypeInfoTemplate111("dataIO",T,"regular");
|
||||
|
||||
dataIORegular(const IOPattern& iop)
|
||||
:
|
||||
|
@ -57,6 +63,13 @@ public:
|
|||
dataIORegular& operator=(dataIORegular&&) = default;
|
||||
|
||||
~dataIORegular() = default;
|
||||
|
||||
add_vCtor
|
||||
(
|
||||
DataIOType,
|
||||
DataIORegularType,
|
||||
IOPattern
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
|
||||
#include "types.hpp"
|
||||
#include "dataIO.hpp"
|
||||
#include "dataIORegular.hpp"
|
||||
|
||||
template class pFlow::dataIO<pFlow::uint8>;
|
||||
template class pFlow::dataIORegular<pFlow::uint8>;
|
||||
|
||||
template class pFlow::dataIO<pFlow::int8>;
|
||||
template class pFlow::dataIORegular<pFlow::int8>;
|
||||
|
||||
template class pFlow::dataIO<pFlow::int32>;
|
||||
template class pFlow::dataIORegular<pFlow::int32>;
|
||||
|
||||
template class pFlow::dataIO<pFlow::int64>;
|
||||
template class pFlow::dataIORegular<pFlow::int64>;
|
||||
|
||||
template class pFlow::dataIO<pFlow::uint32>;
|
||||
template class pFlow::dataIORegular<pFlow::uint32>;
|
||||
|
||||
template class pFlow::dataIO<pFlow::uint64>;
|
||||
template class pFlow::dataIORegular<pFlow::uint64>;
|
||||
|
||||
template class pFlow::dataIO<pFlow::real>;
|
||||
template class pFlow::dataIORegular<pFlow::real>;
|
||||
|
||||
template class pFlow::dataIO<pFlow::realx3>;
|
||||
template class pFlow::dataIORegular<pFlow::realx3>;
|
||||
|
||||
template class pFlow::dataIO<pFlow::realx4>;
|
||||
template class pFlow::dataIORegular<pFlow::realx4>;
|
||||
|
||||
template class pFlow::dataIO<pFlow::word>;
|
||||
template class pFlow::dataIORegular<pFlow::word>;
|
||||
|
||||
/*template class pFlow::dataIO<char>;
|
||||
template class pFlow::dataIORegular<char>;*/
|
Loading…
Reference in New Issue