freefem3d-1.0pre10/0002777000175000017500000000000010643717126011100 500000000000000freefem3d-1.0pre10/py-compile0000755000175000017500000000474507624207261013027 00000000000000#!/bin/sh # py-compile - Compile a Python program # Copyright 2000, 2001 Free Software Foundation, Inc. # 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, 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. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # called as "py-compile [--basedir DIR] PY_FILES ... if [ -z "$PYTHON" ]; then PYTHON=python fi basedir= case "$1" in --basedir) basedir=$2 shift 2 ;; --help) echo "Usage: py-compile [--basedir DIR] PY_FILES ..." echo "Byte compile some python scripts. This should be performed" echo "after they have been moved to the final installation location" exit 0 ;; --version) echo "py-compile version 0.0" exit 0 ;; esac if [ $# = 0 ]; then echo "No files given to $0" 1>&2 exit 1 fi # if basedir was given, then it should be prepended to filenames before # byte compilation. if [ -z "$basedir" ]; then trans="path = file" else trans="path = os.path.join('$basedir', file)" fi $PYTHON -c " import sys, os, string, py_compile files = '''$*''' print 'Byte-compiling python modules...' for file in string.split(files): $trans if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): continue print file, sys.stdout.flush() py_compile.compile(path) print" || exit $? # this will fail for python < 1.5, but that doesn't matter ... $PYTHON -O -c " import sys, os, string, py_compile files = '''$*''' print 'Byte-compiling python modules (optimised versions) ...' for file in string.split(files): $trans if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): continue print file, sys.stdout.flush() py_compile.compile(path) print" 2>/dev/null || : freefem3d-1.0pre10/TODO0000644000175000017500000000206610413746776011516 00000000000000$Id: TODO,v 1.4 2006/04/02 13:13:34 delpinux Exp $ * Code Rearrange code for surface meshes and internal faces groups. This sould lead to remove the motherCell() function in Triangle and Quadrangle! o [delpino] Configuration Display sumary of ./configure run * Optimization Use AutoPointer instead of ReferenceCounting for Discretizations : should be faster but need modifying Autopointer... o [delpino] Code design Should change boundary conditions in solver part merging variational problems and pde problems to simplify code and then avoid bugs. * Algebra: TinyMatrix() should be initialized to nothing (actually it is 0) * Boundary conditions - Fat boundary method. - Lagrange multipliers surface/volume. * DDM and parallel computing: everything is to implement * CSG & VR Finish POV-Ray parser rewrite. * Language Make version 3 of it, spliting the syntaxical and sementical analysis. o [Pascal & Cecile] Mesh - Surface mesh generation Improve it: mainly needed for Lagrange multipliers methods * Others: - post-treatment simplify it freefem3d-1.0pre10/language/0002777000175000017500000000000010643717122012657 500000000000000freefem3d-1.0pre10/language/FunctionExpressionVariable.hpp0000644000175000017500000000643410624156366020632 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionVariable.hpp,v 1.3 2007/05/20 23:15:36 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_VARIABLE_HPP #define FUNCTION_EXPRESSION_VARIABLE_HPP #include #include #include /** * @file FunctionExpressionVariable.hpp * @author Stephane Del Pino * @date Wed Jul 19 11:44:32 2006 * * @brief Manages function expression variables * */ class FunctionExpressionVariable : public FunctionExpression { private: /** * writes an expression * * @param os output stream * * @return os */ std::ostream& put(std::ostream& os) const; const std::string __functionName; ReferenceCounting __functionVariable; /**< the function variable */ DiscretizationType::Type __discretizationType; /**< Variables can be related to discretization types */ public: /** * Checks if the variable requires a boundary for evaluation * * * @return @b true if __functionVariable requires a boundary */ bool hasBoundaryExpression() const { return __functionVariable->expression()->hasBoundaryExpression(); } /** * Subscribe the variable * */ void subscribe() { __functionVariable->subscribe(); } /** * Un-substrcibe the variable * */ void unsubscribe() { __functionVariable->unsubscribe(); } /** * Read only access to the discretization type * * @return __discretizationType */ const DiscretizationType::Type& discretizationType() const { return __discretizationType; } /** * Read only access to the variable * * @return __functionVariable */ ConstReferenceCounting variable() const; /** * Access to the variable * * @return __functionVariable */ ReferenceCounting variable(); /** * Executes the function expression * */ void execute(); /** * Constructor * * @param functionName name of the variable * @param type a discretization type */ FunctionExpressionVariable(const std::string& functionName, const DiscretizationType::Type& type = DiscretizationType::lagrangianFEM1); /** * Copy constructor * * @param functionVariable name of the variable */ FunctionExpressionVariable(const FunctionExpressionVariable& functionVariable); /** * Destructor * */ ~FunctionExpressionVariable(); }; #endif // FUNCTION_EXPRESSION_VARIABLE_HPP freefem3d-1.0pre10/language/Makefile.in0000644000175000017500000010121210633012162014622 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # -*- Mode: makefile -*- # This file is part of ff3d - http://www.freefem.org/ff3d # Copyright (C) 2001, 2002, 2003 Stéphane Del Pino # 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, 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. # $Id: Makefile.am,v 1.27 2007/06/10 15:00:07 delpinux Exp $ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = language DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in parse.ff.cc parse.pov.cc parse.xml.cc \ ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/m4/compile.m4 $(top_srcdir)/m4/vtk.m4 \ $(top_srcdir)/m4/qt.m4 $(top_srcdir)/m4/gui.m4 \ $(top_srcdir)/m4/pthread.m4 $(top_srcdir)/m4/petsc.m4 \ $(top_srcdir)/m4/mpi.m4 $(top_srcdir)/m4/documentation.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru libfflanguage_a_AR = $(AR) $(ARFLAGS) libfflanguage_a_LIBADD = am_libfflanguage_a_OBJECTS = FFLexer.$(OBJEXT) \ BooleanExpression.$(OBJEXT) \ BoundaryConditionExpression.$(OBJEXT) \ BoundaryConditionExpressionDirichlet.$(OBJEXT) \ BoundaryConditionExpressionFourrier.$(OBJEXT) \ BoundaryConditionExpressionNeumann.$(OBJEXT) \ BoundaryConditionListExpression.$(OBJEXT) \ BoundaryExpression.$(OBJEXT) BoundaryExpressionList.$(OBJEXT) \ BoundaryExpressionPOVRay.$(OBJEXT) \ BoundaryExpressionReferences.$(OBJEXT) \ BoundaryExpressionSurfaceMesh.$(OBJEXT) \ DomainExpression.$(OBJEXT) DomainExpressionAnalytic.$(OBJEXT) \ DomainExpressionSet.$(OBJEXT) \ DomainExpressionUndefined.$(OBJEXT) \ DomainExpressionVariable.$(OBJEXT) EmbededFunctions.$(OBJEXT) \ FieldExpression.$(OBJEXT) FieldExpressionList.$(OBJEXT) \ FunctionExpression.$(OBJEXT) \ FunctionExpressionBinaryOperation.$(OBJEXT) \ FunctionExpressionCFunction.$(OBJEXT) \ FunctionExpressionComposed.$(OBJEXT) \ FunctionExpressionConstant.$(OBJEXT) \ FunctionExpressionConvection.$(OBJEXT) \ FunctionExpressionDerivative.$(OBJEXT) \ FunctionExpressionDomainCharacteristic.$(OBJEXT) \ FunctionExpressionFEM.$(OBJEXT) \ FunctionExpressionIntegrate.$(OBJEXT) \ FunctionExpressionLinearBasis.$(OBJEXT) \ FunctionExpressionMeshCharacteristic.$(OBJEXT) \ FunctionExpressionMeshReferences.$(OBJEXT) \ FunctionExpressionNormalComponent.$(OBJEXT) \ FunctionExpressionNot.$(OBJEXT) \ FunctionExpressionObjectCharacteristic.$(OBJEXT) \ FunctionExpressionRead.$(OBJEXT) \ FunctionExpressionSpectral.$(OBJEXT) \ FunctionExpressionUnaryMinus.$(OBJEXT) \ FunctionExpressionValue.$(OBJEXT) \ FunctionExpressionVariable.$(OBJEXT) Information.$(OBJEXT) \ Instruction.$(OBJEXT) InsideListExpression.$(OBJEXT) \ MeshExpression.$(OBJEXT) MultiLinearExpression.$(OBJEXT) \ MultiLinearExpressionSum.$(OBJEXT) \ OFStreamExpressionVariable.$(OBJEXT) \ OStreamExpression.$(OBJEXT) PDEOperatorExpression.$(OBJEXT) \ PDEOperatorSumExpression.$(OBJEXT) \ PDEEquationExpression.$(OBJEXT) PDEProblemExpression.$(OBJEXT) \ PDESystemExpression.$(OBJEXT) RealExpression.$(OBJEXT) \ SceneExpression.$(OBJEXT) SolverExpression.$(OBJEXT) \ StringExpression.$(OBJEXT) SubOptionExpression.$(OBJEXT) \ TestFunctionExpressionList.$(OBJEXT) \ UnknownExpressionDeclaration.$(OBJEXT) \ UnknownExpressionFunction.$(OBJEXT) \ UnknownListExpression.$(OBJEXT) Variable.$(OBJEXT) \ VariableLexerRepository.$(OBJEXT) VariableRepository.$(OBJEXT) \ VariationalDirichletListExpression.$(OBJEXT) \ VariationalFormulaExpression.$(OBJEXT) \ VariationalProblemExpression.$(OBJEXT) \ Vector3Expression.$(OBJEXT) parse.ff.$(OBJEXT) libfflanguage_a_OBJECTS = $(am_libfflanguage_a_OBJECTS) libpovlanguage_a_AR = $(AR) $(ARFLAGS) libpovlanguage_a_LIBADD = am_libpovlanguage_a_OBJECTS = POVLexer.$(OBJEXT) parse.pov.$(OBJEXT) libpovlanguage_a_OBJECTS = $(am_libpovlanguage_a_OBJECTS) libxmllanguage_a_AR = $(AR) $(ARFLAGS) libxmllanguage_a_LIBADD = am_libxmllanguage_a_OBJECTS = XMLLexer.$(OBJEXT) parse.xml.$(OBJEXT) libxmllanguage_a_OBJECTS = $(am_libxmllanguage_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) LTYACCCOMPILE = $(LIBTOOL) --mode=compile $(YACC) $(YFLAGS) \ $(AM_YFLAGS) YLWRAP = $(top_srcdir)/ylwrap COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libfflanguage_a_SOURCES) $(libpovlanguage_a_SOURCES) \ $(libxmllanguage_a_SOURCES) DIST_SOURCES = $(libfflanguage_a_SOURCES) $(libpovlanguage_a_SOURCES) \ $(libxmllanguage_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILT_GUI_FALSE = @BUILT_GUI_FALSE@ BUILT_GUI_TRUE = @BUILT_GUI_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GENERATE_DOCUMENTATION_FALSE = @GENERATE_DOCUMENTATION_FALSE@ GENERATE_DOCUMENTATION_TRUE = @GENERATE_DOCUMENTATION_TRUE@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LATEX = @LATEX@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINDEX = @MAKEINDEX@ MAKEINFO = @MAKEINFO@ MOC = @MOC@ MPI_CXXFLAGS = @MPI_CXXFLAGS@ MPI_LDADD = @MPI_LDADD@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PDFLATEX = @PDFLATEX@ PETSC_CXXFLAGS = @PETSC_CXXFLAGS@ PETSC_LDADD = @PETSC_LDADD@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ QT_CXXFLAGS = @QT_CXXFLAGS@ QT_LDADD = @QT_LDADD@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UIC = @UIC@ USES_PETSC_FALSE = @USES_PETSC_FALSE@ USES_PETSC_TRUE = @USES_PETSC_TRUE@ VERSION = @VERSION@ VTK_CXXFLAGS = @VTK_CXXFLAGS@ VTK_LDADD = @VTK_LDADD@ XMKMF = @XMKMF@ YACC = @YACC@ YFLAGS = @YFLAGS@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ acx_pthread_config = @acx_pthread_config@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_HEADERS = \ BooleanExpression.hpp \ BoundaryConditionExpression.hpp \ BoundaryConditionExpressionDirichlet.hpp \ BoundaryConditionExpressionFourrier.hpp \ BoundaryConditionExpressionNeumann.hpp \ BoundaryConditionListExpression.hpp \ BoundaryExpression.hpp \ BoundaryExpressionList.hpp \ BoundaryExpressionPOVRay.hpp \ BoundaryExpressionSurfaceMesh.hpp \ BoundaryExpressionReferences.hpp \ DomainExpression.hpp \ DomainExpressionAnalytic.hpp \ DomainExpressionSet.hpp \ DomainExpressionUndefined.hpp \ DomainExpressionVariable.hpp \ EmbededFunctions.hpp \ Expression.hpp \ FFLexer.hpp \ FieldExpression.hpp \ FieldExpressionList.hpp \ FunctionExpression.hpp \ FunctionExpressionBinaryOperation.hpp \ FunctionExpressionCFunction.hpp \ FunctionExpressionComposed.hpp \ FunctionExpressionConstant.hpp \ FunctionExpressionConvection.hpp \ FunctionExpressionDerivative.hpp \ FunctionExpressionDomainCharacteristic.hpp \ FunctionExpressionFEM.hpp \ FunctionExpressionIntegrate.hpp \ FunctionExpressionLinearBasis.hpp \ FunctionExpressionMeshCharacteristic.hpp \ FunctionExpressionMeshReferences.hpp \ FunctionExpressionNormalComponent.hpp \ FunctionExpressionNot.hpp \ FunctionExpressionObjectCharacteristic.hpp \ FunctionExpressionRead.hpp \ FunctionExpressionSpectral.hpp \ FunctionExpressionUnaryMinus.hpp \ FunctionExpressionValue.hpp \ FunctionExpressionVariable.hpp \ Information.hpp \ InsideExpression.hpp \ InsideListExpression.hpp \ Instruction.hpp \ IntegratedExpression.hpp \ IntegratedOperatorExpression.hpp \ Lexer.hpp \ LinearExpression.hpp \ MeshExpression.hpp \ MultiLinearExpression.hpp \ MultiLinearExpressionSum.hpp \ MultiLinearFormExpression.hpp \ OptionExpression.hpp \ OFStreamExpression.hpp \ OFStreamExpressionUndefined.hpp \ OFStreamExpressionValue.hpp \ OFStreamExpressionVariable.hpp \ OStreamExpression.hpp \ OStreamExpressionList.hpp \ PDEEquationExpression.hpp \ PDEOperatorExpression.hpp \ PDEOperatorSumExpression.hpp \ PDEProblemExpression.hpp \ PDESystemExpression.hpp \ POVLexer.hpp \ ProblemExpression.hpp \ RealExpression.hpp \ SceneExpression.hpp \ SolutionExpression.hpp \ SolverExpression.hpp \ SolverOptionsExpression.hpp \ StringExpression.hpp \ SubOptionExpression.hpp \ SubOptionListExpression.hpp \ TestFunctionExpressionList.hpp \ UnknownExpression.hpp \ UnknownExpressionDeclaration.hpp \ UnknownExpressionFunction.hpp \ UnknownListExpression.hpp \ Variable.hpp \ VariableLexerRepository.hpp \ VariableRepository.hpp \ VariationalDirichletListExpression.hpp \ VariationalFormulaExpression.hpp \ VariationalOperatorExpression.hpp \ VariationalProblemExpression.hpp \ Vector3Expression.hpp \ XMLLexer.hpp \ parse.ff.hpp \ parse.pov.hpp noinst_LIBRARIES = \ libfflanguage.a \ libpovlanguage.a \ libxmllanguage.a libfflanguage_a_SOURCES = \ FFLexer.cpp \ \ BooleanExpression.cpp \ BoundaryConditionExpression.cpp \ BoundaryConditionExpressionDirichlet.cpp \ BoundaryConditionExpressionFourrier.cpp \ BoundaryConditionExpressionNeumann.cpp \ BoundaryConditionListExpression.cpp \ BoundaryExpression.cpp \ BoundaryExpressionList.cpp \ BoundaryExpressionPOVRay.cpp \ BoundaryExpressionReferences.cpp \ BoundaryExpressionSurfaceMesh.cpp \ DomainExpression.cpp \ DomainExpressionAnalytic.cpp \ DomainExpressionSet.cpp \ DomainExpressionUndefined.cpp \ DomainExpressionVariable.cpp \ EmbededFunctions.cpp \ FieldExpression.cpp \ FieldExpressionList.cpp \ FunctionExpression.cpp \ FunctionExpressionBinaryOperation.cpp \ FunctionExpressionCFunction.cpp \ FunctionExpressionComposed.cpp \ FunctionExpressionConstant.cpp \ FunctionExpressionConvection.cpp \ FunctionExpressionDerivative.cpp \ FunctionExpressionDomainCharacteristic.cpp \ FunctionExpressionFEM.cpp \ FunctionExpressionIntegrate.cpp \ FunctionExpressionLinearBasis.cpp \ FunctionExpressionMeshCharacteristic.cpp \ FunctionExpressionMeshReferences.cpp \ FunctionExpressionNormalComponent.cpp \ FunctionExpressionNot.cpp \ FunctionExpressionObjectCharacteristic.cpp \ FunctionExpressionRead.cpp \ FunctionExpressionSpectral.cpp \ FunctionExpressionUnaryMinus.cpp \ FunctionExpressionValue.cpp \ FunctionExpressionVariable.cpp \ Information.cpp \ Instruction.cpp \ InsideListExpression.cpp \ MeshExpression.cpp \ MultiLinearExpression.cpp \ MultiLinearExpressionSum.cpp \ OFStreamExpressionVariable.cpp \ OStreamExpression.cpp \ PDEOperatorExpression.cpp \ PDEOperatorSumExpression.cpp \ PDEEquationExpression.cpp \ PDEProblemExpression.cpp \ PDESystemExpression.cpp \ RealExpression.cpp \ SceneExpression.cpp \ SolverExpression.cpp \ StringExpression.cpp \ SubOptionExpression.cpp \ TestFunctionExpressionList.cpp \ UnknownExpressionDeclaration.cpp \ UnknownExpressionFunction.cpp \ UnknownListExpression.cpp \ Variable.cpp \ VariableLexerRepository.cpp \ VariableRepository.cpp \ VariationalDirichletListExpression.cpp \ VariationalFormulaExpression.cpp \ VariationalProblemExpression.cpp \ Vector3Expression.cpp \ parse.ff.yy libpovlanguage_a_SOURCES = \ POVLexer.cpp \ parse.pov.yy libxmllanguage_a_SOURCES = \ XMLLexer.cpp \ parse.xml.yy CLEANFILES = \ parse.ff.cc \ parse.ff.h \ parse.ff.output \ parse.pov.cc \ parse.pov.h \ parse.pov.output \ parse.xml.cc \ parse.xml.h \ parse.xml.output BUILT_SOURCES = \ parse.ff.cc \ parse.ff.h \ parse.pov.cc \ parse.pov.h \ parse.xml.cc \ parse.xml.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cc .cpp .lo .o .obj .yy $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu language/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu language/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libfflanguage.a: $(libfflanguage_a_OBJECTS) $(libfflanguage_a_DEPENDENCIES) -rm -f libfflanguage.a $(libfflanguage_a_AR) libfflanguage.a $(libfflanguage_a_OBJECTS) $(libfflanguage_a_LIBADD) $(RANLIB) libfflanguage.a libpovlanguage.a: $(libpovlanguage_a_OBJECTS) $(libpovlanguage_a_DEPENDENCIES) -rm -f libpovlanguage.a $(libpovlanguage_a_AR) libpovlanguage.a $(libpovlanguage_a_OBJECTS) $(libpovlanguage_a_LIBADD) $(RANLIB) libpovlanguage.a libxmllanguage.a: $(libxmllanguage_a_OBJECTS) $(libxmllanguage_a_DEPENDENCIES) -rm -f libxmllanguage.a $(libxmllanguage_a_AR) libxmllanguage.a $(libxmllanguage_a_OBJECTS) $(libxmllanguage_a_LIBADD) $(RANLIB) libxmllanguage.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BooleanExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryConditionExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryConditionExpressionDirichlet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryConditionExpressionFourrier.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryConditionExpressionNeumann.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryConditionListExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryExpressionList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryExpressionPOVRay.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryExpressionReferences.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BoundaryExpressionSurfaceMesh.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DomainExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DomainExpressionAnalytic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DomainExpressionSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DomainExpressionUndefined.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DomainExpressionVariable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EmbededFunctions.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FFLexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FieldExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FieldExpressionList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionBinaryOperation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionCFunction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionComposed.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionConstant.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionConvection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionDerivative.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionDomainCharacteristic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionFEM.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionIntegrate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionLinearBasis.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionMeshCharacteristic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionMeshReferences.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionNormalComponent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionNot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionObjectCharacteristic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionRead.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionSpectral.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionUnaryMinus.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionValue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionExpressionVariable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Information.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InsideListExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Instruction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MeshExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiLinearExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiLinearExpressionSum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OFStreamExpressionVariable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OStreamExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PDEEquationExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PDEOperatorExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PDEOperatorSumExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PDEProblemExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PDESystemExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/POVLexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RealExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SceneExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SolverExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StringExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SubOptionExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestFunctionExpressionList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnknownExpressionDeclaration.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnknownExpressionFunction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnknownListExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Variable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VariableLexerRepository.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VariableRepository.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VariationalDirichletListExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VariationalFormulaExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VariationalProblemExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vector3Expression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XMLLexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.ff.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.pov.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.xml.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: @am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< .yy.cc: $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f parse.ff.cc -rm -f parse.pov.cc -rm -f parse.xml.cc -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-info-am parse.ff.cc parse.ff.h: $(srcdir)/parse.ff.yy $(YACC) -p ff -o parse.ff.cc --defines="parse.ff.h" -v $< parse.pov.cc parse.pov.h: $(srcdir)/parse.pov.yy $(YACC) -p pov -o parse.pov.cc --defines="parse.pov.h" -v $< parse.xml.cc parse.xml.h: $(srcdir)/parse.xml.yy $(YACC) -p xml -o parse.xml.cc --defines="parse.xml.h" -v $< # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freefem3d-1.0pre10/language/DomainExpressionVariable.hpp0000644000175000017500000000305510562730012020233 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpressionVariable.hpp,v 1.2 2007/02/08 23:19:38 delpinux Exp $ #ifndef DOMAIN_EXPRESSION_VARIABLE_HPP #define DOMAIN_EXPRESSION_VARIABLE_HPP #include #include class DomainExpressionVariable : public DomainExpression { private: const std::string __domainName; ReferenceCounting __domainVariable; std::ostream& put(std::ostream& os) const { os << __domainName; return os; } public: void execute(); ReferenceCounting domainExpression() const; DomainExpressionVariable(const std::string& domainName); DomainExpressionVariable(const DomainExpressionVariable& e); ~DomainExpressionVariable(); }; #endif // DOMAIN_EXPRESSION_VARIABLE_HPP freefem3d-1.0pre10/language/DomainExpressionSet.hpp0000644000175000017500000000305010561425532017243 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpressionSet.hpp,v 1.1 2006/09/28 19:05:34 delpinux Exp $ #ifndef DOMAIN_EXPRESSION_SET_HPP #define DOMAIN_EXPRESSION_SET_HPP #include class SceneExpression; class InsideListExpression; class DomainExpressionSet : public DomainExpression { private: ReferenceCounting __scene; ReferenceCounting __definition; std::ostream& put(std::ostream& os) const; public: ReferenceCounting scene(); void execute(); DomainExpressionSet(ReferenceCounting s, ReferenceCounting def); DomainExpressionSet(const DomainExpressionSet& m); ~DomainExpressionSet(); }; #endif // DOMAIN_EXPRESSION_SET_HPP freefem3d-1.0pre10/language/EmbededFunctions.cpp0000644000175000017500000000735610603253060016516 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: EmbededFunctions.cpp,v 1.4 2007/03/30 18:25:52 delpinux Exp $ #include // unary operators real_t unaryMinus(real_t x) { return -x; } bool not_(bool a) { return not(a); } // binary operators real_t modulo(real_t x, real_t y) { int a = static_cast(x); int b = static_cast(y); return a%b; } real_t sum(real_t x, real_t y) { return x+y; } real_t difference(real_t x, real_t y) { return x-y; } real_t division(real_t x, real_t y) { return x/y; } real_t product(real_t x, real_t y) { return x*y; } // Binary Bool operators. bool gt(real_t x, real_t y) { return (x > y); } bool lt(real_t x, real_t y) { return (x < y); } bool ge(real_t x, real_t y) { return (x >= y); } bool le(real_t x, real_t y) { return (x <= y); } bool eq(real_t x, real_t y) { return (x == y); } bool ne(real_t x, real_t y) { return (x != y); } bool and_(bool a, bool b) { return (a and b); } bool or_(bool a, bool b) { return (a or b); } bool xor_(bool a, bool b) { return (a xor b); } template<> std::ostream& functionName(std::ostream& os) { os << "log"; return os; } template<> std::ostream& functionName(std::ostream& os) { os << "sin"; return os; } template<> std::ostream& functionName(std::ostream& os) { os << "cos"; return os; } template<> std::ostream& functionName(std::ostream& os) { os << "tan"; return os; } template<> std::ostream& functionName(std::ostream& os) { os << "asin"; return os; } template<> std::ostream& functionName(std::ostream& os) { os << "acos"; return os; } template<> std::ostream& functionName(std::ostream& os) { os << "atan"; return os; } template<> std::ostream& functionName(std::ostream& os) { os << "exp"; return os; } template<> std::ostream& functionName(std::ostream& os) { os << "abs"; return os; } template<> std::ostream& functionName(std::ostream& os) { os << "sqrt"; return os; } template <> std::ostream& operatorName(std::ostream& os) { os << '>'; return os; } template <> std::ostream& operatorName(std::ostream& os) { os << '<'; return os; } template <> std::ostream& operatorName(std::ostream& os) { os << ">="; return os; } template <> std::ostream& operatorName(std::ostream& os) { os << "<="; return os; } template <> std::ostream& operatorName(std::ostream& os) { os << "=="; return os; } template <> std::ostream& operatorName(std::ostream& os) { os << "!="; return os; } template <> std::ostream& binaryBooleanName(std::ostream& os) { os << "and"; return os; } template <> std::ostream& binaryBooleanName(std::ostream& os) { os << "or"; return os; } template <> std::ostream& binaryBooleanName(std::ostream& os) { os << "xor"; return os; } template <> std::ostream& unaryBooleanName(std::ostream& os) { os << "not"; return os; } freefem3d-1.0pre10/language/VariableRepository.hpp0000644000175000017500000000612110624156366017135 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariableRepository.hpp,v 1.2 2007/05/20 23:02:48 delpinux Exp $ #ifndef VARIABLE_PARSER_REPOSITORY_HPP #define VARIABLE_PARSER_REPOSITORY_HPP #include #include #include #include #include #include /** * @file VariableRepository.hpp * @author Stéphane Del Pino * @date Sat Feb 10 14:57:45 2007 * * @brief Variable repository during execution */ class VariableRepository : public ThreadStaticBase { private: //! The container of variables. typedef std::map > Container; std::vector __variableList; /**< list of variable per level */ size_t __blockLevel; /**< current level */ VariableRepository(const VariableRepository& vpr); public: /** * Search for a variable according to its name * * @param name name of the variable * * @return pointer to the variable */ ReferenceCounting find(const std::string& name) const; /** * Search for a variable and returns a pointer to it * * @param name name of the variable * * @return pointer of the correct type to the variable */ template ReferenceCounting findVariable(const std::string& name) const { ReferenceCounting reference = this->find(name); Variable* variable = reference; ASSERT(variable != 0); VariableType* castedVariable = dynamic_cast(variable); if(not(castedVariable)) { throw ErrorHandler(__FILE__,__LINE__, "cannot cast "+name +" of type "+stringify(variable->type()), ErrorHandler::unexpected); } return castedVariable; } /** * Adds the variable @p v to the list * * @param v variable to add */ void add(ReferenceCounting v); /** * Remove a variable named @p name * * @param name name of the variable to remove */ void remove(const std::string& name); /** * Begins a new block * */ void beginBlock(); /** * Ends a new block * */ void endBlock(); /** * Constructor * */ VariableRepository(); /** * Destructor * */ ~VariableRepository(); }; #endif // VARIABLE_PARSER_REPOSITORY_HPP freefem3d-1.0pre10/language/FunctionExpressionDomainCharacteristic.hpp0000644000175000017500000000417610561425532023160 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionDomainCharacteristic.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_DOMAIN_CHARACTERISTIC_HPP #define FUNCTION_EXPRESSION_DOMAIN_CHARACTERISTIC_HPP #include class DomainExpression; /** * @file FunctionExpressionDomainCharacteristic.hpp * @author Stephane Del Pino * @date Tue Jul 4 01:47:23 2006 * * @brief Characteristic function of a domain * */ class FunctionExpressionDomainCharacteristic : public FunctionExpression { private: ReferenceCounting __domain; /**< domain expression */ /** * Overloading of the put function * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * execute the expression * */ void execute(); /** * Constructor * * @param D domain expression * */ FunctionExpressionDomainCharacteristic(ReferenceCounting D); /** * Copy constructor * * @param f given function expression of the characteristic function of a domain * */ FunctionExpressionDomainCharacteristic(const FunctionExpressionDomainCharacteristic& f); /** * Destructor * */ ~FunctionExpressionDomainCharacteristic(); }; #endif // FUNCTION_EXPRESSION_DOMAIN_CHARACTERISTIC_HPP freefem3d-1.0pre10/language/StringExpression.cpp0000644000175000017500000000271210561425532016625 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: StringExpression.cpp,v 1.2 2004/11/28 18:15:47 delpinux Exp $ #include #include #include void StringExpressionReal::execute() { (*__realExpression).execute(); __stringExpressionValue = stringify((*__realExpression).realValue()); } StringExpressionReal::StringExpressionReal(ReferenceCounting r) : __realExpression(r) { ; } StringExpressionReal::StringExpressionReal(const StringExpressionReal& re) : __stringExpressionValue(re.__stringExpressionValue), __realExpression(re.__realExpression) { ; } StringExpressionReal::~StringExpressionReal() { ; } freefem3d-1.0pre10/language/Instruction.cpp0000644000175000017500000002245210624156366015631 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: Instruction.cpp,v 1.31 2007/05/20 23:22:26 delpinux Exp $ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void InstructionExec::execute() { __command->execute(); std::string command = __command->value(); ffout(2) << "executing: " << command << '\n'; #ifdef ALLOW_EXEC int result = system(command.c_str()); if (result == -1) { throw ErrorHandler(__FILE__,__LINE__, "could not execute: "+command, ErrorHandler::normal); } #else // ALLOW_EXEC fferr(2) << "warning: this version was not compiled with 'exec' support.\n"; #endif // ALLOW_EXEC } InstructionExec::InstructionExec(ReferenceCounting command) : Instruction(Instruction::exec), __command(command) { ; } InstructionExec::InstructionExec(const InstructionExec& I) : Instruction(I), __command(I.__command) { ; } InstructionExec:: ~InstructionExec() { ; } void InstructionCat::execute() { __filename->execute(); const std::string filename = __filename->value(); std::ifstream fin(filename.c_str()); if (not fin) { throw ErrorHandler(__FILE__,__LINE__, "could not open file \""+filename+"\"", ErrorHandler::normal); } char c = fin.get(); while (not(fin.eof())) { ffout(0) << c; c = fin.get(); } } InstructionCat:: InstructionCat(ReferenceCounting filename) : Instruction(Instruction::cat), __filename(filename) { ; } InstructionCat:: InstructionCat(const InstructionCat& I) : Instruction(I), __filename(I.__filename) { ; } InstructionCat:: ~InstructionCat() { ; } InstructionSave:: InstructionSave(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting mesh) : Instruction(Instruction::save), __fileDescriptor(descriptor), __fileName(fileName), __mesh(mesh) { ; } InstructionSave::InstructionSave(const InstructionSave& I) : Instruction(I), __fileDescriptor(I.__fileDescriptor), __fileName(I.__fileName), __mesh(I.__mesh) { ; } InstructionSave::~InstructionSave() { ; } InstructionSaveMesh:: InstructionSaveMesh(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting mesh) : InstructionSave(descriptor, fileName, mesh) { ; } InstructionSaveMesh:: InstructionSaveMesh(const InstructionSaveMesh& I) : InstructionSave(I) { ; } InstructionSaveMesh:: ~InstructionSaveMesh() { ; } void InstructionSaveMesh::execute() { __mesh->execute(); __fileName->execute(); Information::instance().setMesh(__mesh->mesh()); const std::string CR = __fileDescriptor->cr(); ReferenceCounting writer; switch(__fileDescriptor->format()) { case FileDescriptor::medit: { writer = new WriterMedit(__mesh->mesh(), __fileName->value(), __fileDescriptor->cr()); break; } case FileDescriptor::raw: { writer = new WriterRaw(__mesh->mesh(), __fileName->value(), __fileDescriptor->cr()); break; } case FileDescriptor::vtk: { writer = new WriterVTK(__mesh->mesh(), __fileName->value(), __fileDescriptor->cr()); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "file type \""+__fileDescriptor->toString()+'\"', ErrorHandler::unexpected); } } writer->proceed(); //! The mesh is nomore used in this region. Information::instance().unsetMesh(); } void InstructionAffectation:: execute() { __expression->execute(); ConstReferenceCounting newValue = __expression->function(); FunctionVariable* functionVariable = VariableRepository::instance().findVariable(__variableName); ConstReferenceCounting f = functionVariable->expression(); const ScalarFunctionBase& scalarFunction = *f->function(); switch(scalarFunction.type()) { case ScalarFunctionBase::femfunction: { const FEMFunctionBase& femFunction = dynamic_cast(scalarFunction); Information::instance().setMesh(femFunction.baseMesh()); FEMFunctionBuilder builder; builder.build(femFunction.discretizationType(), femFunction.baseMesh(), *newValue); (*functionVariable) = new FunctionExpressionValue(builder.getBuiltScalarFunction(), false); Information::instance().unsetMesh(); break; } case ScalarFunctionBase::spectral: { const SpectralFunction& spectralFunction = dynamic_cast(scalarFunction); (*functionVariable) = new FunctionExpressionValue(new SpectralFunction(spectralFunction.mesh(), *newValue),false); break; } default: { (*functionVariable) = __expression; } } } InstructionSaveFieldList:: InstructionSaveFieldList(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting fieldList, ReferenceCounting mesh) : InstructionSave(descriptor,fileName,mesh), __fieldList(fieldList) { ; } InstructionSaveFieldList:: InstructionSaveFieldList(const InstructionSaveFieldList& I) : InstructionSave(I), __fieldList(I.__fieldList) { ; } InstructionSaveFieldList:: ~InstructionSaveFieldList() { ; } void InstructionSaveFieldList:: execute() { __mesh->execute(); __fieldList->execute(); __fileName->execute(); Information::instance().setMesh(__mesh->mesh()); const std::string CR = __fileDescriptor->cr(); ReferenceCounting writer; switch(__fileDescriptor->format()) { case FileDescriptor::medit: { writer = new WriterMedit(__mesh->mesh(), __fileName->value(), __fileDescriptor->cr()); break; } case FileDescriptor::raw: { writer = new WriterRaw(__mesh->mesh(), __fileName->value(), __fileDescriptor->cr()); break; } case FileDescriptor::vtk: { writer = new WriterVTK(__mesh->mesh(), __fileName->value(), __fileDescriptor->cr()); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "file type \""+__fileDescriptor->toString()+'\"', ErrorHandler::unexpected); } } for (size_t iList = 0; iList<__fieldList->numberOfFields(); ++iList) { ReferenceCounting field = __fieldList->field(iList); switch(field->numberOfComponents()) { case 0: { break; } case 1: { writer->add(field->field()->function(0)); break; } default: { writer->add(field->field()); } } } writer->proceed(); //! The mesh is nomore used in this region. Information::instance().unsetMesh(); } void InstructionPlot::execute() { __mesh->execute(); Mesh& M = *(__mesh->mesh()); VTKDriver d; if (__f == 0) { d.plot(M); } else { __f->execute(); ConstReferenceCounting u = __f->value()->function(); d.plot(M, u); } } InstructionPlot::InstructionPlot(ReferenceCounting m, ReferenceCounting f) : Instruction(Instruction::plot), __mesh(m), __f(f) { ; } InstructionPlot::InstructionPlot(const InstructionPlot& I) : Instruction(I), __mesh(I.__mesh) { ; } InstructionPlot::~InstructionPlot() { ; } void InstructionUsingScene::execute() { __sceneExpression->execute(); Information::instance().setScene(__sceneExpression->scene()); } InstructionUsingScene::InstructionUsingScene(ReferenceCounting e) : Instruction(Instruction::Using), __sceneExpression(e) { ; } InstructionUsingScene::InstructionUsingScene(const InstructionUsingScene& I) : Instruction(I), __sceneExpression(I.__sceneExpression) { ; } InstructionUsingScene::~InstructionUsingScene() { ; } void InstructionCoarseMesh::execute() { Information::instance().setCoarseMesh(__coarseMesh); } void InstructionBlockBegin::execute() { VariableRepository::instance().beginBlock(); } void InstructionBlockEnd::execute() { VariableRepository::instance().endBlock(); } freefem3d-1.0pre10/language/Information.hpp0000644000175000017500000000714310561425532015574 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: Information.hpp,v 1.5 2006/10/28 23:27:02 delpinux Exp $ #ifndef INFORMATION_HPP #define INFORMATION_HPP #include class Mesh; class Scene; class UnknownListExpression; #include #include /** * @file Information.hpp * @author Stephane Del Pino * @date Sun Nov 28 15:07:51 2004 * * @brief Contains informations related to ff3d's behaviour * * */ class Information : public StaticBase { private: /// if not NULL contains the Mesh which is used in the instruction std::stack > __mesh; /// the last defined sceneExpression. ConstReferenceCounting __scene; /// The current Unknown list. ReferenceCounting __unknownListExpression; /// Choose which algorithm is used for surface mesh generation. If /// true, does not use mesh intersection algorithm. bool __coarseMesh; public: /** * Read only access to the mesh on the top of the stack * * @return latest mesh */ ConstReferenceCounting getMesh(); /** * Sets a new mesh * * @param mesh a mesh */ void setMesh(ConstReferenceCounting mesh); /** * pops the mesh on the top of the stack * */ void unsetMesh(); /** * Checks if a mesh is in use * * @return true if the stack is not empty */ bool usesMesh() const; /** * Access to the unknown list expression * * @return __unknownListExpression */ ReferenceCounting getUnknownList(); /** * Set the unknown list expression * * @param ul the unknown list */ void setUnknownList(ReferenceCounting ul); /** * Unset the unknown list expression * */ void unsetUnknownList(); /** * Checks if an unknown list expression is in use * * @return @b true if an unknown list is in use */ bool usesUnknownList() const; /** * Access to the scene * * @return __scene */ ConstReferenceCounting getScene(); /** * Set a scene * * @param scene a given Scene */ void setScene(ConstReferenceCounting scene); /** * Unset the scene * */ void unsetScene(); /** * Checks if a Scene is in use * * @return @b true if __scene in non null */ bool usesScene() const; /** * Sets the coarse mesh parameter * * @param b */ void setCoarseMesh(const bool& b); /** * read-only access to __coarseMesh * * @return __coarseMesh */ const bool& coarseMesh() const; /** * Constructor * */ Information(); /** * Copy constructor * * @param I an Information * */ Information(const Information& I); /** * Destructor * */ ~Information(); }; #endif // INFORMATION_HPP freefem3d-1.0pre10/language/BoundaryConditionExpressionDirichlet.cpp0000644000175000017500000000453510563377365022662 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryConditionExpressionDirichlet.cpp,v 1.4 2007/02/10 17:20:53 delpinux Exp $ #include #include #include #include #include #include #include std::ostream& BoundaryConditionExpressionDirichlet:: put(std::ostream& os) const { os << "\t\t" << __unknownName << " = " << (*__g) << " on " << (*__boundary); return os; } void BoundaryConditionExpressionDirichlet:: execute() { __boundary->execute(); __g->execute(); ConstReferenceCounting g = __g->function(); ReferenceCounting L = Information::instance().getUnknownList(); size_t n = L->number(__unknownName); ReferenceCounting D = new Dirichlet(g,n); __boundaryCondition = new BoundaryCondition(D, __boundary->boundary()); } BoundaryConditionExpressionDirichlet:: BoundaryConditionExpressionDirichlet(const std::string& unknownName, ReferenceCounting g, ReferenceCounting boundary) : BoundaryConditionExpression(boundary, unknownName, BoundaryConditionExpression::dirichlet), __g(g) { ; } BoundaryConditionExpressionDirichlet:: BoundaryConditionExpressionDirichlet(const BoundaryConditionExpressionDirichlet& d) : BoundaryConditionExpression(d), __g(d.__g) { ; } BoundaryConditionExpressionDirichlet:: ~BoundaryConditionExpressionDirichlet() { ; } freefem3d-1.0pre10/language/FunctionExpressionConstant.cpp0000644000175000017500000000303710561425532020657 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionConstant.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include void FunctionExpressionConstant::execute() { __realExpression->execute(); __scalarFunction = new ScalarFunctionConstant(__realExpression->realValue()); } FunctionExpressionConstant:: FunctionExpressionConstant(ReferenceCounting r) : FunctionExpression(FunctionExpression::constant), __realExpression(r) { ; } FunctionExpressionConstant:: FunctionExpressionConstant(const FunctionExpressionConstant& f) : FunctionExpression(f), __realExpression(f.__realExpression) { ; } FunctionExpressionConstant::~ FunctionExpressionConstant() { ; } freefem3d-1.0pre10/language/VariationalFormulaExpression.cpp0000644000175000017500000004043710633010754021160 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariationalFormulaExpression.cpp,v 1.12 2007/06/10 14:59:56 delpinux Exp $ #include #include #include bool VariationalFormulaExpression:: hasPOVBoundary() const { return (*__givenMultiLinearExpression).hasPOVBoundary(); } void VariationalFormulaExpression:: __getBandLForms2D(MultiLinearExpressionSum::iterator begin, MultiLinearExpressionSum::iterator end, BilinearOperatorList& bilinearPlus, BilinearOperatorList& bilinearMinus, LinearOperatorList& linearPlus, LinearOperatorList& linearMinus, ReferenceCounting borderExpression) { for (MultiLinearExpressionSum::iterator j = begin; j != end; ++j) { ReferenceCounting f = (*j)->getFunction(); switch ((*j)->operatorType()) { case MultiLinearExpression::UV: { const std::string& unknownName = (*j)->getUnknownName(); const std::string& testFunctionName = (*j)->getTestFunctionName(); const VariationalOperator::Property unknownProperty = (*j)->getUnknownProperty(); const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); bilinearPlus.push_back(new VariationalAlphaUVExpression(f, unknownName, unknownProperty, testFunctionName, testFunctionProperty, borderExpression)); break; } case MultiLinearExpression::V: { const std::string& testFunctionName = (*j)->getTestFunctionName(); const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); linearMinus.push_back(new VariationalFVExpression(f, testFunctionName, testFunctionProperty, borderExpression)); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected operator type", ErrorHandler::unexpected); } } } } template std::ostream& VariationalFormulaExpression::__putList(const ListType& listType, char delimiter, bool& first, std::ostream& os) const { for (typename ListType::const_iterator i = listType.begin(); i != listType.end(); ++i) { os << "\t "; if (not(first) or (delimiter != '+')) { os << delimiter; } else { os << ' '; } first = false; os << "int"; if ((*i)->border() != 0) { os << '[' << *(*i)->border() << ']'; } os << '(' << **i << ")\n"; } return os; } std::ostream& VariationalFormulaExpression:: put(std::ostream& os) const { bool first = true; os << '\n'; __putList(__bilinearPlus, '+' , first, os); __putList(__bilinearMinus, '-', first , os); __putList(__bilinearBorderPlus, '+', first , os); __putList(__bilinearBorderMinus, '-', first , os); os << "\t ="; if ( __linearPlus.size() +__linearMinus.size() +__linearBorderPlus.size() +__linearBorderMinus.size()==0) { os << " 0"; } else { os << '\n'; first = true; __putList(__linearPlus, '+', first , os); __putList(__linearMinus, '-', first , os); __putList(__linearBorderPlus, '+', first , os); __putList(__linearBorderMinus, '-', first , os); os << ";\n"; } return os; } void VariationalFormulaExpression:: __getBandLForms3D(MultiLinearExpressionSum::iterator begin, MultiLinearExpressionSum::iterator end, BilinearOperatorList& bilinearPlus, BilinearOperatorList& bilinearMinus, LinearOperatorList& linearPlus, LinearOperatorList& linearMinus) { for (MultiLinearExpressionSum::iterator j = begin; j != end; ++j) { ReferenceCounting f = (*j)->getFunction(); switch ((*j)->operatorType()) { case MultiLinearExpression::gradUgradV: { const std::string& unknownName = (*j)->getUnknownName(); const std::string& testFunctionName = (*j)->getTestFunctionName(); const VariationalOperator::Property unknownProperty = (*j)->getUnknownProperty(); const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); bilinearPlus.push_back(new VariationalMuGradUGradVExpression(f, unknownName, unknownProperty, testFunctionName, testFunctionProperty)); break; } case MultiLinearExpression::dxUdxV: { const std::string& unknownName = (*j)->getUnknownName(); const std::string& testFunctionName = (*j)->getTestFunctionName(); IntegratedOperatorExpression::OperatorType t = (*j)->getTestFunctionOperator(); size_t m = 0; switch (t) { case (IntegratedOperatorExpression::dx): { m=0; break; } case (IntegratedOperatorExpression::dy): { m=1; break; } case (IntegratedOperatorExpression::dz): { m=2; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected derivative number", ErrorHandler::unexpected); } } t = (*j)->getUnknownOperator(); size_t n = 0; switch (t) { case (IntegratedOperatorExpression::dx): { n=0; break; } case (IntegratedOperatorExpression::dy): { n=1; break; } case (IntegratedOperatorExpression::dz): { n=2; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected derivative number", ErrorHandler::unexpected); } } const VariationalOperator::Property unknownProperty = (*j)->getUnknownProperty(); const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); bilinearPlus.push_back(new VariationalAlphaDxUDxVExpression(f,m,n, unknownName, unknownProperty, testFunctionName, testFunctionProperty)); break; } case MultiLinearExpression::UdxV: { const std::string& unknownName = (*j)->getUnknownName(); const std::string& testFunctionName = (*j)->getTestFunctionName(); IntegratedOperatorExpression::OperatorType t = (*j)->getTestFunctionOperator(); size_t n = 0; switch (t) { case (IntegratedOperatorExpression::dx): { n=0; break; } case (IntegratedOperatorExpression::dy): { n=1; break; } case (IntegratedOperatorExpression::dz): { n=2; break; } case (IntegratedOperatorExpression::gradient): { throw ErrorHandler(__FILE__,__LINE__, "\""+stringify(**j)+"\" is not an allowed construction", ErrorHandler::normal); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected derivative number", ErrorHandler::unexpected); } } const VariationalOperator::Property unknownProperty = (*j)->getUnknownProperty(); const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); bilinearPlus.push_back(new VariationalNuUdxVExpression(f,n, unknownName, unknownProperty, testFunctionName, testFunctionProperty)); break; } case MultiLinearExpression::dxUV: { const std::string& unknownName = (*j)->getUnknownName(); const std::string& testFunctionName = (*j)->getTestFunctionName(); IntegratedOperatorExpression::OperatorType t = (*j)->getUnknownOperator(); size_t n = 0; switch (t) { case (IntegratedOperatorExpression::dx): { n=0; break; } case (IntegratedOperatorExpression::dy): { n=1; break; } case (IntegratedOperatorExpression::dz): { n=2; break; } case (IntegratedOperatorExpression::gradient): { throw ErrorHandler(__FILE__,__LINE__, "\""+stringify(**j)+"\" is not an allowed construction", ErrorHandler::normal); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected derivative number", ErrorHandler::unexpected); } } const VariationalOperator::Property unknownProperty = (*j)->getUnknownProperty(); const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); bilinearPlus.push_back(new VariationalNuDxUVExpression(f,n, unknownName, unknownProperty, testFunctionName, testFunctionProperty)); break; } case MultiLinearExpression::UV: { const std::string& unknownName = (*j)->getUnknownName(); const std::string& testFunctionName = (*j)->getTestFunctionName(); const VariationalOperator::Property unknownProperty = (*j)->getUnknownProperty(); const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); bilinearPlus.push_back(new VariationalAlphaUVExpression(f, unknownName, unknownProperty, testFunctionName, testFunctionProperty)); break; } case MultiLinearExpression::gradV: { const std::string& testFunctionName = (*j)->getTestFunctionName(); throw ErrorHandler(__FILE__,__LINE__, "cannot discretize 'int("+stringify(*f)+"*grad("+testFunctionName+"))'", ErrorHandler::normal); break; } case MultiLinearExpression::dxV: { const std::string& testFunctionName = (*j)->getTestFunctionName(); IntegratedOperatorExpression::OperatorType t = (*j)->getTestFunctionOperator(); size_t n = 0; switch (t) { case (IntegratedOperatorExpression::dx): { n=0; break; } case (IntegratedOperatorExpression::dy): { n=1; break; } case (IntegratedOperatorExpression::dz): { n=2; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected derivative number", ErrorHandler::unexpected); } } const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); linearMinus.push_back(new VariationalFdxVExpression(f, testFunctionName, testFunctionProperty, n)); break; } case MultiLinearExpression::V: { const std::string& testFunctionName = (*j)->getTestFunctionName(); const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); linearMinus.push_back(new VariationalFVExpression(f, testFunctionName, testFunctionProperty)); break; } case MultiLinearExpression::dxFV: { ReferenceCounting g = (*j)->getFunctionExpression(); const std::string& testFunctionName = (*j)->getTestFunctionName(); IntegratedOperatorExpression::OperatorType t = (*j)->getFunctionOperator(); size_t n = 0; switch (t) { case (IntegratedOperatorExpression::dx): { n=0; break; } case (IntegratedOperatorExpression::dy): { n=1; break; } case (IntegratedOperatorExpression::dz): { n=2; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected derivative number", ErrorHandler::unexpected); } } const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); linearMinus.push_back(new VariationalFdxGVExpression(f,g, testFunctionName, testFunctionProperty, n)); break; } case MultiLinearExpression::gradFgradV: { ReferenceCounting g = (*j)->getFunctionExpression(); const std::string& testFunctionName = (*j)->getTestFunctionName(); const VariationalOperator::Property testFunctionProperty = (*j)->getTestFunctionProperty(); linearMinus.push_back(new VariationalFgradGgradVExpression(f,g, testFunctionName, testFunctionProperty)); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected operator type", ErrorHandler::unexpected); } } } } void VariationalFormulaExpression:: __getBilinearAndLinearForms(MultiLinearFormSumExpression::iterator begin, MultiLinearFormSumExpression::iterator end, BilinearOperatorList& bilinearPlus, BilinearOperatorList& bilinearMinus, BilinearOperatorList& bilinearBorderPlus, BilinearOperatorList& bilinearBorderMinus, LinearOperatorList& linearPlus, LinearOperatorList& linearMinus, LinearOperatorList& linearBorderPlus, LinearOperatorList& linearBorderMinus) { ReferenceCounting r = new RealExpressionValue(1); ReferenceCounting one = new FunctionExpressionConstant(r); for(MultiLinearFormSumExpression::iterator i = begin; i != end; ++i) { MultiLinearExpressionSum& m = *(*i)->multiLinearExpression(); if ((*i)->formType() == MultiLinearFormExpression::threeD) { __getBandLForms3D(m.beginPlus(), m.endPlus(), bilinearPlus, bilinearMinus, linearPlus, linearMinus); __getBandLForms3D(m.beginMinus(), m.endMinus(), bilinearMinus, bilinearPlus, linearMinus, linearPlus); } else { __getBandLForms2D(m.beginPlus(), m.endPlus(), bilinearBorderPlus, bilinearBorderMinus, linearBorderPlus, linearBorderMinus, (*i)->boundaryExpression()); __getBandLForms2D(m.beginMinus(), m.endMinus(), bilinearBorderMinus, bilinearBorderPlus, linearBorderMinus, linearBorderPlus, (*i)->boundaryExpression()); } } } void VariationalFormulaExpression:: execute() { for (BilinearOperatorList::iterator i = __bilinearPlus.begin(); i != __bilinearPlus.end(); ++i) { (*i)->execute(); } for (BilinearOperatorList::iterator i = __bilinearMinus.begin(); i != __bilinearMinus.end(); ++i) { (*i)->execute(); } for (LinearOperatorList::iterator i = __linearPlus.begin(); i != __linearPlus.end(); ++i) { (*i)->execute(); } for (LinearOperatorList::iterator i = __linearMinus.begin(); i != __linearMinus.end(); ++i) { (*i)->execute(); } for (BilinearOperatorList::iterator i = __bilinearBorderPlus.begin(); i != __bilinearBorderPlus.end(); ++i) { (*i)->execute(); } for (BilinearOperatorList::iterator i = __bilinearBorderMinus.begin(); i != __bilinearBorderMinus.end(); ++i) { (*i)->execute(); } for (LinearOperatorList::iterator i = __linearBorderPlus.begin(); i != __linearBorderPlus.end(); ++i) { (*i)->execute(); } for (LinearOperatorList::iterator i = __linearBorderMinus.begin(); i != __linearBorderMinus.end(); ++i) { (*i)->execute(); } } VariationalFormulaExpression:: VariationalFormulaExpression(ReferenceCounting m) : Expression(Expression::variationalFormula), __givenMultiLinearExpression(m) { this->__getBilinearAndLinearForms(__givenMultiLinearExpression->plusBegin(), __givenMultiLinearExpression->plusEnd(), __bilinearPlus, __bilinearMinus, __bilinearBorderPlus, __bilinearBorderMinus, __linearPlus, __linearMinus, __linearBorderPlus, __linearBorderMinus); this->__getBilinearAndLinearForms(__givenMultiLinearExpression->minusBegin(), __givenMultiLinearExpression->minusEnd(), __bilinearMinus, __bilinearPlus, __bilinearBorderMinus, __bilinearBorderPlus, __linearMinus, __linearPlus, __linearBorderMinus, __linearBorderPlus); } VariationalFormulaExpression:: VariationalFormulaExpression(const VariationalFormulaExpression& v) : Expression(v), __givenMultiLinearExpression(v.__givenMultiLinearExpression), __bilinearPlus(v.__bilinearPlus), __bilinearMinus(v.__bilinearMinus), __linearPlus(v.__linearPlus), __linearMinus(v.__linearMinus) { ; } VariationalFormulaExpression:: ~VariationalFormulaExpression() { ; } freefem3d-1.0pre10/language/PDEOperatorExpression.cpp0000644000175000017500000001765310563377365017531 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: PDEOperatorExpression.cpp,v 1.6 2007/02/10 17:20:53 delpinux Exp $ #include #include #include #include #include #include #include #include PDEOperatorExpression:: PDEOperatorExpression(const PDEOperatorExpression& e) : Expression(e), __pdeOperatorType(e.__pdeOperatorType) { ; } PDEOperatorExpression:: PDEOperatorExpression(PDEOperatorType t) : Expression(Expression::pdeOperator), __pdeOperatorType(t) { ; } PDEOperatorExpression::~PDEOperatorExpression() { ; } void PDEOperatorExpression::execute() { this->__execute(); if (this->__checkBoundaryExpression()) { throw ErrorHandler(__FILE__, __LINE__, "cannot evaluate the expression \"" +stringify(*this)+ "\" in the volume", ErrorHandler::normal); } } ReferenceCounting PDEScalarOperatorExpression::pdeOperator() { return __pdeOperator; } PDEScalarOperatorExpression::PDEScalarOperatorExpression(const PDEScalarOperatorExpression& e) : PDEOperatorExpression(e), __unknownName(e.__unknownName), __pdeOperator(e.__pdeOperator), __pdeScalarOperatorType(e.__pdeScalarOperatorType) { ; } PDEScalarOperatorExpression:: PDEScalarOperatorExpression(const std::string& unknownName, PDEScalarOperatorType t) : PDEOperatorExpression(PDEOperatorExpression::scalar), __unknownName(unknownName), __pdeScalarOperatorType(t) { ; } PDEScalarOperatorExpression::~PDEScalarOperatorExpression() { ; } bool PDEScalarOperatorExpressionDivMuGrad::__checkBoundaryExpression() const { return __mu->hasBoundaryExpression(); } void PDEScalarOperatorExpressionDivMuGrad::__execute() { __mu->execute(); ScalarFunctionBuilder functionBuilder; functionBuilder.setFunction(__mu->function()); functionBuilder.setUnaryMinus(); __pdeOperator = new DivMuGrad(functionBuilder.getBuiltFunction()); } bool PDEScalarOperatorExpressionOrderZero::__checkBoundaryExpression() const { return __Alpha->hasBoundaryExpression(); } void PDEScalarOperatorExpressionOrderZero::__execute() { __Alpha->execute(); __pdeOperator = new MassOperator(__Alpha->function()); } bool PDEScalarOperatorExpressionOrderOne::__checkBoundaryExpression() const { for (size_t i=0; i<3; ++i) { if(__nu[i] != 0) { if (__nu[i]->hasBoundaryExpression()) { return true; } } } return false; } void PDEScalarOperatorExpressionOrderOne::__execute() { this->preexec(); ReferenceCounting > > nu = new TinyVector<3, ConstReferenceCounting >; for (size_t i=0; i<3; ++i) { if(__nu[i] != 0) { (*nu)[i] = __nu[i]->function(); } else { (*nu)[i] = 0; } } __pdeOperator = new FirstOrderOperator(nu); } PDEVectorialOperatorExpression:: PDEVectorialOperatorExpression(const PDEVectorialOperatorExpression:: PDEScalarOperatorType& t) : PDEOperatorExpression(PDEOperatorExpression::vectorial), __pdeOperatorType(t) { ; } PDEVectorialOperatorExpression:: PDEVectorialOperatorExpression(const PDEVectorialOperatorExpression& e) : PDEOperatorExpression(e), __pdeOperatorList(e.__pdeOperatorList), __pdeOperatorType(e.__pdeOperatorType) { ; } PDEVectorialOperatorExpression:: ~PDEVectorialOperatorExpression() { ; } bool PDEVectorialOperatorExpressionOrderOne:: __checkBoundaryExpression() const { for(FirstOrderSum::const_iterator i = __sum.begin(); i != __sum.end(); ++i) { if ((*(*i).second).__checkBoundaryExpression()) { return true; } } for(FirstOrderSum::const_iterator i = __diff.begin(); i != __diff.end(); ++i) { if ((*(*i).second).__checkBoundaryExpression()) { return true; } } return false; } bool PDEVectorialOperatorExpressionOrderTwo:: __checkBoundaryExpression() const { typedef TinyMatrix<3,3,ReferenceCounting > FunctionMatrix; typedef std::map FunctionMatrixSet; FunctionMatrixSet matrixSet; typedef PDEVectorialOperatorExpressionOrderOne::FirstOrderSum::const_iterator PDEVectorialOperatorIterator; for (FirstOperatorList::const_iterator i = __firstOrderOp.begin(); i != __firstOrderOp.end(); ++i) { const PDEVectorialOperatorExpressionOrderOne& pdeOpOrderOne = (*(*i).second); if (pdeOpOrderOne.__checkBoundaryExpression()) { return true; } } return false; } void PDEVectorialOperatorExpressionOrderTwo::__execute() { typedef TinyMatrix<3,3,ReferenceCounting > FunctionMatrix; typedef std::map FunctionMatrixSet; FunctionMatrixSet matrixSet; typedef PDEVectorialOperatorExpressionOrderOne::FirstOrderSum::iterator PDEVectorialOperatorIterator; for (FirstOperatorList::iterator i = __firstOrderOp.begin(); i != __firstOrderOp.end(); ++i) { int I = (*i).first; PDEVectorialOperatorExpressionOrderOne& pdeOpOrderOne = (*(*i).second); pdeOpOrderOne.preexec(); for (PDEVectorialOperatorIterator j = pdeOpOrderOne.__sum.begin(); j != pdeOpOrderOne.__sum.end(); ++j) { PDEScalarOperatorExpressionOrderOne& operatorOrderOne = *j->second; FunctionMatrix& A = matrixSet[(*j).first]; for (size_t J=0; J<3; ++J) { if (operatorOrderOne.nu(J) != 0) { if (A(I,J) == 0) { A(I,J) = operatorOrderOne.nu(J); } else { A(I,J) = new FunctionExpressionBinaryOperation(BinaryOperation::sum,A(I,J),operatorOrderOne.nu(J)); } } } } for (PDEVectorialOperatorIterator j = pdeOpOrderOne.__diff.begin(); j != pdeOpOrderOne.__diff.end(); ++j) { PDEScalarOperatorExpressionOrderOne& operatorOrderOne = (*(*j).second); FunctionMatrix& A = matrixSet[(*j).first]; for (size_t J=0; J<3; ++J) { if (operatorOrderOne.nu(J) != 0) { if (A(I,J) == 0) { A(I,J) = new FunctionExpressionUnaryMinus(operatorOrderOne.nu(J)); } else { A(I,J) = new FunctionExpressionBinaryOperation(BinaryOperation::difference, A(I,J),operatorOrderOne.nu(J)); } } } } } for (FunctionMatrixSet::iterator i = matrixSet.begin(); i != matrixSet.end(); ++i) { FunctionMatrix& a = (*i).second; ReferenceCounting A = new SecondOrderOperator::Matrix; for (size_t m=0; m<3; ++m) for (size_t n=0; n<3; ++n) { if (a(m,n) != 0) { ScalarFunctionBuilder functionBuilder; functionBuilder.setFunction(a(m,n)->function()); functionBuilder.setUnaryMinus(); (*A)(m,n) = functionBuilder.getBuiltFunction(); } } SecondOrderOperator* secondOrderOp = new SecondOrderOperator(A); __pdeOperatorList.insert(std::make_pair(i->first,secondOrderOp)); } } PDEVectorialOperatorExpressionOrderTwo:: PDEVectorialOperatorExpressionOrderTwo() : PDEVectorialOperatorExpression(PDEVectorialOperatorExpression:: secondOrder) { ; } PDEVectorialOperatorExpressionOrderTwo:: ~PDEVectorialOperatorExpressionOrderTwo() { ; } freefem3d-1.0pre10/language/MultiLinearFormExpression.hpp0000644000175000017500000001314210633010754020430 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: MultiLinearFormExpression.hpp,v 1.7 2007/06/10 14:59:56 delpinux Exp $ #ifndef MULTI_LINEAR_FORM_EXPRESSION_HPP #define MULTI_LINEAR_FORM_EXPRESSION_HPP #include #include #include #include #include class MultiLinearFormExpression : public Expression { public: enum FormType { oneD, twoD, threeD }; private: ReferenceCounting __boundary; ReferenceCounting __multiLinearExpression; const FormType __formType; std::ostream& put(std::ostream& os) const { switch(__formType) { case oneD: { os << "int1d("; break; } case twoD: { os << "int2d(" << *__boundary << ")("; break; } case threeD: { os << "int3d("; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } os << *__multiLinearExpression << ')'; return os; } public: bool hasPOVBoundary() const { if (__boundary != 0) return (*__boundary).hasPOVBoundary(); else return false; } ReferenceCounting boundaryExpression() { return __boundary; } ReferenceCounting multiLinearExpression() { return __multiLinearExpression; } void execute() { (*__multiLinearExpression).execute(); if(__boundary != 0) { (*__boundary).execute(); } } const FormType& formType() const { return __formType; } MultiLinearFormExpression(ReferenceCounting me, const FormType t, ReferenceCounting b = 0) : Expression(Expression::multiLinearForm), __boundary(b), __multiLinearExpression(me), __formType(t) { //! checks the validity of the expression (*me).check(); } MultiLinearFormExpression(const MultiLinearFormExpression& m) : Expression(m), __boundary(m.__boundary), __multiLinearExpression(m.__multiLinearExpression), __formType(m.__formType) { ; } ~MultiLinearFormExpression() { ; } }; class MultiLinearFormSumExpression : public Expression { private: typedef std::list > ListType; public: typedef ListType::iterator iterator; private: ListType __listPlus; ListType __listMinus; std::ostream& put(std::ostream& os) const { bool first = true; for (ListType::const_iterator i = __listPlus.begin(); i != __listPlus.end(); ++i) { if (!first) { os << '+'; } else { first = false; } os << *(*i); } for (ListType::const_iterator i = __listMinus.begin(); i != __listMinus.end(); ++i) { os << '-' << *(*i); } return os; } public: bool hasPOVBoundary() const { for (ListType::const_iterator i = __listMinus.begin(); i != __listMinus.end(); ++i) { if ((**i).hasPOVBoundary()) return true; } for (ListType::const_iterator i = __listPlus.begin(); i != __listPlus.end(); ++i) { if ((**i).hasPOVBoundary()) return true; } return false; } void clear() { __listPlus.clear(); __listMinus.clear(); } const MultiLinearFormSumExpression& operator-=(MultiLinearFormSumExpression& M) { for (MultiLinearFormSumExpression::iterator i = M.plusBegin(); i != M.plusEnd(); ++i) { __listMinus.push_back(*i); } for (MultiLinearFormSumExpression::iterator i = M.minusBegin(); i != M.minusEnd(); ++i) { __listPlus.push_back(*i); } return *this; } MultiLinearFormSumExpression::iterator plusBegin() { return __listPlus.begin(); } MultiLinearFormSumExpression::iterator plusEnd() { return __listPlus.end(); } MultiLinearFormSumExpression::iterator minusBegin() { return __listMinus.begin(); } MultiLinearFormSumExpression::iterator minusEnd() { return __listMinus.end(); } void execute() { for (ListType::iterator i = __listPlus.begin(); i != __listPlus.end(); ++i) { (*(*i)).execute(); } for (ListType::iterator i = __listMinus.begin(); i != __listMinus.end(); ++i) { (*(*i)).execute(); } } void plus(ReferenceCounting ml) { __listPlus.push_back(ml); } void minus(ReferenceCounting ml) { __listMinus.push_back(ml); } MultiLinearFormSumExpression() : Expression(Expression::multiLinearFormSum) { ; } MultiLinearFormSumExpression(const MultiLinearFormSumExpression& m) : Expression(m), __listPlus(m.__listPlus), __listMinus(m.__listMinus) { ; } ~MultiLinearFormSumExpression() { ; } }; #endif // MULTI_LINEAR_FORM_EXPRESSION_HPP freefem3d-1.0pre10/language/Lexer.hpp0000644000175000017500000000545310632501735014367 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: Lexer.hpp,v 1.6 2007/06/09 10:37:08 delpinux Exp $ // This is the Lexer replacement to Flex. The reason for changing flex // is the portability: it is not available at this very moment using CodeWarrior 6. // This is a base class. Its derived classes will be used for different languages. #ifndef LEXER_HPP #define LEXER_HPP #include #include #include #include /*! \class Lexer This class is the base class for all lexers. \remark It has been written to replace the use of flex which did not worked under MS-Windows (using cygwin). This should make the porting of the code easier. \author Stéphane Del Pino. */ class Lexer { private: //! The maximum autorized length for a "word". size_t WordMaxLenght; struct eqstr { bool operator()(const char* s1, const char* s2) const { return std::strcmp(s1, s2) < 0; } }; protected: //! The input std::istream. std::istream& in; //! The output std::istream. std::ostream& out; //! The current number line. size_t linenumber; //! The current "word". std::string yytext; public: /*! a list of known Keyword. */ typedef std::map KeyWordList; protected: KeyWordList __keyWordList; /*! This contains the token associated to a type. This is used for variables declaration to know its type. */ int declarationToken; public: //! Constructs a Lexer. Lexer(std::istream& In, std::ostream& Out = std::cout, const size_t WMaxL = 255) : WordMaxLenght(WMaxL), in(In), out(Out) { // yytext = new char[WMaxL+1]; linenumber = 1; } //! Destructor. virtual ~Lexer() { ; } //! Interface with parser. virtual int yylex() = 0; //! Read-only access to the current line number. const size_t& lineno() const { return linenumber; } //! Read-only access to the current Word const char* YYText() const { return yytext.c_str(); } }; #endif // LEXER_HPP freefem3d-1.0pre10/language/FieldExpressionList.hpp0000644000175000017500000000461310570430710017237 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FieldExpressionList.hpp,v 1.1 2007/02/26 01:03:04 delpinux Exp $ #ifndef FIELD_EXPRESSION_LIST_HPP #define FIELD_EXPRESSION_LIST_HPP #include #include #include #include /** * @file FieldExpressionList.hpp * @author Stéphane Del Pino * @date Thu Feb 22 12:12:47 2007 * * @brief manages a list of fields of functions */ class FieldExpressionList : public Expression { private: std::vector > __list; /** * Writes the expression to a stream * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; /** * Copy constructor is forbiden * */ FieldExpressionList(const FieldExpressionList&); public: /** * Access to the ith field * * @return the ith field */ ReferenceCounting field(const size_t& i); /** * Read-only access to the ith field * * @return the ith field */ ConstReferenceCounting field(const size_t& i) const; /** * Executes the field expression * */ void execute(); /** * Access to the number of fields in the list * * @return the number of fields in the list */ size_t numberOfFields() const; /** * Adds a field to the list * * @param field next field of the list */ void add(ReferenceCounting field); /** * Constructor */ FieldExpressionList(); /** * Destructor * */ ~FieldExpressionList(); }; #endif // FIELD_EXPRESSION_LIST_HPP freefem3d-1.0pre10/language/VariableLexerRepository.hpp0000644000175000017500000000452510564676110020140 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariableLexerRepository.hpp,v 1.3 2007/02/14 21:16:56 delpinux Exp $ #ifndef VARIABLE_LEXER_REPOSITORY_HPP #define VARIABLE_LEXER_REPOSITORY_HPP #include #include #include #include /** * @file VariableLexerRepository.hpp * @author Stéphane Del Pino * @date Sat Feb 10 13:17:05 2007 * * @brief Variable repository used during lexical analysis */ class VariableLexerRepository : public ThreadStaticBase { private: typedef int Type; //! The container of variables. typedef std::map Container; std::vector __repository; /**< per level variable lists */ size_t __blockLevel; /**< current level */ public: /** * Search for a variable in the list * * @param name name of the variable to find * * @return the type of the variable */ Type find(const std::string& name) const; /** * Adds a variable to the list * * @param name name of the variable * @param type type of the variable */ void add(const std::string& name, const Type& type); /** * Marks a function as a variable * * @param name name of the variable */ void markAsUnknown(const std::string& name); /** * Begins a new block * */ void beginBlock(); /** * Ends a block * */ void endBlock(); /** * Constructor * */ VariableLexerRepository(); /** * Destructor * */ ~VariableLexerRepository(); }; #endif // VARIABLE_LEXER_REPOSITORY_HPP freefem3d-1.0pre10/language/MeshExpression.cpp0000644000175000017500000004237210624156366016267 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: MeshExpression.cpp,v 1.40 2007/05/20 23:23:19 delpinux Exp $ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ReferenceCounting MeshExpression:: mesh() const { ASSERT(__typeOfMesh != MeshExpression::undefined); return __mesh; } MeshExpression:: MeshExpression(const MeshExpression& e) : Expression(e), __mesh(e.__mesh), __typeOfMesh(e.__typeOfMesh) { ; } MeshExpression:: MeshExpression(ReferenceCounting mesh, const MeshExpression::TypeOfMesh& t) : Expression(Expression::mesh), __mesh(mesh), __typeOfMesh(t) { ; } MeshExpression:: ~MeshExpression() { ; } std::ostream& MeshExpressionStructured:: put(std::ostream& os) const { const Structured3DMesh& smesh = static_cast(*__mesh); os << "structured mesh of {(" << smesh.shape().shape().nx() << ',' << smesh.shape().shape().ny() << ','<< smesh.shape().shape().nz() << ");" << smesh.shape().a() << ';' << smesh.shape().b() << '}'; return os; } void MeshExpressionStructured:: execute() { TinyVector<3> a; TinyVector<3> b; TinyVector<3,int> n; (*__corner1).execute(); (*__corner2).execute(); (*__meshSize).execute(); for (size_t i=0; i<3; ++i) { a[i] = (*__corner1).value(i); b[i] = (*__corner2).value(i); n[i] = static_cast((*__meshSize).value(i)); } ffout(2) << "Building Mesh ... "; Structured3DMeshShape S(n[0], n[1], n[2], a, b); __mesh = new Structured3DMesh(S, new VerticesCorrespondance(S.numberOfVertices())); ffout(2) << "done\n"; } MeshExpressionStructured:: MeshExpressionStructured(ReferenceCounting size, ReferenceCounting corner1, ReferenceCounting corner2) : MeshExpression(0, MeshExpression::structured), __meshSize(size), __corner1(corner1), __corner2(corner2) { ; } MeshExpressionStructured:: MeshExpressionStructured(const MeshExpressionStructured& m) : MeshExpression(m), __meshSize(m.__meshSize), __corner1(m.__corner1), __corner2(m.__corner2) { ; } MeshExpressionStructured:: ~MeshExpressionStructured() { ; } std::ostream& MeshExpressionSpectral:: put(std::ostream& os) const { const SpectralMesh& smesh = static_cast(*__mesh); os << "spectral mesh of {(" << smesh.shape().shape().nx() << ',' << smesh.shape().shape().ny() << ','<< smesh.shape().shape().nz() << ");" << smesh.shape().a() << ';' << smesh.shape().b() << '}'; return os; } void MeshExpressionSpectral:: execute() { TinyVector<3> a; TinyVector<3> b; TinyVector<3,int> n; __corner1->execute(); __corner2->execute(); __degree->execute(); for (size_t i=0; i<3; ++i) { a[i] = __corner1->value(i); b[i] = __corner2->value(i); n[i] = static_cast(__degree->value(i)); } ffout(2) << "Building Mesh ... "; Structured3DMeshShape degrees(n[0], n[1], n[2], a, b); Structured3DMeshShape shape (n[0]+2, n[1]+2, n[2]+2, a, b); __mesh = new SpectralMesh(degrees,new VerticesCorrespondance(shape.numberOfVertices())); ffout(2) << "done\n"; } MeshExpressionSpectral:: MeshExpressionSpectral(ReferenceCounting degree, ReferenceCounting corner1, ReferenceCounting corner2) : MeshExpression(0, MeshExpression::spectral), __degree(degree), __corner1(corner1), __corner2(corner2) { ; } MeshExpressionSpectral:: MeshExpressionSpectral(const MeshExpressionSpectral& m) : MeshExpression(m), __degree(m.__degree), __corner1(m.__corner1), __corner2(m.__corner2) { ; } MeshExpressionSpectral:: ~MeshExpressionSpectral() { ; } std::ostream& MeshExpressionSurface:: put(std::ostream& os) const { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); return os; } template void MeshExpressionSurface:: __getSurfaceMesh(MeshType& mesh) { if (mesh.hasSurfaceMesh()) { __mesh = mesh.surfaceMesh(); } else { throw ErrorHandler(__FILE__,__LINE__, "mesh \""+stringify(*__volumeMesh)+"\" has no surface mesh", ErrorHandler::normal); } } void MeshExpressionSurface:: execute() { __volumeMesh->execute(); if (__volumeMesh->mesh()->family() != Mesh::volume) { throw ErrorHandler(__FILE__,__LINE__, "Cannot build a surface mesh using mesh \""+ stringify(*__volumeMesh)+ "\" a volume mesh is mandatory!", ErrorHandler::normal); } if (__domain == 0) { switch (__volumeMesh->mesh()->type()) { case Mesh::cartesianHexahedraMesh: { this->__getSurfaceMesh(dynamic_cast(*__volumeMesh->mesh())); break; } case Mesh::hexahedraMesh: { this->__getSurfaceMesh(dynamic_cast(*__volumeMesh->mesh())); break; } case Mesh::tetrahedraMesh: { this->__getSurfaceMesh(dynamic_cast(*__volumeMesh->mesh())); break; } case Mesh::spectralMesh: { this->__getSurfaceMesh(dynamic_cast(*__volumeMesh->mesh())); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "cannot get boundary of mesh \""+stringify(*__volumeMesh)+"\"", ErrorHandler::unexpected); } } } else { __domain->execute(); Domain& omega = *__domain->domain(); if(omega.isR3()) { throw ErrorHandler(__FILE__,__LINE__, "trying to mesh the boundary of R3!", ErrorHandler::normal); } switch (__volumeMesh->mesh()->type()) { case Mesh::cartesianHexahedraMesh: { __mesh = new SurfaceMeshOfTriangles(); Structured3DMesh& volumeMesh = dynamic_cast(*__volumeMesh->mesh()); SurfaceMeshOfTriangles& surfaceMesh = dynamic_cast(*__mesh); SurfaceMeshGenerator S; S.generateSurfacicMesh(omega, volumeMesh, surfaceMesh); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "mesh generation not yet implemented for \""+ stringify(*__volumeMesh)+"\"'s type", ErrorHandler::normal); } } } } MeshExpressionSurface:: MeshExpressionSurface(ReferenceCounting domain, ReferenceCounting volumeMesh) : MeshExpression(0, MeshExpression::surface), __domain(domain), __volumeMesh(volumeMesh) { ; } MeshExpressionSurface:: MeshExpressionSurface(ReferenceCounting volumeMesh) : MeshExpression(0, MeshExpression::surface), __domain(0), __volumeMesh(volumeMesh) { ; } MeshExpressionSurface:: MeshExpressionSurface(const MeshExpressionSurface& m) : MeshExpression(m), __domain(m.__domain), __volumeMesh(m.__volumeMesh) { ; } MeshExpressionSurface:: ~MeshExpressionSurface() { ; } void MeshExpressionVariable:: execute() { __meshVariable = VariableRepository::instance().findVariable(__meshName); __mesh = __meshVariable->expression()->mesh(); } MeshExpressionVariable:: MeshExpressionVariable(const std::string& meshName) : MeshExpression(0,MeshExpression::variable), __meshName(meshName), __meshVariable(0) { ; } MeshExpressionVariable:: MeshExpressionVariable(const MeshExpressionVariable& e) : MeshExpression(e), __meshName(e.__meshName), __meshVariable(e.__meshVariable) { ; } MeshExpressionVariable:: ~MeshExpressionVariable() { ; } std::ostream& MeshExpressionRead:: put(std::ostream& os) const { os << "read(" << __fileDescriptor->toString() << ",\"" << __filename->value() << "\")"; return os; } void MeshExpressionRead:: execute() { (*__filename).execute(); const std::string filename = (*__filename).value(); try { ReferenceCounting M; // pas encore de support pour les modes binaire/ascii switch ((*__fileDescriptor).format()) { case FileDescriptor::am_fmt: M = new MeshReaderAM_FMTFormat(filename); break; case FileDescriptor::medit: M = new MeshFormatReader(filename); break; case FileDescriptor::gmsh: M = new GmshFormatReader(filename); break; default: throw MeshReader::Error("no support for reading '"+(*__fileDescriptor).toString()+"' format"); break; } __mesh = (*M).mesh(); } catch (MeshReader::Error & e) { throw ErrorHandler(__FILE__,__LINE__, e.message(), ErrorHandler::normal); } } MeshExpressionRead:: MeshExpressionRead(ReferenceCounting descriptor, ReferenceCounting filename) : MeshExpression(0, MeshExpression::read), __fileDescriptor(descriptor), __filename(filename) { ; } MeshExpressionRead:: MeshExpressionRead(const MeshExpressionRead& m) : MeshExpression(m), __fileDescriptor(m.__fileDescriptor), __filename(m.__filename) { ; } MeshExpressionRead::~MeshExpressionRead() { ; } std::ostream& MeshExpressionSimplify:: put(std::ostream& os) const { os << "simplify(" << (*__originalMesh) << ')'; return os; } void MeshExpressionSimplify:: execute() { (*__originalMesh).execute(); MeshSimplifier M((*__originalMesh).mesh()); __mesh = M.mesh(); } MeshExpressionSimplify:: MeshExpressionSimplify(ReferenceCounting me) : MeshExpression(0, MeshExpression::simplify), __originalMesh(me) { ; } MeshExpressionSimplify:: MeshExpressionSimplify(const MeshExpressionSimplify& e) : MeshExpression(e), __originalMesh(e.__originalMesh) { ; } MeshExpressionSimplify:: ~MeshExpressionSimplify() { ; } std::ostream& MeshExpressionExtract:: put(std::ostream& os) const { os << "extract(" << (*__originalMesh) << ',' << (*__referenceToExtract) << ')'; return os; } template void MeshExpressionExtract::__extract() { Mesh* mesh = __originalMesh->mesh(); MeshExtractor extractor(dynamic_cast(mesh)); const int ref = static_cast(__referenceToExtract->realValue()); if (ref < 0) { throw ErrorHandler(__FILE__,__LINE__, "Element references have to be positives", ErrorHandler::normal); } std::set refSet; refSet.insert(static_cast(ref)); __mesh = extractor(refSet); } void MeshExpressionExtract:: execute() { (*__originalMesh).execute(); (*__referenceToExtract).execute(); switch ((*(*__originalMesh).mesh()).type()) { // case Mesh::cartesianHexahedraMesh: { // this->__extract(); // break; // } // case Mesh::hexahedraMesh: { // this->__extract(); // break; // } case Mesh::tetrahedraMesh: { this->__extract(); break; } case Mesh::surfaceMeshQuadrangles: { this->__extract(); break; } case Mesh::surfaceMeshTriangles: { this->__extract(); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } } MeshExpressionExtract:: MeshExpressionExtract(ReferenceCounting me, ReferenceCounting re) : MeshExpression(0, MeshExpression::extract), __originalMesh(me), __referenceToExtract(re) { ; } MeshExpressionExtract:: MeshExpressionExtract(const MeshExpressionExtract& e) : MeshExpression(e), __originalMesh(e.__originalMesh), __referenceToExtract(e.__referenceToExtract) { ; } MeshExpressionExtract:: ~MeshExpressionExtract() { ; } void MeshExpressionTetrahedrize::execute() { (*__inputMesh).execute(); ffout(3) << "Converting to tetrahedra " << (*__inputMesh) << '\n'; MeshTetrahedrizor mt((*__inputMesh).mesh()); mt.run(); __mesh = mt.mesh(); ffout(3) << "Converting to tetrahedra done\n"; } MeshExpressionTetrahedrize:: MeshExpressionTetrahedrize(ReferenceCounting m) : MeshExpression(0,MeshExpression::tetrahedrize), __inputMesh(m) { ; } MeshExpressionTetrahedrize:: MeshExpressionTetrahedrize(const MeshExpressionTetrahedrize& m) : MeshExpression(m), __inputMesh(m.__inputMesh) { ; } MeshExpressionTetrahedrize:: ~MeshExpressionTetrahedrize() { ; } void MeshExpressionTetrahedrizeDomain ::execute() { (*__inputMesh).execute(); (*__domain).execute(); ffout(3) << "Building domain tetrahedral mesh\n"; MeshDomainTetrahedrizor mt((*__inputMesh).mesh(), (*__domain).domain()); mt.run(); __mesh = mt.mesh(); ffout(3) << "Building domain tetrahedral mesh: done\n"; } MeshExpressionTetrahedrizeDomain:: MeshExpressionTetrahedrizeDomain(ReferenceCounting m, ReferenceCounting d) : MeshExpression(0,MeshExpression::tetrahedrizeDomain), __inputMesh(m), __domain(d) { ; } MeshExpressionTetrahedrizeDomain:: MeshExpressionTetrahedrizeDomain(const MeshExpressionTetrahedrizeDomain& m) : MeshExpression(m), __inputMesh(m.__inputMesh), __domain(m.__domain) { ; } MeshExpressionTetrahedrizeDomain:: ~MeshExpressionTetrahedrizeDomain() { ; } void MeshExpressionTransform::execute() { __inputMesh->execute(); __transformationField->execute(); if (__transformationField->numberOfComponents() != 3) { throw ErrorHandler(__FILE__,__LINE__, "mesh transformation needs a 3 component field:\n" +stringify(*__transformationField)+"has " +stringify(__transformationField->numberOfComponents())+" components", ErrorHandler::normal); } MeshTransformer transformer(__inputMesh->mesh(), __transformationField->field()); transformer.transform(); __mesh = transformer.mesh(); } MeshExpressionTransform:: MeshExpressionTransform(ReferenceCounting m, ReferenceCounting f) : MeshExpression(0,MeshExpression::transform), __inputMesh(m), __transformationField(f) { ; } MeshExpressionTransform:: MeshExpressionTransform(const MeshExpressionTransform& m) : MeshExpression(m), __inputMesh(m.__inputMesh), __transformationField(m.__transformationField) { ; } MeshExpressionTransform:: ~MeshExpressionTransform() { ; } void MeshExpressionPeriodic::execute() { (*__inputMesh).execute(); MeshPeriodizer::ReferencesMapping referencesMapping; MappedReferencesList& mappedReferences = (*__mappedReferences); for (MappedReferencesList::iterator i = mappedReferences.begin(); i != mappedReferences.end(); ++i) { (*(*i).first).execute(); (*(*i).second).execute(); const real_t first = (*(*i).first).realValue(); const real_t second= (*(*i).second).realValue(); if ((first != int(first)) or (second != int(second))) { throw ErrorHandler(__FILE__,__LINE__, "invalid periodic references (" +stringify(first)+"<->"+stringify(second) +") You must give integers value", ErrorHandler::normal); } referencesMapping.push_back(std::make_pair(static_cast(first), static_cast(second))); } MeshPeriodizer periodizer((*__inputMesh).mesh(), referencesMapping); periodizer.run(); __mesh = periodizer.mesh(); } MeshExpressionPeriodic:: MeshExpressionPeriodic(ReferenceCounting m, ReferenceCounting l) : MeshExpression(0,MeshExpression::periodic), __inputMesh(m), __mappedReferences(l) { ; } MeshExpressionPeriodic:: MeshExpressionPeriodic(const MeshExpressionPeriodic& m) : MeshExpression(m), __inputMesh(m.__inputMesh), __mappedReferences(m.__mappedReferences) { ; } MeshExpressionPeriodic:: ~MeshExpressionPeriodic() { ; } MeshExpressionUndefined::MeshExpressionUndefined() : MeshExpression(0, MeshExpression::undefined) { ; } MeshExpressionUndefined ::MeshExpressionUndefined(const MeshExpressionUndefined& m) : MeshExpression(m) { ; } MeshExpressionUndefined ::~MeshExpressionUndefined() { ; } freefem3d-1.0pre10/language/VariableRepository.cpp0000644000175000017500000000520210624156366017127 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariableRepository.cpp,v 1.2 2007/05/20 23:02:48 delpinux Exp $ #include #include #include #include #include ReferenceCounting VariableRepository:: find(const std::string& name) const { Container::const_iterator i; size_t level=0; for (; level<=__blockLevel;++level) { i = __variableList[level].find(name); if (i != __variableList[level].end()) break; } if (level>__blockLevel) return 0; if (i == __variableList[level].end()) return 0; else { return i->second; } } void VariableRepository:: add(ReferenceCounting v) { if (find(v->name())) { throw ErrorHandler (__FILE__,__LINE__, "variable "+v->name()+" already declared", ErrorHandler::unexpected); } __variableList[__blockLevel][v->name()]=v; } void VariableRepository:: remove(const std::string& name) { Container::const_iterator i; size_t level=0; for (; level<=__blockLevel;++level) { i = __variableList[level].find(name); if (i != __variableList[level].end()) break; } if ((i != __variableList[level].end()) and (level>__blockLevel)) { __variableList[level].erase(name); } else { const std::string errorMsg = "cannot erase variable "+name +", since it is not declared"; throw ErrorHandler(__FILE__,__LINE__, errorMsg, ErrorHandler::unexpected); } } void VariableRepository:: beginBlock() { __blockLevel++; __variableList.push_back(Container()); } void VariableRepository:: endBlock() { ASSERT(__blockLevel>0); __variableList[__blockLevel].clear(); __blockLevel--; __variableList.pop_back(); } VariableRepository:: VariableRepository() : __blockLevel(0) { __variableList.push_back(Container()); } VariableRepository:: ~VariableRepository() { ; } freefem3d-1.0pre10/language/Makefile.am0000644000175000017500000001577310633010767014642 00000000000000# -*- Mode: makefile -*- # This file is part of ff3d - http://www.freefem.org/ff3d # Copyright (C) 2001, 2002, 2003 Stéphane Del Pino # 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, 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. # $Id: Makefile.am,v 1.27 2007/06/10 15:00:07 delpinux Exp $ noinst_HEADERS = \ BooleanExpression.hpp \ BoundaryConditionExpression.hpp \ BoundaryConditionExpressionDirichlet.hpp \ BoundaryConditionExpressionFourrier.hpp \ BoundaryConditionExpressionNeumann.hpp \ BoundaryConditionListExpression.hpp \ BoundaryExpression.hpp \ BoundaryExpressionList.hpp \ BoundaryExpressionPOVRay.hpp \ BoundaryExpressionSurfaceMesh.hpp \ BoundaryExpressionReferences.hpp \ DomainExpression.hpp \ DomainExpressionAnalytic.hpp \ DomainExpressionSet.hpp \ DomainExpressionUndefined.hpp \ DomainExpressionVariable.hpp \ EmbededFunctions.hpp \ Expression.hpp \ FFLexer.hpp \ FieldExpression.hpp \ FieldExpressionList.hpp \ FunctionExpression.hpp \ FunctionExpressionBinaryOperation.hpp \ FunctionExpressionCFunction.hpp \ FunctionExpressionComposed.hpp \ FunctionExpressionConstant.hpp \ FunctionExpressionConvection.hpp \ FunctionExpressionDerivative.hpp \ FunctionExpressionDomainCharacteristic.hpp \ FunctionExpressionFEM.hpp \ FunctionExpressionIntegrate.hpp \ FunctionExpressionLinearBasis.hpp \ FunctionExpressionMeshCharacteristic.hpp \ FunctionExpressionMeshReferences.hpp \ FunctionExpressionNormalComponent.hpp \ FunctionExpressionNot.hpp \ FunctionExpressionObjectCharacteristic.hpp \ FunctionExpressionRead.hpp \ FunctionExpressionSpectral.hpp \ FunctionExpressionUnaryMinus.hpp \ FunctionExpressionValue.hpp \ FunctionExpressionVariable.hpp \ Information.hpp \ InsideExpression.hpp \ InsideListExpression.hpp \ Instruction.hpp \ IntegratedExpression.hpp \ IntegratedOperatorExpression.hpp \ Lexer.hpp \ LinearExpression.hpp \ MeshExpression.hpp \ MultiLinearExpression.hpp \ MultiLinearExpressionSum.hpp \ MultiLinearFormExpression.hpp \ OptionExpression.hpp \ OFStreamExpression.hpp \ OFStreamExpressionUndefined.hpp \ OFStreamExpressionValue.hpp \ OFStreamExpressionVariable.hpp \ OStreamExpression.hpp \ OStreamExpressionList.hpp \ PDEEquationExpression.hpp \ PDEOperatorExpression.hpp \ PDEOperatorSumExpression.hpp \ PDEProblemExpression.hpp \ PDESystemExpression.hpp \ POVLexer.hpp \ ProblemExpression.hpp \ RealExpression.hpp \ SceneExpression.hpp \ SolutionExpression.hpp \ SolverExpression.hpp \ SolverOptionsExpression.hpp \ StringExpression.hpp \ SubOptionExpression.hpp \ SubOptionListExpression.hpp \ TestFunctionExpressionList.hpp \ UnknownExpression.hpp \ UnknownExpressionDeclaration.hpp \ UnknownExpressionFunction.hpp \ UnknownListExpression.hpp \ Variable.hpp \ VariableLexerRepository.hpp \ VariableRepository.hpp \ VariationalDirichletListExpression.hpp \ VariationalFormulaExpression.hpp \ VariationalOperatorExpression.hpp \ VariationalProblemExpression.hpp \ Vector3Expression.hpp \ XMLLexer.hpp \ parse.ff.hpp \ parse.pov.hpp noinst_LIBRARIES= \ libfflanguage.a \ libpovlanguage.a \ libxmllanguage.a libfflanguage_a_SOURCES= \ FFLexer.cpp \ \ BooleanExpression.cpp \ BoundaryConditionExpression.cpp \ BoundaryConditionExpressionDirichlet.cpp \ BoundaryConditionExpressionFourrier.cpp \ BoundaryConditionExpressionNeumann.cpp \ BoundaryConditionListExpression.cpp \ BoundaryExpression.cpp \ BoundaryExpressionList.cpp \ BoundaryExpressionPOVRay.cpp \ BoundaryExpressionReferences.cpp \ BoundaryExpressionSurfaceMesh.cpp \ DomainExpression.cpp \ DomainExpressionAnalytic.cpp \ DomainExpressionSet.cpp \ DomainExpressionUndefined.cpp \ DomainExpressionVariable.cpp \ EmbededFunctions.cpp \ FieldExpression.cpp \ FieldExpressionList.cpp \ FunctionExpression.cpp \ FunctionExpressionBinaryOperation.cpp \ FunctionExpressionCFunction.cpp \ FunctionExpressionComposed.cpp \ FunctionExpressionConstant.cpp \ FunctionExpressionConvection.cpp \ FunctionExpressionDerivative.cpp \ FunctionExpressionDomainCharacteristic.cpp \ FunctionExpressionFEM.cpp \ FunctionExpressionIntegrate.cpp \ FunctionExpressionLinearBasis.cpp \ FunctionExpressionMeshCharacteristic.cpp \ FunctionExpressionMeshReferences.cpp \ FunctionExpressionNormalComponent.cpp \ FunctionExpressionNot.cpp \ FunctionExpressionObjectCharacteristic.cpp \ FunctionExpressionRead.cpp \ FunctionExpressionSpectral.cpp \ FunctionExpressionUnaryMinus.cpp \ FunctionExpressionValue.cpp \ FunctionExpressionVariable.cpp \ Information.cpp \ Instruction.cpp \ InsideListExpression.cpp \ MeshExpression.cpp \ MultiLinearExpression.cpp \ MultiLinearExpressionSum.cpp \ OFStreamExpressionVariable.cpp \ OStreamExpression.cpp \ PDEOperatorExpression.cpp \ PDEOperatorSumExpression.cpp \ PDEEquationExpression.cpp \ PDEProblemExpression.cpp \ PDESystemExpression.cpp \ RealExpression.cpp \ SceneExpression.cpp \ SolverExpression.cpp \ StringExpression.cpp \ SubOptionExpression.cpp \ TestFunctionExpressionList.cpp \ UnknownExpressionDeclaration.cpp \ UnknownExpressionFunction.cpp \ UnknownListExpression.cpp \ Variable.cpp \ VariableLexerRepository.cpp \ VariableRepository.cpp \ VariationalDirichletListExpression.cpp \ VariationalFormulaExpression.cpp \ VariationalProblemExpression.cpp \ Vector3Expression.cpp \ parse.ff.yy libpovlanguage_a_SOURCES= \ POVLexer.cpp \ parse.pov.yy libxmllanguage_a_SOURCES= \ XMLLexer.cpp \ parse.xml.yy CLEANFILES= \ parse.ff.cc \ parse.ff.h \ parse.ff.output \ parse.pov.cc \ parse.pov.h \ parse.pov.output \ parse.xml.cc \ parse.xml.h \ parse.xml.output BUILT_SOURCES= \ parse.ff.cc \ parse.ff.h \ parse.pov.cc \ parse.pov.h \ parse.xml.cc \ parse.xml.h parse.ff.cc parse.ff.h: $(srcdir)/parse.ff.yy $(YACC) -p ff -o parse.ff.cc --defines="parse.ff.h" -v $< parse.pov.cc parse.pov.h: $(srcdir)/parse.pov.yy $(YACC) -p pov -o parse.pov.cc --defines="parse.pov.h" -v $< parse.xml.cc parse.xml.h: $(srcdir)/parse.xml.yy $(YACC) -p xml -o parse.xml.cc --defines="parse.xml.h" -v $< freefem3d-1.0pre10/language/DomainExpressionVariable.cpp0000644000175000017500000000337310563377365020254 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpressionVariable.cpp,v 1.3 2007/02/10 17:20:53 delpinux Exp $ #include #include #include ReferenceCounting DomainExpressionVariable::domainExpression() const { return __domainVariable->expression(); } DomainExpressionVariable:: DomainExpressionVariable(const std::string& domainName) : DomainExpression(DomainExpression::variable), __domainName(domainName), __domainVariable(0) { ; } DomainExpressionVariable:: DomainExpressionVariable(const DomainExpressionVariable& e) : DomainExpression(e), __domainName(e.__domainName), __domainVariable(e.__domainVariable) { ; } DomainExpressionVariable:: ~DomainExpressionVariable() { ; } void DomainExpressionVariable:: execute() { __domainVariable = VariableRepository::instance().findVariable(__domainName); __domain = __domainVariable->expression()->domain(); } freefem3d-1.0pre10/language/RealExpression.hpp0000644000175000017500000002651010624156366016257 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: RealExpression.hpp,v 1.12 2007/05/20 23:15:36 delpinux Exp $ #ifndef REAL_EXPRESSION_HPP #define REAL_EXPRESSION_HPP #include #include #include #include #include #include class RealExpression : public Expression { protected: //! The value. real_t __realValue; private: std::ostream& put(std::ostream& os) const { os << this->realValue(); return os; } public: virtual ReferenceCounting value() = 0; /** * Read only access to the real value * * @todo Return type should use traits. * @return the value of the expression. */ inline const real_t& realValue() const { return __realValue; } /** * Access to the real value * * @todo Return type should use traits. * @return the value of the expression. */ inline real_t& realValue() { return __realValue; } RealExpression(const RealExpression& e) : Expression(e), __realValue(e.__realValue) { ; } RealExpression() : Expression(Expression::real), __realValue(0) { ; } virtual ~RealExpression() { ; } }; class RealExpressionValue : public RealExpression { public: ReferenceCounting value() { return this; } void execute() { ; } RealExpressionValue(const real_t d) { __realValue = d; } RealExpressionValue(const RealExpressionValue& re) { ; } ~RealExpressionValue() { ; } }; class BooleanExpression; class RealExpressionBoolean : public RealExpression { private: ReferenceCounting __booleanExpression; public: ReferenceCounting value(); void execute(); RealExpressionBoolean(ReferenceCounting be); RealExpressionBoolean(const RealExpressionBoolean& re); ~RealExpressionBoolean(); }; class RealExpressionVariable : public RealExpression { private: std::string __variableName; ReferenceCounting __realVariable; ReferenceCounting __expression; public: friend class RealExpressionPreIncrement; friend class RealExpressionPostIncrement; friend class RealExpressionPreDecrement; friend class RealExpressionPostDecrement; ReferenceCounting value(); void execute(); RealExpressionVariable(const std::string& variableName); RealExpressionVariable(const RealExpressionVariable& e); ~RealExpressionVariable(); }; class FunctionExpression; class Vector3Expression; /** * @note This class implementation is ugly * */ class RealExpressionFunctionEvaluate : public RealExpression { private: ReferenceCounting __realFunction; ReferenceCounting __v; ReferenceCounting __x; ReferenceCounting __y; ReferenceCounting __z; public: ReferenceCounting value(); void execute(); RealExpressionFunctionEvaluate(ReferenceCounting f, ReferenceCounting x, ReferenceCounting y, ReferenceCounting z); RealExpressionFunctionEvaluate(ReferenceCounting f, ReferenceCounting v); RealExpressionFunctionEvaluate(const RealExpressionFunctionEvaluate& e); ~RealExpressionFunctionEvaluate(); }; class RealExpressionIntegrate : public RealExpression { private: ReferenceCounting __realFunction; ReferenceCounting __mesh; const DiscretizationType::Type __discretizationType; template real_t __integrate(const MeshType& M, const QuadratureType& Q, FunctionExpression& f); template real_t __integrate(const MeshType& M, FunctionExpression& f); public: ReferenceCounting value(); void execute(); RealExpressionIntegrate(ReferenceCounting f, ReferenceCounting m, const DiscretizationType::Type& discretizationType = DiscretizationType::lagrangianFEM1); RealExpressionIntegrate(const RealExpressionIntegrate& e); ~RealExpressionIntegrate(); }; class RealExpressionMinMax : public RealExpression { private: const std::string __operatorName; ReferenceCounting __realFunction; ReferenceCounting __mesh; public: ReferenceCounting value(); void execute(); RealExpressionMinMax(const std::string& operatorName, ReferenceCounting f, ReferenceCounting m); RealExpressionMinMax(const RealExpressionMinMax& e); ~RealExpressionMinMax(); }; class RealExpressionPreIncrement : public RealExpression { private: ReferenceCounting __variable; public: ReferenceCounting value() { return new RealExpressionValue(__realValue); } void execute() { (*__variable).execute(); __realValue = (*__variable).realValue()+1; (*(*__variable).__realVariable) = new RealExpressionValue(__realValue); } RealExpressionPreIncrement(ReferenceCounting v) : __variable(v) { ; } RealExpressionPreIncrement(const RealExpressionPreIncrement& r) : RealExpression(r), __variable(r.__variable) { ; } ~RealExpressionPreIncrement() { ; } }; class RealExpressionPostIncrement : public RealExpression { private: ReferenceCounting __variable; public: ReferenceCounting value() { return new RealExpressionValue(__realValue); } void execute() { (*__variable).execute(); __realValue = (*__variable).realValue(); (*(*__variable).__realVariable) = new RealExpressionValue(__realValue+1); } RealExpressionPostIncrement(ReferenceCounting v) : __variable(v) { ; } RealExpressionPostIncrement(const RealExpressionPostIncrement& r) : RealExpression(r), __variable(r.__variable) { ; } ~RealExpressionPostIncrement() { ; } }; class RealExpressionPreDecrement : public RealExpression { private: ReferenceCounting __variable; public: ReferenceCounting value() { return this; } void execute() { (*__variable).execute(); __realValue = (*__variable).realValue()-1; (*(*__variable).__realVariable) = new RealExpressionValue(__realValue); } RealExpressionPreDecrement(ReferenceCounting v) : __variable(v) { ; } RealExpressionPreDecrement(const RealExpressionPreDecrement& r) : RealExpression(r), __variable(r.__variable) { ; } ~RealExpressionPreDecrement() { ; } }; class RealExpressionPostDecrement : public RealExpression { private: ReferenceCounting __variable; public: ReferenceCounting value() { return this; } void execute() { (*__variable).execute(); __realValue = (*__variable).realValue(); (*(*__variable).__realVariable) = new RealExpressionValue(__realValue-1); } RealExpressionPostDecrement(ReferenceCounting v) : __variable(v) { ; } RealExpressionPostDecrement(const RealExpressionPostDecrement& r) : RealExpression(r), __variable(r.__variable) { ; } ~RealExpressionPostDecrement() { ; } }; class RealExpressionCFunction : public RealExpression { private: const std::string __cfunction; ReferenceCounting __r; public: ReferenceCounting value() { return new RealExpressionValue(__realValue); } void execute() { (*__r).execute(); if (__cfunction == "abs") { __realValue = std::abs(__r->realValue()); return; } if (__cfunction == "sin") { __realValue = std::sin(__r->realValue()); return; } if (__cfunction == "cos") { __realValue = std::cos(__r->realValue()); return; } if (__cfunction == "tan") { __realValue = std::tan(__r->realValue()); return; } if (__cfunction == "asin") { __realValue = std::asin(__r->realValue()); return; } if (__cfunction == "acos") { __realValue = std::acos(__r->realValue()); return; } if (__cfunction == "atan") { __realValue = std::atan(__r->realValue()); return; } if (__cfunction == "sqrt") { __realValue = std::sqrt(__r->realValue()); return; } if (__cfunction == "exp") { __realValue = std::exp(__r->realValue()); return; } if (__cfunction == "log") { __realValue = std::log(__r->realValue()); return; } throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } RealExpressionCFunction(const std::string& cfuntion, ReferenceCounting r) : __cfunction(cfuntion), __r(r) { ; } RealExpressionCFunction(const RealExpressionCFunction& e) : __cfunction(e.__cfunction), __r(e.__r) { ; } ~RealExpressionCFunction() { ; } }; template class RealExpressionUnaryOperator : public RealExpression { private: ReferenceCounting __r; public: ReferenceCounting value() { return new RealExpressionValue(__realValue); } void execute() { (*__r).execute(); __realValue = (*F)((*__r).realValue()); } RealExpressionUnaryOperator(ReferenceCounting r) : __r(r) { ; } RealExpressionUnaryOperator(const RealExpressionUnaryOperator& e) : __r(e.__r) { ; } ~RealExpressionUnaryOperator() { ; } }; template class RealExpressionBinaryOperator : public RealExpression { private: ReferenceCounting __r1; ReferenceCounting __r2; public: ReferenceCounting value() { return new RealExpressionValue(__realValue); } void execute() { (*__r1).execute(); (*__r2).execute(); __realValue = B((*__r1).realValue(), (*__r2).realValue()); } RealExpressionBinaryOperator(ReferenceCounting r1, ReferenceCounting r2) : __r1(r1), __r2(r2) { ; } RealExpressionBinaryOperator(const RealExpressionBinaryOperator& e) : __r1(e.__r1), __r2(e.__r2) { ; } ~RealExpressionBinaryOperator() { ; } }; #endif // REAL_EXPRESSION_HPP freefem3d-1.0pre10/language/XMLLexer.hpp0000644000175000017500000000240310633010674014736 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: XMLLexer.hpp,v 1.2 2007/06/10 14:59:08 delpinux Exp $ #ifndef XML_LEXER_HPP #define XML_LEXER_HPP #include class XMLLexer : public Lexer { private: bool __definingToken; public: //! The lexer function. int yylex(); //! Constructs a XMLLexer for given std::istream and std::ostream. XMLLexer(std::istream& in, std::ostream& out = std::cout); //! Destructor. ~XMLLexer() { ; } }; #endif // XML_LEXER_HPP freefem3d-1.0pre10/language/VariationalDirichletListExpression.cpp0000644000175000017500000000472410561425532022321 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariationalDirichletListExpression.cpp,v 1.1 2006/08/27 21:38:58 delpinux Exp $ #include #include std::ostream& VariationalDirichletListExpression:: put(std::ostream& os) const { for (ListType::const_iterator i = __list.begin(); i != __list.end(); ++i) { os << *(*i) << '\n'; } return os; } bool VariationalDirichletListExpression:: hasPOVBoundary() const { for (ListType::const_iterator i = __list.begin(); i != __list.end(); ++i) { if ((*(*i)).hasPOVBoundary()) return true; } return false; } VariationalDirichletListExpression::iterator VariationalDirichletListExpression:: begin() { return __list.begin(); } VariationalDirichletListExpression::const_iterator VariationalDirichletListExpression:: begin() const { return __list.begin(); } VariationalDirichletListExpression::const_iterator VariationalDirichletListExpression:: end() const { return __list.end(); } void VariationalDirichletListExpression:: execute() { for (ListType::iterator i = __list.begin(); i != __list.end(); ++i) { (*(*i)).execute(); } } void VariationalDirichletListExpression:: add(ReferenceCounting d) { __list.push_back(d); } VariationalDirichletListExpression:: VariationalDirichletListExpression() : Expression(Expression::variationalDirichlet) { ; } VariationalDirichletListExpression:: VariationalDirichletListExpression(const VariationalDirichletListExpression& V) : Expression(V), __list(V.__list) { ; } VariationalDirichletListExpression:: ~VariationalDirichletListExpression() { ; } freefem3d-1.0pre10/language/BoundaryConditionExpressionNeumann.cpp0000644000175000017500000000450010563377365022344 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryConditionExpressionNeumann.cpp,v 1.4 2007/02/10 17:20:53 delpinux Exp $ #include #include #include #include #include #include #include std::ostream& BoundaryConditionExpressionNeumann:: put(std::ostream& os) const { os << "\t\tdnu(" << __unknownName << ") = "<< (*__g) << " on " << (*__boundary); return os; } void BoundaryConditionExpressionNeumann:: execute() { __boundary->execute(); __g->execute(); ConstReferenceCounting g = __g->function(); ReferenceCounting L = Information::instance().getUnknownList(); size_t n = L->number(__unknownName); ReferenceCounting N = new Neumann(g,n); __boundaryCondition = new BoundaryCondition(N, __boundary->boundary()); } BoundaryConditionExpressionNeumann:: BoundaryConditionExpressionNeumann(const std::string& unknownName, ReferenceCounting g, ReferenceCounting boundary) : BoundaryConditionExpression(boundary, unknownName, BoundaryConditionExpression::neumann), __g(g) { ; } BoundaryConditionExpressionNeumann:: BoundaryConditionExpressionNeumann(const BoundaryConditionExpressionNeumann& d) : BoundaryConditionExpression(d), __g(d.__g) { ; } BoundaryConditionExpressionNeumann:: ~BoundaryConditionExpressionNeumann() { ; } freefem3d-1.0pre10/language/FunctionExpressionValue.hpp0000644000175000017500000000434110561425532020146 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionValue.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_VALUE_HPP #define FUNCTION_EXPRESSION_VALUE_HPP #include /** * @file FunctionExpressionValue.hpp * @author Stephane Del Pino * @date Wed Jul 19 11:25:48 2006 * * @brief Embeddes the value of a function expression. * * This class does not know anymore which expression was used to * create the function it juste embeddes the ScalarFunctionBase */ class FunctionExpressionValue : public FunctionExpression { private: const bool __hasBoundary; /**< @b true if the original function expression had a boundary*/ public: /** * Executes the expression. * @note nothing to do ;-) */ void execute() { ; } /** * Checks wether this expression requieres a boundary for evaluation * * @return __hasBoundary */ bool hasBoundaryExpression() const { return __hasBoundary; } /** * Constructor * * @param f a ScalarFunctionBase * @param hasBoundary does @a f requires a boundary */ FunctionExpressionValue(ConstReferenceCounting f, const bool& hasBoundary); /** * Copy constructor * * @param f a given expression value */ FunctionExpressionValue(const FunctionExpressionValue& f); /** * Destructor * */ ~FunctionExpressionValue(); }; #endif // FUNCTION_EXPRESSION_VALUE_HPP freefem3d-1.0pre10/language/parse.xml.yy0000644000175000017500000000656210633010674015073 00000000000000%{ /* -*- c++ -*- */ /* * This file is part of ff3d - http://www.freefem.org/ff3d * Copyright (C) 2001, 2002, 2003 Stéphane Del Pino * * 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, 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. * * $Id: parse.xml.yy,v 1.2 2007/06/10 14:59:08 delpinux Exp $ * */ #define YYDEBUG 1 #include #include #include #include #include #include #include #include typedef std::list XMLAttributeList; #include extern XMLLexer* xmllexer; void yyerror (char* s); #define xmllex xmllexer->xmllex %} %union { std::string* str; XMLAttribute* xmlattribute; XMLAttributeList* xmlattributelist; XMLTag* xmltag; std::istream::pos_type* position; }; %token NAME %token STRING %token POSITION %token SPACE %type opentag %type attribute %type attributelist %token LT %token GT /* Don't care about following shift/reduce problems: */ %expect 0 %% /* Grammar rules and actions follow */ input: /* empty */ head data { ; } ; head: LT '?' NAME spacelist NAME '=' STRING spacelistornot '?' GT { XMLFileReader::instance().xmlTree()->setHead(*$3,*$5,*$7); } ; data: taglist { } ; taglist: tag { } | taglist tag { } ; tag: spacelistornot opentag { } | spacelistornot closetag { } | spacelistornot POSITION { if (not XMLFileReader::instance().xmlTree()->hasOpenTag()) { throw ErrorHandler(__FILE__,__LINE__, "no open tag", ErrorHandler::compilation); } XMLFileReader::instance().xmlTree()->getCurrentTag()->add(new XMLContentPosition(*$2)); } ; opentag: LT NAME attributelist spacelistornot GT { $$ = new XMLTag(*$2); for (XMLAttributeList::const_iterator i = $3->begin(); i != $3->end(); ++i) { $$->add(*i); } XMLFileReader::instance().xmlTree()->addTag($$); } | LT NAME spacelistornot GT { $$ = new XMLTag(*$2); XMLFileReader::instance().xmlTree()->addTag($$); } ; closetag: LT '/' NAME spacelistornot GT { XMLFileReader::instance().xmlTree()->closeTag(*$3); } ; attributelist: spacelist attribute { $$ = new std::list; $$->push_back($2); } | attributelist spacelist attribute { $$ = $1; $$->push_back($3); } ; attribute: NAME spacelistornot '=' spacelistornot STRING { $$ = new XMLAttribute(*$1,*$5); } ; spacelistornot: | spacelist { ; } ; spacelist: SPACE { ; } | spacelist SPACE { ; } ; %% void yyerror(char * s) { throw ErrorHandler("PARSED FILE",xmllexer->lineno(), stringify(s)+" after '"+xmllexer->YYText()+"'", ErrorHandler::compilation); } freefem3d-1.0pre10/language/FunctionExpressionCFunction.cpp0000644000175000017500000000240210561425532020751 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionCFunction.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include void FunctionExpressionCFunction:: execute() { __functionExpression->execute(); ScalarFunctionBuilder functionBuilder; functionBuilder.setFunction(__functionExpression->function()); functionBuilder.setCFunction(__cfunction); __scalarFunction = functionBuilder.getBuiltFunction(); } freefem3d-1.0pre10/language/OFStreamExpression.hpp0000644000175000017500000000422310562730012017034 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: OFStreamExpression.hpp,v 1.3 2007/02/08 23:19:38 delpinux Exp $ #ifndef OFSTREAM_EXPRESSION_HPP #define OFSTREAM_EXPRESSION_HPP #include #include #include #include /** * @file OFStreamExpression.hpp * @author Stephane Del Pino * @date Fri Dec 29 20:56:43 2006 * * @brief Base class for ofstream expression */ class OFStreamExpression : public Expression { public: enum Type { undefined, value, variable }; protected: const Type __type; /**< type of the expression */ ReferenceCounting __fout; virtual std::ostream& put(std::ostream & os) const { return os; } public: /** * Access to the file stream pointer * * @return __fout */ std::ofstream* ofstream() { if (__type == undefined) { throw ErrorHandler(__FILE__,__LINE__, "using undefined stream", ErrorHandler::normal); } return __fout; } OFStreamExpression(const OFStreamExpression::Type& type) : Expression(Expression::ofstreamexpression), __type(type), __fout(0) { ; } OFStreamExpression(const OFStreamExpression& ofs) : Expression(ofs), __type(ofs.__type), __fout(ofs.__fout) { ; } virtual ~OFStreamExpression() { ; } }; #endif // OFSTREAM_EXPRESSION_HPP freefem3d-1.0pre10/language/FunctionExpressionNormalComponent.hpp0000644000175000017500000000446210561425532022211 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionNormalComponent.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_NORMAL_COMPONENT_HPP #define FUNCTION_EXPRESSION_NORMAL_COMPONENT_HPP #include #include /** * @file FunctionExpressionNormalComponent.hpp * @author Stephane Del Pino * @date Wed Jul 19 00:42:34 2006 * * @brief Manages normal-component expressions * */ class FunctionExpressionNormalComponent : public FunctionExpression { private: ScalarFunctionNormal::ComponentType __normalType; /**< type of normal component \f$(n_x, n_y \mbox{ or } n_z)\f$ */ public: /** * This function requires a boundary * * @return @b true */ bool hasBoundaryExpression() const { return true; } /** * Executes the expression * */ void execute(); /** * Copy constructor * * @param f the given function * */ FunctionExpressionNormalComponent(const FunctionExpressionNormalComponent& f) : FunctionExpression(f), __normalType(f.__normalType) { ; } /** * Constructor * * @param componentType type of the normal component * */ FunctionExpressionNormalComponent(ScalarFunctionNormal::ComponentType componentType) : FunctionExpression(FunctionExpression::normalComponent), __normalType(componentType) { ; } /** * Destructor * */ ~FunctionExpressionNormalComponent() { ; } }; #endif // FUNCTION_EXPRESSION_NORMAL_COMPONENT_HPP freefem3d-1.0pre10/language/SceneExpression.hpp0000644000175000017500000000673710562730012016425 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: SceneExpression.hpp,v 1.4 2007/02/08 23:19:38 delpinux Exp $ #ifndef SCENE_EXPRESSION_HPP #define SCENE_EXPRESSION_HPP #include #include #include /*! \class SceneExpression This class defines the base class of Scene expressions. \author Stephane Del Pino */ class Scene; class SceneExpression : public Expression { protected: ReferenceCounting __scene; public: enum SceneType { undefined, povray, transform, variable }; private: SceneExpression::SceneType __sceneType; public: ReferenceCounting scene() const; const SceneExpression::SceneType& sceneType() const { return __sceneType; } SceneExpression(const SceneExpression& e); SceneExpression(ReferenceCounting m, const SceneExpression::SceneType& t); virtual ~SceneExpression(); }; /*! \class SceneExpressionPOVRay This class defines the class of povray Scene expressions. \author Stephane Del Pino */ class SceneExpressionPOVRay : public SceneExpression { private: ReferenceCounting __filename; std::ostream& put(std::ostream& os) const; public: void execute(); SceneExpressionPOVRay(ReferenceCounting s); SceneExpressionPOVRay(const SceneExpressionPOVRay& m); ~SceneExpressionPOVRay(); }; class SceneExpressionVariable : public SceneExpression { private: const std::string __sceneName; ReferenceCounting __sceneVariable; std::ostream& put(std::ostream& os) const { os << __sceneVariable->name() << ": " << (*__sceneVariable->expression()); return os; } public: void execute(); SceneExpressionVariable(const std::string& sceneName); SceneExpressionVariable(const SceneExpressionVariable& e); ~SceneExpressionVariable(); }; class FieldExpression; class SceneExpressionTransform : public SceneExpression { private: ReferenceCounting __sceneExpression; ReferenceCounting __fieldExpression; std::ostream& put(std::ostream& os) const; public: void execute(); SceneExpressionTransform(const SceneExpressionTransform& s); SceneExpressionTransform(ReferenceCounting sceneExpression, ReferenceCounting fieldExpression); ~SceneExpressionTransform(); }; class SceneExpressionUndefined : public SceneExpression { private: std::ostream& put(std::ostream& os) const { os << "undefined scene"; return os; } public: void execute() { ; } SceneExpressionUndefined(); SceneExpressionUndefined(const SceneExpressionUndefined& m); ~SceneExpressionUndefined(); }; #endif // SCENE_EXPRESSION_HPP freefem3d-1.0pre10/language/VariationalProblemExpression.hpp0000644000175000017500000001276510563377365021203 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariationalProblemExpression.hpp,v 1.8 2007/02/10 17:20:53 delpinux Exp $ #ifndef VARIATIONAL_PROBLEM_EXPRESSION_HPP #define VARIATIONAL_PROBLEM_EXPRESSION_HPP #include #include #include #include #include #include #include class PDECondition; class Boundary; /** * @file VariationalProblemExpression.hpp * @author Stephane Del Pino * @date Wed May 29 17:32:59 2002 * * @brief This class describes Variational Problems * * This class describes Variational Problems */ class VariationalProblem; class VariationalProblemExpression : public ProblemExpression { private: ReferenceCounting __variationalFormula; /**< the variational formula */ ReferenceCounting __dirichletList; /**< the NON-natural boundary conditions */ ReferenceCounting __unknownList; /**< list of unknowns */ ReferenceCounting __testFunctionList; /**< list of testFunctions */ ReferenceCounting __variationalProblem; /**< Variational Problem */ /** * Expression::put() overloading * * @param os input stream * * @return os */ std::ostream& put(std::ostream& os) const { os << *__variationalFormula << '\n'; os << *__dirichletList << '\n'; return os; } class AlgebraicPlus; class AlgebraicMinus; /** * Converts bilinear expression to variationnal form * * @param bilinearList the bilinear expression * */ template void __internalSetBilinear(VariationalFormulaExpression::BilinearOperatorList& bilinearList); /** * Converts linear expression to variationnal form * * @param linearList the linear expression * */ template void __internalSetLinear(VariationalFormulaExpression::LinearOperatorList& linearList); /** * Converts bilinear boundary expression to variationnal form * * @param bilinearList the bilinear expression * */ template void __internalSetBilinearBC(VariationalFormulaExpression::BilinearOperatorList& bilinearList); /** * Converts linear boundary expression to variationnal form * * @param linearList the bilinear expression * */ template void __internalSetLinearBC(VariationalFormulaExpression::LinearOperatorList& linearList); /** * Splites linear bounday variational expressions list * * @param testNumber number of the test function * @param f the function in the linear expression * @param b the boundary */ void __splitLinearBoundaryList(const size_t& testNumber, const ScalarFunctionBase* f, const Boundary* b); /** * Splits bilinear boundary variational expression list * * @param unknownNumber * @param testNumber * @param alpha * @param b */ void __splitBilinearBoundaryList(const size_t& unknownNumber, const size_t& testNumber, const ScalarFunctionBase* alpha, const Boundary* b); /** * Splits list of boundary conditions (Dirichlet case) * * @param bcSet the set of boundary condition currently created * @param pde the condition * @param b the boundary */ void __splitBoundaryList(BoundaryConditionSet& bcSet, const PDECondition* pde, const Boundary* b); public: /** */ /** * Checks if the problem expression contains POVRay references. If * it does the execution is stopped. This verification is required * by standard FEM. * * @return true of the */ bool hasPOVBoundary() const; /** * * Access to the variational problem * * @return __variationalProblem */ ReferenceCounting variationalProblem(); /** * Expression::execute() overloading * */ void execute(); /** * Constructs the variational problem * * @param v a variational formula * @param d dirichlet boundary condtions * @param t the test functions set */ VariationalProblemExpression(ReferenceCounting v, ReferenceCounting d, ReferenceCounting t); /** * Copy constructor * * @param vp a variational problem */ VariationalProblemExpression(const VariationalProblemExpression& vp); /** * The destructor * */ ~VariationalProblemExpression(); }; #endif // VARIATIONAL_PROBLEM_EXPRESSION_HPP freefem3d-1.0pre10/language/FunctionExpressionSpectral.hpp0000644000175000017500000000404710604042141020637 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionSpectral.hpp,v 1.1 2007/04/01 23:46:41 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_SPECTRAL_HPP #define FUNCTION_EXPRESSION_SPECTRAL_HPP #include class MeshExpression; /** * @file FunctionExpressionSpectral.hpp * @author Stephane Del Pino * @date Wed Jul 5 14:31:21 2006 * * @brief Manipulates finite element function expressions * */ class FunctionExpressionSpectral : public FunctionExpression { private: ReferenceCounting __mesh; /**< mesh of discretization */ ReferenceCounting __functionExpression; /**< expression defining the function */ public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param mesh mesh of discretization * @param e expression of the function */ FunctionExpressionSpectral(ReferenceCounting mesh, ReferenceCounting e); /** * Copy constructor * * @param f given finite element function expression * */ FunctionExpressionSpectral(const FunctionExpressionSpectral& f); /** * Destructor * */ ~FunctionExpressionSpectral(); }; #endif // FUNCTION_EXPRESSION_Spectral_HPP freefem3d-1.0pre10/language/OptionExpression.hpp0000644000175000017500000000356510561425532016643 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: OptionExpression.hpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ #ifndef _OPTIONS_EXPRESSION_HPP_ #define _OPTIONS_EXPRESSION_HPP_ #include #include class OptionExpression : public Expression { private: std::ostream& put(std::ostream& os) const { os << *__name << '(' << *__options << ')'; return os; } ReferenceCounting __name; ReferenceCounting __options; public: void execute() { (*__name).execute(); (*__options).execute(); //! Passes the base name to options. (*__options).evaluate((*__name).value()); } OptionExpression(ReferenceCounting name, ReferenceCounting option) : Expression(Expression::option), __name(name), __options(option) { ; } OptionExpression(const OptionExpression& o) : Expression(o), __name(o.__name), __options(o.__options) { ; } ~OptionExpression() { ; } }; #endif // _OPTIONS_EXPRESSION_HPP_ freefem3d-1.0pre10/language/MultiLinearExpressionSum.hpp0000644000175000017500000000441310633010754020272 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: MultiLinearExpressionSum.hpp,v 1.1 2007/06/10 14:59:56 delpinux Exp $ #ifndef MULTI_LINEAR_EXPRESSION_SUM_HPP #define MULTI_LINEAR_EXPRESSION_SUM_HPP #include #include #include #include class MultiLinearExpressionSum : public Expression { private: typedef std::list > ListType; public: typedef ListType::iterator iterator; MultiLinearExpressionSum::iterator beginPlus() { return __listPlus.begin(); } MultiLinearExpressionSum::iterator endPlus() { return __listPlus.end(); } MultiLinearExpressionSum::iterator beginMinus() { return __listMinus.begin(); } MultiLinearExpressionSum::iterator endMinus() { return __listMinus.end(); } private: ListType __listPlus; ListType __listMinus; std::ostream& put(std::ostream& os) const; public: void plus(ReferenceCounting m) { __listPlus.push_back(m); } void minus(ReferenceCounting m) { __listMinus.push_back(m); } void check(); void execute(); MultiLinearExpressionSum() : Expression(Expression::multiLinearExpSum) { ; } MultiLinearExpressionSum(const MultiLinearExpressionSum& M) : Expression(M), __listPlus(M.__listPlus), __listMinus(M.__listMinus) { ; } ~MultiLinearExpressionSum() { ; } }; #endif // MULTI_LINEAR_EXPRESSION_SUM_HPP freefem3d-1.0pre10/language/FunctionExpressionRead.hpp0000644000175000017500000000712010633010675017741 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionRead.hpp,v 1.2 2007/06/10 14:59:09 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_READ_HPP #define FUNCTION_EXPRESSION_READ_HPP #include class FileDescriptor; class StringExpression; class RealExpression; class MeshExpression; /** * @file FunctionExpressionRead.hpp * @author Stephane Del Pino * @date Wed Jul 19 00:53:00 2006 * * @brief Describes function expression readers * */ class FunctionExpressionRead : public FunctionExpression { private: ReferenceCounting __fileDescriptor; /**< file descriptor */ ReferenceCounting __fileName; /**< file name */ ReferenceCounting __functionName; /**< function name */ ReferenceCounting __componentNumber; /**< component numberxo */ ReferenceCounting __mesh; /**< mesh associated */ public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param descriptor file descriptor * @param fileName file name * @param mesh the mesh */ FunctionExpressionRead(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting mesh); /** * Constructor * * @param descriptor file descriptor * @param fileName file name * @param functionName function name * @param mesh the mesh */ FunctionExpressionRead(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting functionName, ReferenceCounting mesh); /** * Constructor * * @param descriptor file descriptor * @param fileName file name * @param functionName function name * @param componentNumber component number * @param mesh the mesh */ FunctionExpressionRead(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting functionName, ReferenceCounting componentNumber, ReferenceCounting mesh); /** * Constructor * * @param descriptor file descriptor * @param fileName file name * @param functionName function name * @param componentNumber component number * @param mesh the mesh */ FunctionExpressionRead(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting componentNumber, ReferenceCounting mesh); /** * Copy constructor * * @param f given function expression */ FunctionExpressionRead(const FunctionExpressionRead& f); /** * Destructor * */ ~FunctionExpressionRead(); }; #endif // FUNCTION_EXPRESSION_READ_HPP freefem3d-1.0pre10/language/InsideExpression.hpp0000644000175000017500000000550410561425532016601 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: InsideExpression.hpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ #ifndef INSIDE_EXPRESSION_HPP #define INSIDE_EXPRESSION_HPP #include #include #include /** * @file InsideExpression.hpp * @author Stephane Del Pino * @date Tue Nov 12 16:06:48 2002 * * @brief This class is used to build caracteristic function of sets * of objects defined by a given color. * * */ class InsideExpression : public Expression { private: ReferenceCounting __reference; /**< The reference */ const bool __inside; /**< true for inside, false for outside */ /** * Expression::put function overloading * * @param os * * @return os */ std::ostream& put(std::ostream& os) const { if (__inside) { os << "inside("; } else { os << "outside("; } os << *__reference; os << ')'; return os; } public: /** * Returns the reference * * * @return x */ const TinyVector<3> reference() const { TinyVector<3> x; for (size_t i=0; i<3; ++i) x[i] = (*__reference).value(i); return x; } /** * Specialization of execute * */ void execute() { (*__reference).execute(); } /** * Returns true if one wants to caracterize the inside of the * domain, false for outside * * @return __inside */ const bool& inside() const { return __inside; } /** * Constructor * * @param inside * @param ref * */ InsideExpression(const bool inside, ReferenceCounting ref) : Expression(Expression::insideExpression), __reference(ref), __inside(inside) { ; } /** * Copy constructor * * @param IE * */ InsideExpression(const InsideExpression& IE) : Expression(IE), __reference(IE.__reference), __inside(IE.__inside) { ; } /** * Destructor * */ ~InsideExpression() { ; } }; #endif // INSIDE_EXPRESSION_HPP freefem3d-1.0pre10/language/OFStreamExpressionValue.hpp0000644000175000017500000000407610561425532020046 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: OFStreamExpressionValue.hpp,v 1.1 2006/12/30 00:17:05 delpinux Exp $ #ifndef OFSTREAM_EXPRESSION_VALUE_HPP #define OFSTREAM_EXPRESSION_VALUE_HPP #include #include #include /** * @file OFStreamExpressionValue.hpp * @author Stephane Del Pino * @date Sat Dec 30 00:27:13 2006 * * @brief ofstream expression instanciation */ class OFStreamExpressionValue : public OFStreamExpression { private: ReferenceCounting __filename; /**< expression for the filename */ public: /** * Creates the ofstream * */ void execute() { __filename->execute(); __fout = new std::ofstream(__filename->value()); } /** * Constructor * * @param filename given filename expression */ OFStreamExpressionValue(ReferenceCounting filename) : OFStreamExpression(OFStreamExpression::value), __filename(filename) { ; } /** * Copy constructor * * @param ofs */ OFStreamExpressionValue(const OFStreamExpressionValue& ofs) : OFStreamExpression(ofs), __filename(ofs.__filename) { ; } /** * Destructor * */ ~OFStreamExpressionValue() { ; } }; #endif // OFSTREAM_EXPRESSION_VALUE_HPP freefem3d-1.0pre10/language/BoundaryExpressionReferences.hpp0000644000175000017500000000470010561425532021150 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryExpressionReferences.hpp,v 1.1 2006/08/27 21:33:53 delpinux Exp $ #ifndef BOUNDARY_EXPRESSION_REFERENCES_HPP #define BOUNDARY_EXPRESSION_REFERENCES_HPP #include #include /** * @file BoundaryExpressionReferences.hpp * @author Stephane Del Pino * @date Mon Aug 7 16:22:01 2006 * * @brief This class defines boundary expression reference */ class BoundaryExpressionReferences : public BoundaryExpression { public: typedef std::set > ReferencesSet; private: ReferencesSet __references; /**< set of references */ /** * Writes the expression to a stream * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * Check is boundary has POVRay references * * @return false */ bool hasPOVBoundary() const { return false; } /** * Eexecutes the expression * */ void execute(); /** * Adds a reference to the set * * @param reference added reference */ void add(ReferenceCounting reference) { __references.insert(reference); } /** * Constructor * */ BoundaryExpressionReferences(); /** * Constructor * * @param borderName name of the border */ BoundaryExpressionReferences(const std::string& borderName); /** * Copy constructor * * @param r given boundary expression reference */ BoundaryExpressionReferences(const BoundaryExpressionReferences& r); /** * Destructor * */ ~BoundaryExpressionReferences(); }; #endif // BOUNDARY_EXPRESSION_REFERENCES_HPP freefem3d-1.0pre10/language/FunctionExpressionConvection.cpp0000644000175000017500000000673010612753642021203 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionConvection.cpp,v 1.5 2007/04/22 21:46:10 delpinux Exp $ #include #include #include #include std::ostream& FunctionExpressionConvection:: put(std::ostream& os) const { if (__scalarFunction != 0) { os << *__scalarFunction; } else { os << "convect(" << *__field << ',' << *__timeStep << ',' << *__convectedFunction << ')'; } return os; } void FunctionExpressionConvection:: execute() { __convectedFunction->execute(); __field->execute(); __timeStep->execute(); if (Information::instance().usesMesh()) { const Mesh& mesh = *Information::instance().getMesh(); if (__field->numberOfComponents() != 3) { throw ErrorHandler(__FILE__,__LINE__, "convection needs a 3 component field:\n" +stringify(*__field)+" has "+stringify(__field->numberOfComponents())+" components", ErrorHandler::normal); } switch (mesh.type()) { case Mesh::cartesianHexahedraMesh: { __scalarFunction = new Convection(*__convectedFunction->function(), *__field->field(), __timeStep->realValue(), static_cast(mesh)); break; } case Mesh::tetrahedraMesh: { __scalarFunction = new Convection(*__convectedFunction->function(), *__field->field(), __timeStep->realValue(), static_cast(mesh)); break; } case Mesh::hexahedraMesh: { __scalarFunction = new Convection(*__convectedFunction->function(), *__field->field(), __timeStep->realValue(), static_cast(mesh)); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "convection is not implemented for this kind of mesh", ErrorHandler::unexpected); } } __isToEvaluate = false; } else { __isToEvaluate = true; } } FunctionExpressionConvection:: FunctionExpressionConvection(ReferenceCounting field, ReferenceCounting dt, ReferenceCounting phi) : FunctionExpression(FunctionExpression::convection), __isToEvaluate(true), __field(field), __timeStep(dt), __convectedFunction(phi) { ; } FunctionExpressionConvection:: FunctionExpressionConvection(const FunctionExpressionConvection& f) : FunctionExpression(f), __isToEvaluate(f.__isToEvaluate), __field(f.__field), __timeStep(f.__timeStep), __convectedFunction(f.__convectedFunction) { ; } FunctionExpressionConvection::~FunctionExpressionConvection() { ; } freefem3d-1.0pre10/language/LinearExpression.hpp0000644000175000017500000001045410562730012016571 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: LinearExpression.hpp,v 1.4 2007/02/08 23:19:38 delpinux Exp $ #ifndef LINEAR_EXPRESSION_HPP #define LINEAR_EXPRESSION_HPP #include #include #include #include #include class LinearExpression : public Expression { public: enum LinearType { elementary, elementaryTimesFunction, elementaryTimesReal, elementaryTimesFunctionOperator }; private: LinearExpression::LinearType __formType; protected: ReferenceCounting __integrated; public: const LinearExpression::LinearType& formType() const { return __formType; } ConstReferenceCounting integrated() const { return __integrated; } LinearExpression(const LinearExpression::LinearType t, ReferenceCounting i) : Expression(linearExp), __formType(t), __integrated(i) { ; } LinearExpression(const LinearExpression& LF) : Expression(LF), __formType(LF.__formType), __integrated(LF.__integrated) { ; } virtual ~LinearExpression() { ; } }; class LinearExpressionElementary : public LinearExpression { private: std::ostream& put (std::ostream& os) const { os << *__integrated; return os; } public: void execute() { (*__integrated).execute(); } LinearExpressionElementary(ReferenceCounting i) : LinearExpression(LinearExpression::elementary, i) { ; } LinearExpressionElementary(const LinearExpressionElementary& LF) : LinearExpression(LF) { ; } ~LinearExpressionElementary() { ; } }; class LinearExpressionElementaryTimesFunction : public LinearExpression { private: ReferenceCounting __function; std::ostream& put (std::ostream& os) const { os << *__function << '*' << *__integrated; return os; } public: void execute() { (*__integrated).execute(); (*__function).execute(); } ReferenceCounting function() { return __function; } LinearExpressionElementaryTimesFunction (ReferenceCounting i, ReferenceCounting f) : LinearExpression(LinearExpression::elementaryTimesFunction, i), __function(f) { ; } LinearExpressionElementaryTimesFunction(const LinearExpressionElementaryTimesFunction& LF) : LinearExpression(LF), __function(LF.__function) { ; } ~LinearExpressionElementaryTimesFunction() { ; } }; class LinearExpressionElementaryTimesReal : public LinearExpression { private: ReferenceCounting __realexp; std::ostream& put (std::ostream& os) const { os << *__realexp << '*' << *__integrated; return os; } public: void execute() { (*__realexp).execute(); (*__integrated).execute(); } ReferenceCounting real_t() { return __realexp; } LinearExpressionElementaryTimesReal (ReferenceCounting i, ReferenceCounting r) : LinearExpression(LinearExpression::elementaryTimesReal, i), __realexp(r) { ; } LinearExpressionElementaryTimesReal(const LinearExpressionElementaryTimesReal& LF) : LinearExpression(LF), __realexp(LF.__realexp) { ; } ~LinearExpressionElementaryTimesReal() { ; } }; #endif // LINEAR_EXPRESSION_HPP freefem3d-1.0pre10/language/MeshExpression.hpp0000644000175000017500000002112710607532664016267 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: MeshExpression.hpp,v 1.19 2007/04/12 22:40:56 delpinux Exp $ #ifndef MESH_EXPRESSION_HPP #define MESH_EXPRESSION_HPP #include #include #include #include #include #include #include /** * @file MeshExpression.hpp * @author Stephane Del Pino * @date Sat Sep 4 20:02:23 2004 * * @brief Mesh expression management * */ class Mesh; class MeshExpression : public Expression { protected: ReferenceCounting __mesh; public: enum TypeOfMesh { extract, periodic, read, simplify, surface, spectral, structured, tetrahedrize, tetrahedrizeDomain, transform, undefined, unstructured, variable }; private: MeshExpression::TypeOfMesh __typeOfMesh; public: ReferenceCounting mesh() const; const MeshExpression::TypeOfMesh& typeOfMesh() const { return __typeOfMesh; } MeshExpression(const MeshExpression& e); MeshExpression(ReferenceCounting m, const MeshExpression::TypeOfMesh& t); virtual ~MeshExpression(); }; class DomainExpression; /*! \class MeshExpressionStructured This class defines the class of structured Mesh expressions. \author Stephane Del Pino */ class MeshExpressionStructured : public MeshExpression { private: ReferenceCounting __meshSize; ReferenceCounting __corner1; ReferenceCounting __corner2; std::ostream& put(std::ostream& os) const; public: void execute(); MeshExpressionStructured(ReferenceCounting size, ReferenceCounting corner1, ReferenceCounting corner2); MeshExpressionStructured(const MeshExpressionStructured& m); ~MeshExpressionStructured(); }; /*! \class MeshExpressionSpectral This class defines the class of structured Mesh expressions. \author Stephane Del Pino */ class MeshExpressionSpectral : public MeshExpression { private: ReferenceCounting __degree; ReferenceCounting __corner1; ReferenceCounting __corner2; std::ostream& put(std::ostream& os) const; public: void execute(); MeshExpressionSpectral(ReferenceCounting degrees, ReferenceCounting corner1, ReferenceCounting corner2); MeshExpressionSpectral(const MeshExpressionSpectral& m); ~MeshExpressionSpectral(); }; /*! \class MeshExpressionSurface This class defines the class of Surface Mesh expressions. \author Stephane Del Pino */ class MeshExpressionSurface : public MeshExpression { private: ReferenceCounting __domain; ReferenceCounting __volumeMesh; std::ostream& put(std::ostream& os) const; template void __getSurfaceMesh(MeshType& mesh); public: void execute(); MeshExpressionSurface(ReferenceCounting domain, ReferenceCounting volumeMesh); MeshExpressionSurface(ReferenceCounting volumeMesh); MeshExpressionSurface(const MeshExpressionSurface& m); ~MeshExpressionSurface(); }; class MeshExpressionVariable : public MeshExpression { private: const std::string __meshName; ReferenceCounting __meshVariable; std::ostream& put(std::ostream& os) const { os << __meshVariable->name(); if (StreamCenter::instance().getDebugLevel() > 3) { os << '{' << (*__meshVariable->expression()) << '}'; } return os; } public: void execute(); MeshExpressionVariable(const std::string& meshName); MeshExpressionVariable(const MeshExpressionVariable& e); ~MeshExpressionVariable(); }; class MeshExpressionRead : public MeshExpression { private: ReferenceCounting __meshVariable; ReferenceCounting __fileDescriptor; ReferenceCounting __filename; std::ostream& put(std::ostream& os) const; public: void execute(); MeshExpressionRead(ReferenceCounting descriptor, ReferenceCounting filename); MeshExpressionRead(const MeshExpressionRead& e); ~MeshExpressionRead(); }; class MeshExpressionSimplify : public MeshExpression { private: ReferenceCounting __originalMesh; std::ostream& put(std::ostream& os) const; public: void execute(); MeshExpressionSimplify(ReferenceCounting); MeshExpressionSimplify(const MeshExpressionSimplify& e); ~MeshExpressionSimplify(); }; class MeshExpressionExtract : public MeshExpression { private: ReferenceCounting __originalMesh; ReferenceCounting __referenceToExtract; std::ostream& put(std::ostream& os) const; template void __extract(); public: void execute(); MeshExpressionExtract(ReferenceCounting, ReferenceCounting); MeshExpressionExtract(const MeshExpressionExtract& e); ~MeshExpressionExtract(); }; class MeshExpressionTetrahedrize : public MeshExpression { private: std::ostream& put(std::ostream& os) const { os << "tetrahedrize mesh"; return os; } ReferenceCounting __inputMesh; public: void execute(); MeshExpressionTetrahedrize(ReferenceCounting m); MeshExpressionTetrahedrize(const MeshExpressionTetrahedrize& m); ~MeshExpressionTetrahedrize(); }; /** * @class MeshExpressionTetrahedrizeDomain * @author Stephane Del Pino * @date Sat Sep 4 20:00:57 2004 * * @brief performs a bad quality mesh generation of the domain to * remove visualization artifacts. Not to be used for computation. * */ class MeshExpressionTetrahedrizeDomain : public MeshExpression { private: std::ostream& put(std::ostream& os) const { os << "tetrahedrize domain mesh"; return os; } ReferenceCounting __inputMesh; ReferenceCounting __domain; public: void execute(); MeshExpressionTetrahedrizeDomain(ReferenceCounting m, ReferenceCounting d); MeshExpressionTetrahedrizeDomain(const MeshExpressionTetrahedrizeDomain& m); ~MeshExpressionTetrahedrizeDomain(); }; class MeshExpressionUndefined : public MeshExpression { private: std::ostream& put(std::ostream& os) const { os << "undefined mesh"; return os; } public: void execute() { ; } MeshExpressionUndefined(); MeshExpressionUndefined(const MeshExpressionUndefined& m); ~MeshExpressionUndefined(); }; class VerticesSet; class FieldExpression; class MeshExpressionTransform : public MeshExpression { private: std::ostream& put(std::ostream& os) const { os << "transformed mesh"; return os; } ReferenceCounting __inputMesh; ReferenceCounting __transformationField; public: void execute(); MeshExpressionTransform(ReferenceCounting m, ReferenceCounting f); MeshExpressionTransform(const MeshExpressionTransform& m); ~MeshExpressionTransform(); }; class MeshExpressionPeriodic : public MeshExpression { public: typedef std::list, ReferenceCounting > > MappedReferencesList; private: std::ostream& put(std::ostream& os) const { os << "periodic mesh"; return os; } ReferenceCounting __inputMesh; ReferenceCounting __mappedReferences; public: void execute(); MeshExpressionPeriodic(ReferenceCounting m, ReferenceCounting references); MeshExpressionPeriodic(const MeshExpressionPeriodic& m); ~MeshExpressionPeriodic(); }; #endif // _MESH_EXPRESSION_HPP_ freefem3d-1.0pre10/language/BoundaryConditionListExpression.hpp0000644000175000017500000000653010562730012021645 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryConditionListExpression.hpp,v 1.6 2007/02/08 23:19:38 delpinux Exp $ #ifndef BOUNDARYCONDITIONLIST_EXPRESSION_HPP #define BOUNDARYCONDITIONLIST_EXPRESSION_HPP #include #include #include #include /*! \class BoundaryConditionListExpression This class defines the base class of BoundaryConditionList expressions \author Stephane Del Pino */ class BoundaryConditionSet; class BoundaryConditionListExpression : public Expression { public: enum BoundaryConditionListType { set, variable, undefined }; private: BoundaryConditionListType __boundaryConditionListType; protected: ReferenceCounting __boundaryConditionSet; public: virtual bool hasPOVBoundary() const = 0; ReferenceCounting boundaryConditionSet(); const BoundaryConditionListExpression::BoundaryConditionListType& boundaryConditionListType() const { return __boundaryConditionListType; } virtual void add(ReferenceCounting) = 0; BoundaryConditionListExpression(const BoundaryConditionListExpression& e); BoundaryConditionListExpression(const BoundaryConditionListExpression:: BoundaryConditionListType& t); virtual ~BoundaryConditionListExpression(); }; /*! \class BoundaryConditionListExpressionSet This class defines the base class of BoundaryConditionList expressions \author Stephane Del Pino */ class PDECondition; class BoundaryConditionListExpressionSet : public BoundaryConditionListExpression { private: typedef std::list > BoundaryConditionExpressionList; BoundaryConditionExpressionList __boundaryConditionExpressionList; std::ostream& put(std::ostream& os) const { for (BoundaryConditionExpressionList::const_iterator i = __boundaryConditionExpressionList.begin(); i != __boundaryConditionExpressionList.end(); ++i) os << (**i) << '\n'; return os; } void __splitBoundaryList(BoundaryConditionSet& bcSet, ConstReferenceCounting pde, ConstReferenceCounting b); public: bool hasPOVBoundary() const; void execute(); void add(ReferenceCounting b) { __boundaryConditionExpressionList.push_back(b); } BoundaryConditionListExpressionSet(const BoundaryConditionListExpressionSet& e); BoundaryConditionListExpressionSet(); ~BoundaryConditionListExpressionSet(); }; #endif // BOUNDARYCONDITIONLIST_EXPRESSION_HPP freefem3d-1.0pre10/language/FunctionExpressionMeshReferences.hpp0000644000175000017500000001326010561425532021770 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionMeshReferences.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_MESH_REFERENCES_HPP #define FUNCTION_EXPRESSION_MESH_REFERENCES_HPP #include #include #include /** * @file FunctionExpressionMeshReferences.hpp * @author Stephane Del Pino * @date Wed Jul 19 00:09:36 2006 * * @brief This class describes function defined by references * expression * */ class FunctionExpressionMeshReferences : public FunctionExpression { public: /** * @class ReferencesSet * @author Stephane Del Pino * @date Wed Jul 19 00:10:28 2006 * * @brief This class is manipulates associations of references and * function expressions * */ class ReferencesSet { friend class FunctionExpressionMeshReferences; public: typedef std::vector, ReferenceCounting > > FunctionReferences; /**< @typedef Container of references and functions association */ private: FunctionReferences __functionReferences; /**< the container */ public: /** * Access to the set of references-function expressions * association * * @return __functionReferences */ FunctionReferences& functionReferences() { return __functionReferences; } /** * Checks if a boundary is required to evaluate this function * * @return @b true if one of the functions contained in * __functionReferences requires a boundary */ bool hasBoundaryExpression() const { bool found = false; for (FunctionReferences::const_iterator i = __functionReferences.begin(); i != __functionReferences.end(); ++i) { found = (*(*i).second).hasBoundaryExpression(); } return found; } /** * Writes the reference set @a r to a given stream * * @param os given stream * @param r the reference set * * @return os */ friend std::ostream& operator << (std::ostream& os, const ReferencesSet& r) { FunctionReferences::const_iterator i = r.__functionReferences.begin(); if (i != r.__functionReferences.end()) os << *i->first << ':' << *i->second; i++; for (; i != r.__functionReferences.end(); ++i) { os << ',' << *i->first << ':' << *i->second; } return os; } /** * Executes the set of references and function expressions * */ void execute() { for (FunctionReferences::iterator i = __functionReferences.begin(); i != __functionReferences.end(); ++i) { RealExpression* r = i->first; r->execute(); i->second->execute(); } } /** * Adds a reference @a ref and its associated function expression @a function * * @param ref the reference * @param function the function expression */ void add(ReferenceCounting ref, ReferenceCounting function) { __functionReferences.push_back(std::make_pair(ref, function)); } /** * Constructor * * @param ref a given referencre * @param function its associated function expression */ ReferencesSet(ReferenceCounting ref, ReferenceCounting function) { __functionReferences.push_back(std::make_pair(ref, function)); } /** * Copy constructor * * @param r a given reference set */ ReferencesSet(const ReferencesSet& r) : __functionReferences(r.__functionReferences) { ; } /** * Destructor * */ ~ReferencesSet() { ; } }; enum ItemType { element, vertex, undefined }; private: std::string __itemName; /**< The name of the used items */ ReferenceCounting __mesh; /**< the mesh defining the function */ ReferenceCounting __referenceSet; /**< the set of references */ /** * Checks the ItemType of the current FunctionExpressionMeshReferences * * @return the ItemType associated to the __itemName */ ItemType __getItemType(); std::ostream& put(std::ostream& os) const; public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param itemName the given item name to use check references * @param mesh the mesh used to define the function * @param ref the references set */ FunctionExpressionMeshReferences(const std::string itemName, ReferenceCounting mesh, ReferenceCounting ref); /** * Copy constructor * * @param f a given FunctionExpressionMeshReferences */ FunctionExpressionMeshReferences(const FunctionExpressionMeshReferences& f); /** * Destructor * */ ~FunctionExpressionMeshReferences(); }; #endif // FUNCTION_EXPRESSION_MESH_REFERENCES_HPP freefem3d-1.0pre10/language/Information.cpp0000644000175000017500000000466510624156366015603 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: Information.cpp,v 1.6 2007/05/20 23:02:48 delpinux Exp $ #include #include #include #include ConstReferenceCounting Information:: getMesh() { ASSERT(not __mesh.empty()); return __mesh.top(); } void Information:: setMesh(ConstReferenceCounting mesh) { __mesh.push(mesh); } void Information:: unsetMesh() { __mesh.pop(); } bool Information:: usesMesh() const { return not __mesh.empty(); } ConstReferenceCounting Information:: getScene() { return __scene; } void Information:: setScene(ConstReferenceCounting scene) { __scene = scene; } bool Information:: usesScene() const { return __scene != 0; } void Information:: unsetScene() { __scene = 0; } ReferenceCounting Information:: getUnknownList() { return __unknownListExpression; } void Information:: setUnknownList(ReferenceCounting u) { __unknownListExpression = u; } bool Information:: usesUnknownList() const { return __unknownListExpression != 0; } void Information:: unsetUnknownList() { __unknownListExpression = 0; } const bool& Information:: coarseMesh() const { return __coarseMesh; } void Information:: setCoarseMesh(const bool& coarse) { __coarseMesh = coarse; } Information:: Information() : __scene(0), __unknownListExpression(0), __coarseMesh(true) { ; } Information:: Information(const Information& I) : __mesh(I.__mesh), __scene(I.__scene), __unknownListExpression(I.__unknownListExpression), __coarseMesh(I.__coarseMesh) { ; } Information:: ~Information() { ; } freefem3d-1.0pre10/language/FunctionExpressionUnaryMinus.hpp0000644000175000017500000000416510561425532021210 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionUnaryMinus.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_UNARY_MINUS_HPP #define FUNCTION_EXPRESSION_UNARY_MINUS_HPP #include /** * @file FunctionExpressionUnaryMinus.hpp * @author Stephane Del Pino * @date Wed Jul 19 11:21:12 2006 * * @brief This class manages unary minus operator on function * expressions * */ class FunctionExpressionUnaryMinus : public FunctionExpression { private: ReferenceCounting __givenFunction; /**< Function foe which the opposit will be taken */ public: /** * Executes the expression * */ void execute(); /** * Checks if this function expression requires te use of a boundary * for evaluation * * @return @b true if __givenFunction requires a boundary */ bool hasBoundaryExpression() const; /** * Constructor * * @param f the function whose opposite will be computed */ FunctionExpressionUnaryMinus(ReferenceCounting f); /** * Copy constructor * * @param f a given FunctionExpressionUnaryMinus */ FunctionExpressionUnaryMinus(const FunctionExpressionUnaryMinus& f); /** * Destructor * */ ~FunctionExpressionUnaryMinus(); }; #endif // FUNCTION_EXPRESSION_UNARY_MINUS_HPP freefem3d-1.0pre10/language/FunctionExpressionNot.cpp0000644000175000017500000000330310561425532017622 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionNot.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include void FunctionExpressionNot:: execute() { __givenFunction->execute(); ScalarFunctionBuilder functionBuilder; functionBuilder.setFunction(__givenFunction->function()); functionBuilder.setNot(); __scalarFunction = functionBuilder.getBuiltFunction(); } bool FunctionExpressionNot:: hasBoundaryExpression() const { return __givenFunction->hasBoundaryExpression(); } FunctionExpressionNot:: FunctionExpressionNot(ReferenceCounting f) : FunctionExpression(FunctionExpression::not_), __givenFunction(f) { ; } FunctionExpressionNot:: FunctionExpressionNot(const FunctionExpressionNot& f) : FunctionExpression(f), __givenFunction(f.__givenFunction) { ; } FunctionExpressionNot:: ~FunctionExpressionNot() { ; } freefem3d-1.0pre10/language/FunctionExpression.cpp0000644000175000017500000000402410624156366017150 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpression.cpp,v 1.30 2007/05/20 23:02:48 delpinux Exp $ #include #include #include #include std::ostream& FunctionExpression:: put(std::ostream& os) const { os << *__scalarFunction; return os; } bool FunctionExpression:: hasBoundaryExpression() const { return false; } const FunctionExpression::FunctionType& FunctionExpression:: type() const { return __type; } ConstReferenceCounting FunctionExpression:: function() const { ASSERT(__scalarFunction != 0); return __scalarFunction; } ReferenceCounting FunctionExpression:: value() { return new FunctionExpressionValue(__scalarFunction, this->hasBoundaryExpression()); } FunctionExpression:: FunctionExpression(const FunctionExpression& e) : Expression(e), __type(e.__type), __unknown(e.__unknown), __scalarFunction(e.__scalarFunction) { ; } FunctionExpression:: FunctionExpression(const FunctionExpression::FunctionType& type) : Expression(Expression::function), __type(type), __unknown(false), __scalarFunction(0) { ; } FunctionExpression:: ~FunctionExpression() { ; } freefem3d-1.0pre10/language/BooleanExpression.hpp0000644000175000017500000001066410632501735016747 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BooleanExpression.hpp,v 1.3 2007/06/09 10:37:08 delpinux Exp $ #ifndef _BOOLEAN_EXPRESSION_HPP_ #define _BOOLEAN_EXPRESSION_HPP_ #include #include class BooleanExpression : public Expression { protected: bool __boolValue; private: std::ostream& put(std::ostream& os) const { os << __boolValue; return os; } public: /*! Returns the value of the expression. \todo Return type should use traits. */ bool boolValue() const { return __boolValue; } BooleanExpression(const BooleanExpression& e) : Expression(e), __boolValue(e.__boolValue) { ; } BooleanExpression() : Expression(Expression::boolean) { ; } virtual ~BooleanExpression() { ; } }; class BooleanExpressionValue : public BooleanExpression { public: void execute() { ; } BooleanExpressionValue(bool b) { __boolValue = b; } BooleanExpressionValue(const BooleanExpressionValue& re) : BooleanExpression(re) { ; } ~BooleanExpressionValue() { ; } }; template class BooleanExpressionUnaryOperator : public BooleanExpression { private: ReferenceCounting __r; public: void execute() { (*__r).execute(); __boolValue = (*F)((*__r).boolValue()); } BooleanExpressionUnaryOperator(ReferenceCounting r) : __r(r) { ; } BooleanExpressionUnaryOperator(const BooleanExpressionUnaryOperator& e) : __r(e.__r) { ; } ~BooleanExpressionUnaryOperator() { ; } }; template class BooleanExpressionCompareOperator : public BooleanExpression { private: ReferenceCounting __r1; ReferenceCounting __r2; real_t __r1Value; real_t __r2Value; public: void execute() { (*__r1).execute(); __r1Value = (*__r1).realValue(); (*__r2).execute(); __r2Value = (*__r2).realValue(); __boolValue = B(__r1Value, __r2Value); } BooleanExpressionCompareOperator(ReferenceCounting r1, ReferenceCounting r2) : __r1(r1), __r2(r2), __r1Value(0), __r2Value(0) { ; } BooleanExpressionCompareOperator(const BooleanExpressionCompareOperator& e) : __r1(e.__r1), __r2(e.__r2), __r1Value(e.__r1Value), __r2Value(e.__r2Value) { ; } ~BooleanExpressionCompareOperator() { ; } }; template class BooleanExpressionBinaryOperator : public BooleanExpression { private: ReferenceCounting __r1; ReferenceCounting __r2; public: void execute() { (*__r1).execute(); (*__r2).execute(); __boolValue = B((*__r1).boolValue(), (*__r2).boolValue()); } BooleanExpressionBinaryOperator(ReferenceCounting r1, ReferenceCounting r2) : __r1(r1), __r2(r2) { ; } BooleanExpressionBinaryOperator(const BooleanExpressionBinaryOperator& e) : __r1(e.__r1), __r2(e.__r2) { ; } ~BooleanExpressionBinaryOperator() { ; } }; /* class BooleanVariable; class BooleanExpressionVariable : public BooleanExpression { private: ReferenceCounting __booleanVariable; ReferenceCounting __expression; public: const real_t value() const; void execute(); BooleanExpressionVariable(ReferenceCounting r); BooleanExpressionVariable(const BooleanExpressionVariable& e); ~BooleanExpressionVariable(); }; */ #endif // _BOOLEAN_EXPRESSION_HPP_ freefem3d-1.0pre10/language/BoundaryExpressionList.cpp0000644000175000017500000000337510561425532020004 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryExpressionList.cpp,v 1.1 2006/08/27 21:33:53 delpinux Exp $ #include #include void BoundaryExpressionList:: execute() { BoundaryList* b = new BoundaryList(); for(List::iterator i = __boundaries.begin(); i != __boundaries.end(); ++i) { (**i).execute(); b->add((**i).boundary()); } __boundary = b; } std::ostream& BoundaryExpressionList:: put(std::ostream& os) const { for (List::const_iterator i = __boundaries.begin(); i != __boundaries.end(); ++i) { if (i != __boundaries.begin()) { os << ','; } os << (**i); } return os; } BoundaryExpressionList:: BoundaryExpressionList() : BoundaryExpression(BoundaryExpression::list) { ; } BoundaryExpressionList:: BoundaryExpressionList(const BoundaryExpressionList& l) : BoundaryExpression(l), __boundaries(l.__boundaries) { ; } BoundaryExpressionList:: ~BoundaryExpressionList() { ; } freefem3d-1.0pre10/language/BoundaryConditionExpressionFourrier.hpp0000644000175000017500000000463510562730012022533 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryConditionExpressionFourrier.hpp,v 1.2 2007/02/08 23:19:38 delpinux Exp $ #ifndef BOUNDARY_CONDITION_EXPRESSION_FOURRIER_HPP #define BOUNDARY_CONDITION_EXPRESSION_FOURRIER_HPP #include /** * @file BoundaryConditionExpressionFourrier.hpp * @author Stephane Del Pino * @date Mon Aug 7 13:08:34 2006 * * @brief This class defines the class of fourrier BoundaryCondition * expressions */ class BoundaryConditionExpressionFourrier : public BoundaryConditionExpression { private: ReferenceCounting __Alpha; /**< @f$ \alpha @f$ */ ReferenceCounting __g; /**< @f$ g @f$ */ /** * Writes the expression to a stream * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param unknownName the unknown expression * @param alpha @f$ \alpha @f$ * @param g @f$ g @f$ * @param boundary the boundary expression */ BoundaryConditionExpressionFourrier(const std::string& unknownName, ReferenceCounting alpha, ReferenceCounting g, ReferenceCounting boundary); /** * Copy constructor * * @param f given fourrier expression */ BoundaryConditionExpressionFourrier(const BoundaryConditionExpressionFourrier& f); /** * Destructor * */ ~BoundaryConditionExpressionFourrier(); }; #endif // BOUNDARY_CONDITION_EXPRESSION_FOURRIER_HPP freefem3d-1.0pre10/language/PDEOperatorSumExpression.hpp0000644000175000017500000000474010561425532020200 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: PDEOperatorSumExpression.hpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ #ifndef _PDEOPERATORSUM_EXPRESSION_HPP_ #define _PDEOPERATORSUM_EXPRESSION_HPP_ #include #include #include class VectorialPDEOperator; class PDEOperatorSumExpression : public Expression { protected: ReferenceCounting __vectorPDEOperator; typedef std::list > PDEOperatorExpressionList; ReferenceCounting __sumList; ReferenceCounting __differenceList; private: std::ostream& put(std::ostream& os) const { for(PDEOperatorExpressionList::const_iterator i = (*__sumList).begin(); i != (*__sumList).end(); ++i) { if (i != (*__sumList).begin()) os << " + "; os << (*(*i)); } for(PDEOperatorExpressionList::const_iterator i = (*__differenceList).begin(); i != (*__differenceList).end(); ++i) { os << " - " << (*(*i)); } return os; } public: ReferenceCounting vectorPDEOperator(); void execute(); void add(ReferenceCounting p) { (*__sumList).push_back(p); } void minus(ReferenceCounting p) { (*__differenceList).push_back(p); } void unaryMinus() { std::swap(__differenceList,__sumList); } void add(ReferenceCounting p); void minus(ReferenceCounting p); PDEOperatorSumExpression(const PDEOperatorSumExpression& e); PDEOperatorSumExpression(); virtual ~PDEOperatorSumExpression(); }; #endif // _PDEOPERATORSUM_EXPRESSION_HPP_ freefem3d-1.0pre10/language/UnknownListExpression.cpp0000644000175000017500000000246610563377365017674 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: UnknownListExpression.cpp,v 1.7 2007/02/10 17:20:53 delpinux Exp $ #include #include std::ostream& UnknownListExpressionSet:: put(std::ostream& os) const { os << '['; for (listType::const_iterator i = __list.begin(); i != __list.end(); ++i) { const UnknownExpression& u = **i; if (i != __list.begin()) { os << ','; } os << u.name() << ':' << DiscretizationType::name(u.discretizationType()); } os << ']'; return os; } freefem3d-1.0pre10/language/parse.pov.yy0000644000175000017500000006537410613751457015116 00000000000000%{ /* -*- c++ -*- */ /* * This file is part of ff3d - http://www.freefem.org/ff3d * Copyright (C) 2001, 2002, 2003 Stéphane Del Pino * * 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, 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. * * $Id: parse.pov.yy,v 1.12 2007/04/25 22:13:12 delpinux Exp $ * */ #define YYDEBUG 1 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern std::vector path; // include files paths bool execute = true; variable * variables; int nbvariables; extern POVLexer* povlexer; void yyerror (char* s); void declarevar (char* name, char* val); void expend(std::string& expendval); extern Scene* pScene; SceneBox SB; enum statement { condition, loop }; std::stack ExecStack; std::stack StatementStack; std::stack StreamPosStack; bool BoolOp = false; // used if the actual object is a // construction object that belongs // to a boolean operation std::stack BoolOpStack; std::stack > > OpStack; // Used to store temporarly objects #define povlex povlexer->povlex %} %union { real_t val; real_t vect[3]; real_t vect4[4]; real_t mat[12]; char* str; int integer; long int stream_pos; parsetrans trans; } %token NUM %token STRING KEYWORD %token SPHERE BOX CYLINDER CONE PLANE TORUS %token UNION INTERSECTION DIFFERENCE OBJECT INVERSE %token NAME %token DECLARE %token TRANSF MATRIXTRANSF %token PIGMENT COLOR RGB RGBF %token IF IFDEF IFNDEF ELSE END %token WHILE %token AND OR NOT %token LE GE EQ NE %type vector %type matrix %type vector4 %type exp %type objref %type modifier %type variable %type boolexp /* must use int for bool because lexer is in C :-( */ /* precedence definitions */ %left AND OR NOT %left EQ NE GE LE '<' '>' %left '-' '+' %left '*' '/' %left NEG /* negation--unary minus */ %left '{' '}' /* Don't care about following shift/reduce problems: */ %expect 1 %% /* Grammar rules and actions follow */ input: /* empty */ | input variable { } | input object { } | input iftok { } ; iftok: IFDEF '(' NAME ')' { ExecStack.push(execute); StatementStack.push(condition); if (execute) { bool defined_var = false; for (int i=0; i3) ) { defined_var = true; break; } } if (defined_var) { execute = true; } else { execute = false; } } } | IFNDEF '(' NAME ')' { ExecStack.push(execute); StatementStack.push(condition); if (execute) { bool defined_var = false; for (int i=0; i3) ) { defined_var = true; break; } } if (!defined_var) { execute = true; } else { execute = false; } } } | IF '(' boolexp ')' { ExecStack.push(execute); StatementStack.push(condition); if (execute) { execute = $3; } } | ELSE { if (ExecStack.top()) { // This means that the IF THEN ELSE statment is not to completly ignore execute = ! execute; } } | END { if (StatementStack.top()==loop) { fferr(1) << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; std::exit(1); // if (execute) // fseek(yyin, StreamPosStack.top(),SEEK_SET); // StreamPosStack.pop(); } execute = ExecStack.top(); StatementStack.pop(); ExecStack.pop(); } | WHILE '(' boolexp ')' { ExecStack.push(execute); StatementStack.push(loop); if (execute) { StreamPosStack.push($1); // To go back to position in file. execute = $3; } } ; variable: DECLARE NAME '=' exp ';' { if (execute) { std::string varname = $2; int varnum = 0; bool found = false; for (int i=0; i$ = 0; $$ = false; $$ = false; for (size_t i=0; i<4; ++i) $$[i] = 0; } } | modifier objref { if (execute) { $$ = $1; $$ = new TransType[($$)]; $$[0] = new real_t[($$)]; $$[1] = new real_t[($$)]; $$[2] = new real_t[($$)]; for (size_t i=0; i<12; ++i) $$[i] = $1[i]; /* copy old modifier values */ for (int i=0; i<$1; i++) { $$[i] = $1[i]; $$.vect[0][i] = $1.vect[0][i]; $$.vect[1][i] = $1.vect[1][i]; $$.vect[2][i] = $1.vect[2][i]; } if ($1 > 0) { delete[] $1; /* deallocate memory if needed */ for (int i=0; i<3; i++) delete[] $1[i]; } $$ = $1; $$ = true; for (size_t i=0; i<4; ++i) $$[i] = $2[i]; } } | modifier TRANSF vector { if (execute) { TransType* savetype; real_t* savevect[3]; savetype = new TransType[$$+1]; for (int i=0; i<3; i++) savevect[i] = new real_t[$$+1]; for (int i=0; i<$$; i++) { savetype[i] = $$[i]; /* keeps old values */ savevect[0][i] = $$[0][i]; savevect[1][i] = $$[1][i]; savevect[2][i] = $$[2][i]; } if ($$ > 0) { delete[] $$; /* deallocate memory if needed */ for (int i=0; i<3; i++) delete[] $$[i]; } $$ = new TransType[($$+1)]; $$[0] = new real_t[($$+1)]; $$[1] = new real_t[($$+1)]; $$[2] = new real_t[($$+1)]; /* restore old values */ for (int i=0; i<$$; i++) { $$[i] = savetype[i]; $$[0][i] = savevect[0][i]; $$[1][i] = savevect[1][i]; $$[2][i] = savevect[2][i]; } $$ = $1; $$ = $1; for (size_t i=0; i<4; ++i) $$[i] = $1[i]; delete[] savetype; for (int i=0; i<3; i++) delete [] savevect[i]; if (!strcmp ($2,"rotate")) { $$[$$] = rotation; } else if (!strcmp ($2,"translate")) { $$[$$] = translation; } else if (!strcmp ($2,"scale")) { $$[$$] = scale; } else { std::cerr << "parse error unknown " << $2 << " check parsing in combo.y\n"; } for (int i=0; i<3; i++) $$[i][$$] = $3[i]; $$++; } } | modifier MATRIXTRANSF matrix { if (execute) { $$ = $1; $$ = new TransType[($$)]; $$[0] = new real_t[($$)]; $$[1] = new real_t[($$)]; $$[2] = new real_t[($$)]; /* copy old modifier values */ for (int i=0; i<$1; i++) { $$[i] = $1[i]; $$.vect[0][i] = $1.vect[0][i]; $$.vect[1][i] = $1.vect[1][i]; $$.vect[2][i] = $1.vect[2][i]; } if ($1 > 0) { delete[] $1; /* deallocate memory if needed */ for (int i=0; i<3; i++) delete[] $1[i]; } $$ = $1; $$ = $1; for (size_t i=0; i<12; ++i) $$[i] = $3[i]; $$ = new TransType[1]; $$[0] = matrix; $$=0; } } | modifier INVERSE { if (execute) { $$ = $1; $$ = new TransType[($$)]; $$[0] = new real_t[($$)]; $$[1] = new real_t[($$)]; $$[2] = new real_t[($$)]; /* copy old modifier values */ for (int i=0; i<$1; i++) { $$[i] = $1[i]; $$.vect[0][i] = $1.vect[0][i]; $$.vect[1][i] = $1.vect[1][i]; $$.vect[2][i] = $1.vect[2][i]; } if ($1 > 0) { delete[] $1; /* deallocate memory if needed */ for (int i=0; i<3; i++) delete[] $1[i]; } $$ = $1; $$ = not($1); } } ; object: SPHERE '{' vector ',' exp modifier '}' { if (execute) { if ($6[3] == 0) { // means that the object is not transparent! Vertex c($3[0], $3[1], $3[2]); real_t& r = $5; parsetrans& transformations = $6; Shape* s = new Sphere(c,r); (*s).parseTransform(transformations); if ($6) { s = new Not(new Object(s)); } Object* O = new Object(s); if ($6) { O->setReference(TinyVector<3>($6[0], $6[1], $6[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } | TORUS '{' exp ',' exp modifier '}' { if (execute) { if ($6[3] == 0) { // means that the object is not transparent! real_t& r1 = $3; real_t& r2 = $5; parsetrans& transformations = $6; Shape* s = new Torus(r1,r2); (*s).parseTransform(transformations); if ($6) { s = new Not(new Object(s)); } Object* O = new Object(s); if ($6) { O->setReference(TinyVector<3>($6[0], $6[1], $6[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } | BOX '{' vector ',' vector modifier '}' { if (execute) { Vertex a($3[0], $3[1], $3[2]); Vertex b($5[0], $5[1], $5[2]); if ($6[3] == 0) { // means the object is not transparent parsetrans& transformations = $6; Shape* s = new Cube(a,b); (*s).parseTransform(transformations); if ($6) { s = new Not(new Object(s)); } Object* O = new Object(s); if ($6) { O->setReference(TinyVector<3>($6[0], $6[1], $6[2])); } /* put the cube in the list */ if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } else { SB = SceneBox(a, b); } } } | CYLINDER '{' vector ',' vector ',' exp modifier '}' { if (execute) { if ($8[3] == 0) { // means the object is not transparent Vertex a($3[0], $3[1], $3[2]); Vertex b($5[0], $5[1], $5[2]); real_t radius = $7; parsetrans& transformations = $8; Shape* s = new Cylinder(a,b,radius); (*s).parseTransform(transformations); if ($8) { s = new Not(new Object(s)); } Object* O = new Object(s); if ($8) { O->setReference( TinyVector<3>($8[0], $8[1], $8[2])); } /* put the cylinder in the list */ if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } | CONE '{' vector ',' exp ',' vector ',' exp modifier '}' { if (execute) { if ($8[3] == 0) { // means the object is not transparent Vertex a($3[0], $3[1], $3[2]); Vertex b($7[0], $7[1], $7[2]); real_t radius1 = $5; real_t radius2 = $9; parsetrans& transformations = $10; Shape* s = new Cone(a,b,radius1, radius2); (*s).parseTransform(transformations); if ($8) { s = new Not(new Object(s)); } Object* O = new Object(s); if ($10) { O->setReference( TinyVector<3>($10[0], $10[1], $10[2])); } /* put the cylinder in the list */ if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } | PLANE '{' vector ',' exp modifier '}' { if (execute) { if ($6[3] == 0) { // means that the object is not transparent! Vertex c($3[0], $3[1], $3[2]); real_t& r = $5; parsetrans& transformations = $6; Shape* s = new Plane(c,r); (*s).parseTransform(transformations); if ($6) { s = new Not(new Object(s)); } Object* O = new Object(s); if ($6) { O->setReference( TinyVector<3>($6[0], $6[1], $6[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } | UNION '{' { if (execute) { BoolOpStack.push(BoolOp); // store previous context OpStack.push(std::vector >()); // start new vetor BoolOp = true; } } objects modifier '}' { if (execute) { if ($5[3] == 0) { // means the object is not transparent BoolOp = BoolOpStack.top(); // revert to previous context BoolOpStack.pop(); Union* u = new Union(); for (size_t i=0; ipush_back(OpStack.top()[i]); OpStack.pop(); parsetrans& transformations = $5; u->parseTransform(transformations); Object* O = new Object(u); if ($5) { O->setReference(TinyVector<3>($5[0], $5[1], $5[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } | INTERSECTION '{' { if (execute) { BoolOpStack.push(BoolOp); // store previous context OpStack.push(std::vector >()); // start new vetor BoolOp = true; } } objects modifier '}' { if (execute) { if ($5[3] == 0) { // means the object is not transparent BoolOp = BoolOpStack.top(); // revert to previous context BoolOpStack.pop(); Intersection* I = new Intersection(); for (size_t i=0; ipush_back(OpStack.top()[i]); OpStack.pop(); parsetrans& transformations = $5; (*I).parseTransform(transformations); Object* O = new Object(I); if ($5) { O->setReference( TinyVector<3>($5[0], $5[1], $5[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } | DIFFERENCE '{' { if (execute) { BoolOpStack.push(BoolOp); // store previous context OpStack.push(std::vector >()); // start new vetor BoolOp = true; } } objects modifier '}' { if (execute) { if ($5[3] == 0) { // means the object is not transparent BoolOp = BoolOpStack.top(); // revert to previous context BoolOpStack.pop(); Difference* d = new Difference(); for (size_t i=0; i5) { O->setReference(TinyVector<3>($5[0], $5[1], $5[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } | OBJECT '{' { // object is treated like an union limited to one object #ifdef __GNUC__ #warning REWORK OBJECT TREATMENT #endif // __GNUC__ if (execute) { BoolOpStack.push(BoolOp); // store previous context OpStack.push(std::vector >()); // start new vetor BoolOp = true; } } object modifier '}' { if (execute) { if ($5[3] == 0) { // means the object is not transparent BoolOp = BoolOpStack.top(); // revert to previous context BoolOpStack.pop(); Union* u = new Union(); for (size_t i=0; i5) { O->setReference(TinyVector<3>($5[0], $5[1], $5[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } ; objects: object | object objects ; exp: NUM { $$ = $1; } | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { $$ = $1 / $3; } | '(' exp ')' { $$ = $2 ; } | '-' exp %prec NEG { $$ = -$2; } ; boolexp: exp { $$ = (fabs($1)>1E-6); } | exp '>' exp { $$ = ($1 > $3); } | exp '<' exp { $$ = ($1 < $3); } | exp GE exp { $$ = ($1 >= $3); } | exp LE exp { $$ = ($1 <= $3); } | exp EQ exp { $$ = ($1 == $3); } | exp NE exp { $$ = ($1 != $3); } | boolexp AND boolexp { $$ = $1 && $3; } | boolexp OR boolexp { $$ = $1 || $3; } | NOT boolexp { $$ = !($2); } | '(' boolexp ')' { $$ = $2; } ; matrix: '<' exp ',' exp ',' exp ',' exp ',' exp ',' exp ',' exp ',' exp ',' exp ',' exp ',' exp ',' exp '>' { $$[ 0] = $2; $$[ 1] = $4; $$[ 2] = $6; $$[ 3] = $8; $$[ 4] = $10; $$[ 5] = $12; $$[ 6] = $14; $$[ 7] = $16; $$[ 8] = $18; $$[ 9] = $20; $$[10] = $22; $$[11] = $24; } ; vector: '<' exp ',' exp ',' exp '>' { $$[0] = $2; $$[1] = $4; $$[2] = $6; } | '-' vector { // opposit vector $$[0] = - $2[0]; $$[1] = - $2[1]; $$[2] = - $2[2]; } | vector '-' vector { // difference between 2 vectors $$[0] = $1[0] - $3[0]; $$[1] = $1[1] - $3[1]; $$[2] = $1[2] - $3[2]; } | vector '+' vector { // sum of 2 vectors $$[0] = $1[0] + $3[0]; $$[1] = $1[1] + $3[1]; $$[2] = $1[2] + $3[2]; } | vector '*' exp { // product by a scalar on right $$[0] = $1[0] * $3; $$[1] = $1[1] * $3; $$[2] = $1[2] * $3; } | vector '/' exp { // division by a scalar on right $$[0] = $1[0] / $3; $$[1] = $1[1] / $3; $$[2] = $1[2] / $3; } | exp '*' vector { // product by a scalar on left $$[0] = $3[0] * $1; $$[1] = $3[1] * $1; $$[2] = $3[2] * $1; } ; vector4: '<' exp ',' exp ',' exp ',' exp '>' { $$[0] = $2; $$[1] = $4; $$[2] = $6; $$[3] = $8; } | '-' vector4 { // opposit vector4 for (size_t i=0; i<4; ++i) $$[i] = - $2[i]; } | vector4 '-' vector4 { // difference between 2 vector4s for (size_t i=0; i<4; ++i) $$[i] = $1[i] - $3[i]; } | vector4 '+' vector4 { // sum of 2 vector4s for (size_t i=0; i<4; ++i) $$[i] = $1[i] + $3[i]; } | vector4 '*' exp { // product by a scalar on right for (size_t i=0; i<4; ++i) $$[i] = $1[i] * $3; } | vector4 '/' exp { // division by a scalar on right for (size_t i=0; i<4; ++i) $$[i] = $1[i] / $3; } | exp '*' vector4 { // product by a scalar on left for (size_t i=0; i<4; ++i) $$[i] = $3[i] * $1; } ; %% void yyerror(char * s) { throw ErrorHandler("PARSED FILE",povlexer->lineno(), stringify(s)+"'"+povlexer->YYText()+"' unexpected", ErrorHandler::compilation); } void declarevar (char* name, char* val) { bool found = false; int varnum = 0; std::string expendval = val; // Substitute variables value in varname. expend(expendval); for (int i=0; i= 0) { bool replace = true; if (begining > 0) { replace = !isalnum(expendval[begining-1]); } replace = (replace) && isalnum(expendval[begining+var.size()]); if (replace) { std::stringstream tempstr; for (int i=0; i #include #include #include class MultiLinearExpression : public Expression { public: enum LinearFormType { linear, biLinear }; enum OperatorType { gradUgradV, dxUdxV, dxUV, UdxV, UV, gradV, gradFgradV, dxV, V, dxFV, undefined }; typedef std::list > LinearListType; typedef std::list > FunctionListType; typedef std::list > RealListType; private: LinearListType __linearList; FunctionListType __functionList; RealListType __realList; std::ostream& put(std::ostream& os) const; public: ReferenceCounting getFunction(); const std::string& getUnknownName() const; const std::string& getTestFunctionName() const; IntegratedOperatorExpression::OperatorType getUnknownOperator() const; IntegratedOperatorExpression::OperatorType getTestFunctionOperator() const; IntegratedOperatorExpression::OperatorType getFunctionOperator() const; VariationalOperator::Property getUnknownProperty() const; VariationalOperator::Property getTestFunctionProperty() const; ReferenceCounting getFunctionExpression() const; LinearListType::iterator beginLinear() { return __linearList.begin(); } LinearListType::iterator endLinear() { return __linearList.end(); } FunctionListType::iterator beginFunction() { return __functionList.begin(); } FunctionListType::iterator endFunction() { return __functionList.end(); } RealListType::iterator beginReal() { return __realList.begin(); } RealListType::iterator endReal() { return __realList.end(); } OperatorType operatorType() const; LinearFormType linearFormType() const; void check(); void execute() { for (LinearListType::iterator i = __linearList.begin(); i != __linearList.end(); ++i) { (*(*i)).execute(); } for (FunctionListType::iterator i = __functionList.begin(); i != __functionList.end(); ++i) { (*(*i)).execute(); } for (RealListType::iterator i = __realList.begin(); i != __realList.end(); ++i) { (*(*i)).execute(); } } void times(ReferenceCounting LF) { __linearList.push_back(LF); } void times(ReferenceCounting f) { __functionList.push_back(f); } void times(ReferenceCounting r) { __realList.push_back(r); } MultiLinearExpression(ReferenceCounting LF) : Expression(Expression::multiLinearExp) { __linearList.push_back(LF); } MultiLinearExpression(const MultiLinearExpression& MLF) : Expression(MLF), __linearList(MLF.__linearList), __functionList(MLF.__functionList), __realList(MLF.__realList) { ; } virtual ~MultiLinearExpression() { ; } }; #endif // MULTI_LINEAR_EXPRESSION_HPP freefem3d-1.0pre10/language/BoundaryConditionExpressionDirichlet.hpp0000644000175000017500000000436710562730012022647 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryConditionExpressionDirichlet.hpp,v 1.2 2007/02/08 23:19:38 delpinux Exp $ #ifndef BOUNDARY_CONDITION_EXPRESSION_DIRICHLET_HPP #define BOUNDARY_CONDITION_EXPRESSION_DIRICHLET_HPP #include /** * @file BoundaryConditionExpressionDirichlet.hpp * @author Stephane Del Pino * @date Mon Aug 7 12:18:17 2006 * * @brief This class defines the class of dirichlet BoundaryCondition * expressions */ class BoundaryConditionExpressionDirichlet : public BoundaryConditionExpression { private: ReferenceCounting __g; /**< @f$ g @f$ */ /** * Writes the expression to a stream * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param unknownName unknown variable * @param g @f$ g @f$ * @param boundary boundary expression */ BoundaryConditionExpressionDirichlet(const std::string& unknownName, ReferenceCounting g, ReferenceCounting boundary); /** * Copy constructor * * @param d dirichlet expression */ BoundaryConditionExpressionDirichlet(const BoundaryConditionExpressionDirichlet& d); /** * Destructor * */ ~BoundaryConditionExpressionDirichlet(); }; #endif // BOUNDARY_CONDITION_EXPRESSION_DIRICHLET_HPP freefem3d-1.0pre10/language/BoundaryConditionExpression.hpp0000644000175000017500000000461510562730012021013 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryConditionExpression.hpp,v 1.9 2007/02/08 23:19:38 delpinux Exp $ #ifndef BOUNDARY_CONDITION_EXPRESSION_HPP #define BOUNDARY_CONDITION_EXPRESSION_HPP #include #include #include /** * @file BoundaryConditionExpression.hpp * @author Stephane Del Pino * @date Wed Jan 5 20:09:56 2005 * * @brief This class defines the base class of BoundaryCondition * expressions */ class BoundaryCondition; class BoundaryConditionExpression : public Expression { protected: ConstReferenceCounting __boundaryCondition; ReferenceCounting __boundary; const std::string __unknownName; public: enum BoundaryConditionType { dirichlet, neumann, fourrier // also known as Robin }; const std::string& unknownName() const { return __unknownName; } private: BoundaryConditionExpression::BoundaryConditionType __boundaryConditionType; public: bool hasPOVBoundary() const { return __boundary->hasPOVBoundary(); } ConstReferenceCounting boundaryCondition() const; const BoundaryConditionExpression::BoundaryConditionType& boundaryConditionType() const { return __boundaryConditionType; } BoundaryConditionExpression(const BoundaryConditionExpression& e); BoundaryConditionExpression(ReferenceCounting boundary, const std::string& unknownName, const BoundaryConditionExpression::BoundaryConditionType& t); virtual ~BoundaryConditionExpression(); }; #endif // BOUNDARY_CONDITION_EXPRESSION_HPP freefem3d-1.0pre10/language/POVLexer.hpp0000644000175000017500000000302510572276253014754 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: POVLexer.hpp,v 1.2 2003/05/05 19:03:32 delpinux Exp $ #include #ifndef _POVLEXER_HPP_ #define _POVLEXER_HPP_ /*! \class POVLexer This class is a the specialized Lexer for the POV-Ray language. \author Stéphane Del Pino */ class POVLexer : public Lexer { private: /*! This function returns the token associated to the name "word" if it corresponds to a Keyword, else, it returns "-1". */ int isKeyword (const std::string& word); public: //! The lexer function. int yylex(); //! Constructs a POVLexer for given std::istream and std::ostream. POVLexer(std::istream& In, std::ostream& Out = std::cout); //! Destructor. ~POVLexer() { ; } }; #endif // _POVLEXER_HPP_ freefem3d-1.0pre10/language/DomainExpressionUndefined.cpp0000644000175000017500000000234210561425532020407 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpressionUndefined.cpp,v 1.1 2006/09/28 19:05:34 delpinux Exp $ #include DomainExpressionUndefined ::DomainExpressionUndefined() : DomainExpression(DomainExpression::undefined) { ; } DomainExpressionUndefined ::DomainExpressionUndefined(const DomainExpressionUndefined& m) : DomainExpression(m) { ; } DomainExpressionUndefined ::~DomainExpressionUndefined() { ; } freefem3d-1.0pre10/language/OFStreamExpressionVariable.cpp0000644000175000017500000000344410563377365020524 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: OFStreamExpressionVariable.cpp,v 1.3 2007/02/10 17:20:53 delpinux Exp $ #include #include ConstReferenceCounting OFStreamExpressionVariable::ofstreamExpression() const { return __ofstreamVariable->expression(); } OFStreamExpressionVariable:: OFStreamExpressionVariable(const std::string& ofstreamName) : OFStreamExpression(OFStreamExpression::variable), __ofstreamName(ofstreamName), __ofstreamVariable(0) { ; } OFStreamExpressionVariable:: OFStreamExpressionVariable(const OFStreamExpressionVariable& e) : OFStreamExpression(e), __ofstreamName(e.__ofstreamName), __ofstreamVariable(e.__ofstreamVariable) { ; } OFStreamExpressionVariable:: ~OFStreamExpressionVariable() { ; } void OFStreamExpressionVariable:: execute() { __ofstreamVariable = VariableRepository::instance().findVariable(__ofstreamName); __fout = __ofstreamVariable->expression()->ofstream(); } freefem3d-1.0pre10/language/VariationalOperatorExpression.hpp0000644000175000017500000010220710640300314021335 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariationalOperatorExpression.hpp,v 1.16 2007/06/26 21:10:36 delpinux Exp $ #ifndef VARIATIONAL_OPERATOR_EXPRESSION_HPP #define VARIATIONAL_OPERATOR_EXPRESSION_HPP #include #include #include #include #include #include /** * @file VariationalOperatorExpression.hpp * @author Stephane Del Pino * @date Mon May 27 17:51:28 2002 * * @brief Variational operator description * * This file contain "Variational operators" description. It means *that all PDE operator's associated weak forms can be found here. */ class VariationalBilinearOperatorExpression : public Expression { public: enum OperatorType { mugradUgradV, /**< \f$ \int \mu \nabla u \nabla v \f$ */ alphaDxUDxV, /**< \f$ \int \nabla u A \nabla v \f$ */ nuDxUV, /**< \f$ \int \nu \partial_{x_i} u v \f$ */ nuUdxV, /**< \f$ \int \nu u \partial_{x_i} v \f$ */ alphaUV, /**< \f$ \int \alpha u v \f$ */ }; private: OperatorType __operatorType; /**< operator type */ ReferenceCounting __border; /**< border */ /** * Checks that no boundary expression is used in volumic expression * (normal to the boundary for instance) */ void __checkNoBoundaryExpression() const { if (this->__hasBoundaryExpression()) { throw ErrorHandler(__FILE__,__LINE__, "cannot evaluate the expression \"" +stringify(*this)+ "\" in the volume", ErrorHandler::normal); } } protected: /** * proceed execution * */ virtual void __executeRemaining() = 0; virtual bool __hasBoundaryExpression() const = 0; std::string __propertyBeginWrite(const VariationalOperator::Property& property) const { switch(property) { case VariationalOperator::mean: { return "{"; break; } case VariationalOperator::jump: { return "["; break; } default: { return ""; } } } std::string __propertyEndWrite(const VariationalOperator::Property& property) const { switch(property) { case VariationalOperator::mean: { return "}"; break; } case VariationalOperator::jump: { return "]"; break; } default: { return ""; } } } std::string __unknownTypeBeginWrite() const { return __propertyBeginWrite(__unknownProperty); } std::string __unknownTypeEndWrite() const { return __propertyEndWrite(__unknownProperty); } std::string __testTypeBeginWrite() const { return __propertyBeginWrite(__testFunctionProperty); } std::string __testTypeEndWrite() const { return __propertyEndWrite(__testFunctionProperty); } char __directionName(const size_t& i) const { switch(i) { case 0: return 'x'; case 1: return 'y'; case 2: return 'z'; default: { throw ErrorHandler(__FILE__,__LINE__,": unknown direction", ErrorHandler::unexpected); return '0'; } } } const std::string __unknownName; /**< unknown variable */ const VariationalOperator::Property __unknownProperty; /**< unknown property */ const std::string __testFunctionName; /**< test function */ const VariationalOperator::Property __testFunctionProperty; /**< test function property */ public: /** * Returns the border Expression * * @return __border */ ReferenceCounting border() const { return __border; } /** * Expression::execute() overloading * */ void execute() { if(__border != 0) { (*__border).execute(); } __executeRemaining(); if(__border == 0) { __checkNoBoundaryExpression(); } } /** * * Access to the operator type * * @return __operatorType */ OperatorType operatorType() { return __operatorType; } /** * * Access to the unknown variable * * @return __unknownName */ const std::string& unknownName() const { return __unknownName; } /** * * Access to the test function * * @return __testFunctionName */ const std::string& testFunctionName() const { return __testFunctionName; } /** * Gets unknown property * * @return __unknownProperty */ const VariationalOperator::Property& unknownProperty() const { return __unknownProperty; } /** * Gets test function property * * @return __testFunctionProperty */ const VariationalOperator::Property& testFunctionProperty() const { return __testFunctionProperty; } /** * Copy Constructor * * @param V Variational Bilinear Operator */ VariationalBilinearOperatorExpression(const VariationalBilinearOperatorExpression& V) : Expression(V), __operatorType(V.__operatorType), __border(V.__border), __unknownName(V.__unknownName), __unknownProperty(V.__unknownProperty), __testFunctionName(V.__testFunctionName), __testFunctionProperty(V.__testFunctionProperty) { ; } /** * Constructor * * @param type type of operator * @param border the border where to compute this term * @param u unknown function * @param t test function */ VariationalBilinearOperatorExpression(VariationalBilinearOperatorExpression::OperatorType type, ReferenceCounting border, const std::string& unknownName, const VariationalOperator::Property& unknownProperty, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty) : Expression(Expression::variationalBilinearOperator), __operatorType(type), __border(border), __unknownName(unknownName), __unknownProperty(unknownProperty), __testFunctionName(testFunctionName), __testFunctionProperty(testFunctionProperty) { ; } /** * Destructor * */ virtual ~VariationalBilinearOperatorExpression() { ; } }; /** * @class VariationalLinearOperatorExpression * @author Stephane Del Pino * @date Wed May 29 11:13:20 2002 * * @brief Describes linear operators * * This is used to describe linear operators going to the right hand * side of a variational formulation. */ class VariationalLinearOperatorExpression : public Expression { public: enum OperatorType { FV, /**< \f$\int fv\f$ */ FdxGV, /**< \f$ \int f\partial_{x_i} g v \f$ */ FdxV, /**< \f$ \int f\partial_{x_i} v \f$ */ FgradGgradV /**< \f$ \int f\\nabla g\cdot\nabla v \f$ */ }; private: const OperatorType __operatorType; /**< operator type */ ReferenceCounting __border; /**< border */ virtual void __executeRemaining() = 0; void __checkNoBoundaryExpression() const { if (this->__hasBoundaryExpression()) { throw ErrorHandler(__FILE__,__LINE__, "cannot evaluate the expression \"" +stringify(*this)+ "\" in the volume", ErrorHandler::normal); } } protected: std::string __propertyBeginWrite(const VariationalOperator::Property& property) const { switch(property) { case VariationalOperator::mean: { return "{"; break; } case VariationalOperator::jump: { return "["; break; } default: { return ""; } } } std::string __propertyEndWrite(const VariationalOperator::Property& property) const { switch(property) { case VariationalOperator::mean: { return "}"; break; } case VariationalOperator::jump: { return "]"; break; } default: { return ""; } } } std::string __testTypeBeginWrite() const { return __propertyBeginWrite(__testFunctionProperty); } std::string __testTypeEndWrite() const { return __propertyEndWrite(__testFunctionProperty); } virtual bool __hasBoundaryExpression() const = 0; char __directionName(const size_t& i) const { switch(i) { case 0: return 'x'; case 1: return 'y'; case 2: return 'z'; default: { throw ErrorHandler(__FILE__,__LINE__,": unknown direction", ErrorHandler::unexpected); return '0'; } } } const std::string __testFunctionName; /**< test function name */ const VariationalOperator::Property __testFunctionProperty; /**< test function property */ public: /** * Returns the border Expression * * @return __border */ ReferenceCounting border() const { return __border; } /** * Expression::execute() overloading * */ void execute() { if(__border != 0) { (*__border).execute(); } __executeRemaining(); if(__border == 0) { __checkNoBoundaryExpression(); } } /** * * Access to the operator type * * @return __operatorType */ OperatorType operatorType() { return __operatorType; } /** * * Access to the test function * * @return __testFunctionName */ const std::string& testFunctionName() const { return __testFunctionName; } /** * Copy Constructor * * @param V Variational Linear Operator */ VariationalLinearOperatorExpression(const VariationalLinearOperatorExpression& V) : Expression(V), __operatorType(V.__operatorType), __border(V.__border), __testFunctionName(V.__testFunctionName), __testFunctionProperty(V.__testFunctionProperty) { ; } /** * Constructor * * @param type type of operator * @param border the border where the variational linear operator is defined * @param testFunctionName test function * @param testFunctionProperty test function property */ VariationalLinearOperatorExpression(VariationalLinearOperatorExpression::OperatorType type, ReferenceCounting border, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty) : Expression(Expression::variationalBilinearOperator), __operatorType(type), __border(border), __testFunctionName(testFunctionName), __testFunctionProperty(testFunctionProperty) { ; } /** * Destructor * */ virtual ~VariationalLinearOperatorExpression() { ; } }; /********************** * BILINEAR OPERATORS * **********************/ /** * @class VariationalMuGradUGradVExpression * @author Stephane Del Pino * @date Tue May 28 15:43:26 2002 * * @brief \f$\mu\nabla u\nabla v\f$ operator * * \f$\mu\nabla u\nabla v\f$ operator */ class VariationalMuGradUGradVExpression : public VariationalBilinearOperatorExpression { private: ReferenceCounting __mu; /**< viscosity \f$\mu\f$*/ bool __hasBoundaryExpression() const { return (*__mu).hasBoundaryExpression(); } public: /** * Access to the viscosity \f$\mu\f$ * * * @return __mu */ ReferenceCounting mu() { return __mu; } /** * VariationalBilinearOperatorExpression::__executeRemaining() overloading * */ void __executeRemaining() { (*__mu).execute(); } /** * put function overloading * * @param os * * @return os */ std::ostream& put(std::ostream& os) const { os << *__mu << '*' << this->__unknownTypeBeginWrite() << "grad(" << __unknownName << ')' << this->__unknownTypeEndWrite() << '*' << this->__testTypeBeginWrite() << "grad(" << __testFunctionName << ')' << this->__testTypeEndWrite(); return os; } /** * Constructor * * @param mu \f$\mu\f$, the viscosity * @param u unknown function * @param t test function * @param border the border where to compute the integral * */ VariationalMuGradUGradVExpression(ReferenceCounting mu, const std::string& unknownName, const VariationalOperator::Property& unknownProperty, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty, ReferenceCounting border = 0) : VariationalBilinearOperatorExpression(VariationalBilinearOperatorExpression:: mugradUgradV, border, unknownName, unknownProperty, testFunctionName, testFunctionProperty), __mu(mu) { ; } /** * Copy Constructor * * @param V * */ VariationalMuGradUGradVExpression(const VariationalMuGradUGradVExpression& V) : VariationalBilinearOperatorExpression(V), __mu(V.__mu) { ; } /** * * Destructor * */ ~VariationalMuGradUGradVExpression() { ; } }; /** * @class VariationalAlphaDxUDxVExpression * @author Stephane Del Pino * @date Tue May 28 15:43:26 2002 * * @brief \f$\alpha \partial{x_j} u\partial_{x_i} v\f$ operator * * \f$\alpha \partial_{x_j} u\partial{x_i} v\f$ */ class VariationalAlphaDxUDxVExpression : public VariationalBilinearOperatorExpression { private: ReferenceCounting __Alpha; /**< \f$\alpha\f$*/ size_t __i; /**< the \f$ i\f$ in \f$\partial_{x_i}\f$ */ size_t __j; /**< the \f$ j\f$ in \f$\partial_{x_j}\f$ */ /** * put function overloading * * @param os * * @return os */ std::ostream& put(std::ostream& os) const { os << *__Alpha << '*' << this->__unknownTypeBeginWrite() << 'd' << __directionName(__j) << '(' << __unknownName << ')' << this->__unknownTypeEndWrite() << '*' << this->__testTypeBeginWrite() << 'd' << __directionName(__i) << '(' << __testFunctionName << ')' << this->__testTypeEndWrite(); return os; } bool __hasBoundaryExpression() const { return (*__Alpha).hasBoundaryExpression(); } public: /** * Access to \f$\alpha\f$ * * * @return __Alpha */ ReferenceCounting alpha() { return __Alpha; } /** * Access to __i * * * @return __i */ const size_t& i() const { return __i; } /** * Access to __j * * * @return __j */ const size_t& j() const { return __j; } /** * VariationalBilinearOperatorExpression::__executeRemaining() overloading * */ void __executeRemaining() { (*__Alpha).execute(); } /** * Constructor of the type \f$ \alpha \partial_{x_i} u \partial_{x_j} v\f$ * * @param alpha \f$ \alpha \f$ * @param i \f$ \partial_{x_i} \f$ * @param j \f$ \partial_{x_j} \f$ * @param u unknown function * @param v test function * @param border the border where to compute this term if required. * */ VariationalAlphaDxUDxVExpression(ReferenceCounting alpha, const size_t i, const size_t j, const std::string& unknownName, const VariationalOperator::Property& unknownProperty, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty, ReferenceCounting border = 0) : VariationalBilinearOperatorExpression(VariationalBilinearOperatorExpression:: alphaDxUDxV, border, unknownName, unknownProperty, testFunctionName, testFunctionProperty), __Alpha(alpha), __i(i), __j(j) { ; } /** * Copy Constructor * * @param V * */ VariationalAlphaDxUDxVExpression(const VariationalAlphaDxUDxVExpression& V) : VariationalBilinearOperatorExpression(V), __Alpha(V.__Alpha), __i(V.__i), __j(V.__j) { ; } /** * * Destructor * */ ~VariationalAlphaDxUDxVExpression() { ; } }; /** * @class VariationalNuUdxVExpression * @author Stephane Del Pino * @date Tue May 28 15:43:26 2002 * * @brief \f$\nu u\partial_{x_i} v\f$ operator * * \f$\nu u\partial_{x_i} v\f$ */ class VariationalNuUdxVExpression : public VariationalBilinearOperatorExpression { private: ReferenceCounting __nu; /**< \f$\nu\f$*/ size_t __number; /**< the \f$ i\f$ in \f$\partial_{x_i}\f$ */ /** * put function overloading * * @param os * * @return os */ std::ostream& put(std::ostream& os) const { os << *__nu << '*' << this->__unknownTypeBeginWrite() << __unknownName << this->__unknownTypeEndWrite() << '*' << this->__testTypeBeginWrite() << 'd' << __directionName(__number) << '(' << __testFunctionName << ')' << this->__testTypeEndWrite(); return os; } bool __hasBoundaryExpression() const { return (*__nu).hasBoundaryExpression(); } public: /** * Access to \f$\nu\f$ * * * @return __nu */ ReferenceCounting nu() { return __nu; } /** * Access to __number * * * @return __number */ const size_t& number() const { return __number; } /** * VariationalBilinearOperatorExpression::__executeRemaining() overloading * */ void __executeRemaining() { (*__nu).execute(); } /** * Constructor * * @param nu \f$\nu\f$ * @param number the number of the derivative variable (\f$ i\f$) * @param u unknown function * @param t test function * @param border the border where to compute the integral * */ VariationalNuUdxVExpression(ReferenceCounting nu, const size_t& number, const std::string& unknownName, const VariationalOperator::Property& unknownProperty, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty, ReferenceCounting border = 0) : VariationalBilinearOperatorExpression(VariationalBilinearOperatorExpression:: nuUdxV, border, unknownName, unknownProperty, testFunctionName, testFunctionProperty), __nu(nu), __number(number) { ; } /** * Copy Constructor * * @param V * */ VariationalNuUdxVExpression(const VariationalNuUdxVExpression& V) : VariationalBilinearOperatorExpression(V), __nu(V.__nu), __number(V.__number) { ; } /** * * Destructor * */ ~VariationalNuUdxVExpression() { ; } }; /** * @class VariationalNuDxUVExpression * @author Stephane Del Pino * @date Tue May 28 15:43:26 2002 * * @brief \f$\nu u\partial_{x_i} v\f$ operator * * \f$\nu u\partial_{x_i} v\f$ */ class VariationalNuDxUVExpression : public VariationalBilinearOperatorExpression { private: ReferenceCounting __nu; /**< \f$\nu\f$*/ size_t __number; /**< the \f$ i\f$ in \f$\partial_{x_i}\f$ */ /** * put function overloading * * @param os * * @return os */ std::ostream& put(std::ostream& os) const { os << *__nu << '*' << this->__unknownTypeBeginWrite() << 'd' << __directionName(__number) << '(' << __unknownName << ')' << this->__unknownTypeEndWrite() << '*' << this->__testTypeBeginWrite() << __testFunctionName << this->__testTypeEndWrite(); return os; } bool __hasBoundaryExpression() const { return (*__nu).hasBoundaryExpression(); } public: /** * Access to \f$\nu\f$ * * * @return __nu */ ReferenceCounting nu() { return __nu; } /** * Access to __number * * * @return __number */ const size_t& number() const { return __number; } /** * VariationalBilinearOperatorExpression::__executeRemaining() overloading * */ void __executeRemaining() { (*__nu).execute(); } /** * Constructor * * @param nu \f$\nu\f$ * @param number the derivative variable number (\f$ i\f$) * @param u unknown function * @param t test function * @param border the border where to compute the integral * */ VariationalNuDxUVExpression(ReferenceCounting nu, const size_t& number, const std::string& unknownName, const VariationalOperator::Property& unknownProperty, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty, ReferenceCounting border = 0) : VariationalBilinearOperatorExpression(VariationalBilinearOperatorExpression:: nuDxUV, border, unknownName, unknownProperty, testFunctionName, testFunctionProperty), __nu(nu), __number(number) { ; } /** * Copy Constructor * * @param V * */ VariationalNuDxUVExpression(const VariationalNuDxUVExpression& V) : VariationalBilinearOperatorExpression(V), __nu(V.__nu), __number(V.__number) { ; } /** * * Destructor * */ ~VariationalNuDxUVExpression() { ; } }; /** * @class VariationalAlphaUVExpression * @author Stephane Del Pino * @date Tue May 28 16:36:45 2002 * * @brief \f$\alpha u v\f$ operator * * \f$\alpha u v\f$ operator */ class VariationalAlphaUVExpression : public VariationalBilinearOperatorExpression { private: ReferenceCounting __Alpha; /**< mass term \f$\alpha\f$*/ bool __hasBoundaryExpression() const { return (*__Alpha).hasBoundaryExpression(); } /** * VariationalBilinearOperatorExpression::__executeRemaining() overloading * */ void __executeRemaining() { (*__Alpha).execute(); } public: ReferenceCounting alpha() { return __Alpha; } /** * put function overloading * * @param os * * @return os */ std::ostream& put(std::ostream& os) const { os << *__Alpha << '*' << this->__unknownTypeBeginWrite() << __unknownName << this->__unknownTypeEndWrite() << '*' << this->__testTypeBeginWrite() << __testFunctionName << this->__testTypeEndWrite(); return os; } /** * Constructor * * @param alpha \f$\alpha\f$, the mass coeffiecient * @param unknownName unknown function * @param testFunctionName test function * @param border the border where to compute the integral if required. * */ VariationalAlphaUVExpression(ReferenceCounting alpha, const std::string& unknownName, const VariationalOperator::Property& unknownProperty, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty, ReferenceCounting border = 0) : VariationalBilinearOperatorExpression(VariationalBilinearOperatorExpression::alphaUV, border, unknownName, unknownProperty, testFunctionName, testFunctionProperty), __Alpha(alpha) { ; } /** * Copy Constructor * * @param V * */ VariationalAlphaUVExpression(const VariationalAlphaUVExpression& V) : VariationalBilinearOperatorExpression(V), __Alpha(V.__Alpha) { ; } /** * * Destructor * */ ~VariationalAlphaUVExpression() { ; } }; /******************** * LINEAR OPERATORS * ********************/ /** * @class VariationalFVExpression * @author Stephane Del Pino * @date Wed May 29 11:19:01 2002 * * @brief describes \f$\int fv\f$ * * used to describe \f$\int fv\f$ */ class VariationalFVExpression : public VariationalLinearOperatorExpression { private: ReferenceCounting __f; /**< \f$ f\f$*/ /** * VariationalLinearOperatorExpression::__executeRemaining() overloading * */ void __executeRemaining() { (*__f).execute(); } bool __hasBoundaryExpression() const { return (*__f).hasBoundaryExpression(); } /** * put function overloading * * @param os the input (modified) stream * * @return os */ std::ostream& put(std::ostream& os) const { os << *__f << '*' << this->__testTypeBeginWrite() << __testFunctionName << this->__testTypeEndWrite(); return os; } public: /** * * Returns the \f$ f\f$ function * * @return __f */ ReferenceCounting f() { return __f; } /** * Constructor * * @param f \f$ f\f$, the second member * @param testFunctionName a test function * @param testFunctionProperty a test function property * @param border the border where it is computed * */ VariationalFVExpression(ReferenceCounting f, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty, ReferenceCounting border = 0) : VariationalLinearOperatorExpression(VariationalLinearOperatorExpression::FV, border, testFunctionName, testFunctionProperty), __f(f) { ; } /** * Copy Constructor * * @param V * */ VariationalFVExpression(const VariationalFVExpression& V) : VariationalLinearOperatorExpression(V), __f(V.__f) { ; } /** * * Destructor * */ ~VariationalFVExpression() { ; } }; /** * @class VariationalFdxGVExpression * @author Stephane Del Pino * @date Sun Jun 23 19:51:48 2002 * * @brief \f$ b(v) = \int f\partial_{x_i} g v \f$ */ class VariationalFdxGVExpression : public VariationalLinearOperatorExpression { private: ReferenceCounting __f; /**< \f$ f\f$*/ ReferenceCounting __g; /**< \f$ g\f$*/ const size_t __number; /**< \f$ i \f$ in \f$\partial_{x_i}\f$ */ bool __hasBoundaryExpression() const { return ((*__f).hasBoundaryExpression() or (*__g).hasBoundaryExpression()); } /** * VariationalLinearOperatorExpression::__executeRemaining() overloading * */ void __executeRemaining() { (*__f).execute(); (*__g).execute(); } /** * put function overloading * * @param os the input (modified) stream * * @return os */ std::ostream& put(std::ostream& os) const { os << *__f << '*' << 'd'<< __directionName(__number) << '(' << *__g << ')' << this->__testTypeBeginWrite() << '*' << __testFunctionName << this->__testTypeEndWrite(); return os; } public: /** * Access to __number * * @return __number */ const size_t& number() const { return __number; } /** * * Returns the \f$ f\f$ function * * @return __f */ ReferenceCounting f() { return __f; } /** * * Returns the \f$ g\f$ function * * @return __g */ ReferenceCounting g() { return __g; } /** * Constructor * * @param f the function \f$ f\f$ * @param g the function \f$ g \f$ * @param testFunctionName a test function * @param testFunctionProperty a test function property * @param n the number of the derivative variable (\f$ i\f$) * @param border the border where it is computed * */ VariationalFdxGVExpression(ReferenceCounting f, ReferenceCounting g, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty, const size_t& n, ReferenceCounting border = 0) : VariationalLinearOperatorExpression(VariationalLinearOperatorExpression::FdxGV, border, testFunctionName, testFunctionProperty), __f(f), __g(g), __number(n) { ; } /** * Copy Constructor * * @param V * */ VariationalFdxGVExpression(const VariationalFdxGVExpression& V) : VariationalLinearOperatorExpression(V), __f(V.__f), __g(V.__g), __number(V.__number) { ; } /** * * Destructor * */ ~VariationalFdxGVExpression() { ; } }; /** * @class VariationalFdxGVExpression * @author Stephane Del Pino * @date Sun Jun 23 19:51:48 2007 * * @brief \f$ b(v) = \int f\partial_{x_i} v \f$ */ class VariationalFdxVExpression : public VariationalLinearOperatorExpression { private: ReferenceCounting __f; /**< \f$ f\f$*/ const size_t __number; /**< \f$ i \f$ in \f$\partial_{x_i}\f$ */ bool __hasBoundaryExpression() const { return __f->hasBoundaryExpression(); } /** * VariationalLinearOperatorExpression::__executeRemaining() overloading * */ void __executeRemaining() { __f->execute(); } /** * put function overloading * * @param os the input (modified) stream * * @return os */ std::ostream& put(std::ostream& os) const { os << *__f << '*' << this->__testTypeBeginWrite() <<'d'<< __directionName(__number) << '(' << __testFunctionName << ')' << this->__testTypeEndWrite(); return os; } public: /** * Access to __number * * @return __number */ const size_t& number() const { return __number; } /** * * Returns the \f$ f\f$ function * * @return __f */ ReferenceCounting f() { return __f; } /** * Constructor * * @param f the function \f$ f\f$ * @param testFunctionName a test function * @param testFunctionProperty a test function property * @param n the number of the derivative variable (\f$ i\f$) * @param border the border where it is computed */ VariationalFdxVExpression(ReferenceCounting f, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty, const size_t& n, ReferenceCounting border = 0) : VariationalLinearOperatorExpression(VariationalLinearOperatorExpression::FdxV, border, testFunctionName, testFunctionProperty), __f(f), __number(n) { ; } /** * Copy Constructor * * @param V * */ VariationalFdxVExpression(const VariationalFdxVExpression& V) : VariationalLinearOperatorExpression(V), __f(V.__f), __number(V.__number) { ; } /** * * Destructor * */ ~VariationalFdxVExpression() { ; } }; /** * @class VariationalOperatorExpression * @author Stephane Del Pino * @date Sun Nov 21 18:20:15 2004 * * @brief \f$ b(v) = \int f\nabla g\cdot\nabla v \f$ * */ class VariationalFgradGgradVExpression : public VariationalLinearOperatorExpression { private: ReferenceCounting __f; /**< \f$ f\f$*/ ReferenceCounting __g; /**< \f$ g\f$*/ /** * VariationalLinearOperatorExpression::__executeRemaining() overloading * */ void __executeRemaining() { (*__f).execute(); (*__g).execute(); } bool __hasBoundaryExpression() const { return ((*__f).hasBoundaryExpression() or (*__g).hasBoundaryExpression()); } /** * put function overloading * * @param os the input (modified) stream * * @return os */ std::ostream& put(std::ostream& os) const { os << *__f << "*grad("<< *__g << ')' <<'*' << this->__testTypeBeginWrite() << "grad(" << __testFunctionName << ')' << this->__testTypeEndWrite(); return os; } public: /** * * Returns the \f$ f\f$ function * * @return __f */ ReferenceCounting f() { return __f; } /** * * Returns the \f$ g\f$ function * * @return __g */ ReferenceCounting g() { return __g; } /** * Constructor * * @param f the function \f$ f\f$ * @param g the function \f$ g \f$ * @param testFunctionName a test function * @param testFunctionProperty a test function property * @param border the border where it is computed */ VariationalFgradGgradVExpression(ReferenceCounting f, ReferenceCounting g, const std::string& testFunctionName, const VariationalOperator::Property& testFunctionProperty, ReferenceCounting border = 0) : VariationalLinearOperatorExpression(VariationalLinearOperatorExpression::FgradGgradV, border, testFunctionName, testFunctionProperty), __f(f), __g(g) { ; } /** * Copy Constructor * * @param V a VariationalFgradGgradVExpression * */ VariationalFgradGgradVExpression(const VariationalFgradGgradVExpression& V) : VariationalLinearOperatorExpression(V), __f(V.__f), __g(V.__g) { ; } /** * * Destructor * */ ~VariationalFgradGgradVExpression() { ; } }; #endif // VARIATIONAL_OPERATOR_EXPRESSION_HPP freefem3d-1.0pre10/language/SubOptionExpression.hpp0000644000175000017500000000602510561425532017307 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: SubOptionExpression.hpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ #ifndef _SUB_OPTION_EXPRESSION_HPP_ #define _SUB_OPTION_EXPRESSION_HPP_ #include #include #include class SubOptionExpression : public Expression { public: enum SOEType { stringValue, realValue, integerValue }; protected: ReferenceCounting __name; virtual void setOption(std::string& name) = 0; private: SubOptionExpression::SOEType __type; public: void evaluate(const std::string& basename) { std::string name = basename; name += "::"; name += (*__name).value(); setOption(name); } SubOptionExpression(const SubOptionExpression& soe) : Expression(soe), __name(soe.__name), __type(soe.__type) { ; } SubOptionExpression(ReferenceCounting name, SubOptionExpression::SOEType type) : Expression(Expression::subOption), __name(name), __type(type) { ; } virtual ~SubOptionExpression() { ; } }; class SubOptionExpressionString : public SubOptionExpression { private: ReferenceCounting __value; std::ostream& put(std::ostream& os) const { os << *__name << "::" << *__value; return os; } void setOption(std::string& name); public: void execute() { (*__name).execute(); (*__value).execute(); } SubOptionExpressionString(ReferenceCounting name, ReferenceCounting value) : SubOptionExpression(name, SubOptionExpression::stringValue), __value(value) { ; } }; class SubOptionExpressionReal : public SubOptionExpression { private: ReferenceCounting __value; std::ostream& put(std::ostream& os) const { os << *__name << "::" << *__value; return os; } void setOption(std::string& name); public: void execute() { (*__name).execute(); (*__value).execute(); } SubOptionExpressionReal(ReferenceCounting name, ReferenceCounting value) : SubOptionExpression(name, SubOptionExpression::realValue), __value(value) { ; } }; #endif // _SUB_OPTION_EXPRESSION_HPP_ freefem3d-1.0pre10/language/FunctionExpressionNormalComponent.cpp0000644000175000017500000000213210561425532022174 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionNormalComponent.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include void FunctionExpressionNormalComponent:: execute() { __scalarFunction = new ScalarFunctionNormal(__normalType); } freefem3d-1.0pre10/language/DomainExpression.cpp0000644000175000017500000000267710624156366016606 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpression.cpp,v 1.6 2007/05/20 23:02:48 delpinux Exp $ #include #include #include #include ReferenceCounting DomainExpression::domain() const { ASSERT(__domainType != DomainExpression::undefined); return __domain; } DomainExpression:: DomainExpression(const DomainExpression& e) : Expression(e), __domain(e.__domain), __domainType(e.__domainType) { ; } DomainExpression:: DomainExpression(const DomainExpression::DomainType& t) : Expression(Expression::domain), __domainType(t) { ; } DomainExpression:: ~DomainExpression() { ; } freefem3d-1.0pre10/language/SolverOptionsExpression.hpp0000644000175000017500000000404410561425532020212 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: SolverOptionsExpression.hpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ #ifndef _SOLVEROPTIONS_EXPRESSION_HPP_ #define _SOLVEROPTIONS_EXPRESSION_HPP_ #include #include #include /*! \class SolverOptionsExpression This class defines the base class of SolverOptions expressions. \author Stephane Del Pino */ class SolverOptionsExpression : public Expression { private: typedef std::list > OptionList; OptionList __options; std::ostream& put(std::ostream& os) const { for(OptionList::const_iterator i = __options.begin(); i != __options.end(); ++i) { os << (*(*i)) << '\n'; } return os; } public: void execute() { for(OptionList::iterator i = __options.begin(); i != __options.end(); ++i) { (*(*i)).execute(); } } void add(ReferenceCounting o) { __options.push_back(o); } SolverOptionsExpression(const SolverOptionsExpression& soe) : Expression(soe), __options(soe.__options) { ; } SolverOptionsExpression() : Expression(Expression::solverOptions) { ; } ~SolverOptionsExpression() { ; } }; #endif // _SOLVEROPTIONS_EXPRESSION_HPP_ freefem3d-1.0pre10/language/FunctionExpressionDerivative.cpp0000644000175000017500000000453510561425532021174 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionDerivative.cpp,v 1.2 2006/07/23 22:14:19 delpinux Exp $ #include #include void FunctionExpressionDerivative:: execute() { __derivedFunction->execute(); switch (__direction) { case FunctionExpressionDerivative::x: { __scalarFunction = new ScalarFunctionDerivative(ScalarFunctionDerivative::x, __derivedFunction->function()); break; } case FunctionExpressionDerivative::y: { __scalarFunction = new ScalarFunctionDerivative(ScalarFunctionDerivative::y, __derivedFunction->function()); break; } case FunctionExpressionDerivative::z: { __scalarFunction = new ScalarFunctionDerivative(ScalarFunctionDerivative::z, __derivedFunction->function()); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unknown derivation direction", ErrorHandler::unexpected); } } } FunctionExpressionDerivative:: FunctionExpressionDerivative(const std::string& operatorName, ReferenceCounting derivedFunction) : FunctionExpression(FunctionExpression::derivative), __direction(FunctionExpressionDerivative::getDirection(operatorName)), __derivedFunction(derivedFunction) { ; } FunctionExpressionDerivative:: FunctionExpressionDerivative(const FunctionExpressionDerivative& f) : FunctionExpression(f), __direction(f.__direction), __derivedFunction(f.__derivedFunction) { ; } FunctionExpressionDerivative:: ~FunctionExpressionDerivative() { ; } freefem3d-1.0pre10/language/FunctionExpression.hpp0000644000175000017500000000613610604043217017147 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpression.hpp,v 1.20 2007/04/01 23:46:41 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_HPP #define FUNCTION_EXPRESSION_HPP #include #include #include class ScalarFunctionBase; /** * @file FunctionExpression.hpp * @author Stephane Del Pino * @date Tue Jul 4 01:05:53 2006 * * @brief Function expression base class * */ class FunctionExpression : public Expression { public: /// functions types ids enum FunctionType { constant, linearBase, normalComponent, fem, spectral, derivative, meshReferences, composed, variable, cfunction, binaryOperation, unaryMinus, convection, objectCharacteristic, meshCharacteristic, domainCharacteristic, read, functionValue, not_, integrate }; private: const FunctionType __type; /**< Type of function */ bool __unknown; /**< is true if the function is unknown */ protected: ConstReferenceCounting __scalarFunction; /**< The function associated to the expression */ /** * Specialization of the put function * * @param os the stream * * @return the stream @a os */ virtual std::ostream& put(std::ostream& os) const; public: /** * Returns @b true if the functions has a boundary * * @return false as a default value */ virtual bool hasBoundaryExpression() const; /** * Read only access to the type of the function * * @return __type */ const FunctionExpression::FunctionType& type() const; /** * Access to the scalar function * * @return __scalarFunction */ ConstReferenceCounting function() const; /** * Access the value of the function expression * * @return a FunctionExpressionValue */ ReferenceCounting value(); /** * Copy constructor * * @param e the original function expression * */ FunctionExpression(const FunctionExpression& e); /** * Builds a function expression of type @a type * * @param type the type of the function expression * */ FunctionExpression(const FunctionExpression::FunctionType& type); /** * Destructor * */ virtual ~FunctionExpression(); }; #endif // FUNCTION_EXPRESSION_HPP freefem3d-1.0pre10/language/BoundaryConditionExpressionNeumann.hpp0000644000175000017500000000434510562730012022335 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryConditionExpressionNeumann.hpp,v 1.2 2007/02/08 23:19:38 delpinux Exp $ #ifndef BOUNDARY_CONDITION_EXPRESSION_NEUMANN_HPP #define BOUNDARY_CONDITION_EXPRESSION_NEUMANN_HPP #include /** * @file BoundaryConditionExpressionNeumann.hpp * @author Stephane Del Pino * @date Mon Aug 7 12:19:59 2006 * * @brief This class defines the class of neumann BoundaryCondition * expressions */ class BoundaryConditionExpressionNeumann : public BoundaryConditionExpression { private: ReferenceCounting __g; /**< @f$ g @f$ */ /** * Writes the expression to a stream * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param unknownName the unknown variable * @param g @f$ g @f$ * @param boundary boundary expression */ BoundaryConditionExpressionNeumann(const std::string& unknownName, ReferenceCounting g, ReferenceCounting boundary); /** * Copy constructor * * @param n given Neumann expression */ BoundaryConditionExpressionNeumann(const BoundaryConditionExpressionNeumann& n); /** * Destructor * */ ~BoundaryConditionExpressionNeumann(); }; #endif // BOUNDARY_CONDITION_EXPRESSION_NEUMANN_HPP freefem3d-1.0pre10/language/PDEEquationExpression.hpp0000644000175000017500000000337710561425532017512 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: PDEEquationExpression.hpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ #ifndef _PDEEQUATION_EXPRESSION_HPP_ #define _PDEEQUATION_EXPRESSION_HPP_ #include #include #include class PDE; class PDEEquationExpression : public Expression { private: ReferenceCounting __pdeOperatorSum; ReferenceCounting __secondMember; protected: ReferenceCounting __pde; private: std::ostream& put(std::ostream& os) const { os << "\t\t" << (*__pdeOperatorSum) << " = " << (*__secondMember); return os; } public: ReferenceCounting pde(); void execute(); PDEEquationExpression(const PDEEquationExpression& e); PDEEquationExpression(ReferenceCounting __pdeOpSum, ReferenceCounting __secondMember); ~PDEEquationExpression(); }; #endif // _PDEEQUATION_EXPRESSION_HPP_ freefem3d-1.0pre10/language/FunctionExpressionComposed.cpp0000644000175000017500000000415710561425532020643 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionComposed.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include void FunctionExpressionComposed:: execute() { __function->execute(); __functionExpressionX->execute(); __functionExpressionY->execute(); __functionExpressionZ->execute(); __scalarFunction = new ScalarFunctionComposed(__function->function(), __functionExpressionX->function(), __functionExpressionY->function(), __functionExpressionZ->function()); } FunctionExpressionComposed:: FunctionExpressionComposed(ReferenceCounting f, ReferenceCounting X, ReferenceCounting Y, ReferenceCounting Z) : FunctionExpression(FunctionExpression::composed), __function(f), __functionExpressionX(X), __functionExpressionY(Y), __functionExpressionZ(Z) { ; } FunctionExpressionComposed:: FunctionExpressionComposed(const FunctionExpressionComposed& f) : FunctionExpression(f), __function(f.__function), __functionExpressionX(f.__functionExpressionX), __functionExpressionY(f.__functionExpressionY), __functionExpressionZ(f.__functionExpressionZ) { ; } FunctionExpressionComposed:: ~FunctionExpressionComposed() { ; } freefem3d-1.0pre10/language/TestFunctionExpressionList.hpp0000644000175000017500000000431010563377365020655 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: TestFunctionExpressionList.hpp,v 1.1 2007/02/10 17:20:53 delpinux Exp $ #ifndef TEST_FUNCTION_EXPRESSION_LIST_HPP #define TEST_FUNCTION_EXPRESSION_LIST_HPP #include #include #include /** * @file TestFunctionExpressionList.hpp * @author Stéphane Del Pino * @date Sat Feb 10 13:07:57 2007 * * @brief managed test function list * */ class TestFunctionExpressionList : public Expression { private: typedef std::vector > ListType; ListType __list; /**< List of test functions */ /** * Expression::put overload * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * Returns the number of test functions * * @return size */ size_t size() const; /** * Gets the number of a test function in the list * * @param name test function name * * @return its position in the list */ size_t number(const std::string& name) const; /** * Adds a test functino to the list * * @param t */ void add(ReferenceCounting t); /** * Execute the expression * */ void execute(); /** * Constructor * */ TestFunctionExpressionList(); /** * Destructor * */ ~TestFunctionExpressionList(); }; #endif // TEST_FUNCTION_EXPRESSION_LIST_HPP freefem3d-1.0pre10/language/PDEProblemExpression.hpp0000644000175000017500000000622610562730012017312 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: PDEProblemExpression.hpp,v 1.4 2007/02/08 23:19:38 delpinux Exp $ #ifndef PDEPROBLEM_EXPRESSION_HPP #define PDEPROBLEM_EXPRESSION_HPP #include #include #include #include /*! \class PdeproblemExpression This class defines the base class of Pdeproblem expressions. \author Stephane Del Pino */ class PDEProblem; class PDEProblemExpression : public Expression { public: enum PDEProblemType { description, undefined, variable }; private: PDEProblemExpression::PDEProblemType __pdeProblemType; protected: ReferenceCounting __pdeProblem; public: /** * Checks if the PDEProblemExpression contains POVRay references. If * it does the execution is stopped. This verification is required * by standard FEM. * * @return true if the problem has boundary conditions on a POV boundary */ virtual bool hasPOVBoundary() const = 0; ReferenceCounting pdeProblem(); const PDEProblemExpression::PDEProblemType& pdeProblemType() const { return __pdeProblemType; } PDEProblemExpression(const PDEProblemExpression& e); PDEProblemExpression(const PDEProblemExpression::PDEProblemType& t); virtual ~PDEProblemExpression(); }; class PDEProblemExpressionDescription : public PDEProblemExpression { private: std::ostream& put(std::ostream& os) const; const std::string __unknownName; ReferenceCounting __pdeEquation; ReferenceCounting __bcList; public: /** * Checks if the PDEProblemExpressionDescription contains POVRay * references. If it does the execution is stopped. This * verification is required by standard FEM. * * @return true if the problem has boundary conditions on a POV boundary */ bool hasPOVBoundary() const; void execute(); ReferenceCounting pdeEquation(); ReferenceCounting bcList(); PDEProblemExpressionDescription(const std::string& unknownName, ReferenceCounting pdeEquation, ReferenceCounting bcList); PDEProblemExpressionDescription(const PDEProblemExpressionDescription& e); ~PDEProblemExpressionDescription(); }; #endif // PDEPROBLEM_EXPRESSION_HPP freefem3d-1.0pre10/language/FunctionExpressionMeshCharacteristic.cpp0000644000175000017500000000352410561425532022634 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionMeshCharacteristic.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include #include std::ostream& FunctionExpressionMeshCharacteristic:: put(std::ostream& os) const { os << "one(" << *__meshExpression <<')'; return os; } void FunctionExpressionMeshCharacteristic:: execute() { __meshExpression->execute(); __scalarFunction=new ScalarFunctionMeshCharacteristic(__meshExpression->mesh()); } FunctionExpressionMeshCharacteristic:: FunctionExpressionMeshCharacteristic(ReferenceCounting meshExpression) : FunctionExpression(FunctionExpression::meshCharacteristic), __meshExpression(meshExpression) { ; } FunctionExpressionMeshCharacteristic:: FunctionExpressionMeshCharacteristic(const FunctionExpressionMeshCharacteristic& f) : FunctionExpression(f), __meshExpression(f.__meshExpression) { ; } FunctionExpressionMeshCharacteristic:: ~FunctionExpressionMeshCharacteristic() { ; } freefem3d-1.0pre10/language/BoundaryConditionListExpression.cpp0000644000175000017500000000751610562730012021645 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryConditionListExpression.cpp,v 1.5 2007/02/08 23:19:38 delpinux Exp $ #include #include #include BoundaryConditionListExpression:: BoundaryConditionListExpression(const BoundaryConditionListExpression& e) : Expression(Expression::boundaryConditionList), __boundaryConditionListType(e.__boundaryConditionListType), __boundaryConditionSet(e.__boundaryConditionSet) { ; } BoundaryConditionListExpression:: BoundaryConditionListExpression(const BoundaryConditionListExpression:: BoundaryConditionListType& t) : Expression(Expression::boundaryConditionList), __boundaryConditionListType(t) { ; } BoundaryConditionListExpression:: ~BoundaryConditionListExpression() { ; } ReferenceCounting BoundaryConditionListExpression::boundaryConditionSet() { return __boundaryConditionSet; } void BoundaryConditionListExpressionSet:: __splitBoundaryList(BoundaryConditionSet& bcSet, ConstReferenceCounting pde, ConstReferenceCounting b) { const BoundaryList& boundaryList = dynamic_cast(*b); for (BoundaryList::List::const_iterator i = boundaryList.list().begin(); i != boundaryList.list().end(); ++i) { ConstReferenceCounting boundary = *i; if (boundary->type() == Boundary::list) { this->__splitBoundaryList(bcSet, pde, boundary); } else { bcSet.addBoundaryCondition(new BoundaryCondition(pde, boundary)); } } } bool BoundaryConditionListExpressionSet::hasPOVBoundary() const { for (BoundaryConditionExpressionList::const_iterator i = __boundaryConditionExpressionList.begin(); i != __boundaryConditionExpressionList.end(); ++i) { if ((*(*i)).hasPOVBoundary()) { return true; } } return false; } void BoundaryConditionListExpressionSet::execute() { __boundaryConditionSet = new BoundaryConditionSet(); BoundaryConditionSet& bcSet = (*__boundaryConditionSet); for (BoundaryConditionExpressionList::iterator i = __boundaryConditionExpressionList.begin(); i != __boundaryConditionExpressionList.end(); ++i) { (*i)->execute(); ConstReferenceCounting b = (*i)->boundaryCondition(); if (b->boundary()->type() == Boundary::list) { ConstReferenceCounting bc = b->boundary(); ConstReferenceCounting pde = b->condition(); this->__splitBoundaryList(bcSet, pde, bc); } else { bcSet.addBoundaryCondition((*i)->boundaryCondition()); } } } BoundaryConditionListExpressionSet:: BoundaryConditionListExpressionSet(const BoundaryConditionListExpressionSet& e) : BoundaryConditionListExpression(e), __boundaryConditionExpressionList(e.__boundaryConditionExpressionList) { ; } BoundaryConditionListExpressionSet::BoundaryConditionListExpressionSet() : BoundaryConditionListExpression(BoundaryConditionListExpression::set) { ; } BoundaryConditionListExpressionSet::~BoundaryConditionListExpressionSet() { ; } freefem3d-1.0pre10/language/FunctionExpressionConvection.hpp0000644000175000017500000000524410566646050021211 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionConvection.hpp,v 1.3 2007/02/20 19:29:44 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_CONVECTION_HPP #define FUNCTION_EXPRESSION_CONVECTION_HPP #include #include #include #include /** * @file FunctionExpressionConvection.hpp * @author Stephane Del Pino * @date Tue Jul 4 01:30:50 2006 * * @brief Function expression associated to a convection operator * * */ class FunctionExpressionConvection : public FunctionExpression { private: bool __isToEvaluate; /**< true while function has not been evaluated */ ReferenceCounting __field; /**< advection field */ ReferenceCounting __timeStep; /**< time step expression */ ReferenceCounting __convectedFunction; /**< convected function */ protected: std::ostream& put(std::ostream& os) const; public: /** * Returns @b true if one of the functions has a boundary * * @return true if one of the function expression has a boundary */ bool hasBoundaryExpression() const { return (__field->hasBoundaryExpression() or __convectedFunction->hasBoundaryExpression()); } /** * Executes the expression * */ void execute(); /** * Constructor * * @param field advection field * @param dt time step * @param phi convected function * */ FunctionExpressionConvection(ReferenceCounting field, ReferenceCounting dt, ReferenceCounting phi); /** * Copy constructor * * @param e given function expression * */ FunctionExpressionConvection(const FunctionExpressionConvection& e); /** * Destructor * */ ~FunctionExpressionConvection(); }; #endif // FUNCTION_EXPRESSION_CONVECTION_HPP freefem3d-1.0pre10/language/FieldExpression.cpp0000644000175000017500000000427510570430576016414 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FieldExpression.cpp,v 1.4 2007/02/26 01:01:50 delpinux Exp $ #include std::ostream& FieldExpression:: put(std::ostream& os) const { if (__fieldExpression.size()>1) { os << '['; } os << __fieldExpression[0]; for (size_t i=1; i<__fieldExpression.size(); ++i) { os << ',' << __fieldExpression[0]; } if (__fieldExpression.size()>1) { os << ']'; } return os; } ReferenceCounting FieldExpression:: field() { return __field; } ConstReferenceCounting FieldExpression:: field() const { return __field; } void FieldExpression:: execute() { __field = new FieldOfScalarFunction; for (size_t i=0; i<__fieldExpression.size(); ++i) { __fieldExpression[i]->execute(); __field->add(__fieldExpression[i]->function()); } } bool FieldExpression:: hasBoundaryExpression() const { for (size_t i=0; i<__fieldExpression.size(); ++i) { if (this->__fieldExpression[i]->hasBoundaryExpression()) { return true; } } return false; } size_t FieldExpression:: numberOfComponents() const { return __fieldExpression.size(); } void FieldExpression:: add(ReferenceCounting functionExpression) { __fieldExpression.push_back(functionExpression); } FieldExpression:: FieldExpression() : Expression(Expression::field) { ; } FieldExpression:: ~FieldExpression() { ; } freefem3d-1.0pre10/language/Instruction.hpp0000644000175000017500000004174710615647626015652 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: Instruction.hpp,v 1.18 2007/05/01 11:33:17 delpinux Exp $ #ifndef INSTRUCTION_HPP #define INSTRUCTION_HPP #include #include #include #include #include #include #include #include #include #include /** * @file Instruction.hpp * @author Stephane Del Pino * @date Sat Aug 28 00:58:55 2004 * * @brief Utility instructions * */ class Instruction { public: enum Type { list, ifStatement, doWhileStatement, whileStatement, forStatement, exitStatement, coarseMesh, declaration, affectation, increment, decrement, evaluation, blockBegin, blockEnd, output, Using, exec, cat, plot, save, none }; protected: const Instruction::Type __type; public: const Instruction::Type& type() const { return __type; } virtual void execute() = 0; Instruction(const Instruction::Type& t) : __type(t) { ; } Instruction(const Instruction& I) : __type(I.__type) { ; } virtual ~Instruction() { ; } }; class InstructionList : public Instruction { public: typedef std::list > InstructionSet; InstructionSet __instructions; public: void execute() { for(InstructionSet::iterator i = __instructions.begin(); i != __instructions.end(); ++i) { (*i)->execute(); } } void add(ReferenceCounting i) { __instructions.push_back(i); } InstructionList() : Instruction(Instruction::list) { ; } InstructionList(const InstructionList& I) : Instruction(I), __instructions(I.__instructions) { ; } ~InstructionList() { ; } }; class InstructionIfStatement : public Instruction { public: ReferenceCounting __booleanExpression; ReferenceCounting __firstStatement; ReferenceCounting __secondStatement; public: void execute() { (*__booleanExpression).execute(); if ((*__booleanExpression).boolValue()) { (*__firstStatement).execute(); } else { (*__secondStatement).execute(); } } InstructionIfStatement(ReferenceCounting b, ReferenceCounting first, ReferenceCounting second) : Instruction(Instruction::ifStatement), __booleanExpression(b), __firstStatement(first), __secondStatement(second) { ; } InstructionIfStatement(const InstructionIfStatement& I) : Instruction(I), __booleanExpression(I.__booleanExpression), __firstStatement(I.__firstStatement), __secondStatement(I.__secondStatement) { ; } ~InstructionIfStatement() { ; } }; class InstructionDoWhileStatement : public Instruction { public: ReferenceCounting __statement; ReferenceCounting __booleanExpression; public: void execute() { do { __statement->execute(); __booleanExpression->execute(); } while (__booleanExpression->boolValue()); } InstructionDoWhileStatement(ReferenceCounting statement, ReferenceCounting b) : Instruction(Instruction::doWhileStatement), __statement(statement), __booleanExpression(b) { ; } InstructionDoWhileStatement(const InstructionDoWhileStatement& I) : Instruction(I), __statement(I.__statement), __booleanExpression(I.__booleanExpression) { ; } ~InstructionDoWhileStatement() { ; } }; class InstructionForStatement : public Instruction { public: ReferenceCounting __instruction1; ReferenceCounting __booleanExpression; ReferenceCounting __instruction2; ReferenceCounting __statement; public: void execute() { for (__instruction1->execute(); __booleanExpression->execute(), __booleanExpression->boolValue(); __instruction2->execute()) { __statement->execute(); } } InstructionForStatement(ReferenceCounting a, ReferenceCounting b, ReferenceCounting c, ReferenceCounting statement) : Instruction(Instruction::forStatement), __instruction1(a), __booleanExpression(b), __instruction2(c), __statement(statement) { ; } InstructionForStatement(const InstructionForStatement& I) : Instruction(I), __instruction1(I.__instruction1), __booleanExpression(I.__booleanExpression), __instruction2(I.__instruction2), __statement(I.__statement) { ; } ~InstructionForStatement() { ; } }; class InstructionWhileStatement : public Instruction { public: ReferenceCounting __statement; ReferenceCounting __booleanExpression; public: void execute() { __booleanExpression->execute(); while (__booleanExpression->boolValue()) { __statement->execute(); __booleanExpression->execute(); } } InstructionWhileStatement(ReferenceCounting b, ReferenceCounting statement) : Instruction(Instruction::whileStatement), __statement(statement), __booleanExpression(b) { ; } InstructionWhileStatement(const InstructionWhileStatement& I) : Instruction(I), __statement(I.__statement), __booleanExpression(I.__booleanExpression) { ; } ~InstructionWhileStatement() { ; } }; class InstructionOutput : public Instruction { private: ReferenceCounting __ostream; ReferenceCounting __expression; public: void execute() { __ostream->execute(); __expression->execute(); *__ostream << *__expression; } InstructionOutput(ReferenceCounting o, ReferenceCounting e) : Instruction(Instruction::output), __ostream(o), __expression(e) { ; } InstructionOutput(const InstructionOutput& I) : Instruction(I), __ostream(I.__ostream), __expression(I.__expression) { ; } ~InstructionOutput() { ; } }; /** * @class InstructionSave * @author Stephane Del Pino * @date Sun Feb 9 17:24:28 2003 * * @brief Mother class for saving instruction * */ class InstructionSave : public Instruction { protected: ReferenceCounting __fileDescriptor; ReferenceCounting __fileName; ReferenceCounting __mesh; public: InstructionSave(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting mesh); InstructionSave(const InstructionSave& I); ~InstructionSave(); }; /** * @class InstructionExec * @author Stephane Del Pino * @date Mon Jan 26 17:40:26 2004 * * @brief Executes shell commands */ class InstructionExec : public Instruction { protected: ReferenceCounting __command; public: void execute(); InstructionExec(ReferenceCounting command); InstructionExec(const InstructionExec& I); ~InstructionExec(); }; /** * @class InstructionExec * @author Stephane Del Pino * @date Mon Jan 26 17:40:26 2004 * * @brief Executes shell commands */ class InstructionCat : public Instruction { protected: ReferenceCounting __filename; public: void execute(); InstructionCat(ReferenceCounting command); InstructionCat(const InstructionCat& I); ~InstructionCat(); }; /** * @class InstructionSaveMesh * @author Stephane Del Pino * @date Sun Feb 9 17:24:55 2003 * * @brief Saves meshes in files according to a given format * */ class InstructionSaveMesh : public InstructionSave { public: void execute(); InstructionSaveMesh(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting mesh); InstructionSaveMesh(const InstructionSaveMesh& I); ~InstructionSaveMesh(); }; /** * @class InstructionSaveField * @author Stephane Del Pino * @date Sun Feb 9 17:25:44 2003 * * @brief Saves fields of function according to a given format. */ class InstructionSaveFieldList : public InstructionSave { private: ReferenceCounting __fieldList; public: void execute(); InstructionSaveFieldList(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting fieldList, ReferenceCounting mesh); InstructionSaveFieldList(const InstructionSaveFieldList& I); ~InstructionSaveFieldList(); }; /** * @class InstructionPlot * * This class is designed to plot data using graphic libraries * * @author Stephane Del Pino */ class InstructionPlot : public Instruction { private: ReferenceCounting __mesh; ReferenceCounting __f; public: /** * Expression::execute() specialization * */ void execute(); /** * * Constructor * */ InstructionPlot(ReferenceCounting mesh, ReferenceCounting f = 0); /** * Copy Constructor * */ InstructionPlot(const InstructionPlot& __instruction); /** * Destructor * */ ~InstructionPlot(); }; /*! \class InstructionNone This class is used for istructions which does nothing \author Stephane Del Pino */ class InstructionNone : public Instruction { public: void execute() { ; } InstructionNone() : Instruction(Instruction::none) { ; } InstructionNone(const InstructionNone& I) : Instruction(I) { ; } ~InstructionNone() { ; } }; #include template class InstructionDeclaration : public Instruction { private: const std::string __name; ReferenceCounting __expression; public: void execute() { ReferenceCounting a = new VarType(__name, __expression); VariableRepository::instance().add(a); ReferenceCounting V = VariableRepository::instance().findVariable(__name); __expression->execute(); (*V) = __expression; } InstructionDeclaration(const std::string name, ReferenceCounting e) : Instruction(Instruction::declaration), __name(name), __expression(e) { ; } ~InstructionDeclaration() { ; } }; template class InstructionAffectation : public Instruction { private: std::string __variableName; ReferenceCounting __expression; public: void execute() { __expression->execute(); VarType* V = VariableRepository::instance().findVariable(__variableName); (*V) = __expression; } InstructionAffectation(const std::string& variableName, ReferenceCounting e) : Instruction(Instruction::affectation), __variableName(variableName), __expression(e) { ; } InstructionAffectation(const InstructionAffectation& I) : Instruction(I), __variableName(I.__variableName), __expression(I.__expression) { ; } ~InstructionAffectation() { ; } }; class InstructionRealExpressionIncrement : public Instruction { private: std::string __variableName; public: void execute() { RealVariable* realVariable = VariableRepository::instance().findVariable(__variableName);; const real_t r = realVariable->expression()->realValue(); (*realVariable) = new RealExpressionValue(r+1); } InstructionRealExpressionIncrement(const std::string& variableName) : Instruction(Instruction::increment), __variableName(variableName) { ; } InstructionRealExpressionIncrement(const InstructionRealExpressionIncrement& I) : Instruction(I), __variableName(I.__variableName) { ; } ~InstructionRealExpressionIncrement() { ; } }; class InstructionRealExpressionDecrement : public Instruction { private: std::string __variableName; public: void execute() { RealVariable* realVariable = VariableRepository::instance().findVariable(__variableName); const real_t r = realVariable->expression()->realValue(); (*realVariable) = new RealExpressionValue(r-1); } InstructionRealExpressionDecrement(const std::string& variableName) : Instruction(Instruction::decrement), __variableName(variableName) { ; } InstructionRealExpressionDecrement(const InstructionRealExpressionDecrement& I) : Instruction(I), __variableName(I.__variableName) { ; } ~InstructionRealExpressionDecrement() { ; } }; class FunctionExpression; class FunctionExpressionFEM; template<> class InstructionAffectation : public Instruction { private: std::string __variableName; ReferenceCounting __expression; public: void execute(); InstructionAffectation(const std::string& variableName, ReferenceCounting e) : Instruction(Instruction::affectation), __variableName(variableName), __expression(e) { ; } InstructionAffectation(const InstructionAffectation& I) : Instruction(I), __variableName(I.__variableName), __expression(I.__expression) { ; } ~InstructionAffectation() { ; } }; template class InstructionEvaluation : public Instruction { private: ReferenceCounting __expression; public: void execute() { __expression->execute(); } InstructionEvaluation(ReferenceCounting e) : Instruction(Instruction::evaluation), __expression(e) { ; } InstructionEvaluation(const InstructionEvaluation& I) : Instruction(I), __expression(I.__expression) { ; } ~InstructionEvaluation() { ; } }; class InstructionUsingScene : public Instruction { private: ReferenceCounting __sceneExpression; public: void execute(); InstructionUsingScene(ReferenceCounting e); InstructionUsingScene(const InstructionUsingScene& I); ~InstructionUsingScene(); }; class InstructionExit : public Instruction { private: ReferenceCounting __realExpression; public: void execute() { if (__realExpression != 0) { __realExpression->execute(); throw ErrorHandler(__FILE__,__LINE__, "exit called (argument ignored)", ErrorHandler::asked); } throw ErrorHandler(__FILE__,__LINE__, "exit called", ErrorHandler::asked); } InstructionExit() : Instruction(Instruction::exitStatement), __realExpression(0) { ; } InstructionExit(ReferenceCounting e) : Instruction(Instruction::exitStatement), __realExpression(e) { ; } InstructionExit(const InstructionExit& I) : Instruction(I), __realExpression(I.__realExpression) { ; } ~InstructionExit() { ; } }; class InstructionCoarseMesh : public Instruction { private: bool __coarseMesh; public: void execute(); InstructionCoarseMesh(const bool& fm) : Instruction(Instruction::coarseMesh), __coarseMesh(fm) { ; } InstructionCoarseMesh(const InstructionCoarseMesh& I) : Instruction(I), __coarseMesh(I.__coarseMesh) { ; } ~InstructionCoarseMesh() { ; } }; class InstructionBlockBegin : public Instruction { public: void execute(); InstructionBlockBegin() : Instruction(Instruction::blockBegin) { ; } InstructionBlockBegin(const InstructionBlockBegin& I) : Instruction(I) { ; } ~InstructionBlockBegin() { ; } }; class InstructionBlockEnd : public Instruction { public: void execute(); InstructionBlockEnd() : Instruction(Instruction::blockEnd) { ; } InstructionBlockEnd(const InstructionBlockEnd& I) : Instruction(I) { ; } ~InstructionBlockEnd() { ; } }; #endif // INSTRUCTION_HPP freefem3d-1.0pre10/language/Expression.hpp0000644000175000017500000000560110570431157015443 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: Expression.hpp,v 1.5 2007/02/26 01:05:51 delpinux Exp $ #ifndef EXPRESSION_HPP #define EXPRESSION_HPP #include #include #include /** * @file Expression.hpp * @author Stephane Del Pino * @date Sun Feb 9 16:47:26 2003 * * @brief This is the base class for all expressions * * */ class Expression { public: enum Type { boolean, boundary, boundaryCondition, boundaryConditionList, domain, field, fieldlist, function, integrated, integratedOperator, insideExpression, insideListExpression, linearExp, mesh, multiLinearExp, multiLinearExpSum, multiLinearForm, multiLinearFormSum, ofstreamexpression, option, ostreamexpression, ostreamExpressionList, pdeEquation, pdeOperator, pdeOperatorSum, pdeProblem, problem, real, scene, solver, solverOptions, string, subOption, subOptionList, testFunctionList, unknown, unknownList, variationalFormula, variationalBilinearOperator, variationalLinearOperator, variationalDirichlet, vector3 }; private: //! The type of the expression. Expression::Type __type; protected: /*! Traits conversion of types. \todo IMPLEMENT IT. */ static Expression::Type getType(ReferenceCounting e1, ReferenceCounting e2) { return Expression::real; } //! Writes *this to the output os. virtual std::ostream& put(std::ostream& os) const = 0; public: //! return the type. const Expression::Type& type() const { return __type; } /*! Executes the expression. */ virtual void execute() = 0; //! this function allows to output expressions. friend std::ostream& operator<< (std::ostream& os, const Expression& e) { return e.put(os); } Expression(const Expression::Type& t) : __type(t) { ; } Expression(const Expression& e) : __type(e.__type) { ; } virtual ~Expression() { ; } }; #endif // EXPRESSION_HPP freefem3d-1.0pre10/language/FunctionExpressionIntegrate.cpp0000644000175000017500000000640010561425532021005 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionIntegrate.cpp,v 1.2 2006/07/23 22:17:07 delpinux Exp $ #include #include void FunctionExpressionIntegrate:: execute() { __lowerBound->execute(); __upperBound->execute(); __integratedFunction->execute(); switch (__direction) { case FunctionExpressionIntegrate::x: { __scalarFunction = new ScalarFunctionIntegrate(__lowerBound->function(), __upperBound->function(), __integratedFunction->function(), ScalarFunctionIntegrate::x); break; } case FunctionExpressionIntegrate::y: { __scalarFunction = new ScalarFunctionIntegrate(__lowerBound->function(), __upperBound->function(), __integratedFunction->function(), ScalarFunctionIntegrate::y); break; } case FunctionExpressionIntegrate::z: { __scalarFunction = new ScalarFunctionIntegrate(__lowerBound->function(), __upperBound->function(), __integratedFunction->function(), ScalarFunctionIntegrate::z); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "Unknown integration direction", ErrorHandler::unexpected); } } } FunctionExpressionIntegrate:: FunctionExpressionIntegrate(ReferenceCounting lowerBound, ReferenceCounting upperBound, ReferenceCounting integratedFunction, const std::string& directionName) : FunctionExpression(FunctionExpression::integrate), __lowerBound(lowerBound), __upperBound(upperBound), __integratedFunction(integratedFunction) { if (directionName.size() == 2) { if (directionName[0] == 'd') { switch (directionName[1]) { case 'x': { __direction = FunctionExpressionIntegrate::x; return; } case 'y': { __direction = FunctionExpressionIntegrate::y; return; } case 'z': { __direction = FunctionExpressionIntegrate::z; return; } } } } throw ErrorHandler(__FILE__,__LINE__, "unknown direction name: "+directionName, ErrorHandler::unexpected); } FunctionExpressionIntegrate:: FunctionExpressionIntegrate(const FunctionExpressionIntegrate& f) : FunctionExpression(f), __lowerBound(f.__lowerBound), __upperBound(f.__upperBound), __integratedFunction(f.__integratedFunction), __direction(f.__direction) { ; } FunctionExpressionIntegrate:: ~FunctionExpressionIntegrate() { ; } freefem3d-1.0pre10/language/RealExpression.cpp0000644000175000017500000003047210637212130016236 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: RealExpression.cpp,v 1.25 2007/06/23 12:38:48 delpinux Exp $ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ReferenceCounting RealExpressionVariable:: value() { return __expression->value(); } void RealExpressionVariable::execute() { RealVariable* realVariable = VariableRepository::instance().findVariable(__variableName); __expression = realVariable->expression(); __realValue = __expression->realValue(); } RealExpressionVariable:: RealExpressionVariable(const std::string& variableName) : __variableName(variableName), __expression(0) { ; } RealExpressionVariable::RealExpressionVariable(const RealExpressionVariable& e) : __realVariable(e.__realVariable), __expression(e.__expression) { ; } RealExpressionVariable::~RealExpressionVariable() { ; } /* Function Evaluate */ ReferenceCounting RealExpressionFunctionEvaluate:: value() { return new RealExpressionValue(__realValue); } void RealExpressionFunctionEvaluate::execute() { (*__realFunction).execute(); if ((*__realFunction).hasBoundaryExpression()) { throw ErrorHandler(__FILE__,__LINE__, "Cannot evaluate \"" +stringify(*__realFunction)+ "\": missing boundary", ErrorHandler::normal); } TinyVector<3,real_t> X; if (__v == 0) { (*__x).execute(); (*__y).execute(); (*__z).execute(); X[0] = (*__x).realValue(); X[1] = (*__y).realValue(); X[2] = (*__z).realValue(); } else { (*__v).execute(); for (size_t i=0; i<3; ++i) { X[i] = (*__v).value(i); } } const ScalarFunctionBase& f = *__realFunction->function(); __realValue = f(X); } RealExpressionFunctionEvaluate:: RealExpressionFunctionEvaluate (ReferenceCounting f, ReferenceCounting x, ReferenceCounting y, ReferenceCounting z) : __realFunction(f), __v(0), __x(x), __y(y), __z(z) { ; } RealExpressionFunctionEvaluate:: RealExpressionFunctionEvaluate(ReferenceCounting f, ReferenceCounting v) : __realFunction(f), __v(v), __x(0), __y(0), __z(0) { ; } RealExpressionFunctionEvaluate:: RealExpressionFunctionEvaluate(const RealExpressionFunctionEvaluate& e) : __realFunction(e.__realFunction), __v(e.__v), __x(e.__x), __y(e.__y), __z(e.__z) { ; } RealExpressionFunctionEvaluate::~RealExpressionFunctionEvaluate() { ; } /* Integrate */ ReferenceCounting RealExpressionIntegrate:: value() { return new RealExpressionValue(__realValue); } template real_t RealExpressionIntegrate::__integrate(const MeshType& M, const QuadratureType& Q, FunctionExpression& fe) { const ScalarFunctionBase& f = *fe.function(); real_t integral=0; typedef typename MeshType::CellType CellType; for (typename MeshType::const_iterator iCell(M); not(iCell.end()); ++iCell) { const CellType& C = *iCell; typename FiniteElementTraits::Transformation T(C); typename FiniteElementTraits::JacobianTransformation J(T); TinyVector<3, real_t> X; for (size_t i=0; i real_t RealExpressionIntegrate::__integrate(const MeshType& M, FunctionExpression& f) { switch(this->__discretizationType) { case DiscretizationType::lagrangianFEM0: { typedef typename FiniteElementTraits::Type FiniteElementType; typedef typename FiniteElementType::QuadratureType QuadratureType; const QuadratureType& Q = QuadratureType::instance(); return __integrate(M,Q,f); } case DiscretizationType::lagrangianFEM1: { typedef typename FiniteElementTraits::Type FiniteElementType; typedef typename FiniteElementType::QuadratureType QuadratureType; const QuadratureType& Q = QuadratureType::instance(); return __integrate(M,Q,f); } case DiscretizationType::lagrangianFEM2: { typedef typename FiniteElementTraits::Type FiniteElementType; typedef typename FiniteElementType::QuadratureType QuadratureType; const QuadratureType& Q = QuadratureType::instance(); return __integrate(M,Q,f); } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected quadrature type", ErrorHandler::unexpected); return 0; } } } //! \todo compute the integral on the domain. void RealExpressionIntegrate::execute() { __mesh->execute(); Information::instance().setMesh(__mesh->mesh()); const Mesh& M = *__mesh->mesh(); __realFunction->execute(); FunctionExpression& f = (*__realFunction); if (M.family() ==Mesh::volume) { if (f.hasBoundaryExpression()) { throw ErrorHandler(__FILE__,__LINE__, "Cannot evaluate \"" +stringify(f)+ "\": missing boundary", ErrorHandler::normal); } } real_t& integral = __realValue; integral = 0; switch (M.type()) { case Mesh::cartesianHexahedraMesh: { const Structured3DMesh& m = static_cast(M); integral = __integrate(m, f); break; } case Mesh::hexahedraMesh: { const MeshOfHexahedra& m = static_cast(M); integral = __integrate(m, f); break; } case Mesh::tetrahedraMesh: { const MeshOfTetrahedra& m = static_cast(M); integral = __integrate(m, f); break; } case Mesh::surfaceMeshTriangles: { const SurfaceMeshOfTriangles& m = static_cast(M); integral = __integrate(m, f); break; } case Mesh::surfaceMeshQuadrangles: { const SurfaceMeshOfQuadrangles& m = static_cast(M); integral = __integrate(m, f); break; } case Mesh::spectralMesh: { const SpectralMesh& m = static_cast(M); const ScalarFunctionBase& integratedFunction = *f.function(); TinyVector<3, real_t> X; Interval intervalX(m.shape().a()[0],m.shape().b()[0]); Interval intervalY(m.shape().a()[1],m.shape().b()[1]); Interval intervalZ(m.shape().a()[2],m.shape().b()[2]); SpectralConformTransformation transformX(intervalX); SpectralConformTransformation transformY(intervalY); SpectralConformTransformation transformZ(intervalZ); GaussLobatto gaussLobattoX(m.degree(0)+1); GaussLobatto gaussLobattoY(m.degree(1)+1); GaussLobatto gaussLobattoZ(m.degree(2)+1); Vector nodesX(gaussLobattoX.numberOfPoints()); for (size_t i=0; i nodesY(gaussLobattoY.numberOfPoints()); for (size_t i=0; i nodesZ(gaussLobattoZ.numberOfPoints()); for (size_t i=0; i f, ReferenceCounting m, const DiscretizationType::Type& discretizationType) : __realFunction(f), __mesh(m), __discretizationType(discretizationType) { ; } RealExpressionIntegrate::RealExpressionIntegrate(const RealExpressionIntegrate& e) : __realFunction(e.__realFunction), __mesh(e.__mesh), __discretizationType(e.__discretizationType) { } RealExpressionIntegrate::~RealExpressionIntegrate() { ; } /* Max */ ReferenceCounting RealExpressionMinMax:: value() { return new RealExpressionValue(__realValue); } void RealExpressionMinMax::execute() { __mesh->execute(); __realFunction->execute(); Information::instance().setMesh(__mesh->mesh()); if (__operatorName == "max") { ScalarFunctionMaxComputer computer(__mesh->mesh(), __realFunction->function()); __realValue = computer.getValue(); } else if (__operatorName == "min") { ScalarFunctionMinComputer computer(__mesh->mesh(), __realFunction->function()); __realValue = computer.getValue(); } else { throw ErrorHandler(__FILE__,__LINE__, "unknown operator: "+__operatorName, ErrorHandler::unexpected); } Information::instance().unsetMesh(); } RealExpressionMinMax::RealExpressionMinMax(const std::string& operatorName, ReferenceCounting f, ReferenceCounting m) : __operatorName(operatorName), __realFunction(f), __mesh(m) { ; } RealExpressionMinMax::RealExpressionMinMax(const RealExpressionMinMax& e) : __operatorName(e.__operatorName), __realFunction(e.__realFunction), __mesh(e.__mesh) { } RealExpressionMinMax::~RealExpressionMinMax() { ; } /* Boolean */ ReferenceCounting RealExpressionBoolean:: value() { if((*__booleanExpression).boolValue()) { return new RealExpressionValue(1.); } else { return new RealExpressionValue(0.); } } void RealExpressionBoolean::execute() { (*__booleanExpression).execute(); } RealExpressionBoolean:: RealExpressionBoolean(ReferenceCounting be) : __booleanExpression(be) { ; } RealExpressionBoolean::RealExpressionBoolean(const RealExpressionBoolean& re) : RealExpression(re), __booleanExpression(re.__booleanExpression) { ; } RealExpressionBoolean::~RealExpressionBoolean() { ; } freefem3d-1.0pre10/language/FunctionExpressionCFunction.hpp0000644000175000017500000000454410561425532020767 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionCFunction.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_C_FUNCTION_HPP #define FUNCTION_EXPRESSION_C_FUNCTION_HPP #include #include /** * @file FunctionExpressionCFunction.hpp * @author Stephane Del Pino * @date Tue Jul 4 01:20:23 2006 * * @brief Function expression of standard cmath functions * * */ class FunctionExpressionCFunction : public FunctionExpression { private: const std::string __cfunction; /**< the name of the cmath function */ ReferenceCounting __functionExpression; /**< the argument function */ public: /** * Overload of the execution of the expression * */ void execute(); /** * Constructor * * @param cfunction the cmath function name * @param functionExpression the argument of the C function * */ FunctionExpressionCFunction(const std::string& cfunction, ReferenceCounting functionExpression) : FunctionExpression(FunctionExpression::cfunction), __cfunction(cfunction), __functionExpression(functionExpression) { ; } /** * Copy constructor * * @param f the original C function * */ FunctionExpressionCFunction(const FunctionExpressionCFunction& f) :FunctionExpression(f), __cfunction(f.__cfunction), __functionExpression(f.__functionExpression) { ; } /** * Destructor * */ ~FunctionExpressionCFunction() { ; } }; #endif // FUNCTION_EXPRESSION_C_FUNCTION_HPP freefem3d-1.0pre10/language/SolverExpression.cpp0000644000175000017500000003122010626644651016634 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: SolverExpression.cpp,v 1.24 2007/05/28 18:24:22 yakoubix Exp $ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include std::ostream& SolverExpression:: put(std::ostream& os) const { os << __FILE__ << ':' << __LINE__ << ": NOT IMPLEMENTED\n"; return os; } SolverExpression:: SolverExpression(ReferenceCounting unknownList, ReferenceCounting mesh, ReferenceCounting solverOptions, ReferenceCounting problemExpression, ReferenceCounting domainExpression) : Expression(Expression::solver), __unknownList(unknownList), __mesh(mesh), __solverOptions(solverOptions), __problemExpression(problemExpression), __domain(domainExpression) { ; } SolverExpression:: ~SolverExpression() { ; } void SolverExpression:: __setScene(ReferenceCounting domainExp) const { switch(domainExp->domainType()) { case DomainExpression::set: { DomainExpressionSet& D = dynamic_cast(*domainExp); const SceneExpression& SE = dynamic_cast(*(D.scene())); Information::instance().setScene(SE.scene()); break; } case DomainExpression::analytic: { DomainExpressionAnalytic& D = dynamic_cast(*domainExp); Information::instance().setScene(D.domain()->scene()); break; } case DomainExpression::variable: { DomainExpressionVariable& D = dynamic_cast(*domainExp); __setScene(D.domainExpression()); break; } case DomainExpression::undefined: { throw ErrorHandler(__FILE__,__LINE__, "undefined domain", ErrorHandler::normal); } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected domain type", ErrorHandler::unexpected); } } } void SolverExpression:: execute() { //! The unknowns Information::instance().setUnknownList(__unknownList); //! Reset solver options. ParameterCenter::instance().reset(); __mesh->execute(); //! A mesh is used there. We inform others about that ... Information::instance().setMesh(__mesh->mesh()); __unknownList->execute(); if (__domain != 0) { __domain->execute(); __setScene(__domain); } __solverOptions->execute(); __problemExpression->execute(); if (__domain != 0) { switch (__problemExpression->problemType()) { case ProblemExpression::pdeSystem: { (*dynamic_cast(*__problemExpression).pdeSystem()).setDomain(__domain->domain()); break; } case ProblemExpression::variationalProblem: { (*dynamic_cast(*__problemExpression).variationalProblem()).setDomain(__domain->domain()); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected problem type", ErrorHandler::unexpected); } } } else { if (__problemExpression->hasPOVBoundary()) { throw ErrorHandler(__FILE__,__LINE__, "cannot use POVRay references in standard FEM discretization.\n" "You probably forgot to specify the domain in the 'solve' bloc.\n" "Refere to the Fictitious Domain part of the documentation", ErrorHandler::normal); } } for (UnknownListExpression::iterator i= __unknownList->begin(); i != __unknownList->end(); ++i) { UnknownExpression& unknown = **i; unknown.execute(); DiscretizationType discretization = DiscretizationType::getDefault(unknown.discretizationType()); if (discretization.type() == DiscretizationType::functionLike) { UnknownExpression& unknown = **__unknownList->begin(); unknown.execute(); ReferenceCounting unknownVariable = VariableRepository::instance().findVariable(unknown.name()); ConstReferenceCounting f = unknownVariable->expression()->function(); switch (f->type()) { case ScalarFunctionBase::femfunction: { discretization = dynamic_cast(*f).discretizationType(); break; } case ScalarFunctionBase::spectral: { discretization = dynamic_cast(*f).discretizationType(); break; } default: { discretization = DiscretizationType::lagrangianFEM1; } } unknown.setDiscretizationType(discretization.type()); } } DiscretizationType discretization = DiscretizationType::getDefault((*__unknownList->begin())->discretizationType()); switch (discretization.type()) { case DiscretizationType::lagrangianFEM0: case DiscretizationType::lagrangianFEM1: case DiscretizationType::lagrangianFEM2: { this->__solveFEM(discretization); break; } case DiscretizationType::spectralLegendre: { this->__solveLegendre(discretization); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "'"+DiscretizationType::name(discretization)+"' discretization not implemented", ErrorHandler::unexpected); } } //! The unknown are no more there. Information::instance().unsetUnknownList(); //! The mesh is no more used in this region. Information::instance().unsetMesh(); } void SolverExpression:: __solveFEM(const DiscretizationType& discretization) { ReferenceCounting dofBuilder; if (__domain != 0) { dofBuilder = new DegreeOfFreedomSetBuilder(__unknownList->size(), discretization, *__mesh->mesh(), *__domain->domain()); } else { dofBuilder = new DegreeOfFreedomSetBuilder(__unknownList->size(), discretization, *__mesh->mesh()); } const DegreeOfFreedomSet& degreeOfFreedomSet = dofBuilder->degreeOfFreedomSet(); FEMSolution u(degreeOfFreedomSet); typedef std::vector > UnknownList; UnknownList UL; ConstReferenceCounting mesh = __mesh->mesh(); for (UnknownListExpression::iterator i= __unknownList->begin(); i != __unknownList->end(); ++i) { UnknownExpression& unknown = **i; ReferenceCounting unknownVariable = VariableRepository::instance().findVariable(unknown.name()); ConstReferenceCounting f = unknownVariable->expression()->function(); FEMFunctionBuilder femFunctionBuilder; femFunctionBuilder.build(discretization, mesh, *f); UL.push_back(femFunctionBuilder.getBuiltFEMFunction()); } u.setUserFunction(UL); ConstReferenceCounting P; switch (__problemExpression->problemType()) { case ProblemExpression::pdeSystem: { P = (PDESystem*)(dynamic_cast(*__problemExpression).pdeSystem()); break; } case ProblemExpression::variationalProblem: { P = (VariationalProblem*)(dynamic_cast(*__problemExpression).variationalProblem()); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected problem type", ErrorHandler::unexpected); } } ffout(2) << "Solving Problem:\n" << '\n'; ffout(2) << "\tUnknowns: " << *__unknownList << '\n'; ffout(2) << "\tProblem: " << *__problemExpression << '\n'; if (__domain != 0) { SolverDriver sd(P, u, discretization,__mesh->mesh(), degreeOfFreedomSet, SolverDriver::fictitiousFEM); sd.run(); } else { SolverDriver sd(P, u, discretization,__mesh->mesh(), degreeOfFreedomSet, SolverDriver::fem); sd.run(); } u.getUserFunction(UL); UnknownListExpressionSet& UList = dynamic_cast(*__unknownList); size_t i=0; for(UnknownListExpressionSet::listType::iterator iunknown = UList.giveList().begin(); iunknown != UList.giveList().end(); ++iunknown) { UnknownExpression& unknown = **iunknown; ReferenceCounting unknownVariable = VariableRepository::instance().findVariable(unknown.name()); const FEMFunctionBase* value = UL[i]; (*unknownVariable) = new FunctionExpressionValue(value, false); ++i; } } void SolverExpression:: __solveLegendre(const DiscretizationType& discretization) { ReferenceCounting dofBuilder; if (__domain != 0) { dofBuilder = new DegreeOfFreedomSetBuilder(__unknownList->size(), discretization, *__mesh->mesh(), *__domain->domain()); } else { dofBuilder = new DegreeOfFreedomSetBuilder(__unknownList->size(), discretization, *__mesh->mesh()); } if (__mesh->mesh()->type() != Mesh::spectralMesh) { throw ErrorHandler(__FILE__,__LINE__, "cannot use spectral method on '"+__mesh->mesh()->typeName()+"'", ErrorHandler::normal); } ConstReferenceCounting mesh = dynamic_cast(static_cast(__mesh->mesh())); const DegreeOfFreedomSet& degreeOfFreedomSet = dofBuilder->degreeOfFreedomSet(); LegendreSolution u(degreeOfFreedomSet); typedef std::vector > UnknownList; UnknownList UL; for (UnknownListExpression::iterator i= __unknownList->begin(); i != __unknownList->end(); ++i) { UnknownExpression& unknown = **i; ReferenceCounting unknownVariable = VariableRepository::instance().findVariable(unknown.name()); ConstReferenceCounting f = unknownVariable->expression()->function(); UL.push_back(new SpectralFunction(mesh,*f)); } u.setUserFunction(UL); ConstReferenceCounting P; switch (__problemExpression->problemType()) { case ProblemExpression::pdeSystem: { P = (PDESystem*)(dynamic_cast(*__problemExpression).pdeSystem()); break; } case ProblemExpression::variationalProblem: { P = (VariationalProblem*)(dynamic_cast(*__problemExpression).variationalProblem()); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected problem type", ErrorHandler::unexpected); } } ffout(2) << "Solving Problem:\n" << '\n'; ffout(2) << "\tUnknowns: " << *__unknownList << '\n'; ffout(2) << "\tProblem: " << *__problemExpression << '\n'; if (__domain != 0) { SolverDriver sd(P, u, discretization,__mesh->mesh(), degreeOfFreedomSet, SolverDriver::fictitiousSpectral); sd.run(); } else { SolverDriver sd(P, u, discretization,__mesh->mesh(), degreeOfFreedomSet, SolverDriver::spectral); sd.run(); } u.getUserFunction(UL); UnknownListExpressionSet& UList = dynamic_cast(*__unknownList); size_t i=0; for(UnknownListExpressionSet::listType::iterator iunknown = UList.giveList().begin(); iunknown != UList.giveList().end(); ++iunknown) { UnknownExpression& unknown = **iunknown; ReferenceCounting unknownVariable = VariableRepository::instance().findVariable(unknown.name()); const SpectralFunction* value = UL[i]; (*unknownVariable) = new FunctionExpressionValue(value, false); ++i; } } freefem3d-1.0pre10/language/BoundaryExpression.cpp0000644000175000017500000000256310561425532017146 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryExpression.cpp,v 1.9 2006/08/27 21:33:53 delpinux Exp $ #include #include ReferenceCounting BoundaryExpression::boundary() { return __boundary; } BoundaryExpression::BoundaryExpression(const BoundaryExpression& e) : Expression(Expression::boundary), __boundaryType(e.__boundaryType) { ; } BoundaryExpression::BoundaryExpression(const BoundaryExpression::BoundaryType& t) : Expression(Expression::boundary), __boundaryType(t) { ; } BoundaryExpression::~BoundaryExpression() { ; } freefem3d-1.0pre10/language/FFLexer.cpp0000644000175000017500000003451510632501735014577 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FFLexer.cpp,v 1.47 2007/06/09 10:37:08 delpinux Exp $ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void FFLexer::define(Lexer::KeyWordList& kw) { kw["x"] = XYZ; kw["y"] = XYZ; kw["z"] = XYZ; kw["double"] = DOUBLE; kw["extract"] = EXTRACT; kw["femfunction"] = FEMFUNCTION; kw["function"] = FUNCTION; kw["mesh"] = MESH; kw["periodic"] = PERIODIC; kw["sfunction"] = SFUNCTION; kw["simplify"] = SIMPLIFY; kw["spectral"] = SPECTRALMESH; kw["structured"] = STRUCTMESH; kw["surface"] = SURFMESH; kw["tetrahedrize"] = TETRAHEDRIZE; kw["transform"] = TRANSFORM; // Those two keywords are equivalent! kw["vector"] = VECTOR; kw["vertex"] = VECTOR; kw["scene"] = SCENE; kw["domain"] = DOMAIN_; kw["ofstream"] = OFSTREAM; // statements kw["do"] = DO; kw["while"] = WHILE; kw["for"] = FOR; kw["if"] = IF; kw["else"] = ELSE; kw["true"] = TRUE; kw["false"] = FALSE; kw["not"] = NOT; kw["and"] = AND; kw["or"] = OR; kw["xor"] = XOR; kw["solve"] = SOLVE; kw["div"] = DIV; kw["grad"] = GRAD; kw["dnu"] = DNU; kw["int"] = INT; kw["min"] = MINMAX; kw["max"] = MINMAX; kw["convect"] = CONVECT; kw["pde"] = PDEQ; kw["dx"] = DXYZ; kw["dy"] = DXYZ; kw["dz"] = DXYZ; kw["nx"] = NORMALCOMPONENT; kw["ny"] = NORMALCOMPONENT; kw["nz"] = NORMALCOMPONENT; kw["in"] = IN; kw["on"] = ON; kw["by"] = BY; kw["using"] = USING; kw["P0"] = DISCRETIZATIONTYPE; kw["P1"] = DISCRETIZATIONTYPE; kw["P2"] = DISCRETIZATIONTYPE; kw["coarsemesh"] = COARSEMESH; kw["finemesh"] = FINEMESH; kw["exit"] = EXIT; kw["inside"] = INSIDE; kw["outside"] = OUTSIDE; kw["cout"] = COUT; kw["cerr"] = CERR; kw["read"] = READ; kw["save"] = SAVE; kw["plot"] = PLOT; kw["exec"] = EXEC; kw["cat"] = CAT; kw["pov"] = POV; kw["gmsh"] = FILEFORMAT; kw["medit"] = FILEFORMAT; kw["am_fmt"] = FILEFORMAT; kw["opendx"] = FILEFORMAT; kw["raw"] = FILEFORMAT; kw["vtk"] = FILEFORMAT; kw["abs"] = CFUNCTION; kw["sin"] = CFUNCTION; kw["cos"] = CFUNCTION; kw["tan"] = CFUNCTION; kw["asin"] = CFUNCTION; kw["acos"] = CFUNCTION; kw["atan"] = CFUNCTION; kw["sqrt"] = CFUNCTION; kw["exp"] = CFUNCTION; kw["log"] = CFUNCTION; kw["one"] = ONE; kw["reference"] = REFERENCE; kw["vertices"] = ITEMS; kw["elements"] = ITEMS; kw["xmin"] = FACE; kw["xmax"] = FACE; kw["ymin"] = FACE; kw["ymax"] = FACE; kw["zmin"] = FACE; kw["zmax"] = FACE; kw["dos"] = FILETYPE; kw["unix"] = FILETYPE; kw["mac"] = FILETYPE; kw["binary"] = FILETYPE; kw["test"] = TESTS; } //! Constructs a FFLexer for given std::istream and std::ostream. FFLexer::FFLexer(std::istream& In, std::ostream& Out) : Lexer(In,Out) { FFLexer::define(__keyWordList); //! Get the list of keywords ParameterCenter::instance().get(__optionsKeyWords); } void FFLexer::switchToContext(const FFLexer::Context context) { switch (context) { case (FFLexer::defaultContext): { __keyWordList["dx"] = DXYZ; __keyWordList["dy"] = DXYZ; __keyWordList["dz"] = DXYZ; break; } case (FFLexer::variationalContext): { __keyWordList["dx"] = DXYZOP; __keyWordList["dy"] = DXYZOP; __keyWordList["dz"] = DXYZOP; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "should not reach that context", ErrorHandler::unexpected); } } } /*! This function returns the token associated to the name "word" if it corresponds to a Keyword, else, it returns "-1". */ int FFLexer::isKeyword(const std::string& word) { KeyWordList::iterator theKeyWord = __keyWordList.find(word.c_str()); if(theKeyWord != __keyWordList.end()) { // if it was found switch (theKeyWord->second) { case FILETYPE: { fflval.fileType = FileDescriptor::fileType(word.c_str()); break; } case FILEFORMAT: { fflval.formatType = FileDescriptor::formatType(word.c_str()); break; } case CFUNCTION: case DXYZ: case DXYZOP: case FACE: case ITEMS: case MINMAX: case XYZ: { fflval.str = new char[strlen(word.c_str())+1]; strcpy (fflval.str, word.c_str()); break; } case NORMALCOMPONENT: { const char* c = word.c_str(); if (std::strcmp(c,"nx") == 0) { fflval.normalComponent = ScalarFunctionNormal::x; break; } if (std::strcmp(c,"ny") == 0) { fflval.normalComponent = ScalarFunctionNormal::y; break; } if (std::strcmp(c,"nz") == 0) { fflval.normalComponent = ScalarFunctionNormal::z; break; } // Should not reach this place throw ErrorHandler(__FILE__,__LINE__, "unexpected discretization type", ErrorHandler::unexpected); } case DISCRETIZATIONTYPE: { const char* c = word.c_str(); if (std::strcmp(c,"P0") == 0) { fflval.discretizationType = DiscretizationType::lagrangianFEM0; break; } if (std::strcmp(c,"P1") == 0) { fflval.discretizationType = DiscretizationType::lagrangianFEM1; break; } if (std::strcmp(c,"P2") == 0) { fflval.discretizationType = DiscretizationType::lagrangianFEM2; break; } if (std::strcmp(c,"Legendre") == 0) { fflval.discretizationType = DiscretizationType::spectralLegendre; break; } // Should not reach this place throw ErrorHandler(__FILE__,__LINE__, "unexpected discretization type", ErrorHandler::unexpected); } default:{ ; } } return theKeyWord->second; } return -1; // Means this is not a keyword! } /*! This function returns the token associated to the name "word" if it corresponds to an Option, else, it returns "-1". */ int FFLexer::isOption(const std::string& word) { IdentifierSet::iterator theKeyWord = __optionsKeyWords.find(word.c_str()); if(theKeyWord != __optionsKeyWords.end()) { // if it was found return OPTION; } return -1; // Means this is not a keyword! } /*! This function returns the token associated to the name "word" if it corresponds to a variable, else, it returns "-1". */ int FFLexer::isVariable(const std::string& word) { const int token = VariableLexerRepository::instance().find(word); if (token != -1) { // if (fflval.str != 0) { // delete fflval.str; // } fflval.str = new char[strlen(word.c_str())+1]; strcpy(fflval.str,word.c_str()); } return token; } //! The lexer function. int FFLexer::yylex() { char readChar = ' '; in.unsetf(std::ios::skipws); while ((in)&&(isspace(readChar))) { in >> readChar; if (readChar=='\n') linenumber++; } char nextChar = in.peek(); // read next Char if (in) { // Is input a Number? if (isdigit(readChar) || ((readChar=='.') && isdigit(nextChar))) { in.unget(); if (in >> fflval.value) { std::stringstream is; is << fflval.value << std::ends; yytext = is.str(); return NUM; } else { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } if (isalpha(readChar) or (readChar == '_')) { std::string is; while (isalnum(readChar) or (readChar == '_')) { is += readChar; in >> readChar; } in.unget(); yytext = is; // is the word a Keyword? int TOKEN = isKeyword(yytext); if (TOKEN != -1) { return TOKEN; } // reaching this place means this is not a Keyword! // Is the TOKEN an option ? TOKEN = isOption(yytext); if(TOKEN != -1) { fflval.str = new char[strlen(yytext.c_str())+1]; strcpy (fflval.str, yytext.c_str()); return TOKEN; } // is the word a Variable? TOKEN = isVariable(yytext); if (TOKEN != -1) { return TOKEN; } else { fflval.aString = new std::string(yytext); return NAME; } // reaching this place means this is not a Variable! } // Comments treatment. switch(readChar) { case '/': { if (nextChar == '/') { // end of line comment while ((readChar != '\n') and (not(in.eof()))) in >> readChar; in.unget(); return yylex(); // use recursion } if (nextChar == '*') { // multi-line comment bool endOfComment = false; size_t commentLines = 0; // Counts lines within comment in >> readChar; while (!endOfComment) { if(in >> readChar) { switch (readChar) { case '*': { if (in.peek() == '/') { endOfComment = true; } break; } case '\n': { commentLines++; break; } } } else { throw ErrorHandler(__FILE__,linenumber, "opened comment never closed", ErrorHandler::compilation); } } in >> readChar; linenumber += commentLines; return yylex(); } } case '+': { if (nextChar == '+') { // increment operator in >> readChar; return INCR; } break; } case '{': { yytext = "{"; return OPENBLOCK; } case '}': { yytext = "}"; return CLOSEBLOCK; } case '-': { if (nextChar == '-') { // increment operator in >> readChar; yytext = "--"; return DECR; } break; } case '<':{ if (nextChar == '=') { // increment operator in >> readChar; yytext = "<="; return LEQ; } else if (nextChar == '<') { // increment operator in >> readChar; yytext = "<<"; return LRAFTER; } yytext = "<"; return LT; } case '>':{ if (nextChar == '=') { // increment operator in >> readChar; yytext = ">="; return GEQ; } else if (nextChar == '>') { // increment operator in >> readChar; yytext = ">>"; return RRAFTER; } yytext = ">"; return GT; } case '=': { if (nextChar == '=') { // increment operator in >> readChar; yytext = "=="; return EQ; } break; } case '!': { if (nextChar == '=') { // increment operator in >> readChar; yytext = "!="; return NE; } return NOT; } case '|': { if (nextChar == '|') { // increment operator yytext = "||"; in >> readChar; return OR; } break; } case '&': { if (nextChar == '&') { // increment operator in >> readChar; yytext = "&&"; return AND; } break; } case ')': { if (declarationToken == SOLVE) // Declaration has been achieved. declarationToken = -1; // Must remove Type storage! return ')'; } case '"': { bool endOfString = false; size_t stringLines = 0; // Counts lines within the string std::stringstream is; while (!endOfString) { if(in >> readChar) { switch (readChar) { case '"': { endOfString = true; break; } case '\n': { stringLines++; is << '\n'; break; } case '\\': { int peekC = in.peek(); switch (peekC) { case 'n': { is << '\n'; in >> readChar; break; } case 't': { is << '\t'; in >> readChar; break; } case 'v': { is << '\v'; in >> readChar; break; } case 'b': { is << '\b'; in >> readChar; break; } case 'r': { is << '\r'; in >> readChar; break; } case 'f': { is << '\f'; in >> readChar; break; } case 'a': { is << '\a'; in >> readChar; break; } case '\'': { is << '\''; in >> readChar; break; } case '"': { is << '"'; in >> readChar; break; } case '\\': { is << '\\'; in >> readChar; break; } default: { throw ErrorHandler(__FILE__,linenumber, "unknown escape sequence", ErrorHandler::compilation); } } break; } default: { is << readChar; } } } else { throw ErrorHandler(__FILE__,linenumber, "opened string never closed", ErrorHandler::compilation); } } is << std::ends; fflval.str = new char[is.str().size()+1]; strcpy (fflval.str, is.str().c_str()); linenumber += stringLines; // yytext = fflval.str; return STRING; } } // Others characters treatment yytext = readChar; return readChar; } else { return EOF; } return 0; } freefem3d-1.0pre10/language/FunctionExpressionObjectCharacteristic.hpp0000644000175000017500000000413010561425532023145 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionObjectCharacteristic.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_OBJECT_CHARACTERISTIC_HPP #define FUNCTION_EXPRESSION_OBJECT_CHARACTERISTIC_HPP #include class Vector3Expression; class Scene; /** * @file FunctionExpressionObjectCharacteristic.hpp * @author Stephane Del Pino * @date Wed Jul 19 00:49:31 2006 * * @brief Manipulates the expression of the characteristic function of * a given object * */ class FunctionExpressionObjectCharacteristic : public FunctionExpression { private: ReferenceCounting __reference; /**< The reference of the object */ ReferenceCounting __scene; /**< The scene that contain the object */ public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param ref the reference of the object * */ FunctionExpressionObjectCharacteristic(ReferenceCounting ref); /** * Copy constructor * * @param f given function expression */ FunctionExpressionObjectCharacteristic(const FunctionExpressionObjectCharacteristic& f); /** * Destructor * */ ~FunctionExpressionObjectCharacteristic(); }; #endif // FUNCTION_EXPRESSION_OBJECT_CHARACTERISTIC_HPP freefem3d-1.0pre10/language/SolverExpression.hpp0000644000175000017500000000446010624156366016646 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: SolverExpression.hpp,v 1.9 2007/05/20 23:40:04 delpinux Exp $ #ifndef SOLVER_EXPRESSION_HPP #define SOLVER_EXPRESSION_HPP #include #include #include #include #include #include #include class DiscretizationType; /*! \class SolverExpression This class defines the base class of Solver expressions. \author Stephane Del Pino */ class SolverExpression : public Expression { protected: ReferenceCounting __unknownList; ReferenceCounting __mesh; ReferenceCounting __solverOptions; ReferenceCounting __problemExpression; ReferenceCounting __domain; private: void __setScene(ReferenceCounting d) const; std::ostream& put(std::ostream& os) const; SolverExpression(const SolverExpression&); void __solveFEM(const DiscretizationType& discretization); void __solveLegendre(const DiscretizationType& discretization); public: void execute(); SolverExpression(ReferenceCounting unknownList, ReferenceCounting mesh, ReferenceCounting solverOptions, ReferenceCounting problemExpression, ReferenceCounting domainExpression = 0); ~SolverExpression(); }; #endif // SOLVER_EXPRESSION_HPP freefem3d-1.0pre10/language/parse.xml.cc0000644000175000017500000013430010633014326015005 00000000000000/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse xmlparse #define yylex xmllex #define yyerror xmlerror #define yylval xmllval #define yychar xmlchar #define yydebug xmldebug #define yynerrs xmlnerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NAME = 258, STRING = 259, POSITION = 260, SPACE = 261, LT = 262, GT = 263 }; #endif /* Tokens. */ #define NAME 258 #define STRING 259 #define POSITION 260 #define SPACE 261 #define LT 262 #define GT 263 /* Copy the first part of user declarations. */ #line 1 "/home/delpino/src/ff3d/language/parse.xml.yy" /* -*- c++ -*- */ /* * This file is part of ff3d - http://www.freefem.org/ff3d * Copyright (C) 2001, 2002, 2003 Stéphane Del Pino * * 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, 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. * * $Id: parse.xml.yy,v 1.2 2007/06/10 14:59:08 delpinux Exp $ * */ #define YYDEBUG 1 #include #include #include #include #include #include #include #include typedef std::list XMLAttributeList; #include extern XMLLexer* xmllexer; void yyerror (char* s); #define xmllex xmllexer->xmllex /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE #line 50 "/home/delpino/src/ff3d/language/parse.xml.yy" { std::string* str; XMLAttribute* xmlattribute; XMLAttributeList* xmlattributelist; XMLTag* xmltag; std::istream::pos_type* position; } /* Line 187 of yacc.c. */ #line 177 "parse.xml.cc" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #line 190 "parse.xml.cc" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 39 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 12 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 12 /* YYNRULES -- Number of rules. */ #define YYNRULES 19 /* YYNRULES -- Number of states. */ #define YYNSTATES 45 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 263 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 11, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 2, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 6, 17, 19, 21, 24, 27, 30, 33, 39, 44, 50, 53, 57, 63, 64, 66, 68 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 13, 0, -1, 14, 15, -1, 7, 9, 3, 23, 3, 10, 4, 22, 9, 8, -1, 16, -1, 17, -1, 16, 17, -1, 22, 18, -1, 22, 19, -1, 22, 5, -1, 7, 3, 20, 22, 8, -1, 7, 3, 22, 8, -1, 7, 11, 3, 22, 8, -1, 23, 21, -1, 20, 23, 21, -1, 3, 22, 10, 22, 4, -1, -1, 23, -1, 6, -1, 23, 6, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 76, 76, 83, 90, 96, 99, 105, 108, 111, 123, 132, 140, 147, 152, 160, 166, 167, 174, 178 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "NAME", "STRING", "POSITION", "SPACE", "LT", "GT", "'?'", "'='", "'/'", "$accept", "input", "head", "data", "taglist", "tag", "opentag", "closetag", "attributelist", "attribute", "spacelistornot", "spacelist", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 63, 61, 47 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 12, 13, 14, 15, 16, 16, 17, 17, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 23 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 2, 10, 1, 1, 2, 2, 2, 2, 5, 4, 5, 2, 3, 5, 0, 1, 1, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 0, 0, 16, 0, 1, 18, 2, 16, 5, 0, 17, 0, 6, 9, 0, 7, 8, 19, 0, 16, 0, 0, 16, 0, 17, 16, 0, 0, 17, 11, 16, 13, 0, 16, 10, 14, 0, 12, 0, 16, 0, 0, 3, 15 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 2, 3, 7, 8, 9, 16, 17, 23, 32, 10, 11 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -21 static const yytype_int8 yypact[] = { -3, 8, 16, 17, 19, -21, -21, -21, 7, -21, 14, 18, 17, -21, -21, -1, -21, -21, -21, 2, 17, 22, 20, 17, 21, 12, 17, 23, 24, 12, -21, 17, -21, 25, 17, -21, -21, 26, -21, 28, 17, 27, 30, -21, -21 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -21, -21, -21, -21, -21, 31, -21, -21, -21, 9, -20, -11 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -5 static const yytype_int8 yytable[] = { 24, 19, 20, 28, 1, 22, 33, -4, 18, 25, 21, 37, 29, 6, 39, 31, 5, 4, 18, 14, 42, 15, 12, 6, 18, 26, 0, 34, 0, 30, 27, 0, 35, 38, 44, 43, 40, 41, 36, 13 }; static const yytype_int8 yycheck[] = { 20, 12, 3, 23, 7, 3, 26, 0, 6, 20, 11, 31, 23, 6, 34, 3, 0, 9, 6, 5, 40, 7, 3, 6, 6, 3, -1, 4, -1, 8, 10, -1, 8, 8, 4, 8, 10, 9, 29, 8 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 7, 13, 14, 9, 0, 6, 15, 16, 17, 22, 23, 3, 17, 5, 7, 18, 19, 6, 23, 3, 11, 3, 20, 22, 23, 3, 10, 22, 23, 8, 3, 21, 22, 4, 8, 21, 22, 8, 22, 10, 9, 22, 8, 4 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: #line 77 "/home/delpino/src/ff3d/language/parse.xml.yy" { ; } break; case 3: #line 84 "/home/delpino/src/ff3d/language/parse.xml.yy" { XMLFileReader::instance().xmlTree()->setHead(*(yyvsp[(3) - (10)].str),*(yyvsp[(5) - (10)].str),*(yyvsp[(7) - (10)].str)); } break; case 4: #line 91 "/home/delpino/src/ff3d/language/parse.xml.yy" { } break; case 5: #line 97 "/home/delpino/src/ff3d/language/parse.xml.yy" { } break; case 6: #line 100 "/home/delpino/src/ff3d/language/parse.xml.yy" { } break; case 7: #line 106 "/home/delpino/src/ff3d/language/parse.xml.yy" { } break; case 8: #line 109 "/home/delpino/src/ff3d/language/parse.xml.yy" { } break; case 9: #line 112 "/home/delpino/src/ff3d/language/parse.xml.yy" { if (not XMLFileReader::instance().xmlTree()->hasOpenTag()) { throw ErrorHandler(__FILE__,__LINE__, "no open tag", ErrorHandler::compilation); } XMLFileReader::instance().xmlTree()->getCurrentTag()->add(new XMLContentPosition(*(yyvsp[(2) - (2)].position))); } break; case 10: #line 124 "/home/delpino/src/ff3d/language/parse.xml.yy" { (yyval.xmltag) = new XMLTag(*(yyvsp[(2) - (5)].str)); for (XMLAttributeList::const_iterator i = (yyvsp[(3) - (5)].xmlattributelist)->begin(); i != (yyvsp[(3) - (5)].xmlattributelist)->end(); ++i) { (yyval.xmltag)->add(*i); } XMLFileReader::instance().xmlTree()->addTag((yyval.xmltag)); } break; case 11: #line 133 "/home/delpino/src/ff3d/language/parse.xml.yy" { (yyval.xmltag) = new XMLTag(*(yyvsp[(2) - (4)].str)); XMLFileReader::instance().xmlTree()->addTag((yyval.xmltag)); } break; case 12: #line 141 "/home/delpino/src/ff3d/language/parse.xml.yy" { XMLFileReader::instance().xmlTree()->closeTag(*(yyvsp[(3) - (5)].str)); } break; case 13: #line 148 "/home/delpino/src/ff3d/language/parse.xml.yy" { (yyval.xmlattributelist) = new std::list; (yyval.xmlattributelist)->push_back((yyvsp[(2) - (2)].xmlattribute)); } break; case 14: #line 153 "/home/delpino/src/ff3d/language/parse.xml.yy" { (yyval.xmlattributelist) = (yyvsp[(1) - (3)].xmlattributelist); (yyval.xmlattributelist)->push_back((yyvsp[(3) - (3)].xmlattribute)); } break; case 15: #line 161 "/home/delpino/src/ff3d/language/parse.xml.yy" { (yyval.xmlattribute) = new XMLAttribute(*(yyvsp[(1) - (5)].str),*(yyvsp[(5) - (5)].str)); } break; case 17: #line 168 "/home/delpino/src/ff3d/language/parse.xml.yy" { ; } break; case 18: #line 175 "/home/delpino/src/ff3d/language/parse.xml.yy" { ; } break; case 19: #line 179 "/home/delpino/src/ff3d/language/parse.xml.yy" { ; } break; /* Line 1267 of yacc.c. */ #line 1531 "parse.xml.cc" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } #line 184 "/home/delpino/src/ff3d/language/parse.xml.yy" void yyerror(char * s) { throw ErrorHandler("PARSED FILE",xmllexer->lineno(), stringify(s)+" after '"+xmllexer->YYText()+"'", ErrorHandler::compilation); } freefem3d-1.0pre10/language/BoundaryConditionExpression.cpp0000644000175000017500000000366410562730012021011 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryConditionExpression.cpp,v 1.8 2007/02/08 23:19:38 delpinux Exp $ #include #include #include #include #include #include #include ConstReferenceCounting BoundaryConditionExpression::boundaryCondition() const { return __boundaryCondition; } BoundaryConditionExpression:: BoundaryConditionExpression(const BoundaryConditionExpression& e) : Expression(e), __boundaryCondition(e.__boundaryCondition), __boundary(e.__boundary), __unknownName(e.__unknownName), __boundaryConditionType(e.__boundaryConditionType) { ; } BoundaryConditionExpression:: BoundaryConditionExpression(ReferenceCounting boundary, const std::string& unknownName, const BoundaryConditionExpression::BoundaryConditionType& t) : Expression(Expression::boundaryCondition), __boundary(boundary), __unknownName(unknownName), __boundaryConditionType(t) { ; } BoundaryConditionExpression::~BoundaryConditionExpression() { ; } freefem3d-1.0pre10/language/DomainExpressionSet.cpp0000644000175000017500000000402010561425532017234 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpressionSet.cpp,v 1.1 2006/09/28 19:05:34 delpinux Exp $ #include #include #include #include #include std::ostream& DomainExpressionSet::put(std::ostream& os) const { os << __FILE__ << ':' << __LINE__ << ": NOT IMPLEMENTED\n"; return os; } ReferenceCounting DomainExpressionSet::scene() { return __scene; } void DomainExpressionSet::execute() { ffout(2) << "Building Domain ...\n"; __scene->execute(); __domain = new Domain(__scene->scene()); if(__definition != 0) { __definition->execute(); ffout(2) << "\tDomain is: " << *__definition << '\n'; const Scene& S = *__scene->scene(); __domain->setObjects(__definition->objects(S)); } ffout(2) << "Done\n"; } DomainExpressionSet:: DomainExpressionSet(ReferenceCounting S, ReferenceCounting def) : DomainExpression(DomainExpression::set), __scene(S), __definition(def) { ; } DomainExpressionSet:: DomainExpressionSet(const DomainExpressionSet& m) : DomainExpression(m), __scene(m.__scene) { ; } DomainExpressionSet:: ~DomainExpressionSet() { ; } freefem3d-1.0pre10/language/FieldExpression.hpp0000644000175000017500000000521310570430576016412 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FieldExpression.hpp,v 1.6 2007/02/26 01:01:50 delpinux Exp $ #ifndef FIELD_EXPRESSION_HPP #define FIELD_EXPRESSION_HPP #include #include #include #include #include /** * @file FieldExpression.hpp * @author Stephane Del Pino * @date Sun Feb 9 16:41:04 2003 * * @brief Describes functions fields */ class FieldExpression : public Expression { private: std::vector > __fieldExpression; ReferenceCounting __field; /** * Writes the expression to a stream * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; /** * Copy constructor is forbiden * */ FieldExpression(const FieldExpression&); public: /** * Access to the field of functions * * @return the field */ ReferenceCounting field(); /** * Read-only access to the field of functions * * @return the field */ ConstReferenceCounting field() const; /** * Executes the field expression * */ void execute(); /** * Checks if one of the field's functions has a boundary * * @return true if at least one function has a boundary */ bool hasBoundaryExpression() const; /** * Access to the number of components * * @return the number of components of the field */ size_t numberOfComponents() const; /** * Adds a component to the field * * @param functionExpression next component function */ void add(ReferenceCounting functionExpression); /** * Constructor */ FieldExpression(); /** * Destructor * */ ~FieldExpression(); }; #endif // FIELD_EXPRESSION_HPP freefem3d-1.0pre10/language/Variable.hpp0000644000175000017500000001605410562730012015026 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: Variable.hpp,v 1.5 2007/02/08 23:19:38 delpinux Exp $ #ifndef VARIABLE_HPP #define VARIABLE_HPP #include #include /*! \class Variable This class is the interface for all variables in the language. \author Stephane Del Pino */ class Variable { public: enum Type { domain, function, mesh, ofstream, real, scene, testFuncion, unknown, unknownList, vector3 }; private: //! The type of the variable const Variable::Type __type; //! the name of the variable const std::string __name; public: const Variable::Type& type() const { return __type; } const std::string& name() const { return __name; } Variable(const std::string& name, const Variable::Type& type) : __type(type), __name(name) { ; } Variable(const Variable& v) : __type(v.__type), __name(v.__name) { ; } virtual ~Variable() { ; } }; /*! \class RealVariable This class allow manipulation of real_t variables. \author Stephane Del Pino */ class RealExpression; class RealVariable : public Variable { private: ReferenceCounting __expression; public: ReferenceCounting expression() const; ConstReferenceCounting operator=(ReferenceCounting e); RealVariable(const std::string& name, ReferenceCounting expression); RealVariable(const RealVariable& rv); ~RealVariable(); }; /*! \class StringVariable This class allow manipulation of string variables. \author Stephane Del Pino */ class StringExpression; class StringVariable : public Variable { private: ReferenceCounting __expression; public: ReferenceCounting expression() const; ConstReferenceCounting operator=(ReferenceCounting e); StringVariable(const std::string& name); StringVariable(const std::string& name, ReferenceCounting expression); StringVariable(const StringVariable& rv); ~StringVariable(); }; /*! \class Vector3Variable This class allow manipulation of Vector3 variables. \author Stephane Del Pino */ class Vector3Expression; class Vector3Variable : public Variable { private: ReferenceCounting __expression; public: ReferenceCounting expression() const; ConstReferenceCounting operator=(ReferenceCounting e); Vector3Variable(const std::string& name, ReferenceCounting expression); Vector3Variable(const Vector3Variable& rv); ~Vector3Variable(); }; /*! \class FunctionVariable This class allow manipulation of Function variables. \author Stephane Del Pino */ class FunctionExpression; class FunctionVariable : public Variable { private: ReferenceCounting __expression; // This is used to check if function variable is an Unknown bool __subscribed; public: void subscribe() { __subscribed = true; } void unsubscribe() { __subscribed = false; } const bool& isSubscribed() const { return __subscribed; } ReferenceCounting expression() const; ConstReferenceCounting operator=(ReferenceCounting e); FunctionVariable(const std::string& name, ReferenceCounting expression); FunctionVariable(const FunctionVariable& rv); ~FunctionVariable(); }; /*! \class TestFunctionVariable This class allow manipulation of Test Functions. \author Stephane Del Pino */ class TestFunctionVariable : public Variable { public: TestFunctionVariable(const std::string& name); TestFunctionVariable(const TestFunctionVariable& rv); ~TestFunctionVariable(); }; /*! \class MeshVariable This class allow manipulation of mesh variables. \author Stephane Del Pino */ class MeshExpression; class MeshVariable : public Variable { private: ReferenceCounting __expression; public: ReferenceCounting expression() const; ConstReferenceCounting operator=(ReferenceCounting e); MeshVariable(const std::string& name); MeshVariable(const std::string& name, ReferenceCounting expression); MeshVariable(const MeshVariable& rv); ~MeshVariable(); }; /*! \class SceneVariable This class allow manipulation of scene variables. \author Stephane Del Pino */ class SceneExpression; class SceneVariable : public Variable { private: ReferenceCounting __expression; public: ReferenceCounting expression() const; ConstReferenceCounting operator=(ReferenceCounting e); SceneVariable(const std::string& name); SceneVariable(const std::string& name, ReferenceCounting expression); SceneVariable(const SceneVariable& rv); ~SceneVariable(); }; /*! \class DomainVariable This class allow manipulation of domain variables. \author Stephane Del Pino */ class DomainExpression; class DomainVariable : public Variable { private: ReferenceCounting __expression; public: ReferenceCounting expression() const; ConstReferenceCounting operator=(ReferenceCounting e); DomainVariable(const std::string& name); DomainVariable(const std::string& name, ReferenceCounting expression); DomainVariable(const DomainVariable& rv); ~DomainVariable(); }; /*! \class OFStreamVariable This class allow manipulation of domain variables. \author Stephane Del Pino */ class OFStreamExpression; class OFStreamVariable : public Variable { private: ReferenceCounting __expression; public: ReferenceCounting expression() const; ConstReferenceCounting operator=(ReferenceCounting e); OFStreamVariable(const std::string& name); OFStreamVariable(const std::string& name, ReferenceCounting expression); OFStreamVariable(const OFStreamVariable& rv); ~OFStreamVariable(); }; #endif // VARIABLE_HPP freefem3d-1.0pre10/language/FunctionExpressionRead.cpp0000644000175000017500000001001010635616466017740 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionRead.cpp,v 1.4 2007/06/19 00:03:02 delpinux Exp $ #include #include #include #include #include #include #include #include #include #include void FunctionExpressionRead:: execute() { __mesh->execute(); __fileName->execute(); const std::string& filename = __fileName->value(); const FileDescriptor& fileDescriptor = *__fileDescriptor; ScalarFunctionReaderBuilder readerBuilder(filename, __mesh->mesh(), fileDescriptor); if (__functionName != 0) { __functionName->execute(); readerBuilder.setFunctionName(__functionName->value()); } if (__componentNumber != 0) { __componentNumber->execute(); readerBuilder.setComponent(size_t(__componentNumber->realValue())); } ReferenceCounting reader = readerBuilder.getReader(); __scalarFunction = reader->getFunction(); } FunctionExpressionRead:: FunctionExpressionRead(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting mesh) : FunctionExpression(FunctionExpression::read), __fileDescriptor(descriptor), __fileName(fileName), __functionName(0), __componentNumber(0), __mesh(mesh) { ; } FunctionExpressionRead:: FunctionExpressionRead(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting functionName, ReferenceCounting componentNumber, ReferenceCounting mesh) : FunctionExpression(FunctionExpression::read), __fileDescriptor(descriptor), __fileName(fileName), __functionName(functionName), __componentNumber(componentNumber), __mesh(mesh) { ; } FunctionExpressionRead:: FunctionExpressionRead(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting functionName, ReferenceCounting mesh) : FunctionExpression(FunctionExpression::read), __fileDescriptor(descriptor), __fileName(fileName), __functionName(functionName), __componentNumber(0), __mesh(mesh) { ; } FunctionExpressionRead:: FunctionExpressionRead(ReferenceCounting descriptor, ReferenceCounting fileName, ReferenceCounting componentNumber, ReferenceCounting mesh) : FunctionExpression(FunctionExpression::read), __fileDescriptor(descriptor), __fileName(fileName), __functionName(0), __componentNumber(componentNumber), __mesh(mesh) { ; } FunctionExpressionRead:: FunctionExpressionRead(const FunctionExpressionRead& f) : FunctionExpression(f), __fileDescriptor(f.__fileDescriptor), __fileName(f.__fileName), __functionName(f.__functionName), __componentNumber(f.__componentNumber), __mesh(f.__mesh) { ; } FunctionExpressionRead:: ~FunctionExpressionRead() { ; } freefem3d-1.0pre10/language/FunctionExpressionFEM.hpp0000644000175000017500000000464010561425532017503 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionFEM.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_FEM_HPP #define FUNCTION_EXPRESSION_FEM_HPP #include #include class MeshExpression; /** * @file FunctionExpressionFEM.hpp * @author Stephane Del Pino * @date Wed Jul 5 14:31:21 2006 * * @brief Manipulates finite element function expressions * */ class FunctionExpressionFEM : public FunctionExpression { private: const DiscretizationType::Type __discretizationType; /**< type of discretization */ ReferenceCounting __mesh; /**< mesh of discretization */ ReferenceCounting __functionExpression; /**< expression defining the function */ public: /** * Access to the mesh * * @bug This function should not exist * @return __mesh */ ReferenceCounting mesh() const { #warning SHOULD NOT USE THIS FUNCTION return __mesh; } /** * Executes the expression * */ void execute(); /** * Constructor * * @param mesh mesh of discretization * @param e expression of the function * @param femType discretization type * */ FunctionExpressionFEM(ReferenceCounting mesh, ReferenceCounting e, const DiscretizationType::Type& femType); /** * Copy constructor * * @param f given finite element function expression * */ FunctionExpressionFEM(const FunctionExpressionFEM& f); /** * Destructor * */ ~FunctionExpressionFEM(); }; #endif // FUNCTION_EXPRESSION_FEM_HPP freefem3d-1.0pre10/language/UnknownExpression.hpp0000644000175000017500000000412010624156366017024 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: UnknownExpression.hpp,v 1.5 2007/05/20 23:39:23 delpinux Exp $ #ifndef UNKNOWN_EXPRESSION_HPP #define UNKNOWN_EXPRESSION_HPP #include #include #include class UnknownExpression : public Expression { public: enum Type { declaration, existingFunction }; private: virtual void __preExecute() = 0; std::ostream& put(std::ostream& os) const { os << __name << ':' << DiscretizationType::name(__discretizationType); return os; } protected: const Type __type; const std::string __name; DiscretizationType::Type __discretizationType; public: void setDiscretizationType(const DiscretizationType::Type& type) { __discretizationType = type; } const std::string& name() const { return __name; } const DiscretizationType::Type& discretizationType() const { return __discretizationType; } void execute() { this->__preExecute(); } UnknownExpression(const Type& type, const std::string& name, const DiscretizationType::Type& discretization) : Expression(Expression::unknown), __type(type), __name(name), __discretizationType(discretization) { ; } virtual ~UnknownExpression() { ; } }; #endif // UNKNOWN_EXPRESSION_HPP freefem3d-1.0pre10/language/VariationalProblemExpression.cpp0000644000175000017500000003705310633010754021153 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariationalProblemExpression.cpp,v 1.17 2007/06/10 14:59:56 delpinux Exp $ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class VariationalProblemExpression::AlgebraicPlus { public: static ConstReferenceCounting convert(ConstReferenceCounting f) { return f->function(); } }; class VariationalProblemExpression::AlgebraicMinus { public: static ConstReferenceCounting convert(ReferenceCounting f) { ScalarFunctionBuilder functionBuilder; functionBuilder.setFunction(f->function()); functionBuilder.setUnaryMinus(); return functionBuilder.getBuiltFunction(); } }; void VariationalProblemExpression:: __splitBilinearBoundaryList(const size_t& unknownNumber, const size_t& testNumber, const ScalarFunctionBase* alpha, const Boundary* b) { const BoundaryList& boundaryList = dynamic_cast(*b); for (BoundaryList::List::const_iterator i = boundaryList.list().begin(); i != boundaryList.list().end(); ++i) { if ((**i).type() == Boundary::list) { this->__splitBilinearBoundaryList(unknownNumber, testNumber, alpha, *i); } else { __variationalProblem->add(new VariationalBorderOperatorAlphaUV(unknownNumber, testNumber, alpha, *i)); } } } void VariationalProblemExpression:: __splitLinearBoundaryList(const size_t& testNumber, const ScalarFunctionBase* f, const Boundary* b) { const BoundaryList& boundaryList = dynamic_cast(*b); for (BoundaryList::List::const_iterator i = boundaryList.list().begin(); i != boundaryList.list().end(); ++i) { if ((*i)->type() == Boundary::list) { this->__splitLinearBoundaryList(testNumber, f, *i); } else { __variationalProblem->add(new VariationalBorderOperatorFV(testNumber, f, *i)); } } } template void VariationalProblemExpression:: __internalSetBilinearBC(VariationalFormulaExpression::BilinearOperatorList& bilinearList) { for (VariationalFormulaExpression::BilinearOperatorList::iterator i = bilinearList.begin(); i != bilinearList.end(); ++i) { switch ((*i)->operatorType()) { case VariationalBilinearOperatorExpression::alphaUV: { VariationalAlphaUVExpression& I = dynamic_cast(**i); ConstReferenceCounting alpha = AlgebraicOperator::convert(I.alpha()); const size_t unknownNumber = __unknownList->number(I.unknownName()); const size_t testNumber = __testFunctionList->number(I.testFunctionName()); ReferenceCounting boundary = I.border(); if (boundary->boundary()->type() == Boundary::list) { this->__splitBilinearBoundaryList(unknownNumber, testNumber, alpha, boundary->boundary()); } else { __variationalProblem->add(new VariationalBorderOperatorAlphaUV(unknownNumber, testNumber, alpha, boundary->boundary())); } break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected boundary operator type", ErrorHandler::unexpected); } } } } template void VariationalProblemExpression:: __internalSetBilinear(VariationalFormulaExpression::BilinearOperatorList& bilinearList) { for (VariationalFormulaExpression::BilinearOperatorList::iterator i = bilinearList.begin(); i != bilinearList.end(); ++i) { switch ((*i)->operatorType()) { case VariationalBilinearOperatorExpression::mugradUgradV: { VariationalMuGradUGradVExpression& I = dynamic_cast(**i); ConstReferenceCounting mu = AlgebraicOperator::convert(I.mu()); const size_t unknownNumber = __unknownList->number(I.unknownName()); const size_t testNumber = __testFunctionList->number(I.testFunctionName()); __variationalProblem->add(new VariationalMuGradUGradVOperator(unknownNumber, I.unknownProperty(), testNumber, I.testFunctionProperty(), mu)); break; } case VariationalBilinearOperatorExpression::alphaDxUDxV: { VariationalAlphaDxUDxVExpression& I = dynamic_cast(*(*i)); ConstReferenceCounting alpha = AlgebraicOperator::convert(I.alpha()); const size_t unknownNumber = __unknownList->number(I.unknownName()); const size_t testNumber = __testFunctionList->number(I.testFunctionName()); __variationalProblem->add(new VariationalAlphaDxUDxVOperator(unknownNumber, I.unknownProperty(), testNumber, I.testFunctionProperty(), alpha, I.i(), I.j())); break; } case VariationalBilinearOperatorExpression::nuUdxV: { VariationalNuUdxVExpression& I = dynamic_cast(*(*i)); ConstReferenceCounting nu = AlgebraicOperator::convert(I.nu()); const size_t unknownNumber = __unknownList->number(I.unknownName()); const size_t testNumber = __testFunctionList->number(I.testFunctionName()); __variationalProblem->add(new VariationalNuUdxVOperator(unknownNumber, I.unknownProperty(), testNumber, I.testFunctionProperty(), nu, I.number())); break; } case VariationalBilinearOperatorExpression::nuDxUV: { VariationalNuDxUVExpression& I = dynamic_cast(*(*i)); ConstReferenceCounting nu = AlgebraicOperator::convert(I.nu()); const size_t unknownNumber = __unknownList->number(I.unknownName()); const size_t testNumber = __testFunctionList->number(I.testFunctionName()); __variationalProblem->add(new VariationalNuDxUVOperator(unknownNumber, I.unknownProperty(), testNumber, I.testFunctionProperty(), nu, I.number())); break; } case VariationalBilinearOperatorExpression::alphaUV: { VariationalAlphaUVExpression& I = dynamic_cast(*(*i)); ConstReferenceCounting alpha = AlgebraicOperator::convert(I.alpha()); const size_t& unknownNumber = __unknownList->number(I.unknownName()); const size_t& testNumber = __testFunctionList->number(I.testFunctionName()); __variationalProblem->add(new VariationalAlphaUVOperator(unknownNumber, I.unknownProperty(), testNumber, I.testFunctionProperty(), alpha)); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected operator type", ErrorHandler::unexpected); } } } } template void VariationalProblemExpression:: __internalSetLinearBC(VariationalFormulaExpression::LinearOperatorList& linearList) { for (VariationalFormulaExpression::LinearOperatorList::iterator i = linearList.begin(); i != linearList.end(); ++i) { switch ((*i)->operatorType()) { case VariationalLinearOperatorExpression::FV: { VariationalFVExpression& I = dynamic_cast(**i); const size_t testNumber = __testFunctionList->number(I.testFunctionName()); ConstReferenceCounting f = AlgebraicOperator::convert(I.f()); ReferenceCounting boundary = I.border(); ASSERT(boundary != 0); if (boundary->boundary()->type() == Boundary::list) { this->__splitLinearBoundaryList(testNumber, f, boundary->boundary()); } else { __variationalProblem->add(new VariationalBorderOperatorFV(testNumber, f, boundary->boundary())); } break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected operator type", ErrorHandler::unexpected); } } } } template void VariationalProblemExpression:: __internalSetLinear(VariationalFormulaExpression::LinearOperatorList& linearList) { for (VariationalFormulaExpression::LinearOperatorList::iterator i = linearList.begin(); i != linearList.end(); ++i) { VariationalOperator::Property testFunctionProperty = VariationalOperator::normal; switch ((*i)->operatorType()) { case VariationalLinearOperatorExpression::FV: { VariationalFVExpression& I = dynamic_cast(**i); I.execute(); const size_t testFunctionNumber = __testFunctionList->number(I.testFunctionName()); ConstReferenceCounting f = AlgebraicOperator::convert(I.f()); __variationalProblem->add(new VariationalOperatorFV(testFunctionNumber, testFunctionProperty, f)); break; } case VariationalLinearOperatorExpression::FdxGV: { VariationalFdxGVExpression& I = dynamic_cast(**i); I.execute(); const size_t testFunctionNumber = __testFunctionList->number(I.testFunctionName()); ConstReferenceCounting f = AlgebraicOperator::convert(I.f()); ConstReferenceCounting g = I.g()->function(); __variationalProblem->add(new VariationalOperatorFdxGV(testFunctionNumber, testFunctionProperty, f,g, I.number())); break; } case VariationalLinearOperatorExpression::FdxV: { VariationalFdxVExpression& I = dynamic_cast(**i); I.execute(); const size_t testFunctionNumber = __testFunctionList->number(I.testFunctionName()); ConstReferenceCounting f = AlgebraicOperator::convert(I.f()); __variationalProblem->add(new VariationalOperatorFdxV(testFunctionNumber, testFunctionProperty, f,I.number())); break; } case VariationalLinearOperatorExpression::FgradGgradV: { VariationalFgradGgradVExpression& I = dynamic_cast(*(*i)); I.execute(); const size_t testFunctionNumber = __testFunctionList->number(I.testFunctionName()); ConstReferenceCounting f = AlgebraicOperator::convert(I.f()); ConstReferenceCounting g = I.g()->function(); __variationalProblem->add(new VariationalOperatorFgradGgradV(testFunctionNumber, testFunctionProperty, f,g)); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unexpected operator type", ErrorHandler::unexpected); } } } } void VariationalProblemExpression:: __splitBoundaryList(BoundaryConditionSet& bcSet, const PDECondition* pde, const Boundary* b) { const BoundaryList& boundaryList = dynamic_cast(*b); for (BoundaryList::List::const_iterator i = boundaryList.list().begin(); i != boundaryList.list().end(); ++i) { if ((*i)->type() == Boundary::list) { this->__splitBoundaryList(bcSet, pde, *i); } else { bcSet.addBoundaryCondition(new BoundaryCondition(pde, *i)); } } } bool VariationalProblemExpression:: hasPOVBoundary() const { if (__dirichletList->hasPOVBoundary()) return true; if (__variationalFormula->hasPOVBoundary()) return true; return false; } void VariationalProblemExpression:: execute() { __variationalFormula->execute(); __dirichletList->execute(); __testFunctionList->execute(); __unknownList = Information::instance().getUnknownList(); std::vector > listOfBCSet; listOfBCSet.resize(__testFunctionList->size()); for (size_t i=0; ibegin(); i != __dirichletList->end(); ++i) { size_t number = __unknownList->number((*i)->unknownName()); BoundaryConditionSet& bcSet = (*listOfBCSet[number]); const BoundaryCondition& b = * (*i)->boundaryCondition(); if (b.boundary()->type() == Boundary::list) { const Boundary* bc = b.boundary(); const PDECondition* pde = b.condition(); this->__splitBoundaryList(bcSet, pde, bc); } else { bcSet.addBoundaryCondition((*i)->boundaryCondition()); } } // Now Boundary conditions will not change: std::vector > listOfConstBCSet; listOfConstBCSet.resize(listOfBCSet.size()); for (size_t i=0; i(__variationalFormula->__bilinearPlus); __internalSetBilinear(__variationalFormula->__bilinearMinus); __internalSetLinear(__variationalFormula->__linearPlus); __internalSetLinear(__variationalFormula->__linearMinus); __internalSetBilinearBC(__variationalFormula->__bilinearBorderPlus); __internalSetBilinearBC(__variationalFormula->__bilinearBorderMinus); __internalSetLinearBC(__variationalFormula->__linearBorderPlus); __internalSetLinearBC(__variationalFormula->__linearBorderMinus); } VariationalProblemExpression:: VariationalProblemExpression(ReferenceCounting v, ReferenceCounting d, ReferenceCounting t) : ProblemExpression(ProblemExpression::variationalProblem), __variationalFormula(v), __dirichletList(d), __testFunctionList(t) { ; } VariationalProblemExpression:: VariationalProblemExpression(const VariationalProblemExpression& vp) : ProblemExpression(vp), __variationalFormula(vp.__variationalFormula), __dirichletList(vp.__dirichletList), __unknownList(vp.__unknownList), __testFunctionList(vp.__testFunctionList), __variationalProblem(vp.__variationalProblem) { ; } VariationalProblemExpression:: ~VariationalProblemExpression() { ; } ReferenceCounting VariationalProblemExpression::variationalProblem() { return __variationalProblem; } freefem3d-1.0pre10/language/DomainExpressionAnalytic.cpp0000644000175000017500000000352610561425532020257 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpressionAnalytic.cpp,v 1.1 2006/09/28 19:13:25 delpinux Exp $ #include #include #include #include #include std::ostream& DomainExpressionAnalytic:: put(std::ostream& os) const { return os; } void DomainExpressionAnalytic:: execute() { __function->execute(); ReferenceCounting object = new Object(new AnalyticShape(__function->function())); object->setReference(TinyVector<3,real_t>(0,0,0)); ReferenceCounting scene = new Scene(); scene->add(object); __domain = new Domain(scene); __domain->setObjects(object); } DomainExpressionAnalytic:: DomainExpressionAnalytic(ReferenceCounting f) : DomainExpression(DomainExpression::analytic), __function(f) { ; } DomainExpressionAnalytic:: DomainExpressionAnalytic(const DomainExpressionAnalytic& d) : DomainExpression(d), __function(d.__function) { ; } DomainExpressionAnalytic:: ~DomainExpressionAnalytic() { ; } freefem3d-1.0pre10/language/VariationalFormulaExpression.hpp0000644000175000017500000001226410561425532021166 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariationalFormulaExpression.hpp,v 1.5 2006/04/08 10:43:20 delpinux Exp $ #ifndef VARIATIONAL_FORMULA_EXPRESSION_HPP #define VARIATIONAL_FORMULA_EXPRESSION_HPP #include #include #include #include #include #include /** * @file VariationalFormulaExpression.hpp * @author Stephane Del Pino * @date Mon May 27 18:16:55 2002 * * @brief reads the bilinear form and interprets it * * This class jobs is to understand the bilinear and linear forms in *order to discretize them. */ class VariationalFormulaExpression : public Expression { private: friend class VariationalProblemExpression; ReferenceCounting __givenMultiLinearExpression; /**< the fiven multi-linear expression */ typedef std::list > BilinearOperatorList; BilinearOperatorList __bilinearPlus; /**< added bilinear expressions */ BilinearOperatorList __bilinearMinus; /**< removed bilinear expressions */ BilinearOperatorList __bilinearBorderPlus; /**< added bilinear expressions living on a border */ BilinearOperatorList __bilinearBorderMinus; /**< removed bilinear expressions living on a border */ typedef std::list > LinearOperatorList; LinearOperatorList __linearPlus; /**< added linear expressions */ LinearOperatorList __linearMinus; /**< removed linear expressions */ LinearOperatorList __linearBorderPlus; /**< added linear expressions living on a border */ LinearOperatorList __linearBorderMinus; /**< removed linear expressions living on a border */ /** * printes operators lists * * @param listType a list * @param delimiter typically '+' or '-' * @param first true if the variational term is the first to write * @param os given stream * * @return modified stream */ template std::ostream& __putList(const ListType& listType, char delimiter, bool& first, std::ostream& os) const; /** * Overloading of Expression::put() * * @param os incoming stream * * @return os modified stream */ std::ostream& put(std::ostream& os) const; /** * Internal function used to rewrite the variational formula in term of * linear and bilinear form */ void __getBandLForms2D(MultiLinearExpressionSum::iterator begin, MultiLinearExpressionSum::iterator end, BilinearOperatorList& bilinearPlus, BilinearOperatorList& bilinearMinus, LinearOperatorList& linearPlus, LinearOperatorList& linearMinus, ReferenceCounting b); /** * Internal function used to rewrite the variational formula in term of * linear and bilinear form */ void __getBandLForms3D(MultiLinearExpressionSum::iterator begin, MultiLinearExpressionSum::iterator end, BilinearOperatorList& bilinearPlus, BilinearOperatorList& bilinearMinus, LinearOperatorList& linearPlus, LinearOperatorList& linearMinus); /** * Internal function used to rewrite the variational formula in term of * linear and bilinear form */ void __getBilinearAndLinearForms(MultiLinearFormSumExpression::iterator begin, MultiLinearFormSumExpression::iterator end, BilinearOperatorList& bilinearPlus, BilinearOperatorList& bilinearMinus, BilinearOperatorList& bilinearBorderPlus, BilinearOperatorList& bilinearBorderMinus, LinearOperatorList& linearPlus, LinearOperatorList& linearMinus, LinearOperatorList& linearBorderPlus, LinearOperatorList& linearBorderMinus); public: /** * Returns true if one of the boundaries is defined by a POVRef * * @return true if one of the boundaries is defined by a POVRef */ bool hasPOVBoundary() const; /** * Expression::execute() overloading * */ void execute(); /** * Constructor * * @param m multi-linear form * */ VariationalFormulaExpression(ReferenceCounting m); /** * Copy constructor * * @param v a Variational formula * */ VariationalFormulaExpression(const VariationalFormulaExpression& v); /** * The destructor * */ ~VariationalFormulaExpression(); }; #endif // VARIATIONAL_FORMULA_EXPRESSION_HPP freefem3d-1.0pre10/language/FunctionExpressionMeshReferences.cpp0000644000175000017500000000760610624156366022000 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionMeshReferences.cpp,v 1.2 2007/05/20 23:22:26 delpinux Exp $ #include #include #include #include #include FunctionExpressionMeshReferences::ItemType FunctionExpressionMeshReferences:: __getItemType() { if (__itemName == "elements") { return FunctionExpressionMeshReferences::element; } if (__itemName == "vertices") { return FunctionExpressionMeshReferences::vertex; } return FunctionExpressionMeshReferences::undefined; } std::ostream& FunctionExpressionMeshReferences:: put(std::ostream& os) const { os << "reference(" << __itemName << ',' << *__mesh << ',' << *__referenceSet << ')'; return os; } void FunctionExpressionMeshReferences:: execute() { __referenceSet->execute(); __mesh->execute(); ScalarFunctionMeshElementsReferences::FunctionMap functionMap; for (ReferencesSet::FunctionReferences::const_iterator i = __referenceSet->functionReferences().begin(); i != __referenceSet->functionReferences().end(); ++i) { size_t referenceNumber = size_t(i->first->realValue()); if (functionMap.find(referenceNumber) != functionMap.end()) { throw ErrorHandler(__FILE__,__LINE__, "reference "+ stringify(referenceNumber)+ " multiply defined in '"+ stringify(*this)+ "'", ErrorHandler::normal); } functionMap[referenceNumber] = i->second->function(); } switch (this->__getItemType()) { case FunctionExpressionMeshReferences::element: { __scalarFunction = new ScalarFunctionMeshElementsReferences(functionMap,__mesh->mesh()); break; } case FunctionExpressionMeshReferences::vertex: { const Mesh* m = __mesh->mesh(); Vector values(m->numberOfVertices()); for (size_t i=0; ivertex(i); ScalarFunctionMeshElementsReferences::FunctionMap::const_iterator f = functionMap.find(x.reference()); if (f != functionMap.end()) { values[i] = (*f->second)(x); } else { // reference was not found in list values[i] = 0; } } FEMFunctionBuilder builder; DiscretizationType d(DiscretizationType::lagrangianFEM1); builder.build(d,m,values); __scalarFunction = builder.getBuiltScalarFunction(); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "unknown item type", ErrorHandler::unexpected); } } } FunctionExpressionMeshReferences:: FunctionExpressionMeshReferences(const std::string itemName, ReferenceCounting mesh, ReferenceCounting ref) : FunctionExpression(FunctionExpression::meshReferences), __itemName(itemName), __mesh(mesh), __referenceSet(ref) { ; } FunctionExpressionMeshReferences:: FunctionExpressionMeshReferences(const FunctionExpressionMeshReferences& f) : FunctionExpression(f), __itemName(f.__itemName), __mesh(f.__mesh), __referenceSet(f.__referenceSet) { ; } FunctionExpressionMeshReferences:: ~FunctionExpressionMeshReferences() { ; } freefem3d-1.0pre10/language/FunctionExpressionSpectral.cpp0000644000175000017500000000465410615171717020654 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionSpectral.cpp,v 1.2 2007/04/29 19:19:36 yakoubix Exp $ #include #include #include #include #include #include #include void FunctionExpressionSpectral:: execute() { __mesh->execute(); Information::instance().setMesh(__mesh->mesh()); if (__mesh->mesh()->type() != Mesh::spectralMesh) { throw ErrorHandler(__FILE__,__LINE__, "cannot built spectral function on non spectral mesh", ErrorHandler::normal); } const Mesh* mesh = __mesh->mesh(); ConstReferenceCounting smesh = dynamic_cast(mesh); SpectralFunction* s = new SpectralFunction(smesh); if (__functionExpression != 0) { __functionExpression->execute(); (*s) = *(__functionExpression->function()); } __scalarFunction = s; // function has now been evaluated. __functionExpression = 0; Information::instance().unsetMesh(); } FunctionExpressionSpectral:: FunctionExpressionSpectral(ReferenceCounting mesh, ReferenceCounting function) : FunctionExpression(FunctionExpression::spectral), __mesh(mesh), __functionExpression(function) { ; } FunctionExpressionSpectral:: FunctionExpressionSpectral(const FunctionExpressionSpectral& spectralFunction) : FunctionExpression(spectralFunction), __mesh(spectralFunction.__mesh), __functionExpression(spectralFunction.__functionExpression) { ; } FunctionExpressionSpectral:: ~FunctionExpressionSpectral() { ; } freefem3d-1.0pre10/language/ylwrap0000755000175000017500000000631210034350060014023 00000000000000#! /bin/sh # ylwrap - wrapper for lex/yacc invocations. # Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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, 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. # Usage: # ylwrap PROGRAM INPUT [OUTPUT DESIRED]... -- [ARGS]... # * PROGRAM is program to run. # * INPUT is the input file # * OUTPUT is file PROG generates # * DESIRED is file we actually want # * ARGS are passed to PROG # Any number of OUTPUT,DESIRED pairs may be used. # The program to run. prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in /* | [A-Za-z]:\\*) ;; */*) prog="`pwd`/$prog" ;; esac # The input. input="$1" shift case "$input" in /* | [A-Za-z]:\\*) # Absolute path; do nothing. ;; *) # Relative path. Make it absolute. Why? Because otherwise any # debugging info in the generated file will point to the wrong # place. This is really gross. input="`pwd`/$input" ;; esac # We don't want to use the absolute path if the input in the current # directory like when making a tar ball. input_base=`echo $input | sed -e 's|.*/||'` if test -f $input_base && cmp $input_base $input >/dev/null 2>&1; then input=$input_base fi pairlist= while test "$#" -ne 0; do if test "$1" = "--"; then shift break fi pairlist="$pairlist $1" shift done # FIXME: add hostname here for parallel makes that run commands on # other machines. But that might take us over the 14-char limit. dirname=ylwrap$$ trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 mkdir $dirname || exit 1 cd $dirname case "$input" in /* | [A-Za-z]:\\*) # Absolute path; do nothing. ;; *) # Make a symbolic link, hard link or hardcopy. ln -s ../"$input" . > /dev/null 2>&1 || ln ../"$input" . > /dev/null 2>&1 || cp ../"$input" . ;; esac $prog ${1+"$@"} "$input" status=$? if test $status -eq 0; then set X $pairlist shift first=yes while test "$#" -ne 0; do if test -f "$1"; then # If $2 is an absolute path name, then just use that, # otherwise prepend `../'. case "$2" in /* | [A-Za-z]:\\*) target="$2";; *) target="../$2";; esac mv "$1" "$target" || status=$? else # A missing file is only an error for the first file. This # is a blatant hack to let us support using "yacc -d". If -d # is not specified, we don't want an error when the header # file is "missing". if test $first = yes; then status=1 fi fi shift shift first=no done else status=$? fi # Remove the directory. cd .. rm -rf $dirname exit $status freefem3d-1.0pre10/language/OStreamExpressionList.hpp0000644000175000017500000000336310561425532017575 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: OStreamExpressionList.hpp,v 1.1 2006/12/19 23:32:00 delpinux Exp $ #ifndef OSTREAM_EXPRESSION_LIST_HPP #define OSTREAM_EXPRESSION_LIST_HPP #include #include class OStreamExpressionList : public Expression { private: typedef std::list > ListType; ListType __expressions; std::ostream & put(std::ostream & os) const { for (ListType::const_iterator i=__expressions.begin(); i != __expressions.end(); ++i) { os << (*(*i)); } return os; } public: void operator << (ReferenceCounting e) { __expressions.push_back(e); } void execute() { for(ListType::iterator i=__expressions.begin(); i != __expressions.end(); ++i) { (*(*i)).execute(); } } OStreamExpressionList() : Expression(Expression::ostreamExpressionList) { ; } ~OStreamExpressionList() { ; } }; #endif // OSTREAM_EXPRESSION_LIST_HPP freefem3d-1.0pre10/language/parse.ff.cc0000644000175000017500000065447010633014327014620 00000000000000/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse ffparse #define yylex fflex #define yyerror fferror #define yylval fflval #define yychar ffchar #define yydebug ffdebug #define yynerrs ffnerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NUM = 258, VARREALID = 259, VARVECTID = 260, VARFNCTID = 261, MESHID = 262, VARSCENEID = 263, VARDOMAINID = 264, VARUNKNOWNID = 265, VARTESTFUNCTIONID = 266, VAROFSTREAMID = 267, MESH = 271, DOMAIN_ = 276, OFSTREAM = 279, FUNCTION = 283, TRANSFORM = 308, SIMPLIFY = 309, EXTRACT = 310, PERIODIC = 311, DXYZ = 312, DXYZOP = 313, XYZ = 314, VECTOR = 315, DOUBLE = 316, STRING = 317, SFUNCTION = 318, FEMFUNCTION = 319, STRUCTMESH = 320, SPECTRALMESH = 321, SURFMESH = 322, SCENE = 323, USING = 324, FINEMESH = 325, COARSEMESH = 326, IF = 327, ELSE = 328, DO = 329, WHILE = 330, FOR = 331, EXIT = 332, LT = 333, GT = 334, LEQ = 335, GEQ = 336, EQ = 337, NE = 338, OR = 339, XOR = 340, AND = 341, TRUE = 342, FALSE = 343, NOT = 344, LRAFTER = 345, RRAFTER = 346, DIV = 347, GRAD = 348, SOLVE = 349, OPENBLOCK = 350, CLOSEBLOCK = 351, DNU = 352, CONVECT = 353, INCR = 354, DECR = 355, ONE = 356, REFERENCE = 357, FILETYPE = 358, FILEFORMAT = 359, DISCRETIZATIONTYPE = 360, SAVE = 361, PLOT = 362, CAT = 363, EXEC = 364, READ = 365, TETRAHEDRIZE = 366, FACE = 367, OPTION = 368, INT = 369, EPSILON = 370, MAXITER = 371, KEEPMATRIX = 372, METHOD = 373, PENALTY = 374, FATBOUNDARY = 375, PDEQ = 376, TESTS = 377, IN = 378, ON = 379, BY = 380, INSIDE = 381, OUTSIDE = 382, POV = 383, COUT = 384, CERR = 385, ITEMS = 386, CFUNCTION = 387, MINMAX = 388, NORMALCOMPONENT = 389, NAME = 390, NEG = 391 }; #endif /* Tokens. */ #define NUM 258 #define VARREALID 259 #define VARVECTID 260 #define VARFNCTID 261 #define MESHID 262 #define VARSCENEID 263 #define VARDOMAINID 264 #define VARUNKNOWNID 265 #define VARTESTFUNCTIONID 266 #define VAROFSTREAMID 267 #define MESH 271 #define DOMAIN_ 276 #define OFSTREAM 279 #define FUNCTION 283 #define TRANSFORM 308 #define SIMPLIFY 309 #define EXTRACT 310 #define PERIODIC 311 #define DXYZ 312 #define DXYZOP 313 #define XYZ 314 #define VECTOR 315 #define DOUBLE 316 #define STRING 317 #define SFUNCTION 318 #define FEMFUNCTION 319 #define STRUCTMESH 320 #define SPECTRALMESH 321 #define SURFMESH 322 #define SCENE 323 #define USING 324 #define FINEMESH 325 #define COARSEMESH 326 #define IF 327 #define ELSE 328 #define DO 329 #define WHILE 330 #define FOR 331 #define EXIT 332 #define LT 333 #define GT 334 #define LEQ 335 #define GEQ 336 #define EQ 337 #define NE 338 #define OR 339 #define XOR 340 #define AND 341 #define TRUE 342 #define FALSE 343 #define NOT 344 #define LRAFTER 345 #define RRAFTER 346 #define DIV 347 #define GRAD 348 #define SOLVE 349 #define OPENBLOCK 350 #define CLOSEBLOCK 351 #define DNU 352 #define CONVECT 353 #define INCR 354 #define DECR 355 #define ONE 356 #define REFERENCE 357 #define FILETYPE 358 #define FILEFORMAT 359 #define DISCRETIZATIONTYPE 360 #define SAVE 361 #define PLOT 362 #define CAT 363 #define EXEC 364 #define READ 365 #define TETRAHEDRIZE 366 #define FACE 367 #define OPTION 368 #define INT 369 #define EPSILON 370 #define MAXITER 371 #define KEEPMATRIX 372 #define METHOD 373 #define PENALTY 374 #define FATBOUNDARY 375 #define PDEQ 376 #define TESTS 377 #define IN 378 #define ON 379 #define BY 380 #define INSIDE 381 #define OUTSIDE 382 #define POV 383 #define COUT 384 #define CERR 385 #define ITEMS 386 #define CFUNCTION 387 #define MINMAX 388 #define NORMALCOMPONENT 389 #define NAME 390 #define NEG 391 /* Copy the first part of user declarations. */ #line 1 "/home/delpino/src/ff3d/language/parse.ff.yy" /* -*- c++ -*- */ /* * This file is part of ff3d - http://www.freefem.org/ff3d * Copyright (C) 2001, 2002, 2003 Stéphane Del Pino * * 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, 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. * * $Id: parse.ff.yy,v 1.66 2007/06/10 14:59:08 delpinux Exp $ * */ #include #include #include #include #include int yyerror (const char*); int yyerror2(const char*); #include extern FFLexer* fflexer; #define fflex fflexer->fflex #define YYERROR_VERBOSE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //! The set of instructions. extern std::vector > iSet; /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE #line 155 "/home/delpino/src/ff3d/language/parse.ff.yy" { real_t value; int entier; Expression* expression; RealExpression* realExp; BooleanExpression* boolean; Vector3Expression* vector3; StringExpression* string; FunctionExpression* function; FunctionExpressionMeshReferences::ReferencesSet* reference; FieldExpressionList* fieldlist; FieldExpression* field; MeshExpression* mesh; MeshExpressionSpectral* spectralmesh; MeshExpressionSurface* surfacemesh; MeshExpressionStructured* structured3dmesh; MeshExpressionPeriodic::MappedReferencesList* mapreference; SceneExpression* scene; DomainExpression* domain; OFStreamExpression* ofstream; UnknownExpression* unknownExpression; UnknownListExpression* unknownList; TestFunctionVariable* testFunction; TestFunctionExpressionList* testFunctionList; BoundaryConditionListExpression* boundaryConditionList; BoundaryConditionExpression* boundaryCondition; BoundaryExpression* boundary; PDEOperatorExpression* pdeOperatorExpression; PDEScalarOperatorExpressionOrderZero* zerothOrderOp; PDEVectorialOperatorExpressionOrderOne* vectorialFirstOrderOp; PDEScalarOperatorExpressionOrderOne* firstOrderOp; PDEVectorialOperatorExpressionOrderTwo* matricialSecondOrderOp; PDEOperatorSumExpression* pdeOperatorSumExpression; PDEEquationExpression* pdeEquation; PDEProblemExpression* pdeProblem; PDESystemExpression* pdeSystem; SolverOptionsExpression* solverOptions; OptionExpression* option; OStreamExpression * ostreamExpression; OStreamExpressionList * ostreamExpressionList; SolverOptionsExpression* solver; SubOptionExpression* subOption; SubOptionListExpression* subOptionList; Variable* variable; RealVariable* realVariable; Vector3Variable* vector3Variable; FunctionVariable* functionVariable; OFStreamVariable* ofstreamVariable; FunctionVariable* unknownVariable; StringVariable* stringVariable; MeshVariable* meshVariable; SceneVariable* sceneVariable; DomainVariable* domainVariable; InsideExpression* insideExpression; InsideListExpression* insideListExpression; Instruction* instruction; IntegratedExpression* integratedFunction; IntegratedOperatorExpression* integratedOperatorExp; LinearExpression* linearexp; MultiLinearExpression* multilinearexp; MultiLinearExpressionSum* multilinearexpsum; MultiLinearFormExpression* multilinearform; MultiLinearFormSumExpression* multilinearformsum; VariationalDirichletListExpression* variationalDirichletList; BoundaryConditionExpressionDirichlet* boundaryConditionDirichlet; VariationalFormulaExpression* variationalFormula; VariationalProblemExpression* variationalProblem; ProblemExpression* problem; char* str; const std::string* aString; FileDescriptor::FileType fileType; FileDescriptor::FormatType formatType; DiscretizationType::Type discretizationType; ScalarFunctionNormal::ComponentType normalComponent; } /* Line 187 of yacc.c. */ #line 560 "parse.ff.cc" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #line 573 "parse.ff.cc" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 3011 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 152 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 80 /* YYNRULES -- Number of rules. */ #define YYNRULES 332 /* YYNRULES -- Number of states. */ #define YYNSTATES 914 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 391 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 141, 2, 2, 144, 145, 139, 138, 147, 137, 151, 140, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 148, 146, 2, 136, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 149, 2, 150, 143, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 142 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 6, 9, 12, 14, 16, 18, 19, 21, 23, 27, 29, 31, 33, 40, 46, 56, 62, 70, 73, 78, 81, 86, 89, 95, 101, 109, 117, 122, 130, 138, 148, 158, 161, 166, 169, 174, 177, 182, 185, 190, 194, 197, 200, 203, 206, 210, 214, 218, 222, 226, 230, 235, 239, 245, 251, 257, 265, 275, 287, 299, 313, 323, 331, 335, 338, 341, 344, 350, 352, 356, 358, 362, 364, 366, 370, 372, 376, 378, 380, 382, 383, 387, 389, 391, 393, 395, 397, 399, 401, 403, 410, 415, 422, 429, 436, 441, 448, 452, 458, 467, 476, 483, 488, 493, 495, 502, 509, 514, 516, 521, 523, 525, 529, 532, 536, 540, 545, 550, 551, 553, 555, 559, 564, 566, 570, 574, 578, 580, 582, 583, 589, 594, 596, 600, 602, 606, 610, 612, 616, 620, 623, 631, 636, 638, 642, 646, 649, 651, 655, 659, 663, 667, 669, 673, 677, 679, 684, 689, 693, 697, 699, 701, 703, 705, 706, 710, 716, 718, 721, 729, 733, 735, 736, 740, 742, 746, 749, 753, 757, 765, 775, 785, 787, 789, 791, 793, 797, 801, 803, 807, 811, 816, 821, 823, 826, 830, 834, 838, 842, 846, 848, 852, 858, 867, 880, 891, 902, 915, 926, 939, 941, 945, 947, 949, 951, 954, 956, 960, 962, 966, 968, 972, 974, 976, 978, 980, 989, 998, 1007, 1016, 1025, 1034, 1043, 1045, 1050, 1059, 1063, 1072, 1083, 1096, 1107, 1112, 1117, 1122, 1129, 1133, 1137, 1141, 1145, 1149, 1153, 1157, 1161, 1164, 1169, 1178, 1183, 1190, 1197, 1201, 1205, 1209, 1213, 1217, 1221, 1225, 1229, 1233, 1237, 1248, 1252, 1258, 1266, 1268, 1276, 1280, 1284, 1288, 1292, 1294, 1298, 1302, 1304, 1306, 1308, 1313, 1322, 1330, 1340, 1348, 1352, 1356, 1360, 1364, 1368, 1372, 1376, 1379, 1382, 1385, 1388, 1391, 1396, 1401, 1403, 1405, 1409, 1413, 1417, 1421, 1425, 1429, 1433, 1437, 1441, 1445, 1448, 1450, 1452, 1456, 1460, 1464, 1468, 1472, 1476, 1480, 1484, 1488, 1492 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 153, 0, -1, 154, -1, -1, 154, 155, -1, 156, 146, -1, 157, -1, 160, -1, 165, -1, -1, 162, -1, 163, -1, 158, 154, 159, -1, 95, -1, 96, -1, 161, -1, 74, 155, 75, 144, 230, 145, -1, 75, 144, 230, 145, 155, -1, 76, 144, 156, 146, 230, 146, 156, 145, 155, -1, 72, 144, 230, 145, 155, -1, 72, 144, 230, 145, 155, 73, 155, -1, 61, 135, -1, 61, 135, 136, 229, -1, 60, 135, -1, 60, 135, 136, 226, -1, 28, 135, -1, 63, 135, 144, 174, 145, -1, 64, 135, 144, 174, 145, -1, 64, 135, 144, 174, 147, 105, 145, -1, 64, 135, 144, 174, 148, 105, 145, -1, 28, 135, 136, 223, -1, 63, 135, 144, 174, 145, 136, 223, -1, 64, 135, 144, 174, 145, 136, 223, -1, 64, 135, 144, 174, 147, 105, 145, 136, 223, -1, 64, 135, 144, 174, 148, 105, 145, 136, 223, -1, 16, 135, -1, 16, 135, 136, 174, -1, 68, 135, -1, 68, 135, 136, 179, -1, 21, 135, -1, 21, 135, 136, 180, -1, 24, 135, -1, 24, 135, 136, 181, -1, 4, 136, 229, -1, 4, 99, -1, 99, 4, -1, 4, 100, -1, 100, 4, -1, 5, 136, 226, -1, 6, 136, 223, -1, 7, 136, 174, -1, 9, 136, 180, -1, 8, 136, 179, -1, 12, 136, 181, -1, 94, 144, 218, 145, -1, 171, 172, 146, -1, 108, 144, 227, 145, 146, -1, 109, 144, 227, 145, 146, -1, 107, 144, 174, 145, 146, -1, 107, 144, 224, 147, 174, 145, 146, -1, 106, 144, 104, 147, 227, 147, 174, 145, 146, -1, 106, 144, 104, 147, 227, 147, 174, 147, 103, 145, 146, -1, 106, 144, 104, 147, 227, 147, 166, 147, 174, 145, 146, -1, 106, 144, 104, 147, 227, 147, 166, 147, 174, 147, 103, 145, 146, -1, 164, 123, 180, 125, 174, 184, 158, 189, 159, -1, 164, 123, 174, 184, 158, 189, 159, -1, 69, 179, 146, -1, 71, 146, -1, 70, 146, -1, 77, 146, -1, 77, 144, 229, 145, 146, -1, 168, -1, 95, 167, 96, -1, 168, -1, 167, 147, 168, -1, 223, -1, 169, -1, 149, 170, 150, -1, 223, -1, 170, 147, 223, -1, 129, -1, 130, -1, 12, -1, -1, 172, 90, 173, -1, 227, -1, 224, -1, 229, -1, 226, -1, 176, -1, 177, -1, 178, -1, 7, -1, 110, 144, 104, 147, 227, 145, -1, 111, 144, 174, 145, -1, 111, 144, 180, 147, 174, 145, -1, 55, 144, 174, 147, 229, 145, -1, 53, 144, 174, 147, 169, 145, -1, 54, 144, 174, 145, -1, 56, 144, 174, 147, 175, 145, -1, 229, 148, 229, -1, 175, 147, 229, 148, 229, -1, 65, 144, 226, 147, 226, 147, 226, 145, -1, 66, 144, 226, 147, 226, 147, 226, 145, -1, 67, 144, 180, 147, 174, 145, -1, 67, 144, 174, 145, -1, 128, 144, 227, 145, -1, 8, -1, 53, 144, 179, 147, 169, 145, -1, 21, 144, 179, 147, 182, 145, -1, 21, 144, 231, 145, -1, 9, -1, 24, 144, 227, 145, -1, 12, -1, 183, -1, 144, 182, 145, -1, 89, 182, -1, 182, 86, 182, -1, 182, 84, 182, -1, 126, 144, 226, 145, -1, 127, 144, 226, 145, -1, -1, 185, -1, 186, -1, 185, 147, 186, -1, 113, 144, 187, 145, -1, 188, -1, 188, 147, 187, -1, 113, 136, 113, -1, 113, 136, 229, -1, 206, -1, 190, -1, -1, 192, 191, 195, 146, 204, -1, 122, 144, 193, 145, -1, 194, -1, 193, 147, 194, -1, 135, -1, 196, 136, 3, -1, 196, 136, 196, -1, 197, -1, 196, 138, 197, -1, 196, 137, 197, -1, 137, 197, -1, 114, 149, 220, 150, 144, 198, 145, -1, 114, 144, 198, 145, -1, 199, -1, 198, 138, 199, -1, 198, 137, 199, -1, 137, 199, -1, 200, -1, 199, 139, 200, -1, 199, 139, 224, -1, 199, 139, 229, -1, 144, 199, 145, -1, 201, -1, 224, 139, 201, -1, 229, 139, 201, -1, 203, -1, 93, 144, 202, 145, -1, 58, 144, 202, 145, -1, 149, 201, 150, -1, 95, 201, 96, -1, 203, -1, 224, -1, 10, -1, 11, -1, -1, 204, 205, 146, -1, 10, 136, 223, 124, 220, -1, 207, -1, 206, 207, -1, 121, 144, 10, 145, 208, 146, 210, -1, 211, 136, 209, -1, 223, -1, -1, 219, 146, 210, -1, 212, -1, 144, 211, 145, -1, 137, 211, -1, 211, 138, 211, -1, 211, 137, 211, -1, 92, 144, 93, 144, 10, 145, 145, -1, 92, 144, 229, 139, 93, 144, 10, 145, 145, -1, 92, 144, 224, 139, 93, 144, 10, 145, 145, -1, 216, -1, 214, -1, 213, -1, 10, -1, 224, 139, 10, -1, 229, 139, 10, -1, 215, -1, 224, 139, 214, -1, 229, 139, 214, -1, 57, 144, 10, 145, -1, 57, 144, 217, 145, -1, 215, -1, 137, 217, -1, 217, 138, 217, -1, 217, 137, 217, -1, 224, 139, 217, -1, 229, 139, 217, -1, 144, 217, 145, -1, 222, -1, 218, 147, 222, -1, 10, 136, 223, 124, 220, -1, 97, 144, 10, 145, 136, 223, 124, 220, -1, 224, 139, 10, 138, 97, 144, 10, 145, 136, 223, 124, 220, -1, 10, 138, 97, 144, 10, 145, 136, 223, 124, 220, -1, 97, 144, 10, 145, 138, 10, 136, 223, 124, 220, -1, 97, 144, 10, 145, 138, 223, 139, 10, 136, 223, 124, 220, -1, 97, 144, 10, 145, 137, 10, 136, 223, 124, 220, -1, 97, 144, 10, 145, 137, 223, 139, 10, 136, 223, 124, 220, -1, 221, -1, 220, 147, 221, -1, 226, -1, 229, -1, 7, -1, 7, 112, -1, 135, -1, 135, 148, 105, -1, 10, -1, 10, 148, 105, -1, 6, -1, 6, 148, 105, -1, 229, -1, 224, -1, 59, -1, 134, -1, 224, 144, 224, 147, 224, 147, 224, 145, -1, 224, 144, 224, 147, 224, 147, 229, 145, -1, 224, 144, 224, 147, 229, 147, 224, 145, -1, 224, 144, 224, 147, 229, 147, 229, 145, -1, 224, 144, 229, 147, 224, 147, 224, 145, -1, 224, 144, 229, 147, 224, 147, 229, 145, -1, 224, 144, 229, 147, 229, 147, 224, 145, -1, 6, -1, 101, 144, 231, 145, -1, 102, 144, 131, 147, 174, 147, 225, 145, -1, 144, 224, 145, -1, 110, 144, 104, 147, 227, 147, 174, 145, -1, 110, 144, 104, 147, 227, 148, 227, 147, 174, 145, -1, 110, 144, 104, 147, 227, 148, 227, 148, 229, 147, 174, 145, -1, 110, 144, 104, 147, 227, 148, 229, 147, 174, 145, -1, 101, 144, 226, 145, -1, 101, 144, 180, 145, -1, 101, 144, 174, 145, -1, 133, 144, 224, 147, 224, 145, -1, 224, 141, 224, -1, 224, 138, 224, -1, 224, 137, 224, -1, 224, 139, 224, -1, 224, 140, 224, -1, 224, 143, 229, -1, 224, 143, 224, -1, 229, 143, 224, -1, 137, 224, -1, 57, 144, 223, 145, -1, 98, 144, 169, 147, 229, 147, 223, 145, -1, 132, 144, 224, 145, -1, 133, 144, 229, 147, 224, 145, -1, 133, 144, 224, 147, 229, 145, -1, 229, 141, 224, -1, 224, 141, 229, -1, 229, 138, 224, -1, 224, 138, 229, -1, 229, 139, 224, -1, 224, 139, 229, -1, 229, 137, 224, -1, 224, 137, 229, -1, 229, 140, 224, -1, 224, 140, 229, -1, 114, 149, 223, 147, 223, 150, 144, 223, 145, 57, -1, 229, 148, 223, -1, 225, 147, 229, 148, 223, -1, 78, 229, 147, 229, 147, 229, 79, -1, 5, -1, 144, 229, 147, 229, 147, 229, 145, -1, 226, 138, 226, -1, 226, 137, 226, -1, 229, 139, 226, -1, 226, 139, 229, -1, 228, -1, 227, 151, 228, -1, 227, 151, 229, -1, 62, -1, 3, -1, 4, -1, 224, 144, 226, 145, -1, 224, 144, 229, 147, 229, 147, 229, 145, -1, 114, 149, 174, 150, 144, 223, 145, -1, 114, 149, 174, 148, 105, 150, 144, 223, 145, -1, 133, 149, 174, 150, 144, 223, 145, -1, 144, 229, 145, -1, 229, 141, 229, -1, 229, 138, 229, -1, 229, 137, 229, -1, 229, 139, 229, -1, 229, 140, 229, -1, 229, 143, 229, -1, 137, 229, -1, 99, 4, -1, 4, 99, -1, 100, 4, -1, 4, 100, -1, 132, 144, 229, 145, -1, 144, 61, 145, 230, -1, 87, -1, 88, -1, 229, 79, 229, -1, 229, 78, 229, -1, 229, 80, 229, -1, 229, 81, 229, -1, 229, 82, 229, -1, 229, 83, 229, -1, 230, 84, 230, -1, 230, 85, 230, -1, 230, 86, 230, -1, 144, 230, 145, -1, 89, 230, -1, 87, -1, 88, -1, 223, 79, 223, -1, 223, 78, 223, -1, 223, 81, 223, -1, 223, 80, 223, -1, 223, 82, 223, -1, 223, 83, 223, -1, 231, 84, 231, -1, 231, 85, 231, -1, 231, 86, 231, -1, 144, 231, 145, -1, 89, 231, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 459, 459, 467, 470, 478, 482, 486, 490, 498, 501, 505, 512, 523, 530, 538, 542, 546, 550, 557, 563, 570, 578, 583, 592, 597, 608, 622, 637, 655, 670, 675, 684, 692, 699, 706, 712, 717, 723, 728, 736, 743, 752, 762, 766, 770, 774, 778, 782, 786, 790, 794, 798, 802, 810, 817, 821, 825, 829, 833, 837, 842, 847, 852, 857, 866, 875, 879, 883, 887, 891, 898, 903, 910, 915, 923, 928, 935, 942, 947, 955, 959, 963, 970, 973, 980, 984, 988, 992, 999, 1003, 1007, 1011, 1015, 1020, 1024, 1028, 1032, 1036, 1040, 1047, 1052, 1061, 1068, 1075, 1079, 1086, 1090, 1094, 1102, 1106, 1110, 1117, 1121, 1128, 1132, 1136, 1140, 1144, 1151, 1155, 1162, 1165, 1172, 1177, 1185, 1195, 1200, 1208, 1220, 1231, 1235, 1243, 1242, 1255, 1262, 1267, 1275, 1284, 1291, 1300, 1305, 1310, 1315, 1323, 1327, 1334, 1339, 1345, 1349, 1357, 1361, 1366, 1371, 1376, 1384, 1388, 1392, 1399, 1403, 1407, 1411, 1416, 1424, 1428, 1435, 1439, 1446, 1450, 1458, 1465, 1470, 1478, 1485, 1492, 1500, 1503, 1511, 1516, 1520, 1525, 1530, 1538, 1544, 1550, 1554, 1558, 1562, 1569, 1575, 1579, 1588, 1592, 1597, 1607, 1618, 1626, 1631, 1636, 1641, 1646, 1651, 1658, 1665, 1670, 1678, 1683, 1688, 1692, 1698, 1704, 1708, 1714, 1722, 1726, 1741, 1745, 1751, 1757, 1764, 1769, 1774, 1779, 1784, 1789, 1797, 1801, 1808, 1812, 1816, 1820, 1825, 1830, 1836, 1841, 1847, 1853, 1857, 1861, 1865, 1869, 1874, 1879, 1884, 1889, 1893, 1897, 1901, 1905, 1909, 1913, 1917, 1921, 1925, 1931, 1935, 1941, 1945, 1949, 1953, 1961, 1966, 1971, 1976, 1981, 1986, 1991, 1996, 2001, 2006, 2011, 2016, 2021, 2028, 2032, 2040, 2044, 2048, 2052, 2056, 2060, 2064, 2071, 2075, 2079, 2087, 2096, 2100, 2104, 2108, 2112, 2116, 2120, 2124, 2129, 2133, 2137, 2141, 2145, 2149, 2154, 2158, 2162, 2166, 2170, 2174, 2179, 2186, 2190, 2194, 2198, 2202, 2206, 2210, 2214, 2218, 2222, 2226, 2230, 2234, 2241, 2246, 2251, 2255, 2259, 2263, 2267, 2271, 2275, 2279, 2283, 2287, 2291 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "\"real_t value\"", "\"real_t variable\"", "\"vector variable\"", "\"function variable\"", "MESHID", "\"scene variable\"", "\"domain variable\"", "\"unkown variable\"", "\"test function variable\"", "VAROFSTREAMID", "\"double\"", "\"vector\"", "\"bool\"", "\"mesh\"", "\"surface mesh\"", "\"structured 3d mesh\"", "\"spectral mesh\"", "\"scene\"", "\"domain\"", "\"unknown\"", "\"unknown list\"", "\"ofstream\"", "\"test function\"", "\"test function list\"", "\"string\"", "\"function\"", "\"reference expression\"", "\"reference map expression\"", "\"function or real\"", "\"field\"", "\"field or function\"", "\" field or function list\"", "\"boundary\"", "\"PDE\"", "\"PDE operator\"", "\"order zero PDE operator\"", "\"order one PDE operator\"", "\"order one vectorial PDE operator\"", "\"order two PDE operator\"", "\"vector PDE operator\"", "\"right hand side\"", "\"problem\"", "\"pde system\"", "\"variational problem\"", "\"Dirichlet boundary conditions\"", "\"Dirichlet boundary condition\"", "\"pde problem\"", "\"boundary condition list\"", "\"boundary condition\"", "\"ostream\"", "TRANSFORM", "SIMPLIFY", "EXTRACT", "PERIODIC", "DXYZ", "DXYZOP", "XYZ", "VECTOR", "\"real\"", "STRING", "SFUNCTION", "FEMFUNCTION", "STRUCTMESH", "SPECTRALMESH", "SURFMESH", "SCENE", "\"using\"", "\"finemesh\"", "\"coarsemesh\"", "IF", "ELSE", "DO", "WHILE", "FOR", "EXIT", "\"<\"", "\">\"", "\"<=\"", "\">=\"", "\"==\"", "\"!=\"", "\"or\"", "\"xor\"", "\"and\"", "\"true\"", "\"false\"", "\"not\"", "\"<<\"", "\">>\"", "\"div\"", "\"grad\"", "\"solve\"", "\"{\"", "\"}\"", "DNU", "CONVECT", "INCR", "DECR", "\"one\"", "\"reference\"", "\"file type\"", "\"file format\"", "\"discretization type\"", "\"save\"", "\"plot\"", "\"cat\"", "\"exec\"", "\"read\"", "\"tetrahedrize\"", "FACE", "OPTION", "INT", "EPSILON", "MAXITER", "KEEPMATRIX", "METHOD", "PENALTY", "FATBOUNDARY", "PDEQ", "TESTS", "IN", "ON", "BY", "INSIDE", "OUTSIDE", "POV", "COUT", "CERR", "ITEMS", "CFUNCTION", "MINMAX", "NORMALCOMPONENT", "NAME", "'='", "'-'", "'+'", "'*'", "'/'", "'%'", "NEG", "'^'", "'('", "')'", "';'", "','", "':'", "'['", "']'", "'.'", "$accept", "input", "instlist", "inst", "simpleinst", "block", "openblockexp", "closeblockexp", "statement", "selectionStatement", "declaration", "affectation", "declareSolve", "otherinst", "fieldorfieldlistexp", "fieldlistexp", "fieldorfunctionexp", "fieldexp", "componentsexp", "ostreamexp", "ofluxexplist", "ofluxexp", "meshexp", "refmapexp", "structured3dmeshexp", "spectralmeshexp", "surfacemeshexp", "sceneexp", "domainexp", "ofstreamexp", "domaindefexp", "inoutexp", "solveopts", "optionlist", "option", "suboptionList", "suboption", "problemexp", "variationalexp", "@1", "testFunctionsExp", "testfunctionlistexp", "testfunctionexp", "variationalFormula", "multiLinearSumExp", "multiLinearFormExp", "multilinearsumexp", "multilinearexp", "linearexp", "elementarylinearexp", "operatorOrFunctionExp", "operatorFunctionExp", "variationalDirichletList", "variationalDirichlet", "pdesystemexp", "pdeproblemexp", "pdeexp", "rightHandSide", "boundaryConditionList", "vectpdeop", "pdeop", "zerothOrderOp", "firstOrderOp", "firstOrderOpSimple", "matricialSecondOrderOp", "vectorialFirstOrderOp", "unknownlistexp", "boundaryCondition", "boundaryexp", "singleBoundaryexp", "unknownexp", "fdexp", "functionexp", "refexp", "vector3exp", "stringexp", "strexp", "realexp", "boolexp", "boolfunctionexp", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 61, 45, 43, 42, 47, 37, 391, 94, 40, 41, 59, 44, 58, 91, 93, 46 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 152, 153, 154, 154, 155, 155, 155, 155, 156, 156, 156, 157, 158, 159, 160, 160, 160, 160, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 164, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 166, 166, 167, 167, 168, 168, 169, 170, 170, 171, 171, 171, 172, 172, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, 176, 177, 178, 178, 179, 179, 179, 180, 180, 180, 181, 181, 182, 182, 182, 182, 182, 183, 183, 184, 184, 185, 185, 186, 187, 187, 188, 188, 189, 189, 191, 190, 192, 193, 193, 194, 195, 195, 196, 196, 196, 196, 197, 197, 198, 198, 198, 198, 199, 199, 199, 199, 199, 200, 200, 200, 201, 201, 201, 201, 201, 202, 202, 203, 203, 204, 204, 205, 206, 206, 207, 208, 209, 210, 210, 211, 211, 211, 211, 211, 212, 212, 212, 212, 212, 212, 213, 213, 213, 214, 214, 214, 215, 216, 217, 217, 217, 217, 217, 217, 217, 218, 218, 219, 219, 219, 219, 219, 219, 219, 219, 220, 220, 221, 221, 221, 221, 222, 222, 222, 222, 222, 222, 223, 223, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 225, 225, 226, 226, 226, 226, 226, 226, 226, 227, 227, 227, 228, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 0, 2, 2, 1, 1, 1, 0, 1, 1, 3, 1, 1, 1, 6, 5, 9, 5, 7, 2, 4, 2, 4, 2, 5, 5, 7, 7, 4, 7, 7, 9, 9, 2, 4, 2, 4, 2, 4, 2, 4, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 3, 5, 5, 5, 7, 9, 11, 11, 13, 9, 7, 3, 2, 2, 2, 5, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 1, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 6, 4, 6, 6, 6, 4, 6, 3, 5, 8, 8, 6, 4, 4, 1, 6, 6, 4, 1, 4, 1, 1, 3, 2, 3, 3, 4, 4, 0, 1, 1, 3, 4, 1, 3, 3, 3, 1, 1, 0, 5, 4, 1, 3, 1, 3, 3, 1, 3, 3, 2, 7, 4, 1, 3, 3, 2, 1, 3, 3, 3, 3, 1, 3, 3, 1, 4, 4, 3, 3, 1, 1, 1, 1, 0, 3, 5, 1, 2, 7, 3, 1, 0, 3, 1, 3, 2, 3, 3, 7, 9, 9, 1, 1, 1, 1, 3, 3, 1, 3, 3, 4, 4, 1, 2, 3, 3, 3, 3, 3, 1, 3, 5, 8, 12, 10, 10, 12, 10, 12, 1, 3, 1, 1, 1, 2, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1, 8, 8, 8, 8, 8, 8, 8, 1, 4, 8, 3, 8, 10, 12, 10, 4, 4, 4, 6, 3, 3, 3, 3, 3, 3, 3, 3, 2, 4, 8, 4, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 10, 3, 5, 7, 1, 7, 3, 3, 3, 3, 1, 3, 3, 1, 1, 1, 4, 8, 7, 9, 7, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 4, 4, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 3, 0, 2, 1, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 80, 81, 4, 0, 6, 3, 7, 15, 10, 11, 0, 8, 83, 44, 46, 0, 0, 0, 0, 0, 0, 0, 35, 39, 41, 25, 23, 21, 0, 0, 37, 107, 0, 0, 0, 68, 67, 0, 0, 0, 9, 0, 69, 0, 45, 47, 0, 0, 0, 0, 5, 9, 0, 0, 286, 287, 236, 0, 227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 228, 0, 0, 0, 43, 276, 0, 0, 48, 0, 49, 226, 225, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 89, 90, 91, 52, 111, 0, 51, 113, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 307, 308, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 221, 219, 0, 203, 0, 0, 0, 0, 0, 285, 0, 282, 0, 14, 12, 121, 0, 0, 55, 302, 304, 0, 0, 301, 303, 0, 0, 0, 0, 0, 0, 0, 256, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 40, 42, 30, 24, 22, 0, 0, 38, 0, 0, 319, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 9, 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 0, 84, 86, 88, 85, 87, 0, 0, 0, 320, 321, 0, 0, 0, 0, 0, 0, 225, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239, 293, 250, 269, 249, 265, 251, 267, 252, 271, 248, 263, 254, 253, 0, 0, 0, 268, 296, 264, 295, 266, 297, 270, 298, 262, 294, 255, 299, 0, 0, 279, 278, 281, 280, 297, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, 0, 0, 0, 106, 318, 310, 309, 311, 312, 313, 314, 315, 316, 317, 19, 0, 17, 0, 70, 224, 222, 220, 204, 0, 0, 58, 0, 56, 283, 284, 57, 0, 0, 0, 121, 257, 0, 78, 0, 332, 226, 225, 0, 246, 245, 0, 0, 0, 0, 0, 0, 244, 0, 0, 0, 237, 0, 0, 0, 0, 0, 259, 305, 0, 0, 0, 306, 0, 288, 0, 0, 0, 0, 98, 0, 0, 0, 0, 105, 0, 0, 94, 0, 225, 0, 110, 112, 0, 0, 0, 0, 0, 9, 16, 9, 0, 0, 0, 0, 0, 126, 0, 0, 0, 131, 132, 130, 170, 124, 0, 0, 77, 0, 331, 323, 322, 325, 324, 326, 327, 328, 329, 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 114, 31, 32, 28, 29, 108, 20, 0, 0, 0, 71, 76, 0, 75, 0, 59, 0, 125, 0, 0, 0, 65, 0, 171, 0, 79, 0, 0, 0, 0, 0, 0, 0, 247, 261, 260, 0, 0, 0, 0, 0, 0, 0, 97, 96, 99, 0, 0, 0, 0, 104, 93, 95, 116, 0, 0, 0, 0, 0, 109, 0, 0, 9, 0, 73, 0, 0, 0, 128, 129, 127, 0, 137, 0, 135, 0, 0, 0, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 290, 0, 292, 0, 0, 0, 0, 0, 0, 0, 0, 275, 277, 0, 100, 0, 0, 0, 0, 115, 118, 117, 33, 34, 18, 72, 0, 0, 60, 0, 0, 134, 0, 0, 0, 143, 167, 0, 0, 0, 64, 258, 238, 0, 0, 240, 0, 0, 0, 0, 0, 229, 230, 231, 232, 233, 234, 235, 289, 0, 102, 103, 119, 120, 74, 0, 0, 0, 188, 0, 0, 0, 0, 0, 0, 177, 187, 186, 191, 185, 0, 0, 136, 165, 166, 0, 0, 0, 0, 0, 0, 0, 146, 150, 155, 158, 0, 0, 217, 0, 213, 215, 216, 133, 138, 139, 142, 141, 0, 273, 0, 0, 0, 291, 0, 101, 62, 0, 61, 0, 0, 179, 256, 300, 0, 0, 0, 175, 0, 0, 0, 0, 0, 0, 0, 0, 149, 256, 300, 0, 0, 0, 0, 0, 0, 145, 0, 0, 0, 218, 0, 0, 0, 0, 0, 241, 0, 243, 272, 0, 0, 0, 0, 0, 196, 0, 226, 225, 0, 0, 0, 178, 0, 0, 172, 0, 0, 173, 174, 181, 180, 189, 192, 251, 267, 190, 193, 266, 297, 0, 163, 164, 0, 162, 154, 161, 148, 147, 151, 152, 153, 156, 157, 214, 0, 0, 168, 274, 0, 63, 194, 0, 197, 256, 300, 0, 0, 0, 0, 0, 195, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 160, 159, 0, 0, 242, 202, 199, 0, 0, 198, 200, 251, 267, 201, 266, 297, 0, 0, 0, 0, 0, 0, 176, 0, 144, 0, 0, 0, 0, 0, 0, 0, 0, 169, 182, 0, 0, 205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 184, 183, 0, 0, 0, 0, 0, 0, 0, 0, 206, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 208, 211, 0, 209, 0, 0, 0, 0, 0, 212, 210, 207 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 1, 2, 38, 39, 40, 41, 176, 42, 43, 44, 45, 46, 47, 516, 570, 517, 518, 391, 48, 89, 274, 127, 495, 128, 129, 130, 70, 134, 137, 506, 507, 270, 271, 272, 454, 455, 458, 459, 529, 460, 580, 581, 584, 585, 586, 686, 687, 688, 689, 784, 690, 698, 748, 461, 462, 668, 772, 769, 669, 670, 671, 672, 673, 674, 760, 164, 770, 694, 695, 165, 288, 107, 589, 696, 172, 173, 116, 155, 397 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -707 static const yytype_int16 yypact[] = { -707, 27, 1478, -707, 110, -83, -30, -21, -4, 9, 41, 55, 109, 125, 130, 137, 178, 182, 226, 237, 5, 195, 231, 139, 2834, 259, 266, -56, 285, -707, 441, 446, 305, 310, 330, 334, -707, -707, -707, 317, -707, -707, -707, -707, -707, -707, 368, -707, -707, -707, -707, 2556, 1846, 2556, 8, 5, 22, 21, 376, 395, 396, 409, 427, 439, 456, 460, 453, -707, 463, 470, 394, -707, -707, 1729, 555, 1729, 2911, 2556, -707, 4, -707, -707, 538, 1660, 569, 569, -707, 2757, 236, -46, -707, -58, -707, 511, -707, 516, 658, 668, 535, 536, 545, 544, 565, -14, -707, 2556, 680, 817, 1012, -707, 2556, 680, 378, 1232, -707, 817, 1012, -707, 567, 576, 577, 584, 587, 588, 590, 591, 592, -707, -707, -707, -707, -707, -707, 594, -707, -707, 596, -707, 8, 22, 21, 2556, 1846, 2556, 8, 8, 5, 5, 569, -707, -707, -707, 1729, 917, -44, -36, 598, 37, 41, 597, 1562, 553, 599, 612, 58, -707, 614, 601, 619, 429, 1012, -707, -105, -707, 16, -707, -707, 633, 645, 250, -707, -707, -707, 2556, 622, -707, -707, 1560, 641, 673, 1660, 2556, 2556, 8, -72, 640, 639, 660, 1602, 2556, 2556, 2556, 2556, 2556, 2556, 1846, 2556, 2556, 2556, 2556, 2556, 2556, 754, 509, 1846, 1846, 2556, 1846, 8, 8, 8, 8, 1846, 1846, 236, 689, 236, 420, 569, -707, -707, -707, -707, 378, 1012, 651, 104, -707, 661, 28, -707, 319, 90, 2556, 2556, 2556, 2556, 2556, 2556, 1729, 1729, 1729, 2834, 1729, 2834, 1729, 664, 710, 711, 723, -707, 4, 569, 725, 685, 8, 688, 2024, 692, 691, 744, 694, -707, 8, -707, 817, 378, 693, 1232, 698, 2556, 700, -707, -707, 1746, 1677, 704, 718, 671, 294, 1232, 122, 708, 709, 158, 717, 1152, 1731, 575, 768, 715, 1729, -707, -707, 556, 341, 556, 341, 274, 295, 274, 295, -72, 640, -72, 640, 586, 331, 806, 556, 341, 556, 341, 274, 295, 274, 295, -72, 640, -72, 640, 2556, 2556, 728, 728, 415, -707, 295, 727, 733, 730, 734, 206, 275, 735, 740, 741, 737, 743, 1677, 751, 155, 75, 764, 766, 798, 805, 622, -707, -707, 295, 295, 295, 295, 295, 1012, 826, 826, -707, 840, 191, -707, -66, -707, -707, -707, -707, -707, 40, 767, -707, 771, -707, -707, 1012, -707, 804, 244, 633, 633, -707, 68, -707, 2556, -707, 660, 509, 230, -707, -707, 2556, 2556, 2556, 2556, 2556, 2556, -707, 1746, 1746, 1746, -707, 8, 569, 813, 775, 2556, -707, -707, 2556, 2556, 778, -707, 2556, -707, 2556, 883, 949, 622, -707, 2556, 2556, 1846, 1846, -707, 8, 569, -707, 8, 1602, 144, -707, -707, 2556, 2556, 779, 780, 781, 2834, -707, 2911, 934, 569, 788, 799, 791, 792, 808, 815, 852, -707, -707, 829, -707, -707, 744, 2556, -707, 966, -707, -707, -707, -707, -707, -707, -707, 880, 880, -707, 820, 534, 818, 2556, 821, 1197, 1780, 1222, 2556, 648, 977, 732, 1048, 2556, 2556, 827, 1798, 297, 268, 314, 328, 828, 123, 830, 144, 835, 836, 144, -63, -707, -707, -707, 845, 846, -707, -707, 838, 225, 837, -707, -707, 404, -707, 245, -707, 2071, -707, 804, 984, 860, -707, 48, -707, 244, -707, 2556, 2556, 8, 2024, 853, 851, 854, -707, -707, -707, 857, 2556, 2556, 2556, 2556, -54, 1812, -707, -707, -707, 2556, 2556, 1846, 1846, -707, -707, -707, -707, 1846, 1846, -18, 144, 144, -707, 2556, 2556, 2834, -31, -707, 8, 861, 900, -707, 1012, -707, 864, -707, 434, -707, 98, 896, 865, 424, -707, 852, 892, 506, 349, 893, 557, 1130, 2556, -707, 2556, -707, 1302, 1829, 1321, 1848, 1381, 1957, 1392, 1973, -707, -707, 398, 1012, 361, 388, 405, 457, -707, 939, -707, -707, -707, -707, -707, 225, 514, -707, 895, 1905, -707, 860, 1254, 752, -707, -707, 6, 896, 896, -707, -707, -707, 2556, 2556, -707, 8, 2556, 8, 902, 907, -707, -707, -707, -707, -707, -707, -707, -707, 2556, -707, -707, -707, -707, -707, 882, 938, 909, -707, 912, 914, 1905, 1796, 913, 475, -707, -707, -707, -707, -707, 1072, 1267, -707, -707, -707, 918, 919, 19, 1319, 1070, 19, 148, 925, -707, -707, -707, 1502, 1419, 941, 190, -707, 378, 1232, 1055, -707, 157, -707, -707, 445, -707, 924, 1141, 927, -707, 1013, 1012, -707, 930, -707, 2139, 2186, -707, -72, 640, 173, 1451, 2037, 1955, 2556, 1905, 1905, 2203, 2251, 2007, 2007, 981, 925, -72, 640, 193, 1460, 2079, 929, 1319, 1319, -707, 1379, 1379, 1379, -707, 752, 947, 946, 951, 2556, -707, 8, -707, -707, 952, 948, 955, 2606, 2303, -707, 218, 1513, 1883, 956, 1547, 2126, -707, 454, 964, -707, 965, 1907, -707, -707, -707, -707, -707, -707, 274, 295, -707, -707, 274, 295, 967, -707, 817, 974, -707, -707, -707, 925, 925, -707, 526, 415, -707, -707, -707, 1254, 2556, -707, -707, 980, -707, -707, 2353, -707, -72, 640, 461, 1491, 2088, 2606, 2606, -707, 2606, 2606, 1100, 2403, 2453, 2556, 1025, 1116, 1955, 2424, 2623, 2623, -707, -707, 520, 1006, -707, -707, -707, 1513, 1883, -707, -707, 274, 295, -707, 274, 295, 989, 991, 992, 1014, 993, 994, -707, 1016, -707, 752, 1017, 1148, 1154, 752, 1163, 503, 1077, 1030, -707, 1033, 1034, 1030, 1036, 2556, 2474, 2539, 1038, 1045, 1047, 1057, 1059, 1058, 1060, 1061, 1062, 1186, -707, -707, 2556, 752, 2556, 1188, 2556, 1190, 1063, 1081, 1030, 1082, 1084, 1097, 1086, 1087, 752, 752, 2556, 752, 2556, 2556, 1030, 1030, 1101, 1030, 1102, 1103, 752, 752, 752, 1030, 1030, 1030 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -707, -707, 1187, -22, -73, -707, -263, -441, -707, -707, -707, -707, -707, -707, -707, -707, -504, -179, -707, -707, -707, -707, -7, -707, -707, -707, -707, -43, -82, 1089, -376, -707, 841, -707, 848, 721, -707, 702, -707, -707, -707, -707, 613, -707, 615, -555, 449, -405, 508, -423, 522, -309, -707, -707, -707, 793, -707, -707, 428, -403, -707, -707, -657, -706, -707, -428, -707, -707, -462, 510, 995, 527, 418, -707, 82, -81, 986, -51, -28, -171 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -10 static const yytype_int16 yytable[] = { 108, 113, 74, 159, 174, 281, 178, 387, 759, 699, 161, 571, 131, 67, 162, 117, 291, 528, 249, 250, 251, 564, 154, 565, 154, 606, 160, 3, 630, 678, 679, 132, 170, 135, 243, 244, 245, 246, 247, 248, 266, 181, 182, 133, 179, 136, 267, 157, 249, 250, 251, 759, 759, 52, 195, 198, 351, 230, 68, 212, 213, 118, 119, 120, 121, 620, 564, 239, 565, 777, 781, 204, 205, 122, 123, 124, 168, 680, 701, 702, 449, 177, 566, 206, 207, 208, 209, 210, 77, 211, 78, 113, 234, 206, 207, 208, 209, 210, 277, 211, 180, 154, 241, 237, 238, 287, 53, 759, 759, 252, 759, 759, 681, 394, 682, 54, 621, 659, 125, 126, 582, 249, 250, 251, 240, 242, 560, 614, 278, 563, 192, 229, 55, 69, 112, 193, 290, 235, 236, 163, 297, 299, 345, 583, 348, 56, 635, 352, 305, 307, 309, 311, 313, 315, 318, 320, 322, 324, 326, 328, 330, 268, 582, 113, 113, 335, 337, 267, 685, 777, 781, 113, 113, 358, 249, 250, 251, 57, 446, 267, 286, 378, 254, 294, 350, 583, 300, 450, 615, 616, 58, 267, 360, 361, 362, 363, 364, 365, 154, 154, 154, 531, 154, 260, 154, 261, 407, 408, 409, 49, 50, 338, 339, 340, 341, 465, 384, 344, 466, 347, 441, 366, 367, 368, 233, 370, 267, 372, 90, 91, 369, 92, 371, 502, 396, 359, 475, 476, 477, 407, 408, 409, 628, 117, 59, 132, 51, 629, 493, 354, 154, 355, 356, 90, 91, 109, 92, 133, 381, 730, 60, 276, 737, 716, 719, 61, 389, 410, 558, 289, 503, 504, 62, 421, 267, 249, 250, 251, 731, 734, 425, 426, 93, 73, 94, 738, 739, 317, 505, 118, 119, 120, 121, 740, 633, 634, 333, 334, 438, 336, 440, 122, 123, 124, 342, 343, 413, 93, 414, 94, 724, 725, 171, 63, 407, 408, 409, 64, 766, 796, 797, 774, 775, 95, 96, 97, 98, 99, 110, 807, 810, 479, 741, 791, 792, 100, 448, 745, 789, 101, 746, 71, 467, 214, 215, 216, 125, 126, 95, 96, 97, 98, 99, 431, 500, 813, 814, 102, 103, 104, 100, 65, 105, 815, 101, 456, 457, 484, 170, 106, 521, 488, 66, 490, 280, 468, 514, 72, 494, 496, 113, 113, 102, 103, 104, 834, 837, 105, 838, 841, 558, 861, 535, 536, 111, 865, 267, 243, 244, 245, 246, 247, 248, 75, 478, 206, 207, 208, 209, 210, 76, 211, 214, 215, 216, 203, 554, 204, 205, 785, 785, 890, 432, 90, 91, 513, 92, 499, 67, 79, 501, 214, 215, 216, 902, 903, 210, 905, 211, 406, 548, 549, 552, 519, 553, 80, 911, 912, 913, 82, 81, 214, 215, 216, 83, 592, 206, 207, 208, 209, 210, 555, 211, 86, 303, 214, 215, 216, 214, 215, 216, 115, 576, 68, 84, 556, 423, 93, 85, 94, 208, 209, 210, 590, 211, 593, 206, 207, 208, 209, 210, 88, 211, 599, 601, 603, 605, 639, 214, 215, 216, 169, 608, 609, 113, 113, 655, 282, 283, 284, 113, 113, 138, 497, 498, 214, 215, 216, 95, 96, 97, 98, 99, 194, 197, 214, 215, 216, 591, 197, 100, 139, 140, 656, 101, 206, 207, 208, 209, 210, 149, 211, 214, 215, 216, 141, 654, 619, 69, 573, 657, 574, 102, 103, 104, 209, 210, 105, 211, 115, 632, 633, 634, 142, 349, 622, 199, 200, 201, 202, 203, 197, 204, 205, 676, 143, 265, 692, 697, 626, 114, 627, 206, 207, 208, 209, 210, 703, 211, 146, 821, 706, 822, 749, 214, 215, 216, 275, 813, 814, 144, 115, 658, 710, 145, 115, 833, 147, 115, 296, 298, 723, 724, 725, 148, 718, 721, 304, 306, 308, 310, 312, 314, 316, 319, 321, 323, 325, 327, 329, 156, 171, 733, 736, 705, 323, 707, 610, 611, 867, 868, 869, 166, 612, 613, 115, 206, 207, 208, 209, 210, 637, 211, 638, 303, 183, 332, 738, 739, 660, 184, 661, 185, 762, 765, 852, 202, 203, 232, 204, 205, 170, 186, 676, 676, 779, 783, 170, 170, 187, 188, 535, 536, 90, 91, 267, 92, 692, 692, 189, 795, 309, 324, 190, 697, 201, 202, 203, 115, 204, 205, 257, 115, 395, 641, 642, 809, 812, 267, 191, 279, 218, 199, 200, 201, 202, 203, 295, 204, 205, 219, 220, 418, 199, 200, 201, 202, 203, 221, 204, 205, 222, 223, 422, 224, 225, 226, 93, 227, 94, 228, 196, 253, 255, 803, 263, 269, 258, 692, 400, 401, 402, 403, 404, 405, 90, 91, 109, 92, 693, 259, 262, 836, 836, 264, 840, 843, 395, 309, 324, 273, 280, 292, 170, 309, 779, 783, 293, 95, 96, 97, 98, 99, 211, 301, 199, 200, 201, 202, 203, 100, 204, 205, 346, 101, 544, 353, 199, 200, 201, 202, 203, 697, 204, 205, 302, 697, 392, 357, 93, 373, 94, 102, 103, 104, 374, 375, 105, 115, 115, 115, 115, 115, 115, 106, 115, 115, 115, 376, 379, 110, 380, 697, 115, 382, 386, 483, 485, 385, 29, 487, 388, 489, 390, 267, 697, 697, 393, 697, 398, 95, 96, 97, 98, 99, 411, 412, 697, 697, 697, 115, 115, 100, 399, 415, 420, 101, 216, 115, 199, 200, 201, 202, 203, 427, 204, 205, 429, 428, 546, 433, 430, 436, 115, 102, 103, 104, 434, 435, 105, 437, 206, 207, 208, 209, 210, 111, 211, 439, 115, 442, 331, 443, 444, 115, 206, 207, 208, 209, 210, 445, 211, 251, 447, 451, 419, 452, 453, 480, 481, 90, 91, 486, 92, 510, 511, 512, 469, 470, 471, 472, 473, 474, 115, 522, 523, 524, 90, 91, 525, 92, 117, 482, 206, 207, 217, 209, 210, 175, 211, 456, 115, 526, 424, 199, 200, 201, 202, 203, 527, 204, 205, 598, 600, 602, 604, 409, 534, 537, 508, 509, 539, 550, 557, 93, 559, 94, 520, 196, 561, 562, 567, 568, 569, 572, 115, 115, 118, 119, 120, 121, 93, 532, 94, 578, 579, 595, 594, 596, 122, 123, 124, 597, 624, 150, 151, 152, 623, 538, 625, 582, 631, 115, 543, 115, 95, 96, 97, 98, 99, 206, 207, 208, 209, 210, 565, 211, 100, 711, 515, 491, 101, 95, 96, 97, 98, 99, 636, 640, 115, 662, 712, 520, 675, 167, 126, 691, 708, 101, 102, 103, 104, 709, 744, 105, 713, 714, 115, 715, 722, 588, 153, 728, 729, 741, 747, 102, 103, 104, 750, 753, 105, 752, 90, 91, 754, 92, 788, 106, 790, 678, 679, 800, 280, 717, 720, 206, 207, 208, 209, 210, 799, 211, 805, 617, 618, 492, 801, 804, 806, 818, 732, 735, 206, 207, 208, 209, 210, 823, 211, 844, 824, 828, 533, 206, 207, 208, 209, 210, 829, 211, 644, 848, 645, 545, 832, 849, 93, 680, 94, 853, 196, 761, 764, 854, 855, 856, 858, 857, 859, 771, 115, 675, 675, 778, 782, 786, 786, 520, 206, 207, 208, 209, 210, 860, 211, 691, 691, 863, 794, 308, 323, 862, 681, 864, 682, 704, 115, 95, 96, 97, 98, 99, 866, 870, 808, 811, 745, 871, 872, 100, 873, 879, 883, 101, 206, 207, 208, 209, 210, 880, 211, 881, 882, 884, 547, 888, 886, 892, 885, 894, 887, 102, 103, 104, 896, 897, 105, 895, 199, 200, 726, 202, 203, 684, 204, 205, 691, 115, 685, 898, 899, 900, 901, 115, 908, 909, 910, 87, 231, 464, 835, 835, 587, 839, 842, 463, 308, 323, 115, 677, 279, 771, 308, 778, 782, 577, 700, 830, 793, 773, 787, 850, 383, 530, 798, 377, 90, 91, 0, 92, 0, 0, 0, 678, 679, 0, 206, 207, 208, 209, 210, 0, 211, 0, 0, 802, 643, 206, 207, 208, 209, 210, 0, 211, 115, 115, 115, 751, 199, 200, 201, 202, 203, 0, 204, 205, 416, 0, 0, 115, 0, 115, 0, 115, 0, 0, 0, 0, 0, 0, 93, 680, 94, 0, 0, 115, 0, 115, 115, 0, 0, 90, 91, 0, 92, 0, 831, 0, 678, 679, 0, 0, 279, 199, 200, 201, 202, 203, 0, 204, 205, 540, 0, 0, 0, 0, 681, 847, 682, 0, 0, 95, 96, 97, 98, 99, 0, 0, 199, 200, 201, 202, 203, 100, 204, 205, 542, 101, 206, 207, 217, 209, 210, 0, 211, 93, 680, 94, 0, 0, 0, 90, 91, 0, 92, 102, 103, 104, 678, 679, 683, 0, 0, 874, 876, 878, 0, 684, 0, 0, 0, 0, 685, 206, 207, 727, 209, 210, 889, 211, 891, 681, 893, 682, 0, 0, 95, 96, 97, 98, 99, 0, 0, 0, 904, 0, 906, 907, 100, 0, 0, 0, 101, 0, 0, 93, 680, 94, 199, 200, 201, 202, 203, 0, 204, 205, 646, 0, 0, 0, 102, 103, 104, 0, 0, 105, 0, 199, 200, 201, 202, 203, 684, 204, 205, 648, 0, 685, 0, 0, 0, 681, 0, 682, 0, 0, 95, 96, 97, 98, 99, 4, 5, 6, 7, 8, 9, 0, 100, 10, 0, 0, 101, 11, 0, 0, 0, 0, 12, 0, 0, 13, 0, 0, 0, 14, 0, 0, 0, 0, 102, 103, 104, 0, 0, 105, 0, 199, 200, 201, 202, 203, 106, 204, 205, 650, 0, 685, 199, 200, 201, 202, 203, 0, 204, 205, 652, 15, 16, 0, 17, 18, 0, 0, 0, 19, 20, 21, 22, 23, 0, 24, 25, 26, 27, 206, 207, 743, 209, 210, 0, 211, 90, 91, 109, 92, 117, 0, 132, 0, 0, 28, 29, 0, 0, 0, 30, 31, 0, 0, 133, 0, 0, 32, 33, 34, 35, 199, 200, 726, 202, 203, 0, 204, 205, 302, 199, 200, 742, 202, 203, 0, 204, 205, 302, 0, 36, 37, 0, 0, 0, 0, 118, 119, 120, 121, 93, 0, 94, 0, 0, 0, 0, -9, 122, 123, 124, 199, 200, 816, 202, 203, 0, 204, 205, 302, 0, 110, 199, 200, 742, 202, 203, 0, 204, 205, 282, 283, 284, 199, 200, 816, 202, 203, 0, 204, 205, 95, 96, 97, 98, 99, 90, 91, 0, 92, 117, 0, 0, 167, 126, 0, 0, 101, 0, 0, 0, 0, 0, 90, 91, 0, 92, 199, 200, 819, 202, 203, 0, 204, 205, 102, 103, 104, 0, 0, 105, 0, 206, 207, 208, 209, 210, 285, 211, 0, 256, 0, 0, 0, 0, 0, 118, 119, 120, 121, 93, 0, 94, 0, 0, 0, 0, 0, 122, 123, 124, 0, 0, 0, 0, 90, 91, 93, 92, 94, 0, 196, 206, 207, 208, 209, 210, 0, 211, 0, 303, 0, 90, 91, 0, 92, 0, 0, 0, 0, 0, 95, 96, 97, 98, 99, 0, 282, 283, 284, 0, 0, 0, 167, 126, 0, 0, 101, 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, 0, 93, 100, 94, 0, 0, 101, 102, 103, 104, 0, 0, 105, 0, 90, 91, 0, 92, 93, 106, 94, 663, 0, 0, 102, 103, 104, 0, 0, 105, 0, 150, 151, 152, 0, 0, 349, 0, 0, 0, 0, 0, 95, 96, 97, 98, 99, 0, 282, 283, 284, 0, 0, 0, 100, 0, 0, 0, 101, 95, 96, 97, 98, 99, 90, 91, 109, 92, 664, 0, 94, 100, 196, 0, 0, 101, 102, 103, 104, 0, 0, 105, 0, 206, 207, 208, 209, 210, 153, 211, 0, 417, 0, 102, 103, 104, 0, 0, 105, 0, 0, 0, 0, 665, 0, 349, 0, 0, 0, 95, 96, 97, 98, 99, 0, 0, 0, 0, 93, 0, 94, 100, 0, 90, 91, 101, 92, 0, 0, 0, 663, 0, 206, 207, 208, 209, 210, 0, 211, 110, 541, 0, 0, 102, 103, 104, 0, 0, 666, 0, 206, 207, 208, 209, 210, 667, 211, 0, 551, 95, 96, 97, 98, 99, 206, 207, 208, 209, 210, 0, 211, 100, 607, 90, 91, 101, 92, 664, 0, 94, 767, 206, 207, 208, 209, 210, 0, 211, 0, 647, 0, 0, 0, 102, 103, 104, 0, 0, 105, 0, 206, 207, 208, 209, 210, 111, 211, 0, 649, 0, 0, 0, 665, 0, 0, 0, 0, 0, 95, 96, 97, 98, 99, 0, 0, 90, 91, 93, 92, 94, 100, 0, 678, 679, 101, 206, 207, 817, 209, 210, 0, 211, 90, 91, 0, 92, 0, 0, 0, 0, 0, 0, 102, 103, 104, 0, 0, 666, 0, 199, 200, 825, 202, 203, 667, 204, 205, 768, 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, 0, 93, 100, 94, 0, 0, 101, 0, 0, 0, 0, 90, 91, 0, 92, 0, 0, 0, 93, 0, 94, 0, 0, 171, 102, 103, 104, 0, 0, 105, 0, 206, 207, 208, 209, 210, 106, 211, 0, 651, 0, 0, 95, 96, 97, 98, 99, 206, 207, 208, 209, 210, 0, 211, 100, 653, 0, 0, 101, 95, 96, 97, 98, 99, 0, 93, 0, 94, 0, 0, 0, 100, 0, 0, 0, 101, 102, 103, 104, 90, 91, 105, 92, 0, 0, 0, 755, 0, 106, 0, 0, 0, 0, 102, 103, 104, 0, 0, 105, 0, 0, 0, 0, 0, 0, 106, 95, 96, 97, 98, 99, 206, 207, 727, 209, 210, 0, 211, 100, 303, 0, 575, 101, 0, 0, 0, 90, 91, 0, 92, 0, 0, 0, 756, 0, 94, 0, 0, 0, 0, 102, 103, 104, 90, 91, 105, 92, 0, 0, 0, 776, 0, 106, 206, 207, 743, 209, 210, 0, 211, 0, 303, 206, 207, 817, 209, 210, 0, 211, 0, 303, 0, 0, 0, 95, 96, 97, 98, 99, 0, 93, 0, 94, 0, 0, 0, 100, 0, 0, 0, 101, 90, 91, 0, 92, 0, 0, 756, 780, 94, 206, 207, 820, 209, 210, 0, 211, 0, 102, 103, 104, 0, 0, 757, 0, 0, 763, 0, 0, 0, 758, 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 101, 95, 96, 97, 98, 99, 90, 91, 756, 92, 94, 0, 0, 100, 0, 0, 0, 101, 102, 103, 104, 0, 0, 105, 0, 0, 0, 0, 0, 0, 106, 0, 0, 0, 0, 102, 103, 104, 0, 0, 105, 0, 0, 0, 0, 0, 0, 106, 0, 95, 96, 97, 98, 99, 0, 0, 90, 91, 0, 92, 756, 100, 94, 755, 196, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 103, 104, 0, 0, 105, 0, 0, 0, 0, 0, 0, 106, 0, 0, 0, 0, 0, 95, 96, 97, 98, 99, 90, 91, 0, 92, 93, 0, 94, 100, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 91, 0, 92, 0, 0, 0, 851, 102, 103, 104, 0, 0, 757, 0, 0, 0, 0, 0, 0, 758, 0, 0, 0, 95, 96, 97, 98, 99, 90, 91, 0, 92, 93, 0, 94, 100, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 91, 0, 92, 93, 0, 94, 875, 102, 103, 104, 0, 0, 105, 0, 0, 0, 0, 0, 845, 106, 0, 0, 0, 95, 96, 97, 98, 99, 0, 0, 0, 0, 93, 0, 94, 100, 0, 0, 0, 101, 0, 0, 0, 0, 95, 96, 97, 98, 99, 0, 0, 0, 0, 93, 0, 94, 100, 102, 103, 104, 101, 0, 105, 0, 90, 91, 0, 92, 846, 106, 0, 877, 0, 95, 96, 97, 98, 99, 102, 103, 104, 90, 91, 105, 92, 100, 0, 0, 0, 101, 106, 0, 0, 0, 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, 0, 0, 100, 102, 103, 104, 101, 0, 105, 0, 0, 0, 0, 0, 93, 106, 94, 0, 0, 0, 0, 0, 0, 0, 102, 103, 104, 90, 91, 105, 92, 93, 0, 94, 0, 0, 106, 0, 0, 0, 0, 0, 0, 0, 90, 91, 0, 92, 0, 0, 0, 0, 0, 0, 0, 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 101, 95, 96, 97, 98, 99, 0, 0, 0, 0, 756, 0, 94, 100, 0, 0, 0, 101, 102, 103, 104, 0, 0, 105, 0, 0, 0, 756, 0, 94, 106, 0, 0, 0, 0, 102, 103, 104, 0, 0, 105, 0, 0, 0, 0, 0, 0, 106, 0, 0, 0, 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 101, 95, 96, 97, 98, 99, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 101, 102, 103, 104, 0, 0, 757, 0, 0, 0, 0, 0, 0, 758, 0, 0, 0, 0, 102, 103, 104, 0, 0, 105, 4, 5, 6, 7, 8, 9, 106, 0, 10, 0, 0, 0, 11, 0, 0, 0, 0, 12, 0, 0, 13, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 16, 0, 17, 18, 0, 0, 0, 19, 20, 21, 22, 23, 0, 24, 25, 26, 27, 0, 0, 0, 4, 5, 6, 7, 8, 9, 0, 0, 10, 0, 0, 0, 11, 28, 29, 175, 0, 12, 30, 31, 13, 0, 0, 0, 14, 32, 33, 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 37, 0, 0, 0, 0, 0, 0, 15, 16, 0, 17, 18, 0, 0, 0, 19, 20, 21, 22, 23, 0, 24, 25, 26, 27, 0, 0, 0, 4, 5, 6, 7, 8, 9, 0, 0, 158, 0, 0, 0, 11, 28, 29, 0, 0, 12, 30, 31, 13, 0, 0, 0, 14, 32, 33, 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 37, 0, 0, 0, 0, 0, 0, 15, 16, 0, 17, 18, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31 }; static const yytype_int16 yycheck[] = { 51, 52, 24, 76, 85, 184, 88, 270, 714, 3, 6, 515, 55, 8, 10, 7, 187, 458, 84, 85, 86, 84, 73, 86, 75, 79, 77, 0, 583, 10, 11, 9, 83, 12, 78, 79, 80, 81, 82, 83, 145, 99, 100, 21, 90, 24, 151, 75, 84, 85, 86, 757, 758, 136, 105, 106, 227, 139, 53, 110, 111, 53, 54, 55, 56, 96, 84, 148, 86, 726, 727, 143, 144, 65, 66, 67, 83, 58, 633, 634, 146, 88, 145, 137, 138, 139, 140, 141, 144, 143, 146, 142, 143, 137, 138, 139, 140, 141, 179, 143, 146, 152, 153, 146, 147, 187, 136, 813, 814, 145, 816, 817, 93, 284, 95, 136, 147, 621, 110, 111, 114, 84, 85, 86, 152, 153, 502, 145, 179, 505, 144, 138, 136, 128, 52, 149, 187, 144, 145, 135, 191, 192, 224, 137, 226, 136, 587, 228, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 145, 114, 214, 215, 216, 217, 151, 149, 826, 827, 222, 223, 145, 84, 85, 86, 136, 357, 151, 187, 262, 145, 190, 227, 137, 193, 147, 564, 565, 135, 151, 243, 244, 245, 246, 247, 248, 249, 250, 251, 464, 253, 145, 255, 147, 84, 85, 86, 99, 100, 218, 219, 220, 221, 147, 267, 224, 150, 226, 145, 249, 250, 251, 142, 253, 151, 255, 3, 4, 252, 6, 254, 89, 285, 145, 407, 408, 409, 84, 85, 86, 144, 7, 135, 9, 136, 149, 427, 145, 301, 147, 148, 3, 4, 5, 6, 21, 265, 682, 135, 179, 685, 666, 667, 135, 273, 145, 145, 187, 126, 127, 135, 301, 151, 84, 85, 86, 683, 684, 331, 332, 57, 144, 59, 137, 138, 205, 144, 53, 54, 55, 56, 145, 137, 138, 214, 215, 349, 217, 145, 65, 66, 67, 222, 223, 148, 57, 150, 59, 137, 138, 62, 135, 84, 85, 86, 135, 145, 742, 743, 724, 725, 98, 99, 100, 101, 102, 78, 757, 758, 412, 139, 738, 739, 110, 145, 147, 145, 114, 150, 146, 393, 137, 138, 139, 110, 111, 98, 99, 100, 101, 102, 147, 435, 137, 138, 132, 133, 134, 110, 135, 137, 145, 114, 121, 122, 418, 419, 144, 451, 422, 135, 424, 149, 145, 449, 146, 429, 430, 431, 432, 132, 133, 134, 813, 814, 137, 816, 817, 145, 853, 147, 148, 144, 857, 151, 78, 79, 80, 81, 82, 83, 144, 411, 137, 138, 139, 140, 141, 144, 143, 137, 138, 139, 141, 148, 143, 144, 728, 729, 883, 147, 3, 4, 447, 6, 434, 8, 144, 437, 137, 138, 139, 896, 897, 141, 899, 143, 145, 491, 492, 145, 450, 147, 4, 908, 909, 910, 144, 4, 137, 138, 139, 144, 536, 137, 138, 139, 140, 141, 147, 143, 146, 145, 137, 138, 139, 137, 138, 139, 53, 523, 53, 144, 147, 145, 57, 144, 59, 139, 140, 141, 534, 143, 536, 137, 138, 139, 140, 141, 123, 143, 544, 545, 546, 547, 148, 137, 138, 139, 83, 553, 554, 555, 556, 145, 87, 88, 89, 561, 562, 136, 431, 432, 137, 138, 139, 98, 99, 100, 101, 102, 105, 106, 137, 138, 139, 535, 111, 110, 136, 136, 145, 114, 137, 138, 139, 140, 141, 146, 143, 137, 138, 139, 136, 148, 569, 128, 145, 145, 147, 132, 133, 134, 140, 141, 137, 143, 141, 136, 137, 138, 136, 144, 572, 137, 138, 139, 140, 141, 153, 143, 144, 625, 136, 147, 628, 629, 145, 53, 147, 137, 138, 139, 140, 141, 638, 143, 136, 136, 642, 138, 148, 137, 138, 139, 179, 137, 138, 144, 183, 145, 654, 144, 187, 145, 144, 190, 191, 192, 136, 137, 138, 144, 666, 667, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 75, 62, 683, 684, 641, 217, 643, 555, 556, 136, 137, 138, 104, 561, 562, 227, 137, 138, 139, 140, 141, 145, 143, 147, 145, 144, 147, 137, 138, 145, 144, 147, 4, 714, 715, 145, 140, 141, 141, 143, 144, 722, 4, 724, 725, 726, 727, 728, 729, 144, 144, 147, 148, 3, 4, 151, 6, 738, 739, 144, 741, 742, 743, 149, 745, 139, 140, 141, 280, 143, 144, 148, 284, 285, 147, 148, 757, 758, 151, 144, 183, 144, 137, 138, 139, 140, 141, 190, 143, 144, 144, 144, 147, 137, 138, 139, 140, 141, 144, 143, 144, 144, 144, 147, 144, 144, 144, 57, 144, 59, 144, 61, 144, 146, 751, 144, 113, 148, 799, 78, 79, 80, 81, 82, 83, 3, 4, 5, 6, 7, 148, 147, 813, 814, 145, 816, 817, 349, 819, 820, 125, 149, 131, 824, 825, 826, 827, 104, 98, 99, 100, 101, 102, 143, 145, 137, 138, 139, 140, 141, 110, 143, 144, 104, 114, 147, 145, 137, 138, 139, 140, 141, 853, 143, 144, 145, 857, 280, 147, 57, 146, 59, 132, 133, 134, 105, 105, 137, 400, 401, 402, 403, 404, 405, 144, 407, 408, 409, 105, 104, 78, 146, 883, 415, 146, 144, 418, 419, 146, 95, 422, 147, 424, 145, 151, 896, 897, 147, 899, 145, 98, 99, 100, 101, 102, 147, 147, 908, 909, 910, 442, 443, 110, 145, 147, 150, 114, 139, 450, 137, 138, 139, 140, 141, 147, 143, 144, 147, 145, 147, 145, 147, 145, 465, 132, 133, 134, 147, 147, 137, 147, 137, 138, 139, 140, 141, 144, 143, 147, 481, 136, 147, 136, 105, 486, 137, 138, 139, 140, 141, 105, 143, 86, 73, 147, 147, 145, 113, 105, 144, 3, 4, 144, 6, 145, 145, 145, 400, 401, 402, 403, 404, 405, 515, 146, 136, 145, 3, 4, 147, 6, 7, 415, 137, 138, 139, 140, 141, 96, 143, 121, 533, 144, 147, 137, 138, 139, 140, 141, 144, 143, 144, 544, 545, 546, 547, 86, 147, 150, 442, 443, 150, 145, 145, 57, 145, 59, 450, 61, 144, 144, 136, 136, 145, 147, 567, 568, 53, 54, 55, 56, 57, 465, 59, 10, 135, 145, 144, 144, 65, 66, 67, 145, 103, 87, 88, 89, 146, 481, 145, 114, 146, 594, 486, 596, 98, 99, 100, 101, 102, 137, 138, 139, 140, 141, 86, 143, 110, 146, 95, 147, 114, 98, 99, 100, 101, 102, 145, 145, 621, 145, 103, 515, 625, 110, 111, 628, 145, 114, 132, 133, 134, 145, 112, 137, 146, 144, 639, 144, 146, 533, 144, 144, 144, 139, 10, 132, 133, 134, 145, 57, 137, 145, 3, 4, 145, 6, 96, 144, 150, 10, 11, 136, 149, 666, 667, 137, 138, 139, 140, 141, 144, 143, 145, 567, 568, 147, 146, 146, 144, 144, 683, 684, 137, 138, 139, 140, 141, 144, 143, 10, 146, 145, 147, 137, 138, 139, 140, 141, 145, 143, 594, 97, 596, 147, 145, 10, 57, 58, 59, 124, 61, 714, 715, 145, 144, 144, 144, 124, 145, 722, 723, 724, 725, 726, 727, 728, 729, 621, 137, 138, 139, 140, 141, 138, 143, 738, 739, 10, 741, 742, 743, 145, 93, 10, 95, 639, 749, 98, 99, 100, 101, 102, 10, 97, 757, 758, 147, 145, 145, 110, 145, 144, 124, 114, 137, 138, 139, 140, 141, 145, 143, 145, 136, 136, 147, 10, 136, 10, 139, 10, 139, 132, 133, 134, 124, 124, 137, 145, 137, 138, 139, 140, 141, 144, 143, 144, 799, 800, 149, 136, 124, 136, 136, 806, 124, 124, 124, 41, 140, 389, 813, 814, 531, 816, 817, 388, 819, 820, 821, 627, 714, 824, 825, 826, 827, 525, 632, 799, 741, 723, 729, 824, 267, 461, 745, 261, 3, 4, -1, 6, -1, -1, -1, 10, 11, -1, 137, 138, 139, 140, 141, -1, 143, -1, -1, 749, 147, 137, 138, 139, 140, 141, -1, 143, 867, 868, 869, 147, 137, 138, 139, 140, 141, -1, 143, 144, 145, -1, -1, 882, -1, 884, -1, 886, -1, -1, -1, -1, -1, -1, 57, 58, 59, -1, -1, 898, -1, 900, 901, -1, -1, 3, 4, -1, 6, -1, 800, -1, 10, 11, -1, -1, 806, 137, 138, 139, 140, 141, -1, 143, 144, 145, -1, -1, -1, -1, 93, 821, 95, -1, -1, 98, 99, 100, 101, 102, -1, -1, 137, 138, 139, 140, 141, 110, 143, 144, 145, 114, 137, 138, 139, 140, 141, -1, 143, 57, 58, 59, -1, -1, -1, 3, 4, -1, 6, 132, 133, 134, 10, 11, 137, -1, -1, 867, 868, 869, -1, 144, -1, -1, -1, -1, 149, 137, 138, 139, 140, 141, 882, 143, 884, 93, 886, 95, -1, -1, 98, 99, 100, 101, 102, -1, -1, -1, 898, -1, 900, 901, 110, -1, -1, -1, 114, -1, -1, 57, 58, 59, 137, 138, 139, 140, 141, -1, 143, 144, 145, -1, -1, -1, 132, 133, 134, -1, -1, 137, -1, 137, 138, 139, 140, 141, 144, 143, 144, 145, -1, 149, -1, -1, -1, 93, -1, 95, -1, -1, 98, 99, 100, 101, 102, 4, 5, 6, 7, 8, 9, -1, 110, 12, -1, -1, 114, 16, -1, -1, -1, -1, 21, -1, -1, 24, -1, -1, -1, 28, -1, -1, -1, -1, 132, 133, 134, -1, -1, 137, -1, 137, 138, 139, 140, 141, 144, 143, 144, 145, -1, 149, 137, 138, 139, 140, 141, -1, 143, 144, 145, 60, 61, -1, 63, 64, -1, -1, -1, 68, 69, 70, 71, 72, -1, 74, 75, 76, 77, 137, 138, 139, 140, 141, -1, 143, 3, 4, 5, 6, 7, -1, 9, -1, -1, 94, 95, -1, -1, -1, 99, 100, -1, -1, 21, -1, -1, 106, 107, 108, 109, 137, 138, 139, 140, 141, -1, 143, 144, 145, 137, 138, 139, 140, 141, -1, 143, 144, 145, -1, 129, 130, -1, -1, -1, -1, 53, 54, 55, 56, 57, -1, 59, -1, -1, -1, -1, 146, 65, 66, 67, 137, 138, 139, 140, 141, -1, 143, 144, 145, -1, 78, 137, 138, 139, 140, 141, -1, 143, 144, 87, 88, 89, 137, 138, 139, 140, 141, -1, 143, 144, 98, 99, 100, 101, 102, 3, 4, -1, 6, 7, -1, -1, 110, 111, -1, -1, 114, -1, -1, -1, -1, -1, 3, 4, -1, 6, 137, 138, 139, 140, 141, -1, 143, 144, 132, 133, 134, -1, -1, 137, -1, 137, 138, 139, 140, 141, 144, 143, -1, 145, -1, -1, -1, -1, -1, 53, 54, 55, 56, 57, -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, -1, -1, -1, -1, 3, 4, 57, 6, 59, -1, 61, 137, 138, 139, 140, 141, -1, 143, -1, 145, -1, 3, 4, -1, 6, -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, -1, 87, 88, 89, -1, -1, -1, 110, 111, -1, -1, 114, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 57, 110, 59, -1, -1, 114, 132, 133, 134, -1, -1, 137, -1, 3, 4, -1, 6, 57, 144, 59, 10, -1, -1, 132, 133, 134, -1, -1, 137, -1, 87, 88, 89, -1, -1, 144, -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, -1, 87, 88, 89, -1, -1, -1, 110, -1, -1, -1, 114, 98, 99, 100, 101, 102, 3, 4, 5, 6, 57, -1, 59, 110, 61, -1, -1, 114, 132, 133, 134, -1, -1, 137, -1, 137, 138, 139, 140, 141, 144, 143, -1, 145, -1, 132, 133, 134, -1, -1, 137, -1, -1, -1, -1, 92, -1, 144, -1, -1, -1, 98, 99, 100, 101, 102, -1, -1, -1, -1, 57, -1, 59, 110, -1, 3, 4, 114, 6, -1, -1, -1, 10, -1, 137, 138, 139, 140, 141, -1, 143, 78, 145, -1, -1, 132, 133, 134, -1, -1, 137, -1, 137, 138, 139, 140, 141, 144, 143, -1, 145, 98, 99, 100, 101, 102, 137, 138, 139, 140, 141, -1, 143, 110, 145, 3, 4, 114, 6, 57, -1, 59, 10, 137, 138, 139, 140, 141, -1, 143, -1, 145, -1, -1, -1, 132, 133, 134, -1, -1, 137, -1, 137, 138, 139, 140, 141, 144, 143, -1, 145, -1, -1, -1, 92, -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, -1, -1, 3, 4, 57, 6, 59, 110, -1, 10, 11, 114, 137, 138, 139, 140, 141, -1, 143, 3, 4, -1, 6, -1, -1, -1, -1, -1, -1, 132, 133, 134, -1, -1, 137, -1, 137, 138, 139, 140, 141, 144, 143, 144, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 57, 110, 59, -1, -1, 114, -1, -1, -1, -1, 3, 4, -1, 6, -1, -1, -1, 57, -1, 59, -1, -1, 62, 132, 133, 134, -1, -1, 137, -1, 137, 138, 139, 140, 141, 144, 143, -1, 145, -1, -1, 98, 99, 100, 101, 102, 137, 138, 139, 140, 141, -1, 143, 110, 145, -1, -1, 114, 98, 99, 100, 101, 102, -1, 57, -1, 59, -1, -1, -1, 110, -1, -1, -1, 114, 132, 133, 134, 3, 4, 137, 6, -1, -1, -1, 10, -1, 144, -1, -1, -1, -1, 132, 133, 134, -1, -1, 137, -1, -1, -1, -1, -1, -1, 144, 98, 99, 100, 101, 102, 137, 138, 139, 140, 141, -1, 143, 110, 145, -1, 113, 114, -1, -1, -1, 3, 4, -1, 6, -1, -1, -1, 57, -1, 59, -1, -1, -1, -1, 132, 133, 134, 3, 4, 137, 6, -1, -1, -1, 10, -1, 144, 137, 138, 139, 140, 141, -1, 143, -1, 145, 137, 138, 139, 140, 141, -1, 143, -1, 145, -1, -1, -1, 98, 99, 100, 101, 102, -1, 57, -1, 59, -1, -1, -1, 110, -1, -1, -1, 114, 3, 4, -1, 6, -1, -1, 57, 10, 59, 137, 138, 139, 140, 141, -1, 143, -1, 132, 133, 134, -1, -1, 137, -1, -1, 93, -1, -1, -1, 144, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, 114, 98, 99, 100, 101, 102, 3, 4, 57, 6, 59, -1, -1, 110, -1, -1, -1, 114, 132, 133, 134, -1, -1, 137, -1, -1, -1, -1, -1, -1, 144, -1, -1, -1, -1, 132, 133, 134, -1, -1, 137, -1, -1, -1, -1, -1, -1, 144, -1, 98, 99, 100, 101, 102, -1, -1, 3, 4, -1, 6, 57, 110, 59, 10, 61, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, 133, 134, -1, -1, 137, -1, -1, -1, -1, -1, -1, 144, -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, 3, 4, -1, 6, 57, -1, 59, 110, -1, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, -1, 6, -1, -1, -1, 10, 132, 133, 134, -1, -1, 137, -1, -1, -1, -1, -1, -1, 144, -1, -1, -1, 98, 99, 100, 101, 102, 3, 4, -1, 6, 57, -1, 59, 110, -1, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, -1, 6, 57, -1, 59, 10, 132, 133, 134, -1, -1, 137, -1, -1, -1, -1, -1, 93, 144, -1, -1, -1, 98, 99, 100, 101, 102, -1, -1, -1, -1, 57, -1, 59, 110, -1, -1, -1, 114, -1, -1, -1, -1, 98, 99, 100, 101, 102, -1, -1, -1, -1, 57, -1, 59, 110, 132, 133, 134, 114, -1, 137, -1, 3, 4, -1, 6, 93, 144, -1, 10, -1, 98, 99, 100, 101, 102, 132, 133, 134, 3, 4, 137, 6, 110, -1, -1, -1, 114, 144, -1, -1, -1, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, 110, 132, 133, 134, 114, -1, 137, -1, -1, -1, -1, -1, 57, 144, 59, -1, -1, -1, -1, -1, -1, -1, 132, 133, 134, 3, 4, 137, 6, 57, -1, 59, -1, -1, 144, -1, -1, -1, -1, -1, -1, -1, 3, 4, -1, 6, -1, -1, -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, 114, 98, 99, 100, 101, 102, -1, -1, -1, -1, 57, -1, 59, 110, -1, -1, -1, 114, 132, 133, 134, -1, -1, 137, -1, -1, -1, 57, -1, 59, 144, -1, -1, -1, -1, 132, 133, 134, -1, -1, 137, -1, -1, -1, -1, -1, -1, 144, -1, -1, -1, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, 114, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, 114, 132, 133, 134, -1, -1, 137, -1, -1, -1, -1, -1, -1, 144, -1, -1, -1, -1, 132, 133, 134, -1, -1, 137, 4, 5, 6, 7, 8, 9, 144, -1, 12, -1, -1, -1, 16, -1, -1, -1, -1, 21, -1, -1, 24, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, 61, -1, 63, 64, -1, -1, -1, 68, 69, 70, 71, 72, -1, 74, 75, 76, 77, -1, -1, -1, 4, 5, 6, 7, 8, 9, -1, -1, 12, -1, -1, -1, 16, 94, 95, 96, -1, 21, 99, 100, 24, -1, -1, -1, 28, 106, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129, 130, -1, -1, -1, -1, -1, -1, 60, 61, -1, 63, 64, -1, -1, -1, 68, 69, 70, 71, 72, -1, 74, 75, 76, 77, -1, -1, -1, 4, 5, 6, 7, 8, 9, -1, -1, 12, -1, -1, -1, 16, 94, 95, -1, -1, 21, 99, 100, 24, -1, -1, -1, 28, 106, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129, 130, -1, -1, -1, -1, -1, -1, 60, 61, -1, 63, 64, -1, -1, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, 100 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 153, 154, 0, 4, 5, 6, 7, 8, 9, 12, 16, 21, 24, 28, 60, 61, 63, 64, 68, 69, 70, 71, 72, 74, 75, 76, 77, 94, 95, 99, 100, 106, 107, 108, 109, 129, 130, 155, 156, 157, 158, 160, 161, 162, 163, 164, 165, 171, 99, 100, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 135, 135, 135, 135, 135, 8, 53, 128, 179, 146, 146, 144, 155, 144, 144, 144, 146, 144, 4, 4, 144, 144, 144, 144, 146, 154, 123, 172, 3, 4, 6, 57, 59, 98, 99, 100, 101, 102, 110, 114, 132, 133, 134, 137, 144, 224, 229, 5, 78, 144, 226, 229, 223, 224, 229, 7, 53, 54, 55, 56, 65, 66, 67, 110, 111, 174, 176, 177, 178, 179, 9, 21, 180, 12, 24, 181, 136, 136, 136, 136, 136, 136, 144, 144, 136, 144, 144, 146, 87, 88, 89, 144, 229, 230, 75, 230, 12, 156, 229, 6, 10, 135, 218, 222, 104, 110, 174, 224, 229, 62, 227, 228, 227, 96, 159, 174, 180, 90, 146, 99, 100, 144, 144, 4, 4, 144, 144, 144, 149, 144, 144, 149, 224, 229, 61, 224, 229, 137, 138, 139, 140, 141, 143, 144, 137, 138, 139, 140, 141, 143, 229, 229, 137, 138, 139, 139, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 174, 180, 181, 223, 226, 229, 174, 174, 179, 179, 227, 230, 229, 230, 78, 79, 80, 81, 82, 83, 84, 85, 86, 145, 144, 145, 146, 145, 148, 148, 148, 145, 147, 147, 144, 145, 147, 145, 151, 145, 113, 184, 185, 186, 125, 173, 224, 226, 227, 229, 223, 149, 169, 87, 88, 89, 144, 174, 180, 223, 226, 229, 231, 131, 104, 174, 223, 224, 229, 224, 229, 174, 145, 145, 145, 224, 229, 224, 229, 224, 229, 224, 229, 224, 229, 224, 229, 224, 226, 229, 224, 229, 224, 229, 224, 229, 224, 229, 224, 229, 224, 229, 147, 147, 226, 226, 229, 226, 229, 174, 174, 174, 174, 226, 226, 174, 180, 104, 174, 180, 144, 179, 231, 227, 145, 145, 147, 148, 147, 145, 145, 229, 229, 229, 229, 229, 229, 230, 230, 230, 155, 230, 155, 230, 146, 105, 105, 105, 222, 227, 104, 146, 174, 146, 228, 229, 146, 144, 158, 147, 174, 145, 170, 223, 147, 231, 224, 229, 231, 145, 145, 78, 79, 80, 81, 82, 83, 145, 84, 85, 86, 145, 147, 147, 148, 150, 147, 145, 145, 147, 147, 150, 230, 147, 145, 147, 229, 229, 147, 145, 147, 147, 147, 147, 145, 147, 147, 145, 147, 229, 147, 145, 145, 136, 136, 105, 105, 169, 73, 145, 146, 147, 147, 145, 113, 187, 188, 121, 122, 189, 190, 192, 206, 207, 186, 184, 147, 150, 229, 145, 223, 223, 223, 223, 223, 223, 231, 231, 231, 174, 227, 105, 144, 223, 224, 229, 224, 144, 224, 229, 224, 229, 147, 147, 169, 229, 175, 229, 226, 226, 174, 227, 174, 89, 126, 127, 144, 182, 183, 223, 223, 145, 145, 145, 155, 156, 95, 166, 168, 169, 174, 223, 227, 146, 136, 145, 147, 144, 144, 159, 191, 207, 158, 223, 147, 147, 147, 148, 150, 223, 150, 145, 145, 145, 223, 147, 147, 147, 147, 229, 229, 145, 145, 145, 147, 148, 147, 147, 145, 145, 145, 182, 144, 144, 182, 84, 86, 145, 136, 136, 145, 167, 168, 147, 145, 147, 113, 229, 187, 10, 135, 193, 194, 114, 137, 195, 196, 197, 189, 223, 225, 229, 174, 227, 229, 144, 145, 144, 145, 224, 229, 224, 229, 224, 229, 224, 229, 79, 145, 229, 229, 226, 226, 226, 226, 145, 182, 182, 223, 223, 155, 96, 147, 174, 146, 103, 145, 145, 147, 144, 149, 197, 146, 136, 137, 138, 159, 145, 145, 147, 148, 145, 147, 148, 147, 223, 223, 145, 145, 145, 145, 145, 145, 145, 145, 148, 145, 145, 145, 145, 168, 145, 147, 145, 10, 57, 92, 137, 144, 208, 211, 212, 213, 214, 215, 216, 224, 229, 194, 10, 11, 58, 93, 95, 137, 144, 149, 198, 199, 200, 201, 203, 224, 229, 7, 220, 221, 226, 229, 204, 3, 196, 197, 197, 229, 223, 174, 229, 174, 145, 145, 229, 146, 103, 146, 144, 144, 211, 224, 229, 211, 224, 229, 146, 136, 137, 138, 139, 139, 144, 144, 201, 199, 224, 229, 199, 224, 229, 201, 137, 138, 145, 139, 139, 139, 112, 147, 150, 10, 205, 148, 145, 147, 145, 57, 145, 10, 57, 137, 144, 215, 217, 224, 229, 93, 224, 229, 145, 10, 97, 210, 219, 224, 209, 223, 211, 211, 10, 214, 224, 229, 10, 214, 224, 229, 202, 203, 224, 202, 96, 145, 150, 199, 199, 200, 224, 229, 201, 201, 221, 144, 136, 146, 223, 174, 146, 145, 144, 217, 224, 229, 217, 224, 229, 137, 138, 145, 139, 139, 144, 139, 139, 136, 138, 144, 146, 139, 139, 139, 145, 145, 198, 223, 145, 145, 217, 224, 229, 217, 217, 224, 229, 217, 224, 229, 10, 93, 93, 223, 97, 10, 210, 10, 145, 124, 145, 144, 144, 124, 144, 145, 138, 220, 145, 10, 10, 220, 10, 136, 137, 138, 97, 145, 145, 145, 223, 10, 223, 10, 223, 144, 145, 145, 136, 124, 136, 139, 136, 139, 10, 223, 220, 223, 10, 223, 10, 145, 124, 124, 136, 124, 136, 136, 220, 220, 223, 220, 223, 223, 124, 124, 124, 220, 220, 220 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: #line 460 "/home/delpino/src/ff3d/language/parse.ff.yy" { iSet.push_back((yyvsp[(1) - (1)].instruction)); } break; case 3: #line 467 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionList(); } break; case 4: #line 471 "/home/delpino/src/ff3d/language/parse.ff.yy" { static_cast((yyvsp[(1) - (2)].instruction))->add((yyvsp[(2) - (2)].instruction)); (yyval.instruction) = (yyvsp[(1) - (2)].instruction); } break; case 5: #line 479 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = (yyvsp[(1) - (2)].instruction); } break; case 6: #line 483 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = (yyvsp[(1) - (1)].instruction); } break; case 7: #line 487 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = (yyvsp[(1) - (1)].instruction); } break; case 8: #line 491 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = (yyvsp[(1) - (1)].instruction); } break; case 9: #line 498 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionNone(); } break; case 10: #line 502 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = (yyvsp[(1) - (1)].instruction); } break; case 11: #line 506 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = (yyvsp[(1) - (1)].instruction); } break; case 12: #line 513 "/home/delpino/src/ff3d/language/parse.ff.yy" { InstructionList* i= new InstructionList(); i->add(new InstructionBlockBegin()); i->add((yyvsp[(2) - (3)].instruction)); i->add(new InstructionBlockEnd()); (yyval.instruction) = i; } break; case 13: #line 524 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().beginBlock(); } break; case 14: #line 531 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().endBlock(); } break; case 15: #line 539 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = (yyvsp[(1) - (1)].instruction); } break; case 16: #line 543 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionDoWhileStatement((yyvsp[(2) - (6)].instruction),(yyvsp[(5) - (6)].boolean)); } break; case 17: #line 547 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionWhileStatement((yyvsp[(3) - (5)].boolean),(yyvsp[(5) - (5)].instruction)); } break; case 18: #line 551 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionForStatement((yyvsp[(3) - (9)].instruction),(yyvsp[(5) - (9)].boolean),(yyvsp[(7) - (9)].instruction),(yyvsp[(9) - (9)].instruction)); } break; case 19: #line 558 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting I = new InstructionNone(); (yyval.instruction) = new InstructionIfStatement((yyvsp[(3) - (5)].boolean),(yyvsp[(5) - (5)].instruction),I); } break; case 20: #line 564 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionIfStatement((yyvsp[(3) - (7)].boolean),(yyvsp[(5) - (7)].instruction),(yyvsp[(7) - (7)].instruction)); } break; case 21: #line 571 "/home/delpino/src/ff3d/language/parse.ff.yy" { //! Default value is set to 0. VariableLexerRepository::instance().add(*(yyvsp[(2) - (2)].aString),VARREALID); ReferenceCounting zero = new RealExpressionValue(0); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (2)].aString), zero); } break; case 22: #line 579 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (4)].aString),VARREALID); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (4)].aString),(yyvsp[(4) - (4)].realExp)); } break; case 23: #line 584 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (2)].aString),VARVECTID); ReferenceCounting zero = new RealExpressionValue(0); ReferenceCounting zeroV = new Vector3ExpressionValue(zero,zero,zero); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (2)].aString),zeroV); } break; case 24: #line 593 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (4)].aString),VARVECTID); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (4)].aString),(yyvsp[(4) - (4)].vector3)); } break; case 25: #line 598 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (2)].aString),VARFNCTID); ReferenceCounting __zero = new RealExpressionValue(0.); ReferenceCounting zero = new FunctionExpressionConstant(__zero); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (2)].aString),zero); } break; case 26: #line 609 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (5)].aString),VARFNCTID); ReferenceCounting __zero = new RealExpressionValue(0.); ReferenceCounting zero = new FunctionExpressionConstant(__zero); ReferenceCounting f = new FunctionExpressionSpectral((yyvsp[(4) - (5)].mesh), zero); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (5)].aString),f); } break; case 27: #line 623 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (5)].aString),VARFNCTID); ReferenceCounting __zero = new RealExpressionValue(0.); ReferenceCounting zero = new FunctionExpressionConstant(__zero); ReferenceCounting f = new FunctionExpressionFEM((yyvsp[(4) - (5)].mesh), zero, DiscretizationType::lagrangianFEM1); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (5)].aString),f); } break; case 28: #line 638 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (7)].aString),VARFNCTID); fferr(0) << "warning: line " << fflexer->lineno() << ": deprecated syntaxe \"femfunction name(meshName,discretizationType)\"\n"; fferr(0) << "warning: use \"femfunction name(meshName:discretizationType)\"\n"; ReferenceCounting __zero = new RealExpressionValue(0.); ReferenceCounting zero = new FunctionExpressionConstant(__zero); ReferenceCounting f = new FunctionExpressionFEM((yyvsp[(4) - (7)].mesh), zero, (yyvsp[(6) - (7)].discretizationType)); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (7)].aString),f); } break; case 29: #line 656 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (7)].aString),VARFNCTID); ReferenceCounting __zero = new RealExpressionValue(0.); ReferenceCounting zero = new FunctionExpressionConstant(__zero); ReferenceCounting f = new FunctionExpressionFEM((yyvsp[(4) - (7)].mesh), zero, (yyvsp[(6) - (7)].discretizationType)); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (7)].aString),f); } break; case 30: #line 671 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (4)].aString),VARFNCTID); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (4)].aString),(yyvsp[(4) - (4)].function)); } break; case 31: #line 676 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (7)].aString),VARFNCTID); ReferenceCounting f = new FunctionExpressionSpectral((yyvsp[(4) - (7)].mesh), (yyvsp[(7) - (7)].function)); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (7)].aString),f); } break; case 32: #line 685 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (7)].aString),VARFNCTID); ReferenceCounting f = new FunctionExpressionFEM((yyvsp[(4) - (7)].mesh), (yyvsp[(7) - (7)].function), DiscretizationType::lagrangianFEM1); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (7)].aString),f); } break; case 33: #line 693 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (9)].aString),VARFNCTID); ReferenceCounting f = new FunctionExpressionFEM((yyvsp[(4) - (9)].mesh), (yyvsp[(9) - (9)].function), (yyvsp[(6) - (9)].discretizationType)); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (9)].aString),f); } break; case 34: #line 700 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (9)].aString),VARFNCTID); ReferenceCounting f = new FunctionExpressionFEM((yyvsp[(4) - (9)].mesh), (yyvsp[(9) - (9)].function), (yyvsp[(6) - (9)].discretizationType)); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (9)].aString),f); } break; case 35: #line 707 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (2)].aString),MESHID); ReferenceCounting M = new MeshExpressionUndefined(); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (2)].aString),M); } break; case 36: #line 713 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (4)].aString),MESHID); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (4)].aString),(yyvsp[(4) - (4)].mesh)); } break; case 37: #line 718 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (2)].aString),VARSCENEID); ReferenceCounting M = new SceneExpressionUndefined(); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (2)].aString),M); } break; case 38: #line 724 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (4)].aString),VARSCENEID); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (4)].aString),(yyvsp[(4) - (4)].scene)); } break; case 39: #line 729 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (2)].aString),VARDOMAINID); ReferenceCounting D = new DomainExpressionUndefined(); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (2)].aString),D); } break; case 40: #line 737 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (4)].aString),VARDOMAINID); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (4)].aString),(yyvsp[(4) - (4)].domain)); } break; case 41: #line 744 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (2)].aString),VAROFSTREAMID); ReferenceCounting ofstreamExpression = new OFStreamExpressionUndefined(); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (2)].aString),ofstreamExpression); } break; case 42: #line 753 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(2) - (4)].aString),VAROFSTREAMID); (yyval.instruction) = new InstructionDeclaration(*(yyvsp[(2) - (4)].aString),(yyvsp[(4) - (4)].ofstream)); } break; case 43: #line 763 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionAffectation((yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].realExp)); } break; case 44: #line 767 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionRealExpressionIncrement((yyvsp[(1) - (2)].str)); } break; case 45: #line 771 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionRealExpressionIncrement((yyvsp[(2) - (2)].str)); } break; case 46: #line 775 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionRealExpressionDecrement((yyvsp[(1) - (2)].str)); } break; case 47: #line 779 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionRealExpressionDecrement((yyvsp[(2) - (2)].str)); } break; case 48: #line 783 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionAffectation((yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].vector3)); } break; case 49: #line 787 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionAffectation((yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].function)); } break; case 50: #line 791 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionAffectation((yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].mesh)); } break; case 51: #line 795 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionAffectation((yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].domain)); } break; case 52: #line 799 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionAffectation((yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].scene)); } break; case 53: #line 803 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionAffectation((yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].ofstream)); } break; case 54: #line 811 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.unknownList) = (yyvsp[(3) - (4)].unknownList); } break; case 55: #line 818 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionOutput((yyvsp[(1) - (3)].ostreamExpression),(yyvsp[(2) - (3)].ostreamExpressionList)); } break; case 56: #line 822 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionCat((yyvsp[(3) - (5)].string)); } break; case 57: #line 826 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionExec((yyvsp[(3) - (5)].string)); } break; case 58: #line 830 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionPlot((yyvsp[(3) - (5)].mesh)); } break; case 59: #line 834 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionPlot((yyvsp[(5) - (7)].mesh), (yyvsp[(3) - (7)].function)); } break; case 60: #line 838 "/home/delpino/src/ff3d/language/parse.ff.yy" { FileDescriptor* f = new FileDescriptor((yyvsp[(3) - (9)].formatType), FileDescriptor::Unix); (yyval.instruction) = new InstructionSaveMesh(f, (yyvsp[(5) - (9)].string), (yyvsp[(7) - (9)].mesh)); } break; case 61: #line 843 "/home/delpino/src/ff3d/language/parse.ff.yy" { FileDescriptor* f = new FileDescriptor((yyvsp[(3) - (11)].formatType), (yyvsp[(9) - (11)].fileType)); (yyval.instruction) = new InstructionSaveMesh(f, (yyvsp[(5) - (11)].string), (yyvsp[(7) - (11)].mesh)); } break; case 62: #line 848 "/home/delpino/src/ff3d/language/parse.ff.yy" { FileDescriptor* f = new FileDescriptor((yyvsp[(3) - (11)].formatType), FileDescriptor::Unix); (yyval.instruction) = new InstructionSaveFieldList(f, (yyvsp[(5) - (11)].string), (yyvsp[(7) - (11)].fieldlist), (yyvsp[(9) - (11)].mesh)); } break; case 63: #line 853 "/home/delpino/src/ff3d/language/parse.ff.yy" { FileDescriptor* f = new FileDescriptor((yyvsp[(3) - (13)].formatType), (yyvsp[(11) - (13)].fileType)); (yyval.instruction) = new InstructionSaveFieldList(f, (yyvsp[(5) - (13)].string), (yyvsp[(7) - (13)].fieldlist), (yyvsp[(9) - (13)].mesh)); } break; case 64: #line 858 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionList(); ReferenceCounting solver = new SolverExpression((yyvsp[(1) - (9)].unknownList), (yyvsp[(5) - (9)].mesh), (yyvsp[(6) - (9)].solverOptions), (yyvsp[(8) - (9)].problem), (yyvsp[(3) - (9)].domain)); (yyval.instruction) = new InstructionEvaluation(solver); } break; case 65: #line 867 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionList(); ReferenceCounting solver = new SolverExpression((yyvsp[(1) - (7)].unknownList), (yyvsp[(3) - (7)].mesh), (yyvsp[(4) - (7)].solverOptions), (yyvsp[(6) - (7)].problem)); (yyval.instruction) = new InstructionEvaluation(solver); } break; case 66: #line 876 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionUsingScene((yyvsp[(2) - (3)].scene)); } break; case 67: #line 880 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionCoarseMesh(true); } break; case 68: #line 884 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionCoarseMesh(false); } break; case 69: #line 888 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionExit(); } break; case 70: #line 892 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.instruction) = new InstructionExit((yyvsp[(3) - (5)].realExp)); } break; case 71: #line 899 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.fieldlist) = new FieldExpressionList; (yyval.fieldlist)->add((yyvsp[(1) - (1)].field)); } break; case 72: #line 904 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.fieldlist) = (yyvsp[(2) - (3)].fieldlist); } break; case 73: #line 911 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.fieldlist) = new FieldExpressionList; (yyval.fieldlist)->add((yyvsp[(1) - (1)].field)); } break; case 74: #line 916 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.fieldlist) = (yyvsp[(1) - (3)].fieldlist); (yyvsp[(1) - (3)].fieldlist)->add((yyvsp[(3) - (3)].field)); } break; case 75: #line 924 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.field) = new FieldExpression; (yyval.field)->add((yyvsp[(1) - (1)].function)); } break; case 76: #line 929 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.field) = (yyvsp[(1) - (1)].field); } break; case 77: #line 936 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.field) = (yyvsp[(2) - (3)].field); } break; case 78: #line 943 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.field) = new FieldExpression; (yyval.field)->add((yyvsp[(1) - (1)].function)); } break; case 79: #line 948 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.field) = (yyvsp[(1) - (3)].field); (yyval.field)->add((yyvsp[(3) - (3)].function)); } break; case 80: #line 956 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.ostreamExpression) = new OStreamExpression(&ffout(0)); } break; case 81: #line 960 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.ostreamExpression) = new OStreamExpression(&fferr(0)); } break; case 82: #line 964 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.ostreamExpression) = new OStreamExpression((yyvsp[(1) - (1)].str)); } break; case 83: #line 970 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.ostreamExpressionList) = new OStreamExpressionList(); } break; case 84: #line 974 "/home/delpino/src/ff3d/language/parse.ff.yy" { (*(yyval.ostreamExpressionList)) << (yyvsp[(3) - (3)].expression); } break; case 85: #line 981 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.expression) = (yyvsp[(1) - (1)].string); } break; case 86: #line 985 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.expression) = (yyvsp[(1) - (1)].function); } break; case 87: #line 989 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.expression) = (yyvsp[(1) - (1)].realExp); } break; case 88: #line 993 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.expression) = (yyvsp[(1) - (1)].vector3); } break; case 89: #line 1000 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = (yyvsp[(1) - (1)].structured3dmesh); } break; case 90: #line 1004 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = (yyvsp[(1) - (1)].spectralmesh); } break; case 91: #line 1008 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = (yyvsp[(1) - (1)].surfacemesh); } break; case 92: #line 1012 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = new MeshExpressionVariable((yyvsp[(1) - (1)].str)); } break; case 93: #line 1016 "/home/delpino/src/ff3d/language/parse.ff.yy" { FileDescriptor* f = new FileDescriptor((yyvsp[(3) - (6)].formatType), FileDescriptor::Unix); (yyval.mesh) = new MeshExpressionRead(f, (yyvsp[(5) - (6)].string)); } break; case 94: #line 1021 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = new MeshExpressionTetrahedrize((yyvsp[(3) - (4)].mesh)); } break; case 95: #line 1025 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = new MeshExpressionTetrahedrizeDomain((yyvsp[(5) - (6)].mesh), (yyvsp[(3) - (6)].domain)); } break; case 96: #line 1029 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = new MeshExpressionExtract((yyvsp[(3) - (6)].mesh), (yyvsp[(5) - (6)].realExp)); } break; case 97: #line 1033 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = new MeshExpressionTransform((yyvsp[(3) - (6)].mesh), (yyvsp[(5) - (6)].field)); } break; case 98: #line 1037 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = new MeshExpressionSimplify((yyvsp[(3) - (4)].mesh)); } break; case 99: #line 1041 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mesh) = new MeshExpressionPeriodic((yyvsp[(3) - (6)].mesh),(yyvsp[(5) - (6)].mapreference)); } break; case 100: #line 1048 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mapreference) = new MeshExpressionPeriodic::MappedReferencesList(); (*(yyval.mapreference)).push_back(std::make_pair((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp))); } break; case 101: #line 1053 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.mapreference) = (yyvsp[(1) - (5)].mapreference); (*(yyval.mapreference)).push_back(std::make_pair((yyvsp[(3) - (5)].realExp),(yyvsp[(5) - (5)].realExp))); } break; case 102: #line 1062 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.structured3dmesh) = new MeshExpressionStructured((yyvsp[(3) - (8)].vector3),(yyvsp[(5) - (8)].vector3),(yyvsp[(7) - (8)].vector3)); } break; case 103: #line 1069 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.spectralmesh) = new MeshExpressionSpectral((yyvsp[(3) - (8)].vector3),(yyvsp[(5) - (8)].vector3),(yyvsp[(7) - (8)].vector3)); } break; case 104: #line 1076 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.surfacemesh) = new MeshExpressionSurface((yyvsp[(3) - (6)].domain),(yyvsp[(5) - (6)].mesh)); } break; case 105: #line 1080 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.surfacemesh) = new MeshExpressionSurface((yyvsp[(3) - (4)].mesh)); } break; case 106: #line 1087 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.scene) = new SceneExpressionPOVRay((yyvsp[(3) - (4)].string)); } break; case 107: #line 1091 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.scene) = new SceneExpressionVariable((yyvsp[(1) - (1)].str)); } break; case 108: #line 1095 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.scene) = new SceneExpressionTransform((yyvsp[(3) - (6)].scene),(yyvsp[(5) - (6)].field)); } break; case 109: #line 1103 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.domain) = new DomainExpressionSet((yyvsp[(3) - (6)].scene), (yyvsp[(5) - (6)].insideListExpression)); } break; case 110: #line 1107 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.domain) = new DomainExpressionAnalytic((yyvsp[(3) - (4)].function)); } break; case 111: #line 1111 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.domain) = new DomainExpressionVariable((yyvsp[(1) - (1)].str)); } break; case 112: #line 1118 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.ofstream) = new OFStreamExpressionValue((yyvsp[(3) - (4)].string)); } break; case 113: #line 1122 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.ofstream) = new OFStreamExpressionVariable((yyvsp[(1) - (1)].str)); } break; case 114: #line 1129 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.insideListExpression) = new InsideListExpressionLeaf((yyvsp[(1) - (1)].insideExpression)); } break; case 115: #line 1133 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.insideListExpression) = (yyvsp[(2) - (3)].insideListExpression); } break; case 116: #line 1137 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.insideListExpression) = new InsideListExpressionNot((yyvsp[(2) - (2)].insideListExpression)); } break; case 117: #line 1141 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.insideListExpression) = new InsideListExpressionAnd((yyvsp[(1) - (3)].insideListExpression),(yyvsp[(3) - (3)].insideListExpression)); } break; case 118: #line 1145 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.insideListExpression) = new InsideListExpressionOr((yyvsp[(1) - (3)].insideListExpression),(yyvsp[(3) - (3)].insideListExpression)); } break; case 119: #line 1152 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.insideExpression) = new InsideExpression(true,(yyvsp[(3) - (4)].vector3)); } break; case 120: #line 1156 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.insideExpression) = new InsideExpression(false,(yyvsp[(3) - (4)].vector3)); } break; case 121: #line 1162 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.solverOptions) = new SolverOptionsExpression(); } break; case 122: #line 1166 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.solverOptions) = (yyvsp[(1) - (1)].solverOptions); } break; case 123: #line 1173 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.solverOptions) = new SolverOptionsExpression(); (*(yyval.solverOptions)).add((yyvsp[(1) - (1)].option)); } break; case 124: #line 1178 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.solverOptions) = (yyvsp[(1) - (3)].solverOptions); (*(yyval.solverOptions)).add((yyvsp[(3) - (3)].option)); } break; case 125: #line 1186 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting S = new StringExpressionValue((yyvsp[(1) - (4)].str)); (yyval.option) = new OptionExpression(S,(yyvsp[(3) - (4)].subOptionList)); delete [] (yyvsp[(1) - (4)].str); } break; case 126: #line 1196 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.subOptionList) = new SubOptionListExpression; (*(yyval.subOptionList)).add((yyvsp[(1) - (1)].subOption)); } break; case 127: #line 1201 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.subOptionList) = (yyvsp[(3) - (3)].subOptionList); (*(yyval.subOptionList)).add((yyvsp[(1) - (3)].subOption)); } break; case 128: #line 1209 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting S1 = new StringExpressionValue((yyvsp[(1) - (3)].str)); ReferenceCounting S2 = new StringExpressionValue((yyvsp[(3) - (3)].str)); (yyval.subOption) = new SubOptionExpressionString(S1,S2); delete [] (yyvsp[(1) - (3)].str); delete [] (yyvsp[(3) - (3)].str); } break; case 129: #line 1221 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting S = new StringExpressionValue((yyvsp[(1) - (3)].str)); (yyval.subOption) = new SubOptionExpressionReal(S,(yyvsp[(3) - (3)].realExp)); delete [] (yyvsp[(1) - (3)].str); } break; case 130: #line 1232 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.problem) = (yyvsp[(1) - (1)].pdeSystem); } break; case 131: #line 1236 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.problem) = (yyvsp[(1) - (1)].variationalProblem); } break; case 132: #line 1243 "/home/delpino/src/ff3d/language/parse.ff.yy" { (*fflexer).switchToContext(FFLexer::variationalContext); } break; case 133: #line 1247 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.variationalProblem) = new VariationalProblemExpression((yyvsp[(3) - (5)].variationalFormula),(yyvsp[(5) - (5)].variationalDirichletList),(yyvsp[(1) - (5)].testFunctionList)); (*fflexer).switchToContext(FFLexer::defaultContext); } break; case 134: #line 1256 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.testFunctionList) = (yyvsp[(3) - (4)].testFunctionList); } break; case 135: #line 1263 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.testFunctionList) = new TestFunctionExpressionList(); (*(yyval.testFunctionList)).add((yyvsp[(1) - (1)].testFunction)); } break; case 136: #line 1268 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.testFunctionList) = (yyvsp[(1) - (3)].testFunctionList); (*(yyval.testFunctionList)).add((yyvsp[(3) - (3)].testFunction)); } break; case 137: #line 1276 "/home/delpino/src/ff3d/language/parse.ff.yy" { std::string name(*(yyvsp[(1) - (1)].aString)); VariableLexerRepository::instance().add(name,VARTESTFUNCTIONID); (yyval.testFunction) = new TestFunctionVariable(name); } break; case 138: #line 1285 "/home/delpino/src/ff3d/language/parse.ff.yy" { if ((yyvsp[(3) - (3)].value) != 0) { yyerror("Should be equal to 0"); } (yyval.variationalFormula) = new VariationalFormulaExpression((yyvsp[(1) - (3)].multilinearformsum)); } break; case 139: #line 1292 "/home/delpino/src/ff3d/language/parse.ff.yy" { (*(yyvsp[(1) - (3)].multilinearformsum)) -= (*(yyvsp[(3) - (3)].multilinearformsum)); (*(yyvsp[(3) - (3)].multilinearformsum)).clear(); (yyval.variationalFormula) = new VariationalFormulaExpression((yyvsp[(1) - (3)].multilinearformsum)); } break; case 140: #line 1301 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearformsum) = new MultiLinearFormSumExpression(); (*(yyval.multilinearformsum)).plus((yyvsp[(1) - (1)].multilinearform)); } break; case 141: #line 1306 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearformsum) = (yyvsp[(1) - (3)].multilinearformsum); (*(yyval.multilinearformsum)).plus((yyvsp[(3) - (3)].multilinearform)); } break; case 142: #line 1311 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearformsum) = (yyvsp[(1) - (3)].multilinearformsum); (*(yyval.multilinearformsum)).minus((yyvsp[(3) - (3)].multilinearform)); } break; case 143: #line 1316 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearformsum) = new MultiLinearFormSumExpression(); (*(yyval.multilinearformsum)).minus((yyvsp[(2) - (2)].multilinearform)); } break; case 144: #line 1324 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearform) = new MultiLinearFormExpression((yyvsp[(6) - (7)].multilinearexpsum), MultiLinearFormExpression::twoD, (yyvsp[(3) - (7)].boundary)); } break; case 145: #line 1328 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearform) = new MultiLinearFormExpression((yyvsp[(3) - (4)].multilinearexpsum), MultiLinearFormExpression::threeD); } break; case 146: #line 1335 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearexpsum) = new MultiLinearExpressionSum(); (*(yyval.multilinearexpsum)).plus((yyvsp[(1) - (1)].multilinearexp)); } break; case 147: #line 1340 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearexpsum) = (yyvsp[(1) - (3)].multilinearexpsum); (*(yyval.multilinearexpsum)).plus((yyvsp[(3) - (3)].multilinearexp)); } break; case 148: #line 1346 "/home/delpino/src/ff3d/language/parse.ff.yy" { (*(yyval.multilinearexpsum)).minus((yyvsp[(3) - (3)].multilinearexp)); } break; case 149: #line 1350 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearexpsum) = new MultiLinearExpressionSum(); (*(yyval.multilinearexpsum)).minus((yyvsp[(2) - (2)].multilinearexp)); } break; case 150: #line 1358 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearexp) = new MultiLinearExpression((yyvsp[(1) - (1)].linearexp)); } break; case 151: #line 1362 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearexp) = (yyvsp[(1) - (3)].multilinearexp); (*(yyval.multilinearexp)).times((yyvsp[(3) - (3)].linearexp)); } break; case 152: #line 1367 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearexp) = (yyvsp[(1) - (3)].multilinearexp); (*(yyval.multilinearexp)).times((yyvsp[(3) - (3)].function)); } break; case 153: #line 1372 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearexp) = (yyvsp[(1) - (3)].multilinearexp); (*(yyval.multilinearexp)).times((yyvsp[(3) - (3)].realExp)); } break; case 154: #line 1377 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.multilinearexp) = (yyvsp[(2) - (3)].multilinearexp); } break; case 155: #line 1385 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.linearexp) = new LinearExpressionElementary((yyvsp[(1) - (1)].integratedOperatorExp)); } break; case 156: #line 1389 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.linearexp) = new LinearExpressionElementaryTimesFunction((yyvsp[(3) - (3)].integratedOperatorExp),(yyvsp[(1) - (3)].function)); } break; case 157: #line 1393 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.linearexp) = new LinearExpressionElementaryTimesReal((yyvsp[(3) - (3)].integratedOperatorExp),(yyvsp[(1) - (3)].realExp)); } break; case 158: #line 1400 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.integratedOperatorExp) = new IntegratedOperatorExpressionOrderZero((yyvsp[(1) - (1)].integratedFunction)); } break; case 159: #line 1404 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.integratedOperatorExp) = new IntegratedOperatorExpressionGrad((yyvsp[(3) - (4)].integratedFunction)); } break; case 160: #line 1408 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.integratedOperatorExp) = new IntegratedOperatorExpressionDx((yyvsp[(1) - (4)].str),(yyvsp[(3) - (4)].integratedFunction)); } break; case 161: #line 1412 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyvsp[(2) - (3)].integratedOperatorExp)->setJump(); (yyval.integratedOperatorExp) = (yyvsp[(2) - (3)].integratedOperatorExp); } break; case 162: #line 1417 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyvsp[(2) - (3)].integratedOperatorExp)->setMean(); (yyval.integratedOperatorExp) = (yyvsp[(2) - (3)].integratedOperatorExp); } break; case 163: #line 1425 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.integratedFunction) = (yyvsp[(1) - (1)].integratedFunction); } break; case 164: #line 1429 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.integratedFunction) = new IntegratedExpressionFunctionExpression((yyvsp[(1) - (1)].function)); } break; case 165: #line 1436 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.integratedFunction) = new IntegratedExpressionUnknown((yyvsp[(1) - (1)].str)); } break; case 166: #line 1440 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.integratedFunction) = new IntegratedExpressionTest((yyvsp[(1) - (1)].str)); } break; case 167: #line 1446 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.variationalDirichletList) = new VariationalDirichletListExpression; } break; case 168: #line 1451 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.variationalDirichletList) = (yyvsp[(1) - (3)].variationalDirichletList); (*(yyval.variationalDirichletList)).add((yyvsp[(2) - (3)].boundaryConditionDirichlet)); } break; case 169: #line 1459 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boundaryConditionDirichlet) = new BoundaryConditionExpressionDirichlet((yyvsp[(1) - (5)].str),(yyvsp[(3) - (5)].function),(yyvsp[(5) - (5)].boundary)); } break; case 170: #line 1466 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeSystem) = new PDESystemExpression(); (*(yyval.pdeSystem)).add((yyvsp[(1) - (1)].pdeProblem)); } break; case 171: #line 1471 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeSystem) = (yyvsp[(1) - (2)].pdeSystem); (*(yyval.pdeSystem)).add((yyvsp[(2) - (2)].pdeProblem)); } break; case 172: #line 1479 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeProblem) = new PDEProblemExpressionDescription((yyvsp[(3) - (7)].str), (yyvsp[(5) - (7)].pdeEquation), (yyvsp[(7) - (7)].boundaryConditionList)); } break; case 173: #line 1486 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeEquation) = new PDEEquationExpression((yyvsp[(1) - (3)].pdeOperatorSumExpression),(yyvsp[(3) - (3)].function)); } break; case 174: #line 1493 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = (yyvsp[(1) - (1)].function); } break; case 175: #line 1500 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boundaryConditionList) = new BoundaryConditionListExpressionSet(); } break; case 176: #line 1504 "/home/delpino/src/ff3d/language/parse.ff.yy" { static_cast((yyvsp[(3) - (3)].boundaryConditionList))->add((yyvsp[(1) - (3)].boundaryCondition)); (yyval.boundaryConditionList) = (yyvsp[(3) - (3)].boundaryConditionList); } break; case 177: #line 1512 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeOperatorSumExpression) = new PDEOperatorSumExpression(); (*(yyval.pdeOperatorSumExpression)).add((yyvsp[(1) - (1)].pdeOperatorExpression)); } break; case 178: #line 1517 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeOperatorSumExpression) = (yyvsp[(2) - (3)].pdeOperatorSumExpression); } break; case 179: #line 1521 "/home/delpino/src/ff3d/language/parse.ff.yy" { (*(yyvsp[(2) - (2)].pdeOperatorSumExpression)).unaryMinus(); (yyval.pdeOperatorSumExpression) = (yyvsp[(2) - (2)].pdeOperatorSumExpression); } break; case 180: #line 1526 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeOperatorSumExpression) = (yyvsp[(3) - (3)].pdeOperatorSumExpression); (*(yyval.pdeOperatorSumExpression)).add((yyvsp[(1) - (3)].pdeOperatorSumExpression)); } break; case 181: #line 1531 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeOperatorSumExpression) = (yyvsp[(1) - (3)].pdeOperatorSumExpression); (*(yyval.pdeOperatorSumExpression)).minus((yyvsp[(3) - (3)].pdeOperatorSumExpression)); } break; case 182: #line 1539 "/home/delpino/src/ff3d/language/parse.ff.yy" { RealExpression* One = new RealExpressionValue(1); FunctionExpression* OneFunction = new FunctionExpressionConstant(One); (yyval.pdeOperatorExpression) = new PDEScalarOperatorExpressionDivMuGrad((yyvsp[(5) - (7)].str),OneFunction); } break; case 183: #line 1545 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting F = new FunctionExpressionConstant((yyvsp[(3) - (9)].realExp)); (yyval.pdeOperatorExpression) = new PDEScalarOperatorExpressionDivMuGrad((yyvsp[(7) - (9)].str),F); } break; case 184: #line 1551 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeOperatorExpression) = new PDEScalarOperatorExpressionDivMuGrad((yyvsp[(7) - (9)].str),(yyvsp[(3) - (9)].function)); } break; case 185: #line 1555 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeOperatorExpression) = (yyvsp[(1) - (1)].matricialSecondOrderOp); } break; case 186: #line 1559 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeOperatorExpression) = (yyvsp[(1) - (1)].firstOrderOp); } break; case 187: #line 1563 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.pdeOperatorExpression) = (yyvsp[(1) - (1)].zerothOrderOp); } break; case 188: #line 1570 "/home/delpino/src/ff3d/language/parse.ff.yy" { RealExpression* One = new RealExpressionValue(1); FunctionExpression* OneFunction = new FunctionExpressionConstant(One); (yyval.zerothOrderOp) = new PDEScalarOperatorExpressionOrderZero((yyvsp[(1) - (1)].str),OneFunction); } break; case 189: #line 1576 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.zerothOrderOp) = new PDEScalarOperatorExpressionOrderZero((yyvsp[(3) - (3)].str),(yyvsp[(1) - (3)].function)); } break; case 190: #line 1580 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting F = new FunctionExpressionConstant((yyvsp[(1) - (3)].realExp)); (yyval.zerothOrderOp) = new PDEScalarOperatorExpressionOrderZero((yyvsp[(3) - (3)].str),F); } break; case 191: #line 1589 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.firstOrderOp) = (yyvsp[(1) - (1)].firstOrderOp); } break; case 192: #line 1593 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.firstOrderOp) = (yyvsp[(3) - (3)].firstOrderOp); (*(yyvsp[(3) - (3)].firstOrderOp)) *= (yyvsp[(1) - (3)].function); } break; case 193: #line 1598 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting F = new FunctionExpressionConstant((yyvsp[(1) - (3)].realExp)); (yyval.firstOrderOp) = (yyvsp[(3) - (3)].firstOrderOp); (*(yyvsp[(3) - (3)].firstOrderOp)) *= F; } break; case 194: #line 1608 "/home/delpino/src/ff3d/language/parse.ff.yy" { RealExpression* One = new RealExpressionValue(1); FunctionExpression* OneFunction = new FunctionExpressionConstant(One); (yyval.firstOrderOp) = new PDEScalarOperatorExpressionOrderOne((yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].str), OneFunction); } break; case 195: #line 1619 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.matricialSecondOrderOp) = new PDEVectorialOperatorExpressionOrderTwo(); (*(yyval.matricialSecondOrderOp)).add((yyvsp[(1) - (4)].str),(yyvsp[(3) - (4)].vectorialFirstOrderOp)); } break; case 196: #line 1627 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vectorialFirstOrderOp) = new PDEVectorialOperatorExpressionOrderOne(); (*(yyval.vectorialFirstOrderOp)) += (yyvsp[(1) - (1)].firstOrderOp); } break; case 197: #line 1632 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vectorialFirstOrderOp) = new PDEVectorialOperatorExpressionOrderOne(); (*(yyval.vectorialFirstOrderOp)) -= (yyvsp[(2) - (2)].vectorialFirstOrderOp); } break; case 198: #line 1637 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vectorialFirstOrderOp) = (yyvsp[(1) - (3)].vectorialFirstOrderOp); (*(yyval.vectorialFirstOrderOp)) += (yyvsp[(3) - (3)].vectorialFirstOrderOp); } break; case 199: #line 1642 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vectorialFirstOrderOp) = (yyvsp[(1) - (3)].vectorialFirstOrderOp); (*(yyval.vectorialFirstOrderOp)) -= (yyvsp[(3) - (3)].vectorialFirstOrderOp); } break; case 200: #line 1647 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vectorialFirstOrderOp) = (yyvsp[(3) - (3)].vectorialFirstOrderOp); (*(yyvsp[(3) - (3)].vectorialFirstOrderOp)) *= (yyvsp[(1) - (3)].function); } break; case 201: #line 1652 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vectorialFirstOrderOp) = (yyvsp[(3) - (3)].vectorialFirstOrderOp); ReferenceCounting f = new FunctionExpressionConstant((yyvsp[(1) - (3)].realExp)); (*(yyvsp[(3) - (3)].vectorialFirstOrderOp)) *= f; } break; case 202: #line 1659 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vectorialFirstOrderOp) = (yyvsp[(2) - (3)].vectorialFirstOrderOp); } break; case 203: #line 1666 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.unknownList) = new UnknownListExpressionSet(); static_cast((yyval.unknownList))->add((yyvsp[(1) - (1)].unknownExpression)); } break; case 204: #line 1671 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.unknownList) = (yyvsp[(1) - (3)].unknownList); static_cast((yyval.unknownList))->add((yyvsp[(3) - (3)].unknownExpression)); } break; case 205: #line 1679 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boundaryCondition) = new BoundaryConditionExpressionDirichlet((yyvsp[(1) - (5)].str),(yyvsp[(3) - (5)].function),(yyvsp[(5) - (5)].boundary)); } break; case 206: #line 1684 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boundaryCondition) = new BoundaryConditionExpressionNeumann((yyvsp[(3) - (8)].str),(yyvsp[(6) - (8)].function),(yyvsp[(8) - (8)].boundary)); } break; case 207: #line 1689 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boundaryCondition) = new BoundaryConditionExpressionFourrier((yyvsp[(3) - (12)].str),(yyvsp[(1) - (12)].function),(yyvsp[(10) - (12)].function),(yyvsp[(12) - (12)].boundary)); } break; case 208: #line 1693 "/home/delpino/src/ff3d/language/parse.ff.yy" { RealExpression* One = new RealExpressionValue(1); FunctionExpression* OneFunction = new FunctionExpressionConstant(One); (yyval.boundaryCondition) = new BoundaryConditionExpressionFourrier((yyvsp[(5) - (10)].str),OneFunction,(yyvsp[(8) - (10)].function),(yyvsp[(10) - (10)].boundary)); } break; case 209: #line 1699 "/home/delpino/src/ff3d/language/parse.ff.yy" { RealExpression* One = new RealExpressionValue(1); FunctionExpression* OneFunction = new FunctionExpressionConstant(One); (yyval.boundaryCondition) = new BoundaryConditionExpressionFourrier((yyvsp[(3) - (10)].str),OneFunction,(yyvsp[(8) - (10)].function),(yyvsp[(10) - (10)].boundary)); } break; case 210: #line 1705 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boundaryCondition) = new BoundaryConditionExpressionFourrier((yyvsp[(3) - (12)].str),(yyvsp[(6) - (12)].function),(yyvsp[(10) - (12)].function),(yyvsp[(12) - (12)].boundary)); } break; case 211: #line 1709 "/home/delpino/src/ff3d/language/parse.ff.yy" { RealExpression* One = new RealExpressionValue(-1); FunctionExpression* OneFunction = new FunctionExpressionConstant(One); (yyval.boundaryCondition) = new BoundaryConditionExpressionFourrier((yyvsp[(3) - (10)].str),OneFunction,(yyvsp[(8) - (10)].function),(yyvsp[(10) - (10)].boundary)); } break; case 212: #line 1715 "/home/delpino/src/ff3d/language/parse.ff.yy" { FunctionExpression* MinusFDexp = new FunctionExpressionUnaryMinus((yyvsp[(6) - (12)].function)); (yyval.boundaryCondition) = new BoundaryConditionExpressionFourrier((yyvsp[(3) - (12)].str),MinusFDexp,(yyvsp[(10) - (12)].function),(yyvsp[(12) - (12)].boundary)); } break; case 213: #line 1723 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boundary) = (yyvsp[(1) - (1)].boundary); } break; case 214: #line 1727 "/home/delpino/src/ff3d/language/parse.ff.yy" { if ((*(yyvsp[(1) - (3)].boundary)).boundaryType() != BoundaryExpression::list) { BoundaryExpressionList* bl = new BoundaryExpressionList(); bl = new BoundaryExpressionList(); bl->add((yyvsp[(1) - (3)].boundary)); bl->add((yyvsp[(3) - (3)].boundary)); (yyval.boundary) = bl; } else { dynamic_cast(*(yyvsp[(1) - (3)].boundary)).add((yyvsp[(3) - (3)].boundary)); (yyval.boundary) = (yyvsp[(1) - (3)].boundary); } } break; case 215: #line 1742 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boundary) = new BoundaryExpressionPOVRay((yyvsp[(1) - (1)].vector3)); } break; case 216: #line 1746 "/home/delpino/src/ff3d/language/parse.ff.yy" { BoundaryExpressionReferences* b = new BoundaryExpressionReferences(); b->add((yyvsp[(1) - (1)].realExp)); (yyval.boundary) = b; } break; case 217: #line 1752 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting m = new MeshExpressionVariable((yyvsp[(1) - (1)].str)); (yyval.boundary) = new BoundaryExpressionSurfaceMesh(m); } break; case 218: #line 1758 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boundary) = new BoundaryExpressionReferences((yyvsp[(2) - (2)].str)); } break; case 219: #line 1765 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(1) - (1)].aString),VARUNKNOWNID); (yyval.unknownExpression) = new UnknownExpressionDeclaration(*(yyvsp[(1) - (1)].aString)); } break; case 220: #line 1770 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().add(*(yyvsp[(1) - (3)].aString),VARUNKNOWNID); (yyval.unknownExpression) = new UnknownExpressionDeclaration(*(yyvsp[(1) - (3)].aString),(yyvsp[(3) - (3)].discretizationType)); } break; case 221: #line 1775 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().markAsUnknown((yyvsp[(1) - (1)].str)); (yyval.unknownExpression) = new UnknownExpressionFunction((yyvsp[(1) - (1)].str)); } break; case 222: #line 1780 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().markAsUnknown((yyvsp[(1) - (3)].str)); (yyval.unknownExpression) = new UnknownExpressionFunction((yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].discretizationType)); } break; case 223: #line 1785 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().markAsUnknown((yyvsp[(1) - (1)].str)); (yyval.unknownExpression) = new UnknownExpressionFunction((yyvsp[(1) - (1)].str)); } break; case 224: #line 1790 "/home/delpino/src/ff3d/language/parse.ff.yy" { VariableLexerRepository::instance().markAsUnknown((yyvsp[(1) - (3)].str)); (yyval.unknownExpression) = new UnknownExpressionFunction((yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].discretizationType)); } break; case 225: #line 1798 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionConstant((yyvsp[(1) - (1)].realExp)); } break; case 226: #line 1802 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = (yyvsp[(1) - (1)].function); } break; case 227: #line 1809 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionLinearBasis((yyvsp[(1) - (1)].str)); } break; case 228: #line 1813 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionNormalComponent((yyvsp[(1) - (1)].normalComponent)); } break; case 229: #line 1817 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionComposed((yyvsp[(1) - (8)].function),(yyvsp[(3) - (8)].function),(yyvsp[(5) - (8)].function),(yyvsp[(7) - (8)].function)); } break; case 230: #line 1821 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting F3 = new FunctionExpressionConstant((yyvsp[(7) - (8)].realExp)); (yyval.function) = new FunctionExpressionComposed((yyvsp[(1) - (8)].function),(yyvsp[(3) - (8)].function),(yyvsp[(5) - (8)].function),F3); } break; case 231: #line 1826 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting F2 = new FunctionExpressionConstant((yyvsp[(5) - (8)].realExp)); (yyval.function) = new FunctionExpressionComposed((yyvsp[(1) - (8)].function),(yyvsp[(3) - (8)].function),F2,(yyvsp[(7) - (8)].function)); } break; case 232: #line 1831 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting F2 = new FunctionExpressionConstant((yyvsp[(5) - (8)].realExp)); ReferenceCounting F3 = new FunctionExpressionConstant((yyvsp[(7) - (8)].realExp)); (yyval.function) = new FunctionExpressionComposed((yyvsp[(1) - (8)].function),(yyvsp[(3) - (8)].function),F2,F3); } break; case 233: #line 1837 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting F1 = new FunctionExpressionConstant((yyvsp[(3) - (8)].realExp)); (yyval.function) = new FunctionExpressionComposed((yyvsp[(1) - (8)].function),F1,(yyvsp[(5) - (8)].function),(yyvsp[(7) - (8)].function)); } break; case 234: #line 1842 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting F1 = new FunctionExpressionConstant((yyvsp[(3) - (8)].realExp)); ReferenceCounting F3 = new FunctionExpressionConstant((yyvsp[(7) - (8)].realExp)); (yyval.function) = new FunctionExpressionComposed((yyvsp[(1) - (8)].function),F1,(yyvsp[(5) - (8)].function),F3); } break; case 235: #line 1848 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting F1 = new FunctionExpressionConstant((yyvsp[(3) - (8)].realExp)); ReferenceCounting F2 = new FunctionExpressionConstant((yyvsp[(5) - (8)].realExp)); (yyval.function) = new FunctionExpressionComposed((yyvsp[(1) - (8)].function),F1,F2,(yyvsp[(7) - (8)].function)); } break; case 236: #line 1854 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionVariable((yyvsp[(1) - (1)].str)); } break; case 237: #line 1858 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = (yyvsp[(3) - (4)].function); } break; case 238: #line 1862 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionMeshReferences((yyvsp[(3) - (8)].str), (yyvsp[(5) - (8)].mesh), (yyvsp[(7) - (8)].reference)); } break; case 239: #line 1866 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = (yyvsp[(2) - (3)].function); } break; case 240: #line 1870 "/home/delpino/src/ff3d/language/parse.ff.yy" { FileDescriptor* f = new FileDescriptor((yyvsp[(3) - (8)].formatType), FileDescriptor::Unix); (yyval.function) = new FunctionExpressionRead(f, (yyvsp[(5) - (8)].string), (yyvsp[(7) - (8)].mesh)); } break; case 241: #line 1875 "/home/delpino/src/ff3d/language/parse.ff.yy" { FileDescriptor* f = new FileDescriptor((yyvsp[(3) - (10)].formatType), FileDescriptor::Unix); (yyval.function) = new FunctionExpressionRead(f, (yyvsp[(5) - (10)].string), (yyvsp[(7) - (10)].string), (yyvsp[(9) - (10)].mesh)); } break; case 242: #line 1880 "/home/delpino/src/ff3d/language/parse.ff.yy" { FileDescriptor* f = new FileDescriptor((yyvsp[(3) - (12)].formatType), FileDescriptor::Unix); (yyval.function) = new FunctionExpressionRead(f, (yyvsp[(5) - (12)].string), (yyvsp[(7) - (12)].string), (yyvsp[(9) - (12)].realExp), (yyvsp[(11) - (12)].mesh)); } break; case 243: #line 1885 "/home/delpino/src/ff3d/language/parse.ff.yy" { FileDescriptor* f = new FileDescriptor((yyvsp[(3) - (10)].formatType), FileDescriptor::Unix); (yyval.function) = new FunctionExpressionRead(f, (yyvsp[(5) - (10)].string), (yyvsp[(7) - (10)].realExp), (yyvsp[(9) - (10)].mesh)); } break; case 244: #line 1890 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionObjectCharacteristic((yyvsp[(3) - (4)].vector3)); } break; case 245: #line 1894 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionDomainCharacteristic((yyvsp[(3) - (4)].domain)); } break; case 246: #line 1898 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionMeshCharacteristic((yyvsp[(3) - (4)].mesh)); } break; case 247: #line 1902 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation((yyvsp[(1) - (6)].str),(yyvsp[(3) - (6)].function),(yyvsp[(5) - (6)].function)); } break; case 248: #line 1906 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::modulo,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 249: #line 1910 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::sum,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 250: #line 1914 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::difference,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 251: #line 1918 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::product,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 252: #line 1922 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::division,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 253: #line 1926 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting g = new FunctionExpressionConstant((yyvsp[(3) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::power,(yyvsp[(1) - (3)].function),g); } break; case 254: #line 1932 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::power,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 255: #line 1936 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting f = new FunctionExpressionConstant((yyvsp[(1) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::power,f,(yyvsp[(3) - (3)].function)); } break; case 256: #line 1942 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionUnaryMinus((yyvsp[(2) - (2)].function)); } break; case 257: #line 1946 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionDerivative((yyvsp[(1) - (4)].str),(yyvsp[(3) - (4)].function)); } break; case 258: #line 1950 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionConvection((yyvsp[(3) - (8)].field),(yyvsp[(5) - (8)].realExp),(yyvsp[(7) - (8)].function)); } break; case 259: #line 1954 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionCFunction((yyvsp[(1) - (4)].str), (yyvsp[(3) - (4)].function)); } break; case 260: #line 1962 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(3) - (6)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation((yyvsp[(1) - (6)].str),C,(yyvsp[(5) - (6)].function)); } break; case 261: #line 1967 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(5) - (6)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation((yyvsp[(1) - (6)].str),(yyvsp[(3) - (6)].function),C); } break; case 262: #line 1972 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(1) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::modulo,C,(yyvsp[(3) - (3)].function)); } break; case 263: #line 1977 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(3) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::modulo,(yyvsp[(1) - (3)].function),C); } break; case 264: #line 1982 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(1) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::sum, C,(yyvsp[(3) - (3)].function)); } break; case 265: #line 1987 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(3) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::sum, (yyvsp[(1) - (3)].function), C); } break; case 266: #line 1992 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(1) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::product, C, (yyvsp[(3) - (3)].function)); } break; case 267: #line 1997 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(3) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::product, (yyvsp[(1) - (3)].function), C); } break; case 268: #line 2002 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(1) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::difference, C, (yyvsp[(3) - (3)].function)); } break; case 269: #line 2007 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(3) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::difference, (yyvsp[(1) - (3)].function), C); } break; case 270: #line 2012 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(1) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::division, C, (yyvsp[(3) - (3)].function)); } break; case 271: #line 2017 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting C = new FunctionExpressionConstant((yyvsp[(3) - (3)].realExp)); (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::division, (yyvsp[(1) - (3)].function), C); } break; case 272: #line 2022 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionIntegrate((yyvsp[(3) - (10)].function), (yyvsp[(5) - (10)].function), (yyvsp[(8) - (10)].function), (yyvsp[(10) - (10)].str)); } break; case 273: #line 2029 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.reference) = new FunctionExpressionMeshReferences::ReferencesSet((yyvsp[(1) - (3)].realExp), (yyvsp[(3) - (3)].function)); } break; case 274: #line 2033 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.reference) = (yyvsp[(1) - (5)].reference); (yyval.reference)->add((yyvsp[(3) - (5)].realExp), (yyvsp[(5) - (5)].function)); } break; case 275: #line 2041 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vector3) = new Vector3ExpressionValue((yyvsp[(2) - (7)].realExp), (yyvsp[(4) - (7)].realExp), (yyvsp[(6) - (7)].realExp)); } break; case 276: #line 2045 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vector3) = new Vector3ExpressionVariable((yyvsp[(1) - (1)].str)); } break; case 277: #line 2049 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vector3) = new Vector3ExpressionValue((yyvsp[(2) - (7)].realExp), (yyvsp[(4) - (7)].realExp), (yyvsp[(6) - (7)].realExp)); } break; case 278: #line 2053 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vector3) = new Vector3ExpressionBinaryOperator((yyvsp[(1) - (3)].vector3),(yyvsp[(3) - (3)].vector3)); } break; case 279: #line 2057 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vector3) = new Vector3ExpressionBinaryOperator((yyvsp[(1) - (3)].vector3), (yyvsp[(3) - (3)].vector3)); } break; case 280: #line 2061 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vector3) = new Vector3ExpressionTimesScalar((yyvsp[(3) - (3)].vector3), (yyvsp[(1) - (3)].realExp)); } break; case 281: #line 2065 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.vector3) = new Vector3ExpressionTimesScalar((yyvsp[(1) - (3)].vector3), (yyvsp[(3) - (3)].realExp)); } break; case 282: #line 2072 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.string) = (yyvsp[(1) - (1)].string); } break; case 283: #line 2076 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.string) = new StringExpressionConcat((yyvsp[(1) - (3)].string),(yyvsp[(3) - (3)].string)); } break; case 284: #line 2080 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.string) = new StringExpressionConcat((yyvsp[(1) - (3)].string), new StringExpressionReal((yyvsp[(3) - (3)].realExp))); } break; case 285: #line 2088 "/home/delpino/src/ff3d/language/parse.ff.yy" { std::string s((yyvsp[(1) - (1)].str)); delete [] (yyvsp[(1) - (1)].str); (yyval.string) = new StringExpressionValue(s); } break; case 286: #line 2097 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionValue((yyvsp[(1) - (1)].value)); } break; case 287: #line 2101 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionVariable((yyvsp[(1) - (1)].str)); } break; case 288: #line 2105 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionFunctionEvaluate((yyvsp[(1) - (4)].function), (yyvsp[(3) - (4)].vector3)); } break; case 289: #line 2109 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionFunctionEvaluate((yyvsp[(1) - (8)].function), (yyvsp[(3) - (8)].realExp), (yyvsp[(5) - (8)].realExp), (yyvsp[(7) - (8)].realExp)); } break; case 290: #line 2113 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionIntegrate((yyvsp[(6) - (7)].function),(yyvsp[(3) - (7)].mesh)); } break; case 291: #line 2117 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionIntegrate((yyvsp[(8) - (9)].function),(yyvsp[(3) - (9)].mesh),(yyvsp[(5) - (9)].discretizationType)); } break; case 292: #line 2121 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionMinMax((yyvsp[(1) - (7)].str),(yyvsp[(6) - (7)].function),(yyvsp[(3) - (7)].mesh)); } break; case 293: #line 2125 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = (yyvsp[(2) - (3)].realExp); } break; case 294: #line 2130 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionBinaryOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 295: #line 2134 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionBinaryOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 296: #line 2138 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionBinaryOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 297: #line 2142 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionBinaryOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 298: #line 2146 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionBinaryOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 299: #line 2150 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionBinaryOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 300: #line 2155 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionUnaryOperator((yyvsp[(2) - (2)].realExp)); } break; case 301: #line 2159 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionPreIncrement(new RealExpressionVariable((yyvsp[(2) - (2)].str))); } break; case 302: #line 2163 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionPostIncrement(new RealExpressionVariable((yyvsp[(1) - (2)].str))); } break; case 303: #line 2167 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionPreDecrement(new RealExpressionVariable((yyvsp[(2) - (2)].str))); } break; case 304: #line 2171 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionPostDecrement(new RealExpressionVariable((yyvsp[(1) - (2)].str))); } break; case 305: #line 2175 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionCFunction((yyvsp[(1) - (4)].str),(yyvsp[(3) - (4)].realExp)); } break; case 306: #line 2180 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.realExp) = new RealExpressionBoolean((yyvsp[(4) - (4)].boolean)); } break; case 307: #line 2187 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionValue(true); } break; case 308: #line 2191 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionValue(false); } break; case 309: #line 2195 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionCompareOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 310: #line 2199 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionCompareOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 311: #line 2203 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionCompareOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 312: #line 2207 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionCompareOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 313: #line 2211 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionCompareOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 314: #line 2215 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionCompareOperator((yyvsp[(1) - (3)].realExp),(yyvsp[(3) - (3)].realExp)); } break; case 315: #line 2219 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionBinaryOperator((yyvsp[(1) - (3)].boolean),(yyvsp[(3) - (3)].boolean)); } break; case 316: #line 2223 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionBinaryOperator((yyvsp[(1) - (3)].boolean),(yyvsp[(3) - (3)].boolean)); } break; case 317: #line 2227 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionBinaryOperator((yyvsp[(1) - (3)].boolean),(yyvsp[(3) - (3)].boolean)); } break; case 318: #line 2231 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = (yyvsp[(2) - (3)].boolean); } break; case 319: #line 2235 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.boolean) = new BooleanExpressionUnaryOperator((yyvsp[(2) - (2)].boolean)); } break; case 320: #line 2242 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting one = new RealExpressionValue(1); (yyval.function) = new FunctionExpressionConstant(one); } break; case 321: #line 2247 "/home/delpino/src/ff3d/language/parse.ff.yy" { ReferenceCounting zero = new RealExpressionValue(0); (yyval.function) = new FunctionExpressionConstant(zero); } break; case 322: #line 2252 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::gt,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 323: #line 2256 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::lt,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 324: #line 2260 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::ge,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 325: #line 2264 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::le,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 326: #line 2268 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::eq,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 327: #line 2272 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::ne,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 328: #line 2276 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::or_,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 329: #line 2280 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::xor_,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 330: #line 2284 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionBinaryOperation(BinaryOperation::and_,(yyvsp[(1) - (3)].function),(yyvsp[(3) - (3)].function)); } break; case 331: #line 2288 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = (yyvsp[(2) - (3)].function); } break; case 332: #line 2292 "/home/delpino/src/ff3d/language/parse.ff.yy" { (yyval.function) = new FunctionExpressionNot((yyvsp[(2) - (2)].function)); } break; /* Line 1267 of yacc.c. */ #line 5589 "parse.ff.cc" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } #line 2298 "/home/delpino/src/ff3d/language/parse.ff.yy" int yyerror (const char * s) /* Called by yyparse on error */ { throw ErrorHandler("PARSED FILE",fflexer->lineno(), stringify(s)+": [\""+fflexer->YYText()+"\" unexpected]", ErrorHandler::compilation); return 0; } int yyerror2 (const char * s) /* Called by yyparse on error */ { throw ErrorHandler("PARSED FILE",fflexer->lineno(), stringify(s), ErrorHandler::compilation); return 0; } freefem3d-1.0pre10/language/VariationalDirichletListExpression.hpp0000644000175000017500000000557710561425532022335 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariationalDirichletListExpression.hpp,v 1.5 2006/08/27 21:38:58 delpinux Exp $ #ifndef VARIATIONAL_DIRICHLET_LIST_EXPRESSION_HPP #define VARIATIONAL_DIRICHLET_LIST_EXPRESSION_HPP #include class BoundaryConditionExpressionDirichlet; #include /** * @file VariationalDirichletListExpression.hpp * @author Stephane Del Pino * @date Mon Jun 3 08:47:43 2002 * * @brief A list of Dirichlet Boundary Conditions. * */ class VariationalDirichletListExpression : public Expression { private: typedef std::list > ListType; ListType __list; /**< The list of Dirichlet bc */ /** * Overload of Expression::put * * @param os output stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * Checks if the boundary contains a POV-Ray boundary * * @return true if boundary has POV-Ray boundary */ bool hasPOVBoundary() const; typedef ListType::iterator iterator; typedef ListType::const_iterator const_iterator; /** * * Returns an iterator on the begining of the list * * @return begining */ iterator begin(); /** * * Returns an iterator on the begining of the list * * @return begining */ const_iterator begin() const; /** * * Returns an iterator at the end of the list * * @return end */ const_iterator end() const; /** * Overload of Expression::execute() * */ void execute(); /** * Adds a Dirichlet BC in the list * * @param d a Dirichlet BC */ void add(ReferenceCounting d); /** * Default constructor * */ VariationalDirichletListExpression(); /** * Copy constructor * * @param V another VariationalDirichletListExpression * */ VariationalDirichletListExpression(const VariationalDirichletListExpression& V); /** * Destructor * */ ~VariationalDirichletListExpression(); }; #endif // VARIATIONAL_DIRICHLET_LIST_EXPRESSION_HPP freefem3d-1.0pre10/language/DomainExpressionAnalytic.hpp0000644000175000017500000000374310561425532020265 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpressionAnalytic.hpp,v 1.1 2006/09/28 19:13:25 delpinux Exp $ #ifndef DOMAIN_EXPRESSION_ANALYTIC_HPP #define DOMAIN_EXPRESSION_ANALYTIC_HPP #include class FunctionExpression; /** * @file DomainExpressionAnalytic.hpp * @author Stephane Del Pino * @date Thu Sep 28 21:07:11 2006 * * @brief domain defined by function expression for instance * @f$ \Omega=\{x/ f(x) __function; /**< the domain definition */ /** * Overload of the put function * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param f domain definition */ DomainExpressionAnalytic(ReferenceCounting f); /** * Copy constuctor * * @param d given domain */ DomainExpressionAnalytic(const DomainExpressionAnalytic& d); /** * Destructor * */ ~DomainExpressionAnalytic(); }; #endif // DOMAIN_EXPRESSION_ANALYTIC_HPP freefem3d-1.0pre10/language/StringExpression.hpp0000644000175000017500000000724410561425532016637 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: StringExpression.hpp,v 1.3 2003/10/18 16:07:27 delpinux Exp $ #ifndef _STRING_EXPRESSION_HPP_ #define _STRING_EXPRESSION_HPP_ #include #include #include class StringExpression : public Expression { private: std::ostream& put(std::ostream& os) const { os << this->value(); return os; } public: /*! Returns the value of the expression. \todo Return type should use traits. */ virtual const char* value() const = 0; StringExpression(const StringExpression& e) : Expression(e) { ; } StringExpression() : Expression(Expression::string) { ; } virtual ~StringExpression() { ; } }; class StringExpressionValue : public StringExpression { private: std::string __stringExpressionValue; public: const char* value() const { return __stringExpressionValue.c_str(); } void execute() { ; } StringExpressionValue(const std::string& d) : __stringExpressionValue(d) { ; } StringExpressionValue(const StringExpressionValue& re) : __stringExpressionValue(re.__stringExpressionValue) { ; } ~StringExpressionValue() { ; } }; class StringExpressionConcat : public StringExpression { private: std::string __stringExpressionValue; ReferenceCounting __string1; ReferenceCounting __string2; public: const char* value() const { return __stringExpressionValue.c_str(); } void execute() { (*__string1).execute(); (*__string2).execute(); __stringExpressionValue = (*__string1).value(); __stringExpressionValue += (*__string2).value(); } StringExpressionConcat(ReferenceCounting s1, ReferenceCounting s2) : __string1(s1), __string2(s2) { ; } StringExpressionConcat(const StringExpressionConcat& re) : __stringExpressionValue(re.__stringExpressionValue), __string1(re.__string1), __string2(re.__string2) { ; } ~StringExpressionConcat() { ; } }; class RealExpression; class StringExpressionReal : public StringExpression { private: std::string __stringExpressionValue; ReferenceCounting __realExpression; public: const char* value() const { return __stringExpressionValue.c_str(); } void execute(); StringExpressionReal(ReferenceCounting r); StringExpressionReal(const StringExpressionReal& re); ~StringExpressionReal(); }; class StringExpressionVariable : public StringExpression { private: ReferenceCounting __stringVariable; real_t __value; public: const char* value() const; void execute(); StringExpressionVariable(ReferenceCounting r); StringExpressionVariable(const StringExpressionVariable& e); ~StringExpressionVariable(); }; #endif // _REAL_EXPRESSION_HPP_ freefem3d-1.0pre10/language/OFStreamExpressionUndefined.hpp0000644000175000017500000000342410561425532020667 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: OFStreamExpressionUndefined.hpp,v 1.1 2006/12/30 00:17:05 delpinux Exp $ #ifndef OFSTREAM_EXPRESSION_UNDEFINED_HPP #define OFSTREAM_EXPRESSION_UNDEFINED_HPP #include /** * @file OFStreamExpressionUndefined.hpp * @author Stephane Del Pino * @date Sat Dec 30 01:08:19 2006 * * @brief Undefined ofstream */ class OFStreamExpressionUndefined : public OFStreamExpression { public: /** * Execution requires no action * */ void execute() { ; } /** * Constructor * */ OFStreamExpressionUndefined() : OFStreamExpression(OFStreamExpression::undefined) { ; } /** * Copy constructor * * @param ofs given undefined ofstream expression */ OFStreamExpressionUndefined(const OFStreamExpressionUndefined& ofs) : OFStreamExpression(ofs) { ; } /** * Destructor * */ ~OFStreamExpressionUndefined() { ; } }; #endif // OFSTREAM_EXPRESSION_UNDEFINED_HPP freefem3d-1.0pre10/language/parse.pov.cc0000644000175000017500000026573010625370707015036 00000000000000/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse povparse #define yylex povlex #define yyerror poverror #define yylval povlval #define yychar povchar #define yydebug povdebug #define yynerrs povnerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NUM = 258, STRING = 259, KEYWORD = 260, SPHERE = 261, BOX = 262, CYLINDER = 263, CONE = 264, PLANE = 265, TORUS = 266, UNION = 267, INTERSECTION = 268, DIFFERENCE = 269, OBJECT = 270, INVERSE = 271, NAME = 272, DECLARE = 273, TRANSF = 274, MATRIXTRANSF = 275, PIGMENT = 276, COLOR = 277, RGB = 278, RGBF = 279, IF = 280, IFDEF = 281, IFNDEF = 282, ELSE = 283, END = 284, WHILE = 285, AND = 286, OR = 287, NOT = 288, LE = 289, GE = 290, EQ = 291, NE = 292, NEG = 293 }; #endif /* Tokens. */ #define NUM 258 #define STRING 259 #define KEYWORD 260 #define SPHERE 261 #define BOX 262 #define CYLINDER 263 #define CONE 264 #define PLANE 265 #define TORUS 266 #define UNION 267 #define INTERSECTION 268 #define DIFFERENCE 269 #define OBJECT 270 #define INVERSE 271 #define NAME 272 #define DECLARE 273 #define TRANSF 274 #define MATRIXTRANSF 275 #define PIGMENT 276 #define COLOR 277 #define RGB 278 #define RGBF 279 #define IF 280 #define IFDEF 281 #define IFNDEF 282 #define ELSE 283 #define END 284 #define WHILE 285 #define AND 286 #define OR 287 #define NOT 288 #define LE 289 #define GE 290 #define EQ 291 #define NE 292 #define NEG 293 /* Copy the first part of user declarations. */ #line 1 "/home/delpino/src/ff3d/language/parse.pov.yy" /* -*- c++ -*- */ /* * This file is part of ff3d - http://www.freefem.org/ff3d * Copyright (C) 2001, 2002, 2003 Stéphane Del Pino * * 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, 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. * * $Id: parse.pov.yy,v 1.12 2007/04/25 22:13:12 delpinux Exp $ * */ #define YYDEBUG 1 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern std::vector path; // include files paths bool execute = true; variable * variables; int nbvariables; extern POVLexer* povlexer; void yyerror (char* s); void declarevar (char* name, char* val); void expend(std::string& expendval); extern Scene* pScene; SceneBox SB; enum statement { condition, loop }; std::stack ExecStack; std::stack StatementStack; std::stack StreamPosStack; bool BoolOp = false; // used if the actual object is a // construction object that belongs // to a boolean operation std::stack BoolOpStack; std::stack > > OpStack; // Used to store temporarly objects #define povlex povlexer->povlex /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE #line 94 "/home/delpino/src/ff3d/language/parse.pov.yy" { real_t val; real_t vect[3]; real_t vect4[4]; real_t mat[12]; char* str; int integer; long int stream_pos; parsetrans trans; } /* Line 187 of yacc.c. */ #line 284 "parse.pov.cc" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #line 297 "parse.pov.cc" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 492 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 52 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 17 /* YYNRULES -- Number of rules. */ #define YYNRULES 69 /* YYNRULES -- Number of states. */ #define YYNSTATES 230 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 293 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 47, 48, 42, 41, 51, 40, 2, 43, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 50, 38, 49, 39, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 45, 2, 46, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 44 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 7, 10, 13, 18, 23, 28, 30, 32, 37, 43, 51, 58, 65, 66, 69, 73, 77, 80, 88, 96, 104, 114, 126, 134, 135, 142, 143, 150, 151, 158, 159, 166, 168, 171, 173, 177, 181, 185, 189, 193, 196, 198, 202, 206, 210, 214, 218, 222, 226, 230, 233, 237, 263, 271, 274, 278, 282, 286, 290, 294, 304, 307, 311, 315, 319, 323 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 53, 0, -1, -1, 53, 55, -1, 53, 58, -1, 53, 54, -1, 26, 47, 17, 48, -1, 27, 47, 17, 48, -1, 25, 47, 65, 48, -1, 28, -1, 29, -1, 30, 47, 65, 48, -1, 18, 17, 49, 64, 50, -1, 18, 17, 49, 6, 45, 17, 46, -1, 21, 45, 22, 23, 67, 46, -1, 21, 45, 22, 24, 68, 46, -1, -1, 57, 56, -1, 57, 19, 67, -1, 57, 20, 66, -1, 57, 16, -1, 6, 45, 67, 51, 64, 57, 46, -1, 11, 45, 64, 51, 64, 57, 46, -1, 7, 45, 67, 51, 67, 57, 46, -1, 8, 45, 67, 51, 67, 51, 64, 57, 46, -1, 9, 45, 67, 51, 64, 51, 67, 51, 64, 57, 46, -1, 10, 45, 67, 51, 64, 57, 46, -1, -1, 12, 45, 59, 63, 57, 46, -1, -1, 13, 45, 60, 63, 57, 46, -1, -1, 14, 45, 61, 63, 57, 46, -1, -1, 15, 45, 62, 58, 57, 46, -1, 58, -1, 58, 63, -1, 3, -1, 64, 41, 64, -1, 64, 40, 64, -1, 64, 42, 64, -1, 64, 43, 64, -1, 47, 64, 48, -1, 40, 64, -1, 64, -1, 64, 39, 64, -1, 64, 38, 64, -1, 64, 35, 64, -1, 64, 34, 64, -1, 64, 36, 64, -1, 64, 37, 64, -1, 65, 31, 65, -1, 65, 32, 65, -1, 33, 65, -1, 47, 65, 48, -1, 38, 64, 51, 64, 51, 64, 51, 64, 51, 64, 51, 64, 51, 64, 51, 64, 51, 64, 51, 64, 51, 64, 51, 64, 39, -1, 38, 64, 51, 64, 51, 64, 39, -1, 40, 67, -1, 67, 40, 67, -1, 67, 41, 67, -1, 67, 42, 64, -1, 67, 43, 64, -1, 64, 42, 67, -1, 38, 64, 51, 64, 51, 64, 51, 64, 39, -1, 40, 68, -1, 68, 40, 68, -1, 68, 41, 68, -1, 68, 42, 64, -1, 68, 43, 64, -1, 64, 42, 68, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 141, 141, 142, 143, 144, 147, 165, 183, 190, 195, 208, 219, 244, 255, 261, 270, 279, 311, 372, 405, 433, 464, 495, 528, 560, 593, 624, 624, 660, 660, 697, 697, 735, 735, 778, 779, 782, 783, 784, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 805, 824, 829, 834, 839, 844, 849, 854, 861, 867, 871, 875, 879, 883, 887 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "NUM", "STRING", "KEYWORD", "SPHERE", "BOX", "CYLINDER", "CONE", "PLANE", "TORUS", "UNION", "INTERSECTION", "DIFFERENCE", "OBJECT", "INVERSE", "NAME", "DECLARE", "TRANSF", "MATRIXTRANSF", "PIGMENT", "COLOR", "RGB", "RGBF", "IF", "IFDEF", "IFNDEF", "ELSE", "END", "WHILE", "AND", "OR", "NOT", "LE", "GE", "EQ", "NE", "'<'", "'>'", "'-'", "'+'", "'*'", "'/'", "NEG", "'{'", "'}'", "'('", "')'", "'='", "';'", "','", "$accept", "input", "iftok", "variable", "objref", "modifier", "object", "@1", "@2", "@3", "@4", "objects", "exp", "boolexp", "matrix", "vector", "vector4", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 60, 62, 45, 43, 42, 47, 293, 123, 125, 40, 41, 61, 59, 44 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 52, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 55, 55, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 59, 58, 60, 58, 61, 58, 62, 58, 63, 63, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 67, 67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 2, 2, 4, 4, 4, 1, 1, 4, 5, 7, 6, 6, 0, 2, 3, 3, 2, 7, 7, 7, 9, 11, 7, 0, 6, 0, 6, 0, 6, 0, 6, 1, 2, 1, 3, 3, 3, 3, 3, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 25, 7, 2, 3, 3, 3, 3, 3, 9, 2, 3, 3, 3, 3, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 0, 5, 3, 4, 0, 0, 0, 0, 0, 0, 27, 29, 31, 33, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, 43, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 35, 16, 16, 16, 16, 0, 0, 53, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 6, 7, 11, 0, 42, 39, 38, 40, 62, 41, 58, 59, 60, 61, 16, 16, 0, 0, 16, 40, 16, 36, 0, 0, 0, 0, 0, 12, 54, 48, 47, 49, 50, 46, 45, 51, 52, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 28, 17, 30, 32, 34, 0, 0, 21, 23, 16, 0, 26, 22, 18, 0, 19, 0, 13, 0, 0, 0, 0, 0, 56, 24, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 14, 0, 43, 64, 0, 0, 0, 0, 0, 15, 0, 0, 40, 69, 65, 66, 67, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 1, 20, 21, 150, 123, 82, 50, 51, 52, 53, 83, 42, 58, 164, 43, 184 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -45 static const yytype_int16 yypact[] = { -45, 203, -45, -44, -42, -26, -3, 2, 6, 10, 18, 36, 38, -7, -15, 39, 49, -45, -45, 52, -45, -45, -45, 71, 71, 71, 71, 71, 81, -45, -45, -45, -45, 65, 40, 100, 103, 40, -45, 81, 71, 81, 164, -18, 220, 225, 255, 260, 81, 267, 432, 432, 432, 432, 76, 40, 40, 414, -27, 50, 74, -17, 272, -45, -35, 418, 81, 81, 71, 81, 71, 71, 81, 81, 81, 71, 71, 81, 81, -45, 81, 81, 432, -45, -45, -45, -45, 79, 387, -45, 251, 98, 81, 81, 81, 81, 81, 81, 40, 40, -45, -45, -45, -45, 81, -45, -13, -13, -45, -45, -45, -35, -35, -45, -45, 441, 445, 279, 284, 441, -45, 441, -45, 69, 85, 123, 136, 108, -45, -45, 441, 441, 441, 441, 441, 441, -45, -45, 291, 152, 204, 81, 71, 218, 224, -45, 71, 88, 87, -45, -45, -45, -45, -45, 90, 81, -45, -45, 441, 296, -45, -45, 445, 81, -45, 111, -45, 240, 232, 81, 303, 13, -45, -45, 441, 81, 71, 72, 238, 308, 422, 81, 72, 449, 429, -45, 81, -45, 315, -45, 51, 72, 72, 72, 81, 81, -45, 320, 81, -45, -45, 51, 51, -45, -45, 81, 327, 332, 81, 81, 339, 344, 81, 81, 393, 351, -45, 81, 356, 81, 363, 81, 368, 81, 375, 81, 380, 81, 437, -45 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -45, -45, -45, -45, -45, -24, 1, -45, -45, -45, -45, -34, -28, -21, -45, 32, -31 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 49, 23, 22, 24, 98, 99, 57, 72, 73, 57, 33, 62, 63, 65, 98, 99, 61, 84, 85, 25, 79, 100, 70, 71, 72, 73, 88, 57, 90, 80, 69, 103, 34, 74, 89, 91, 176, 177, 106, 107, 108, 110, 26, 38, 113, 114, 115, 27, 122, 118, 119, 28, 120, 121, 86, 29, 44, 45, 46, 47, 124, 125, 126, 30, 130, 131, 132, 133, 134, 135, 57, 57, 64, 55, 38, 38, 138, 136, 137, 38, 48, 31, 87, 32, 38, 145, 35, 56, 146, 147, 148, 139, 140, 194, 195, 143, 36, 144, 101, 37, 109, 145, 111, 112, 146, 147, 148, 116, 117, 39, 181, 40, 182, 158, 54, 149, 48, 59, 41, 41, 60, 48, 102, 41, 127, 154, 163, 167, 41, 98, 99, 151, 165, 171, 168, 170, 166, 0, 0, 145, 0, 174, 146, 147, 148, 0, 129, 179, 0, 183, 178, 190, 145, 188, 189, 146, 147, 148, 197, 0, 200, 201, 202, 199, 183, 183, 203, 204, 145, 152, 206, 146, 147, 148, 159, 0, 0, 207, 162, 0, 210, 211, 153, 0, 214, 215, 0, 0, 0, 218, 0, 220, 0, 222, 0, 224, 0, 226, 156, 228, 0, 0, 0, 2, 66, 67, 68, 69, 180, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 145, 13, 0, 146, 147, 148, 0, 0, 14, 15, 16, 17, 18, 19, 145, 0, 0, 146, 147, 148, 145, 0, 0, 146, 147, 148, 0, 0, 145, 0, 157, 146, 147, 148, 145, 0, 0, 146, 147, 148, 70, 71, 72, 73, 160, 70, 71, 72, 73, 0, 161, 75, 0, 0, 0, 0, 76, 0, 173, 172, 66, 67, 80, 69, 185, 92, 93, 94, 95, 96, 97, 66, 67, 80, 69, 70, 71, 72, 73, 105, 70, 71, 72, 73, 0, 0, 77, 66, 67, 80, 69, 78, 66, 67, 80, 69, 0, 0, 81, 70, 71, 72, 73, 104, 66, 67, 80, 69, 0, 0, 141, 66, 67, 80, 69, 142, 70, 71, 72, 73, 0, 0, 155, 66, 67, 80, 69, 169, 66, 67, 80, 69, 0, 0, 175, 66, 67, 80, 69, 186, 66, 67, 80, 69, 0, 0, 198, 66, 67, 80, 69, 205, 66, 67, 80, 69, 0, 0, 208, 66, 67, 80, 69, 209, 66, 67, 80, 69, 0, 0, 212, 66, 67, 80, 69, 213, 66, 67, 80, 69, 0, 0, 217, 66, 67, 80, 69, 219, 66, 67, 80, 69, 0, 0, 221, 66, 67, 80, 69, 223, 66, 67, 80, 69, 0, 0, 225, 66, 67, 80, 69, 227, 216, 66, 67, 80, 69, 128, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 92, 93, 94, 95, 96, 97, 66, 67, 80, 69, 66, 67, 80, 69, 70, 71, 72, 73, 105, 0, 187, 192, 193, 194, 195, 0, 0, 196, 229, 66, 67, 80, 69, 66, 67, 80, 69, 70, 71, 72, 73, 66, 67, 191, 69 }; static const yytype_int16 yycheck[] = { 28, 45, 1, 45, 31, 32, 34, 42, 43, 37, 17, 39, 40, 41, 31, 32, 37, 51, 52, 45, 48, 48, 40, 41, 42, 43, 54, 55, 56, 42, 43, 48, 47, 51, 55, 56, 23, 24, 66, 67, 68, 69, 45, 3, 72, 73, 74, 45, 82, 77, 78, 45, 80, 81, 53, 45, 24, 25, 26, 27, 84, 85, 86, 45, 92, 93, 94, 95, 96, 97, 98, 99, 40, 33, 3, 3, 104, 98, 99, 3, 40, 45, 6, 45, 3, 16, 47, 47, 19, 20, 21, 115, 116, 42, 43, 119, 47, 121, 48, 47, 68, 16, 70, 71, 19, 20, 21, 75, 76, 38, 38, 40, 40, 141, 49, 46, 40, 17, 47, 47, 17, 40, 48, 47, 45, 17, 38, 155, 47, 31, 32, 46, 45, 22, 158, 163, 46, -1, -1, 16, -1, 169, 19, 20, 21, -1, 48, 175, -1, 177, 174, 182, 16, 181, 182, 19, 20, 21, 186, -1, 191, 192, 193, 191, 192, 193, 194, 195, 16, 46, 198, 19, 20, 21, 142, -1, -1, 205, 146, -1, 208, 209, 46, -1, 212, 213, -1, -1, -1, 217, -1, 219, -1, 221, -1, 223, -1, 225, 46, 227, -1, -1, -1, 0, 40, 41, 42, 43, 176, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, 16, 18, -1, 19, 20, 21, -1, -1, 25, 26, 27, 28, 29, 30, 16, -1, -1, 19, 20, 21, 16, -1, -1, 19, 20, 21, -1, -1, 16, -1, 46, 19, 20, 21, 16, -1, -1, 19, 20, 21, 40, 41, 42, 43, 46, 40, 41, 42, 43, -1, 46, 51, -1, -1, -1, -1, 51, -1, 46, 39, 40, 41, 42, 43, 46, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 40, 41, 42, 43, 48, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 40, 41, 42, 43, -1, -1, 51, 40, 41, 42, 43, 51, 39, 40, 41, 42, 43, 50, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 40, 41, 42, 43, 40, 41, 42, 43, 48, -1, 46, 40, 41, 42, 43, -1, -1, 46, 39, 40, 41, 42, 43, 40, 41, 42, 43, 40, 41, 42, 43, 40, 41, 42, 43 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 53, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 25, 26, 27, 28, 29, 30, 54, 55, 58, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 17, 47, 47, 47, 47, 3, 38, 40, 47, 64, 67, 67, 67, 67, 67, 40, 64, 59, 60, 61, 62, 49, 33, 47, 64, 65, 17, 17, 65, 64, 64, 67, 64, 40, 41, 42, 43, 40, 41, 42, 43, 51, 51, 51, 51, 51, 64, 42, 51, 58, 63, 63, 63, 58, 6, 64, 65, 64, 65, 34, 35, 36, 37, 38, 39, 31, 32, 48, 48, 48, 48, 51, 48, 64, 64, 64, 67, 64, 67, 67, 64, 64, 64, 67, 67, 64, 64, 64, 64, 63, 57, 57, 57, 57, 45, 50, 48, 64, 64, 64, 64, 64, 64, 65, 65, 64, 57, 57, 51, 51, 57, 57, 16, 19, 20, 21, 46, 56, 46, 46, 46, 17, 51, 46, 46, 64, 67, 46, 46, 67, 38, 66, 45, 46, 64, 57, 51, 64, 22, 39, 46, 64, 51, 23, 24, 57, 64, 67, 38, 40, 64, 68, 46, 51, 46, 64, 64, 68, 42, 40, 41, 42, 43, 46, 64, 51, 64, 68, 68, 68, 64, 64, 51, 64, 64, 51, 51, 64, 64, 51, 51, 64, 64, 39, 51, 64, 51, 64, 51, 64, 51, 64, 51, 64, 51, 64, 39 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 3: #line 142 "/home/delpino/src/ff3d/language/parse.pov.yy" { } break; case 4: #line 143 "/home/delpino/src/ff3d/language/parse.pov.yy" { } break; case 5: #line 144 "/home/delpino/src/ff3d/language/parse.pov.yy" { } break; case 6: #line 147 "/home/delpino/src/ff3d/language/parse.pov.yy" { ExecStack.push(execute); StatementStack.push(condition); if (execute) { bool defined_var = false; for (int i=0; i 0) { delete[] (yyvsp[(1) - (2)].trans.type); /* deallocate memory if needed */ for (int i=0; i<3; i++) delete[] (yyvsp[(1) - (2)].trans.vect)[i]; } (yyval.trans.inverse) = (yyvsp[(1) - (2)].trans.inverse); (yyval.trans.hasRef) = true; for (size_t i=0; i<4; ++i) (yyval.trans.ref)[i] = (yyvsp[(2) - (2)].vect4)[i]; } } break; case 18: #line 312 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { TransType* savetype; real_t* savevect[3]; savetype = new TransType[(yyval.trans.number)+1]; for (int i=0; i<3; i++) savevect[i] = new real_t[(yyval.trans.number)+1]; for (int i=0; i<(yyval.trans.number); i++) { savetype[i] = (yyval.trans.type)[i]; /* keeps old values */ savevect[0][i] = (yyval.trans.vect)[0][i]; savevect[1][i] = (yyval.trans.vect)[1][i]; savevect[2][i] = (yyval.trans.vect)[2][i]; } if ((yyval.trans.number) > 0) { delete[] (yyval.trans.type); /* deallocate memory if needed */ for (int i=0; i<3; i++) delete[] (yyval.trans.vect)[i]; } (yyval.trans.type) = new TransType[((yyval.trans.number)+1)]; (yyval.trans.vect)[0] = new real_t[((yyval.trans.number)+1)]; (yyval.trans.vect)[1] = new real_t[((yyval.trans.number)+1)]; (yyval.trans.vect)[2] = new real_t[((yyval.trans.number)+1)]; /* restore old values */ for (int i=0; i<(yyval.trans.number); i++) { (yyval.trans.type)[i] = savetype[i]; (yyval.trans.vect)[0][i] = savevect[0][i]; (yyval.trans.vect)[1][i] = savevect[1][i]; (yyval.trans.vect)[2][i] = savevect[2][i]; } (yyval.trans.hasRef) = (yyvsp[(1) - (3)].trans.hasRef); (yyval.trans.inverse) = (yyvsp[(1) - (3)].trans.inverse); for (size_t i=0; i<4; ++i) (yyval.trans.ref)[i] = (yyvsp[(1) - (3)].trans.ref)[i]; delete[] savetype; for (int i=0; i<3; i++) delete [] savevect[i]; if (!strcmp ((yyvsp[(2) - (3)].str),"rotate")) { (yyval.trans.type)[(yyval.trans.number)] = rotation; } else if (!strcmp ((yyvsp[(2) - (3)].str),"translate")) { (yyval.trans.type)[(yyval.trans.number)] = translation; } else if (!strcmp ((yyvsp[(2) - (3)].str),"scale")) { (yyval.trans.type)[(yyval.trans.number)] = scale; } else { std::cerr << "parse error unknown " << (yyvsp[(2) - (3)].str) << " check parsing in combo.y\n"; } for (int i=0; i<3; i++) (yyval.trans.vect)[i][(yyval.trans.number)] = (yyvsp[(3) - (3)].vect)[i]; (yyval.trans.number)++; } } break; case 19: #line 373 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { (yyval.trans.number) = (yyvsp[(1) - (3)].trans.number); (yyval.trans.type) = new TransType[((yyval.trans.number))]; (yyval.trans.vect)[0] = new real_t[((yyval.trans.number))]; (yyval.trans.vect)[1] = new real_t[((yyval.trans.number))]; (yyval.trans.vect)[2] = new real_t[((yyval.trans.number))]; /* copy old modifier values */ for (int i=0; i<(yyvsp[(1) - (3)].trans.number); i++) { (yyval.trans.type)[i] = (yyvsp[(1) - (3)].trans.type)[i]; (yyval.trans).vect[0][i] = (yyvsp[(1) - (3)].trans).vect[0][i]; (yyval.trans).vect[1][i] = (yyvsp[(1) - (3)].trans).vect[1][i]; (yyval.trans).vect[2][i] = (yyvsp[(1) - (3)].trans).vect[2][i]; } if ((yyvsp[(1) - (3)].trans.number) > 0) { delete[] (yyvsp[(1) - (3)].trans.type); /* deallocate memory if needed */ for (int i=0; i<3; i++) delete[] (yyvsp[(1) - (3)].trans.vect)[i]; } (yyval.trans.inverse) = (yyvsp[(1) - (3)].trans.inverse); (yyval.trans.hasRef) = (yyvsp[(1) - (3)].trans.hasRef); for (size_t i=0; i<12; ++i) (yyval.trans.mat)[i] = (yyvsp[(3) - (3)].mat)[i]; (yyval.trans.type) = new TransType[1]; (yyval.trans.type)[0] = matrix; (yyval.trans.number)=0; } } break; case 20: #line 406 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { (yyval.trans.number) = (yyvsp[(1) - (2)].trans.number); (yyval.trans.type) = new TransType[((yyval.trans.number))]; (yyval.trans.vect)[0] = new real_t[((yyval.trans.number))]; (yyval.trans.vect)[1] = new real_t[((yyval.trans.number))]; (yyval.trans.vect)[2] = new real_t[((yyval.trans.number))]; /* copy old modifier values */ for (int i=0; i<(yyvsp[(1) - (2)].trans.number); i++) { (yyval.trans.type)[i] = (yyvsp[(1) - (2)].trans.type)[i]; (yyval.trans).vect[0][i] = (yyvsp[(1) - (2)].trans).vect[0][i]; (yyval.trans).vect[1][i] = (yyvsp[(1) - (2)].trans).vect[1][i]; (yyval.trans).vect[2][i] = (yyvsp[(1) - (2)].trans).vect[2][i]; } if ((yyvsp[(1) - (2)].trans.number) > 0) { delete[] (yyvsp[(1) - (2)].trans.type); /* deallocate memory if needed */ for (int i=0; i<3; i++) delete[] (yyvsp[(1) - (2)].trans.vect)[i]; } (yyval.trans.hasRef) = (yyvsp[(1) - (2)].trans.hasRef); (yyval.trans.inverse) = not((yyvsp[(1) - (2)].trans.inverse)); } } break; case 21: #line 434 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { if ((yyvsp[(6) - (7)].trans.ref)[3] == 0) { // means that the object is not transparent! Vertex c((yyvsp[(3) - (7)].vect)[0], (yyvsp[(3) - (7)].vect)[1], (yyvsp[(3) - (7)].vect)[2]); real_t& r = (yyvsp[(5) - (7)].val); parsetrans& transformations = (yyvsp[(6) - (7)].trans); Shape* s = new Sphere(c,r); (*s).parseTransform(transformations); if ((yyvsp[(6) - (7)].trans.inverse)) { s = new Not(new Object(s)); } Object* O = new Object(s); if ((yyvsp[(6) - (7)].trans.hasRef)) { O->setReference(TinyVector<3>((yyvsp[(6) - (7)].trans.ref)[0], (yyvsp[(6) - (7)].trans.ref)[1], (yyvsp[(6) - (7)].trans.ref)[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } break; case 22: #line 465 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { if ((yyvsp[(6) - (7)].trans.ref)[3] == 0) { // means that the object is not transparent! real_t& r1 = (yyvsp[(3) - (7)].val); real_t& r2 = (yyvsp[(5) - (7)].val); parsetrans& transformations = (yyvsp[(6) - (7)].trans); Shape* s = new Torus(r1,r2); (*s).parseTransform(transformations); if ((yyvsp[(6) - (7)].trans.inverse)) { s = new Not(new Object(s)); } Object* O = new Object(s); if ((yyvsp[(6) - (7)].trans.hasRef)) { O->setReference(TinyVector<3>((yyvsp[(6) - (7)].trans.ref)[0], (yyvsp[(6) - (7)].trans.ref)[1], (yyvsp[(6) - (7)].trans.ref)[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } break; case 23: #line 496 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { Vertex a((yyvsp[(3) - (7)].vect)[0], (yyvsp[(3) - (7)].vect)[1], (yyvsp[(3) - (7)].vect)[2]); Vertex b((yyvsp[(5) - (7)].vect)[0], (yyvsp[(5) - (7)].vect)[1], (yyvsp[(5) - (7)].vect)[2]); if ((yyvsp[(6) - (7)].trans.ref)[3] == 0) { // means the object is not transparent parsetrans& transformations = (yyvsp[(6) - (7)].trans); Shape* s = new Cube(a,b); (*s).parseTransform(transformations); if ((yyvsp[(6) - (7)].trans.inverse)) { s = new Not(new Object(s)); } Object* O = new Object(s); if ((yyvsp[(6) - (7)].trans.hasRef)) { O->setReference(TinyVector<3>((yyvsp[(6) - (7)].trans.ref)[0], (yyvsp[(6) - (7)].trans.ref)[1], (yyvsp[(6) - (7)].trans.ref)[2])); } /* put the cube in the list */ if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } else { SB = SceneBox(a, b); } } } break; case 24: #line 529 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { if ((yyvsp[(8) - (9)].trans.ref)[3] == 0) { // means the object is not transparent Vertex a((yyvsp[(3) - (9)].vect)[0], (yyvsp[(3) - (9)].vect)[1], (yyvsp[(3) - (9)].vect)[2]); Vertex b((yyvsp[(5) - (9)].vect)[0], (yyvsp[(5) - (9)].vect)[1], (yyvsp[(5) - (9)].vect)[2]); real_t radius = (yyvsp[(7) - (9)].val); parsetrans& transformations = (yyvsp[(8) - (9)].trans); Shape* s = new Cylinder(a,b,radius); (*s).parseTransform(transformations); if ((yyvsp[(8) - (9)].trans.inverse)) { s = new Not(new Object(s)); } Object* O = new Object(s); if ((yyvsp[(8) - (9)].trans.hasRef)) { O->setReference( TinyVector<3>((yyvsp[(8) - (9)].trans.ref)[0], (yyvsp[(8) - (9)].trans.ref)[1], (yyvsp[(8) - (9)].trans.ref)[2])); } /* put the cylinder in the list */ if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } break; case 25: #line 561 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { if ((yyvsp[(8) - (11)].trans.ref)[3] == 0) { // means the object is not transparent Vertex a((yyvsp[(3) - (11)].vect)[0], (yyvsp[(3) - (11)].vect)[1], (yyvsp[(3) - (11)].vect)[2]); Vertex b((yyvsp[(7) - (11)].vect)[0], (yyvsp[(7) - (11)].vect)[1], (yyvsp[(7) - (11)].vect)[2]); real_t radius1 = (yyvsp[(5) - (11)].val); real_t radius2 = (yyvsp[(9) - (11)].val); parsetrans& transformations = (yyvsp[(10) - (11)].trans); Shape* s = new Cone(a,b,radius1, radius2); (*s).parseTransform(transformations); if ((yyvsp[(8) - (11)].trans.inverse)) { s = new Not(new Object(s)); } Object* O = new Object(s); if ((yyvsp[(10) - (11)].trans.hasRef)) { O->setReference( TinyVector<3>((yyvsp[(10) - (11)].trans.ref)[0], (yyvsp[(10) - (11)].trans.ref)[1], (yyvsp[(10) - (11)].trans.ref)[2])); } /* put the cylinder in the list */ if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } break; case 26: #line 594 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { if ((yyvsp[(6) - (7)].trans.ref)[3] == 0) { // means that the object is not transparent! Vertex c((yyvsp[(3) - (7)].vect)[0], (yyvsp[(3) - (7)].vect)[1], (yyvsp[(3) - (7)].vect)[2]); real_t& r = (yyvsp[(5) - (7)].val); parsetrans& transformations = (yyvsp[(6) - (7)].trans); Shape* s = new Plane(c,r); (*s).parseTransform(transformations); if ((yyvsp[(6) - (7)].trans.inverse)) { s = new Not(new Object(s)); } Object* O = new Object(s); if ((yyvsp[(6) - (7)].trans.hasRef)) { O->setReference( TinyVector<3>((yyvsp[(6) - (7)].trans.ref)[0], (yyvsp[(6) - (7)].trans.ref)[1], (yyvsp[(6) - (7)].trans.ref)[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } break; case 27: #line 624 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { BoolOpStack.push(BoolOp); // store previous context OpStack.push(std::vector >()); // start new vetor BoolOp = true; } } break; case 28: #line 632 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { if ((yyvsp[(5) - (6)].trans.ref)[3] == 0) { // means the object is not transparent BoolOp = BoolOpStack.top(); // revert to previous context BoolOpStack.pop(); Union* u = new Union(); for (size_t i=0; ipush_back(OpStack.top()[i]); OpStack.pop(); parsetrans& transformations = (yyvsp[(5) - (6)].trans); u->parseTransform(transformations); Object* O = new Object(u); if ((yyvsp[(5) - (6)].trans.hasRef)) { O->setReference(TinyVector<3>((yyvsp[(5) - (6)].trans.ref)[0], (yyvsp[(5) - (6)].trans.ref)[1], (yyvsp[(5) - (6)].trans.ref)[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } break; case 29: #line 660 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { BoolOpStack.push(BoolOp); // store previous context OpStack.push(std::vector >()); // start new vetor BoolOp = true; } } break; case 30: #line 668 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { if ((yyvsp[(5) - (6)].trans.ref)[3] == 0) { // means the object is not transparent BoolOp = BoolOpStack.top(); // revert to previous context BoolOpStack.pop(); Intersection* I = new Intersection(); for (size_t i=0; ipush_back(OpStack.top()[i]); OpStack.pop(); parsetrans& transformations = (yyvsp[(5) - (6)].trans); (*I).parseTransform(transformations); Object* O = new Object(I); if ((yyvsp[(5) - (6)].trans.hasRef)) { O->setReference( TinyVector<3>((yyvsp[(5) - (6)].trans.ref)[0], (yyvsp[(5) - (6)].trans.ref)[1], (yyvsp[(5) - (6)].trans.ref)[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } break; case 31: #line 697 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { BoolOpStack.push(BoolOp); // store previous context OpStack.push(std::vector >()); // start new vetor BoolOp = true; } } break; case 32: #line 705 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { if ((yyvsp[(5) - (6)].trans.ref)[3] == 0) { // means the object is not transparent BoolOp = BoolOpStack.top(); // revert to previous context BoolOpStack.pop(); Difference* d = new Difference(); for (size_t i=0; isetReference(TinyVector<3>((yyvsp[(5) - (6)].trans.ref)[0], (yyvsp[(5) - (6)].trans.ref)[1], (yyvsp[(5) - (6)].trans.ref)[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } break; case 33: #line 735 "/home/delpino/src/ff3d/language/parse.pov.yy" { // object is treated like an union limited to one object #ifdef __GNUC__ #warning REWORK OBJECT TREATMENT #endif // __GNUC__ if (execute) { BoolOpStack.push(BoolOp); // store previous context OpStack.push(std::vector >()); // start new vetor BoolOp = true; } } break; case 34: #line 746 "/home/delpino/src/ff3d/language/parse.pov.yy" { if (execute) { if ((yyvsp[(5) - (6)].trans.ref)[3] == 0) { // means the object is not transparent BoolOp = BoolOpStack.top(); // revert to previous context BoolOpStack.pop(); Union* u = new Union(); for (size_t i=0; isetReference(TinyVector<3>((yyvsp[(5) - (6)].trans.ref)[0], (yyvsp[(5) - (6)].trans.ref)[1], (yyvsp[(5) - (6)].trans.ref)[2])); } if (BoolOp) { OpStack.top().push_back(O); } else { pScene->add(O); } } } } break; case 37: #line 782 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.val) = (yyvsp[(1) - (1)].val); } break; case 38: #line 783 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.val) = (yyvsp[(1) - (3)].val) + (yyvsp[(3) - (3)].val); } break; case 39: #line 784 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.val) = (yyvsp[(1) - (3)].val) - (yyvsp[(3) - (3)].val); } break; case 40: #line 785 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.val) = (yyvsp[(1) - (3)].val) * (yyvsp[(3) - (3)].val); } break; case 41: #line 786 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.val) = (yyvsp[(1) - (3)].val) / (yyvsp[(3) - (3)].val); } break; case 42: #line 787 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.val) = (yyvsp[(2) - (3)].val) ; } break; case 43: #line 788 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.val) = -(yyvsp[(2) - (2)].val); } break; case 44: #line 791 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = (fabs((yyvsp[(1) - (1)].val))>1E-6); } break; case 45: #line 792 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = ((yyvsp[(1) - (3)].val) > (yyvsp[(3) - (3)].val)); } break; case 46: #line 793 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = ((yyvsp[(1) - (3)].val) < (yyvsp[(3) - (3)].val)); } break; case 47: #line 794 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = ((yyvsp[(1) - (3)].val) >= (yyvsp[(3) - (3)].val)); } break; case 48: #line 795 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = ((yyvsp[(1) - (3)].val) <= (yyvsp[(3) - (3)].val)); } break; case 49: #line 796 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = ((yyvsp[(1) - (3)].val) == (yyvsp[(3) - (3)].val)); } break; case 50: #line 797 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = ((yyvsp[(1) - (3)].val) != (yyvsp[(3) - (3)].val)); } break; case 51: #line 798 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); } break; case 52: #line 799 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); } break; case 53: #line 800 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = !((yyvsp[(2) - (2)].integer)); } break; case 54: #line 801 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.integer) = (yyvsp[(2) - (3)].integer); } break; case 55: #line 808 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.mat)[ 0] = (yyvsp[(2) - (25)].val); (yyval.mat)[ 1] = (yyvsp[(4) - (25)].val); (yyval.mat)[ 2] = (yyvsp[(6) - (25)].val); (yyval.mat)[ 3] = (yyvsp[(8) - (25)].val); (yyval.mat)[ 4] = (yyvsp[(10) - (25)].val); (yyval.mat)[ 5] = (yyvsp[(12) - (25)].val); (yyval.mat)[ 6] = (yyvsp[(14) - (25)].val); (yyval.mat)[ 7] = (yyvsp[(16) - (25)].val); (yyval.mat)[ 8] = (yyvsp[(18) - (25)].val); (yyval.mat)[ 9] = (yyvsp[(20) - (25)].val); (yyval.mat)[10] = (yyvsp[(22) - (25)].val); (yyval.mat)[11] = (yyvsp[(24) - (25)].val); } break; case 56: #line 824 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.vect)[0] = (yyvsp[(2) - (7)].val); (yyval.vect)[1] = (yyvsp[(4) - (7)].val); (yyval.vect)[2] = (yyvsp[(6) - (7)].val); } break; case 57: #line 829 "/home/delpino/src/ff3d/language/parse.pov.yy" { // opposit vector (yyval.vect)[0] = - (yyvsp[(2) - (2)].vect)[0]; (yyval.vect)[1] = - (yyvsp[(2) - (2)].vect)[1]; (yyval.vect)[2] = - (yyvsp[(2) - (2)].vect)[2]; } break; case 58: #line 834 "/home/delpino/src/ff3d/language/parse.pov.yy" { // difference between 2 vectors (yyval.vect)[0] = (yyvsp[(1) - (3)].vect)[0] - (yyvsp[(3) - (3)].vect)[0]; (yyval.vect)[1] = (yyvsp[(1) - (3)].vect)[1] - (yyvsp[(3) - (3)].vect)[1]; (yyval.vect)[2] = (yyvsp[(1) - (3)].vect)[2] - (yyvsp[(3) - (3)].vect)[2]; } break; case 59: #line 839 "/home/delpino/src/ff3d/language/parse.pov.yy" { // sum of 2 vectors (yyval.vect)[0] = (yyvsp[(1) - (3)].vect)[0] + (yyvsp[(3) - (3)].vect)[0]; (yyval.vect)[1] = (yyvsp[(1) - (3)].vect)[1] + (yyvsp[(3) - (3)].vect)[1]; (yyval.vect)[2] = (yyvsp[(1) - (3)].vect)[2] + (yyvsp[(3) - (3)].vect)[2]; } break; case 60: #line 844 "/home/delpino/src/ff3d/language/parse.pov.yy" { // product by a scalar on right (yyval.vect)[0] = (yyvsp[(1) - (3)].vect)[0] * (yyvsp[(3) - (3)].val); (yyval.vect)[1] = (yyvsp[(1) - (3)].vect)[1] * (yyvsp[(3) - (3)].val); (yyval.vect)[2] = (yyvsp[(1) - (3)].vect)[2] * (yyvsp[(3) - (3)].val); } break; case 61: #line 849 "/home/delpino/src/ff3d/language/parse.pov.yy" { // division by a scalar on right (yyval.vect)[0] = (yyvsp[(1) - (3)].vect)[0] / (yyvsp[(3) - (3)].val); (yyval.vect)[1] = (yyvsp[(1) - (3)].vect)[1] / (yyvsp[(3) - (3)].val); (yyval.vect)[2] = (yyvsp[(1) - (3)].vect)[2] / (yyvsp[(3) - (3)].val); } break; case 62: #line 854 "/home/delpino/src/ff3d/language/parse.pov.yy" { // product by a scalar on left (yyval.vect)[0] = (yyvsp[(3) - (3)].vect)[0] * (yyvsp[(1) - (3)].val); (yyval.vect)[1] = (yyvsp[(3) - (3)].vect)[1] * (yyvsp[(1) - (3)].val); (yyval.vect)[2] = (yyvsp[(3) - (3)].vect)[2] * (yyvsp[(1) - (3)].val); } break; case 63: #line 861 "/home/delpino/src/ff3d/language/parse.pov.yy" { (yyval.vect4)[0] = (yyvsp[(2) - (9)].val); (yyval.vect4)[1] = (yyvsp[(4) - (9)].val); (yyval.vect4)[2] = (yyvsp[(6) - (9)].val); (yyval.vect4)[3] = (yyvsp[(8) - (9)].val); } break; case 64: #line 867 "/home/delpino/src/ff3d/language/parse.pov.yy" { // opposit vector4 for (size_t i=0; i<4; ++i) (yyval.vect4)[i] = - (yyvsp[(2) - (2)].vect4)[i]; } break; case 65: #line 871 "/home/delpino/src/ff3d/language/parse.pov.yy" { // difference between 2 vector4s for (size_t i=0; i<4; ++i) (yyval.vect4)[i] = (yyvsp[(1) - (3)].vect4)[i] - (yyvsp[(3) - (3)].vect4)[i]; } break; case 66: #line 875 "/home/delpino/src/ff3d/language/parse.pov.yy" { // sum of 2 vector4s for (size_t i=0; i<4; ++i) (yyval.vect4)[i] = (yyvsp[(1) - (3)].vect4)[i] + (yyvsp[(3) - (3)].vect4)[i]; } break; case 67: #line 879 "/home/delpino/src/ff3d/language/parse.pov.yy" { // product by a scalar on right for (size_t i=0; i<4; ++i) (yyval.vect4)[i] = (yyvsp[(1) - (3)].vect4)[i] * (yyvsp[(3) - (3)].val); } break; case 68: #line 883 "/home/delpino/src/ff3d/language/parse.pov.yy" { // division by a scalar on right for (size_t i=0; i<4; ++i) (yyval.vect4)[i] = (yyvsp[(1) - (3)].vect4)[i] / (yyvsp[(3) - (3)].val); } break; case 69: #line 887 "/home/delpino/src/ff3d/language/parse.pov.yy" { // product by a scalar on left for (size_t i=0; i<4; ++i) (yyval.vect4)[i] = (yyvsp[(3) - (3)].vect4)[i] * (yyvsp[(1) - (3)].val); } break; /* Line 1267 of yacc.c. */ #line 2674 "parse.pov.cc" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } #line 892 "/home/delpino/src/ff3d/language/parse.pov.yy" void yyerror(char * s) { throw ErrorHandler("PARSED FILE",povlexer->lineno(), stringify(s)+"'"+povlexer->YYText()+"' unexpected", ErrorHandler::compilation); } void declarevar (char* name, char* val) { bool found = false; int varnum = 0; std::string expendval = val; // Substitute variables value in varname. expend(expendval); for (int i=0; i= 0) { bool replace = true; if (begining > 0) { replace = !isalnum(expendval[begining-1]); } replace = (replace) && isalnum(expendval[begining+var.size()]); if (replace) { std::stringstream tempstr; for (int i=0; i #include #include #include class SubOptionListExpression : public Expression { public: typedef std::list > SubOptionList; private: SubOptionList __list; std::ostream& put(std::ostream& os) const { os << '\n' <<__FILE__ << ':' << __LINE__ << ": Not implemented\n"; return os; } public: void execute() { for (SubOptionList::iterator i = __list.begin(); i != __list.end(); ++i) { (*(*i)).execute(); } } void evaluate(const std::string& basename) { for (SubOptionList::iterator i = __list.begin(); i != __list.end(); ++i) { (*(*i)).evaluate(basename); } } void add(ReferenceCounting soe) { __list.push_back(soe); } SubOptionListExpression() : Expression(Expression::subOptionList) { ; } ~SubOptionListExpression() { ; } }; #endif // _SUB_OPTION_LIST_EXPRESSION_HPP_ freefem3d-1.0pre10/language/FunctionExpressionBinaryOperation.hpp0000644000175000017500000000534310561425532022202 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionBinaryOperation.hpp,v 1.2 2006/07/30 22:23:10 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_BINARY_OPERATION_HPP #define FUNCTION_EXPRESSION_BINARY_OPERATION_HPP #include #include /** * @file FunctionExpressionBinaryOperation.hpp * @author Stephane Del Pino * @date Tue Jul 4 01:15:48 2006 * * @brief FunctionExpression described as binary operators * */ class FunctionExpressionBinaryOperation : public FunctionExpression { private: BinaryOperation __type; /**< type of binary operators */ ReferenceCounting __fExpression; /**< first operand */ ReferenceCounting __gExpression; /**< second operand */ public: /** * Overload of the execution of Expression * */ void execute(); /** * Returns true if the function has a boundary * * @return true if __fExpression or __gExpression has a boundary */ bool hasBoundaryExpression() const; /** * Constructor * * @param operatorName the name of the operator * @param f the first operand * @param g the second operand */ FunctionExpressionBinaryOperation(const std::string& operatorName, ReferenceCounting f, ReferenceCounting g); /** * Constructor * * @param type the binary operation type * @param f the first operand * @param g the second operand */ FunctionExpressionBinaryOperation(const BinaryOperation::Type& type, ReferenceCounting f, ReferenceCounting g); /** * Copy constructor * * @param f the original binary operator function expression */ FunctionExpressionBinaryOperation(const FunctionExpressionBinaryOperation& f); /** * Destructor * */ ~FunctionExpressionBinaryOperation(); }; #endif // FUNCTION_EXPRESSION_BINARY_OPERATION_HPP freefem3d-1.0pre10/language/BoundaryExpressionSurfaceMesh.cpp0000644000175000017500000000607610624156366021305 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryExpressionSurfaceMesh.cpp,v 1.3 2007/05/20 23:02:48 delpinux Exp $ #include #include #include #include #include #include #include std::ostream& BoundaryExpressionSurfaceMesh:: put(std::ostream& os) const { os << "Surface Mesh"; return os; } void BoundaryExpressionSurfaceMesh:: execute() { __surfaceMeshExpression->execute(); Mesh* m = __surfaceMeshExpression->mesh(); switch (m->family()) { case Mesh::volume: { switch (m->type()) { case Mesh::cartesianHexahedraMesh: { const Structured3DMesh& mesh = dynamic_cast(*m); const SurfaceMesh* surface = mesh.surfaceMesh(); __boundary = new BoundarySurfaceMesh(surface); break; } case Mesh::tetrahedraMesh: { const MeshOfTetrahedra& mesh = dynamic_cast(*m); const SurfaceMesh* surface = mesh.surfaceMesh(); __boundary = new BoundarySurfaceMesh(surface); break; } case Mesh::hexahedraMesh: { const MeshOfHexahedra& mesh = dynamic_cast(*m); const SurfaceMesh* surface = mesh.surfaceMesh(); __boundary = new BoundarySurfaceMesh(surface); break; } default: { throw ErrorHandler(__BASE_FILE__,__LINE__, "Unexpected volume mesh type", ErrorHandler::unexpected); } } break; } case Mesh::surface: { ASSERT(m->type() == Mesh::surfaceMeshTriangles); __boundary = new BoundarySurfaceMesh(dynamic_cast(m)); break; } default: { throw ErrorHandler(__BASE_FILE__,__LINE__, "Unexpected mesh family", ErrorHandler::unexpected); } } } BoundaryExpressionSurfaceMesh:: BoundaryExpressionSurfaceMesh(ReferenceCounting m) : BoundaryExpression(BoundaryExpression::surfaceMesh), __surfaceMeshExpression(m) { ; } BoundaryExpressionSurfaceMesh:: BoundaryExpressionSurfaceMesh(const BoundaryExpressionSurfaceMesh& m) : BoundaryExpression(m), __surfaceMeshExpression(m.__surfaceMeshExpression) { ; } BoundaryExpressionSurfaceMesh:: ~BoundaryExpressionSurfaceMesh() { ; } freefem3d-1.0pre10/language/FFLexer.hpp0000644000175000017500000000451610603507673014607 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FFLexer.hpp,v 1.7 2007/02/08 23:19:38 delpinux Exp $ #include #include #include #include #include #ifndef FFLEXER_HPP #define FFLEXER_HPP /*! \class FFLexer This class is a the specialized Lexer for the FreeFEM language. \author Stéphane Del Pino */ class Variable; class FFLexer : public Lexer { private: /*! This function returns the token associated to the name "word" if it corresponds to a Keyword, else, it returns "-1". */ int isKeyword (const std::string& word); /*! This function returns the token associated to the name "word" if it corresponds to a variable, else, it returns "-1". */ int isVariable(const std::string& word); /*! This function returns the token associated to the name "word" if it corresponds to an Option, else, it returns "-1". */ int isOption (const std::string& word); //! This contains the list of kewords used for options management IdentifierSet __optionsKeyWords; public: /** * Fills @a kw the keyword/token associatino list * * @param kw keywords list */ static void define(KeyWordList& kw); //! The lexer function. int yylex(); enum Context { defaultContext, variationalContext }; void switchToContext(const FFLexer::Context context); //! Constructs a FFLexer for given std::istream and std::ostream. FFLexer(std::istream& In, std::ostream& Out = std::cout); //! Destructor. ~FFLexer() { ; } }; #endif // FFLEXER_HPP freefem3d-1.0pre10/language/Variable.cpp0000644000175000017500000001530610562730012015020 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: Variable.cpp,v 1.7 2007/02/08 23:19:38 delpinux Exp $ #include #include #include #include #include #include #include #include #include ReferenceCounting RealVariable:: expression() const { return __expression; } ConstReferenceCounting RealVariable::operator=(ReferenceCounting e) { __expression=e->value(); return __expression; } RealVariable::RealVariable(const std::string& name, ReferenceCounting expression) : Variable(name, Variable::real), __expression(expression) { ; } RealVariable::RealVariable(const RealVariable& rv) : Variable(rv), __expression(rv.__expression) { ; } RealVariable::~RealVariable() { ; } ReferenceCounting Vector3Variable:: expression() const { return __expression; } ConstReferenceCounting Vector3Variable::operator=(ReferenceCounting e) { __expression=e; return __expression; } Vector3Variable::Vector3Variable(const std::string& name, ReferenceCounting expression) : Variable(name, Variable::vector3), __expression(expression) { ; } Vector3Variable::Vector3Variable(const Vector3Variable& rv) : Variable(rv), __expression(rv.__expression) { ; } Vector3Variable::~Vector3Variable() { ; } ReferenceCounting FunctionVariable::expression() const { return __expression; } ConstReferenceCounting FunctionVariable::operator=(ReferenceCounting e) { __expression = e->value(); return __expression; } FunctionVariable::FunctionVariable(const std::string& name, ReferenceCounting expression) : Variable(name, Variable::function), __expression(expression), __subscribed(false) { ; } FunctionVariable::FunctionVariable(const FunctionVariable& rv) : Variable(rv), __expression(rv.__expression), __subscribed(rv.__subscribed) { ; } FunctionVariable::~FunctionVariable() { ; } TestFunctionVariable:: TestFunctionVariable(const std::string& name) : Variable(name, Variable::testFuncion) { ; } TestFunctionVariable:: TestFunctionVariable(const TestFunctionVariable& rv) : Variable(rv) { ; } TestFunctionVariable::~TestFunctionVariable() { ; } ReferenceCounting MeshVariable:: expression() const { if(__expression == 0) { throw ErrorHandler(__FILE__,__LINE__, "undefined mesh '"+name()+"'", ErrorHandler::normal); } return __expression; } ConstReferenceCounting MeshVariable::operator=(ReferenceCounting e) { __expression = e; return __expression; } MeshVariable::MeshVariable(const std::string& name) : Variable(name, Variable::mesh), __expression(0) { ; } MeshVariable::MeshVariable(const std::string& name, ReferenceCounting expression) : Variable(name, Variable::mesh), __expression(expression) { ; } MeshVariable::MeshVariable(const MeshVariable& rv) : Variable(rv), __expression(rv.__expression) { } MeshVariable::~MeshVariable() { ; } ReferenceCounting SceneVariable:: expression() const { if(__expression == 0) { throw ErrorHandler(__FILE__,__LINE__, "undefined scene '"+name()+"'", ErrorHandler::normal); } return __expression; } ConstReferenceCounting SceneVariable::operator=(ReferenceCounting e) { __expression = e; return __expression; } SceneVariable::SceneVariable(const std::string& name) : Variable(name, Variable::scene), __expression(0) { fferr(2) << "\nstoring scene " << name << '\n'; } SceneVariable::SceneVariable(const std::string& name, ReferenceCounting expression) : Variable(name, Variable::scene), __expression(expression) { ; } SceneVariable::SceneVariable(const SceneVariable& rv) : Variable(rv), __expression(rv.__expression) { } SceneVariable::~SceneVariable() { ; } ReferenceCounting DomainVariable:: expression() const { if(__expression == 0) { throw ErrorHandler(__FILE__,__LINE__, "undefined domain '"+name()+"'", ErrorHandler::normal); } return __expression; } ConstReferenceCounting DomainVariable:: operator=(ReferenceCounting e) { __expression = e; return __expression; } DomainVariable::DomainVariable(const std::string& name) : Variable(name, Variable::domain), __expression(0) { ; } DomainVariable::DomainVariable(const std::string& name, ReferenceCounting expression) : Variable(name, Variable::domain), __expression(expression) { ; } DomainVariable::DomainVariable(const DomainVariable& rv) : Variable(rv), __expression(rv.__expression) { } DomainVariable::~DomainVariable() { ; } ReferenceCounting OFStreamVariable:: expression() const { if(__expression == 0) { throw ErrorHandler(__FILE__,__LINE__, "undefined ofstream '"+name()+"'", ErrorHandler::normal); } return __expression; } ConstReferenceCounting OFStreamVariable:: operator=(ReferenceCounting e) { __expression = e; return __expression; } OFStreamVariable::OFStreamVariable(const std::string& name) : Variable(name, Variable::ofstream), __expression(0) { ; } OFStreamVariable::OFStreamVariable(const std::string& name, ReferenceCounting expression) : Variable(name, Variable::ofstream), __expression(expression) { ; } OFStreamVariable::OFStreamVariable(const OFStreamVariable& rv) : Variable(rv), __expression(rv.__expression) { } OFStreamVariable::~OFStreamVariable() { ; } freefem3d-1.0pre10/language/FunctionExpressionUnaryMinus.cpp0000644000175000017500000000343510561425532021202 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionUnaryMinus.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include void FunctionExpressionUnaryMinus:: execute() { __givenFunction->execute(); ScalarFunctionBuilder functionBuilder; functionBuilder.setFunction(__givenFunction->function()); functionBuilder.setUnaryMinus(); __scalarFunction = functionBuilder.getBuiltFunction(); } bool FunctionExpressionUnaryMinus:: hasBoundaryExpression() const { return __givenFunction->hasBoundaryExpression(); } FunctionExpressionUnaryMinus:: FunctionExpressionUnaryMinus(ReferenceCounting f) : FunctionExpression(FunctionExpression::unaryMinus), __givenFunction(f) { ; } FunctionExpressionUnaryMinus:: FunctionExpressionUnaryMinus(const FunctionExpressionUnaryMinus& f) : FunctionExpression(f), __givenFunction(f.__givenFunction) { ; } FunctionExpressionUnaryMinus:: ~FunctionExpressionUnaryMinus() { ; } freefem3d-1.0pre10/language/FunctionExpressionValue.cpp0000644000175000017500000000263410561425532020144 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionValue.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include FunctionExpressionValue:: FunctionExpressionValue(ConstReferenceCounting f, const bool& hasBoundary) : FunctionExpression(FunctionExpression::functionValue), __hasBoundary(hasBoundary) { __scalarFunction = f; } FunctionExpressionValue:: FunctionExpressionValue(const FunctionExpressionValue& f) : FunctionExpression(f), __hasBoundary(f.__hasBoundary) { ; } FunctionExpressionValue:: ~FunctionExpressionValue() { ; } freefem3d-1.0pre10/language/FunctionExpressionDerivative.hpp0000644000175000017500000000553410561425532021201 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionDerivative.hpp,v 1.2 2006/07/23 22:14:19 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_DERIVATIVE_HPP #define FUNCTION_EXPRESSION_DERIVATIVE_HPP #include #include /** * @file FunctionExpressionDerivative.hpp * @author Stephane Del Pino * @date Tue Jul 4 01:43:55 2006 * * @brief Computes the derivative of a function expression * */ class FunctionExpressionDerivative : public FunctionExpression { public: enum Direction { x, y, z, undefined }; private: FunctionExpressionDerivative::Direction __direction; /**< direction of derivation */ ReferenceCounting __derivedFunction; /**< function to derive */ /** * returns @b true if the function to derive has a boundary * * @return true if the function to derive has a boundary */ bool hasBoundaryExpression() const { return __derivedFunction->hasBoundaryExpression(); } /** * converts the string direction name to a the type Direction * * @param name name of the direction * * @return associated enumerate value */ static FunctionExpressionDerivative::Direction getDirection(const std::string& name) { if (name == "dx") return x; if (name == "dy") return y; if (name == "dz") return z; throw ErrorHandler(__FILE__,__LINE__, "unknown derivation direction", ErrorHandler::unexpected); return undefined; } public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param directionName derivation direction * @param function function to derive */ FunctionExpressionDerivative(const std::string& directionName, ReferenceCounting function); /** * Copy constructor * * @param f the derivative function expression */ FunctionExpressionDerivative(const FunctionExpressionDerivative& f); /** * Destructor * */ ~FunctionExpressionDerivative(); }; #endif // FUNCTION_EXPRESSION_DERIVATIVE_HPP freefem3d-1.0pre10/language/FieldExpressionList.cpp0000644000175000017500000000363610624156366017252 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FieldExpressionList.cpp,v 1.2 2007/05/20 23:02:48 delpinux Exp $ #include std::ostream& FieldExpressionList:: put(std::ostream& os) const { ASSERT(__list.size()>0); if (__list.size()>1) { os << '{'; } os << *__list[0]; for (size_t i=1; i<__list.size(); ++i) { os << ',' << *__list[i]; } if (__list.size()>1) { os << '}'; } return os; } ReferenceCounting FieldExpressionList:: field(const size_t& i) { ASSERT(i<__list.size()); return __list[i]; } ConstReferenceCounting FieldExpressionList:: field(const size_t& i) const { ASSERT(i<__list.size()); return __list[i]; } void FieldExpressionList:: execute() { for (size_t i=0; i<__list.size(); ++i) { __list[i]->execute(); } } size_t FieldExpressionList:: numberOfFields() const { return __list.size(); } void FieldExpressionList:: add(ReferenceCounting field) { __list.push_back(field); } FieldExpressionList:: FieldExpressionList() : Expression(Expression::fieldlist) { ; } FieldExpressionList:: ~FieldExpressionList() { ; } freefem3d-1.0pre10/language/UnknownExpressionFunction.cpp0000644000175000017500000000236510624155672020535 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2007 Stéphane Del Pino // 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, 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. // $Id: UnknownExpressionFunction.cpp,v 1.1 2007/05/20 23:37:30 delpinux Exp $ #include void UnknownExpressionFunction:: __preExecute() { ; } UnknownExpressionFunction:: UnknownExpressionFunction(const std::string& name, const DiscretizationType::Type& type) : UnknownExpression(UnknownExpression::declaration, name, type) { ; } UnknownExpressionFunction:: ~UnknownExpressionFunction() { ; } freefem3d-1.0pre10/language/IntegratedExpression.hpp0000644000175000017500000000745210563377365017474 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: IntegratedExpression.hpp,v 1.4 2007/02/10 17:20:53 delpinux Exp $ #ifndef INTEGRATED_EXPRESSION_HPP #define INTEGRATED_EXPRESSION_HPP #include class IntegratedExpression : public Expression { public: enum IType { unknownFunction, testFunction, function }; private: IType __integratedExpressionType; public: const IType& integratedExpressionType() const { return __integratedExpressionType; } IntegratedExpression(IntegratedExpression::IType t) : Expression(Expression::integrated), __integratedExpressionType(t) { ; } IntegratedExpression(const IntegratedExpression& I) : Expression(I), __integratedExpressionType(I.__integratedExpressionType) { ; } ~IntegratedExpression() { ; } }; class IntegratedExpressionUnknown : public IntegratedExpression { private: const std::string __unknownName; std::ostream& put(std::ostream& os) const { os << __unknownName; return os; } public: void execute() { ; } const std::string& unknownName() const { return __unknownName; } IntegratedExpressionUnknown(const std::string& unknownName) : IntegratedExpression(IntegratedExpression::unknownFunction), __unknownName(unknownName) { ; } IntegratedExpressionUnknown(const IntegratedExpressionUnknown& I) : IntegratedExpression(I), __unknownName(I.__unknownName) { ; } ~IntegratedExpressionUnknown() { ; } }; class IntegratedExpressionTest : public IntegratedExpression { private: const std::string __testFunctionName; std::ostream& put(std::ostream& os) const { os << __testFunctionName; return os; } public: void execute() { ; } const std::string& testFunctionName() const { return __testFunctionName; } IntegratedExpressionTest(const std::string& testFunctionName) : IntegratedExpression(IntegratedExpression::testFunction), __testFunctionName(testFunctionName) { ; } IntegratedExpressionTest(const IntegratedExpressionTest& I) : IntegratedExpression(I), __testFunctionName(I.__testFunctionName) { ; } ~IntegratedExpressionTest() { ; } }; class IntegratedExpressionFunctionExpression : public IntegratedExpression { private: ReferenceCounting __function; std::ostream& put(std::ostream& os) const { os << (*__function); return os; } public: void execute() { (*__function).execute(); } ReferenceCounting function() const { return __function; } IntegratedExpressionFunctionExpression(ReferenceCounting F) : IntegratedExpression(IntegratedExpression::function), __function(F) { ; } IntegratedExpressionFunctionExpression(const IntegratedExpressionFunctionExpression& I) : IntegratedExpression(I), __function(I.__function) { ; } ~IntegratedExpressionFunctionExpression() { ; } }; #endif // INTEGRATED_EXPRESSION_HPP freefem3d-1.0pre10/language/PDEOperatorExpression.hpp0000644000175000017500000002503510624156366017521 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: PDEOperatorExpression.hpp,v 1.10 2007/05/20 23:02:48 delpinux Exp $ #ifndef PDE_OPERATOR_EXPRESSION_HPP #define PDE_OPERATOR_EXPRESSION_HPP #include #include #include #include #include #include #include #include class PDEOperator; class PDEOperatorExpression : public Expression { public: enum PDEOperatorType { scalar, vectorial }; protected: PDEOperatorType __pdeOperatorType; virtual void __execute() = 0; public: virtual bool __checkBoundaryExpression() const = 0; void execute(); const PDEOperatorType& pdeOperatorType() const { return __pdeOperatorType; } PDEOperatorExpression(const PDEOperatorExpression& e); PDEOperatorExpression(PDEOperatorType t); virtual ~PDEOperatorExpression(); }; class PDEScalarOperatorExpression : public PDEOperatorExpression { public: enum PDEScalarOperatorType { divMuGrad, secondOrder, firstOrder, zerothOrder }; protected: const std::string __unknownName; ReferenceCounting __pdeOperator; private: PDEScalarOperatorType __pdeScalarOperatorType; public: const std::string& unknownName() const { return __unknownName; } ReferenceCounting pdeOperator(); PDEScalarOperatorExpression(const PDEScalarOperatorExpression& e); PDEScalarOperatorExpression(const std::string& unknownName, PDEScalarOperatorType t); virtual ~PDEScalarOperatorExpression(); }; class PDEVectorialOperatorExpression : public PDEOperatorExpression { public: enum PDEScalarOperatorType { firstOrder, secondOrder }; public: typedef std::map > PDEOperatorList; protected: PDEOperatorList __pdeOperatorList; private: PDEScalarOperatorType __pdeOperatorType; public: PDEVectorialOperatorExpression::PDEOperatorList& pdeOperatorList() { return __pdeOperatorList; } PDEVectorialOperatorExpression(const PDEVectorialOperatorExpression:: PDEScalarOperatorType& t); PDEVectorialOperatorExpression(const PDEVectorialOperatorExpression& e); virtual ~PDEVectorialOperatorExpression(); }; class PDEScalarOperatorExpressionDivMuGrad : public PDEScalarOperatorExpression { private: ReferenceCounting __mu; std::ostream& put(std::ostream& os) const { os << "div(" << (*__mu) << "*grad(" << __unknownName << "))"; return os; } void __execute(); public: bool __checkBoundaryExpression() const; PDEScalarOperatorExpressionDivMuGrad(const std::string& unknownName, ReferenceCounting mu) : PDEScalarOperatorExpression(unknownName, PDEScalarOperatorExpression::divMuGrad), __mu(mu) { ; } PDEScalarOperatorExpressionDivMuGrad(const PDEScalarOperatorExpressionDivMuGrad& re) : PDEScalarOperatorExpression(re), __mu(re.__mu) { ; } ~PDEScalarOperatorExpressionDivMuGrad() { ; } }; class PDEScalarOperatorExpressionOrderZero : public PDEScalarOperatorExpression { private: ReferenceCounting __Alpha; std::ostream& put(std::ostream& os) const { os << (*__Alpha) << '*' << __unknownName; return os; } void __execute(); public: bool __checkBoundaryExpression() const; PDEScalarOperatorExpressionOrderZero(const std::string& unknownName, ReferenceCounting alpha) : PDEScalarOperatorExpression(unknownName, PDEScalarOperatorExpression::zerothOrder), __Alpha(alpha) { ; } PDEScalarOperatorExpressionOrderZero(const PDEScalarOperatorExpressionOrderZero& re) : PDEScalarOperatorExpression(re), __Alpha(re.__Alpha) { ; } ~PDEScalarOperatorExpressionOrderZero() { ; } }; class PDEScalarOperatorExpressionOrderOne : public PDEScalarOperatorExpression { protected: ReferenceCounting __nu[3]; std::ostream& put(std::ostream& os) const { const char d[3] = { 'x', 'y', 'z'}; bool plus = false; for (size_t i=0; i<3; ++i) if (__nu[i] != 0) { if (plus) os << '+'; os << *(__nu[i]) << "*d" << d[i] << '(' << __unknownName << ')'; plus = true; } return os; } void __execute(); public: bool __checkBoundaryExpression() const; void operator*=(ReferenceCounting f) { for (size_t i=0; i<3; ++i) { if (__nu[i] != 0) __nu[i] = new FunctionExpressionBinaryOperation(BinaryOperation::product,f,__nu[i]); } } virtual void preexec() { for(size_t i=0; i<3; ++i) { if (__nu[i] != 0) (*__nu[i]).execute(); } } ReferenceCounting nu(const size_t i) const { ASSERT (i<3); return __nu[i]; } const std::string& unknownName() const { return __unknownName; } PDEScalarOperatorExpressionOrderOne(const std::string& operatorName, const std::string&unknownName, ReferenceCounting alpha) : PDEScalarOperatorExpression(unknownName, PDEScalarOperatorExpression::firstOrder) { __nu[0] = 0; __nu[1] = 0; __nu[2] = 0; if (operatorName == "dx") { __nu[0] = alpha; return; } if (operatorName == "dy") { __nu[1] = alpha; return; } if (operatorName == "dz") { __nu[2] = alpha; return; } } PDEScalarOperatorExpressionOrderOne(const std::string& unknownName) : PDEScalarOperatorExpression(unknownName, PDEScalarOperatorExpression::firstOrder) { for (size_t i=0; i<3; ++i) __nu[i] = 0; } PDEScalarOperatorExpressionOrderOne(const PDEScalarOperatorExpressionOrderOne& re) : PDEScalarOperatorExpression(re) { for (size_t i=0; i<3; ++i) __nu[i] = re.__nu[i]; } ~PDEScalarOperatorExpressionOrderOne() { ; } }; class PDEVectorialOperatorExpressionOrderTwo; class PDEVectorialOperatorExpressionOrderOne : public PDEVectorialOperatorExpression { friend class PDEVectorialOperatorExpressionOrderTwo; private: typedef std::multimap > FirstOrderSum; FirstOrderSum __sum; FirstOrderSum __diff; protected: std::ostream& put(std::ostream& os) const { bool plus = false; for (FirstOrderSum::const_iterator i = __sum.begin(); i != __sum.end(); ++i) { if (plus) os << '+'; os << (*(*i).second); plus = true; } for (FirstOrderSum::const_iterator i = __diff.begin(); i != __diff.end(); ++i) { os << '-' << (*(*i).second); } return os; } void __execute() { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } public: bool __checkBoundaryExpression() const; void operator*=(ReferenceCounting f) { for (FirstOrderSum::iterator i = __sum.begin(); i != __sum.end(); ++i) { (*(*i).second) *= f; } for (FirstOrderSum::iterator i = __diff.begin(); i != __diff.end(); ++i) { (*(*i).second) *= f; } } void operator+=(ReferenceCounting pdeOp) { __sum.insert(std::make_pair(pdeOp->unknownName(),pdeOp)); } void operator+=(ReferenceCounting pdeVectOp) { for (FirstOrderSum::iterator i = (*pdeVectOp).__sum.begin(); i != (*pdeVectOp).__sum.end(); ++i) { __sum.insert(*i); } for (FirstOrderSum::iterator i = (*pdeVectOp).__diff.begin(); i != (*pdeVectOp).__diff.end(); ++i) { __diff.insert(*i); } } void operator-=(ReferenceCounting pdeVectOp) { for (FirstOrderSum::iterator i = (*pdeVectOp).__sum.begin(); i != (*pdeVectOp).__sum.end(); ++i) { __diff.insert(*i); } for (FirstOrderSum::iterator i = (*pdeVectOp).__diff.begin(); i != (*pdeVectOp).__diff.end(); ++i) { __sum.insert(*i); } } void preexec() { for(FirstOrderSum::iterator i = __sum.begin(); i != __sum.end(); ++i) { (*(*i).second).preexec(); } for(FirstOrderSum::iterator i = __diff.begin(); i != __diff.end(); ++i) { (*(*i).second).preexec(); } } PDEVectorialOperatorExpressionOrderOne() : PDEVectorialOperatorExpression(PDEVectorialOperatorExpression::firstOrder) { ; } ~PDEVectorialOperatorExpressionOrderOne() { ; } }; class PDEVectorialOperatorExpressionOrderTwo : public PDEVectorialOperatorExpression { private: typedef std::multimap > FirstOperatorList; FirstOperatorList __firstOrderOp; std::ostream& put(std::ostream& os) const { const char x[3] = {'x', 'y', 'z'}; for (FirstOperatorList::const_iterator i = __firstOrderOp.begin(); i != __firstOrderOp.end(); ++i) { os << 'd' << x[(*i).first] << '(' << (*(*i).second) << ')'; } return os; } void __execute(); public: bool __checkBoundaryExpression() const; void add(const std::string& operatorName, ReferenceCounting pdeOp) { size_t operatorNumber = std::numeric_limits::max(); if (operatorName == "dx") { operatorNumber = 0; } if (operatorName == "dy") { operatorNumber = 1; } if (operatorName == "dz") { operatorNumber = 2; } if (operatorNumber > 2) { throw ErrorHandler(__FILE__,__LINE__, "unknown operator", ErrorHandler::unexpected); } __firstOrderOp.insert(std::pair >(operatorNumber, pdeOp)); } PDEVectorialOperatorExpressionOrderTwo(); ~PDEVectorialOperatorExpressionOrderTwo(); }; #endif // PDE_OPERATOR_EXPRESSION_HPP freefem3d-1.0pre10/language/SceneExpression.cpp0000644000175000017500000001215610624156366016425 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: SceneExpression.cpp,v 1.10 2007/05/20 23:02:48 delpinux Exp $ #include #include #include #include #include #include #include #include #include Scene* pScene; POVLexer* povlexer; // The parse function int povparse(); ReferenceCounting SceneExpression::scene() const { ASSERT(__sceneType != SceneExpression::undefined); return __scene; } SceneExpression::SceneExpression(const SceneExpression& e) : Expression(e), __scene(e.__scene), __sceneType(e.__sceneType) { ; } SceneExpression::SceneExpression(ReferenceCounting S, const SceneExpression::SceneType& t) : Expression(Expression::scene), __scene(S), __sceneType(t) { ; } SceneExpression::~SceneExpression() { ; } std::ostream& SceneExpressionPOVRay::put(std::ostream& os) const { // Scene& S = static_cast(*__scene); os << '\n' << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; return os; } void SceneExpressionPOVRay::execute() { (*__filename).execute(); const std::string& filename = (*__filename).value(); ffout(2) << "Building Scene ... "; __scene = new Scene(); ffout(2) << "done\n"; std::ifstream POVin(filename.c_str()); if (not(POVin)) { throw ErrorHandler(__FILE__,__LINE__, "error: cannot open file '"+stringify(filename)+"'", ErrorHandler::normal); } /********************************************************************** * VERY IMPORTANT: PARSER/LEXER MUST KNOW WHICH SCENE IT'S WORKING ON * **********************************************************************/ pScene = __scene; ffout(2) << "Parsing POVRay file: \"" << filename << "\"\n"; // Initialize Lexer to read geometry. povlexer = new POVLexer(POVin); // Parse the file to read geometry. povparse (); ffout(3) << "- the scene is composed of " << (*pScene).nbObjects() << " object(s)\n"; for (size_t i=0; i<(*__scene).nbObjects(); i++) ffout(4) << '\t' << (*__scene).object(i) << '\n'; ffout(2) << "Parsing POVRay file: done\n"; Information::instance().setScene(__scene); } SceneExpressionPOVRay:: SceneExpressionPOVRay(ReferenceCounting s) : SceneExpression(0, SceneExpression::povray), __filename(s) { ; } SceneExpressionPOVRay:: SceneExpressionPOVRay(const SceneExpressionPOVRay& m) : SceneExpression(m), __filename(m.__filename) { ; } SceneExpressionPOVRay:: ~SceneExpressionPOVRay() { ; } void SceneExpressionVariable::execute() { __sceneVariable = VariableRepository::instance().findVariable(__sceneName); __scene = __sceneVariable->expression()->scene(); } SceneExpressionVariable:: SceneExpressionVariable(const std::string& sceneName) : SceneExpression(0,SceneExpression::variable), __sceneName(sceneName), __sceneVariable(0) { ; } SceneExpressionVariable::SceneExpressionVariable(const SceneExpressionVariable& e) : SceneExpression(e), __sceneName(e.__sceneName), __sceneVariable(e.__sceneVariable) { ; } SceneExpressionVariable::~SceneExpressionVariable() { ; } std::ostream& SceneExpressionTransform::put(std::ostream& os) const { os << "transform(" << (*__sceneExpression) << ',' << (*__fieldExpression) << ')'; return os; } void SceneExpressionTransform::execute() { throw ErrorHandler(__FILE__, __LINE__, "not yet implemented", ErrorHandler::unexpected); } SceneExpressionTransform:: SceneExpressionTransform(const SceneExpressionTransform& s) : SceneExpression(s), __sceneExpression(s.__sceneExpression), __fieldExpression(s.__fieldExpression) { } SceneExpressionTransform:: SceneExpressionTransform(ReferenceCounting sceneExpression, ReferenceCounting fieldExpression) : SceneExpression(0, SceneExpression::transform), __sceneExpression(sceneExpression), __fieldExpression(fieldExpression) { ; } SceneExpressionTransform:: ~SceneExpressionTransform() { ; } SceneExpressionUndefined ::SceneExpressionUndefined() : SceneExpression(0, SceneExpression::undefined) { ; } SceneExpressionUndefined ::SceneExpressionUndefined(const SceneExpressionUndefined& m) : SceneExpression(m) { ; } SceneExpressionUndefined ::~SceneExpressionUndefined() { ; } freefem3d-1.0pre10/language/OStreamExpression.cpp0000644000175000017500000000421010624156366016732 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: OStreamExpression.cpp,v 1.6 2007/05/20 23:02:48 delpinux Exp $ #include #include #include #include std::ostream& OStreamExpression:: put(std::ostream & os) const { return os; } void OStreamExpression:: execute() { if (__ostream == 0) { __ofstreamVariable = VariableRepository::instance().findVariable(__ofstreamName); } } void OStreamExpression:: operator<<(Expression& E) { if (__ostream != 0) { (*__ostream) << E; } else { ASSERT(__ofstreamVariable->expression()->ofstream() != 0); (*__ofstreamVariable->expression()->ofstream()) << E << std::flush; } } OStreamExpression:: OStreamExpression(OStream* os) : Expression(Expression::ostreamexpression), __ofstreamName("none"), __ostream(os), __ofstreamVariable(0) { ; } OStreamExpression:: OStreamExpression(const std::string& ofstreamName) : Expression(Expression::ostreamexpression), __ofstreamName(ofstreamName), __ostream(0), __ofstreamVariable(0) { ; } OStreamExpression:: OStreamExpression(const OStreamExpression& os) : Expression(*this), __ofstreamName(os.__ofstreamName), __ostream(os.__ostream), __ofstreamVariable(os.__ofstreamVariable) { ; } OStreamExpression:: ~OStreamExpression() { ; } freefem3d-1.0pre10/language/FunctionExpressionVariable.cpp0000644000175000017500000000464010632110116020600 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionVariable.cpp,v 1.5 2007/06/07 22:40:31 delpinux Exp $ #include #include #include std::ostream& FunctionExpressionVariable:: put(std::ostream& os) const { os << __functionName; if (StreamCenter::instance().getDebugLevel() > 3) { os << '{' << (*__scalarFunction) << '}'; } return os; } ConstReferenceCounting FunctionExpressionVariable:: variable() const { return __functionVariable; } ReferenceCounting FunctionExpressionVariable:: variable() { return __functionVariable; } void FunctionExpressionVariable:: execute() { __functionVariable = VariableRepository::instance().findVariable(__functionName); __scalarFunction = __functionVariable->expression()->function(); ScalarFunctionBase& function = const_cast(*__scalarFunction); function.setName(__functionVariable->name()); } FunctionExpressionVariable:: FunctionExpressionVariable(const std::string& functionName, const DiscretizationType::Type& discretizationType) : FunctionExpression(FunctionExpression::variable), __functionName(functionName), __functionVariable(0), __discretizationType(discretizationType) { ; } FunctionExpressionVariable:: FunctionExpressionVariable(const FunctionExpressionVariable& f) : FunctionExpression(f), __functionName(f.__functionName), __functionVariable(f.__functionVariable), __discretizationType(f.__discretizationType) { ; } FunctionExpressionVariable:: ~FunctionExpressionVariable() { ; } freefem3d-1.0pre10/language/FunctionExpressionComposed.hpp0000644000175000017500000000530210561425532020641 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionComposed.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_COMPOSED_HPP #define FUNCTION_EXPRESSION_COMPOSED_HPP #include /** * @file FunctionExpressionComposed.hpp * @author Stephane Del Pino * @date Tue Jul 4 01:22:36 2006 * * @brief Function composition expression * * */ class FunctionExpressionComposed : public FunctionExpression { private: ReferenceCounting __function; /**< The function */ ReferenceCounting __functionExpressionX; /**< function returning \f$ x \f$ */ ReferenceCounting __functionExpressionY; /**< function returning \f$ y \f$ */ ReferenceCounting __functionExpressionZ; /**< function returning \f$ z \f$ */ public: /** * Return true if one of the functions has a boundary * * @return if one of the functions has a boundary */ bool hasBoundaryExpression() const { return (__function->hasBoundaryExpression() or __functionExpressionX->hasBoundaryExpression() or __functionExpressionY->hasBoundaryExpression() or __functionExpressionZ->hasBoundaryExpression()); } /** * execute the expression * */ void execute(); /** * Constructor * * @param f the function * @param X the @e x function * @param Y the @e y function * @param Z the @e z function * */ FunctionExpressionComposed(ReferenceCounting f, ReferenceCounting X, ReferenceCounting Y, ReferenceCounting Z); /** * Copy constructor * * @param f the composed function * */ FunctionExpressionComposed(const FunctionExpressionComposed& f); /** * Destructor * */ ~FunctionExpressionComposed(); }; #endif // FUNCTION_EXPRESSION_COMPOSED_HPP freefem3d-1.0pre10/language/MultiLinearExpressionSum.cpp0000644000175000017500000000357510633010755020276 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: MultiLinearExpressionSum.cpp,v 1.1 2007/06/10 14:59:57 delpinux Exp $ #include std::ostream& MultiLinearExpressionSum:: put(std::ostream& os) const { bool first = true; for (ListType::const_iterator i = __listPlus.begin(); i != __listPlus.end(); ++i) { if (!first) { os << '+'; } else { first = false; } os << *(*i); } for (ListType::const_iterator i = __listMinus.begin(); i != __listMinus.end(); ++i) { os << '-' << *(*i); } return os; } void MultiLinearExpressionSum:: check() { for (ListType::iterator i = __listPlus.begin(); i != __listPlus.end(); ++i) { (*(*i)).check(); } for (ListType::iterator i = __listMinus.begin(); i != __listMinus.end(); ++i) { (*(*i)).check(); } } void MultiLinearExpressionSum:: execute() { for (ListType::iterator i = __listPlus.begin(); i != __listPlus.end(); ++i) { (*(*i)).execute(); } for (ListType::iterator i = __listMinus.begin(); i != __listMinus.end(); ++i) { (*(*i)).execute(); } } freefem3d-1.0pre10/language/FunctionExpressionLinearBasis.hpp0000644000175000017500000000367010561425532021272 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionLinearBasis.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_LINEAR_BASIS_HPP #define FUNCTION_EXPRESSION_LINEAR_BASIS_HPP #include #include /** * @file FunctionExpressionLinearBasis.hpp * @author Stephane Del Pino * @date Tue Jul 18 00:05:24 2006 * * @brief basis linear function \f$(x,y \mbox{or} z)\f$ * */ class FunctionExpressionLinearBasis : public FunctionExpression { public: enum BasisType { x, y, z }; private: FunctionExpressionLinearBasis::BasisType __basisType; /**< type of the basis function */ public: /** * Executes the expression * */ void execute(); /** * Constructor * * @param name name of the linear basis function * */ FunctionExpressionLinearBasis(const std::string& name); /** * Copy constructor * * @param f original expression * */ FunctionExpressionLinearBasis(const FunctionExpressionLinearBasis& f); /** * Destructor * */ ~FunctionExpressionLinearBasis(); }; #endif // FUNCTION_EXPRESSION_LINEAR_BASIS_HPP freefem3d-1.0pre10/language/PDEOperatorSumExpression.cpp0000644000175000017500000001205510562730012020162 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: PDEOperatorSumExpression.cpp,v 1.5 2007/02/08 23:19:38 delpinux Exp $ #include #include #include #include #include ReferenceCounting PDEOperatorSumExpression::vectorPDEOperator() { return __vectorPDEOperator; } void PDEOperatorSumExpression::execute() { ReferenceCounting unknownListExpression = Information::instance().getUnknownList(); const UnknownListExpression& uList = *unknownListExpression; __vectorPDEOperator = new VectorialPDEOperator(uList.size()); for(PDEOperatorExpressionList::iterator i = (*__sumList).begin(); i != (*__sumList).end(); ++i) { PDEOperatorExpression& theOperator = (*(*i)); theOperator.execute(); switch(theOperator.pdeOperatorType()) { case (PDEOperatorExpression::scalar): { PDEScalarOperatorExpression& theScalarOperator = dynamic_cast(theOperator); size_t n = uList.number(theScalarOperator.unknownName()); (*__vectorPDEOperator)[n]->add(theScalarOperator.pdeOperator()); break; } case (PDEOperatorExpression::vectorial): { PDEVectorialOperatorExpression& theVectorialOperator = dynamic_cast(theOperator); typedef PDEVectorialOperatorExpression::PDEOperatorList::iterator Iterator; for (Iterator i = theVectorialOperator.pdeOperatorList().begin(); i != theVectorialOperator.pdeOperatorList().end(); ++i) { size_t n = uList.number((*i).first); (*__vectorPDEOperator)[n]->add((*i).second); } break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } } for(PDEOperatorExpressionList::iterator i = (*__differenceList).begin(); i != (*__differenceList).end(); ++i) { PDEOperatorExpression& theOperator = (*(*i)); theOperator.execute(); switch(theOperator.pdeOperatorType()) { case (PDEOperatorExpression::scalar): { PDEScalarOperatorExpression& theScalarOperator = dynamic_cast(theOperator); size_t n = uList.number(theScalarOperator.unknownName()); (*__vectorPDEOperator)[n]->add(-(*theScalarOperator.pdeOperator())); break; } case (PDEOperatorExpression::vectorial): { PDEVectorialOperatorExpression& theVectorialOperator = dynamic_cast(theOperator); typedef PDEVectorialOperatorExpression::PDEOperatorList::iterator Iterator; for (Iterator i = theVectorialOperator.pdeOperatorList().begin(); i != theVectorialOperator.pdeOperatorList().end(); ++i) { size_t n = uList.number((*i).first); (*__vectorPDEOperator)[n]->add(-(*(*i).second)); } break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } } } PDEOperatorSumExpression:: PDEOperatorSumExpression(const PDEOperatorSumExpression& e) : Expression(e), __vectorPDEOperator(e.__vectorPDEOperator), __sumList(e.__sumList), __differenceList(e.__differenceList) { ; } PDEOperatorSumExpression::PDEOperatorSumExpression() : Expression(Expression::pdeOperatorSum), __sumList(new PDEOperatorExpressionList), __differenceList(new PDEOperatorExpressionList) { ; } PDEOperatorSumExpression::~PDEOperatorSumExpression() { ; } void PDEOperatorSumExpression::add(ReferenceCounting P) { for(PDEOperatorExpressionList::iterator i = (*(*P).__sumList).begin(); i != (*(*P).__sumList).end(); ++i) { (*__sumList).push_back(*i); } for(PDEOperatorExpressionList::iterator i = (*(*P).__differenceList).begin(); i != (*(*P).__differenceList).end(); ++i) { (*__differenceList).push_back(*i); } } void PDEOperatorSumExpression::minus(ReferenceCounting P) { for(PDEOperatorExpressionList::iterator i = (*(*P).__sumList).begin(); i != (*(*P).__sumList).end(); ++i) { (*__differenceList).push_back(*i); } for(PDEOperatorExpressionList::iterator i = (*(*P).__differenceList).begin(); i != (*(*P).__differenceList).end(); ++i) { (*__sumList).push_back(*i); } } freefem3d-1.0pre10/language/BoundaryExpressionPOVRay.hpp0000644000175000017500000000416510561425532020214 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryExpressionPOVRay.hpp,v 1.1 2006/08/27 21:33:53 delpinux Exp $ #ifndef BOUNDARY_EXPRESSION_POVRAY_HPP #define BOUNDARY_EXPRESSION_POVRAY_HPP #include /** * @file BoundaryExpressionPOVRay.hpp * @author Stephane Del Pino * @date Mon Aug 7 15:32:25 2006 * * @brief This class defines the class of POVRay Boundary expressions */ class BoundaryExpressionPOVRay : public BoundaryExpression { private: ReferenceCounting __povrayReference; /**< Reference of the POV-Ray objects */ /** * Writes the boundary expression to a stream * * @param os output stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * Checks that the boundary is a POVRay boundary * * @return true */ bool hasPOVBoundary() const { return true; } /** * Executes the expression * */ void execute(); /** * Constructor * * @param r POV-Ray reference */ BoundaryExpressionPOVRay(ReferenceCounting r); /** * Copy constructor * * @param r original boundary expression */ BoundaryExpressionPOVRay(const BoundaryExpressionPOVRay& r); /** * Destructor * */ ~BoundaryExpressionPOVRay(); }; #endif // BOUNDARY_EXPRESSION_POVRAY_HPP freefem3d-1.0pre10/language/FunctionExpressionDomainCharacteristic.cpp0000644000175000017500000000357010561425532023150 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionDomainCharacteristic.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include #include #include std::ostream& FunctionExpressionDomainCharacteristic:: put(std::ostream& os) const { os << "one(" << (*__domain) << ')'; return os; } void FunctionExpressionDomainCharacteristic:: execute() { __domain->execute(); __scalarFunction = new ScalarFunctionDomainCharacteristic(__domain->domain()); } FunctionExpressionDomainCharacteristic ::FunctionExpressionDomainCharacteristic(ReferenceCounting D) : FunctionExpression(FunctionExpression::domainCharacteristic), __domain(D) { ; } FunctionExpressionDomainCharacteristic:: FunctionExpressionDomainCharacteristic(const FunctionExpressionDomainCharacteristic& f) : FunctionExpression(FunctionExpression::domainCharacteristic), __domain(f.__domain) { ; } FunctionExpressionDomainCharacteristic:: ~FunctionExpressionDomainCharacteristic() { ; } freefem3d-1.0pre10/language/OFStreamExpressionVariable.hpp0000644000175000017500000000435410562730012020507 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: OFStreamExpressionVariable.hpp,v 1.2 2007/02/08 23:19:38 delpinux Exp $ #ifndef OFSTREAM_EXPRESSION_VARIABLE_HPP #define OFSTREAM_EXPRESSION_VARIABLE_HPP #include #include /** * @file OFStreamExpressionVariable.hpp * @author Stephane Del Pino * @date Sat Dec 30 01:10:27 2006 * * @brief ofstream expression variable */ class OFStreamExpressionVariable : public OFStreamExpression { private: const std::string __ofstreamName; ReferenceCounting __ofstreamVariable; /**< the variable */ /** * Overload of the put function * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const { os << __ofstreamVariable->name(); return os; } public: /** * Executes the variable expression * */ void execute(); /** * Access to the ofstream expression related to this variable * * @return __ofstreamVariable */ ConstReferenceCounting ofstreamExpression() const; /** * Constructor * * @param ofstreamName given variable name */ OFStreamExpressionVariable(const std::string& ofstreamName); /** * Copy constructor * * @param e given expression */ OFStreamExpressionVariable(const OFStreamExpressionVariable& e); /** * Destructor * */ ~OFStreamExpressionVariable(); }; #endif // OFSTREAM_EXPRESSION_VARIABLE_HPP freefem3d-1.0pre10/language/MultiLinearExpression.cpp0000644000175000017500000003625410633010755017611 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2007 Stéphane Del Pino // 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, 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. // $Id: MultiLinearExpression.cpp,v 1.1 2007/06/10 14:59:57 delpinux Exp $ #include #include #include #include #include #include std::ostream& MultiLinearExpression:: put(std::ostream& os) const { bool notFirst = false; for (LinearListType::const_iterator i = __linearList.begin(); i != __linearList.end(); ++i) { if (notFirst) { os << '*'; } else { notFirst = true; } os << (*(*i)); } for (FunctionListType::const_iterator i = __functionList.begin(); i != __functionList.end(); ++i) { if (notFirst) { os << '*'; } else { notFirst = true; } os << (*(*i)); } for (RealListType::const_iterator i = __realList.begin(); i != __realList.end(); ++i) { if (notFirst) { os << '*'; } else { notFirst = true; } os << (*(*i)); } return os; } ReferenceCounting MultiLinearExpression:: getFunction() { ReferenceCounting f = 0; ReferenceCounting r = 0; if (__realList.size() > 0) { RealListType::iterator i = __realList.begin(); r = *i; i++; for ( ; i != __realList.end(); ++i) { r = new RealExpressionBinaryOperator(r,*i); } } if (__functionList.size() > 0) { FunctionListType::iterator i = __functionList.begin(); f = *i; ++i; for ( ; i != __functionList.end(); ++i) { f = new FunctionExpressionBinaryOperation(BinaryOperation::product, f, *i); } } for (LinearListType::iterator i = __linearList.begin(); i != __linearList.end(); ++i) { switch ((*(*i)).formType()) { case (LinearExpression::elementary): { break; // nothing to do } case (LinearExpression::elementaryTimesFunction): { LinearExpressionElementaryTimesFunction& L = dynamic_cast(*(*i)); if (f == 0) { f = L.function(); } else { f = new FunctionExpressionBinaryOperation(BinaryOperation::product, f, L.function()); } break; } case (LinearExpression::elementaryTimesReal): { LinearExpressionElementaryTimesReal& L = dynamic_cast(*(*i)); if (r == 0) { r = L.real_t(); } else { r = new RealExpressionBinaryOperator(r,L.real_t()); } break; } case (LinearExpression::elementaryTimesFunctionOperator): { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } } if ((r == 0)&&(f == 0)) { r = new RealExpressionValue(1); f = new FunctionExpressionConstant(r); } else if (r == 0) { ; // everything is ok ! } else if (f == 0){ f = new FunctionExpressionConstant(r); } else { f = new FunctionExpressionBinaryOperation(BinaryOperation::product, f, new FunctionExpressionConstant(r)); } return f; } const std::string& MultiLinearExpression:: getUnknownName() const { LinearListType::const_iterator i = __linearList.begin(); while (i != __linearList.end()) { const IntegratedExpression& IE = *(*i)->integrated()->integratedExpression(); if (IE.integratedExpressionType() == IntegratedExpression::unknownFunction) { const IntegratedExpressionUnknown& I = dynamic_cast(IE); return I.unknownName(); } ++i; } throw ErrorHandler(__FILE__,__LINE__, "Could not find unknown name", ErrorHandler::unexpected); static std::string badName("unknown function"); return badName; } const std::string& MultiLinearExpression:: getTestFunctionName() const { ConstReferenceCounting t = 0; LinearListType::const_iterator i = __linearList.begin(); while (i != __linearList.end()) { const IntegratedExpression& IE = *(*i)->integrated()->integratedExpression(); if (IE.integratedExpressionType() == IntegratedExpression::testFunction) { const IntegratedExpressionTest& I = dynamic_cast(IE); return I.testFunctionName(); } ++i; } throw ErrorHandler(__FILE__,__LINE__, "Could not find testfunction name", ErrorHandler::unexpected); static std::string badName("unknown function"); return badName; } IntegratedOperatorExpression::OperatorType MultiLinearExpression:: getUnknownOperator() const { IntegratedOperatorExpression::OperatorType t = IntegratedOperatorExpression::undefined; LinearListType::const_iterator i = __linearList.begin(); while (i != __linearList.end()) { const IntegratedOperatorExpression& I = *(*i)->integrated(); const IntegratedExpression& IE = *I.integratedExpression(); if (IE.integratedExpressionType() == IntegratedExpression::unknownFunction) { t = I.operatorType(); } ++i; } return t; } IntegratedOperatorExpression::OperatorType MultiLinearExpression:: getTestFunctionOperator() const { IntegratedOperatorExpression::OperatorType t = IntegratedOperatorExpression::undefined; LinearListType::const_iterator i = __linearList.begin(); while (i != __linearList.end()) { const IntegratedOperatorExpression& I = *(*i)->integrated(); const IntegratedExpression& IE = *I.integratedExpression(); if (IE.integratedExpressionType() == IntegratedExpression::testFunction) { t = I.operatorType(); } ++i; } return t; } IntegratedOperatorExpression::OperatorType MultiLinearExpression:: getFunctionOperator() const { IntegratedOperatorExpression::OperatorType t = IntegratedOperatorExpression::undefined; LinearListType::const_iterator i = __linearList.begin(); while (i != __linearList.end()) { const IntegratedOperatorExpression& I = *(*i)->integrated(); const IntegratedExpression& IE = *I.integratedExpression(); if (IE.integratedExpressionType() == IntegratedExpression::function) { t = I.operatorType(); } ++i; } return t; } VariationalOperator::Property MultiLinearExpression:: getUnknownProperty() const { LinearListType::const_iterator i = __linearList.begin(); while (i != __linearList.end()) { const IntegratedOperatorExpression& I = *(*i)->integrated(); const IntegratedExpression& IE = *I.integratedExpression(); if (IE.integratedExpressionType() == IntegratedExpression::unknownFunction) { if (I.isJump()) { return VariationalOperator::jump; } if (I.isMean()) { return VariationalOperator::mean; } } ++i; } return VariationalOperator::normal; } VariationalOperator::Property MultiLinearExpression:: getTestFunctionProperty() const { LinearListType::const_iterator i = __linearList.begin(); while (i != __linearList.end()) { const IntegratedOperatorExpression& I = *(*i)->integrated(); const IntegratedExpression& IE = *I.integratedExpression(); if (IE.integratedExpressionType() == IntegratedExpression::testFunction) { if (I.isJump()) { return VariationalOperator::jump; } if (I.isMean()) { return VariationalOperator::mean; } } ++i; } return VariationalOperator::normal; } ReferenceCounting MultiLinearExpression:: getFunctionExpression() const { ReferenceCounting f = 0; LinearListType::const_iterator i = __linearList.begin(); while (i != __linearList.end()) { const IntegratedExpression& IE = *(*i)->integrated()->integratedExpression(); if (IE.integratedExpressionType() == IntegratedExpression::function) { const IntegratedExpressionFunctionExpression& I = dynamic_cast(IE); f = I.function(); } ++i; } ASSERT(f != 0); return f; } MultiLinearExpression::OperatorType MultiLinearExpression:: operatorType() const { IntegratedOperatorExpression::OperatorType unknown = IntegratedOperatorExpression::undefined; IntegratedOperatorExpression::OperatorType test = IntegratedOperatorExpression::undefined; IntegratedOperatorExpression::OperatorType function = IntegratedOperatorExpression::undefined; for(LinearListType::const_iterator i = __linearList.begin(); i != __linearList.end(); ++i) { const IntegratedOperatorExpression& I = *(*i)->integrated(); switch(I.integratedExpression()->integratedExpressionType()) { case IntegratedExpression::testFunction: { test = I.operatorType(); break; } case IntegratedExpression::unknownFunction: { unknown = I.operatorType(); break; } case IntegratedExpression::function: { function = I.operatorType(); break; } } } OperatorType t = undefined; switch (__linearList.size()) { case 1: { switch (test) { case IntegratedOperatorExpression::orderZero: { t=V; break; } case IntegratedOperatorExpression::gradient: { t=gradV; break; } case IntegratedOperatorExpression::dx: case IntegratedOperatorExpression::dy: case IntegratedOperatorExpression::dz: { return dxV; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } break; } case 2: { if (test != IntegratedOperatorExpression::undefined) { if (unknown != IntegratedOperatorExpression::undefined) { switch (unknown) { case IntegratedOperatorExpression::orderZero: { switch (test) { case IntegratedOperatorExpression::orderZero: { t=UV; break; } case IntegratedOperatorExpression::gradient: case IntegratedOperatorExpression::dx: case IntegratedOperatorExpression::dy: case IntegratedOperatorExpression::dz: { t=UdxV; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } break; } case IntegratedOperatorExpression::gradient: { switch (test) { case IntegratedOperatorExpression::orderZero: { t=dxUV; break; } case IntegratedOperatorExpression::gradient: { t=gradUgradV; break; } case IntegratedOperatorExpression::dx: case IntegratedOperatorExpression::dy: case IntegratedOperatorExpression::dz: { return dxUdxV; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } break; } case IntegratedOperatorExpression::dx: case IntegratedOperatorExpression::dy: case IntegratedOperatorExpression::dz: { switch (test) { case IntegratedOperatorExpression::orderZero: { t=dxUV; break; } case IntegratedOperatorExpression::gradient: case IntegratedOperatorExpression::dx: case IntegratedOperatorExpression::dy: case IntegratedOperatorExpression::dz: { t=dxUdxV; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } } else { switch (function) { case IntegratedOperatorExpression::gradient: { switch (test) { case IntegratedOperatorExpression::gradient: { t = gradFgradV; break; } case IntegratedOperatorExpression::orderZero: case IntegratedOperatorExpression::dx: case IntegratedOperatorExpression::dy: case IntegratedOperatorExpression::dz: default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } break; } case IntegratedOperatorExpression::dx: case IntegratedOperatorExpression::dy: case IntegratedOperatorExpression::dz: { switch (test) { case IntegratedOperatorExpression::orderZero: { t = dxFV; break; } case IntegratedOperatorExpression::gradient: case IntegratedOperatorExpression::dx: case IntegratedOperatorExpression::dy: case IntegratedOperatorExpression::dz: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } } } break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } return t; } MultiLinearExpression::LinearFormType MultiLinearExpression:: linearFormType() const { LinearFormType t; LinearListType::const_iterator i = __linearList.begin(); switch (__linearList.size()) { case 1: { const IntegratedExpression& I=*(*i)->integrated()->integratedExpression(); if (I.integratedExpressionType() != IntegratedExpression::testFunction) { const std::string errorMsg = "error defining "+stringify(*this)+"\n" "1-linear operator should be defined using test functions"; throw ErrorHandler(__FILE__,__LINE__, errorMsg, ErrorHandler::normal); } else { return linear; } break; } case 2: { return biLinear; break; } default: { throw ErrorHandler(__FILE__,__LINE__, "not implemented", ErrorHandler::unexpected); } } return t; } void MultiLinearExpression:: check() { if (__linearList.size() > 2) { this->execute(); const std::string errorMsg = stringify(*this)+" is "+stringify(__linearList.size()) +"-linear.\ncan discretize at most 2-linear expressions\n"; throw ErrorHandler(__FILE__,__LINE__, errorMsg, ErrorHandler::normal); } else if (__linearList.size() == 2) { LinearListType::iterator i = __linearList.begin(); IntegratedExpression::IType itype = (*(*(*(*i)).integrated()).integratedExpression()).integratedExpressionType(); i++; IntegratedExpression::IType jtype = (*(*(*(*i)).integrated()).integratedExpression()).integratedExpressionType(); if (itype == jtype) { this->execute(); const std::string errorMsg = stringify(*this)+" is non linear\n" +"Cannot discretize non linear operators\n"; throw ErrorHandler(__FILE__,__LINE__, errorMsg, ErrorHandler::normal); } } } freefem3d-1.0pre10/language/FunctionExpressionLinearBasis.cpp0000644000175000017500000000447410561425532021270 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionLinearBasis.cpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #include #include #include void FunctionExpressionLinearBasis:: execute() { switch (__basisType) { case FunctionExpressionLinearBasis::x: { __scalarFunction = new ScalarFunctionLinearBasis(ScalarFunctionLinearBasis::x); break; } case FunctionExpressionLinearBasis::y: { __scalarFunction = new ScalarFunctionLinearBasis(ScalarFunctionLinearBasis::y); break; } case FunctionExpressionLinearBasis::z: { __scalarFunction = new ScalarFunctionLinearBasis(ScalarFunctionLinearBasis::z); break; } } } FunctionExpressionLinearBasis:: FunctionExpressionLinearBasis(const std::string& name) : FunctionExpression(FunctionExpression::linearBase) { if (name.size() != 1) { throw ErrorHandler(__FILE__,__LINE__, "Unknown linear expression basis: \"" +name+"\"", ErrorHandler::unexpected); } switch (name[0]) { case 'x': { __basisType = FunctionExpressionLinearBasis::x; break; } case 'y': { __basisType = FunctionExpressionLinearBasis::y; break; } case 'z': { __basisType = FunctionExpressionLinearBasis::z; break; } } } FunctionExpressionLinearBasis:: FunctionExpressionLinearBasis(const FunctionExpressionLinearBasis& f) : FunctionExpression(f), __basisType(f.__basisType) { ; } FunctionExpressionLinearBasis:: ~FunctionExpressionLinearBasis() { ; } freefem3d-1.0pre10/language/BoundaryExpression.hpp0000644000175000017500000000465410561425532017156 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryExpression.hpp,v 1.7 2006/08/27 21:33:53 delpinux Exp $ #ifndef BOUNDARY_EXPRESSION_HPP #define BOUNDARY_EXPRESSION_HPP #include #include #include #include class Boundary; /** * @file BoundaryExpression.hpp * @author Stephane Del Pino * @date Mon Aug 7 16:10:49 2006 * * @brief This class defines the base class of Boundary expressions */ class BoundaryExpression : public Expression { public: enum BoundaryType { undefined, surfaceMesh, povray, references, list, variable }; private: BoundaryExpression::BoundaryType __boundaryType; /**< type of the boundary */ protected: ReferenceCounting __boundary; /**< Reference to the boundary */ public: /** * Checks if the boundary has POVRay boundary * * @return true if the boundary has POVRay boundary */ virtual bool hasPOVBoundary() const = 0; /** * Read only access to the type of the boundary * * @return __boundaryType */ const BoundaryExpression::BoundaryType& boundaryType() const { return __boundaryType; } /** * Access to the boundary * * @return __boundary */ ReferenceCounting boundary(); /** * Copy constructor * * @param e given boundary expression */ BoundaryExpression(const BoundaryExpression& e); /** * Constructor * * @param t the type of the boundary */ BoundaryExpression(const BoundaryExpression::BoundaryType& t); /** * Destructor * */ virtual ~BoundaryExpression(); }; #endif // BOUNDARY_EXPRESSION_HPP freefem3d-1.0pre10/language/PDESystemExpression.cpp0000644000175000017500000000365510561425532017203 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: PDESystemExpression.cpp,v 1.2 2006/03/12 20:17:23 delpinux Exp $ #include #include ReferenceCounting PDESystemExpression::pdeSystem() { return __pdeSystem; } bool PDESystemExpression::hasPOVBoundary() const { for (SystemList::const_iterator i = __system.begin(); i!= __system.end(); ++i) { if ((*(*i)).hasPOVBoundary()) return true; } return false; } void PDESystemExpression::execute() { size_t dimension = 0; for (SystemList::iterator i = __system.begin(); i!= __system.end(); ++i, ++dimension) { (*(*i)).execute(); } __pdeSystem = new PDESystem(dimension); for (SystemList::iterator i = __system.begin(); i!= __system.end(); ++i) { (*__pdeSystem).add((*(*i)).pdeProblem()); } } PDESystemExpression::PDESystemExpression() : ProblemExpression(ProblemExpression::pdeSystem) { ; } PDESystemExpression::PDESystemExpression(const PDESystemExpression& S) : ProblemExpression(S), __pdeSystem(PDESystemExpression::__pdeSystem), __system(S.__system) { ; } PDESystemExpression::~PDESystemExpression() { ; } freefem3d-1.0pre10/language/BoundaryExpressionPOVRay.cpp0000644000175000017500000000334710561425532020210 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryExpressionPOVRay.cpp,v 1.1 2006/08/27 21:33:53 delpinux Exp $ #include #include std::ostream& BoundaryExpressionPOVRay:: put(std::ostream& os) const { os << (*__povrayReference); return os; } void BoundaryExpressionPOVRay:: execute() { (*__povrayReference).execute(); BoundaryPOVRay* b = new BoundaryPOVRay(); TinyVector<3> ref; for (size_t i=0; i<3; ++i) ref[i] = (*__povrayReference).value(i); (*b).addPOVReference(ref); __boundary = b; } BoundaryExpressionPOVRay:: BoundaryExpressionPOVRay(ReferenceCounting r) : BoundaryExpression(BoundaryExpression::povray), __povrayReference(r) { ; } BoundaryExpressionPOVRay:: BoundaryExpressionPOVRay(const BoundaryExpressionPOVRay& r) : BoundaryExpression(r), __povrayReference(r.__povrayReference) { ; } BoundaryExpressionPOVRay:: ~BoundaryExpressionPOVRay() { ; } freefem3d-1.0pre10/language/parse.ff.hpp0000644000175000017500000000167110561425532015013 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: parse.ff.hpp,v 1.2 2006/07/20 17:38:45 delpinux Exp $ #ifndef PARSE_FF_HPP #define PARSE_FF_HPP #endif // PARSE_FF_HPP freefem3d-1.0pre10/language/SubOptionExpression.cpp0000644000175000017500000000253510561425532017304 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: SubOptionExpression.cpp,v 1.1.1.1 2003/02/17 16:32:52 delpinux Exp $ #include #include void SubOptionExpressionString::setOption(std::string& name) { ffout(4) << "Setting " << name << " to " << (*__value) << '\n'; ParameterCenter::instance().set(name.c_str(), (*__value).value()); } void SubOptionExpressionReal::setOption(std::string& name) { ffout(4) << "Setting " << name << " to " << (*__value) << '\n'; ParameterCenter::instance().set(name.c_str(), (*__value).realValue()); } freefem3d-1.0pre10/language/DomainExpressionUndefined.hpp0000644000175000017500000000257410561425532020423 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpressionUndefined.hpp,v 1.1 2006/09/28 19:05:34 delpinux Exp $ #ifndef DOMAIN_EXPRESSION_UNDEFINED_HPP #define DOMAIN_EXPRESSION_UNDEFINED_HPP #include class DomainExpressionUndefined : public DomainExpression { private: std::ostream& put(std::ostream& os) const { os << "undefined domain"; return os; } public: void execute() { ; } DomainExpressionUndefined(); DomainExpressionUndefined(const DomainExpressionUndefined& m); ~DomainExpressionUndefined(); }; #endif // DOMAIN_EXPRESSION_UNDEFINED_HPP freefem3d-1.0pre10/language/FunctionExpressionConstant.hpp0000644000175000017500000000350610561425532020665 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionConstant.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_CONSTANT_HPP #define FUNCTION_EXPRESSION_CONSTANT_HPP #include #include /** * @file FunctionExpressionConstant.hpp * @author Stephane Del Pino * @date Tue Jul 4 01:28:37 2006 * * @brief Constant function expression * */ class FunctionExpressionConstant : public FunctionExpression { private: ReferenceCounting __realExpression; /**< value of the function */ public: /** * Execute the expression * */ void execute(); /** * Constructor * * @param r real expression * */ FunctionExpressionConstant(ReferenceCounting r); /** * Copy constructor * * @param f constant function expression * */ FunctionExpressionConstant(const FunctionExpressionConstant& f); /** * Destructor * */ ~FunctionExpressionConstant(); }; #endif // FUNCTION_EXPRESSION_CONSTANT_HPP freefem3d-1.0pre10/language/InsideListExpression.hpp0000644000175000017500000002126410561425532017436 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: InsideListExpression.hpp,v 1.6 2004/12/31 14:00:47 delpinux Exp $ #ifndef INSIDE_LIST_EXPRESSION_HPP #define INSIDE_LIST_EXPRESSION_HPP #include #include #include #include class Object; class Scene; /** * @file InsideListExpression.hpp * @author Stephane Del Pino & Cecile Dobrzynski * @date Fri Nov 15 15:21:58 2002 * * @brief nodes and leaves of the domain tree * */ class InsideListExpression : public Expression { protected: typedef std::map, size_t> ReferenceList; public: enum NodeType { NodeAnd, NodeOr, NodeNot, NodeLeaf }; private: const NodeType __type; /**< node type */ public: /** * overloading of Expression::execute() * */ void execute() { this->subExecute(); this->checkReferencesUniqueness(); } /** * helps to break the execution into parts * */ virtual void subExecute() = 0; /** * Checks that all given references are given only once * */ void checkReferencesUniqueness() { InsideListExpression::ReferenceList references; this->addReferences(references); for (ReferenceList::const_iterator i = references.begin(); i != references.end(); ++i) { if ((*i).second > 1) { std::string errorMsg = "POV-Ray reference "+stringify((*i).first)+" is used " +stringify((*i).second)+" times in the domain definition\n" "only once is allowed"; throw ErrorHandler(__FILE__,__LINE__, errorMsg, ErrorHandler::normal); } } } /** * Fills a list which counts POV-Ray references * * @param references the references and their number of instance * */ virtual void addReferences(InsideListExpression::ReferenceList& references) = 0; /** * Evaluates the domain shape * * @return a shape. */ virtual ReferenceCounting objects(const Scene& S) = 0; /** * node constructor * * @param type * */ InsideListExpression(const InsideListExpression::NodeType type) : Expression(Expression::insideListExpression), __type(type) { ; } /** * Copy constructor * * @param ie * */ InsideListExpression(const InsideListExpression& ie) : Expression(ie), __type(ie.__type) { ; } /** * Destructor * * */ virtual ~InsideListExpression() { ; } }; class InsideListExpressionAnd : public InsideListExpression { private: ReferenceCounting __node1; ReferenceCounting __node2; /** * Overloading of Expression::put() * * @param os * */ std::ostream& put(std::ostream& os) const { os << '(' << *__node1 << " and " << *__node2 << ')'; return os; } public: ReferenceCounting objects(const Scene& S); /** * Overloading of InsideListeExpression::subExecute() * */ void subExecute() { (*__node1).subExecute(); (*__node2).subExecute(); } /** * Fills a list which counts POV-Ray references * * @param references the references and their number of instance * */ void addReferences(InsideListExpression::ReferenceList& references) { (*__node1).addReferences(references); (*__node2).addReferences(references); } /** * Constructor * * @param node1 * @param node2 * */ InsideListExpressionAnd(ReferenceCounting node1, ReferenceCounting node2) : InsideListExpression(InsideListExpression::NodeAnd), __node1(node1), __node2(node2) { ; } /** * Copy constructor * * @param I * */ InsideListExpressionAnd(const InsideListExpressionAnd& I) : InsideListExpression(I), __node1(I.__node1), __node2(I.__node2) { ; } /** * Destructor * */ ~InsideListExpressionAnd() { ; } }; class InsideListExpressionOr : public InsideListExpression { private: ReferenceCounting __node1; ReferenceCounting __node2; /** * Overloading of Expression::put() * * @param os * */ std::ostream& put(std::ostream& os) const { os << '(' << *__node1 << " or " << *__node2 << ')'; return os; } public: ReferenceCounting objects(const Scene& S); /** * Overloading of InsideListeExpression::subExecute() * */ void subExecute() { (*__node1).subExecute(); (*__node2).subExecute(); } /** * Fills a list which counts POV-Ray references * * @param references the references and their number of instance * */ void addReferences(InsideListExpression::ReferenceList& references) { (*__node1).addReferences(references); (*__node2).addReferences(references); } /** * Constructor * * @param node1 * @param node2 * */ InsideListExpressionOr(ReferenceCounting node1, ReferenceCounting node2) : InsideListExpression(InsideListExpression::NodeOr), __node1(node1), __node2(node2) { ; } /** * Copy constructor * * @param I * */ InsideListExpressionOr(const InsideListExpressionOr& I) : InsideListExpression(I), __node1(I.__node1), __node2(I.__node2) { ; } /** * Destructor * */ ~InsideListExpressionOr() { ; } }; class InsideListExpressionNot : public InsideListExpression { private: ReferenceCounting __node; /** * Overloading of Expression::put() * * @param os * */ std::ostream& put(std::ostream& os) const { os << '!' << *__node; return os; } public: ReferenceCounting objects(const Scene& S); /** * Overloading of InsideListeExpression::subExecute() * */ void subExecute() { (*__node).subExecute(); } /** * Fills a list which counts POV-Ray references * * @param references the references and their number of instance * */ void addReferences(InsideListExpression::ReferenceList& references) { (*__node).addReferences(references); } /** * Constructor * * @param node * */ InsideListExpressionNot(ReferenceCounting node) : InsideListExpression(InsideListExpression::NodeNot), __node(node) { ; } /** * Copy constructor * * @param I * */ InsideListExpressionNot(const InsideListExpressionNot& I) : InsideListExpression(I), __node(I.__node) { ; } /** * Destructor * */ ~InsideListExpressionNot() { ; } }; class InsideListExpressionLeaf : public InsideListExpression { private: ReferenceCounting __leaf; /** * Overloading of Expression::put() * * @param os * */ std::ostream& put(std::ostream& os) const { os << *__leaf; return os; } public: ReferenceCounting objects(const Scene& S); /** * Overloading of InsideListeExpression::subExecute() * */ void subExecute() { (*__leaf).execute(); } /** * Fills a list which counts POV-Ray references * * @param references the references and their number of instance * */ void addReferences(InsideListExpression::ReferenceList& references) { references[(*__leaf).reference()]++; } /** * Constructor * * @param leaf * */ InsideListExpressionLeaf(ReferenceCounting leaf) : InsideListExpression(InsideListExpression::NodeLeaf), __leaf(leaf) { ; } /** * Copy constructor * * @param I * */ InsideListExpressionLeaf(const InsideListExpressionLeaf& I) : InsideListExpression(I), __leaf(I.__leaf) { ; } /** * Destructor * */ ~InsideListExpressionLeaf() { ; } }; #endif // INSIDE_LIST_EXPRESSION_HPP freefem3d-1.0pre10/language/XMLLexer.cpp0000644000175000017500000001157410633010675014743 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: XMLLexer.cpp,v 1.1 2007/06/10 14:59:09 delpinux Exp $ #include #include #include #include #include #include typedef std::list XMLAttributeList; #include //! Constructs a XMLLexer for given std::istream and std::ostream. XMLLexer:: XMLLexer(std::istream& In, std::ostream& Out) : Lexer(In,Out), __definingToken(false) { in.unsetf(std::ios::skipws); } //! The lexer function. int XMLLexer:: yylex() { char readChar = ' '; if (__definingToken) { if (in) { while ((in)&&(isspace(readChar))) { in >> readChar; if ((readChar==' ') or (readChar=='\t')) { return SPACE; } if (readChar=='\n') { linenumber++; return SPACE; } } char nextChar = in.peek(); // read next Char if (isalpha(readChar) or (readChar == '_')) { std::string is; while (isalnum(readChar) or (readChar == '_')) { is += readChar; in >> readChar; } in.unget(); yytext = is; xmllval.str = new std::string(yytext); return NAME; } switch(readChar) { case '<':{ if (nextChar == '!') { // increment operator in >> readChar; in >> readChar; if (readChar == '-') { in >> readChar; if (readChar == '-') { const size_t startingLine = linenumber; in >> readChar; while (true) { while (readChar != '-') { if (readChar == '\n') { linenumber++; } in >> readChar; if (not in) { throw ErrorHandler(__FILE__,startingLine, "runnaway comment", ErrorHandler::compilation); } } in >> readChar; if (readChar == '-') { in >> readChar; if (readChar == '>') { return yylex(); } } } } } } yytext = "<"; return LT; } case '>':{ yytext = ">"; __definingToken = false; return GT; } case '"': { bool endOfString = false; size_t stringLines = 0; // Counts lines within the string std::stringstream is; while (!endOfString) { if(in >> readChar) { switch (readChar) { case '"': { endOfString = true; break; } case '\n': { stringLines++; is << '\n'; break; } case '\\': { int peekC = in.peek(); switch (peekC) { case 'n': { is << '\n'; in >> readChar; break; } case 't': { is << '\t'; in >> readChar; break; } case 'v': { is << '\v'; in >> readChar; break; } case 'b': { is << '\b'; in >> readChar; break; } case 'r': { is << '\r'; in >> readChar; break; } case 'f': { is << '\f'; in >> readChar; break; } case 'a': { is << '\a'; in >> readChar; break; } case '\'': { is << '\''; in >> readChar; break; } case '"': { is << '"'; in >> readChar; break; } case '\\': { is << '\\'; in >> readChar; break; } default: { throw ErrorHandler(__FILE__,linenumber, "unknown escape sequence", ErrorHandler::compilation); } } break; } default: { is << readChar; } } } else { throw ErrorHandler(__FILE__,linenumber, "opened string never closed", ErrorHandler::compilation); } } xmllval.str = new std::string(is.str()); linenumber += stringLines; return STRING; } } // Others characters treatment yytext = readChar; return readChar; } return 0; } else { bool hasChar = false; std::istream::pos_type position; in >> readChar; while (in and (readChar != '<')) { if (readChar=='\n') { linenumber++; } else { if (not hasChar) { if ((readChar!=' ') and (readChar!='\t')) { hasChar = true; position = in.tellg(); } } } in >> readChar; } if (readChar == '<') { in.unget(); __definingToken = true; if (hasChar) { xmllval.position = new std::istream::pos_type(position); return POSITION; } return yylex(); } } return 0; } freefem3d-1.0pre10/language/FunctionExpressionMeshCharacteristic.hpp0000644000175000017500000000407610561425532022644 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionMeshCharacteristic.hpp,v 1.1 2006/07/20 17:29:18 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_MESH_CHARACTERISTIC_HPP #define FUNCTION_EXPRESSION_MESH_CHARACTERISTIC_HPP #include #include #include /** * @file FunctionExpressionMeshCharacteristic.hpp * @author Stephane Del Pino * @date Tue Jul 18 00:08:11 2006 * * @brief Describes characteristic function of a mesh * * */ class FunctionExpressionMeshCharacteristic : public FunctionExpression { private: ReferenceCounting __meshExpression; /**< Expression of the mesh */ std::ostream& put(std::ostream& os) const; /**< overload of the mesh */ public: /** * execute the expression * */ void execute(); /** * Constructor * * @param meshExpression mesh expression * */ FunctionExpressionMeshCharacteristic(ReferenceCounting meshExpression); /** * Copy constructor * * @param f Original expression * */ FunctionExpressionMeshCharacteristic(const FunctionExpressionMeshCharacteristic& f); /** * Destructor * */ ~FunctionExpressionMeshCharacteristic(); }; #endif // FUNCTION_EXPRESSION_MESH_CHARACTERISTIC_HPP freefem3d-1.0pre10/language/DomainExpression.hpp0000644000175000017500000000322210561425532016570 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: DomainExpression.hpp,v 1.4 2006/09/28 19:05:34 delpinux Exp $ #ifndef DOMAIN_EXPRESSION_HPP #define DOMAIN_EXPRESSION_HPP #include /*! \class DomainExpression This class defines the base class of Domain expressions. \author Stephane Del Pino */ class Domain; class DomainExpression : public Expression { protected: ReferenceCounting __domain; public: enum DomainType { analytic, set, undefined, variable }; private: const DomainExpression::DomainType __domainType; public: ReferenceCounting domain() const; const DomainExpression::DomainType& domainType() const { return __domainType; } DomainExpression(const DomainExpression& e); DomainExpression(const DomainExpression::DomainType& t); virtual ~DomainExpression(); }; #endif // DOMAIN_EXPRESSION_HPP freefem3d-1.0pre10/language/TestFunctionExpressionList.cpp0000644000175000017500000000404710563377365020657 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: TestFunctionExpressionList.cpp,v 1.1 2007/02/10 17:20:53 delpinux Exp $ #include #include #include std::ostream& TestFunctionExpressionList:: put(std::ostream& os) const { os << "tests Functions: "; for(ListType::const_iterator i = __list.begin(); i != __list.end(); ++i) { os << (*i)->name() << ' '; } return os; } size_t TestFunctionExpressionList:: size() const { return __list.size(); } size_t TestFunctionExpressionList:: number(const std::string& name) const { size_t n = 0; for(ListType::const_iterator i = __list.begin(); i != __list.end(); ++i) { if ((*i)->name() == name) { return n; } ++n; } const std::string errorMsg = name+" is not a variable of the test function list"; throw ErrorHandler(__FILE__,__LINE__, errorMsg, ErrorHandler::normal); return 0; } void TestFunctionExpressionList:: add(ReferenceCounting t) { __list.push_back(t); } void TestFunctionExpressionList:: execute() { ; } TestFunctionExpressionList:: TestFunctionExpressionList() : Expression(Expression::testFunctionList) { ; } TestFunctionExpressionList:: ~TestFunctionExpressionList() { ; } freefem3d-1.0pre10/language/parse.pov.hpp0000644000175000017500000000173110561425532015221 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: parse.pov.hpp,v 1.2 2006/07/20 17:38:08 delpinux Exp $ #ifndef PARSE_POV_HPP #define PARSE_POV_HPP #include #endif // PARSE_POV_HPP freefem3d-1.0pre10/language/OStreamExpression.hpp0000644000175000017500000000443410562730012016732 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: OStreamExpression.hpp,v 1.3 2007/02/08 23:19:38 delpinux Exp $ #ifndef OSTREAM_EXPRESSION_HPP #define OSTREAM_EXPRESSION_HPP #include #include class OFStreamVariable; /** * @file OStreamExpression.hpp * @author Stephane Del Pino * @date Sat Dec 30 01:01:35 2006 * * @brief general ostream expression management class */ class OStreamExpression : public Expression { private: const std::string __ofstreamName; /**< name of the ofstream variable */ OStream* __ostream; /**< ff3d's standard stream */ OFStreamVariable* __ofstreamVariable; /**< ofstream variable */ /** * Overload of the put function * * @param os givem stream * * @return os */ std::ostream & put(std::ostream & os) const; public: /** * execute the expression * */ void execute(); /** * Writes an expression to the stream * * @param e given expression */ void operator<<(Expression& e); /** * Constructor for a standard ff3d's stream * * @param os given standard ff3d's stream */ OStreamExpression(OStream* os); /** * Constructor that uses an ofstream * * @param ofstreamName given ofstream */ OStreamExpression(const std::string& ofstreamName); /** * Copy constructor * * @param os given OStreamExpression */ OStreamExpression(const OStreamExpression& os); /** * Destructor * */ ~OStreamExpression(); }; #endif // OSTREAM_EXPRESSION_HPP freefem3d-1.0pre10/language/FunctionExpressionBinaryOperation.cpp0000644000175000017500000000472110561425532022174 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionBinaryOperation.cpp,v 1.2 2006/07/30 22:23:10 delpinux Exp $ #include #include void FunctionExpressionBinaryOperation:: execute() { __fExpression->execute(); __gExpression->execute(); ScalarFunctionBuilder functionBuilder; functionBuilder.setFunction(__fExpression->function()); functionBuilder.setBinaryOperation(__type, __gExpression->function()); __scalarFunction = functionBuilder.getBuiltFunction(); } bool FunctionExpressionBinaryOperation:: hasBoundaryExpression() const { return (__fExpression->hasBoundaryExpression() or __gExpression->hasBoundaryExpression()); } FunctionExpressionBinaryOperation:: FunctionExpressionBinaryOperation(const std::string& operatorName, ReferenceCounting f, ReferenceCounting g) : FunctionExpression(FunctionExpression::binaryOperation), __type(operatorName), __fExpression(f), __gExpression(g) { ; } FunctionExpressionBinaryOperation:: FunctionExpressionBinaryOperation(const BinaryOperation::Type& type, ReferenceCounting f, ReferenceCounting g) : FunctionExpression(FunctionExpression::binaryOperation), __type(type), __fExpression(f), __gExpression(g) { ; } FunctionExpressionBinaryOperation:: FunctionExpressionBinaryOperation(const FunctionExpressionBinaryOperation& f) : FunctionExpression(f), __type(f.__type), __fExpression(f.__fExpression), __gExpression(f.__gExpression) { ; } FunctionExpressionBinaryOperation:: ~FunctionExpressionBinaryOperation() { ; } freefem3d-1.0pre10/language/UnknownListExpression.hpp0000644000175000017500000001022310562730012017644 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: UnknownListExpression.hpp,v 1.7 2007/02/08 23:19:38 delpinux Exp $ #ifndef UNKNOWN_LIST_EXPRESSION_HPP #define UNKNOWN_LIST_EXPRESSION_HPP #include #include #include #include #include #include /*! \class UnknownlistExpression This class defines the base class of Unknownlist expressions. \author Stephane Del Pino */ class UnknownListExpression : public Expression { public: typedef std::list > listType; typedef listType::iterator iterator; typedef listType::const_iterator const_iterator; virtual UnknownListExpression::iterator begin() = 0; virtual UnknownListExpression::const_iterator begin() const = 0; virtual UnknownListExpression::const_iterator end() const = 0; virtual size_t size() const = 0; virtual size_t number(const std::string& name) const = 0; UnknownListExpression() : Expression(Expression::unknownList) { ; } UnknownListExpression(const UnknownListExpression& u) : Expression(u) { ; } virtual ~UnknownListExpression() { ; } }; /* class UnknownListExpressionVariable : public UnknownListExpression { private: ReferenceCounting __unknownlistVariable; std::ostream& put(std::ostream& os) const { os << (*__unknownlistVariable).name() << ": " << (*(*__unknownlistVariable).expression()); return os; } public: void execute() { ; } UnknownListExpressionVariable(ReferenceCounting r); UnknownListExpressionVariable(const UnknownListExpressionVariable& e); ~UnknownListExpressionVariable(); }; */ class UnknownListExpressionSet : public UnknownListExpression { protected: listType __list; private: std::ostream& put(std::ostream& os) const; public: UnknownListExpressionSet::listType::iterator begin() { return __list.begin(); } UnknownListExpressionSet::listType::const_iterator begin() const { return __list.begin(); } UnknownListExpressionSet::listType::const_iterator end() const { return __list.end(); } inline size_t size() const { return __list.size(); } inline size_t number(const std::string& name) const { size_t n = 0; for(listType::const_iterator i = __list.begin(); i != __list.end(); ++i) { if ((*i)->name() == name) { return n; } ++n; } const std::string errorMsg = "\""+name+"\" is not a variable of the unkown list"; throw ErrorHandler(__FILE__,__LINE__, errorMsg, ErrorHandler::unexpected); return 0; } listType& giveList() { return __list; } void add(ReferenceCounting u) { for (listType::const_iterator i = __list.begin(); i != __list.end(); ++i) { if (*i == u) { const std::string errorMsg = stringify(*u)+" has been declared twice in unknown list"; throw ErrorHandler(__FILE__,__LINE__, errorMsg, ErrorHandler::normal); } } __list.push_back(u); } void execute() { ; } UnknownListExpressionSet() : UnknownListExpression() { ; } UnknownListExpressionSet(const UnknownListExpressionSet& l) : UnknownListExpression(l), __list(l.__list) { ; } ~UnknownListExpressionSet() { ; } }; #endif // UNKNOWN_LIST_EXPRESSION_HPP freefem3d-1.0pre10/language/UnknownExpressionFunction.hpp0000644000175000017500000000262310624156366020540 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2007 Stéphane Del Pino // 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, 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. // $Id: UnknownExpressionFunction.hpp,v 1.2 2007/05/20 23:37:29 delpinux Exp $ #ifndef UNKNOWN_EXPRESSION_FUNCTION_HPP #define UNKNOWN_EXPRESSION_FUNCTION_HPP #include #include class UnknownExpressionFunction : public UnknownExpression { private: void __preExecute(); static DiscretizationType::Type __getFunctionType(const std::string& functionName); public: UnknownExpressionFunction(const std::string& name, const DiscretizationType::Type& type = DiscretizationType::functionLike); ~UnknownExpressionFunction(); }; #endif // UNKNOWN_EXPRESSION_FUNCTION_HPP freefem3d-1.0pre10/language/VariableLexerRepository.cpp0000644000175000017500000001141610624156366020133 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: VariableLexerRepository.cpp,v 1.4 2007/05/20 23:02:48 delpinux Exp $ #include #include class Expression; class RealExpression; class BooleanExpression; class Vector3Expression; class StringExpression; class FunctionExpression; #include class FieldExpression; class FieldExpressionList; class MeshExpression; class MeshExpressionSurface; class MeshExpressionStructured; #include class SceneExpression; class DomainExpression; class OFStreamExpression; class UnknownExpression; class UnknownListExpression; class TestFunctionVariable; class TestFunctionExpressionList; class BoundaryConditionListExpression; class BoundaryConditionExpression; class BoundaryExpression; class PDEOperatorExpression; class PDEScalarOperatorExpressionOrderZero; class PDEVectorialOperatorExpressionOrderOne; class PDEScalarOperatorExpressionOrderOne; class PDEVectorialOperatorExpressionOrderTwo; class PDEOperatorSumExpression; class PDEEquationExpression; class PDEProblemExpression; class PDESystemExpression; class SolverOptionsExpression; class OptionExpression; class OStreamExpression ; class OStreamExpressionList ; class SolverOptionsExpression; class SubOptionExpression; class SubOptionListExpression; class Variable; class RealVariable; class Vector3Variable; class FunctionVariable; class OFStreamVariable; class FunctionVariable; class StringVariable; class MeshVariable; class SceneVariable; class DomainVariable; class InsideExpression; class InsideListExpression; class Instruction; class IntegratedExpression; class IntegratedOperatorExpression; class LinearExpression; class MultiLinearExpression; class MultiLinearExpressionSum; class MultiLinearFormExpression; class MultiLinearFormSumExpression; class VariationalDirichletListExpression; class BoundaryConditionExpressionDirichlet; class VariationalFormulaExpression; class VariationalProblemExpression; class ProblemExpression; #include #include #include #include VariableLexerRepository::Type VariableLexerRepository:: find(const std::string& name) const { Container::const_iterator i; size_t level=0; for (; level<=__blockLevel;++level) { i = __repository[level].find(name); if (i != __repository[level].end()) break; } if (level>__blockLevel) return -1; if (i == __repository[level].end()) return -1; else { return i->second; } } void VariableLexerRepository:: markAsUnknown(const std::string& name) { Container::iterator i; size_t level=0; for (; level<=__blockLevel;++level) { i = __repository[level].find(name); if (i != __repository[level].end()) break; } if (level>__blockLevel) { throw ErrorHandler(__FILE__,__LINE__, "cannot find variable "+name, ErrorHandler::unexpected); } if (i == __repository[level].end()) { throw ErrorHandler(__FILE__,__LINE__, "cannot find variable "+name, ErrorHandler::unexpected); } else { i->second = VARUNKNOWNID; } } void VariableLexerRepository:: add(const std::string& name, const Type& type) { __repository[__blockLevel][name]=type; } void VariableLexerRepository:: beginBlock() { __blockLevel++; __repository.push_back(Container()); } void VariableLexerRepository:: endBlock() { ASSERT(__blockLevel>0); __repository[__blockLevel].clear(); __blockLevel--; __repository.pop_back(); // At the end of a block, unknowns are always variables! for (size_t level=0; level<=__blockLevel;++level) { for (Container::iterator ivariable = __repository[level].begin(); ivariable != __repository[level].end(); ++ivariable) { if (ivariable->second == VARUNKNOWNID) { ivariable->second = VARFNCTID; } } } } VariableLexerRepository:: VariableLexerRepository() : __blockLevel(0) { __repository.push_back(Container()); } VariableLexerRepository:: ~VariableLexerRepository() { ; } freefem3d-1.0pre10/language/SolutionExpression.hpp0000644000175000017500000000534110561425532017201 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: SolutionExpression.hpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ #ifndef _SOLUTION_EXPRESSION_HPP_ #define _SOLUTION_EXPRESSION_HPP_ #include #include /*! \class SolutionExpression This class defines the base class of Solution expressions. \author Stephane Del Pino */ class SolutionExpression : public Expression { protected: ReferenceCounting __solution; public: enum SolutionType { undefined, value, variable }; ReferenceCounting operator=(ReferenceCounting u); private: SolutionExpression::SolutionType __solutionType; public: ReferenceCounting solution(); const SolutionExpression::SolutionType& solutionType() const { return __solutionType; } SolutionExpression(const SolutionExpression& u); SolutionExpression(const SolutionExpression::SolutionType& t); virtual ~SolutionExpression(); }; class SolutionExpressionVariable : public SolutionExpression { private: ReferenceCounting __solutionVariable; std::ostream& put(std::ostream& os) const { os << (*__solutionVariable).name() << ": " << (*(*__solutionVariable).expression()); return os; } public: void execute() { ; } ReferenceCounting variable() const { return __solutionVariable; } SolutionExpressionVariable(ReferenceCounting r); SolutionExpressionVariable(const SolutionExpressionVariable& e); ~SolutionExpressionVariable(); }; class SolutionExpressionUndefined : public SolutionExpression { private: std::ostream& put(std::ostream& os) const { os << "undefined solution"; return os; } public: void execute(); SolutionExpressionUndefined(); SolutionExpressionUndefined(const SolutionExpressionUndefined& u); ~SolutionExpressionUndefined(); }; #endif // _SOLUTION_EXPRESSION_HPP_ freefem3d-1.0pre10/language/InsideListExpression.cpp0000644000175000017500000000527110562730012017422 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: InsideListExpression.cpp,v 1.7 2007/02/08 23:19:38 delpinux Exp $ #include #include #include #include #include #include ReferenceCounting InsideListExpressionAnd::objects(const Scene& S) { Intersection* intersection = new Intersection(); (*intersection).push_back((*__node1).objects(S)); (*intersection).push_back((*__node2).objects(S)); return new Object(intersection); } ReferenceCounting InsideListExpressionOr::objects(const Scene& S) { Union* merge = new Union(); (*merge).push_back((*__node1).objects(S)); (*merge).push_back((*__node2).objects(S)); return new Object(merge); } ReferenceCounting InsideListExpressionNot::objects(const Scene& S) { return new Object(new Not((*__node).objects(S))); } ReferenceCounting InsideListExpressionLeaf::objects(const Scene& S) { Union* merge = new Union(); TinyVector<3> reference = (*__leaf).reference(); size_t numberOfLeafObjects = 0; for (size_t i = 0; ihasReference()) { if (S.object(i)->reference() == reference) { merge->push_back(S.object(i)); numberOfLeafObjects++; } } else { ffout(0) << "Object " << i << ':' << S.object(i) << "\nhas no reference\n\n"; } } if (numberOfLeafObjects==0) { throw ErrorHandler(__FILE__,__LINE__, "no object has reference "+stringify(reference)+" in scene", ErrorHandler::normal); } ConstReferenceCounting leaves; if(numberOfLeafObjects == 1) { // leaf is just one object leaves = (*(*merge).begin())->shape(); } else { // leaves are an union leaves = merge; } Object* o; if ((*__leaf).inside()) { o = new Object(leaves); } else { o = new Object(new Not(new Object(leaves))); } o->setReference(reference); return o; } freefem3d-1.0pre10/language/BoundaryExpressionSurfaceMesh.hpp0000644000175000017500000000416210561425532021276 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BoundaryExpressionSurfaceMesh.hpp,v 1.1 2006/08/27 21:33:53 delpinux Exp $ #ifndef BOUNDARY_EXPRESSION_SURFACE_MESH_HPP #define BOUNDARY_EXPRESSION_SURFACE_MESH_HPP #include /** * @file BoundaryExpressionSurfaceMesh.hpp * @author Stephane Del Pino * @date Mon Aug 7 15:40:38 2006 * * @brief Describes surface mesh boundary expressions */ class BoundaryExpressionSurfaceMesh : public BoundaryExpression { private: ReferenceCounting __surfaceMeshExpression; /**< surface mesh expression */ /** * Writes the expression to a stream * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const; public: /** * Checks if the boundary is a POVRay boundary * * @return false */ bool hasPOVBoundary() const { return false; } /** * Executes the expression * */ void execute(); /** * Constructor * * @param m the mesh */ BoundaryExpressionSurfaceMesh(ReferenceCounting m); /** * Copy constructor * * @param b given boundary expression */ BoundaryExpressionSurfaceMesh(const BoundaryExpressionSurfaceMesh& b); /** * Destuctor * */ ~BoundaryExpressionSurfaceMesh(); }; #endif // BOUNDARY_EXPRESSION_SURFACE_MESH_HPP freefem3d-1.0pre10/language/BooleanExpression.cpp0000644000175000017500000000172710561425532016743 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: BooleanExpression.cpp,v 1.2 2003/05/04 18:09:01 delpinux Exp $ // #include // void but should contain boolean variable body. freefem3d-1.0pre10/language/ProblemExpression.hpp0000644000175000017500000000404210561425532016762 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: ProblemExpression.hpp,v 1.2 2006/03/12 20:17:23 delpinux Exp $ #ifndef PROBLEM_EXPRESSION_HPP #define PROBLEM_EXPRESSION_HPP #include class ProblemExpression : public Expression { public: enum ProblemType { pdeSystem, variationalProblem }; private: ProblemType __problemType; /**< problem's type */ public: /** * Checks if the ProblemExpression contains POVRay references. If * it does the execution is stopped. This verification is required * by standard FEM. */ virtual bool hasPOVBoundary() const = 0; /** * * Access to the problem type * * @return __problemType */ ProblemExpression::ProblemType problemType() { return __problemType; } /** * Constructor * * @param t type of the problem * */ ProblemExpression(ProblemExpression::ProblemType t) : Expression(Expression::problem), __problemType(t) { ; } /** * Copy Constructor * * @param P another problem * */ ProblemExpression(const ProblemExpression& P) : Expression(P), __problemType(P.__problemType) { ; } /** * Destructor * */ virtual ~ProblemExpression() { ; } }; #endif // PROBLEM_EXPRESSION_HPP freefem3d-1.0pre10/language/IntegratedOperatorExpression.hpp0000644000175000017500000001221410633010755021161 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: IntegratedOperatorExpression.hpp,v 1.7 2007/06/10 14:59:57 delpinux Exp $ #ifndef INTEGRATED_OPERATOR_EXPRESSION_HPP #define INTEGRATED_OPERATOR_EXPRESSION_HPP #include #include class IntegratedOperatorExpression : public Expression { public: enum OperatorType { undefined, orderZero, gradient, dx, dy, dz }; private: const OperatorType __operatorType; protected: ReferenceCounting __integratedExpression; private: bool __isMean; bool __isJump; protected: std::string __vo; std::string __vf; public: const bool& isJump() const { return __isJump; } void setJump() { __isJump=true; __vo = "["; __vf = "]"; } const bool& isMean() const { return __isMean; } void setMean() { __isMean=true; __vo = "{"; __vf = "}"; } const OperatorType& operatorType() const { return __operatorType; } ConstReferenceCounting integratedExpression() const { return __integratedExpression; } IntegratedOperatorExpression(const IntegratedOperatorExpression:: OperatorType t, ReferenceCounting i) : Expression(Expression::integratedOperator), __operatorType(t), __integratedExpression(i), __isMean(false), __isJump(false), __vo(""), __vf("") { ; } IntegratedOperatorExpression(const IntegratedOperatorExpression& I) : Expression(I), __operatorType(I.__operatorType), __integratedExpression(I.__integratedExpression), __isMean(I.__isMean), __isJump(I.__isJump), __vo(I.__vo), __vf(I.__vf) { ; } virtual ~IntegratedOperatorExpression() { ; } }; class IntegratedOperatorExpressionOrderZero : public IntegratedOperatorExpression { private: std::ostream& put(std::ostream& os) const { os << __vo << *__integratedExpression << __vf; return os; } public: void execute() { ; } IntegratedOperatorExpressionOrderZero(ReferenceCounting I) : IntegratedOperatorExpression(IntegratedOperatorExpression::orderZero, I) { ; } IntegratedOperatorExpressionOrderZero(const IntegratedOperatorExpressionOrderZero& I) : IntegratedOperatorExpression(I) { ; } ~IntegratedOperatorExpressionOrderZero() { ; } }; class IntegratedOperatorExpressionGrad : public IntegratedOperatorExpression { private: std::ostream& put(std::ostream& os) const { os << __vo << "grad(" << *__integratedExpression << ')' << __vf; return os; } public: void execute() { ; } IntegratedOperatorExpressionGrad(ReferenceCounting I) : IntegratedOperatorExpression(IntegratedOperatorExpression::gradient, I) { ; } IntegratedOperatorExpressionGrad(const IntegratedOperatorExpressionGrad& I) : IntegratedOperatorExpression(I) { ; } ~IntegratedOperatorExpressionGrad() { ; } }; class IntegratedOperatorExpressionDx : public IntegratedOperatorExpression { private: std::string __operatorName; std::ostream& put(std::ostream& os) const { os << __vo << __operatorName << '(' << *__integratedExpression << ')' << __vf; return os; } static IntegratedOperatorExpression::OperatorType getOperatorType(const std::string& operatorName) { if (operatorName == "dx") { return IntegratedOperatorExpression::dx; } if (operatorName == "dy") { return IntegratedOperatorExpression::dy; } if (operatorName == "dz") { return IntegratedOperatorExpression::dz; } throw ErrorHandler(__FILE__,__LINE__, "unknown operator", ErrorHandler::unexpected); return IntegratedOperatorExpression::undefined; } public: void execute() { ; } IntegratedOperatorExpressionDx(const std::string& operatorName, ReferenceCounting I) : IntegratedOperatorExpression(IntegratedOperatorExpressionDx::getOperatorType(operatorName), I), __operatorName(operatorName) { ; } IntegratedOperatorExpressionDx(const IntegratedOperatorExpressionDx& I) : IntegratedOperatorExpression(I), __operatorName(I.__operatorName) { ; } ~IntegratedOperatorExpressionDx() { ; } }; #endif // INTEGRATED_OPERATOR_EXPRESSION_HPP freefem3d-1.0pre10/language/PDESystemExpression.hpp0000644000175000017500000000560010632501735017177 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: PDESystemExpression.hpp,v 1.4 2007/06/09 10:37:08 delpinux Exp $ #ifndef PDE_SYSTEM_EXPRESSION_HPP #define PDE_SYSTEM_EXPRESSION_HPP #include #include #include #include /** * @file PDESystemExpression.hpp * @author Stephane Del Pino * @date Sat Mar 11 18:54:22 2006 * * @brief This class allows manipulation of systems of PDEs and the * associated boundary conditions * */ class PDESystem; class PDESystemExpression : public ProblemExpression { private: ReferenceCounting __pdeSystem; /**< The PDE system */ typedef std::list > SystemList; SystemList __system; /**< The system of PDE problems */ /** * Allows to write a PDESystemExpression * * @param os given stream * * @return os */ std::ostream& put(std::ostream& os) const { for (SystemList::const_iterator i = __system.begin(); i!= __system.end(); ++i) os << (*(*i)); return os; } public: /** * Checks if the PDESystemExpression contains POVRay references. If * it does the execution is stopped. This verification is required * by standard FEM. */ bool hasPOVBoundary() const; /** * Returns the number of equations of the system * * @return the system size */ size_t size() const { return __system.size(); } /** * Access to the PDE system * * @return the PDE system */ ReferenceCounting pdeSystem(); /** * Execute the expression * */ void execute(); /** * Addes a PDE problem to the system * * @param p the given PDE problem */ void add(ReferenceCounting p) { __system.push_back(p); } /** * The default constructor * */ PDESystemExpression(); /** * The copy constructor * * @param S a given PDE system * */ PDESystemExpression(const PDESystemExpression& S); /** * The destructor * */ ~PDESystemExpression(); }; #endif // PDE_SYSTEM_EXPRESSION_HPP freefem3d-1.0pre10/language/FunctionExpressionIntegrate.hpp0000644000175000017500000000510310561425532021011 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: FunctionExpressionIntegrate.hpp,v 1.2 2006/07/23 22:17:07 delpinux Exp $ #ifndef FUNCTION_EXPRESSION_INTEGRATE_HPP #define FUNCTION_EXPRESSION_INTEGRATE_HPP #include /** * @file FunctionExpressionIntegrate.hpp * @author Stephane Del Pino * @date Tue Jul 18 00:01:26 2006 * * @brief This class describes expressions of function integration in * a given direction @f$ \int_a^b f dx_i @f$ * */ class FunctionExpressionIntegrate : public FunctionExpression { public: enum Direction { x, y, z }; private: ReferenceCounting __lowerBound; /**< lower bound of integration @f$ a @f$ */ ReferenceCounting __upperBound; /**< upper bound of integration @f$ b @f$ */ ReferenceCounting __integratedFunction; /**< expression to integrate */ Direction __direction; /**< Direction of integration */ public: /** * Executes the expression * */ void execute(); /** * Construtor * * @param lowerBound lower bound of integration @f$ a @f$ * @param upperBound upper bound of integration @f$ b @f$ * @param integratedFunction function to integrate @f$ f @f$ * @param directionName name of the direction of integration */ FunctionExpressionIntegrate(ReferenceCounting lowerBound, ReferenceCounting upperBound, ReferenceCounting integratedFunction, const std::string& directionName); /** * Copy constructor * * @param f original expression */ FunctionExpressionIntegrate(const FunctionExpressionIntegrate& f); /** * Destructor * */ ~FunctionExpressionIntegrate(); }; #endif // FUNCTION_EXPRESSION_INTEGRATE_HPP freefem3d-1.0pre10/language/Vector3Expression.cpp0000644000175000017500000000371310632501735016705 00000000000000// This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino // 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, 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. // $Id: Vector3Expression.cpp,v 1.7 2007/06/09 10:37:08 delpinux Exp $ #include #include #include real_t Vector3ExpressionVariable::value(const size_t& i) const { ASSERT(i<3); return __value[i]; } ReferenceCounting Vector3ExpressionVariable::component(const size_t& i) const { ASSERT (i<3); return (*(*__vector3Variable).expression()).component(i); } void Vector3ExpressionVariable::execute() { __vector3Variable = VariableRepository::instance().findVariable(__vector3Name); for (size_t i=0; i<3; ++i) __value[i] = __vector3Variable->expression()->value(i); } Vector3ExpressionVariable:: Vector3ExpressionVariable(const std::string& vector3Name) : __vector3Name(vector3Name), __vector3Variable(0) { for (size_t i=0; i<3; ++i) __value[i]=0; } Vector3ExpressionVariable:: Vector3ExpressionVariable(const Vector3ExpressionVariable& e) : __vector3Name(e.__vector3Name), __vector3Variable(e.__vector3Variable) { for (size_t i=0; i<3; ++i) __value[i]=e.__value[i]; } Vector3ExpressionVariable:: ~Vector3ExpressionVariable() { ; } freefem3d-1.0pre10/language/parse.ff.yy0000644000175000017500000014420710633010674014665 00000000000000%{ /* -*- c++ -*- */ /* * This file is part of ff3d - http://www.freefem.org/ff3d * Copyright (C) 2001, 2002, 2003 Stéphane Del Pino * * 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, 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. * * $Id: parse.ff.yy,v 1.66 2007/06/10 14:59:08 delpinux Exp $ * */ #include #include #include #include #include int yyerror (const char*); int yyerror2(const char*); #include extern FFLexer* fflexer; #define fflex fflexer->fflex #define YYERROR_VERBOSE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //! The set of instructions. extern std::vector > iSet; %} %union { real_t value; int entier; Expression* expression; RealExpression* realExp; BooleanExpression* boolean; Vector3Expression* vector3; StringExpression* string; FunctionExpression* function; FunctionExpressionMeshReferences::ReferencesSet* reference; FieldExpressionList* fieldlist; FieldExpression* field; MeshExpression* mesh; MeshExpressionSpectral* spectralmesh; MeshExpressionSurface* surfacemesh; MeshExpressionStructured* structured3dmesh; MeshExpressionPeriodic::MappedReferencesList* mapreference; SceneExpression* scene; DomainExpression* domain; OFStreamExpression* ofstream; UnknownExpression* unknownExpression; UnknownListExpression* unknownList; TestFunctionVariable* testFunction; TestFunctionExpressionList* testFunctionList; BoundaryConditionListExpression* boundaryConditionList; BoundaryConditionExpression* boundaryCondition; BoundaryExpression* boundary; PDEOperatorExpression* pdeOperatorExpression; PDEScalarOperatorExpressionOrderZero* zerothOrderOp; PDEVectorialOperatorExpressionOrderOne* vectorialFirstOrderOp; PDEScalarOperatorExpressionOrderOne* firstOrderOp; PDEVectorialOperatorExpressionOrderTwo* matricialSecondOrderOp; PDEOperatorSumExpression* pdeOperatorSumExpression; PDEEquationExpression* pdeEquation; PDEProblemExpression* pdeProblem; PDESystemExpression* pdeSystem; SolverOptionsExpression* solverOptions; OptionExpression* option; OStreamExpression * ostreamExpression; OStreamExpressionList * ostreamExpressionList; SolverOptionsExpression* solver; SubOptionExpression* subOption; SubOptionListExpression* subOptionList; Variable* variable; RealVariable* realVariable; Vector3Variable* vector3Variable; FunctionVariable* functionVariable; OFStreamVariable* ofstreamVariable; FunctionVariable* unknownVariable; StringVariable* stringVariable; MeshVariable* meshVariable; SceneVariable* sceneVariable; DomainVariable* domainVariable; InsideExpression* insideExpression; InsideListExpression* insideListExpression; Instruction* instruction; IntegratedExpression* integratedFunction; IntegratedOperatorExpression* integratedOperatorExp; LinearExpression* linearexp; MultiLinearExpression* multilinearexp; MultiLinearExpressionSum* multilinearexpsum; MultiLinearFormExpression* multilinearform; MultiLinearFormSumExpression* multilinearformsum; VariationalDirichletListExpression* variationalDirichletList; BoundaryConditionExpressionDirichlet* boundaryConditionDirichlet; VariationalFormulaExpression* variationalFormula; VariationalProblemExpression* variationalProblem; ProblemExpression* problem; char* str; const std::string* aString; FileDescriptor::FileType fileType; FileDescriptor::FormatType formatType; DiscretizationType::Type discretizationType; ScalarFunctionNormal::ComponentType normalComponent; } %token NUM "real_t value" /* real_t precision number */ /* Variables */ %token VARREALID "real_t variable" %token VARVECTID "vector variable" %token VARFNCTID "function variable" %token MESHID %token VARSCENEID "scene variable" %token VARDOMAINID "domain variable" %token VARUNKNOWNID "unkown variable" %token VARTESTFUNCTIONID "test function variable" %token VAROFSTREAMID %type operatorFunctionExp %type operatorOrFunctionExp %type elementarylinearexp %type linearexp %type multilinearexp %type multilinearsumexp %type multiLinearFormExp %type multiLinearSumExp %type variationalFormula %type realexp "double" %type vector3exp "vector" %type boolexp "bool" %type meshexp "mesh" %type surfacemeshexp "surface mesh" %type structured3dmeshexp "structured 3d mesh" %type spectralmeshexp "spectral mesh" %type sceneexp "scene" %type domainexp "domain" %type inoutexp %type domaindefexp %type unknownexp "unknown" %type unknownlistexp declareSolve "unknown list" %type ofstreamexp "ofstream" %type testfunctionexp "test function" %type testFunctionsExp testfunctionlistexp "test function list" %type stringexp "string" %type strexp %type functionexp boolfunctionexp "function" %type refexp "reference expression" %type refmapexp "reference map expression" %type fdexp "function or real" %type fieldexp "field" %type fieldorfunctionexp componentsexp "field or function" %type fieldlistexp fieldorfieldlistexp " field or function list" %type singleBoundaryexp boundaryexp "boundary" %type pdeexp "PDE" %type pdeop "PDE operator" %type zerothOrderOp "order zero PDE operator" %type firstOrderOp firstOrderOpSimple "order one PDE operator" %type vectorialFirstOrderOp "order one vectorial PDE operator" %type matricialSecondOrderOp "order two PDE operator" %type vectpdeop "vector PDE operator" %type rightHandSide "right hand side" %type problemexp "problem" %type pdesystemexp "pde system" %type variationalexp "variational problem" %type variationalDirichletList "Dirichlet boundary conditions" %type variationalDirichlet "Dirichlet boundary condition" %type pdeproblemexp "pde problem" %type instlist inst simpleinst otherinst declaration affectation %type block statement selectionStatement %type boundaryConditionList "boundary condition list" %type boundaryCondition "boundary condition" %type ostreamexp "ostream" %type ofluxexp %type ofluxexplist %token TRANSFORM SIMPLIFY EXTRACT PERIODIC %token DXYZ %token DXYZOP %token XYZ %token VECTOR %token FUNCTION "function" %token DOUBLE "real" %token MESH "mesh" %token DOMAIN_ "domain" /* Cannot use DOMAIN (used by math.h) */ %token OFSTREAM "ofstream" %token STRING /* Declaration keywords */ %token SFUNCTION FEMFUNCTION STRUCTMESH SPECTRALMESH SURFMESH SCENE /* This is use to specify global use (e.g.: if one has 2 scenes and wants one to be used has default). */ %token USING "using" %token FINEMESH "finemesh" %token COARSEMESH "coarsemesh" // statements %token IF ELSE DO WHILE FOR EXIT %token LT "<" %token GT ">" %token LEQ "<=" %token GEQ ">=" %token EQ "==" %token NE "!=" %token OR "or" %token XOR "xor" %token AND "and" %token TRUE "true" %token FALSE "false" %token NOT "not" %token LRAFTER "<<" %token RRAFTER ">>" %token DIV "div" %token GRAD "grad" %token SOLVE "solve" %token OPENBLOCK "{" %token CLOSEBLOCK "}" %token DNU CONVECT %token INCR DECR %token ONE "one" %token REFERENCE "reference" %token FILETYPE "file type" %token FILEFORMAT "file format" %token DISCRETIZATIONTYPE "discretization type"; %token SAVE "save" %token PLOT "plot" %token CAT "cat" %token EXEC "exec" %token READ "read" %token TETRAHEDRIZE "tetrahedrize" %token FACE %token OPTION %type suboption %type suboptionList %type optionlist solveopts %type