Fixed: Minor correction of the discretization option when it is specified on the XML input file

git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1551 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
kmo 2012-03-27 12:44:44 +00:00 committed by Knut Morten Okstad
parent d2557be3dc
commit 13412d0a8a
2 changed files with 17 additions and 16 deletions

View File

@ -76,7 +76,7 @@ int main (int argc, char** argv)
Profiler prof(argv[0]); Profiler prof(argv[0]);
SIMoptions dummy; SIMoptions dummy;
std::vector<int> ignoredPatches; std::vector<int> options(2,0), ignoredPatches;
int i, form = SIM::TOTAL_LAGRANGE; int i, form = SIM::TOTAL_LAGRANGE;
int outPrec = 3; int outPrec = 3;
double dtDump = 0.0; double dtDump = 0.0;
@ -91,7 +91,6 @@ int main (int argc, char** argv)
const LinAlgInit& linalg = LinAlgInit::Init(argc,argv); const LinAlgInit& linalg = LinAlgInit::Init(argc,argv);
std::vector<int> options(2,0);
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
if (dummy.parseOldOptions(argc,argv,i)) if (dummy.parseOldOptions(argc,argv,i))
; // ignore the obsolete option ; // ignore the obsolete option
@ -238,10 +237,12 @@ int main (int argc, char** argv)
return 1; return 1;
// Parse the obsolete options again to let them override input file tags // Parse the obsolete options again to let them override input file tags
dummy.discretization = model->opt.discretization; // but not this option
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
if (!model->opt.parseOldOptions(argc,argv,i)) if (!model->opt.parseOldOptions(argc,argv,i))
if (!strcmp(argv[i],"-ignore")) if (!strcmp(argv[i],"-ignore"))
while (i < argc-1 && isdigit(argv[i+1][0])) ++i; while (i < argc-1 && isdigit(argv[i+1][0])) ++i;
model->opt.discretization = dummy.discretization; // XML-tag is used, if set
if (linalg.myPid == 0) if (linalg.myPid == 0)
{ {

View File

@ -210,10 +210,10 @@ int main (int argc, char** argv)
if (iop == 10) if (iop == 10)
{ {
theSim = aSim = new AdaptiveSIM(model); theSim = aSim = new AdaptiveSIM(model);
model->opt.discretization = ASM::LRSpline; dummy.discretization = ASM::LRSpline;
} }
else if (KLp) else if (KLp)
model->opt.discretization = ASM::SplineC1; dummy.discretization = ASM::SplineC1;
// Read in model definitions // Read in model definitions
model->opt.discretization = dummy.discretization; model->opt.discretization = dummy.discretization;
@ -221,10 +221,12 @@ int main (int argc, char** argv)
return 1; return 1;
// Parse the obsolete options again to let them override input file tags // Parse the obsolete options again to let them override input file tags
dummy.discretization = model->opt.discretization; // but not this option
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
if (!model->opt.parseOldOptions(argc,argv,i)) if (!model->opt.parseOldOptions(argc,argv,i))
if (!strcmp(argv[i],"-ignore")) if (!strcmp(argv[i],"-ignore"))
while (i < argc-1 && isdigit(argv[i+1][0])) ++i; while (i < argc-1 && isdigit(argv[i+1][0])) ++i;
model->opt.discretization = dummy.discretization; // XML-tag is used, if set
// Boundary conditions can be ignored only in generalized eigenvalue analysis // Boundary conditions can be ignored only in generalized eigenvalue analysis
if (model->opt.eig != 4 && model->opt.eig != 6) if (model->opt.eig != 4 && model->opt.eig != 6)
@ -278,7 +280,8 @@ int main (int argc, char** argv)
SIMoptions::ProjectionMap::const_iterator pit; SIMoptions::ProjectionMap::const_iterator pit;
// Default projection method // Default projection method
if (model->opt.discretization >= ASM::Spline) bool staticSol = iop + model->opt.eig%5 == 0 || iop == 10;
if (model->opt.discretization >= ASM::Spline && staticSol)
pOpt[SIMoptions::GLOBAL] = "Greville point projection"; pOpt[SIMoptions::GLOBAL] = "Greville point projection";
else else
pOpt.clear(); pOpt.clear();
@ -293,7 +296,7 @@ int main (int argc, char** argv)
int iStep = 1, nBlock = 0; int iStep = 1, nBlock = 0;
DataExporter* exporter = NULL; DataExporter* exporter = NULL;
if (model->opt.dumpHDF5(infile) && (iop+(model->opt.eig%5) == 0 || iop == 10)) if (model->opt.dumpHDF5(infile) && staticSol)
{ {
if (linalg.myPid == 0) if (linalg.myPid == 0)
std::cout <<"\nWriting HDF5 file "<< model->opt.hdf5 std::cout <<"\nWriting HDF5 file "<< model->opt.hdf5
@ -460,16 +463,13 @@ int main (int argc, char** argv)
prefix[pOpt.size()] = 0; prefix[pOpt.size()] = 0;
// Write projected solution fields to VTF-file // Write projected solution fields to VTF-file
if(projs.size() > 0) size_t i = 0;
{ int iBlk = 100;
size_t i = 0; for (pit = pOpt.begin(); pit != pOpt.end(); pit++, i++, iBlk += 10)
int iBlk = 100; if (!model->writeGlvP(projs[i],iStep,nBlock,iBlk,pit->second.c_str()))
for (pit = pOpt.begin(); pit != pOpt.end(); pit++, i++, iBlk += 10) return 11;
if (!model->writeGlvP(projs[i],iStep,nBlock,iBlk,pit->second.c_str())) else
return 11; prefix[i] = pit->second.c_str();
else
prefix[i] = pit->second.c_str();
}
// Write eigenmodes // Write eigenmodes
bool isFreq = model->opt.eig==3 || model->opt.eig==4 || model->opt.eig==6; bool isFreq = model->opt.eig==3 || model->opt.eig==4 || model->opt.eig==6;