Ejemplo n.º 1
0
void ExplorerPropertySheet(HWND hparent)
{
	PropertySheetDialog ps(hparent);

	ps.dwFlags |= PSH_USEICONID | PSH_PROPTITLE;
	ps.pszIcon = MAKEINTRESOURCE(IDI_REACTOS);
	ps.pszCaption = TEXT("Explorer");

	PropSheetPage psp1(IDD_DESKBAR_DESKTOP, WINDOW_CREATOR(DesktopSettingsDlg));
	psp1.dwFlags |= PSP_USETITLE;
	psp1.pszTitle = MAKEINTRESOURCE(IDS_DESKTOP);
	ps.add(psp1);

	PropSheetPage psp2(IDD_DESKBAR_TASKBAR, WINDOW_CREATOR(TaskbarSettingsDlg));
	psp2.dwFlags |= PSP_USETITLE;
	psp2.pszTitle = MAKEINTRESOURCE(IDS_TASKBAR);
	ps.add(psp2);

	PropSheetPage psp3(IDD_DESKBAR_STARTMENU, WINDOW_CREATOR(StartmenuSettingsDlg));
	psp3.dwFlags |= PSP_USETITLE;
	psp3.pszTitle = MAKEINTRESOURCE(IDS_STARTMENU);
	ps.add(psp3);

	ps.DoModal();
}
Ejemplo n.º 2
0
void Strand2dFCBlockSolver::gradStencil()
{
  // create linked lists of surface elements surrounding surface points
  int* surfEsp2 = new int[nSurfNode];
  for (int n=0; n<nSurfNode; n++) surfEsp2[n] = 0;
  for (int n=0; n<nSurfElem; n++)
    for (int k=0; k<meshOrder+1; k++) surfEsp2[surfElem(n,k)]++;

  int** surfEsp1 = new int*[nSurfNode];
  for (int n=0; n<nSurfNode; n++){
    if (surfEsp2[n] > 0) surfEsp1[n] = new int[surfEsp2[n]];
    else surfEsp1[n] = NULL;
  }

  int j;
  for (int n=0; n<nSurfNode; n++) surfEsp2[n] = 0;
  for (int n=0; n<nSurfElem; n++)
    for (int k=0; k<meshOrder+1; k++){
      j = surfEsp2[surfElem(n,k)];
      surfEsp1[surfElem(n,k)][j] = n;
      surfEsp2[surfElem(n,k)]++;
    }

  /*
  for (int n=0; n<nSurfNode; n++){
    cout << n << " ";
    for (int j=0; j<surfEsp2[n]; j++) cout << surfEsp1[n][j] << " ";
    cout << endl;
  }
  exit(0);
  */


  int i,m,n1,n2;
  Array1D<int> flag(nSurfNode);
  psp2.allocate(nSurfNode+1);
  psp2.set(0);
  flag.set(-1);
  for (int n=0; n<nSurfNode; n++)
    for (int l=0; l<surfEsp2[n]; l++){
      i = surfEsp1[n][l];
      for (int k=0; k<meshOrder+1; k++){
	m = surfElem(i,k);
	if (flag(m) != n){
	  psp2(n+1)++;
	  flag(m) = n;
	}}}

  /*
  for (int n=0; n<nNode; n++)
    cout << n << " " << psp2(n+1) << endl;
  exit(0);
  */

  for(int n=1; n<nSurfNode+1; n++) psp2(n) += psp2(n-1);
  npsp1 = psp2(nSurfNode);
  psp1.allocate(npsp1);

  flag.set(-1);
  for (int n=0; n<nSurfNode; n++)
    for (int l=0; l<surfEsp2[n]; l++){
      i = surfEsp1[n][l];
      for (int k=0; k<meshOrder+1; k++){
	m = surfElem(i,k);
	if (flag(m) != n){
	  psp1(psp2(n)++) = m;
	  flag(m)         = n;
	}}}

  for(int n=nSurfNode; n>0; n--) psp2(n) = psp2(n-1);
  psp2(0) = 0;

  /*
  for (int n=0; n<nSurfNode; n++){
    cout << "\nSurfNode: " << n << " " << psp2(n+1)-psp2(n) << endl;
    for (int i=psp2(n); i<psp2(n+1); i++) cout << psp1(i) << endl;
  }
  exit(0);
  */


  // deallocate work arrays
  for (int n=0; n<nSurfNode; n++)
    if (surfEsp1[n]) delete [] surfEsp1[n];
  delete [] surfEsp1;
  delete [] surfEsp2;
  flag.deallocate();
}
Ejemplo n.º 3
0
void Tri2dFCBlockSolver::gradSetupQuadratic()
{
  // form quadratic sub elements
  int nElemQ = 3*nElem;
  int nneQ   = 6; //quadratic elements
  int nngQ   = 4; //quadratic elements
  Array2D<int> elemQ(nElemQ,nneQ),gNode(nElemQ,nngQ);
  int m=0;
  for (int n=0; n<nElem; n++){
    elemQ(m  ,0) = elem(n,0);
    elemQ(m  ,1) = elem(n,4);
    elemQ(m  ,2) = elem(n,7);
    elemQ(m  ,3) = elem(n,3);
    elemQ(m  ,4) = elem(n,9);
    elemQ(m  ,5) = elem(n,8);
    gNode(m  ,0) = 0;
    gNode(m  ,1) = 3;
    gNode(m  ,2) = 4;
    gNode(m++,3) = 5;
    elemQ(m  ,0) = elem(n,3);
    elemQ(m  ,1) = elem(n,1);
    elemQ(m  ,2) = elem(n,6);
    elemQ(m  ,3) = elem(n,4);
    elemQ(m  ,4) = elem(n,5);
    elemQ(m  ,5) = elem(n,9);
    gNode(m  ,0) = 1;
    gNode(m  ,1) = 4;
    gNode(m  ,2) = 5;
    gNode(m++,3) = 3;
    elemQ(m  ,0) = elem(n,8);
    elemQ(m  ,1) = elem(n,5);
    elemQ(m  ,2) = elem(n,2);
    elemQ(m  ,3) = elem(n,9);
    elemQ(m  ,4) = elem(n,6);
    elemQ(m  ,5) = elem(n,7);
    gNode(m  ,0) = 2;
    gNode(m  ,1) = 5;
    gNode(m  ,2) = 3;
    gNode(m++,3) = 4;
  }

  /*
  for (int n=0; n<nElemQ; n++){
    cout << n << " ";
    for (int j=0; j<nneQ; j++) cout << elemQ(n,j) << " ";
    cout << endl;
  }
  exit(0);
  */


  // Jacobian terms
  Array2D <double> xr(nElemQ,nngQ),yr(nElemQ,nngQ),xs(nElemQ,nngQ),
    ys(nElemQ,nngQ),jac(nElemQ,nngQ),rs(nneQ,3),lc(nneQ,nneQ);
  xr.set(0.);
  yr.set(0.);
  xs.set(0.);
  ys.set(0.);
  jac.set(0.);

  int orderE=2; //quadratic elements 
  solutionPoints(orderE,
		 spacing,
		 &rs(0,0));

  bool test=true;
  lagrangePoly(test,
	       orderE,
	       &rs(0,0),
	       &lc(0,0));

  int j,km,lm;
  double lrm,lsm,ri,si;
  for (int n=0; n<nElemQ; n++){

    // evaluate the Jacobian terms at the mesh points
    for (int i=0; i<nngQ; i++){ //ith mesh point
      ri = rs(gNode(n,i),0);
      si = rs(gNode(n,i),1);
      for (int m=0; m<nneQ; m++){ //mth Lagrange polynomial
	j   = 0;
	lrm = 0.;
	lsm = 0.;
	for (int k=0; k<=orderE; k++)
	  for (int l=0; l<=orderE-k; l++){
	    km   = max(0,k-1);
	    lm   = max(0,l-1);
	    lrm +=((double)k)*pow(ri,km)*pow(si,l )*lc(m,j  );
	    lsm +=((double)l)*pow(ri,k )*pow(si,lm)*lc(m,j++);
	  }
	xr(n,i) += lrm*x(elemQ(n,m),0);
	yr(n,i) += lrm*x(elemQ(n,m),1);
	xs(n,i) += lsm*x(elemQ(n,m),0);
	ys(n,i) += lsm*x(elemQ(n,m),1);
      }
      jac(n,i) = xr(n,i)*ys(n,i)-yr(n,i)*xs(n,i);
    }}


  // lr(i,j) = (dl_j/dr)_i (a row is all Lagrange polynomials (derivatives)
  // evaluated at a single mesh point i, same with the other derivatives)
  Array2D<double> lr(nneQ,nneQ),ls(nneQ,nneQ),lrr(nneQ,nneQ),
    lss(nneQ,nneQ),lrs(nneQ,nneQ);
  lr.set(0.);
  ls.set(0.);
  lrr.set(0.);
  lss.set(0.);
  lrs.set(0.);
  int kmm,lmm;
  for (int n=0; n<nneQ; n++) // nth Lagrange polynomial
    for (int i=0; i<nneQ; i++){ // ith mesh point
      j  = 0;
      ri = rs(i,0);
      si = rs(i,1);
      for (int k=0; k<=orderE; k++)
	for (int l=0; l<=orderE-k; l++){
	  km        = max(0,k-1);
	  lm        = max(0,l-1);
	  kmm       = max(0,k-2);
	  lmm       = max(0,l-2);
	  lr (i,n) +=((double)k)*pow(ri,km)*pow(si,l )*lc(n,j);
	  ls (i,n) +=((double)l)*pow(ri,k )*pow(si,lm)*lc(n,j);
	  lrr(i,n) +=((double)(k*km))*pow(ri,kmm)*pow(si,l  )*lc(n,j  );
	  lss(i,n) +=((double)(l*lm))*pow(ri,k  )*pow(si,lmm)*lc(n,j  );
	  lrs(i,n) +=((double)(k*l ))*pow(ri,km )*pow(si,lm )*lc(n,j++);
	}}


  // compute averaged quadratic FEM gradient coefficients
  Array1D<double> sumj(nNode);
  sumj.set(0.);
  for (int n=0; n<nElemQ; n++)
    for (int i=0; i<nngQ; i++){
      m                 = gNode(n,i);
      sumj(elemQ(n,m)) += jac(n,i);
    }
  for (int n=0; n<nNode; n++) sumj(n) = 1./sumj(n);

  int k1,k2;
  double xri,yri,xsi,ysi;
  Array2D<double> ax(nNode,2);
  ax.set(0.);
  gxQ.set(0.);
  for (int n=0; n<nElemQ; n++)
    for (int i=0; i<nngQ; i++){
      m   = gNode(n,i);
      k1  = elemQ(n,m);
      xri = xr(n,i);
      yri = yr(n,i);
      xsi = xs(n,i);
      ysi = ys(n,i);
      for (int j=0; j<nneQ; j++){
	k2       = elemQ(n,j);
	ax(k2,0) = lr(m,j)*ysi-ls(m,j)*yri;
	ax(k2,1) =-lr(m,j)*xsi+ls(m,j)*xri;
      }
      for(int j=psp2(k1); j<psp2(k1+1); j++){
	k2        = psp1(j);
	gxQ(j,0) += ax(k2,0);
	gxQ(j,1) += ax(k2,1);
      }
      for (int j=0; j<nneQ; j++){
	k2       = elemQ(n,j);
	ax(k2,0) = 0.;
	ax(k2,1) = 0.;
      }}

  for (int n=0; n<nNode; n++)
    for (int i=psp2(n); i<psp2(n+1); i++){
      gxQ(i,0) *= sumj(n);
      gxQ(i,1) *= sumj(n);
    }


  // deallocate work arrays
  elemQ.deallocate();
  gNode.deallocate();
  xr.deallocate();
  yr.deallocate();
  xs.deallocate();
  ys.deallocate();
  jac.deallocate();
  rs.deallocate();
  lc.deallocate();
  lr.deallocate();
  ls.deallocate();
  lrr.deallocate();
  lss.deallocate();
  lrs.deallocate();
  sumj.deallocate();
  ax.deallocate();
}
Ejemplo n.º 4
0
void Strand2dFCBlockSolver::gradSetupSub(Array3D<double>& gx)
{
  // initialize coefficient array
  gx.set(0.);


  // form quadratic sub elements
  int meshOrderL=2,nElemLocalL=meshOrder-1,nSurfElemL=nSurfElem*nElemLocalL;
  Array3D<int> surfElemL(nSurfElemL,meshOrderL+1,2);
  Array3D<int> elemLocalL(nElemLocalL,meshOrderL+1,2);
  if (meshOrder == 2){
    elemLocalL(0,0,0) = 0; elemLocalL(0,0,1) = 1;
    elemLocalL(0,1,0) = 1; elemLocalL(0,1,1) = 1;
    elemLocalL(0,2,0) = 2; elemLocalL(0,2,1) = 1;
  }
  else if (meshOrder == 3){
    elemLocalL(0,0,0) = 0; elemLocalL(0,0,1) = 1;
    elemLocalL(0,1,0) = 3; elemLocalL(0,1,1) = 0;
    elemLocalL(0,2,0) = 2; elemLocalL(0,2,1) = 1;
    elemLocalL(1,0,0) = 2; elemLocalL(1,0,1) = 0;
    elemLocalL(1,1,0) = 1; elemLocalL(1,1,1) = 1;
    elemLocalL(1,2,0) = 3; elemLocalL(1,2,1) = 1;
  }
  else if (meshOrder == 4){
    elemLocalL(0,0,0) = 0; elemLocalL(0,0,1) = 1;
    elemLocalL(0,1,0) = 3; elemLocalL(0,1,1) = 0;
    elemLocalL(0,2,0) = 2; elemLocalL(0,2,1) = 1;
    elemLocalL(1,0,0) = 2; elemLocalL(1,0,1) = 0;
    elemLocalL(1,1,0) = 4; elemLocalL(1,1,1) = 0;
    elemLocalL(1,2,0) = 3; elemLocalL(1,2,1) = 1;
    elemLocalL(2,0,0) = 3; elemLocalL(2,0,1) = 0;
    elemLocalL(2,1,0) = 1; elemLocalL(2,1,1) = 1;
    elemLocalL(2,2,0) = 4; elemLocalL(2,2,1) = 1;
  }
  
  int k=0;
  for (int n=0; n<nSurfElem; n++)
    for (int i=0; i<nElemLocalL; i++){
      for (int m=0; m<meshOrderL+1; m++){
	surfElemL(k,m,0) = surfElem(n,elemLocalL(i,m,0));
	surfElemL(k,m,1) = elemLocalL(i,m,1);
      }
      k++;
    }
  if (k != nSurfElemL){
    cout << "\n***Problem forming sub-elements in initialize.C***"
	 << endl;
    exit(0);
  }
 

  // Lagrange polynomial derivatives for lower order elements
  int spacing=0; // assume equally spaced points in surface elements for now
  Array1D<double> ss(meshOrderL+1);
  solutionPoints1D(meshOrderL,
		   spacing,
		   &ss(0));

  bool test=false;
  Array2D<double> lc(meshOrderL+1,meshOrderL+1);
  lagrangePoly1D(test, // coefficients to form Lagrange polynomials
		 meshOrderL,
		 &ss(0),
		 &lc(0,0));

  // ls(i,j) = (dl_j/ds)_i (a row is all Lagrange polynomials (derivatives)
  // evaluated at a single mesh point i)
  Array2D<double> lsL(meshOrderL+1,meshOrderL+1);
  lsL.set(0.);
  int km;
  for (int i=0; i<meshOrderL+1; i++) // ith mesh point
    for (int j=0; j<meshOrderL+1; j++) // jth Lagrange polynomial
      for (int k=0; k<meshOrderL+1; k++){
	km        = max(0,k-1);
	lsL(i,j) +=((double)k)*pow(ss(i),km)*lc(j,k);
      }


  // mapping terms for lower order elements
  Array3D<double> xsL(nSurfElemL,meshOrderL+1,nStrandNode);
  Array3D<double> ysL(nSurfElemL,meshOrderL+1,nStrandNode);
  Array3D<double> jacL(nSurfElemL,meshOrderL+1,nStrandNode);
  xsL.set(0.);
  ysL.set(0.);
  int ni,nm;
  double x0,y0,nx,ny;
  for (int n=0; n<nSurfElemL; n++)
    for (int i=0; i<meshOrderL+1; i++){ // ith point in the element
      ni = surfElemL(n,i,0);
      for (int m=0; m<meshOrderL+1; m++){ // mth Lagrange poly. in mapping
	nm = surfElemL(n,m,0);
	x0 = surfX(nm,0);
	y0 = surfX(nm,1);
	nx = pointingVec(nm,0);
	ny = pointingVec(nm,1);
	for (int j=0; j<nStrandNode; j++){
	  xsL(n,i,j) += lsL(i,m)*(x0+nx*strandX(j));
	  ysL(n,i,j) += lsL(i,m)*(y0+ny*strandX(j));
	}}
      for (int j=0; j<nStrandNode; j++)
	jacL(n,i,j) = xsL(n,i,j)*yn(ni,j)-ysL(n,i,j)*xn(ni,j);
    }


  // degree at each surface node
  Array1D<int> sum(nSurfNode);
  sum.set(0);
  for (int n=0; n<nSurfElemL; n++)
    for (int i=0; i<meshOrderL+1; i++)
      sum(surfElemL(n,i,0)) += surfElemL(n,i,1);


  // use elements to form gradient coefficients
  double xnj,ynj;
  Array3D<double> a(nSurfNode,nStrandNode,2);
  a.set(0.);
  for (int n=0; n<nSurfElemL; n++)
    for (int i=0; i<meshOrderL+1; i++){ //ith point in the element
      if (surfElemL(n,i,1) == 1){ //if a contributing node
	ni = surfElemL(n,i,0);
	for (int m=0; m<meshOrderL+1; m++){ //mth Lagrange poly. in mapping
	  nm = surfElemL(n,m,0);
	  for (int j=0; j<nStrandNode; j++){ //local gradient coefficients
	    xnj       = xn(ni,j)/(jacL(n,i,j)*(double)sum(ni));
	    ynj       = yn(ni,j)/(jacL(n,i,j)*(double)sum(ni));
	    a(nm,j,0) = lsL(i,m)*ynj;
	    a(nm,j,1) =-lsL(i,m)*xnj;
	  }}
	for (int m=psp2(ni); m<psp2(ni+1); m++){ //add to coefficient array
	  nm = psp1(m);
	  for (int j=0; j<nStrandNode; j++){
	    gx(m,j,0) += a(nm,j,0);
	    gx(m,j,1) += a(nm,j,1);
	  }}
	for (int m=0; m<meshOrderL+1; m++){ //reset helper array to zero
	  nm = surfElemL(n,m,0);
	  for (int j=0; j<nStrandNode; j++){
	    a(nm,j,0) = 0.;
	    a(nm,j,1) = 0.;
	  }}}}


  // clean up
  sum.deallocate();
  a.deallocate();
  surfElemL.deallocate();
  elemLocalL.deallocate();
  xsL.deallocate();
  ysL.deallocate();
  ss.deallocate();
  lc.deallocate();
  lsL.deallocate();
}
Ejemplo n.º 5
0
void Tri2dFCBlockSolver::gradient(const int& nqp,
				  const double* p,
				  double* px)
{
  for (int n=0; n<nNode*nqp*2; n++) px[n] = 0.;

  if (order == 2){ //Green-Gauss gradients
    int n1,n2,k1,k2,k1x,k1y,k2x,k2y,m=0;
    double Ax,Ay,a,third=1./3.;
    for (int n=0; n<nEdge; n++){ //interior edges
      n1  = edge(n,0);
      n2  = edge(n,1);
      Ax  = area(n,0);
      Ay  = area(n,1);
      k1  = n1*nqp;
      k2  = n2*nqp;
      k1x = n1*nqp*2;
      k1y = k1x+nqp;
      k2x = n2*nqp*2;
      k2y = k2x+nqp;
      for (int k=0; k<nqp; k++){
	a          = p[k1+k]+p[k2+k];
	px[k1x+k] += Ax*a;
	px[k1y+k] += Ay*a;
	px[k2x+k] -= Ax*a;
	px[k2y+k] -= Ay*a;
      }}
    for (int n=nEdge-nEdgeBd; n<nEdge; n++){ //boundary edges
      n1  = edge(n,0);
      n2  = edge(n,1);
      Ax  = areaBd(m  ,0);
      Ay  = areaBd(m++,1);
      k1  = n1*nqp;
      k2  = n2*nqp;
      k1x = n1*nqp*2;
      k1y = k1x+nqp;
      k2x = n2*nqp*2;
      k2y = k2x+nqp;
      for (int k=0; k<nqp; k++){
	a          =(5.*p[k1+k]+p[k2+k])*third;
	px[k1x+k] += Ax*a;
	px[k1y+k] += Ay*a;
	a          =(p[k1+k]+5.*p[k2+k])*third;
	px[k2x+k] += Ax*a;
	px[k2y+k] += Ay*a;
      }}
    for (int n=0; n<nNode; n++){ //normalize gradients
      a  = .5/v(n);
      k1 = n*nqp*2;
      for (int k=0; k<nqp*2; k++) px[k1+k] *= a;
    }}


  else if (order == 3){ //FEM gradients
    int k1x,k1y,k2,k3;
    double dx,dy;
    for (int n=0; n<nNode; n++){
      k1x = n*nqp*2;
      k1y = k1x+nqp;
      for(int i=psp2(n); i<psp2(n+1); i++){
	k2 = psp1(i)*nqp;
	dx = gx(i,0);
	dy = gx(i,1);
	for (int k=0; k<nqp; k++){
	  k3         = k2+k;
	  px[k1x+k] += p[k3]*dx;
	  px[k1y+k] += p[k3]*dy;
	}}}}
}