Commit 92f4f15b authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

[mpfa] simplify switch statements

Avoid duplicate code by using multiple case markers. For the adaptive
model, there is no need to treat SGrid and YaspGrid.

Reviewed by Martin S.



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@13463 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent ff914487
......@@ -552,30 +552,12 @@ void FvMpfaL2dPressure2p<TypeTag>::initializeMatrix()
// get 'nextIsIt'
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
// for SGrid and YaspGrid
case GridTypeIndices::sGrid:
{
if (nextIsIt == isEndIt)
nextIsIt = isItBegin;
else
{
nextIsIt = ++tempisIt;
if (nextIsIt == isEndIt)
{
nextIsIt = ++tempisItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (nextIsIt == isEndIt)
{
nextIsIt = isItBegin;
}
else
{
nextIsIt = ++tempisIt;
......@@ -588,15 +570,8 @@ void FvMpfaL2dPressure2p<TypeTag>::initializeMatrix()
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (nextIsIt == isEndIt)
nextIsIt = isItBegin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (nextIsIt == isEndIt)
......@@ -674,26 +649,8 @@ void FvMpfaL2dPressure2p<TypeTag>::initializeMatrix()
// get 'nextIsIt'
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
// for SGrid and YaspGrid
case GridTypeIndices::sGrid:
{
if (nextIsIt == isEndIt)
{
nextIsIt = isItBegin;
}
else
{
nextIsIt = ++tempisIt;
if (nextIsIt == isEndIt)
{
nextIsIt = ++tempisItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (nextIsIt == isEndIt)
......@@ -712,15 +669,8 @@ void FvMpfaL2dPressure2p<TypeTag>::initializeMatrix()
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (nextIsIt == isEndIt)
nextIsIt = isItBegin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (nextIsIt == isEndIt)
......@@ -829,26 +779,8 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
//get isIt14
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
// for SGrid and YaspGrid
case GridTypeIndices::sGrid:
{
if (isIt14 == isIt12End)
{
isIt14 = isIt12Begin;
}
else
{
isIt14 = ++tempIsIt;
if (isIt14 == isIt12End)
{
isIt14 = ++tempIsItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (isIt14 == isIt12End)
......@@ -867,15 +799,8 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (isIt14 == isIt12End)
isIt14 = isIt12Begin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (isIt14 == isIt12End)
......
......@@ -578,51 +578,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::initializeMatrix()
// get 'nextIsIt'
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
case GridTypeIndices::sGrid:
{
if (nextIsIt == isEndIt)
nextIsIt = isItBegin;
else
{
nextIsIt = ++tempisIt;
if (nextIsIt == isEndIt)
{
nextIsIt = ++tempisItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (nextIsIt == isEndIt)
{
nextIsIt = isItBegin;
}
else
{
nextIsIt = ++tempisIt;
if (nextIsIt == isEndIt)
{
nextIsIt = ++tempisItBegin;
}
}
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (nextIsIt == isEndIt)
nextIsIt = isItBegin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (nextIsIt == isEndIt)
......@@ -632,7 +589,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::initializeMatrix()
}
default:
{
DUNE_THROW(Dune::NotImplemented, "GridType can not be used with MPFAO implementation!");
DUNE_THROW(Dune::NotImplemented,
"GridType cannot be used with adaptive MPFAL!");
break;
}
}
......@@ -734,53 +692,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::initializeMatrix()
// get 'nextIsIt'
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
case GridTypeIndices::sGrid:
{
if (nextIsIt == isEndIt)
{
nextIsIt = isItBegin;
}
else
{
nextIsIt = ++tempisIt;
if (nextIsIt == isEndIt)
{
nextIsIt = ++tempisItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (nextIsIt == isEndIt)
{
nextIsIt = isItBegin;
}
else
{
nextIsIt = ++tempisIt;
if (nextIsIt == isEndIt)
{
nextIsIt = ++tempisItBegin;
}
}
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (nextIsIt == isEndIt)
nextIsIt = isItBegin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (nextIsIt == isEndIt)
......@@ -790,7 +703,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::initializeMatrix()
}
default:
{
DUNE_THROW(Dune::NotImplemented, "GridType can not be used with MPFAO implementation!");
DUNE_THROW(Dune::NotImplemented,
"GridType cannot be used with adaptive MPFAL!");
break;
}
}
......@@ -917,53 +831,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo()
//get isIt14
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
case GridTypeIndices::sGrid:
{
if (isIt14 == isIt12End)
{
isIt14 = isIt12Begin;
}
else
{
isIt14 = ++tempIsIt;
if (isIt14 == isIt12End)
{
isIt14 = ++tempIsItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (isIt14 == isIt12End)
{
isIt14 = isIt12Begin;
}
else
{
isIt14 = ++tempIsIt;
if (isIt14 == isIt12End)
{
isIt14 = ++tempIsItBegin;
}
}
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (isIt14 == isIt12End)
isIt14 = isIt12Begin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (isIt14 == isIt12End)
......@@ -973,7 +842,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo()
}
default:
{
DUNE_THROW(Dune::NotImplemented, "GridType can not be used with MPFAO implementation!");
DUNE_THROW(Dune::NotImplemented,
"GridType cannot be used with adaptive MPFAL!");
break;
}
}
......@@ -1521,53 +1391,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo()
//get isIt14
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
case GridTypeIndices::sGrid:
{
if (isIt14 == isIt12End)
{
isIt14 = isIt12Begin;
}
else
{
isIt14 = ++tempIsIt;
if (isIt14 == isIt12End)
{
isIt14 = ++tempIsItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (isIt14 == isIt12End)
{
isIt14 = isIt12Begin;
}
else
{
isIt14 = ++tempIsIt;
if (isIt14 == isIt12End)
{
isIt14 = ++tempIsItBegin;
}
}
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (isIt14 == isIt12End)
isIt14 = isIt12Begin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (isIt14 == isIt12End)
......@@ -1577,7 +1402,8 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo()
}
default:
{
DUNE_THROW(Dune::NotImplemented, "GridType can not be used with MPFAO implementation!");
DUNE_THROW(Dune::NotImplemented,
"GridType cannot be used with adaptive MPFAL!");
break;
}
}
......
......@@ -528,24 +528,8 @@ void FvMpfaO2dPressure2p<TypeTag>::initializeMatrix()
// get 'nextIsIt'
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
// for SGrid and YaspGrid
case GridTypeIndices::sGrid:
{
if (nextIsIt == isEndIt)
nextIsIt = isItBegin;
else
{
nextIsIt = ++tempisIt;
if (nextIsIt == isEndIt)
{
nextIsIt = ++tempisItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (nextIsIt == isEndIt)
......@@ -564,15 +548,8 @@ void FvMpfaO2dPressure2p<TypeTag>::initializeMatrix()
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (nextIsIt == isEndIt)
nextIsIt = isItBegin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (nextIsIt == isEndIt)
......@@ -651,26 +628,8 @@ void FvMpfaO2dPressure2p<TypeTag>::initializeMatrix()
// get 'nextIsIt'
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
// for SGrid and YaspGrid
case GridTypeIndices::sGrid:
{
if (nextIsIt == isEndIt)
{
nextIsIt = isItBegin;
}
else
{
nextIsIt = ++tempisIt;
if (nextIsIt == isEndIt)
{
nextIsIt = ++tempisItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (nextIsIt == isEndIt)
......@@ -689,15 +648,8 @@ void FvMpfaO2dPressure2p<TypeTag>::initializeMatrix()
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (nextIsIt == isEndIt)
nextIsIt = isItBegin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (nextIsIt == isEndIt)
......@@ -822,26 +774,8 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
//get isIt14
switch (GET_PROP_VALUE(TypeTag, GridImplementation))
{
// for SGrid
// for SGrid and YaspGrid
case GridTypeIndices::sGrid:
{
if (isIt14 == isIt12End)
{
isIt14 = isIt12Begin;
}
else
{
isIt14 = ++tempIsIt;
if (isIt14 == isIt12End)
{
isIt14 = ++tempIsItBegin;
}
}
break;
}
// for YaspGrid
case GridTypeIndices::yaspGrid:
{
if (isIt14 == isIt12End)
......@@ -860,15 +794,8 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
break;
}
// for ALUGrid
// for ALUGrid and UGGrid
case GridTypeIndices::aluGrid:
{
if (isIt14 == isIt12End)
isIt14 = isIt12Begin;
break;
}
// for UGGrid
case GridTypeIndices::ugGrid:
{
if (isIt14 == isIt12End)
......
Supports Markdown
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