/* Last edited on 2009-07-24 14:22:22 by stolfilocal */ /*************************************************************************** * Copyright (C) 2009 by Douglas Castro * * douglas@ime.unicamp.br * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "arvore.h" #include "bool.h" #include "definicoes.h" #include "inicializa.h" #include "imprime.h" #include "timestep.h" #include "interp_integ.h" #include "gnuplot_i.h" #define SLEEP_LGTH 1 #define SLEEP_LGTH1 2 #define OUT_PREFIX "out" int main(int argc, char *argv[]) { int d = 1; int niv = 7, profund = 0, indice = 1; double eps = 0.0; double xmin[] = {-1.0}; double xmax[] = {1.0}; // DoEPSTests(OUT_PREFIX); /* velocidade */ double c = 1.0; /* niv diz quantos niveis de resolucao tem a arvore mas nao que no ultimo nivel tenha 2^niv celulas, corrigindo... */ /* Nivel de resolucao */ int L = niv+1;/* 7, 8, 9, 10 */ Funcao *f = &condicaoinicial; /* inicializacao */ int tm = pow(5,d); double fval[tm]; int kx, ky=0; for (kx = 0; kx < 5; kx++) { double xlo[] = {xmin[0] + (-2.0 + kx)*(xmax[0] - xmin[0])}; double xhi[] = {xmin[0] + (-1.0 + kx)*(xmax[0] - xmin[0])}; double fint = integra(d, xlo, xhi, condicaoinicial); fval[5*ky + kx] = fint/((xhi[0]-xlo[0])); } No *u = malloc(sizeof(No)); u->fil[0] = NULL; u->fil[1] = NULL; u->deletable = FALSE;u->leaf = FALSE; u->virtual_leaf = FALSE;u->fval = fval[(int)tm/2]; // No *u = completa(d, L, profund, indice, xmin, xmax, f, integra); // No *v = completa(d, niv, profund, indice, xmin, xmax, NULL, integra); // No *pc[] = {NULL,NULL, u, NULL, NULL}; // No *pc[] = {v, v, u, v, v}; // roubando pra podar os galohs da fronteira /* COMO SERA UMA SOLUCAO INTELIGENTE PRA IMPLEMENTAR A CONDICAO DE CONTORNO? */ No *pc[] = {NULL, u, u, u, NULL}; // teste pra ver se da a condicao de contorno periodica VNo pac[5]; int i; for(i=0;i<5;i++) { pac[i].p = pc[i]; pac[i].fv = fval[i]; } int lim; double esq[] = {1.0, 1.0}; // so vai interferir p profund >= 4 double dir[] = {1.0, 1.0}; printf("podando\n"); // poda_arvore(d, L, pac, xmin, xmax, profund, interpola_quad, /*fpoda*/ 1.0, eps); for(lim=1;lim