Added: more control for adaptive LR-spline refinement scheme (LR-splines r202)
git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1724 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
parent
172bc10bc9
commit
61c68b7adb
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
*.log
|
||||
*.vtfx
|
||||
*.vtf
|
||||
*~
|
||||
*.eps
|
||||
|
@ -241,6 +241,7 @@ bool ASMu2D::uniformRefine (int dir, int nInsert)
|
||||
|
||||
delete lrspline;
|
||||
geo = lrspline = new LR::LRSplineSurface(tensorspline);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -273,6 +274,7 @@ bool ASMu2D::refine (int dir, const RealArray& xi)
|
||||
|
||||
delete lrspline;
|
||||
geo = lrspline = new LR::LRSplineSurface(tensorspline);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -297,11 +299,14 @@ bool ASMu2D::refine (const std::vector<int>& elements,
|
||||
if (!lrspline) return false;
|
||||
if (shareFE) return true;
|
||||
|
||||
double beta = (options.size()>0) ? options[0]/100.0 : 0.10;
|
||||
int multiplicity = (options.size()>1) ? options[1] : 1;
|
||||
enum refinementStrategy strat = LR_SAFE;
|
||||
int symmetry = (options.size()>3) ? options[3] : 1;
|
||||
bool linIndepTest = (options.size()>4) ? options[4]!=0 : false;
|
||||
double beta = (options.size()>0) ? options[0]/100.0 : 0.10;
|
||||
int multiplicity = (options.size()>1) ? options[1] : 1;
|
||||
enum refinementStrategy strat = LR_SAFE;
|
||||
int symmetry = (options.size()>3) ? options[3] : 1;
|
||||
bool linIndepTest = (options.size()>4) ? options[4]!=0 : false;
|
||||
int maxTjoints = (options.size()>5) ? options[5] : -1;
|
||||
double maxAspectRatio= (options.size()>6) ? options[6] : -1;
|
||||
bool closeGaps = (options.size()>7) ? options[7]!=0 : false;
|
||||
|
||||
if(options.size() > 2) {
|
||||
if(options[2]==1) strat = LR_MINSPAN;
|
||||
@ -319,6 +324,11 @@ bool ASMu2D::refine (const std::vector<int>& elements,
|
||||
}
|
||||
|
||||
if (!elements.empty()) {
|
||||
if(maxTjoints > 0)
|
||||
lrspline->setMaxTjoints(maxTjoints);
|
||||
if(maxAspectRatio > 0)
|
||||
lrspline->setMaxAspectRatio(maxAspectRatio);
|
||||
lrspline->setCloseGaps(closeGaps);
|
||||
lrspline->refine(elements, beta, multiplicity, strat, symmetry);
|
||||
}
|
||||
if (fName)
|
||||
@ -345,11 +355,21 @@ bool ASMu2D::refine (const std::vector<int>& elements,
|
||||
strcat(fullFileName, fName);
|
||||
std::ofstream lrOut(fullFileName);
|
||||
|
||||
strcpy(fullFileName, "refine_details_");
|
||||
strcat(fullFileName, fName);
|
||||
std::ofstream refineDetails(fullFileName);
|
||||
|
||||
lrspline->writePostscriptMesh(paramMeshFile);
|
||||
lrspline->writePostscriptElements(physicalMeshFile);
|
||||
lrspline->writePostscriptFunctionSpace(paramDotMeshFile);
|
||||
lrspline->writePostscriptMeshWithControlPoints(physicalDotMeshFile);
|
||||
lrOut << *lrspline;
|
||||
refineDetails << beta << " " << multiplicity << " " << strat << " " << symmetry << std::endl;
|
||||
refineDetails << maxTjoints << " " << maxAspectRatio << " " << closeGaps << std::endl;
|
||||
refineDetails << elements.size() << std::endl;
|
||||
for(size_t i=0; i<elements.size(); i++) {
|
||||
refineDetails << elements[i] << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (!elements.empty())
|
||||
@ -362,16 +382,17 @@ bool ASMu2D::refine (const std::vector<int>& elements,
|
||||
std::cout << "Testing for linear independence....";
|
||||
if(!lrspline->isLinearIndepByMappingMatrix(false))
|
||||
{
|
||||
std::cout << "FAILED!!!\n";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "*********************************************\n";
|
||||
std::cerr << "\nLR B-spline is linear dependant. Terminating analysis\n\n";
|
||||
std::cerr << "\nLR B-spline is linear dependant. Continuing analysis anyway\n\n";
|
||||
std::cerr << "*********************************************\n";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << std::endl;
|
||||
exit(34532);
|
||||
return false;
|
||||
// exit(34532);
|
||||
// return false;
|
||||
}
|
||||
std::cout << "OK\n";
|
||||
}
|
||||
@ -1442,7 +1463,7 @@ bool ASMu2D::evalSolution (Matrix& sField, const IntegrandBase& integrand,
|
||||
{
|
||||
// Extract control point values from the spline object
|
||||
sField.resize(s->dimension(),s->nBasisFunctions());
|
||||
for(size_t i=0; i<s->nBasisFunctions(); i++)
|
||||
for(int i=0; i<s->nBasisFunctions(); i++)
|
||||
for(int d=0; d<s->dimension(); d++)
|
||||
sField(d+1,i+1) = s->getBasisfunction(i)->controlpoint_[d];
|
||||
delete s;
|
||||
|
@ -29,16 +29,19 @@
|
||||
AdaptiveSIM::AdaptiveSIM (SIMbase* sim) : model(sim)
|
||||
{
|
||||
// Default grid adaptation parameters
|
||||
storeMesh = false;
|
||||
linIndepTest = false;
|
||||
beta = 10.0;
|
||||
errTol = 1.0;
|
||||
maxStep = 10;
|
||||
maxDOFs = 1000000;
|
||||
scheme = 0; // fullspan
|
||||
symmetry = 1; // no symmetry
|
||||
knot_mult = 1; // maximum regularity (continuity)
|
||||
adaptor = 0;
|
||||
storeMesh = false;
|
||||
linIndepTest = false;
|
||||
beta = 10.0;
|
||||
errTol = 1.0;
|
||||
maxStep = 10;
|
||||
maxDOFs = 1000000;
|
||||
scheme = 0; // fullspan
|
||||
symmetry = 1; // no symmetry
|
||||
knot_mult = 1; // maximum regularity (continuity)
|
||||
adaptor = 0;
|
||||
maxTjoints = -1;
|
||||
maxAspectRatio = -1.0;
|
||||
closeGaps = false;
|
||||
}
|
||||
|
||||
|
||||
@ -82,8 +85,12 @@ bool AdaptiveSIM::parse (const TiXmlElement* elem)
|
||||
else if (!strcasecmp(value,"isotropic_function"))
|
||||
scheme = 3;
|
||||
else
|
||||
std::cerr <<" ** AdaptiveSIM::parse: Unknown refinement scheme \""
|
||||
std::cerr <<" ** AdaptiveSIM::parse: Unknown refinement scheme \""
|
||||
<< value <<"\" (ignored)"<< std::endl;
|
||||
utl::getAttribute(child, "maxTjoints", maxTjoints);
|
||||
utl::getAttribute(child, "maxAspectRatio", maxAspectRatio);
|
||||
if(child->Attribute("closeGaps"))
|
||||
closeGaps = true;
|
||||
}
|
||||
else if ((value = utl::getValue(child,"use_norm")))
|
||||
adaptor = atoi(value);
|
||||
@ -259,12 +266,15 @@ bool AdaptiveSIM::adaptMesh (int iStep)
|
||||
std::vector<int> toBeRefined, options;
|
||||
std::vector<IndexDouble> errors;
|
||||
|
||||
options.reserve(5);
|
||||
options.reserve(8);
|
||||
options.push_back(beta);
|
||||
options.push_back(knot_mult);
|
||||
options.push_back(scheme);
|
||||
options.push_back(symmetry);
|
||||
options.push_back(linIndepTest);
|
||||
options.push_back(maxTjoints);
|
||||
options.push_back(floor(maxAspectRatio));
|
||||
options.push_back(closeGaps);
|
||||
|
||||
size_t i;
|
||||
if (scheme == 3)
|
||||
|
@ -78,12 +78,15 @@ private:
|
||||
|
||||
bool storeMesh; //!< Creates a series of eps-files for intermediate steps
|
||||
bool linIndepTest; //!< Test all mesh for linear independence after refinement
|
||||
double beta; //!< Refinement percentage in each step
|
||||
double errTol; //!< Global error stop tolerance
|
||||
int maxStep; //!< Maximum number of adaptive refinements
|
||||
int maxDOFs; //!< Maximum number of degrees of freedom
|
||||
int symmetry; //!< Always refine a multiplum of this
|
||||
int knot_mult; //!< Knotline multiplicity
|
||||
double beta; //!< Refinement percentage in each step
|
||||
double errTol; //!< Global error stop tolerance
|
||||
int maxStep; //!< Maximum number of adaptive refinements
|
||||
int maxDOFs; //!< Maximum number of degrees of freedom
|
||||
int symmetry; //!< Always refine a multiplum of this
|
||||
int knot_mult; //!< Knotline multiplicity
|
||||
int maxTjoints; //!< Maximum number of hanging nodes on one element
|
||||
double maxAspectRatio; //!< Maximum element aspect ratio
|
||||
bool closeGaps; //!< Split elements with a hanging node on each side
|
||||
|
||||
//! Refinement scheme: 0=fullspan, 1=minspan, 2=isotropic_elements,
|
||||
//! 3=isotropic_functions
|
||||
|
Loading…
Reference in New Issue
Block a user