bool ContainerViewUI::calcAndSetDimRecursive() { for (auto i=children.begin(); i!=children.end(); i++) { (*i)->calcAndSetDimRecursive(); } return setDim(calcDim()); }
void calcDim(Node* node) { switch(node->c) { case '|': // enlarge left and right subwindow, round up left and round down bottom window node->left->dim.h = node->right->dim.h = node->dim.h; node->left->dim.w = node->left->min.w * node->dim.w / node->min.w + ((node->left->min.w * node->dim.w) % node->min.w > 0 ? 1 : 0); node->right->dim.w = node->right->min.w * node->dim.w / node->min.w; break; case '-': // enlarge top and bottom subwindow, round up top and round down bottom window node->left->dim.w = node->right->dim.w = node->dim.w; node->left->dim.h = node->left->min.h * node->dim.h / node->min.h + ((node->left->min.h * node->dim.h) % node->min.h > 0 ? 1 : 0); node->right->dim.h = node->right->min.h * node->dim.h / node->min.h; break; default: return; // do not process leave nodes } calcDim(node->left); calcDim(node->right); }
int main() { int t; scanf("%d\n", &t); char input[200]; int i; for(i=1; i<=t; i++) { scanf("%s\n", input); printf("%d\n", i); char* c = input; buildTree(&root, &c); calcMinDim(&root); root.dim = root.min; // the outer window is the limiting boundary calcDim(&root); printWindows(); freeTree(&root); } return 0; }
void WaterPropsIAPWS::setState_TR(doublereal temperature, doublereal rho) { calcDim(temperature, rho); m_phi.tdpolycalc(tau, delta); }