Moved serial mode to target mcelecron_serial.
Implemented parallelization with mpi.
This commit is contained in:
@@ -76,7 +76,7 @@ protected:
|
||||
private:
|
||||
template <typename T_target> void rec_getSubMap(T_target *subMap, T_target **targetMapPtr, std::deque<double> Points, searchStyle searchMode) ;
|
||||
template <typename T_target, typename T> void rec_getSubMap(T *subMap, T_target **targetMapPtr, std::deque<double> Points, searchStyle searchMode) ;
|
||||
template <class T> typename T::iterator searchItrByStyle(T *subMap, double x, searchStyle searchMode) ;
|
||||
template <class T> typename T::iterator searchitrByStyle(T *subMap, double x, searchStyle searchMode) ;
|
||||
|
||||
protected:
|
||||
void checkEmpty() ;
|
||||
@@ -155,8 +155,8 @@ void Base_Container<T_Map>::addPoint(std::deque<double> pointIn) {
|
||||
if (pointIn.size() != Dim+1) {
|
||||
std::stringstream ss;
|
||||
ss<<"Base_Container::addPoint: deque pointIn dimension missmatch.\n";
|
||||
for (std::deque<double>::iterator Itr = pointIn.begin(); Itr!=pointIn.end(); Itr++) {
|
||||
std::cout<<*Itr<<"\n";
|
||||
for (std::deque<double>::iterator itr = pointIn.begin(); itr!=pointIn.end(); itr++) {
|
||||
std::cout<<*itr<<"\n";
|
||||
}
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
@@ -222,8 +222,8 @@ std::string Base_Container<T_Map>::getExportFileHeader() {
|
||||
|
||||
template <class T_Map>
|
||||
void Base_Container<T_Map>::rec_exportToCSV(const dim1Map &subMap, std::ofstream &exportStream, std::string preset) {
|
||||
for (dim1Map::const_iterator Itr = subMap.cbegin();Itr!=subMap.cend();Itr++) {
|
||||
exportStream<<preset<<Itr->first<<"\t"<<Itr->second<<"\n";
|
||||
for (dim1Map::const_iterator itr = subMap.cbegin();itr!=subMap.cend();itr++) {
|
||||
exportStream<<preset<<itr->first<<"\t"<<itr->second<<"\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,11 +231,11 @@ template <class T_Map>
|
||||
template <typename T>
|
||||
void Base_Container<T_Map>::rec_exportToCSV(const T &subMap, std::ofstream &exportStream, std::string preset) {
|
||||
std::stringstream ss;
|
||||
for (typename T::const_iterator Itr = subMap.cbegin();Itr!=subMap.cend();Itr++) {
|
||||
for (typename T::const_iterator itr = subMap.cbegin();itr!=subMap.cend();itr++) {
|
||||
ss.clear();
|
||||
ss.str("");
|
||||
ss<<preset<<Itr->first<<"\t";
|
||||
rec_exportToCSV(Itr->second, exportStream, ss.str());
|
||||
ss<<preset<<itr->first<<"\t";
|
||||
rec_exportToCSV(itr->second, exportStream, ss.str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,8 +245,8 @@ double Base_Container<T_Map>::get_value(std::deque<double> Points, searchStyle s
|
||||
double x = Points.back();
|
||||
Points.pop_back();
|
||||
dim1Map *subMap = getSubMap<dim1Map>(Points, searchMode);
|
||||
dim1Map::const_iterator Itr = searchItrByStyle(subMap, x, searchMode);
|
||||
return Itr->second;
|
||||
dim1Map::const_iterator itr = searchitrByStyle(subMap, x, searchMode);
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
template <class T_Map>
|
||||
@@ -269,7 +269,7 @@ template <typename T_target>
|
||||
void Base_Container<T_Map>::rec_getSubMap(T_target *subMap, T_target **targetMapPtr, std::deque<double> Points, searchStyle searchMode) {
|
||||
if (Points.size() != 0) {
|
||||
std::stringstream ss;
|
||||
ss<<"Base_Container::get_subItr: Dimension Missmatch of Points\n";
|
||||
ss<<"Base_Container::get_subitr: Dimension Missmatch of Points\n";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
*targetMapPtr = subMap;
|
||||
@@ -280,30 +280,30 @@ template <typename T_target, typename T>
|
||||
void Base_Container<T_Map>::rec_getSubMap(T *subMap, T_target **targetMapPtr, std::deque<double> Points, searchStyle searchMode) {
|
||||
double x = Points.front();
|
||||
Points.pop_front();
|
||||
typename T::iterator Itr = searchItrByStyle(subMap, x, searchMode);
|
||||
rec_getSubMap(&(Itr->second), targetMapPtr, Points, searchMode);
|
||||
typename T::iterator itr = searchitrByStyle(subMap, x, searchMode);
|
||||
rec_getSubMap(&(itr->second), targetMapPtr, Points, searchMode);
|
||||
}
|
||||
|
||||
template <class T_Map>
|
||||
template <class T>
|
||||
typename T::iterator Base_Container<T_Map>::searchItrByStyle(T *subMap, double x, searchStyle searchMode) {
|
||||
typename T::iterator Itr;
|
||||
typename T::iterator Base_Container<T_Map>::searchitrByStyle(T *subMap, double x, searchStyle searchMode) {
|
||||
typename T::iterator itr;
|
||||
if (searchMode == Find) {
|
||||
Itr = subMap->find(x);
|
||||
itr = subMap->find(x);
|
||||
} else if (searchMode == Lower_bound) {
|
||||
Itr = subMap->lower_bound(x);
|
||||
itr = subMap->lower_bound(x);
|
||||
} else if (searchMode == Lower_bound_Over) {
|
||||
Itr = subMap->lower_bound(x);
|
||||
if (Itr == subMap->end()) {
|
||||
--Itr;
|
||||
itr = subMap->lower_bound(x);
|
||||
if (itr == subMap->end()) {
|
||||
--itr;
|
||||
}
|
||||
}
|
||||
if (Itr == subMap->end()) {
|
||||
if (itr == subMap->end()) {
|
||||
std::stringstream ss;
|
||||
ss<<"Base_Container::calcItr: Point is out of bound.\n";
|
||||
ss<<"Base_Container::calcitr: Point is out of bound.\n";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
return Itr;
|
||||
return itr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user