Commit 90357cd5 authored by Thomas Witkowski's avatar Thomas Witkowski

Added flags for compiling with Intel C++ compiler. Fixed some real compiler warnings.

parent 27235c55
......@@ -31,7 +31,11 @@ if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release")
endif()
#option(ENABLE_INTEL "use intel compiler" false)
if(CMAKE_CXX_COMPILER MATCHES ".*icpc")
Message("Compiler: Intel")
set(CMAKE_CXX_FLAGS "-diag-disable 654 -diag-disable 858")
endif()
SET(ENABLE_PARALLEL_DOMAIN "OFF" CACHE STRING "use parallel domain decomposition. please set to one of: PMTL, PETSC, OFF" )
option(USE_PETSC_DEV false)
option(ENABLE_ZOLTAN false)
......@@ -39,15 +43,6 @@ option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
option(ENABLE_PNG "use png reader/writer" false)
option(ENABLE_BDDCML "Use of BDDCML library" false)
if(ENABLE_INTEL)
Message("please set the icc manually")
INCLUDE (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(icc "intel C compiler")
CMAKE_FORCE_CXX_COMPILER(icpc "intel C++ compiler")
#SET(CMAKE_C_COMPILER "icc")
endif(ENABLE_INTEL)
find_package(Boost 1.42 REQUIRED)
if(Boost_FOUND)
list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
......
......@@ -262,12 +262,14 @@ namespace AMDiS {
inserter= 0;
}
#if 0
/// Returns whether restriction should be performed after coarsening
/// (false by default)
virtual bool coarseRestrict()
{
return false;
}
#endif
/// Returns const \ref rowFeSpace
const FiniteElemSpace* getRowFeSpace() const
......
......@@ -93,7 +93,8 @@ namespace AMDiS {
}
/// Implementation of ProblemTimeInterface::closeTimestep().
virtual void closeTimestep() {}
virtual void closeTimestep(AdaptInfo *adaptInfo)
{}
/// Returns \ref name.
inline std::string getName()
......
......@@ -35,7 +35,7 @@ namespace AMDiS {
}
void ProblemInterpol::solve(AdaptInfo *adaptInfo)
void ProblemInterpol::solve(AdaptInfo *adaptInfo, bool, bool)
{
int size = static_cast<int>(meshes.size());
for (int i = 0; i < size; i++)
......@@ -45,7 +45,7 @@ namespace AMDiS {
}
void ProblemInterpol::estimate(AdaptInfo *adaptInfo, double)
void ProblemInterpol::estimate(AdaptInfo *adaptInfo)
{
FUNCNAME("ProblemIterpolVec::estimate()");
......
......@@ -50,13 +50,18 @@ namespace AMDiS {
virtual void buildbeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}
/// No system assemblage.
virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) {}
virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag,
bool assembleMatrix = true,
bool assembleVector = true)
{}
/// No equation system ins solved. Instead fct is interpolated to uh.
virtual void solve(AdaptInfo *adaptInfo);
virtual void solve(AdaptInfo *adaptInfo,
bool createMatrixData = true,
bool storeMatrixData = false);
/// True H1 or L2 error is calculated.
virtual void estimate(AdaptInfo *adaptInfo, double);
virtual void estimate(AdaptInfo *adaptInfo);
protected:
/// Function to interpolate.
......
......@@ -31,7 +31,9 @@ namespace AMDiS {
filename = fn;
}
void GNUPlotWriter::writeFiles(AdaptInfo *adaptInfo, bool force)
void GNUPlotWriter::writeFiles(AdaptInfo *adaptInfo, bool force,
int, Flag, bool (*)(ElInfo*))
{
DOFVector<WorldVector<double> > coords(feSpace_, "coords");
Mesh *mesh = feSpace_->getMesh();
......
......@@ -43,7 +43,10 @@ namespace AMDiS {
virtual ~GNUPlotWriter() {}
///
virtual void writeFiles(AdaptInfo *adaptInfo, bool force);
virtual void writeFiles(AdaptInfo *adaptInfo, bool force,
int level = -1,
Flag traverseFlag = Mesh::CALL_LEAF_EL,
bool (*writeElem)(ElInfo*) = NULL);
protected:
/// Contains the mesh
......
......@@ -19,7 +19,7 @@
namespace AMDiS {
void ProblemNonLin::initialize(Flag initFlag,
ProblemStat *adoptProblem /*= NULL*/,
ProblemStatSeq *adoptProblem /*= NULL*/,
Flag adoptFlag /*= INIT_NOTHING*/)
{
FUNCNAME("ProblemNonLin::initialize()");
......
......@@ -77,7 +77,7 @@ namespace AMDiS {
/// Initialization of the problem.
virtual void initialize(Flag initFlag,
ProblemStat *adoptProblem = NULL,
ProblemStatSeq *adoptProblem = NULL,
Flag adoptFlag = INIT_NOTHING);
/// Used in \ref initialize().
......
......@@ -969,7 +969,7 @@ namespace AMDiS {
// (static_cast<double>(maxDofs - avrgDofs) / avrgDofs) * 100.0;
double imbalance1 = (static_cast<double>(maxDofs) / minDofs - 1.0) * 100.0;
MSG("Imbalancing factor: %.1f\%\n", imbalance1);
MSG("Imbalancing factor: %.1f\n", imbalance1);
}
}
......@@ -2264,7 +2264,7 @@ namespace AMDiS {
{
FUNCNAME("MeshDistributor::mapGlobalToLocal()");
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dofMap[feSpace].getMap().begin();
for (DofMap::iterator it = dofMap[feSpace].getMap().begin();
it != dofMap[feSpace].getMap().end(); ++it)
if (it->second.global == dof)
return it->first;
......
......@@ -225,6 +225,12 @@ namespace AMDiS {
return dofMap[feSpace][dof].local;
}
/// Returns the DOF mapping object, \ref dofMap.
inline ParallelDofMapping& getDofMap()
{
return dofMap;
}
/// Returns the periodic mapping handler, \ref periodicMap.
inline PeriodicMap& getPeriodicMap()
{
......@@ -555,6 +561,7 @@ namespace AMDiS {
/// macro element.
map<int, int> partitionMap;
/// Mapping object to map from local DOF indices to global ones.
ParallelDofMapping dofMap;
/// Database to store and query all sub-objects of all elements of the
......
......@@ -107,11 +107,7 @@ namespace AMDiS {
boxPartitioning = b;
}
#if 0
void setLocalGlobalDofMap(map<DegreeOfFreedom, DegreeOfFreedom> *m)
#else
void setLocalGlobalDofMap(map<DegreeOfFreedom, MultiIndex> *m)
#endif
void setLocalGlobalDofMap(DofMap *m)
{
mapLocalGlobal = m;
}
......@@ -173,7 +169,7 @@ namespace AMDiS {
/// macro element index the box number it belongs to.
map<int, int> elInBox;
map<DegreeOfFreedom, MultiIndex> *mapLocalGlobal;
DofMap *mapLocalGlobal;
map<int, vector<int> > elNeighbours;
......
......@@ -29,7 +29,7 @@ namespace AMDiS {
ParMetisMesh::ParMetisMesh(Mesh *mesh, MPI::Intracomm *comm,
std::map<int, bool>& elementInRank,
map<DegreeOfFreedom, MultiIndex> *mapLocalGlobal)
DofMap *mapLocalGlobal)
: dim(mesh->getDim()),
nElements(0),
mpiComm(comm)
......
......@@ -44,7 +44,7 @@ namespace AMDiS {
public:
ParMetisMesh(Mesh *mesh, MPI::Intracomm *comm,
map<int, bool>& elementInRank,
map<DegreeOfFreedom, MultiIndex> *mapLocalGlobal);
DofMap *mapLocalGlobal);
~ParMetisMesh();
......
......@@ -640,20 +640,21 @@ namespace AMDiS {
cout << "====== DOF MAP LOCAL -> GLOBAL ====== " << endl;
map<DegreeOfFreedom, MultiIndex> &dofMap = pdb.dofMap[feSpace].getMap();
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dofMap.begin();
it != dofMap.end(); ++it) {
DofMap &dofMap = pdb.dofMap[feSpace].getMap();
for (DofMap::iterator it = dofMap.begin(); it != dofMap.end(); ++it) {
cout << "DOF " << it->first << " " << it->second.global << "\n";
WorldVector<double> coords;
pdb.mesh->getDofIndexCoords(it->first, feSpace, coords);
coords.print();
for (DofComm::Iterator rit(pdb.sendDofs, feSpace); !rit.end(); rit.nextRank())
for (DofComm::Iterator rit(pdb.sendDofs, feSpace);
!rit.end(); rit.nextRank())
for (; !rit.endDofIter(); rit.nextDof())
if (it->first == rit.getDofIndex())
cout << "SEND DOF TO " << rit.getRank() << endl;
for (DofComm::Iterator rit(pdb.recvDofs, feSpace); !rit.end(); rit.nextRank())
for (DofComm::Iterator rit(pdb.recvDofs, feSpace);
!rit.end(); rit.nextRank())
for (; !rit.endDofIter(); rit.nextDof())
if (it->first == rit.getDofIndex())
cout << "RECV DOF FROM " << rit.getRank() << endl;
......
......@@ -32,7 +32,7 @@ namespace AMDiS {
{
// === Compute local indices for all rank owned DOFs. ===
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dofMap.begin(); it != dofMap.end(); ++it)
for (DofMap::iterator it = dofMap.begin(); it != dofMap.end(); ++it)
if (it->second.local == -1 && nonRankDofs.count(it->first) == 0)
it->second.local = nRankDofs++;
......@@ -55,7 +55,7 @@ namespace AMDiS {
void FeSpaceDofMap::computeGlobalMapping()
{
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dofMap.begin(); it != dofMap.end(); ++it)
for (DofMap::iterator it = dofMap.begin(); it != dofMap.end(); ++it)
it->second.global = it->second.local + rStartDofs;
}
......@@ -255,6 +255,21 @@ namespace AMDiS {
computeMatIndex();
}
void ParallelDofMapping::update(vector<const FiniteElemSpace*>& fe)
{
FUNCNAME("ParallelDofMapping::update()");
for (vector<const FiniteElemSpace*>::iterator it = fe.begin();
it != fe.end(); ++it)
if (find(feSpacesUnique.begin(), feSpacesUnique.end(), *it) ==
feSpacesUnique.end())
ERROR_EXIT("Wrong FE space!\n");
feSpaces = fe;
update();
}
void ParallelDofMapping::computeMatIndex()
{
......@@ -274,9 +289,8 @@ namespace AMDiS {
// Traverse all DOFs of the FE space and create for all rank owned DOFs
// a matrix index.
map<DegreeOfFreedom, MultiIndex>& dofMap = data[feSpaces[i]].getMap();
typedef map<DegreeOfFreedom, MultiIndex>::iterator ItType;
for (ItType it = dofMap.begin(); it != dofMap.end(); ++it) {
DofMap& dofMap = data[feSpaces[i]].getMap();
for (DofMap::iterator it = dofMap.begin(); it != dofMap.end(); ++it) {
if (data[feSpaces[i]].isRankDof(it->first)) {
int globalMatIndex = it->second.local + offset;
dofToMatIndex.add(i, it->first, globalMatIndex);
......
......@@ -35,14 +35,6 @@ namespace AMDiS {
using namespace std;
/// Is used if a DOF index is mapped to multiple indices, i.e., to both, a local
/// and a global one.
struct MultiIndex
{
int local, global;
};
/** \brief
* Is used to store matrix indices to all DOFs in rank's subdomain. Thus, the
* class defines a mapping from component number and DOF index to a global
......@@ -183,7 +175,7 @@ namespace AMDiS {
}
/// Returns the raw data of the mapping.
map<DegreeOfFreedom, MultiIndex>& getMap()
DofMap& getMap()
{
return dofMap;
}
......@@ -237,7 +229,7 @@ namespace AMDiS {
const FiniteElemSpace *feSpace;
/// Mapping data from DOF indices to local and global indices.
map<DegreeOfFreedom, MultiIndex> dofMap;
DofMap dofMap;
/// Set of all DOFs that are in mapping but are not owned by the rank.
std::set<DegreeOfFreedom> nonRankDofs;
......@@ -348,6 +340,9 @@ namespace AMDiS {
/// Update the mapping.
void update();
/// Update the mapping.
void update(vector<const FiniteElemSpace*>& feSpaces);
/// Returns the global matrix index of a given DOF for a given
/// component number.
inline int getMatIndex(int ithComponent, DegreeOfFreedom d)
......
......@@ -70,7 +70,15 @@ namespace AMDiS {
/// need to have a periodic DOF mapping for each FE space.
typedef std::map<const FiniteElemSpace*, PeriodicDofMap> PeriodicDofMapFeSpace;
/// Is used if a DOF index is mapped to multiple indices, i.e., to both, a local
/// and a global one.
struct MultiIndex
{
int local, global;
};
typedef std::map<DegreeOfFreedom, MultiIndex> DofMap;
typedef vector<MeshStructure> MeshCodeVec;
}
......
......@@ -20,6 +20,7 @@ namespace AMDiS {
PetscSolver::PetscSolver()
: meshDistributor(NULL),
dofMap(NULL),
mpiRank(-1),
kspPrefix(""),
removeRhsNullSpace(false)
......
......@@ -53,6 +53,7 @@ namespace AMDiS {
void setMeshDistributor(MeshDistributor *m)
{
meshDistributor = m;
dofMap = &(meshDistributor->getDofMap());
mpiRank = meshDistributor->getMpiRank();
mpiComm = meshDistributor->getMpiComm();
mpiSelfComm = PETSC_COMM_SELF;
......@@ -138,7 +139,9 @@ namespace AMDiS {
protected:
MeshDistributor *meshDistributor;
ParallelDofMapping *dofMap;
int mpiRank;
MPI::Intracomm mpiComm;
......
......@@ -420,8 +420,8 @@ namespace AMDiS {
// === appropriate number of Lagrange constraints. ===
int nRankLagrange = 0;
map<DegreeOfFreedom, MultiIndex>& dualMap = dualDofMap[feSpace].getMap();
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dualMap.begin(); it != dualMap.end(); ++it) {
DofMap& dualMap = dualDofMap[feSpace].getMap();
for (DofMap::iterator it = dualMap.begin(); it != dualMap.end(); ++it) {
if (meshDistributor->getIsRankDof(feSpace, it->first)) {
lagrangeMap[feSpace].insertRankDof(it->first, nRankLagrange);
int degree = boundaryDofRanks[feSpace][it->first].size();
......@@ -460,7 +460,7 @@ namespace AMDiS {
// === And finally, add the global indicies of all dual nodes. ===
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dualDofMap[feSpace].getMap().begin();
for (DofMap::iterator it = dualDofMap[feSpace].getMap().begin();
it != dualDofMap[feSpace].getMap().end(); ++it)
localDofMap[feSpace].insertRankDof(it->first);
}
......@@ -486,11 +486,9 @@ namespace AMDiS {
// === constraint. ===
for (unsigned int k = 0; k < feSpaces.size(); k++) {
map<DegreeOfFreedom, MultiIndex> &dualMap =
dualDofMap[feSpaces[k]].getMap();
DofMap &dualMap = dualDofMap[feSpaces[k]].getMap();
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dualMap.begin();
it != dualMap.end(); ++it) {
for (DofMap::iterator it = dualMap.begin(); it != dualMap.end(); ++it) {
TEST_EXIT_DBG(boundaryDofRanks[feSpaces[k]].count(it->first))
("Should not happen!\n");
......@@ -735,10 +733,8 @@ namespace AMDiS {
&(fetiDirichletPreconData.tmp_vec_interior));
for (unsigned int i = 0; i < feSpaces.size(); i++) {
map<DegreeOfFreedom, MultiIndex> &dualMap =
dualDofMap[feSpaces[i]].getMap();
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dualMap.begin();
it != dualMap.end(); ++it) {
DofMap &dualMap = dualDofMap[feSpaces[i]].getMap();
for (DofMap::iterator it = dualMap.begin(); it != dualMap.end(); ++it) {
DegreeOfFreedom d = it->first;
int matIndexLocal = localDofMap.getLocalMatIndex(i, d);
int matIndexDual = dualDofMap.getLocalMatIndex(i, d);
......@@ -758,10 +754,8 @@ namespace AMDiS {
fetiLumpedPreconData.mat_duals_duals = &mat_duals_duals;
for (unsigned int i = 0; i < feSpaces.size(); i++) {
map<DegreeOfFreedom, MultiIndex> &dualMap =
dualDofMap[feSpaces[i]].getMap();
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dualMap.begin();
it != dualMap.end(); ++it) {
DofMap &dualMap = dualDofMap[feSpaces[i]].getMap();
for (DofMap::iterator it = dualMap.begin(); it != dualMap.end(); ++it) {
DegreeOfFreedom d = it->first;
int matIndexLocal = localDofMap.getLocalMatIndex(i, d);
int matIndexDual = dualDofMap.getLocalMatIndex(i, d);
......@@ -865,10 +859,8 @@ namespace AMDiS {
{
int cnt = 0;
for (unsigned int i = 0; i < feSpaces.size(); i++) {
map<DegreeOfFreedom, MultiIndex>& dofMap =
primalDofMap[feSpaces[i]].getMap();
for (map<DegreeOfFreedom, MultiIndex>::iterator it = dofMap.begin();
it != dofMap.end(); ++it) {
DofMap& dofMap = primalDofMap[feSpaces[i]].getMap();
for (DofMap::iterator it = dofMap.begin();it != dofMap.end(); ++it) {
globalIsIndex.push_back(primalDofMap.getMatIndex(i, it->first));
localIsIndex.push_back(cnt++);
}
......@@ -913,13 +905,13 @@ namespace AMDiS {
for (int i = 0; i < vec.getSize(); i++) {
DOFVector<double>& dofVec = *(vec.getDOFVector(i));
for (map<DegreeOfFreedom, MultiIndex>::iterator it = localDofMap[feSpaces[i]].getMap().begin();
for (DofMap::iterator it = localDofMap[feSpaces[i]].getMap().begin();
it != localDofMap[feSpaces[i]].getMap().end(); ++it) {
int petscIndex = localDofMap.getLocalMatIndex(i, it->first);
dofVec[it->first] = localSolB[petscIndex];
}
for (map<DegreeOfFreedom, MultiIndex>::iterator it = primalDofMap[feSpaces[i]].getMap().begin();
for (DofMap::iterator it = primalDofMap[feSpaces[i]].getMap().begin();
it != primalDofMap[feSpaces[i]].getMap().end(); ++it)
dofVec[it->first] = localSolPrimal[cnt++];
}
......
......@@ -22,6 +22,7 @@ namespace AMDiS {
FUNCNAME("PetscSolverGlobalMatrix::fillPetscMatrix()");
TEST_EXIT_DBG(meshDistributor)("No mesh distributor object defined!\n");
TEST_EXIT_DBG(dofMap)("No parallel mapping object defined!\n");
TEST_EXIT_DBG(mat)("No DOF matrix defined!\n");
double wtime = MPI::Wtime();
......
......@@ -118,7 +118,7 @@ namespace AMDiS {
bool rejected = false;
double timeTol = adaptInfo->getTimeTolerance(0);
size_t studyTimestep = -1;
int studyTimestep = -1;
do {
if (dbgTimestepStudy) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment