25 #include "FFDLattice.hpp"
35 m_globalDispl =
false;
37 m_name =
"mimmo.FFDlattice";
50 m_globalDispl =
false;
52 m_name =
"mimmo.FFDlattice";
54 std::string fallback_name =
"ClassNONE";
55 std::string input = rootXML.get(
"ClassName", fallback_name);
56 input = bitpit::utils::string::trim(input);
57 if(input ==
"mimmo.FFDLattice"){
77 m_mapdeg = other.m_mapdeg;
78 m_globalDispl = other.m_globalDispl;
79 m_bfilter = other.m_bfilter;
80 m_filter = other.m_filter;
81 m_collect_wg = other.m_collect_wg;
99 std::swap(m_deg, x.m_deg);
100 std::swap(m_knots, x.m_knots);
101 std::swap(m_mapEff, x.m_mapEff);
102 std::swap(m_weights, x.m_weights);
103 std::swap(m_displ, x.m_displ);
104 std::swap(m_mapNodes, x.m_mapNodes);
105 std::swap(m_mapdeg, x.m_mapdeg);
106 std::swap(m_globalDispl, x.m_globalDispl);
107 std::swap(m_bfilter, x.m_bfilter);
108 m_filter.swap(x.m_filter);
109 std::swap(m_collect_wg, x.m_collect_wg);
110 m_gdispl.swap(x.m_gdispl);
185 return(recoverFullNodeWeights());
211 if(dir<0 || dir>2){
return;}
213 knots.resize(
m_knots[dir].size());
237 if(
m_displ.empty())
return nullptr;
353 dimLimit[1] = 5; dimLimit[2] = 3;
366 for(
int i=0; i<3; ++i){
367 if(spacing[i] != 0.0) {
368 dim[i] = (int) std::floor(span2[i]/spacing[i] +0.5) + 1;
370 dim[i] = dimLimit[i];
423 dimLimit[1] = 5; dimLimit[2] = 3;
434 for(
int i=0; i<3; ++i){
435 if(spacing[i] != 0.0) {
436 dim[i] = (int) std::floor(span2[i]/spacing[i] +0.5) + 1;
438 dim[i] = dimLimit[i];
455 m_collect_wg[ind] = val;
477 for(
auto & val : wg){
492 m_bfilter = !(filter->empty());
509 int size = n[0]*n[1]*n[2];
511 for(
int i=0; i<size; ++i){
518 dispXYZ = recoverFullGridDispl();
523 for(
int i=0; i<size; ++i){
549 int size = n[0]*n[1]*n[2];
551 for(
int i=0; i<size; ++i){
558 dispXYZ = recoverFullGridDispl();
563 for(
int i=0; i<size; ++i){
583 if(container ==
nullptr){
584 (*m_log)<<
m_name +
" : nullptr pointer to linked geometry found"<<std::endl;
585 throw std::runtime_error(
m_name +
"nullptr pointer to linked geometry found");
595 if(container->isSkdTreeSupported() && container->getSkdTreeSyncStatus() !=
SyncStatus::SYNC){
596 container->buildSkdTree();
599 container->buildKdTree();
612 for (
const auto & vertex : container->getVertices()){
618 for(
const auto &mapp: map){
638 return(nurbsEvaluator(point));
654 if(container ==
nullptr)
return dvecarr3E(0);
659 if(container->isSkdTreeSupported()) list= container->getVertexFromCellList(
getShape()->includeGeometry(container));
667 dvecarr3E::iterator itL= result.begin();
668 for (
auto && vID : list){
669 *itL = (*itL) * m_filter[vID];
688 if(point ==
nullptr || !
isBuilt() )
return result;
690 result.resize(point->size(),
darray3E{{0,0,0}});
691 livector1D list = getShape()->includeCloudPoints(*point);
693 for(
const auto & index : list){
695 result[index] = nurbsEvaluator(target);
714 FFDLattice::checkFilter(){
716 check = check && m_filter.completeMissingData(0.0);
717 check = check && m_filter.getGeometry() == getGeometry();
720 m_log->setPriority(bitpit::log::Verbosity::DEBUG);
721 (*m_log)<<
"Not valid filter found in "<<m_name<<
". Proceeding with default unitary field"<<std::endl;
722 m_log->setPriority(bitpit::log::Verbosity::NORMAL);
725 m_filter.setGeometry(m_geometry);
727 m_filter.reserve(getGeometry()->getNVertices());
728 for (
const auto & vertex : getGeometry()->getVertices()){
729 m_filter.insert(vertex.getId(), 1.0);
740 FFDLattice::convertDisplToXYZ(
darray3E & target,
int i){
744 for(
int i=0; i<3; ++i){
745 work[i] = target[i]/scaling[i];
747 work += getLocalPoint(i);
748 darray3E result = transfToGlobal(work) - getGlobalPoint(i);
756 FFDLattice::convertDisplToXYZ(){
758 dvecarr3E displ = recoverFullGridDispl();
759 int sizeD = displ.size();
762 for(
int i=0; i<sizeD; ++i){
763 result[i] = convertDisplToXYZ(displ[i],i);
773 FFDLattice::nurbsEvaluator(
darray3E & pointOr){
775 darray3E point = transfToLocal(pointOr);
776 darray3E scaling = getShape()->getScaling();
780 dvector1D valH(4,0), temp1(4,0),temp2(4,0), zeros(4,0);
781 int uind, vind, wind, index;
785 int i0 = m_mapdeg[0];
786 int i1 = m_mapdeg[1];
787 int i2 = m_mapdeg[2];
791 for(
int i=0; i<3; i++){
792 knotInterval[i] = getKnotInterval(point[i],i);
793 BSbasis[i] = basisITS0(knotInterval[i], i, point[i]);
796 uind = knotInterval[i0] - m_deg[i0];
797 vind = knotInterval[i1] - m_deg[i1];
798 wind = knotInterval[i2] - m_deg[i2];
800 for(
int i=0; i<=m_deg[i0]; ++i){
802 mappedIndex[0] = uind+i;
805 for(
int j=0; j<=m_deg[i1]; ++j){
807 mappedIndex[1] = vind+j;
810 for(
int k=0; k<=m_deg[i2]; ++k){
812 mappedIndex[2] = wind+k;
813 index = accessMapNodes(mappedIndex[0],mappedIndex[1],mappedIndex[2]);
815 for(
int intv=0; intv<3; ++intv){
816 temp2[intv] += BSbasis[i2][k]*m_weights[m_intMapDOF[index]]*(*displ)[m_intMapDOF[index]][intv];
818 temp2[3] += BSbasis[i2][k]*m_weights[index];
820 for(
int intv=0; intv<4; ++intv){
821 temp1[intv] += BSbasis[i1][j]*temp2[intv];
825 for(
int intv=0; intv<4; ++intv){
826 valH[intv] += BSbasis[i0][i]*temp1[intv];
832 for(
int i=0; i<3; ++i){
833 outres[i] = valH[i]/valH[3];
838 for(
int i=0; i<3; ++i){
839 point[i] += valH[i]/(valH[3]*scaling[i]);
843 outres = transfToGlobal(point) - pointOr;
856 FFDLattice::nurbsEvaluator(
livector1D & list){
858 bitpit::PatchKernel * tri = getGeometry()->getPatch();
860 int lsize = list.size();
861 livector1D::iterator it, itend = list.end();
864 dvector1D BSbasisi0, BSbasisi1, BSbasisi2;
865 dvector1D valH(4,0), temp1(4,0),temp2(4,0);
867 dvecarr3E displ = recoverFullGridDispl();
868 dvector1D weig = recoverFullNodeWeights();
870 int uind, vind, wind, index;
874 int i0 = m_mapdeg[0];
875 int i1 = m_mapdeg[1];
876 int i2 = m_mapdeg[2];
884 dvecarr3E::iterator itout = outres.begin();
885 darray3E scaling = getShape()->getScaling();
888 double bbasis1, bbasis0;
890 for(it = list.begin(); it != itend; ++it){
892 for(intv=0; intv<4; ++intv){
896 target = tri->getVertex(
id).getCoords();
897 point = transfToLocal(target);
901 knotInterval[i] = getKnotInterval(point[i],i);
903 BSbasisi0 = basisITS0(knotInterval[i0], i0, point[i0]);
904 BSbasisi1 = basisITS0(knotInterval[i1], i1, point[i1]);
905 BSbasisi2 = basisITS0(knotInterval[i2], i2, point[i2]);
907 uind = knotInterval[i0] - md0;
908 vind = knotInterval[i1] - md1;
909 wind = knotInterval[i2] - md2;
912 for(i=0; i<=md0; ++i){
914 mappedIndex[i0] = uind + i;
916 for(
int intv=0; intv<4; ++intv){
920 for(j=0; j<=md1; ++j){
922 mappedIndex[i1] = vind + j;
924 for(intv=0; intv<4; ++intv){
928 for(k=0; k<=md2; ++k){
930 mappedIndex[i2] = wind + k;
932 index = accessMapNodes(mappedIndex[0], mappedIndex[1], mappedIndex[2]);
934 bbasisw2 = BSbasisi2[k]* weig[index];
936 for(intv=0; intv<3; ++intv){
937 temp2[intv] += bbasisw2 * displ[index][intv];
939 temp2[3] += bbasisw2;
942 bbasis1 = BSbasisi1[j];
943 for(intv=0; intv<4; ++intv){
944 temp1[intv] += bbasis1*temp2[intv];
948 bbasis0 = BSbasisi0[i];
949 for(intv=0; intv<4; ++intv){
950 valH[intv] += bbasis0*temp1[intv];
959 (*itout)[i] = valH[i]/valH[3];
966 point[i]+= valH[i]/(valH[3]*scaling[i]);
971 (*itout)[i] = transfToGlobal(point)[i] - target[i];
980 itout = outres.end();
992 FFDLattice::nurbsEvaluatorScalar(
darray3E & coordOr,
int targ){
994 darray3E point = transfToLocal(coordOr);
995 double scaling = getScaling()[targ];
999 dvector1D valH(2,0), temp1(2,0),temp2(2,0), zeros(2,0);
1000 int uind, vind, wind, index;
1004 int i0 = m_mapdeg[0];
1005 int i1 = m_mapdeg[1];
1006 int i2 = m_mapdeg[2];
1008 int md0 = m_deg[i0];
1009 int md1 = m_deg[i1];
1010 int md2 = m_deg[i2];
1014 for(
int i=0; i<3; i++){
1015 knotInterval[i] = getKnotInterval(point[i],i);
1016 BSbasis[i] = basisITS0(knotInterval[i], i, point[i]);
1019 uind = knotInterval[i0] - md0;
1020 vind = knotInterval[i1] - md1;
1021 wind = knotInterval[i2] - md2;
1023 for(
int i=0; i<=md0; ++i){
1025 mappedIndex[0] = uind+i;
1028 for(
int j=0; j<=md1; ++j){
1030 mappedIndex[1] = vind+j;
1033 for(
int k=0; k<=md2; ++k){
1035 mappedIndex[2] = wind+k;
1036 index = accessMapNodes(mappedIndex[0],mappedIndex[1],mappedIndex[2]);
1037 temp2[0] += BSbasis[i2][k]*m_weights[m_intMapDOF[index]]*(*displ)[m_intMapDOF[index]][targ];
1038 temp2[1] += BSbasis[i2][k]*m_weights[index];
1041 for(
int intv=0; intv<2; ++intv){
1042 temp1[intv] += BSbasis[i1][j]*temp2[intv];
1047 for(
int intv=0; intv<2; ++intv){
1048 valH[intv] += BSbasis[i0][i]*temp1[intv];
1053 if(isDisplGlobal()){
1054 res[targ] = valH[0]/valH[1];
1056 point[targ] += valH[0]/(valH[1]*scaling);
1057 res = transfToGlobal(point)- coordOr;
1070 FFDLattice::basisITS0(
int k,
int pos,
double coord){
1074 int dd1 = m_deg[pos]+1;
1079 for(
int j = 1; j < dd1; ++j){
1081 left[j] = coord - getKnotValue(k+1-j, pos);
1082 right[j]= getKnotValue(k+j, pos) - coord;
1084 for(
int r = 0; r < j; ++r){
1085 tmp = basis[r]/(right[r+1] + left[j-r]);
1086 basis[r] = saved + right[r+1] * tmp;
1087 saved = left[j-r] * tmp;
1101 FFDLattice::getNodeSpacing(
int dir){
1104 int dim = getDimension()[dir];
1105 double span = getLocalSpan()[dir];
1106 double locOr= getShape()->getLocalOrigin()[dir];
1108 int nn, retroOrigin;
1111 switch(getCoordType(dir))
1113 case CoordType::PERIODIC :
1114 nn = dim+m_deg[dir]-1;
1118 retroOrigin = (m_deg[dir]-1)/2 + (m_deg[dir]-1)%2;
1119 origin = locOr-1.0 * retroOrigin * dKn;
1121 for(
int i=0; i<nn; ++i){
1122 result[i] = origin + i*dKn;
1126 case CoordType::SYMMETRIC :
1127 nn = dim+m_deg[dir]-1;
1131 retroOrigin = (m_deg[dir]-1)/2 + (m_deg[dir]-1)%2;
1132 origin = locOr-1.0 * retroOrigin * dKn;
1134 for(
int i=0; i<nn; ++i){
1135 result[i] = origin + i*dKn;
1139 case CoordType::CLAMPED :
1143 for(
int i=0; i<nn; ++i){
1144 result[i] =locOr+ i*dKn;
1148 case CoordType::UNCLAMPED :
1152 for(
int i=0; i<nn; ++i){
1153 result[i] =locOr+ i*dKn;
1166 FFDLattice::clearKnots(){
1172 m_collect_wg.clear();
1177 m_mapNodes.resize(3);
1178 m_mapdeg[0]=0; m_mapdeg[1]=1; m_mapdeg[2]=2;
1184 FFDLattice::setKnotsStructure(){
1185 for(
int i=0; i<3; i++){
1186 setKnotsStructure(i,getCoordType(i));
1196 FFDLattice::setKnotsStructure(
int dir,
CoordType type){
1203 m_knots[dir].clear();
1204 m_mapEff[dir].clear();
1206 dvector1D equinode = getNodeSpacing(dir);
1207 int nEff, kEff,kTheo, kend;
1208 double tol = 1.0E-12;
1212 case CoordType::CLAMPED :
1214 m_deg[dir] = std::min(m_deg[dir], nn-1);
1215 kEff = nn - m_deg[dir] + 1;
1216 kTheo = nn + m_deg[dir] + 1;
1217 m_knots[dir].resize(kEff);
1218 m_mapEff[dir].resize(kTheo,0);
1221 m_knots[dir][0] = equinode[0];
1222 m_knots[dir][kEff-1] = equinode[equinode.size()-1];
1224 for(
int i=1; i<kEff-1; ++i){
1225 m_knots[dir][i] = 0.0;
1226 for(
int j=i; j<=i+m_deg[dir]-1; ++j){
1227 m_knots[dir][i] += equinode[j]/((double) m_deg[dir]);
1231 for(
int i=m_deg[dir]; i<(m_deg[dir]+kEff); i++){
1232 m_mapEff[dir][i]=i-m_deg[dir];
1235 for(
int i=(m_deg[dir]+kEff); i<kTheo; i++){
1236 m_mapEff[dir][i]=kEff-1;
1240 case CoordType::PERIODIC :
1242 m_deg[dir] = std::min(m_deg[dir], nn-1);
1243 nEff = nn + m_deg[dir] - 1;
1244 kEff = nEff -m_deg[dir] + 1;
1245 kTheo = nEff +m_deg[dir] + 1;
1246 m_knots[dir].resize(kTheo);
1247 m_mapEff[dir].resize(kTheo,0);
1251 m_knots[dir][m_deg[dir]] = 0.0;
1252 for(
int j=0; j<=m_deg[dir]-1; ++j){
1253 m_knots[dir][m_deg[dir]] += equinode[j]/((double) m_deg[dir]);
1255 if(abs(m_knots[dir][m_deg[dir]])<1.e-12) m_knots[dir][m_deg[dir]] = 0.0;
1257 for(
int i=1; i<kEff; ++i){
1258 m_knots[dir][i+m_deg[dir]] = 0.0;
1259 for(
int j=i; j<=i+m_deg[dir]-1; ++j){
1260 m_knots[dir][i+m_deg[dir]] += equinode[j]/((double) m_deg[dir]);
1264 kend = m_deg[dir] + kEff-1;
1266 for(
int i=0; i<m_deg[dir]; ++i){
1267 m_knots[dir][m_deg[dir]-i-1] = m_knots[dir][m_deg[dir]-i] - (m_knots[dir][kend-i] - m_knots[dir][kend-i-1]);
1268 m_knots[dir][kend +1 +i] = m_knots[dir][kend + i] + (m_knots[dir][m_deg[dir]+i+1] - m_knots[dir][m_deg[dir]+i]);
1271 for(
int i=0; i<kTheo; i++){
1276 case CoordType::SYMMETRIC :
1278 m_deg[dir] = std::min(m_deg[dir], nn-1);
1279 nEff = nn + m_deg[dir]-1;
1280 kEff = nEff -m_deg[dir] + 1;
1281 kTheo = nEff +m_deg[dir] + 1;
1282 m_knots[dir].resize(kTheo);
1283 m_mapEff[dir].resize(kTheo,0);
1287 m_knots[dir][m_deg[dir]] = 0.0;
1288 for(
int j=0; j<=m_deg[dir]-1; ++j){
1289 m_knots[dir][m_deg[dir]] += equinode[j]/((double) m_deg[dir]);
1291 if(std::abs(m_knots[dir][m_deg[dir]])<1.e-12) m_knots[dir][m_deg[dir]] = 0.0;
1293 for(
int i=1; i<kEff; ++i){
1294 m_knots[dir][i+m_deg[dir]] = 0.0;
1295 for(
int j=i; j<=i+m_deg[dir]-1; ++j){
1296 m_knots[dir][i+m_deg[dir]] += equinode[j]/((double) m_deg[dir]);
1300 kend = m_deg[dir] + kEff-1;
1302 for(
int i=0; i<m_deg[dir]; ++i){
1303 m_knots[dir][m_deg[dir]-i-1] = m_knots[dir][m_deg[dir]-i] - (m_knots[dir][kend-i] - m_knots[dir][kend-i-1]);
1304 m_knots[dir][kend +1 +i] = m_knots[dir][kend + i] + (m_knots[dir][m_deg[dir]+i+1] - m_knots[dir][m_deg[dir]+i]);
1307 for(
int i=0; i<kTheo; i++){
1313 case CoordType::UNCLAMPED :
1315 m_deg[dir] = std::min(m_deg[dir], nn-1);
1316 kEff = nn - m_deg[dir] + 1;
1317 kTheo = nn + m_deg[dir] + 1;
1318 m_knots[dir].resize(kTheo);
1319 m_mapEff[dir].resize(kTheo,0);
1321 kend = m_deg[dir] + kEff-1;
1323 m_knots[dir][m_deg[dir]] = equinode[0];
1324 m_knots[dir][kend] = equinode[equinode.size()-1] + tol;
1326 for(
int i=1; i<kEff-1; ++i){
1327 m_knots[dir][m_deg[dir]+i] = 0.0;
1328 for(
int j=i; j<=i+m_deg[dir]-1; ++j){
1329 m_knots[dir][m_deg[dir]+i] += equinode[j]/((double) m_deg[dir]);
1334 for(
int i=0; i<m_deg[dir]; ++i){
1335 m_knots[dir][m_deg[dir]-i-1] = m_knots[dir][m_deg[dir]-i] - (m_knots[dir][kend-i] - m_knots[dir][kend-i-1]);
1336 m_knots[dir][kend +1 +i] = m_knots[dir][kend + i] + (m_knots[dir][m_deg[dir]+i+1] - m_knots[dir][m_deg[dir]+i]);
1339 for(
int i=0; i<kTheo; i++){
1359 FFDLattice::getKnotInterval(
double coord,
int dir){
1361 int size = m_knots[dir].size();
1362 if(coord< m_knots[dir][0] ){
return(getTheoreticalKnotIndex(0, dir));}
1363 if(coord >= m_knots[dir][size-1]){
return(getTheoreticalKnotIndex(size-2, dir));}
1367 int mid = (low + high)/2;
1368 while( coord < m_knots[dir][mid] || coord>= m_knots[dir][mid+1]){
1369 if(coord < m_knots[dir][mid]) {high=mid;}
1373 return(getTheoreticalKnotIndex(mid, dir));
1382 FFDLattice::getKnotValue(
int index,
int dir){
1383 int target = getKnotIndex(index, dir);
1384 if(target ==-1){
return(-1.0);}
1385 return(m_knots[dir][target]);
1394 FFDLattice::getKnotIndex(
int index ,
int dir){
1395 if(index < 0 || index>=(
int)m_mapEff[dir].size())
return -1;
1396 return(m_mapEff[dir][index]);
1405 FFDLattice::getTheoreticalKnotIndex(
int locIndex,
int dir){
1406 if(locIndex <0 || locIndex >= (
int)m_knots[dir].size()){
return(-1);}
1409 ivector1D::reverse_iterator it = find(m_mapEff[dir].rbegin(), m_mapEff[dir].rend(), locIndex);
1410 int result = std::distance(m_mapEff[dir].begin(), (it.base()-1));
1417 void FFDLattice::resizeMapDof(){
1418 Lattice::resizeMapDof();
1420 m_displ.resize(m_np,
darray3E{{0.0,0.0,0.0}});
1428 FFDLattice::plotOptionalResults(){
1430 std::string dir = m_outputPlot;
1431 std::string nameGrid = m_name+
"GRID";
1433 std::string nameGridD = m_name+
"GRID_deformed";
1436 #if MIMMO_ENABLE_MPI
1441 plotGrid(dir, nameGrid, getId(),
true,
false );
1443 plotGrid(dir, nameGridD, getId(),
true,
true );
1452 FFDLattice::recoverFullGridDispl(){
1455 int size = dim[0]*dim[1]*dim[2];
1457 for(
int i=0; i<size; ++i){
1458 result[i] = m_displ[m_intMapDOF[i]];
1464 dvector1D FFDLattice::recoverFullNodeWeights(){
1467 int size = dim[0]*dim[1]*dim[2];
1469 for(
int i=0; i<size; ++i){
1470 result[i] = m_weights[m_intMapDOF[i]];
1478 FFDLattice::setMapNodes(
int ind){
1480 int dimdir = getDimension()[ind];
1481 int nn,preNNumb,postNNumb, pInd;
1482 m_mapNodes[ind].clear();
1484 switch(getCoordType(ind)){
1485 case CoordType::PERIODIC :
1487 nn = dimdir+m_deg[ind]-1;
1488 m_mapNodes[ind].resize(nn+1);
1490 preNNumb = (m_deg[ind]-1)/2 + (m_deg[ind]-1)%2;
1491 postNNumb = (m_deg[ind]-1) - preNNumb;
1494 for(
int i=0; i<dimdir; ++i){
1495 m_mapNodes[ind][i+preNNumb] = i;
1499 pInd = dimdir - preNNumb -1;
1500 for(
int i=0; i<preNNumb; ++i){
1501 m_mapNodes[ind][i] = pInd + i;
1505 for(
int i=0; i<=postNNumb; ++i){
1506 m_mapNodes[ind][i+preNNumb+dimdir] = pInd+i;
1510 case CoordType::SYMMETRIC :
1512 nn = dimdir+m_deg[ind]-1;
1513 m_mapNodes[ind].resize(nn+1);
1515 preNNumb = (m_deg[ind]-1)/2 + (m_deg[ind]-1)%2;
1516 postNNumb = (m_deg[ind]-1) - preNNumb;
1519 for(
int i=0; i<dimdir; ++i){
1520 m_mapNodes[ind][i+preNNumb] = i;
1524 for(
int i=0; i<preNNumb; ++i){
1525 m_mapNodes[ind][preNNumb -1 - i] = (i+1)%(dimdir-1);
1528 for(
int i=0; i<=postNNumb; ++i){
1529 m_mapNodes[ind][i+preNNumb+dimdir] = (dimdir-2-i)%(dimdir-1);
1534 m_mapNodes[ind].resize(dimdir);
1535 for (
int i=0; i<dimdir; ++i){
1536 m_mapNodes[ind][i] = i;
1545 FFDLattice::orderDimension(){
1547 std::map<std::pair<int,int>,
int > mapsort;
1548 mapsort[std::make_pair(m_nx,0)] = 0;
1549 mapsort[std::make_pair(m_ny,1)] = 1;
1550 mapsort[std::make_pair(m_nz,2)] = 2;
1553 for (std::map<std::pair<int,int>,
int >::iterator it = mapsort.begin(); it != mapsort.end(); ++it){
1554 m_mapdeg[i] = it->second;
1565 FFDLattice::build(){
1566 bool check = Lattice::build();
1568 m_deg[0] = std::min(m_nx, std::max(1, m_deg[0]));
1569 m_deg[1] = std::min(m_ny, std::max(1, m_deg[1]));
1570 m_deg[2] = std::min(m_nz, std::max(1, m_deg[2]));
1573 m_weights.resize(m_np, 1.0);
1575 m_displ.resize(m_np, {{0.0,0.0,0.0}});
1577 std::unordered_map<int, double>::iterator it;
1579 for(it=m_collect_wg.begin(); it != m_collect_wg.end(); ++it){
1580 m_weights[it->first] = it->second;
1583 m_collect_wg.clear();
1585 setKnotsStructure();
1596 FFDLattice::absorbSectionXML(
const bitpit::Config::Section & slotXML, std::string name){
1599 Lattice::absorbSectionXML(slotXML, name);
1602 if(slotXML.hasOption(
"CoordType")){
1603 std::string input = slotXML.get(
"CoordType");
1604 std::stringstream ss(bitpit::utils::string::trim(input));
1606 for(
int i=0; i<3; ++i){
1608 temp = bitpit::utils::string::trim(temp);
1609 if(temp ==
"SYMMETRIC"){
1610 setCoordType(CoordType::SYMMETRIC,i);
1611 }
else if(temp ==
"UNCLAMPED"){
1612 setCoordType(CoordType::UNCLAMPED,i);
1613 }
else if(temp ==
"PERIODIC"){
1614 setCoordType(CoordType::PERIODIC,i);
1616 setCoordType(CoordType::CLAMPED,i);
1621 if(slotXML.hasOption(
"Degrees")){
1622 std::string input = slotXML.get(
"Degrees");
1623 input = bitpit::utils::string::trim(input);
1626 std::stringstream ss(input);
1627 for(
auto &val : temp) ss>>val;
1632 if(slotXML.hasOption(
"DisplGlobal")){
1633 std::string input = slotXML.get(
"DisplGlobal");
1634 input = bitpit::utils::string::trim(input);
1637 std::stringstream ss(input);
1640 setDisplGlobal(temp);
1651 FFDLattice::flushSectionXML(bitpit::Config::Section & slotXML, std::string name){
1653 Lattice::flushSectionXML(slotXML, name);
1655 {std::stringstream ss;
1657 for(
int i=0; i<3; ++i){
1658 std::string towrite =
"CLAMPED";
1659 if(getCoordType()[i] == CoordType::SYMMETRIC){
1660 towrite =
"SYMMETRIC";
1661 }
else if(getCoordType()[i] == CoordType::UNCLAMPED){
1662 towrite =
"UNCLAMPED";
1663 }
else if(getCoordType()[i] == CoordType::PERIODIC){
1664 towrite =
"PERIODIC";
1668 slotXML.set(
"CoordType", ss.str());
1672 std::stringstream ss;
1673 ss<<getDegrees()[0]<<
'\t'<<getDegrees()[1]<<
'\t'<<getDegrees()[2];
1674 slotXML.set(
"Degrees", ss.str());
1678 slotXML.set(
"DisplGlobal", std::to_string(
int(isDisplGlobal())));