diff --git a/CMake.vars.example b/CMake.vars.example deleted file mode 100644 index a0c370af06..0000000000 --- a/CMake.vars.example +++ /dev/null @@ -1,58 +0,0 @@ -# This is a sample CMake.vars file for Hermes. - -# Target path -set(CMAKE_INSTALL_PREFIX "d:/hpfem/hermes/dependencies") - -# Optional features. -set(H2D_WITH_GLUT YES) -set(WITH_BSON YES) -set(WITH_MATIO YES) -set(MATIO_WITH_HDF5 YES) -set(WITH_TC_MALLOC YES) -SET(WITH_PARALUTION YES) -SET(WITH_MUMPS YES) - -# Debug / release -set(HERMES_COMMON_RELEASE NO) -set(H2D_RELEASE NO) - -# Some search paths. -if (WIN32) - set(GLUT_ROOT "d:/hpfem/hermes/dependencies") - set(GLEW_ROOT "d:/hpfem/hermes/dependencies") - set(XERCES_ROOT "d:/hpfem/hermes/dependencies") - set(XSD_ROOT "d:/hpfem/hermes/dependencies") - set(PTHREAD_ROOT "d:/hpfem/hermes/dependencies") - set(TCMALLOC_ROOT "d:/hpfem/hermes/dependencies") - # if using UMFPACK - set the root - if(WITH_UMFPACK) - set(UMFPACK_ROOT "d:/hpfem/hermes/dependencies") - endif(WITH_UMFPACK) - # if using PARALUTION - set the root - if(WITH_PARALUTION) - set(PARALUTION_ROOT "d:/hpfem/hermes/dependencies") - endif(WITH_PARALUTION) - # if using MUMPS - set the root and also set where is the Windows BLAS library - if(WITH_MUMPS) - set(MUMPS_ROOT "d:/hpfem/hermes/dependencies") - set(WINBLAS_ROOT "d:/hpfem/hermes/dependencies") - endif(WITH_MUMPS) - - # Target (installation) path. - set(TARGET_ROOT "d:/hpfem/hermes/dependencies") -else() - #set(GLUT_ROOT "/usr/lib/") - #set(GLEW_ROOT "/usr/lib/") - #set(PTHREAD_ROOT "/usr/lib/") - #set(UMFPACK_ROOT "/usr/lib/") - #set(CLAPACK_ROOT "/usr/lib/") -endif() - -# Trilinos - change "NO" to "YES" to use it, also Trilinos needs CLAPACK, so tell cmake where to find it. -set(WITH_TRILINOS NO) -if (WIN32) - set(TRILINOS_ROOT "d:/hpfem/hermes/dependencies/trilinos") - set(CLAPACK_ROOT "d:/hpfem/hermes/dependencies") -else() - set(TRILINOS_ROOT "~/solvers/trilinos") -endif() \ No newline at end of file diff --git a/CMake.vars.example.Linux b/CMake.vars.example.Linux new file mode 100644 index 0000000000..0e7b230a35 --- /dev/null +++ b/CMake.vars.example.Linux @@ -0,0 +1,112 @@ +# LINUX +# On linux, there should be no need to set up *_ROOT directories, in the default settings, they all point to /usr/local, as should be true on Debian systems. +# We mainly support gcc and CLang compilers with C++11 support. + +# BASIC CONFIGURATION + + # Global + # Target path + if(NOT(CMAKE_INSTALL_PREFIX)) + set(CMAKE_INSTALL_PREFIX "/usr/local") + endif() + + # Paths for compulsory dependencies + set(XERCES_ROOT "/usr/local") + set(XSD_ROOT "/usr/local") + + # HermesCommon + + # Release and debug versions + set(HERMES_COMMON_DEBUG YES) + set(HERMES_COMMON_RELEASE YES) + + # BFD + set(WITH_BFD NO) + set(BFD_ROOT "/usr/local") + + # TC_MALLOC + set(WITH_TC_MALLOC NO) + set(TCMALLOC_ROOT "/usr/local") + + # BSON + set(WITH_BSON NO) + set(BSON_ROOT "/usr/local") + + # MATIO + set(WITH_MATIO NO) + set(MATIO_ROOT "/usr/local") + set(MATIO_WITH_HDF5 NO) + + # Solvers + + # UMFPACK + set(WITH_UMFPACK YES) + set(UMFPACK_ROOT "/usr/local") + + # PARALUTION + set(WITH_PARALUTION NO) + set(PARALUTION_ROOT "/usr/local") + + # MUMPS + # Sequential version of MUMPS may be enabled by setting YES on the following line + # and pointing to the package installation directory with MUMPS_ROOT. To enable the + # parallel version, setting WITH_MPI to YES in addition to that should suffice. If link + # problems arise, it may be that the automatically found SCALAPACK libraries (reported + # during the CMake configuration phase) do not match those used when compiling MUMPS. + # In this case, set SCALAPACK_LIBRARIES manually and reconfigure Hermes. + # set(SCALAPACK_LIBRARIES -lscalapack -lblacs) + set(WITH_MUMPS NO) + set(MUMPS_ROOT "/usr/local") + + # Trilinos + set(WITH_TRILINOS NO) + set(TRILINOS_ROOT "/usr/local") + + # Mesh format Exodus II + set(WITH_EXODUSII NO) + set(EXODUSII_ROOT "/usr/local") + + # Parallel execution - Enable OpenMP for shared memory processing. + set(WITH_OPENMP YES) + + # If MPI is enabled, the MPI library installed on the system should be found by + # CMake automatically. If the found library doesn't match the one used to compile the + # particular MPI-dependent package, the other two options should be used to specify it: + ## set(MPI_LIBRARIES -lmpi) + ## set(MPI_INCLUDE_PATH /usr/include/openmpi) + set(WITH_MPI NO) + + # Experimental + # PJLIB - memory pool implementation + set(WITH_PJLIB NO) + set(PJLIB_ROOT "/usr/local") + + # Hermes2D + set(WITH_H2D YES) + + # Release and debug versions + set(H2D_DEBUG YES) + set(H2D_RELEASE YES) + + # In-house OpenGL visualization + set(H2D_WITH_GLUT YES) + set(GLUT_ROOT "/usr/local") + set(GLEW_ROOT "/usr/local") + set(PTHREAD_ROOT "/usr/local") + + # Test examples shipped with the library + set(H2D_WITH_TEST_EXAMPLES YES) + + +# ADVANCED CONFIGURATION + + # Number of solution / filter components. + # Minimum is 1, maximum 999. + set(H2D_MAX_COMPONENTS 10) + # Number of quadratures, recommended is 4. + # Minimum is 2, maximum 999. + set(H2D_MAX_QUADRATURES 4) + # This number has to be smaller than 21. + set(H2D_MAX_HANGING_NODES_LEVEL 15) + # Use second derivatives (that are turned off by default). + set(H2D_USE_SECOND_DERIVATIVES NO) diff --git a/CMake.vars.example.Windows b/CMake.vars.example.Windows new file mode 100644 index 0000000000..8df65bf729 --- /dev/null +++ b/CMake.vars.example.Windows @@ -0,0 +1,101 @@ +# WINDOWS +# On windows, as there is no package manager or "standard" directory structure, we need to get the locations of dependencies. +# We only support Visual Studio on Windows (with C++11 support), and as such, Release / Debug versions are handled by Visual Studio and there is no need or reason to set them up here. + +# BASIC CONFIGURATION + + # Global + # Generate static libs (instead of dynamic) + set(HERMES_STATIC_LIBS NO) + + # Target path + set(CMAKE_INSTALL_PREFIX "d:/hpfem/hermes/dependencies") + + # Paths for compulsory dependencies + set(XERCES_ROOT "d:/hpfem/hermes/dependencies") + set(XSD_ROOT "d:/hpfem/hermes/dependencies") + + # HermesCommon + # TC_MALLOC + set(WITH_TC_MALLOC NO) + set(TCMALLOC_ROOT "d:/hpfem/hermes/dependencies") + + # BSON + set(WITH_BSON NO) + set(BSON_ROOT "d:/hpfem/hermes/dependencies") + + # MATIO + set(WITH_MATIO NO) + set(MATIO_ROOT "d:/hpfem/hermes/dependencies") + set(MATIO_WITH_HDF5 NO) + + # Solvers + + # UMFPACK + set(WITH_UMFPACK YES) + set(UMFPACK_ROOT "d:/hpfem/hermes/dependencies") + + # PARALUTION + set(WITH_PARALUTION NO) + set(PARALUTION_ROOT "d:/hpfem/hermes/dependencies") + + # MUMPS + # Sequential version of MUMPS may be enabled by setting YES on the following line + # and pointing to the package installation directory with MUMPS_ROOT. + # Winblas (any BLAS library) is also necessary. + # For Win64 platform, ifconsol.lib is also necessary (part of the hermes-windows repository). + set(WITH_MUMPS NO) + set(MUMPS_ROOT "d:/hpfem/hermes/dependencies") + set(WINBLAS_ROOT "d:/hpfem/hermes/dependencies") + if(${CMAKE_CL_64}) # This means that the following is only for 64-bit build. + set(IFCONSOL_LIB_DIRECTORY "d:/hpfem/hermes/dependencies/lib") + endif(${CMAKE_CL_64}) + + # Trilinos + set(WITH_TRILINOS NO) + set(TRILINOS_ROOT "d:/hpfem/hermes/dependencies") + set(CLAPACK_ROOT "d:/hpfem/hermes/dependencies") + + # Mesh format Exodus II + set(WITH_EXODUSII NO) + set(EXODUSII_ROOT "d:/hpfem/hermes/dependencies") + + # Parallel execution - Enable OpenMP for shared memory processing. + set(WITH_OPENMP YES) + + # If MPI is enabled, the MPI library installed on the system should be found by + # CMake automatically. If the found library doesn't match the one used to compile the + # particular MPI-dependent package, the other two options should be used to specify it: + ## set(MPI_LIBRARIES -lmpi) + ## set(MPI_INCLUDE_PATH "d:/hpfem/hermes/dependencies/include") + set(WITH_MPI NO) + + # Experimental + # PJLIB - memory pool implementation + set(WITH_PJLIB NO) + set(PJLIB_ROOT "d:/hpfem/hermes/dependencies") + + # Hermes2D + set(WITH_H2D YES) + # In-house OpenGL visualization + set(H2D_WITH_GLUT YES) + set(GLUT_ROOT "d:/hpfem/hermes/dependencies") + set(GLEW_ROOT "d:/hpfem/hermes/dependencies") + set(PTHREAD_ROOT "d:/hpfem/hermes/dependencies") + + # Test examples shipped with the library + set(H2D_WITH_TEST_EXAMPLES YES) + + +# ADVANCED CONFIGURATION + + # Number of solution / filter components. + # Minimum is 1, maximum 999. + set(H2D_MAX_COMPONENTS 10) + # Number of quadratures, recommended is 4. + # Minimum is 2, maximum 999. + set(H2D_MAX_QUADRATURES 4) + # This number has to be smaller than 21. + set(H2D_MAX_HANGING_NODES_LEVEL 15) + # Use second derivatives (that are turned off by default). + set(H2D_USE_SECOND_DERIVATIVES NO) diff --git a/CMakeLists.txt b/CMakeLists.txt index f843b00340..466a7c49ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,92 +1,93 @@ project(hermes) cmake_minimum_required(VERSION 2.8) - #--------------------------------------------------------------------------------------------- - # Main configuration options. - #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - ### BEGIN DEFAULT CONFIGURATION ############################################################## - - # The values below are sane defaults to produce a build on all platforms, - # if you want to override them, set them in CMake.vars - - # Global - # Generate static libs (instead of dynamic) - set(HERMES_STATIC_LIBS NO) - - # For Win64 - if(${CMAKE_CL_64}) - set(WIN64 YES) - else(${CMAKE_CL_64}) - set(WIN64 NO) - endif(${CMAKE_CL_64}) - - # HermesCommon - # These are ignored for MSVC (where debug / release are handled differently) - set(HERMES_COMMON_DEBUG YES) - set(HERMES_COMMON_RELEASE YES) +########################################################################### +#############//////---------------------------------\\\\\\################# +#############!!!!!! NEVER CHANGE THIS FILE DIRECTLY !!!!!!################# +################!!!!!! USE the "CMake.vars" file !!!!!!#################### +#############\\\\\\---------------------------------//////################# +########################################################################### +# __ __ __ __ __ __ __ __ __ # +# / \ / \ / \ / \ / \ / \ / \ / \ / \ # +#| STOP || STOP || STOP || STOP || STOP || STOP || STOP || STOP || STOP | # +# \ __ / \ __ / \ __ / \ __ / \ __ / \ __ / \ __ / \ __ / \ __ / # +# || || || || || || || || || # +# || || || || || || || || || # +# || || || || || || || || || # +# || || || || || || || || || # +# / \ / \ / \ / \ / \ / \ / \ / \ / \ # +# ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ # +########################################################################### +#############//////---------------------------------\\\\\\################# +#############!!!!!! NEVER CHANGE THIS FILE DIRECTLY !!!!!!################# +################!!!!!! USE the "CMake.vars" file !!!!!!#################### +#############\\\\\\---------------------------------//////################# +########################################################################### + + + # The values below are sane defaults to produce a build on all platforms, + # if you want to override them, set them in CMake.vars rather than here. + + # Global + # Generate static libs (instead of dynamic) + set(HERMES_STATIC_LIBS NO) + + # HermesCommon + # These are ignored for MSVC (where debug / release are handled differently) + set(HERMES_COMMON_DEBUG YES) + set(HERMES_COMMON_RELEASE YES) - # Hermes2D: - set(WITH_H2D YES) + # Hermes2D: + set(WITH_H2D YES) # Release and debug versions. # These are ignored for MSVC (where debug / release are handled differently) set(H2D_DEBUG YES) set(H2D_RELEASE YES) - + # Optional parts of the library. set(H2D_WITH_GLUT YES) set(H2D_WITH_TEST_EXAMPLES YES) - - # Advanced settings. - # Number of solution / filter components. - # Minimum is 1, maximum 999. - set(H2D_MAX_COMPONENTS 10) - # Number of quadratures, recommended is 4. - # Minimum is 2, maximum 999. - set(H2D_MAX_QUADRATURES 4) - # This number has to be smaller than 21. - set(H2D_MAX_HANGING_NODES_LEVEL 15) - # Use second derivatives (that are turned off by default). - set(H2D_USE_SECOND_DERIVATIVES NO) - - # TC_MALLOC - set(WITH_TC_MALLOC NO) + + # TC_MALLOC + set(WITH_TC_MALLOC NO) - # BSON - set(WITH_BSON NO) + # BSON + set(WITH_BSON NO) - # MATIO - set(WITH_MATIO NO) - set(MATIO_WITH_HDF5 NO) + # MATIO + set(WITH_MATIO NO) + set(MATIO_WITH_HDF5 NO) + + # BFD + set(WITH_BFD NO) - #### Solvers ### - # UMFPACK is chosen by default. - set(WITH_UMFPACK YES) - - # PARALUTION is chosen by default. - set(WITH_PARALUTION NO) + #### Solvers ### + # UMFPACK is chosen by default. + set(WITH_UMFPACK YES) - # MUMPS - # Sequential version of MUMPS may be enabled by setting YES on the following line - # and pointing to the package installation directory with MUMPS_ROOT. To enable the - # parallel version, setting WITH_MPI to YES in addition to that should suffice. If link - # problems arise, it may be that the automatically found SCALAPACK libraries (reported - # during the CMake configuration phase) do not match those used when compiling MUMPS. - # In this case, set SCALAPACK_LIBRARIES manually in CMake.vars and reconfigure Hermes. - set(WITH_MUMPS NO) - # set(MUMPS_ROOT root/dir/of/mumps/) - # set(SCALAPACK_LIBRARIES -lscalapack -lblacs) - - # Trilinos - # Enable support for Trilinos solvers. - set(WITH_TRILINOS NO) + # PARALUTION + set(WITH_PARALUTION NO) - ### Mesh format ### - set(WITH_EXODUSII NO) - set(WITH_HDF5 NO) + # MUMPS + # Sequential version of MUMPS may be enabled by setting YES on the following line + # and pointing to the package installation directory with MUMPS_ROOT. To enable the + # parallel version, setting WITH_MPI to YES in addition to that should suffice. If link + # problems arise, it may be that the automatically found SCALAPACK libraries (reported + # during the CMake configuration phase) do not match those used when compiling MUMPS. + # In this case, set SCALAPACK_LIBRARIES manually in CMake.vars and reconfigure Hermes. + set(WITH_MUMPS NO) + # set(SCALAPACK_LIBRARIES -lscalapack -lblacs) + + # Trilinos + # Enable support for Trilinos solvers. + set(WITH_TRILINOS NO) + + ### Mesh format ### + set(WITH_EXODUSII NO) + set(WITH_HDF5 NO) - ### Others ### - # Parallel execution. + ### Others ### + # Parallel execution. # (tells the linker to use parallel versions of the selected solvers, if available): # # Enable OpenMP for shared memory processing. @@ -106,42 +107,70 @@ project(hermes) # Optional Windows stacktrace set(WITH_WINDOWS_STACKWALKER NO) + + ### END BASIC DEFAULT CONFIGURATION ############################################################## + + ################################## CURRENTLY NOT SUPPORTED ################################### + # \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ - ################################## CURRENTLY NOT SUPPORTED ################################### - # \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ - - # SuperLU - # First option enables sequential SuperLU, which should reside in SUPERLU_ROOT/lib - # and SUPERLU_ROOT/include. If SUPERLU_ROOT is not provided, the library will be searched - # for in system directories. If SUPERLU_MT is set to YES, the multithreaded version of - # SuperLU will be used. In this case, there should be either superlu_mt_PTHREAD.a and/or - # superlu_mt_OPENMP.a libraries present in the search path (the former will be chosen if - # WITH_OPENMP is set to NO, the latter otherwise). There should also be a subdirectory - # SLU_MT in the include directory since SuperLU_MT uses different versions of the same-named - # header files as the serial library. - set(WITH_SUPERLU NO) - set(SUPERLU_ROOT /opt/SuperLU_4.0/) - set(SUPERLU_MT NO) - - # PETSc - # If PETSc is enabled, PETSC_ROOT and PETSC_ARCH must be set as well; - # if PETSc is disabled, PETSC_ROOT and PETSC_ARCH will be ignored. - set(WITH_PETSC NO) - set(PETSC_ROOT /opt/petsc/petsc-3.1-p7) - set(PETSC_ARCH petsc-arch-without-scalar-type) - - # /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ - ################################## CURRENTLY NOT SUPPORTED ################################### - + # SuperLU + # First option enables sequential SuperLU, which should reside in SUPERLU_ROOT/lib + # and SUPERLU_ROOT/include. If SUPERLU_ROOT is not provided, the library will be searched + # for in system directories. If SUPERLU_MT is set to YES, the multithreaded version of + # SuperLU will be used. In this case, there should be either superlu_mt_PTHREAD.a and/or + # superlu_mt_OPENMP.a libraries present in the search path (the former will be chosen if + # WITH_OPENMP is set to NO, the latter otherwise). There should also be a subdirectory + # SLU_MT in the include directory since SuperLU_MT uses different versions of the same-named + # header files as the serial library. + set(WITH_SUPERLU NO) + set(SUPERLU_ROOT /opt/SuperLU_4.0/) + set(SUPERLU_MT NO) + + # PETSc + # If PETSc is enabled, PETSC_ROOT and PETSC_ARCH must be set as well; + # if PETSc is disabled, PETSC_ROOT and PETSC_ARCH will be ignored. + set(WITH_PETSC NO) + set(PETSC_ROOT /opt/petsc/petsc-3.1-p7) + set(PETSC_ARCH petsc-arch-without-scalar-type) + + # /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ + ################################## CURRENTLY NOT SUPPORTED ################################### + + ### BEGIN ADVANCED DEFAULT CONFIGURATION ############################################################## + + # Number of solution / filter components. + # Minimum is 1, maximum 999. + set(H2D_MAX_COMPONENTS 10) + # Number of quadratures, recommended is 4. + # Minimum is 2, maximum 999. + set(H2D_MAX_QUADRATURES 4) + # This number has to be smaller than 21. + set(H2D_MAX_HANGING_NODES_LEVEL 15) + # Use second derivatives (that are turned off by default). + set(H2D_USE_SECOND_DERIVATIVES NO) + + ### END ADVANCED DEFAULT CONFIGURATION ############################################################## ### END DEFAULT CONFIGURATION ################################################################ ############################################################################################## ############################################################################################## ### INTERNALS FOLLOW - DO NOT CHANGE ######################################################### - + + # For Win64 + if(${CMAKE_CL_64}) + set(WIN64 YES) + else(${CMAKE_CL_64}) + set(WIN64 NO) + endif(${CMAKE_CL_64}) + # Allow to override the default values in CMake.vars: - include(CMake.vars OPTIONAL) - include(../CMakeHermes.cmake OPTIONAL) - + include(CMake.vars OPTIONAL RESULT_VARIABLE CMAKE_VARS_LOADED) + if(${CMAKE_VARS_LOADED} MATCHES "NOTFOUND") + include(../CMakeHermes.cmake OPTIONAL RESULT_VARIABLE CMAKE_HERMES_LOADED) + if(${CMAKE_HERMES_LOADED} MATCHES "NOTFOUND") + message(FATAL_ERROR "You need to have a CMake.vars file - see the documentation and the example CMake.vars.example.Windows|Linux files for instructions.") + endif() + endif() + set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) if(WIN64) set(HERMES_COMMON_LIB hermes_common_64) @@ -267,11 +296,17 @@ project(hermes) return 0; } " BFD_WORKS) - if (BFD_LIBRARY AND BFD_WORKS) + if (BFD_LIBRARY AND BFD_WORKS AND WITH_BFD) set( HAVE_BFD YES ) else() set(BFD_LIBRARY "") endif() + + if(H2D_DEBUG) + set(HERMES_FLAGS ${HERMES_DEBUG_FLAGS}) + else() + set(HERMES_FLAGS ${HERMES_RELEASE_FLAGS}) + endif() endif() # This overrides CXX flags for MSVC @@ -375,17 +410,16 @@ project(hermes) # FindLAPACK is Fortran-only so Fortran must be enabled as well. if(WITH_UMFPACK OR WITH_PETSC OR WITH_MUMPS OR WITH_TRILINOS OR WITH_SUPERLU) if (NOT LAPACK_FOUND) - enable_language(Fortran) - find_package(LAPACK REQUIRED) - - # If no error occured, LAPACK library has been found. Save the path to - # it to cache, so that it will not be searched for during next 'cmake .' - set(LAPACK_LIBRARIES ${LAPACK_LIBRARIES} - CACHE STRING "Path to LAPACK/BLAS libraries.") - set(LAPACK_FOUND YES - CACHE STRING "Have LAPACK/BLAS libraries been found?") + enable_language(Fortran) + find_package(LAPACK REQUIRED) + + # If no error occured, LAPACK library has been found. Save the path to + # it to cache, so that it will not be searched for during next 'cmake .' + set(LAPACK_LIBRARIES ${LAPACK_LIBRARIES} + CACHE STRING "Path to LAPACK/BLAS libraries.") + set(LAPACK_FOUND YES + CACHE STRING "Have LAPACK/BLAS libraries been found?") endif (NOT LAPACK_FOUND) - add_definitions(-DWITH_BLAS) endif(WITH_UMFPACK OR WITH_PETSC OR WITH_MUMPS OR WITH_TRILINOS OR WITH_SUPERLU) endif(MSVC) @@ -409,6 +443,9 @@ project(hermes) include_directories(${MUMPS_INCLUDE_DIR}) set(MUMPS_LIBRARIES ${MUMPS_CPLX_LIBRARIES}) LIST(APPEND MUMPS_LIBRARIES ${MUMPS_REAL_LIBRARIES}) + if(NOT(MSVC)) + LIST(APPEND MUMPS_LIBRARIES ${GFORTRAN_LIBRARY}) + endif() endif(WITH_MUMPS) if(WITH_TRILINOS) @@ -448,19 +485,21 @@ project(hermes) include_directories(${MPI_INCLUDE_PATH}) endif(WITH_MPI) - IF(WITH_WINDOWS_STACKWALKER) - IF(MSVC) - find_package(STACK_WALKER REQUIRED) - include_directories(${STACK_WALKER_INCLUDE_DIR}) - ENDIF(MSVC) - ENDIF(WITH_WINDOWS_STACKWALKER) - # Match debug or release version of all other libraries. DETERMINE_HERMES_COMMON_RELEASE_DEBUG(H2D) if(NOT H2D_WITH_GLUT) set(NOGLUT YES) endif(NOT H2D_WITH_GLUT) + + if(HAVE_BFD) + find_package(LIBIBERTY REQUIRED) + include_directories(${LIBIBERTY_INCLUDE_DIR}) + endif() + + IF(HERMES_FOR_AGROS) + ADD_DEFINITIONS("-DHERMES_FOR_AGROS") + ENDIF(HERMES_FOR_AGROS) # Main CMakeLists.txt for each library are in the following directories. add_subdirectory(hermes_common) @@ -469,17 +508,17 @@ project(hermes) add_subdirectory(hermes2d) endif(WITH_H2D) - #------------------------------------------------------------------------------ + #------- # Report. #~~~~~~~~ message("\nHermes Configuration results") - message("---------------------") + message("----------------------------") message("Build static libs: ${HERMES_STATIC_LIBS}") if(WIN32) message("Build for Win64: ${WIN64}") endif(WIN32) - message("\n-------Features-------") + message("\n----------Features----------") message("Build with OpenMP: ${WITH_OPENMP}") message("Build with TCMalloc: ${WITH_TC_MALLOC}") message("Build with BSON: ${WITH_BSON}") @@ -491,20 +530,23 @@ project(hermes) message("Build with MPI: ${WITH_MPI}") endif() message("Build with EXODUSII: ${WITH_EXODUSII}") + message("----------------------------") - message("\n-------Solvers-------") + message("\n-----------Solvers----------") message("Build with UMFPACK: ${WITH_UMFPACK}") message("Build with PARALUTION: ${WITH_PARALUTION}") message("Build with PETSC: ${WITH_PETSC}") message("Build with MUMPS: ${WITH_MUMPS}") message("Build with SUPERLU${MT}: ${WITH_SUPERLU}") message("Build with TRILINOS: ${WITH_TRILINOS}") + message("----------------------------") - message("\n-----Hermes common-----") + message("\n-------Hermes common--------") message(" Debug version: ${HERMES_COMMON_DEBUG}") message(" Release version: ${HERMES_COMMON_RELEASE}") +message("----------------------------") - message("\n-----Hermes2D-----") + message("\n----------Hermes2D----------") message(" Build Hermes2D: ${WITH_H2D}") if(WITH_H2D) message(" Debug version: ${H2D_DEBUG}") @@ -512,5 +554,5 @@ project(hermes) message(" Test examples: ${H2D_WITH_TEST_EXAMPLES}") message(" Hermes2D with OpenGL: ${H2D_WITH_GLUT}") endif(WITH_H2D) - message("---------------------") + message("----------------------------") message("\n") diff --git a/README.rst b/README.rst index a9e3bd859e..956f5f1a63 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,14 @@ -[[[ IMPORTANT: Please read ]]] ------------------------------- +IMPORTANT: Please read +---------------------- Information about branches: +=========================== + +master-3.2 + +- current (latest) stable release branch +- documentation available at http://hpfem.org/wp-content/uploads/doc-web/doc-lib/html/html/index.html +- installation (a section in the above documentation): http://hpfem.org/wp-content/uploads/doc-web/doc-lib/html/html/src/installation.html +- more info at http://hpfem.org/hermes master @@ -27,13 +35,6 @@ master-1.0 devel - PURELY FOR DEVELOPMENT PURPOSES, NOT INTENDED FOR USERS AT ALL ------------------------------- - - -Hermes 2D hp-FEM library, version 3.0 (in progress) -===================================== - -This is a basic README file with generic information relevant for both Hermes Common and Hermes2D. Copyright ========= @@ -50,9 +51,9 @@ Public License (LGPL). For details see the files `COPYING` and `COPYING.LESSER`. User Documentation ================== -User Documentation is available online at http://hpfem.org/hermes/doc/index.html. +User Documentation is available online at http://hpfem.org/wp-content/uploads/doc-web/doc-lib/html/html/index.html. Download and Installation ========================= -Installation instructions for Linux, Mac OS X and Windows MSVC are part of User Documentation (Library part). +Installation instructions for Linux, Mac OS X and Windows MSVC are part of User Documentation (Library part). \ No newline at end of file diff --git a/cmake/BuildAndInstallScripts.cmake b/cmake/BuildAndInstallScripts.cmake index 98e4e537d7..6e023c4841 100644 --- a/cmake/BuildAndInstallScripts.cmake +++ b/cmake/BuildAndInstallScripts.cmake @@ -42,20 +42,4 @@ macro(INSTALL_LIB LIB) RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) - - IF(NOT DEFINED AGROS_BUILD) - IF(MSVC) - MAKE_PATH(TARGET_DIR "${CMAKE_INSTALL_PREFIX}/bin") - get_target_property(SOURCE_DEBUG_FILE ${LIB} LOCATION_Debug) - MAKE_PATH(SOURCE_DEBUG_FILE ${SOURCE_DEBUG_FILE}) - get_target_property(SOURCE_RELEASE_FILE ${LIB} LOCATION_Release) - MAKE_PATH(SOURCE_RELEASE_FILE ${SOURCE_RELEASE_FILE}) - add_custom_command(TARGET ${LIB} - POST_BUILD - COMMAND if not exist ${TARGET_DIR} mkdir ${TARGET_DIR} - COMMAND if exist ${SOURCE_DEBUG_FILE} copy /Y ${SOURCE_DEBUG_FILE} ${TARGET_DIR} - COMMAND if exist ${SOURCE_RELEASE_FILE} copy /Y ${SOURCE_RELEASE_FILE} ${TARGET_DIR}) - unset(TARGET_DIR) - ENDIF() - ENDIF() endmacro(INSTALL_LIB) diff --git a/cmake/FindCLAPACK.cmake b/cmake/FindCLAPACK.cmake index ed2100b5c7..603ecb32d2 100644 --- a/cmake/FindCLAPACK.cmake +++ b/cmake/FindCLAPACK.cmake @@ -14,22 +14,20 @@ FIND_PATH(BLAS_INCLUDE_PATH blaswrap.h ${CLAPACK_INCLUDE_SEARCH_PATH}) FIND_PATH(CLAPACK_INCLUDE_PATH clapack.h ${CLAPACK_INCLUDE_SEARCH_PATH}) FIND_PATH(F2C_INCLUDE_PATH f2c.h ${CLAPACK_INCLUDE_SEARCH_PATH}) -FIND_LIBRARY(BLAS_LIBRARY blas ${CLAPACK_LIB_SEARCH_PATH}) +FIND_LIBRARY(BLAS_LIBRARY NAMES blas libblas PATHS ${CLAPACK_LIB_SEARCH_PATH}) FIND_LIBRARY(CLAPACK_LIBRARY lapack ${CLAPACK_LIB_SEARCH_PATH}) FIND_LIBRARY(F2C_LIBRARY libf2c ${CLAPACK_LIB_SEARCH_PATH}) -IF(BLAS_INCLUDE_PATH AND CLAPACK_INCLUDE_PATH AND F2C_INCLUDE_PATH AND BLAS_LIBRARY AND CLAPACK_LIBRARY AND F2C_LIBRARY) - SET(CLAPACK_INCLUDE_DIR ${BLAS_INCLUDE_PATH} ${CLAPACK_INCLUDE_PATH} ${F2C_INCLUDE_PATH}) - SET(CLAPACK_LIBRARY ${BLAS_LIBRARY} ${CLAPACK_LIBRARY} ${F2C_LIBRARY}) - SET(HAVE_CLAPACK YES) - find_package_handle_standard_args(LAPACK DEFAULT_MSG CLAPACK_LIBRARY) - find_package_handle_standard_args(BLAS DEFAULT_MSG BLAS_LIBRARY) - find_package_handle_standard_args(F2C DEFAULT_MSG F2C_LIBRARY) -ENDIF(BLAS_INCLUDE_PATH AND CLAPACK_INCLUDE_PATH AND F2C_INCLUDE_PATH AND BLAS_LIBRARY AND CLAPACK_LIBRARY AND F2C_LIBRARY) +SET(CLAPACK_INCLUDE_DIR ${BLAS_INCLUDE_PATH} ${CLAPACK_INCLUDE_PATH} ${F2C_INCLUDE_PATH}) +SET(CLAPACK_LIBRARY ${BLAS_LIBRARY} ${CLAPACK_LIBRARY} ${F2C_LIBRARY}) +SET(HAVE_CLAPACK YES) +find_package_handle_standard_args(LAPACK DEFAULT_MSG CLAPACK_LIBRARY) +find_package_handle_standard_args(BLAS DEFAULT_MSG BLAS_LIBRARY) +find_package_handle_standard_args(F2C DEFAULT_MSG F2C_LIBRARY) IF(LAPACK_FOUND AND BLAS_FOUND AND F2C_FOUND) SET(CLAPACK_FOUND TRUE) - MESSAGE(STATUS "CLAPACK found.") + MESSAGE(STATUS "All CLAPACK libraries & headers found.") ELSE(LAPACK_FOUND AND BLAS_FOUND AND F2C_FOUND) MESSAGE(FATAL_ERROR "Could not find CLAPACK.") ENDIF(LAPACK_FOUND AND BLAS_FOUND AND F2C_FOUND) \ No newline at end of file diff --git a/cmake/FindGLUT.cmake b/cmake/FindGLUT.cmake index 621af716e4..4540870da7 100644 --- a/cmake/FindGLUT.cmake +++ b/cmake/FindGLUT.cmake @@ -6,7 +6,15 @@ if(WIN64) FIND_LIBRARY(GLUT_LIBRARY NAMES freeglut glut PATHS ${GLUT_ROOT}/lib/x64 ${GLUT_ROOT}/lib) else(WIN64) FIND_LIBRARY(GLUT_LIBRARY NAMES freeglut glut PATHS ${GLUT_ROOT}/lib /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64) + if(WIN32) + else(WIN32) + FIND_LIBRARY(GL_LIBRARY NAMES GL PATHS ${GLUT_ROOT}/lib /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64) + endif(WIN32) endif(WIN64) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT DEFAULT_MSG GLUT_LIBRARY) \ No newline at end of file +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT DEFAULT_MSG GLUT_LIBRARY) +if(WIN32) +else(WIN32) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT DEFAULT_MSG GL_LIBRARY) +endif(WIN32) \ No newline at end of file diff --git a/cmake/FindLIBIBERTY.cmake b/cmake/FindLIBIBERTY.cmake new file mode 100644 index 0000000000..48411cd4bd --- /dev/null +++ b/cmake/FindLIBIBERTY.cmake @@ -0,0 +1,15 @@ +# +# LIBIBERTY +# + +FIND_PATH(LIBIBERTY_INCLUDE_DIR libiberty.h ${LIBIBERTY_ROOT}/include/libiberty /usr/include/libiberty /usr/local/include/libiberty) + +if(WIN64) + FIND_LIBRARY(LIBIBERTY_LIBRARY NAMES libiberty PATHS ${LIBIBERTY_ROOT}/lib/x64 ${LIBIBERTY_ROOT}/lib) +else(WIN64) + FIND_LIBRARY(LIBIBERTY_LIBRARY NAMES libiberty.a PATHS ${LIBIBERTY_ROOT}/lib /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 /usr/lib/x86_64-linux-gnu /usr/lib/x86-linux-gnu) +endif(WIN64) + +# Report the found libraries, quit with fatal error if any required library has not been found. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBIBERTY DEFAULT_MSG LIBIBERTY_LIBRARY LIBIBERTY_INCLUDE_DIR) diff --git a/cmake/FindMUMPS.cmake b/cmake/FindMUMPS.cmake index c6b517664d..0ee33db65b 100644 --- a/cmake/FindMUMPS.cmake +++ b/cmake/FindMUMPS.cmake @@ -9,6 +9,8 @@ # Femhub by specifying the environment variables MY_MUMPS_LIB_DIRS and # MY_MUMPS_INC_DIRS. +INCLUDE(FindPackageHandleStandardArgs) + if(WIN64) SET(MUMPS_LIB_SEARCH_PATH ${MUMPS_ROOT}/lib/x64 ${MUMPS_ROOT}/lib) else(WIN64) @@ -21,10 +23,6 @@ FIND_LIBRARY(MUMPS_MPISEQ_LIBRARY NAMES mpiseq_seq libseq_c PATHS ${MUMPS_LIB_SE FIND_LIBRARY(MUMPS_COMMON_LIBRARY NAMES mumps_common_seq mumps_common_c PATHS ${MUMPS_LIB_SEARCH_PATH}) FIND_LIBRARY(MUMPS_PORD_LIBRARY NAMES pord_seq pord_c PATHS ${MUMPS_LIB_SEARCH_PATH}) -if(WITH_MPI) -FIND_PATH(MUMPS_MPISEQ_INCLUDE_PATH mpi.h PATHS ${MUMPS_INCLUDE_SEARCH_PATH}) -endif(WITH_MPI) - SET(MUMPS_INCLUDE_PATH ${MUMPS_INCLUDE_PATH} ${MUMPS_MPISEQ_INCLUDE_PATH}) FIND_LIBRARY(MUMPSD_SEQ_LIBRARY NAMES dmumps_seq dmumps_c PATHS ${MUMPS_LIB_SEARCH_PATH}) LIST(APPEND REQUIRED_REAL_LIBRARIES "MUMPSD_SEQ_LIBRARY") @@ -38,6 +36,12 @@ LIST(APPEND REQUIRED_CPLX_LIBRARIES "MUMPS_MPISEQ_LIBRARY") LIST(APPEND REQUIRED_REAL_LIBRARIES "MUMPS_COMMON_LIBRARY" "MUMPS_PORD_LIBRARY") LIST(APPEND REQUIRED_CPLX_LIBRARIES "MUMPS_COMMON_LIBRARY" "MUMPS_PORD_LIBRARY") +IF(NOT(MSVC)) + FIND_LIBRARY(GFORTRAN_LIBRARY NAMES libgfortran.so.3.0.0 gfortran.so.3.0.0 libgfortran gfortran li +bgfortran3 gfortran3 PATHS "/usr/lib/x86_64-linux-gnu" "/usr/lib/x86-linux-gnu") + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GFORTRAN DEFAULT_MSG GFORTRAN_LIBRARY) +ENDIF() + # Fortran libraries. FIND_LIBRARY(MUMPS_MPISEQ_FORTRAN_LIBRARY NAMES libseq_fortran PATHS ${MUMPS_LIB_SEARCH_PATH}) if(NOT(${MUMPS_MPISEQ_FORTRAN_LIBRARY} STREQUAL "MUMPS_MPISEQ_FORTRAN_LIBRARY-NOTFOUND")) @@ -73,7 +77,6 @@ FIND_LIBRARY(MUMPSZ_SEQ_FORTRAN_LIBRARY NAMES zmumps_fortran PATHS ${MUMPS_LIB_S endif(NOT(${MUMPSZ_SEQ_FORTRAN_LIBRARY} STREQUAL "MUMPSZ_SEQ_FORTRAN_LIBRARY-NOTFOUND")) # Test if all the required libraries have been found. If they haven't, end with fatal error... -INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS( MUMPS DEFAULT_MSG ${REQUIRED_REAL_LIBRARIES} ${REQUIRED_CPLX_LIBRARIES} MUMPS_INCLUDE_PATH ) diff --git a/cmake/FindPETSC.cmake b/cmake/FindPETSC.cmake index b73e022ce0..69500a2744 100644 --- a/cmake/FindPETSC.cmake +++ b/cmake/FindPETSC.cmake @@ -35,6 +35,7 @@ SET(COMMON_PETSC_INCLUDE_DIRS ) SET(COMMON_PETSC_LIB_DIRS + ${PETSC_ROOT}/lib ${PETSC_ROOT}/${PETSC_ARCH}/lib /usr/lib /usr/local/lib diff --git a/cmake/FindTRILINOS.cmake b/cmake/FindTRILINOS.cmake index 203c74bb34..59b904cc32 100644 --- a/cmake/FindTRILINOS.cmake +++ b/cmake/FindTRILINOS.cmake @@ -146,10 +146,11 @@ IF(EPETRA_FOUND AND TEUCHOS_FOUND) SET(TRILINOS_FOUND TRUE) ENDIF(EPETRA_FOUND AND TEUCHOS_FOUND) -IF(NOT KOMPLEX_FOUND) +IF(KOMPLEX_FOUND) +ELSE(KOMPLEX_FOUND) MESSAGE(STATUS "Komplex not found.") - SET(TRILINOS_FOUND FALSE) -ENDIF(NOT KOMPLEX_FOUND) + SET(HAVE_KOMPLEX NO) +ENDIF() # Experimental if(WITH_ZOLTAN) diff --git a/cmake/FindXERCES.cmake b/cmake/FindXERCES.cmake index 658d81b479..8a7bb48149 100644 --- a/cmake/FindXERCES.cmake +++ b/cmake/FindXERCES.cmake @@ -5,9 +5,9 @@ FIND_PATH(XERCES_INCLUDE_DIR xercesc/sax/InputSource.hpp xercesc/dom/DOMDocument.hpp xercesc/dom/DOMErrorHandler.hpp ${XERCES_ROOT}/include) if(WIN64) - FIND_LIBRARY(XERCES_LIBRARY NAMES xerces-c_3 xerces-c PATHS ${XERCES_ROOT}/lib/x64 ${XERCES_ROOT}/lib) + FIND_LIBRARY(XERCES_LIBRARY NAMES xerces-c_3 xerces-c PATHS ${XERCES_ROOT}/lib/x64 ${XERCES_ROOT}/lib/x64/vc-12.0 ${XERCES_ROOT}/lib/x64/vc-11.0 ${XERCES_ROOT}/lib/x64/vc-10.0 ${XERCES_ROOT}/lib ${XERCES_ROOT}/lib/vc-12.0 ${XERCES_ROOT}/lib/vc-11.0 ${XERCES_ROOT}/lib/vc-10.0) else(WIN64) - FIND_LIBRARY(XERCES_LIBRARY NAMES xerces-c_3 xerces-c PATHS ${XERCES_ROOT}/lib /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64) + FIND_LIBRARY(XERCES_LIBRARY NAMES xerces-c_3 xerces-c PATHS ${XERCES_ROOT}/lib ${XERCES_ROOT}/lib/vc-12.0 ${XERCES_ROOT}/lib/vc-11.0 ${XERCES_ROOT}/lib/vc-10.0 /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64) endif(WIN64) # Report the found libraries, quit with fatal error if any required library has not been found. diff --git a/cmake/FindXSD.cmake b/cmake/FindXSD.cmake index be5d3d62aa..737ef52d2c 100644 --- a/cmake/FindXSD.cmake +++ b/cmake/FindXSD.cmake @@ -6,7 +6,7 @@ SET(XSD_INCLUDE_SEARCH_PATH FIND_PATH(XSD_INCLUDE_DIR xsd/cxx/pre.hxx xsd/cxx/xml/dom/parsing-source.hxx xsd/cxx/post.hxx xsd/cxx/xml/sax/std-input-source.hxx xsd/cxx/tree/error-handler.hxx ${XSD_INCLUDE_SEARCH_PATH}) -FIND_PROGRAM(XSD_BIN NAMES xsd xsdcxx) +FIND_PROGRAM(XSD_BIN PATHS ${XSD_ROOT}/bin NAMES xsdcxx xsd) # Report the found libraries, quit with fatal error if any required library has not been found. INCLUDE(FindPackageHandleStandardArgs) diff --git a/debian/changelog b/debian/changelog index f532726838..f18f747666 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +hermes2d (3.2-ubuntu195) raring; urgency=low + * Proper examples + * Optimizations in the code + * Stabilization, bug-fixing + + -- Lukas Korous Fri, 30 Sep 2016 14:00:00 +0200 + hermes2d (3.0-ubuntu195) raring; urgency=low * Speed and stability optimizations * "Eggshell"-integration approximation diff --git a/debian/control b/debian/control index 8896dde9f5..becda0b9ec 100644 --- a/debian/control +++ b/debian/control @@ -2,13 +2,13 @@ Source: hermes2d Section: science Priority: extra Maintainer: Lukas Korous -Build-Depends: libamd2.2.0 (>= 3.4.0), libsuitesparse-dev (>= 3.2.0), libmumps-seq-dev, xsdcxx (>= 3.3.0), libxerces-c-dev (>= 3.1.0), cmake, g++, gfortran, freeglut3-dev, libglew1.5-dev, python-sphinx, debhelper +Build-Depends: libsuitesparse-dev (>= 3.2.0), libmumps-seq-dev, xsdcxx (>= 3.3.0), libxerces-c-dev (>= 3.1.0), cmake (>= 3.0), g++, gfortran, freeglut3-dev, libglew1.5-dev, python-sphinx, debhelper Standards-Version: 3.8.0 Homepage: http://hpfem.org/hermes Package: hermes2d Architecture: any -Depends: ${shlibs:Depends}, libamd2.2.0 (>= 3.4.0), libumfpack5.4.0 (>= 3.4.0), libmumps-seq-4.10.0 (>= 4.10.0), libblas3 (>= 1.2), libxerces-c3.1 (>= 3.1.0), freeglut3-dev, libglew1.5-dev +Depends: ${shlibs:Depends}, libsuitesparse-dev (>= 3.2.0), libmumps-seq-dev, xsdcxx (>= 3.3.0), libxerces-c-dev (>= 3.1.0), freeglut3-dev, libglew1.5-dev Description: hp-FEM multiphysics library Hermes is a C++ library for rapid development of adaptive hp-FEM / hp-DG solvers. Novel hp-adaptivity algorithms help solve a large variety of problems ranging from ODE and stationary linear PDE to complex time-dependent nonlinear multiphysics PDE systems. Highlights of Hermes Capabilities: - L2, H1, HCurl, HDiv Sobolev spaces, polynomial degree up to 10 diff --git a/debian/rules b/debian/rules index f7b945a6db..bb39f0d04e 100755 --- a/debian/rules +++ b/debian/rules @@ -7,7 +7,8 @@ configure: configure-stamp configure-stamp: dh_testdir -$(MAKE) distclean - cmake -DCMAKE_INSTALL_PREFIX=$(CURDIR)/debian/hermes/usr . + cp CMake.vars.example.Linux CMake.vars + cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_INSTALL_PREFIX=$(CURDIR)/debian/hermes/usr . touch configure-stamp build: configure-stamp build-stamp diff --git a/doc/Hermes-withFixes.tex b/doc/Hermes-withFixes.tex new file mode 100644 index 0000000000..777f2dba08 --- /dev/null +++ b/doc/Hermes-withFixes.tex @@ -0,0 +1,3433 @@ +% Generated by Sphinx. +\def\sphinxdocclass{report} +\documentclass[a4paper,0pt,english]{sphinxmanual} +\usepackage[utf8]{inputenc} +\DeclareUnicodeCharacter{00A0}{\nobreakspace} +\usepackage{cmap} +\usepackage[T1]{fontenc} +\usepackage{babel} +\usepackage{times} +\usepackage[Bjarne]{fncychap} +\usepackage{longtable} +\usepackage{sphinx} +\usepackage{multirow} + +\usepackage{dsfont} +\usepackage{braket} +\usepackage{slashed} +\usepackage{etoolbox} +\pagestyle{fancy} +\usepackage{color} +\usepackage{float} +\usepackage{bm} +\usepackage{eso-pic} +\newcommand\BackgroundPic{% +\put(0,0){% +\parbox[b][\paperheight]{\paperwidth}{% +\vfill +\centering +\includegraphics[width=\paperwidth,height=\paperheight, keepaspectratio]{HermesFlyer.jpg}% +\vfill +}}} +\let\origfigure=\figure +\renewenvironment{figure}[6]{ +\origfigure[H]} +{\endlist} +\def\degrees{^\circ} +\def\d{{\rm d}} +\pagenumbering{arabic} +\def\L{{\mathcal L}} +\def\H{{\mathcal H}} +\def\M{{\mathcal M}} +\def\matrix{} +\def\fslash#1{#1 \!\!\!/} +\def\F{{\bf F}} +\def\R{{\bf R}} +\def\J{{\bf J}} +\def\x{{\bf x}} +\def\y{{\bf y}} +\def\h{{\rm h}} +\def\a{{\rm a}} +\newcommand{\bfx}{\mbox{\boldmath $x$}} +\newcommand{\bfy}{\mbox{\boldmath $y$}} +\newcommand{\bfz}{\mbox{\boldmath $z$}} +\newcommand{\bfv}{\mbox{\boldmath $v$}} +\newcommand{\bfu}{\mbox{\boldmath $u$}} +\newcommand{\bfF}{\mbox{\boldmath $F$}} +\newcommand{\bfJ}{\mbox{\boldmath $J$}} +\newcommand{\bfU}{\mbox{\boldmath $U$}} +\newcommand{\bfY}{\mbox{\boldmath $Y$}} +\newcommand{\bfR}{\mbox{\boldmath $R$}} +\newcommand{\bfg}{\mbox{\boldmath $g$}} +\newcommand{\bfc}{\mbox{\boldmath $c$}} +\newcommand{\bfxi}{\mbox{\boldmath $\xi$}} +\newcommand{\bfw}{\mbox{\boldmath $w$}} +\newcommand{\bfE}{\mbox{\boldmath $E$}} +\newcommand{\bfS}{\mbox{\boldmath $S$}} +\newcommand{\bfb}{\mbox{\boldmath $b$}} +\newcommand{\bfH}{\mbox{\boldmath $H$}} +\def\Hcurl{{\bfH({\rm curl})}} +\def\Hdiv{{\bfH({\rm div})}} + +\newcommand{\dd}[2]{\frac{\partial #1}{\partial #2}} +\newcommand{\dx}{\;\mbox{d}\bfx} + + +%\def\back{\!\!\!\!\!\!\!\!\!\!} +\def\PY{} +\def\PYZcb{} +\def\PYZob{} +\def\PYZus{} +\def\PYZbs{} +\def\PYZpc{} +\def\PYZti{} +\def\PYZsh{} +\def\PYZhy{-} +\def\back{} +\def\col#1#2{\left(\matrix{#1#2}\right)} +\def\row#1#2{\left(\matrix{#1#2}\right)} +\def\mat#1{\begin{pmatrix}#1\end{pmatrix}} +\def\matd#1#2{\left(\matrix{#1\back0\cr0\back#2}\right)} +\def\p#1#2{{\partial#1\over\partial#2}} +\def\cg#1#2#3#4#5#6{({#1},\,{#2},\,{#3},\,{#4}\,|\,{#5},\,{#6})} +\def\half{{\textstyle{1\over2}}} +\def\jsym#1#2#3#4#5#6{\left\{\matrix{ +{#1}{#2}{#3} +{#4}{#5}{#6} +}\right\}} +\def\diag{\hbox{diag}} + +\font\dsrom=dsrom10 +\def\one{\hbox{\dsrom 1}} + +\def\res{\mathop{\mathrm{Res}}} + +\def\mathnot#1{\text{"$#1$"}} + + +%See Character Table for cmmib10: +%http://www.math.union.edu/~dpvc/jsmath/download/extra-fonts/cmmib10/cmmib10.html +\font\mib=cmmib10 +\def\balpha{\hbox{\mib\char"0B}} +\def\bbeta{\hbox{\mib\char"0C}} +\def\bgamma{\hbox{\mib\char"0D}} +\def\bdelta{\hbox{\mib\char"0E}} +\def\bepsilon{\hbox{\mib\char"0F}} +\def\bzeta{\hbox{\mib\char"10}} +\def\boldeta{\hbox{\mib\char"11}} +\def\btheta{\hbox{\mib\char"12}} +\def\biota{\hbox{\mib\char"13}} +\def\bkappa{\hbox{\mib\char"14}} +\def\blambda{\hbox{\mib\char"15}} +\def\bmu{\hbox{\mib\char"16}} +\def\bnu{\hbox{\mib\char"17}} +\def\bxi{\hbox{\mib\char"18}} +\def\bpi{\hbox{\mib\char"19}} +\def\brho{\hbox{\mib\char"1A}} +\def\bsigma{\hbox{\mib\char"1B}} +\def\btau{\hbox{\mib\char"1C}} +\def\bupsilon{\hbox{\mib\char"1D}} +\def\bphi{\hbox{\mib\char"1E}} +\def\bchi{\hbox{\mib\char"1F}} +\def\bpsi{\hbox{\mib\char"20}} +\def\bomega{\hbox{\mib\char"21}} + +\def\bvarepsilon{\hbox{\mib\char"22}} +\def\bvartheta{\hbox{\mib\char"23}} +\def\bvarpi{\hbox{\mib\char"24}} +\def\bvarrho{\hbox{\mib\char"25}} +\def\bvarphi{\hbox{\mib\char"27}} + +%how to use: +%$$\alpha\balpha$$ +%$$\beta\bbeta$$ +%$$\gamma\bgamma$$ +%$$\delta\bdelta$$ +%$$\epsilon\bepsilon$$ +%$$\zeta\bzeta$$ +%$$\eta\boldeta$$ +%$$\theta\btheta$$ +%$$\iota\biota$$ +%$$\kappa\bkappa$$ +%$$\lambda\blambda$$ +%$$\mu\bmu$$ +%$$\nu\bnu$$ +%$$\xi\bxi$$ +%$$\pi\bpi$$ +%$$\rho\brho$$ +%$$\sigma\bsigma$$ +%$$\tau\btau$$ +%$$\upsilon\bupsilon$$ +%$$\phi\bphi$$ +%$$\chi\bchi$$ +%$$\psi\bpsi$$ +%$$\omega\bomega$$ +% +%$$\varepsilon\bvarepsilon$$ +%$$\vartheta\bvartheta$$ +%$$\varpi\bvarpi$$ +%$$\varrho\bvarrho$$ +%$$\varphi\bvarphi$$ + +%small font +\font\mibsmall=cmmib7 +\def\bsigmasmall{\hbox{\mibsmall\char"1B}} + +\def\Tr{\hbox{Tr}\,} +\def\Arg{\hbox{Arg}} +\def\atan{\hbox{atan}} + + +\title{Hermes Documentation} +\date{August 03, 2014} +\release{3.1.0} +\author{hp-FEM group} +\newcommand{\sphinxlogo}{} +\renewcommand{\releasename}{Release} +\makeindex + +\makeatletter +\def\PYG@reset{\let\PYG@it=\relax \let\PYG@bf=\relax% + \let\PYG@ul=\relax \let\PYG@tc=\relax% + \let\PYG@bc=\relax \let\PYG@ff=\relax} +\def\PYG@tok#1{\csname PYG@tok@#1\endcsname} +\def\PYG@toks#1+{\ifx\relax#1\empty\else% + \PYG@tok{#1}\expandafter\PYG@toks\fi} +\def\PYG@do#1{\PYG@bc{\PYG@tc{\PYG@ul{% + \PYG@it{\PYG@bf{\PYG@ff{#1}}}}}}} +\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+\PYG@do{#2}} + +\expandafter\def\csname PYG@tok@gd\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}} +\expandafter\def\csname PYG@tok@gu\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}} +\expandafter\def\csname PYG@tok@gt\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}} +\expandafter\def\csname PYG@tok@gs\endcsname{\let\PYG@bf=\textbf} +\expandafter\def\csname PYG@tok@gr\endcsname{\def\PYG@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}} +\expandafter\def\csname PYG@tok@cm\endcsname{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}} +\expandafter\def\csname PYG@tok@vg\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}} +\expandafter\def\csname PYG@tok@m\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}} +\expandafter\def\csname PYG@tok@mh\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}} +\expandafter\def\csname PYG@tok@cs\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}\def\PYG@bc##1{\setlength{\fboxsep}{0pt}\colorbox[rgb]{1.00,0.94,0.94}{\strut ##1}}} +\expandafter\def\csname PYG@tok@ge\endcsname{\let\PYG@it=\textit} +\expandafter\def\csname PYG@tok@vc\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}} +\expandafter\def\csname PYG@tok@il\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}} +\expandafter\def\csname PYG@tok@go\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.20,0.20,0.20}{##1}}} +\expandafter\def\csname PYG@tok@cp\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@gi\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}} +\expandafter\def\csname PYG@tok@gh\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} +\expandafter\def\csname PYG@tok@ni\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.84,0.33,0.22}{##1}}} +\expandafter\def\csname PYG@tok@nl\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.13,0.44}{##1}}} +\expandafter\def\csname PYG@tok@nn\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.05,0.52,0.71}{##1}}} +\expandafter\def\csname PYG@tok@no\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.38,0.68,0.84}{##1}}} +\expandafter\def\csname PYG@tok@na\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}} +\expandafter\def\csname PYG@tok@nb\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@nc\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.05,0.52,0.71}{##1}}} +\expandafter\def\csname PYG@tok@nd\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.33,0.33,0.33}{##1}}} +\expandafter\def\csname PYG@tok@ne\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@nf\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.02,0.16,0.49}{##1}}} +\expandafter\def\csname PYG@tok@si\endcsname{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.44,0.63,0.82}{##1}}} +\expandafter\def\csname PYG@tok@s2\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}} +\expandafter\def\csname PYG@tok@vi\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}} +\expandafter\def\csname PYG@tok@nt\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.02,0.16,0.45}{##1}}} +\expandafter\def\csname PYG@tok@nv\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}} +\expandafter\def\csname PYG@tok@s1\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}} +\expandafter\def\csname PYG@tok@gp\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.78,0.36,0.04}{##1}}} +\expandafter\def\csname PYG@tok@sh\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}} +\expandafter\def\csname PYG@tok@ow\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@sx\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.78,0.36,0.04}{##1}}} +\expandafter\def\csname PYG@tok@bp\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@c1\endcsname{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}} +\expandafter\def\csname PYG@tok@kc\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@c\endcsname{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}} +\expandafter\def\csname PYG@tok@mf\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}} +\expandafter\def\csname PYG@tok@err\endcsname{\def\PYG@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}} +\expandafter\def\csname PYG@tok@kd\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@ss\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.32,0.47,0.09}{##1}}} +\expandafter\def\csname PYG@tok@sr\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.14,0.33,0.53}{##1}}} +\expandafter\def\csname PYG@tok@mo\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}} +\expandafter\def\csname PYG@tok@mi\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}} +\expandafter\def\csname PYG@tok@kn\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@o\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PYG@tok@kr\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@s\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}} +\expandafter\def\csname PYG@tok@kp\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@w\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}} +\expandafter\def\csname PYG@tok@kt\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.56,0.13,0.00}{##1}}} +\expandafter\def\csname PYG@tok@sc\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}} +\expandafter\def\csname PYG@tok@sb\endcsname{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}} +\expandafter\def\csname PYG@tok@k\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}} +\expandafter\def\csname PYG@tok@se\endcsname{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}} +\expandafter\def\csname PYG@tok@sd\endcsname{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}} + +\def\PYGZbs{\char`\\} +\def\PYGZus{\char`\_} +\def\PYGZob{\char`\{} +\def\PYGZcb{\char`\}} +\def\PYGZca{\char`\^} +\def\PYGZam{\char`\&} +\def\PYGZlt{\char`\<} +\def\PYGZgt{\char`\>} +\def\PYGZsh{\char`\#} +\def\PYGZpc{\char`\%} +\def\PYGZdl{\char`\$} +\def\PYGZhy{\char`\-} +\def\PYGZsq{\char`\'} +\def\PYGZdq{\char`\"} +\def\PYGZti{\char`\~} +% for compatibility with earlier versions +\def\PYGZat{@} +\def\PYGZlb{[} +\def\PYGZrb{]} +\makeatother + +\begin{document} +\AddToShipoutPicture*{\BackgroundPic} +\ \\ \newpage +\ClearShipoutPicture +\maketitle +\tableofcontents +\phantomsection\label{index::doc} + +\chapter{Introduction} +\label{src/introduction:introduction}\label{src/introduction::doc}\label{src/introduction:hermes} + +\section{Introduction} +\label{src/intro:introduction}\label{src/intro::doc}\floatplacement{figure}{H} +Thank you for your interest in Hermes! + +Hermes is a C++ library for rapid development of adaptive \emph{hp}-FEM and \emph{hp}-DG solvers, +with emphasis on nonlinear, time-dependent, multi-physics problems. + +This document is organized as follows: +\begin{itemize} +\item {} +Section 1 provides general information about Hermes and the computational methods it uses, +and how to install Hermes on various platforms. + +\item {} +Section 2 is the Getting Started Guide - to get you started in no time. + +\item {} +Section 3 is the extended documentation section, you will find developers documentation in Doxygen, +as well as step-by-step user documentation in tutorials and advanced examples. + +\item {} +Section 4 explains how to use Git and Github, and how you can contribute to the project if interested. + +\end{itemize} + +This document is under continuous development. If you find bugs, typos, dead links +and such, please report them to the +\href{http://groups.google.com/group/hermes2d/}{Hermes2D mailing list}. + + +\chapter{Hermes Overview} +\label{src/introduction1::doc}\label{src/introduction1:hermes-overview} + +\section{About Hermes} +\label{src/about-hermes::doc}\label{src/about-hermes:about-hermes} +Hermes is a free C++ library for rapid development of +adaptive \emph{hp}-FEM and \emph{hp}-DG solvers for partial differential equations (PDE) +and multiphysics PDE systems. The development team now includes mostly the department of Theory of Electrical Engineering at the University of West Bohemia in Pilsen (contact: \href{mailto:korous@rice.zcu.cz}{korous@rice.zcu.cz}), in the past the main development was done by the \href{http://hpfem.org/hermes}{hp-FEM group} at the \href{http://www.unr.edu}{University of Nevada, Reno}. +Information about further collaborators from numerous places around the globe can be found at \href{http://www.hpfem.org/citing/}{http://www.hpfem.org/citing/}. + +A standard way to use Hermes is to write short C++ user programs +that use the functionality provided by the library, but for +those who prefer to use a graphical interface, the group located at the +University of West Bohemia also develops a graphical Engineering tool based on Hermes2D: +\href{http://agros2d.org/}{Agros2D}. +\begin{figure}[htbp] +\centering + +\scalebox{0.500000}{\includegraphics{agros.png}} +\end{figure} + +Hermes is loaded with modern finite element technology. We hope that you will enjoy +the software and that you will find this documentation useful. +In any case please let us know if you find mistakes +or if you can suggest improvements to this documentation or to Hermes itself. + +Free use of this software is granted under the terms of the GNU Lesser General +Public License (LGPL). For details see the files \emph{COPYING} and \emph{COPYING.LESSER}. + + +\section{Mathematical Background} +\label{src/math-background:mathematical-background}\label{src/math-background::doc} +The main strength of Hermes is a modern adaptive higher-order +finite element technology combined with very easy-to-use implementation approaches. + + +\subsection{Features} +\label{src/math-background:features}\begin{itemize} +\item {} +Curvilinear elements. + +\item {} +Reduced mesh generation needs. + +\item {} +Arbitrary-level hanging nodes. + +\item {} +Scalar and vector-valued approximations. + +\item {} +Advanced nonlinear solver capabilities. + +\item {} +Exponential convergence of adaptive \emph{hp}-FEM. + +\item {} +Dozens of time-integration methods. + +\item {} +Adaptivity with dynamical meshes for time-dependent problems. + +\item {} +Adaptive multimesh \emph{hp}-FEM for multiphysics coupled problems. + +\item {} +Coupled problems solved together with hp-DG and hp-FEM. + +\item {} +Calculations with physical quantities defined in different subdomains. + +\end{itemize} + +Some the above points are discussed in more detail below: +\begin{itemize} +\item {} +\textbf{Curvilinear elements}: Approximating curved boundaries or material interfaces via small elements with straight edges belongs to history. It is much more efficient to employ curvilinear elements, such as in the following acoustics problem. + +\end{itemize} +\begin{figure}[htbp] +\centering + +\scalebox{0.700000}{\includegraphics{acoustic.png}} +\end{figure} +\begin{itemize} +\item {} +\textbf{Reduced mesh generation needs}: The previous result was obtained with the mesh shown below, but we also provide support for traditional mesh generators including Triangle, CUBIT, GMSH. + +\end{itemize} +\begin{figure}[htbp] +\centering + +\scalebox{0.400000}{\includegraphics{initmesh.png}} +\end{figure} +\begin{itemize} +\item {} +\textbf{Arbitrary-level hanging nodes}: Hermes can handle irregular meshes with arbitrary-level hanging nodes. This makes adaptive algorithms much faster compared to algorithms that use regular meshes (without hanging nodes). + +\end{itemize} +\begin{figure}[htbp] +\centering + +\scalebox{0.500000}{\includegraphics{ord_2d_c.png}} +\end{figure} +\begin{itemize} +\item {} +\textbf{Exponential convergence of adaptive hp-FEM}: Many practitioners are skeptical about adaptive FEM because it makes computations slow. However, the exponential convergence of adaptive \emph{hp}-FEM is very different from slow, algebraic convergence of standard low-order FEM. A typical comparison of adaptive low-order FEM and \emph{hp}-FEM is shown below. Here \emph{p=1} and \emph{p=2} means linear and quadratic elements, respectively. The vertical axis shows the approximation error, the horizontal one the number of degrees of freedom (problem size). + +\end{itemize} +\begin{figure}[htbp] +\centering + +\scalebox{0.500000}{\includegraphics{conv_dof.png}} +\end{figure} + +Same graphs as above but now in terms of CPU time: +\begin{figure}[htbp] +\centering + +\scalebox{0.500000}{\includegraphics{conv_cpu.png}} +\end{figure} +\begin{itemize} +\item {} +\textbf{Dozens of time-integration methods}: Hermes has a unique way of using time-integration methods. More than 30 methods are readily available, including the most advanced adaptive implicit higher-order methods. The sample results below illustrate that it is highly recommended to take the time-discretization error seriously (below on the left). The reason is that it can easily be orders of magnitude larger than the error in space (below on the right). + +\end{itemize} +\begin{figure}[htbp] +\centering + +\scalebox{0.700000}{\includegraphics{time_error.png}} +\end{figure} +\begin{itemize} +\item {} +\textbf{Multimesh hp-FEM}: Approximating different physical fields on the same mesh belongs to history. For a given solution component, just one finite element mesh can be optimal. Hermes uses an original adaptive multimesh \emph{hp}-FEM technology to discretize any multiphysics problem \emph{on multiple meshes in a monolithic fashion}. No error due to data transfer between various meshes is present. The following figure illustrates this on a coupled problem of heat and moisture transfer in massive concrete walls of a nuclear reactor vessel. + +\end{itemize} +\begin{figure}[htbp] +\centering + +\scalebox{0.500000}{\includegraphics{hm-sln-frame.png}} +\end{figure} +\begin{figure}[htbp] +\centering + +\scalebox{0.500000}{\includegraphics{hm-mesh-frame.png}} +\end{figure} +\begin{itemize} +\item {} +\textbf{Dynamical meshes for time-dependent problems}: In time-dependent problems, different physical fields or solution components can be approximated on individual meshes that evolve in time independently of each other. + +\end{itemize} +\begin{figure}[htbp] +\centering + +\scalebox{0.700000}{\includegraphics{flame.jpg}} +\end{figure} +\begin{itemize} +\item {} +\textbf{Wide applicability}: Hermes does not employ any error estimate or another technique that would limit its applicability to some particular class of PDE problems. It allows you to tackle an arbitrary PDE or multiphysics PDE system. Visit the \href{http://hpfem.org/}{hp-FEM group home page} and the \href{http://hpfem.org/gallery/}{gallery} to see examples. + +\end{itemize} +\begin{figure}[htbp] +\centering + +\scalebox{0.500000}{\includegraphics{ns.jpg}} +\end{figure} + + +\subsection{Implementation point of view} +\label{src/math-background:implementation-point-of-view}\begin{itemize} +\item {} +OpenMP parallelization + +\item {} +C++ templates for unified handling of real and complex problems + +\item {} +Own OpenGL visualization \& VTK outputs of meshes, spaces, solutions + +\item {} +User-friendly written easy-to-grasp code + +\item {} +XML, BSON save / load of the most important classes + +\item {} +Solvers interfaces: UMFPACK, PARALUTION, PETSc, MUMPS, … + +\item {} +GMSH, ExodusII mesh formats + +\item {} +Matlab, MatrixMarket matrix exports + +\item {} +Well arranged doxygen documentation + +\item {} +Exception safe API + +\end{itemize} + + +\subsection{Presentation about Hermes given at ESCO 2014 conference} +\label{src/math-background:presentation-about-hermes-given-at-esco-2014-conference} +A number of presentations about Hermes have been given. +\begin{figure}[htbp] +\centering + +\scalebox{0.700000}{\includegraphics{presentation.jpg}} +\end{figure} + +Here is a link to one of them: \href{https://github.com/hpfem/hermes/tree/master-3.1/doc/HermesPresentation.pdf}{https://github.com/hpfem/hermes/tree/master-3.1/doc/HermesPresentation.pdf}. + + +\section{Citing Hermes} +\label{src/citing-hermes::doc}\label{src/citing-hermes:citing-hermes} +If you use Hermes for your work, please be so kind to include some of the references below as appropriate. + +\textbf{Monographs}: + +\begin{Verbatim}[commandchars=\\\{\}] +@Book\PYGZob{}Hermes\PYGZhy{}book1, + author = \PYGZob{}P. Solin, K. Segeth, I. Dolezel\PYGZcb{}, + title = \PYGZob{}Higher\PYGZhy{}Order Finite Element Methods\PYGZcb{}, + publisher = \PYGZob{}Chapman \PYGZam{} Hall / CRC Press\PYGZcb{}, + year = \PYGZob{}2003\PYGZcb{} +\PYGZcb{} +\end{Verbatim} + +\begin{Verbatim}[commandchars=\\\{\}] +@Book\PYGZob{}Hermes\PYGZhy{}book2, + author = \PYGZob{}P. Solin\PYGZcb{}, + title = \PYGZob{}Partial Differential Equations and the Finite Element Method\PYGZcb{}, + publisher = \PYGZob{}J. Wiley \PYGZam{} Sons\PYGZcb{}, + year = \PYGZob{}2005\PYGZcb{} +\PYGZcb{} +\end{Verbatim} + +\textbf{Reference to the Hermes open-source project}: + +\begin{Verbatim}[commandchars=\\\{\}] +@Manual\PYGZob{}Hermes\PYGZhy{}project, + title = \PYGZob{}Hermes \PYGZhy{} Higher\PYGZhy{}Order Modular Finite Element System (User\PYGZsq{}s Guide)\PYGZcb{}, + author = \PYGZob{}P. Solin et al.\PYGZcb{}, + url = \PYGZob{}http://hpfem.org/\PYGZcb{} +\PYGZcb{} +\end{Verbatim} + +\textbf{Underlying algorithms (hanging nodes, adaptivity, shape functions)}: +\begin{Verbatim}[commandchars=\\\{\}] +@Article\PYZob{}Hermes\PYZhy{}time\PYZhy{}integration, + author = \PYZob{}P. Solin, L. Korous\PYZcb{}, + title = \PYZob{}Adaptive Higher\PYZhy{}Order Finite Element Methods for Transient PDE + Problems Based on Embedded Higher\PYZhy{}Order Implicit Runge\PYZhy{}Kutta Methods\PYZcb{}, + journal = \PYZob{}J. Comput. Physics\PYZcb{}, + year = \PYZob{}2011\PYZcb{}, + status = \PYZob{}accepted\PYZcb{}, + volume = \PYZob{}\PYZcb{}, + pages = \PYZob{}\PYZcb{} +\PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] +@Article\PYZob{}Hermes\PYZhy{}hanging\PYZhy{}nodes, + author = \PYZob{}P. Solin, J. Cerveny, I. Dolezel\PYZcb{}, + title = \PYZob{}Arbitrary\PYZhy{}Level Hanging Nodes and Automatic Adaptivity + in the hp\PYZhy{}FEM\PYZcb{}, + journal = \PYZob{}Math. Comput. Simul.\PYZcb{}, + year = \PYZob{}2008\PYZcb{}, + volume = \PYZob{}77\PYZcb{}, + pages = \PYZob{}117 \PYZhy{} 132\PYZcb{} +\PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] +@Article\PYZob{}Hermes\PYZhy{}adaptivity, + author = \PYZob{}P. Solin, D. Andrs, J. Cerveny, M. Simko\PYZcb{}, + title = \PYZob{}PDE\PYZhy{}Independent Adaptive hp\PYZhy{}FEM Based on Hierarchic Extension of + Finite Element Spaces\PYZcb{}, + journal = \PYZob{}J. Comput. Appl. Math.\PYZcb{}, + year = \PYZob{}2010\PYZcb{}, + volume = \PYZob{}233\PYZcb{}, + pages = \PYZob{}3086\PYZhy{}3094\PYZcb{} +\PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] +@Article\PYZob{}Hermes\PYZhy{}shape\PYZhy{}functions, + author = \PYZob{}P. Solin, T. Vejchodsky\PYZcb{}, + title = \PYZob{}Higher\PYZhy{}Order Finite Elements Based on Generalized Eigenfunctions of + the Laplacian\PYZcb{}, + journal = \PYZob{}Int. J. Numer. Methods Engrg\PYZcb{}, + year = \PYZob{}2007\PYZcb{}, + volume = \PYZob{}73\PYZcb{}, + pages = \PYZob{}1374 \PYZhy{} 1394\PYZcb{} +\PYZcb{} +\end{Verbatim} + +\textbf{Selected applications}: +\begin{Verbatim}[commandchars=\\\{\}] + @Article\PYZob{}Hermes\PYZhy{}polymer\PYZhy{}metal\PYZhy{}composites, + author = \PYZob{}D. Pugal, P. Solin, K.J. Kim, A. Aabloo\PYZcb{}, + title = \PYZob{}Modeling Ionic Polymer\PYZhy{}Metal Composites with Space\PYZhy{}Time + Adaptive Multimesh hp\PYZhy{}FEM\PYZcb{}, + journal = \PYZob{}Communications in Computational Physics\PYZcb{}, + year = \PYZob{}2011\PYZcb{}, + status = \PYZob{}accepted\PYZcb{}, + volume = \PYZob{}\PYZcb{}, + pages = \PYZob{}\PYZcb{} + \PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] + @Article\PYZob{}Hermes\PYZhy{}anisotropic\PYZhy{}benchmarks, + author = \PYZob{}P. Solin, O. Certik, L. Korous\PYZcb{}, + title = \PYZob{}Three Anisotropic Benchmarks for Adaptive Finite Element Methods\PYZcb{}, + journal = \PYZob{}Appl. Math. Comput.\PYZcb{}, + year = \PYZob{}2011\PYZcb{}, + status = \PYZob{}accepted\PYZcb{}, + volume = \PYZob{}\PYZcb{}, + pages = \PYZob{}\PYZcb{} + \PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] + @Article\PYZob{}Hermes\PYZhy{}richards, + author = \PYZob{}P. Solin, M. Kuraz\PYZcb{}, + title = \PYZob{}Solving the Nonstationary Richards Equation with Adaptive hp\PYZhy{}FEM\PYZcb{}, + journal = \PYZob{}Advanced Water Resources\PYZcb{}, + year = \PYZob{}2011\PYZcb{}, + volume = \PYZob{}34\PYZcb{}, + pages = \PYZob{}1062\PYZhy{}1081\PYZcb{} + \PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] + @Article\PYZob{}Hermes\PYZhy{}nuclear, + author = \PYZob{}L. Dubcova, P. Solin, G. Hansen, H. Park\PYZcb{}, + title = \PYZob{}Comparison of Multimesh hp\PYZhy{}FEM to Interpolation and Projection Methods + for Spatial Coupling of Reactor Thermal and Neutron Diffusion Calculations\PYZcb{}, + journal = \PYZob{}J. Comput. Physics\PYZcb{}, + year = \PYZob{}2011\PYZcb{}, + volume = \PYZob{}230\PYZcb{}, + pages = \PYZob{}1182\PYZhy{}1197\PYZcb{} + \PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] +@Article\PYZob{}Hermes\PYZhy{}heat\PYZhy{}and\PYZhy{}moisture, + author = \PYZob{}P. Solin, L. Dubcova, J. Kruis, + title = \PYZob{}Adaptive hp\PYZhy{}FEM with Dynamical Meshes for Transient Heat and Moisture + Transfer Problems\PYZcb{}, + journal = \PYZob{}J. Comput. Appl. Math\PYZcb{}, + year = \PYZob{}2010\PYZcb{}, + volume = \PYZob{}233\PYZcb{}, + pages = \PYZob{}3103\PYZhy{}3112\PYZcb{} +\PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] +@Article\PYZob{}Hermes\PYZhy{}thermoelasticity, + author = \PYZob{}P. Solin, J. Cerveny, L. Dubcova, D. Andrs\PYZcb{}, + title = \PYZob{}Monolithic Discretization of Linear Thermoelasticity Problems via + Adaptive Multimesh hp\PYZhy{}FEM\PYZcb{}, + journal = \PYZob{}J. Comput. Appl. Math\PYZcb{}, + status = \PYZob{}published online\PYZcb{}, + doi = \PYZob{}doi 10.1016/j.cam.2009.08.092\PYZcb{}, + year = \PYZob{}2009\PYZcb{} +\PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] +@Article\PYZob{}Hermes\PYZhy{}electromagnetics, + author = \PYZob{}L. Dubcova, P. Solin, J. Cerveny, P. Kus\PYZcb{}, + title = \PYZob{}Space and Time Adaptive Two\PYZhy{}Mesh hp\PYZhy{}FEM for Transient Microwave Heating + Problems\PYZcb{}, + journal = \PYZob{}Electromagnetics\PYZcb{}, + year = \PYZob{}2010\PYZcb{}, + volume = \PYZob{}30\PYZcb{}, + pages = \PYZob{}23 \PYZhy{} 40\PYZcb{} +\PYZcb{} +\end{Verbatim} +\begin{Verbatim}[commandchars=\\\{\}] +@Article\PYZob{}Hermes\PYZhy{}fluid\PYZhy{}mechanics, + author = \PYZob{}P. Solin, J. Cerveny, L. Dubcova, I. Dolezel\PYZcb{}, + title = \PYZob{}Multi\PYZhy{}Mesh hp\PYZhy{}FEM for Thermally Conductive Incompressible Flow\PYZcb{}, + journal = \PYZob{}Proceedings of ECCOMAS Conference COUPLED PROBLEMS 2007 (M. Papadrakakis, + E. Onate, B. Schrefler Eds.), CIMNE, Barcelona\PYZcb{}, + year = \PYZob{}2007\PYZcb{}, + pages = \PYZob{}677 \PYZhy{} 680\PYZcb{} +\PYZcb{} +\end{Verbatim} + +Other papers that may be still closer to what you need can be found in the \href{http://www.hpfem.org/citing/}{citing section} of the hp-FEM group home page. + + +\chapter{Installation} +\label{src/installation:installation}\label{src/installation::doc} + +\section{Linux} +\label{src/installation/linux::doc}\label{src/installation/linux:linux} + +\subsection{Download and compilation} +\label{src/installation/linux:download-and-compilation}\begin{figure}[htbp] +\centering + +\scalebox{1.000000}{\includegraphics{redRow.jpg}} +\end{figure} + +\begin{notice}{note}{{[}NEW{]} - debian packages on Launchpad} + +You can download a package directly from \href{https://launchpad.net/~lukas-korous/+archive/ubuntu/hermes}{https://launchpad.net/\textasciitilde{}lukas-korous/+archive/ubuntu/hermes}. +\end{notice} +\begin{figure}[htbp] +\centering + +\scalebox{1.000000}{\includegraphics{redRow.jpg}} +\end{figure} + +The rest of the instructions here are for building Hermes from source. + +If you are using a Debian-based system, install the (required) libraries first: + +If you want to use fast saving / loading of Hermes entities, install +\begin{itemize} +\item {} +BSON +\begin{itemize} +\item {} +Clone the BSON Mongo driver git repository from \href{mailto:git@github.com}{git@github.com}:l-korous/mongo-c-driver.git (if you don't know how, here is a tip: \href{http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository}{Getting a Git Repository}) + +\item {} +Compile and install using `make install' + +\end{itemize} + +\end{itemize} + +For thread caching memory allocator from Google, see +\begin{itemize} +\item {} +TCMalloc +\begin{itemize} +\item {} +Get TCMalloc from the SVN repository at \href{http://code.google.com/p/gperftools/source/checkout}{http://code.google.com/p/gperftools/source/checkout}. + +\item {} +Make \& install + +\end{itemize} + +\end{itemize} + +To obtain the source code, clone the Git repository from Github: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{clone} \PYG{n}{git}\PYG{o}{:}\PYG{c+c1}{//github.com/hpfem/hermes.git} +\end{Verbatim} + +These two repositories are synchronized. For more advanced users we recommend to +create a free account at \href{http://github.com}{Github} (if you do not have one yet), +fork the \href{http://github.com/hpfem/hermes}{Hermes repository}, and then clone your +Github copy of Hermes to your local computer. This will establish links between +your local copy and the master repository, and you'll become part of the Hermes +network at Github. + +Once you have a local copy of the Hermes repository on your computer, change dir +to hermes/. There you will find a CMake.vars.example.Linux file that looks like this: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYGZsh{} LINUX + \PYGZsh{} On linux, there should be no need to set up *\PYGZus{}ROOT directories, in the default settings, they all point to /usr/local, as should be true on Debian systems. + \PYGZsh{} We mainly support gcc and CLang compilers with C++11 support. + + \PYGZsh{} BASIC CONFIGURATION + + \PYGZsh{} Global +\PYGZsh{} Generate static libs (instead of dynamic) + set(HERMES\PYGZus{}STATIC\PYGZus{}LIBS NO) + \PYGZsh{} Target path + set(CMAKE\PYGZus{}INSTALL\PYGZus{}PREFIX \PYGZdq{}/usr/local\PYGZdq{}) + + \PYGZsh{} Paths for compulsory dependencies + set(XERCES\PYGZus{}ROOT \PYGZdq{}/usr/local\PYGZdq{}) + set(XSD\PYGZus{}ROOT \PYGZdq{}/usr/local\PYGZdq{}) + + \PYGZsh{} HermesCommon + + \PYGZsh{} Release and debug versions + set(HERMES\PYGZus{}COMMON\PYGZus{}DEBUG YES) + set(HERMES\PYGZus{}COMMON\PYGZus{}RELEASE YES) + ... +\end{Verbatim} + +Copy this file to ``CMake.vars'' and set the variables according to your needs. +After that, type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{cmake} \PYG{p}{.} +\PYG{n}{make} +\end{Verbatim} + +If you have more than one CPU, you can use ``make -jN'' where N is +the number of CPUs of your computer. + + +\subsection{Debugging with Eclipse} +\label{src/installation/linux:debugging-with-eclipse} +To use eclipse as debugger, in the root folder of the project: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{mkdir} \PYG{n}{eclipse\PYGZus{}build} +\PYG{n}{cd} \PYG{n}{eclipse\PYGZus{}build} +\PYG{n}{cmake} \PYG{o}{\PYGZhy{}}\PYG{n}{G}\PYG{l+s}{\PYGZdq{}}\PYG{l+s}{Eclipse CDT4 \PYGZhy{} Unix Makefiles}\PYG{l+s}{\PYGZdq{}} \PYG{o}{\PYGZhy{}}\PYG{n}{D} \PYG{n}{CMAKE\PYGZus{}BUILD\PYGZus{}TYPE}\PYG{o}{=}\PYG{n}{Debug} \PYG{p}{.}\PYG{p}{.}\PYG{o}{/} +\end{Verbatim} + +In Eclipse: +\begin{itemize} +\item {} +Import project using Menu File-\textgreater{}Import + +\item {} +Select General-\textgreater{}Existing projects into workspace: + +\item {} +Browse where your build tree is and select the root build tree directory. + +\item {} +Keep ``Copy projects into workspace'' unchecked. + +\end{itemize} + + +\subsection{Install Hermes} +\label{src/installation/linux:install-hermes} +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{make} \PYG{n}{install} +\end{Verbatim} + + +\section{Windows} +\label{src/installation/win:windows}\label{src/installation/win::doc} + +\subsection{Download and compilation} +\label{src/installation/win:download-and-compilation}\begin{figure}[htbp] +\centering + +\scalebox{1.000000}{\includegraphics{redRow.jpg}} +\end{figure} + +\begin{notice}{note}{{[}NEW{]} - prebuilt binaries} + +You can download both the dependency libraries and header files, as well as Hermes libraries and header files from \href{https://github.com/l-korous/hermes-windows}{https://github.com/l-korous/hermes-windows}. +\end{notice} +\begin{figure}[htbp] +\centering + +\scalebox{1.000000}{\includegraphics{redRow.jpg}} +\end{figure} + +The rest of the instructions here are for building Hermes from source. + +To obtain the source code, clone the Git repository from Github: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{clone} \PYG{n}{git}\PYG{o}{:}\PYG{c+c1}{//github.com/hpfem/hermes.git} +\end{Verbatim} + +{[}IMPORTANT{]} As Hermes uses features of C++11 (such as initializer lists, nullptr\_t, etc.), the only Visual Studio family compiler you can use is Visual Studio 2013 (both Express and `Full' versions). + + +\subsection{Dependency check-list - overview} +\label{src/installation/win:dependency-check-list-overview}\begin{itemize} +\item {} +You need to install dependent libraries into either common directory, or separate directories. This directory, further called `dependencies' (stands for the particular directory in the case of particular dependency), has to have three subdirectories as follows. The choice of having a single common directory, or separate ones is up to you. +\begin{itemize} +\item {} +`dependencies'\textbackslash{}include: Header files (*.h) of dependency libraries. + +\item {} +`dependencies'\textbackslash{}lib: Library files (*.lib) of dependency libraries. + +\item {} +`dependencies'\textbackslash{}bin: Binary modules (*.dll) of dependency libraries. + +\item {} +be sure to include a directory `dependecies'\textbackslash{}bin into the `PATH' environment variable (you need to include all of them if you chose to have separate ones for various dependencies). + +\end{itemize} + +\item {} +For the 64-bit version, if you want to use it side-by-side to the 32-bit one, you can create a subdirectory `x64' in the `lib' folder where you will be putting the 64-bit dependency libraries. + +\end{itemize} + + +\subsection{Dependency check-list - 32-bit} +\label{src/installation/win:dependency-check-list-32-bit} +This list works for 32-bit version of Hermes. See the section for 64-bit version if that is the one you are interested in. +Please note that e.g. TCMalloc, BSON, UMFPACK are also `optional', but to get the most performance out of Hermes, they are recommended. +\begin{itemize} +\item {} +CMAKE +\begin{itemize} +\item {} +Download CMAKE installer(\href{http://www.cmake.org/files/v2.8/cmake-2.8.3-win32-x86.exe}{http://www.cmake.org/files/v2.8/cmake-2.8.3-win32-x86.exe}) and install it. + +\end{itemize} + +\item {} +UMFPACK +\begin{itemize} +\item {} +MinGW used for compiling AMD and UMFPACK: \href{http://sourceforge.net/projects/mingw/}{Download MinGW}. + +\item {} +after installing MinGW, add `your-minGW-installation-directory'/bin to system PATH. + +\item {} +download latest \href{http://www.cise.ufl.edu/research/sparse/SuiteSparse\_config/}{SuiteSparse\_config}, \href{http://www.cise.ufl.edu/research/sparse/amd/}{AMD}, and \href{http://www.cise.ufl.edu/research/sparse/umfpack/}{UMFPACK} to A SINGLE PARENT DIRECTORY (this requirement is one of UMFPACK). + +\item {} +Add the following lines at the end of file SuiteSparse\_config\textbackslash{}SuiteSparse\_config.mk: +\begin{itemize} +\item {} +CC = gcc + +\item {} +CXX = gcc + +\item {} +UMFPACK\_CONFIG = -DNBLAS + +\item {} +RANLIB = echo + +\item {} +LIB = -lm + +\end{itemize} + +\item {} +Open all files called `Makefile' from all three directories and replace all `;' symbols in them with the Windows equivalent `\&' + +\item {} +Copy SuiteSparse\_config\textbackslash{}SuiteSparse\_config.h to `include' directory + +\item {} +Copy SuiteSparse\_config\textbackslash{}libsuitesparseconfig.a to `lib' directory and change its extension to Windows equivalent `.lib'. + +\item {} +Copy AMD\textbackslash{}Include\textbackslash{}amd.h, AMD\textbackslash{}Include\textbackslash{}amd\_internal.h, and AMD\textbackslash{}Lib\textbackslash{}libamd.a to `include', and `lib' dependecy directories respectively. Change the libamd.a's extension to `.lib' + +\item {} +Copy UMFPACK\textbackslash{}Include\textbackslash{}* to `include' + +\item {} +Copy UMFPACK\textbackslash{}Lib\textbackslash{}libumfpack.a to `lib' directory and change its extension to Windows equivalent `.lib'. + +\end{itemize} + +\item {} +XERCES +\begin{itemize} +\item {} +Download Xerces 3.1.1 source code from \href{http://xerces.apache.org/xerces-c/download.cgi}{http://xerces.apache.org/xerces-c/download.cgi}. + +\item {} +Build using your favorite compiler. + +\item {} +Copy all bin files to `bin' dependencies directory + +\item {} +Copy all header files to `include' dependencies directory + +\item {} +Copy the lib files to `lib' dependencies directory + +\end{itemize} + +\item {} +XSD +- Download XSD library from \href{http://www.codesynthesis.com/download/xsd/3.3/windows/i686/xsd-3.3.0-i686-windows.zip}{http://www.codesynthesis.com/download/xsd/3.3/windows/i686/xsd-3.3.0-i686-windows.zip}, instructions how to build the library are available at \href{http://wiki.codesynthesis.com/Using\_XSD\_with\_Microsoft\_Visual\_Studio}{http://wiki.codesynthesis.com/Using\_XSD\_with\_Microsoft\_Visual\_Studio}. +- Copy all bin files to `bin' dependencies directory +- Copy all header files to `include' dependencies directory + +\item {} +OpenGL support (optional) +\begin{itemize} +\item {} +FREEGLUT +\begin{itemize} +\item {} +Download freeglut 2.4.0 (\href{http://freeglut.sourceforge.net/}{http://freeglut.sourceforge.net/}) and unpack it. + +\item {} +Open the your\_freeglut\_2.4.0\_root\textbackslash{}freeglut.DSP file in Visual Studio and convert it to a newer format. + +\item {} +Compile Debug or Release version. Debug version is recommended in a case of debugging. + +\item {} +Copy `freeglut.dll', `freeglut.h', and `freeglut.lib' to `bin', `include\textbackslash{}GL', and `lib' dependency directories, respectively/. + +\end{itemize} + +\item {} +GLEW +\begin{itemize} +\item {} +Download glew Win32 precompiled binaries ver.1.5.4 (\href{http://glew.sourceforge.net/}{http://glew.sourceforge.net/}) and unpack it. + +\item {} +Copy `my\_glew\_root\textbackslash{}bin\textbackslash{}glew32.dll', `my\_glew\_root\textbackslash{}include\textbackslash{}GL\textbackslash{}*.h', and `my\_glew\_root\textbackslash{}lib\textbackslash{}glew32.lib' to `bin', `include\textbackslash{}GL', and `lib' dependency directories respectively. + +\end{itemize} + +\item {} +PTHREAD(2.9.1) + +\item {} +Download appropriate files (\href{ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release/}{ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release/}). + +\item {} +Copy `dll\textbackslash{}x86\textbackslash{}pthreadVCE2.dll', `include\textbackslash{}*.h' and `lib\textbackslash{}x86\textbackslash{}pthreadVCE2.lib' to `bin', `include', and `lib' dependecy directories respectively. + +\end{itemize} + +\item {} +The rest is optional. If a directive WITH\_BSON is \emph{not} used, this step including all sub-steps can be skipped and you can proceed to ``\textbf{Building Hermes}''. +\begin{itemize} +\item {} +MATIO (1.5.2) +\begin{itemize} +\item {} +Download HDF5 \href{http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8.7/obtain5187.html}{http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8.7/obtain5187.html}. + +\item {} +Install HDF5, note the path (you will need it for MATIO) + +\item {} +Download MATIO from \href{http://sourceforge.net/projects/matio/}{http://sourceforge.net/projects/matio/}. + +\item {} +Open the sln file in the folder visual\_studio + +\item {} +Add to the Include Directories under the libmatio project settings the directory where you installed HDF5's headers + +\item {} +Add to the Libraries Directories under the libmatio project settings the directory where you installed HDF5's libs + +\item {} +Add to the linker linking to ``libszip.lib'' + +\item {} +(Fix MATIO error) Open the file zconf.h and on the line 287 change \#if 1 to \#if 0. + +\item {} +build, copy visual\_studio/\emph{.h and src/}.h to `include' folder, visual\_studio/Release/libmatio.lib to `lib', visual\_studio/Release/libmatio.dll to `bin' folders. + +\end{itemize} + +\item {} +BSON +\begin{itemize} +\item {} +Clone the BSON Mongo driver git repository from \href{mailto:git@github.com}{git@github.com}:l-korous/mongo-c-driver.git (if you don't know how, here is a tip:\href{http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository}{Getting a Git Repository}) + +\item {} +Download SCONS build tool from \href{http://sourceforge.net/projects/scons/files/latest/download?source=files}{http://sourceforge.net/projects/scons/files/latest/download?source=files}. + +\item {} +Install SCONS (you need to have PYTHON installed for that), run it (e.g. issuing C:Python27Scriptsscons.bat) in the BSON Mongo driver root directory +\begin{itemize} +\item {} +Use flags --m32 and --c99 (``C:Python27Scriptsscons.bat --c99 --m32'') + +\end{itemize} + +\item {} +Once compiled (should take seconds at most), copy src/bson.h to your `include' dependency directory, bson.lib to `lib', and bson.dll to `bin' directories. + +\end{itemize} + +\item {} +TCMalloc +\begin{itemize} +\item {} +Get TCMalloc from the SVN repository at \href{http://code.google.com/p/gperftools/source/checkout}{http://code.google.com/p/gperftools/source/checkout}. + +\item {} +Open gperftools.sln in your Visual Studio, build the appropriate version (default works fine - just select Debug/Release) + +\item {} +Copy Win32''Release/Debug''libtcmalloc\_minimal.dll to `bin' dependency directory, Win32''Release/Debug''libtcmalloc\_minimal.lib to `lib' dependency directory + +\item {} +Copy the contents of src/google to `include' dependency directory + +\end{itemize} + +\item {} +ExodusII +\begin{itemize} +\item {} +Download sources of version 4.9.3 (\href{http://sourceforge.net/projects/exodusii/}{http://sourceforge.net/projects/exodusii/}) and unpack `exodusii' + +\item {} +Add the following line to the file `my\_exodusii\_root\textbackslash{}CMakeLists.txt' as: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{PROJECT}\PYG{p}{(}\PYG{n}{Exodusii}\PYG{p}{)} +\PYG{n}{SET}\PYG{p}{(}\PYG{n}{NETCDF\PYGZus{}INCLUDE\PYGZus{}DIR} \PYG{l+s}{\PYGZdq{}}\PYG{l+s}{my\PYGZus{}netcdf\PYGZus{}root/libsrc4}\PYG{l+s}{\PYGZdq{}}\PYG{p}{)} +\PYG{c+cp}{\PYGZsh{}}\PYG{c+cp}{ add this line;} +\end{Verbatim} + +be sure to use a slash `/' instead of a backslash `\textbackslash{}'. + +\item {} +Generate MSVC project files using CMAKE in command prompt as: + +\begin{Verbatim}[commandchars=\\\{\}] +cmake . \PYGZhy{}G \PYGZdq{}Visual Studio 9 2008\PYGZdq{} \PYGZsh{} MSVC2008 user +cmake . \PYGZhy{}G \PYGZdq{}Visual Studio 10\PYGZdq{} \PYGZsh{} MSVC2010 user +\end{Verbatim} + +If you have Cygwin installed, make sure that you are using the windows version of cmake. + +\item {} +Open a SLN file `my\_exodusii\_root/ExodusII.sln' in MSVC08/10 + +\item {} +Switch to `Release' version + +\item {} +Build a project `exoIIv2c': this will create a LIB file in `my\_exodusii\_root\textbackslash{}cbind\textbackslash{}Release' + +\item {} +Copy `exoIIv2c.lib' to `lib' dependency directory structure + +\item {} +Copy `my\_exodusii\_root\textbackslash{}cbind\textbackslash{}include\textbackslash{}exodusII.h and exodusII\_ext.h' to `include' dependency directory + +\end{itemize} + +\item {} +CLAPACK +\begin{itemize} +\item {} +First, you need to install CLAPACK/CBLAS: + +\item {} +Download the file clapack-3.2.1-CMAKE.tgz from \href{http://www.netlib.org/clapack/}{http://www.netlib.org/clapack/}. + +\item {} +Use cmake to configure and build the debug version of clapack. + +\item {} +Copy `\textbackslash{}clapack-3.2.1-CMAKE\textbackslash{}BLAS\textbackslash{}SRC\textbackslash{}Debug\textbackslash{}blas.lib', `\textbackslash{}clapack-3.2.1-CMAKE\textbackslash{}F2CLIBS\textbackslash{}libf2c\textbackslash{}Debug\textbackslash{}libf2c.lib', and `\textbackslash{}clapack-3.2.1-CMAKE\textbackslash{}SRC\textbackslash{}Debug\textbackslash{}lapack.lib' to `lib' dependency directory. + +\item {} +Copy the contains of `\textbackslash{}clapack-3.2.1-CMAKE\textbackslash{}INCLUDE\textbackslash{}' to `include' dependency directory. + +\end{itemize} + +\end{itemize} + +\end{itemize} + + +\subsection{Dependency check-list - 64-bit} +\label{src/installation/win:dependency-check-list-64-bit}\begin{quote} + +Only the most important dependencies are described here for the 64-bit version. For all others, all you must do is compile the 64-bit version, or get it in any other way and link it to Hermes instead of the 32-bit one. +\begin{itemize} +\item {} +CMAKE +\begin{itemize} +\item {} +Download CMAKE installer(\href{http://www.cmake.org/files/v2.8/cmake-2.8.3-win32-x86.exe}{http://www.cmake.org/files/v2.8/cmake-2.8.3-win32-x86.exe}) and install it. + +\end{itemize} + +\item {} +PTHREAD(2.9.1) +\begin{itemize} +\item {} +Download appropriate files (\href{ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release/}{ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release/}). + +\item {} +Copy `dll\textbackslash{}x64\textbackslash{}pthreadVCE2.dll', `include\textbackslash{}*.h' and `lib\textbackslash{}x64\textbackslash{}pthreadVCE2.lib' to `bin', `include', and `lib' dependecy directories respectively. + +\end{itemize} + +\item {} +UMFPACK +\begin{itemize} +\item {} +MinGW used for compiling AMD and UMFPACK: \href{http://sourceforge.net/projects/mingw/}{Download MinGW}. + +\item {} +Just use 64-bit MinGW and provide the flag ``-m64'', otherwise it is the same as in Win32 version. + +\end{itemize} + +\item {} +XERCES +\begin{itemize} +\item {} +Download Xerces 3.1.1 source code from \href{http://xerces.apache.org/xerces-c/download.cgi}{http://xerces.apache.org/xerces-c/download.cgi}. + +\item {} +Build using your favorite compiler for 64-bit. + +\item {} +Copy all bin files to `bin' dependencies directory + +\item {} +Copy all header files to `include' dependencies directory + +\item {} +Copy the lib files to `lib' dependencies directory + +\end{itemize} + +\item {} +XSD +- Download XSD library from \href{http://www.codesynthesis.com/download/xsd/3.3/windows/i686/xsd-3.3.0-i686-windows.zip}{http://www.codesynthesis.com/download/xsd/3.3/windows/i686/xsd-3.3.0-i686-windows.zip}, instructions how to build the library are available at \href{http://wiki.codesynthesis.com/Using\_XSD\_with\_Microsoft\_Visual\_Studio}{http://wiki.codesynthesis.com/Using\_XSD\_with\_Microsoft\_Visual\_Studio}. +- Build the x64 version +- Copy all bin files to `bin' dependencies directory +- Copy all header files to `include' dependencies directory + +\item {} +OpenGL support (optional) +\begin{itemize} +\item {} +FREEGLUT +\begin{itemize} +\item {} +Download freeglut 2.4.0 (\href{http://freeglut.sourceforge.net/}{http://freeglut.sourceforge.net/}) and unpack it. + +\item {} +Open the your\_freeglut\_2.4.0\_root\textbackslash{}freeglut.DSP file in Visual Studio and convert it to a newer format. + +\item {} +Compile Debug or Release version (x64 platform). Debug version is recommended in a case of debugging. + +\item {} +Copy `freeglut.dll', `freeglut.h', and `freeglut.lib' to `bin', `include\textbackslash{}GL', and `lib' dependency directories, respectively/. + +\end{itemize} + +\item {} +GLEW +\begin{itemize} +\item {} +Download glew x64 precompiled binaries (\href{http://glew.sourceforge.net/}{http://glew.sourceforge.net/}) and unpack it. + +\item {} +Copy `my\_glew\_root\textbackslash{}bin\textbackslash{}glew32.dll', `my\_glew\_root\textbackslash{}include\textbackslash{}GL\textbackslash{}*.h', and `my\_glew\_root\textbackslash{}lib\textbackslash{}glew32.lib' to `bin', `include\textbackslash{}GL', and `lib' dependency directories respectively. + +\end{itemize} + +\end{itemize} + +\item {} +The rest is optional. If a directive WITH\_BSON is \emph{not} used, this step including all sub-steps can be skipped and you can proceed to ``\textbf{Building Hermes}''. +\begin{itemize} +\item {} +MATIO (1.5.2) +\begin{itemize} +\item {} +Just follow the 32-bit version instructions and download HDF5 for x64, and also when building MATIO, build the x64 version. + +\end{itemize} + +\item {} +TCMalloc +\begin{itemize} +\item {} +Get TCMalloc from the SVN repository at \href{http://code.google.com/p/gperftools/source/checkout}{http://code.google.com/p/gperftools/source/checkout}. + +\item {} +Open gperftools.sln in your Visual Studio, build the appropriate version (default works fine - just select Debug/Release) + +\item {} +Copy x64''Release/Debug''libtcmalloc\_minimal.dll to `bin' dependency directory, x64''Release/Debug''libtcmalloc\_minimal.lib to `lib' dependency directory + +\item {} +Copy the contents of src/google to `include' dependency directory + +\end{itemize} + +\item {} +BSON +\begin{itemize} +\item {} +Clone the BSON Mongo driver git repository from \href{mailto:git@github.com}{git@github.com}:l-korous/mongo-c-driver.git (if you don't know how, here is a tip:\href{http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository}{Getting a Git Repository}) + +\item {} +Download SCONS build tool from \href{http://sourceforge.net/projects/scons/files/latest/download?source=files}{http://sourceforge.net/projects/scons/files/latest/download?source=files}. + +\item {} +Install SCONS (you need to have PYTHON installed for that), run it (e.g. issuing C:Python27Scriptsscons.bat) in the BSON Mongo driver root directory +\begin{itemize} +\item {} +Use the flag --c99 (``C:Python27Scriptsscons.bat --c99'') + +\end{itemize} + +\item {} +Once compiled (should take seconds at most), copy src/bson.h to your `include' dependency directory, bson.lib to `lib', and bson.dll to `bin' directories. + +\end{itemize} + +\end{itemize} + +\end{itemize} +\end{quote} + + +\subsection{Building Hermes} +\label{src/installation/win:building-hermes}\begin{quote} + +In order to build the library and examples, you need to: +\begin{itemize} +\item {} +Prepare dependecy libraries, see `Dependency Check-list'. + +\item {} +Copy the file `CMake.vars.example.Windows' to `CMake.vars'. The file contains settings for the project. + +\item {} +In the root Hermes directory, generate project files by running CMAKE from a command prompt: + +\begin{Verbatim}[commandchars=\\\{\}] +cmake . \PYGZhy{}G \PYGZdq{}Visual Studio 12\PYGZdq{} \PYGZsh{} MSVC2013 as the generator +\end{Verbatim} + +If you have Cygwin installed, your might have an error ``Could not create named generator Visual Studio 12''. This is because your +cmake path is contaminated by Cygwin's cmake. Try to use absolute path for windows cmake.exe. + +\item {} +Open the SLN file `hermes.sln' and build Hermes. + +\end{itemize} +\end{quote} + + +\subsection{Using Hermes} +\label{src/installation/win:using-hermes} +In order to use Hermes in your project, you need to do the following steps. Steps has 5, 6, and 7 to be repeated for every configuration, i.e., Debug, Release. Except the step 7b, this can be done easily by setting the drop-down Configuration to `All configurations' in the Project Property dialog. +\begin{itemize} +\item {} +Prepare Hermes to be buildable by MSVC, see `Building Hermes'. + +\item {} +Create your project in MSVC. Set the project to be an empty Win32 console project. + +\item {} +Add directories `dependencies\textbackslash{}lib' to additional library directories (\textless{}right click on your project\textgreater{}\textbackslash{}Properties\textbackslash{}Configuration Properties\textbackslash{}Linker\textbackslash{}Additional Library Directories). + +\item {} +Add also the directory where you copied Hermes libraries to as an additional library directory. This would probably be the variable CMAKE\_INSTALL\_PREFIX in your CMake.vars file. + +\item {} +Add `include ``hermes2d.h''', make sure that your CMAKE\_INSTALL\_PREFIX is among Include Directories settings in your compiler. + +\item {} +Add the dependencies\textbackslash{}include directory (and possibly other directories where you copied dependency headers) using +\begin{itemize} +\item {} +Project -\textgreater{} Properties -\textgreater{} Configuration Properties -\textgreater{} VC++ Directories -\textgreater{} Include Directories + +\end{itemize} + +\item {} +Deny (Ignore) warnings that are not indicating anything dangerous: +\begin{itemize} +\item {} +Ignore warnings about STL in DLL by denying a warning 4251 (\textless{}right click on your project\textgreater{}\textbackslash{}Properties\textbackslash{}Configuration Properties\textbackslash{}C/C++\textbackslash{}Advanced\textbackslash{}Disable Specific Warnings, enter 4251). + +\item {} +Ignore warnings about standard functions that are not safe (\textless{}right click on your project\textgreater{}\textbackslash{}Properties\textbackslash{}Configuration Properties\textbackslash{}C/C++\textbackslash{}Preprocessor\textbackslash{}Preprocessor Definitions, add \_CRT\_SECURE\_NO\_WARNINGS). + +\item {} +Also ignore any template instantiation warnings + +\end{itemize} + +\item {} +Resolve unresolved linker error in Xerces +- \href{http://stackoverflow.com/questions/10506582/xerces-c-unresolved-linker-error}{http://stackoverflow.com/questions/10506582/xerces-c-unresolved-linker-error} + +\end{itemize} + + +\section{Mac OS} +\label{src/installation/mac:mac-os}\label{src/installation/mac::doc} + +\subsection{Download and compilation} +\label{src/installation/mac:download-and-compilation} +\textbf{Known issues}: Hermes has built-in OpenGL visualization based on FreeGlut, but this package +comes with certain installation difficulties. If you encounter Glut-related problems, set +H2D\_WITH\_GLUT to NO in Cmake.vars, build Hermes without Glut, and use VTK output for visualization. + +\textbf{Step 1}: Make sure you have XCode installed. This should be on the installation +disks which came with your Mac. XCode contains the GNU compilers, make +and many other things which are required to build Hermes. + +\textbf{Step 3}: Install the following libraries and applications: Suitesparse, +glew, cmake, git. If you don't already have these on your Mac, then +the easiest way to get them is to use MacPorts (which is an +application which allows you to easily install and manage UNIX +libraries and applications on your Mac) by doing the following: +\begin{enumerate} +\item {} +Download and install MacPorts from +\href{http://www.macports.org/install.php}{http://www.macports.org/install.php}. + +\item {} +Do `sudo port install suitesparse glew'. + +\item {} +If you don't already have git installed, do +`sudo port install git'. + +\item {} +If you don't already have cmake installed, do +`sudo port install cmake'. + +\end{enumerate} + +\textbf{Step 4}: Get the Hermes source code as described at the beginning of the Linux section +above. Change to the directory where you want +to download the Hermes source and clone the git repository either +from the hpfem.org server: + +\begin{Verbatim}[commandchars=\\\{\}] +git clone {}`\PYGZlt{}http://git.hpfem.org/git/hermes.git\PYGZgt{}{}`\PYGZus{}. +\end{Verbatim} + +or from Github: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{clone} \PYG{n}{git}\PYG{o}{:}\PYG{c+c1}{//github.com/hpfem/hermes.git} +\end{Verbatim} + +These two repositories are synchronized. For more advanced users we recommend +to create a free account at Github (if you do not have one yet), fork the +Hermes repository, and then clone your Github copy of Hermes to your local computer. +This will establish links between your local copy and the master repository, and +you’ll become part of the Hermes network at Github. + +\textbf{Step 5}: Configure and build Hermes by changing dir to `hermes/', +and then typing `cmake .' and `make'. +If you have more than one CPU, you can use `make -jN' where N is the +number of CPUs of your computer. To set the location where Hermes +will be installed, pass the -DCMAKE\_INSTALL\_PREFIX=\textless{}your location\textgreater{} +flag to cmake (i.e. to install in /usr/local, replace the cmake +command above with `cmake -DCMAKE\_INSTALL\_PREFIX=/usr/local .'). + +\textbf{Step 6}: Install Hermes by doing `make install'. + + +\subsection{More options} +\label{src/installation/mac:more-options} +You can turn on and off various components to build, just create the CMake.vars +file and add the following: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{set}\PYG{p}{(}\PYG{n}{H2D\PYGZus{}WITH\PYGZus{}GLUT} \PYG{n}{NO}\PYG{p}{)} +\end{Verbatim} + +(and any other option that you would like to change, see CMakeLists.txt for the +whole list). + +For development, it is good to say (in global CMake.vars): + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{set}\PYG{p}{(}\PYG{n}{DEBUG} \PYG{n}{YES}\PYG{p}{)} \PYG{n}{to} \PYG{n}{compile} \PYG{n}{debug} \PYG{n}{versions} +\PYG{n}{set}\PYG{p}{(}\PYG{n}{RELEASE} \PYG{n}{YES}\PYG{p}{)} \PYG{n}{to} \PYG{n}{compile} \PYG{n}{release} \PYG{n}{versions} +\end{Verbatim} + +Then type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{make} \PYG{n}{debug} \PYG{p}{(}\PYG{n}{to} \PYG{n}{build} \PYG{n}{debug} \PYG{n}{versions}\PYG{p}{)} +\PYG{n}{make} \PYG{n}{release} \PYG{p}{(}\PYG{n}{to} \PYG{n}{build} \PYG{n}{release} \PYG{n}{versions}\PYG{p}{)} +\end{Verbatim} + + +\section{Installation of Matrix Solvers} +\label{src/installation/matrix_solvers:installation-of-matrix-solvers}\label{src/installation/matrix_solvers::doc} + +\subsection{Mumps} +\label{src/installation/matrix_solvers/mumps::doc}\label{src/installation/matrix_solvers/mumps:mumps} + +\subsubsection{Linux} +\label{src/installation/matrix_solvers/mumps:linux}\label{src/installation/matrix_solvers/mumps:mumps-home-page} + +\paragraph{Using standard Debian packages} +\label{src/installation/matrix_solvers/mumps:using-standard-debian-packages} +For sequential version, install packages \emph{libmumps-seq-4.9.2} and \emph{libmumps-seq-dev}. +For parallel version, install \emph{libmumps-4.9.2} and \emph{libmumps-dev}. Newer versions +may be available. In Ubuntu 6.06 (Dapper) +or newer, you can use the Synaptic package manager for that, or type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{sudo} \PYG{n}{apt}\PYG{o}{\PYGZhy{}}\PYG{n}{get} \PYG{n}{install} \PYG{n}{libmumps}\PYG{o}{\PYGZhy{}}\PYG{n}{seq}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{4.9}\PYG{l+m+mf}{.2} \PYG{n}{libmumps}\PYG{o}{\PYGZhy{}}\PYG{n}{seq}\PYG{o}{\PYGZhy{}}\PYG{n}{dev} +\end{Verbatim} + +for the sequential version and + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{sudo} \PYG{n}{apt}\PYG{o}{\PYGZhy{}}\PYG{n}{get} \PYG{n}{install} \PYG{n}{libmumps}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{4.9}\PYG{l+m+mf}{.2} \PYG{n}{libmumps}\PYG{o}{\PYGZhy{}}\PYG{n}{dev} +\end{Verbatim} + +for the parallel one. + +Now go to the directory with Hermes. Create the file CMake.vars with the +following line (or append to the existing one): + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{set}\PYG{p}{(}\PYG{n}{WITH\PYGZus{}MUMPS} \PYG{n}{YES}\PYG{p}{)} +\end{Verbatim} + +Finally execute: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{rm} \PYG{n}{CMakeCache}\PYG{p}{.}\PYG{n}{txt} +\PYG{n}{cmake} \PYG{p}{.} +\PYG{n}{make} +\end{Verbatim} + +Find more about {\hyperref[src/installation/matrix_solvers/mumps:ref-usage-mumps]{\emph{Using MUMPS in Hermes}}}. + + +\subsubsection{Windows MSVC} +\label{src/installation/matrix_solvers/mumps:windows-msvc} +Installation of MUMPS using MSVC is rather easy: +\begin{itemize} +\item {} +preparation +\begin{itemize} +\item {} +download MUMPS from \href{http://mumps.enseeiht.fr/MUMPS\_4.10.0.tar.gz}{http://mumps.enseeiht.fr/MUMPS\_4.10.0.tar.gz} (if the link does not work, look for 4.10 version of MUMPS) + +\item {} +download WinMUMPS utility from \href{http://sourceforge.net/projects/winmumps/}{http://sourceforge.net/projects/winmumps/}. + +\item {} +download a Fortran compiler (e.g. \href{http://software.intel.com/en-us/intel-fortran-studio-xe-evaluation-options)}{http://software.intel.com/en-us/intel-fortran-studio-xe-evaluation-options)}. + +\item {} +download BLAS (Debug/Release, static/dynamic, 32-bit/64-bit as you like) from \href{http://icl.cs.utk.edu/lapack-for-windows/lapack/index.html\#libraries}{http://icl.cs.utk.edu/lapack-for-windows/lapack/index.html\#libraries}. + +\item {} +you have to have Visual Studio version \textgreater{}= 2008 + +\item {} +you have to have Python 2.6 or 2.7 available + +\end{itemize} + +\item {} +installation +\begin{itemize} +\item {} +copy the downloaded BLAS library to `bin' and `lib' dependencies directory respectively. Please not that the name of the static library (static part of the dynamic library) should be either blas.lib, or libblas.lib + +\item {} +unzip MUMPS and WinMUMPS + +\item {} +execute ``python winmumps\_generator.py'' from WinMUMPS providing the options needed (type -h for help) + +\item {} +this will generate several C++ project files (.vcxproj) and several Fortran project files (.vfproj) + +\item {} +open one of them and add the rest to the solution + +\item {} +build the solution in your desired configuration (Win32 or x64, Debug or Release) + +\item {} +this will place the libraries into MUMPS\_4.10.0libDebugWin32(or alternatively for other configurations) + +\item {} +copy those to `lib' dependencies directory + +\item {} +copy the contents of MUMPS\_4.10.0includeto `include' dependencies directory + +\end{itemize} + +\end{itemize} + + +\subsubsection{Mac OS} +\label{src/installation/matrix_solvers/mumps:mac-os} +Help needed! + + +\subsubsection{Using MUMPS in Hermes} +\label{src/installation/matrix_solvers/mumps:ref-usage-mumps}\label{src/installation/matrix_solvers/mumps:using-mumps-in-hermes} +After the installation has been completed, you may select \code{SOLVER\_MUMPS} as the matrix solver for your finite element problem, as detailed +in the \emph{Poisson tutorial} (in tutorial found on Hermes website), or use it just to solve a standalone matrix problem \emph{Ax = b}. + + +\subsection{PETSc} +\label{src/installation/matrix_solvers/petsc:petsc}\label{src/installation/matrix_solvers/petsc::doc} + +\subsubsection{Linux} +\label{src/installation/matrix_solvers/petsc:petsc-home-page}\label{src/installation/matrix_solvers/petsc:linux} + +\paragraph{Using standard Debian packages} +\label{src/installation/matrix_solvers/petsc:using-standard-debian-packages} +Install packages \emph{libpetsc3.1} and \emph{libpetsc3.1-dev}. +Newer version may be available. In Ubuntu 6.06 (Dapper) +or newer, you can use the Synaptic package manager for that, or type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{sudo} \PYG{n}{apt}\PYG{o}{\PYGZhy{}}\PYG{n}{get} \PYG{n}{install} \PYG{n}{libpetsc3}\PYG{l+m+mf}{.1} \PYG{n}{libpetsc3}\PYG{l+m+mf}{.1}\PYG{o}{\PYGZhy{}}\PYG{n}{dev} +\end{Verbatim} + +Now go to the directory with Hermes. Create the file CMake.vars with the +following line (or append to the existing one): + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{set}\PYG{p}{(}\PYG{n}{WITH\PYGZus{}PETSC} \PYG{n}{YES}\PYG{p}{)} +\end{Verbatim} + +Finally execute: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{rm} \PYG{n}{CMakeCache}\PYG{p}{.}\PYG{n}{txt} +\PYG{n}{cmake} \PYG{p}{.} +\PYG{n}{make} +\end{Verbatim} + +Find more about {\hyperref[src/installation/matrix_solvers/petsc:ref-usage-petsc]{\emph{Using PETSC in Hermes}}}. + + +\subsubsection{Windows MSVC} +\label{src/installation/matrix_solvers/petsc:windows-msvc} +\href{http://www.mcs.anl.gov/petsc/petsc-as/documentation/installation.html\#Windows}{http://www.mcs.anl.gov/petsc/petsc-as/documentation/installation.html\#Windows} + + +\subsubsection{Mac OS} +\label{src/installation/matrix_solvers/petsc:mac-os} +\href{http://petsc.darwinports.com/}{http://petsc.darwinports.com/} + + +\subsubsection{Using PETSC in Hermes} +\label{src/installation/matrix_solvers/petsc:using-petsc-in-hermes}\label{src/installation/matrix_solvers/petsc:ref-usage-petsc} +You may now select \code{SOLVER\_PETSC} as the matrix solver for your finite element problem, as detailed +in the \href{http://hpfem.org/hermes/doc/src/hermes2d/P01-linear/03-poisson.html}{Poisson tutorial}, or use +it just to solve a standalone matrix problem \(Ax = b\) as in the +\href{http://hpfem.org/hermes/doc/src/hermes2d/P08-miscellaneous/35-matrix-solvers.html}{Using Matrix Solvers tutorial}. + + +\subsection{SuperLU} +\label{src/installation/matrix_solvers/superlu::doc}\label{src/installation/matrix_solvers/superlu:superlu} +Hermes currently supports two versions of the SuperLU library - the sequential +one and the multithreaded one. Support for the MPI version will be added in the +future. Please visit \href{http://crd.lbl.gov/~xiaoye/SuperLU/}{http://crd.lbl.gov/\textasciitilde{}xiaoye/SuperLU/} for more information about the +library. + + +\subsubsection{Linux} +\label{src/installation/matrix_solvers/superlu:linux} + +\paragraph{Using standard Debian packages} +\label{src/installation/matrix_solvers/superlu:using-standard-debian-packages} +Install the \emph{libsuperlu3} and \emph{libsuperlu3-dev} packages. In Ubuntu 6.06 (Dapper) +or newer, you can use the Synaptic package manager for that, or type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{sudo} \PYG{n}{apt}\PYG{o}{\PYGZhy{}}\PYG{n}{get} \PYG{n}{install} \PYG{n}{libsuperlu3} \PYG{n}{libsuperlu3}\PYG{o}{\PYGZhy{}}\PYG{n}{dev} +\end{Verbatim} + +Now go to the directory with Hermes. Create the file CMake.vars with the +following lines (or append to the existing one): + +\begin{Verbatim}[commandchars=\\\{\}] +set(WITH\PYGZus{}SUPERLU YES) +set(SUPERLU\PYGZus{}ROOT \PYGZti{}/solvers/superlu\PYGZus{}mt) \PYGZsh{}(or your own installation destination) +set(SUPERLU\PYGZus{}MT NO) +\end{Verbatim} + +Finally execute: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{rm} \PYG{n}{CMakeCache}\PYG{p}{.}\PYG{n}{txt} +\PYG{n}{cmake} \PYG{p}{.} +\PYG{n}{make} +\end{Verbatim} + +Find more about {\hyperref[src/installation/matrix_solvers/superlu:ref-usage-superlu]{\emph{Using SUPERLU in Hermes}}}. + + +\subsubsection{Windows MSVC} +\label{src/installation/matrix_solvers/superlu:windows-msvc} +\href{http://crd.lbl.gov/~xiaoye/SuperLU/faq.html}{http://crd.lbl.gov/\textasciitilde{}xiaoye/SuperLU/faq.html} + + +\subsubsection{MAC OS} +\label{src/installation/matrix_solvers/superlu:mac-os} +\href{http://www.bleedingmind.com/index.php/2010/07/31/compiling-superlu-on-os-x/}{http://www.bleedingmind.com/index.php/2010/07/31/compiling-superlu-on-os-x/} + + +\subsubsection{Using SUPERLU in Hermes} +\label{src/installation/matrix_solvers/superlu:using-superlu-in-hermes}\label{src/installation/matrix_solvers/superlu:ref-usage-superlu} +You may now select \code{SOLVER\_SUPERLU} as the matrix solver for your finite element problem, as detailed +in the \href{http://hpfem.org/hermes/doc/src/hermes2d/P01-linear/03-poisson.html}{Poisson tutorial}, or use +it just to solve a standalone matrix problem \(Ax = b\) as in the +\href{http://http://hpfem.org/hermes/doc/src/hermes2d/P08-miscellaneous/35-matrix-solvers.html}{Using Matrix Solvers tutorial}. + + +\subsection{Trilinos} +\label{src/installation/matrix_solvers/trilinos:trilinos}\label{src/installation/matrix_solvers/trilinos::doc} + +\subsubsection{Linux} +\label{src/installation/matrix_solvers/trilinos:trilinos-home-page}\label{src/installation/matrix_solvers/trilinos:linux} + +\paragraph{Using standard Debian packages} +\label{src/installation/matrix_solvers/trilinos:using-standard-debian-packages} +Install packages \emph{libtrilinos} and \emph{libtrilinos-dev}. In Ubuntu 6.06 (Dapper) +or newer, you can use the Synaptic package manager for that, or type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{sudo} \PYG{n}{apt}\PYG{o}{\PYGZhy{}}\PYG{n}{get} \PYG{n}{install} \PYG{n}{libtrilinos} \PYG{n}{libtrilinos}\PYG{o}{\PYGZhy{}}\PYG{n}{dev} +\end{Verbatim} + +Now go to the directory with Hermes. Create the file CMake.vars with the +following line (or append to the existing one): + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{set}\PYG{p}{(}\PYG{n}{WITH\PYGZus{}TRILINOS} \PYG{n}{YES}\PYG{p}{)} +\end{Verbatim} + +Finally execute: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{rm} \PYG{n}{CMakeCache}\PYG{p}{.}\PYG{n}{txt} +\PYG{n}{cmake} \PYG{p}{.} +\PYG{n}{make} +\end{Verbatim} + +Find more about {\hyperref[src/installation/matrix_solvers/trilinos:ref-usage-trilinos]{\emph{Using TRILINOS in Hermes}}}. + + +\subsubsection{Windows} +\label{src/installation/matrix_solvers/trilinos:windows} +First of all - to build Trilinos, one needs LAPACK (CLAPACK) (see the optional package in the library installation documentation). + +\begin{DUlineblock}{0em} +\item[] Download the sources for the latest version from the \href{http://trilinos.sandia.gov}{Trilinos page} and unpack them in some temporary directory. +\item[] +\item[] Go to the Trilinos source directory. +\item[] +\item[] In the following, replace \{TPL\_LAPACK\_LIBRARIES\}, \{TPL\_BLAS\_LIBRARIES\} with the full path to your lapack.lib and blas.lib without any quotes. +\item[] Also, replace \{CMAKE\_INSTALL\_PREFIX\} with either your dependency root, or any other folder where you want to install Trilinos packages. +\end{DUlineblock} + +\begin{Verbatim}[commandchars=\\\{\}] +mkdir build\PYGZus{}dir +cd build\PYGZus{}dir +cmake \PYGZbs{} + \PYGZhy{}D CMAKE\PYGZus{}BUILD\PYGZus{}TYPE:STRING=DEBUG \PYGZbs{} + \PYGZhy{}D TPL\PYGZus{}LAPACK\PYGZus{}LIBRARIES:FILEPATH=d:\PYGZbs{}\PYGZbs{}hpfem\PYGZbs{}\PYGZbs{}hermes\PYGZbs{}\PYGZbs{}dependencies\PYGZbs{}\PYGZbs{}lib\PYGZbs{}\PYGZbs{}lapack.lib \PYGZbs{} + \PYGZhy{}D TPL\PYGZus{}BLAS\PYGZus{}LIBRARIES:FILEPATH=d:\PYGZbs{}\PYGZbs{}hpfem\PYGZbs{}\PYGZbs{}hermes\PYGZbs{}\PYGZbs{}dependencies\PYGZbs{}\PYGZbs{}lib\PYGZbs{}\PYGZbs{}blas.lib \PYGZbs{} + \PYGZhy{}D CMAKE\PYGZus{}Fortran\PYGZus{}FLAGS:STRING=\PYGZdq{}\PYGZhy{}fPIC\PYGZdq{} \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}ALL\PYGZus{}PACKAGES:BOOL=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}Teuchos:BOOL=ON \PYGZbs{} + \PYGZhy{}D Teuchos\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D Teuchos\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}Epetra:BOOL=ON \PYGZbs{} + \PYGZhy{}D Epetra\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D Epetra\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}EpetraExt:BOOL=ON \PYGZbs{} + \PYGZhy{}D EpetraExt\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D EpetraExt\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}AztecOO:BOOL=ON \PYGZbs{} + \PYGZhy{}D AztecOO\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D AztecOO\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}Ifpack:BOOL=ON \PYGZbs{} + \PYGZhy{}D Ifpack\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D Ifpack\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}ML:BOOL=ON \PYGZbs{} + \PYGZhy{}D ML\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D ML\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}OpenMP:BOOL=ON \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}Amesos:BOOL=ON \PYGZbs{} + \PYGZhy{}D Amesos\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D Amesos\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}NOX:BOOL=ON \PYGZbs{} + \PYGZhy{}D NOX\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D NOX\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}Anasazi:BOOL=ON \PYGZbs{} + \PYGZhy{}D Anasazi\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D Anasazi\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}Komplex:BOOL=ON \PYGZbs{} + \PYGZhy{}D Komplex\PYGZus{}ENABLE\PYGZus{}TESTS:STRING=OFF \PYGZbs{} + \PYGZhy{}D Komplex\PYGZus{}ENABLE\PYGZus{}EXAMPLES:STRING=OFF \PYGZbs{} + \PYGZhy{}D Trilinos\PYGZus{}ENABLE\PYGZus{}TESTS:BOOL=OFF \PYGZbs{} + \PYGZhy{}D DART\PYGZus{}TESTING\PYGZus{}TIMEOUT:STRING=600 \PYGZbs{} + \PYGZhy{}D CMAKE\PYGZus{}INSTALL\PYGZus{}PREFIX:STRING=/d/hpfem/hermes/dependencies \PYGZbs{} + .. +\end{Verbatim} + +\begin{DUlineblock}{0em} +\item[] Build the Trilinos solution. +\item[] Go up to the Trilinos source directory and edit the cmake\_install.cmake file. Change:: +\end{DUlineblock} +\begin{quote} + +SET(CMAKE\_INSTALL\_CONFIG\_NAME ``Release'') +\end{quote} + +for: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{SET}\PYG{p}{(}\PYG{n}{CMAKE\PYGZus{}INSTALL\PYGZus{}CONFIG\PYGZus{}NAME} \PYG{l+s}{\PYGZdq{}}\PYG{l+s}{Debug}\PYG{l+s}{\PYGZdq{}}\PYG{p}{)} +\end{Verbatim} + +Install Trilinos into the path specified by the \{CMAKE\_INSTALL\_PREFIX\} variable by running: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{cmake} \PYG{o}{\PYGZhy{}}\PYG{n}{P} \PYG{n}{cmake\PYGZus{}install}\PYG{p}{.}\PYG{n}{cmake} +\end{Verbatim} + +You may also need to create a dummy file ``unistd.h'' in the include folder under dependencies folder. This header is +not present in certain versions of Microsoft C library. +Go to the directory with Hermes. Add the following lines into CMake.vars: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{set}\PYG{p}{(}\PYG{n}{WITH\PYGZus{}TRILINOS} \PYG{n}{YES}\PYG{p}{)} +\PYG{n}{set}\PYG{p}{(}\PYG{n}{TRILINOS\PYGZus{}ROOT} \PYG{p}{\PYGZob{}}\PYG{n}{CMAKE\PYGZus{}INSTALL\PYGZus{}PREFIX}\PYG{p}{\PYGZcb{}}\PYG{p}{)} +\end{Verbatim} + +again, replace \{CMAKE\_INSTALL\_PREFIX\} with the folder where you installed Trilinos. + +Find more about {\hyperref[src/installation/matrix_solvers/trilinos:ref-usage-trilinos]{\emph{Using TRILINOS in Hermes}}}. + + +\subsubsection{MAC OS} +\label{src/installation/matrix_solvers/trilinos:mac-os} +In preparation. + + +\subsubsection{Using TRILINOS in Hermes} +\label{src/installation/matrix_solvers/trilinos:using-trilinos-in-hermes}\label{src/installation/matrix_solvers/trilinos:ref-usage-trilinos} +You may now select either \code{SOLVER\_AMESOS} as the direct matrix solver or +\code{SOLVER\_AZTECOO} as the iterative matrix solver for your finite element problem, as detailed +in the \href{http://http://hpfem.org/hermes/doc/src/hermes2d/P01-linear/03-poisson.html}{Poisson tutorial}, or use +it just to solve a standalone matrix problem \(Ax = b\) as in the +\href{http://hpfem.org/hermes/doc/src/hermes2d/P08-miscellaneous/35-matrix-solvers.html}{Using Matrix Solvers tutorial}. +Note that Trilinos is also required for using the advanced nonlinear solver \code{NOX} (see e.g. the +\href{http://hpfem.org/hermes/doc/src/hermes2d/P07-trilinos/02-trilinos-nonlinear.html}{Trilinos - Nonlinear tutorial}). + + +\subsection{UMFpack} +\label{src/installation/matrix_solvers/umfpack:umfpack}\label{src/installation/matrix_solvers/umfpack::doc} + +\subsubsection{Linux} +\label{src/installation/matrix_solvers/umfpack:umfpack-home-page}\label{src/installation/matrix_solvers/umfpack:linux} + +\paragraph{Using standard Debian packages} +\label{src/installation/matrix_solvers/umfpack:using-standard-debian-packages} +Install the \emph{libsuitesparse-metis-3.1.0} and \emph{libsuitesparse-dev} packages. +In Ubuntu 9.10 (Karmic) or newer you can use the Synaptic package manager for that, or type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{sudo} \PYG{n}{apt}\PYG{o}{\PYGZhy{}}\PYG{n}{get} \PYG{n}{install} \PYG{n}{libsuitesparse}\PYG{o}{\PYGZhy{}}\PYG{n}{metis}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{3.1}\PYG{l+m+mf}{.0} \PYG{n}{libsuitesparse}\PYG{o}{\PYGZhy{}}\PYG{n}{dev} +\end{Verbatim} + +Now go to the directory with Hermes. Create the file CMake.vars with the +following lines (or append to the existing one): + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{set}\PYG{p}{(}\PYG{n}{WITH\PYGZus{}UMFPACK} \PYG{n}{YES}\PYG{p}{)} +\end{Verbatim} + +and execute: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{rm} \PYG{n}{CMakeCache}\PYG{p}{.}\PYG{n}{txt} +\PYG{n}{cmake} \PYG{p}{.} +\PYG{n}{make} +\end{Verbatim} + +Find more about {\hyperref[src/installation/matrix_solvers/umfpack:ref-usage-umfpack]{\emph{Using UMFPACK in Hermes}}}. + + +\subsubsection{Windows (Cygwin, MinGW, MSVC)} +\label{src/installation/matrix_solvers/umfpack:windows-cygwin-mingw-msvc} +\href{http://matrixprogramming.com/2008/03/umfpack}{http://matrixprogramming.com/2008/03/umfpack} + + +\subsubsection{Mac OS} +\label{src/installation/matrix_solvers/umfpack:mac-os} +\href{http://mywiki-science.wikispaces.com/UMFPACK}{http://mywiki-science.wikispaces.com/UMFPACK} + + +\subsubsection{Using UMFPACK in Hermes} +\label{src/installation/matrix_solvers/umfpack:using-umfpack-in-hermes}\label{src/installation/matrix_solvers/umfpack:ref-usage-umfpack} +After the installation has been completed, you may select \code{SOLVER\_UMFPACK} as the matrix solver for your finite element problems: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{HermesCommonApi}\PYG{p}{.}\PYG{n}{set\PYGZus{}integral\PYGZus{}param\PYGZus{}value}\PYG{p}{(}\PYG{n}{matrixSolverType}\PYG{p}{,} \PYG{n}{SOLVER\PYGZus{}UMFPACK}\PYG{p}{)}\PYG{p}{;} +\end{Verbatim} + + +\subsection{PARALUTION} +\label{src/installation/matrix_solvers/paralution:paralution}\label{src/installation/matrix_solvers/paralution::doc}\begin{enumerate} +\item {} +Download PARALUTION from \href{http://www.paralution.com/}{http://www.paralution.com/}. + +\item {} +Compile, build PARALUTION, and copy headers, and libraries so that Hermes's CMake system can find them (as with other dependencies) +\begin{enumerate} +\item {} +On Linux, installing PARALUTION to default install directories is sufficient, on Windows some paths have to be set + +\end{enumerate} + +\item {} +In your CMake.vars file (or directly in CMakeLists.txt) in the root of Hermes (see step 0) add ``set(WITH\_PARALUTION YES)'' +\begin{enumerate} +\item {} +It is on by default, so by default one has to include PARALUTION to build Hermes + +\end{enumerate} + +\item {} +That is it, build Hermes, it will automatically link to PARALUTION, include headers and make it usable. + +\end{enumerate} + + +\subsection{How to use PARALUTION} +\label{src/installation/matrix_solvers/paralution:how-to-use-paralution}\begin{enumerate} +\setcounter{enumi}{4} +\item {} +Read the doxygen manual of the classes +\begin{enumerate} +\item {} +Hermes::Algebra::ParalutionMatrix + +\item {} +Hermes::Algebra::ParalutionVector + +\item {} +Hermes::Preconditioners::ParalutionPrecond + +\item {} +Hermes::Solvers::IterativeParalutionLinearMatrixSolver + +\item {} +Hermes::Solvers::AMGParalutionLinearMatrixSolver + +\item {} +and all classes that these inherit from / use + +\end{enumerate} + +\item {} +If you want to see Hermes \& PARALUTION readily work together, take any test example in the /hermes2d folder in the Hermes root and add one of these lines at the beginning of your main() +\begin{enumerate} +\item {} +HermesCommonApi.set\_integral\_param\_value(matrixSolverType, SOLVER\_PARALUTION\_ITERATIVE); // to use iterative solver + +\item {} +HermesCommonApi.set\_integral\_param\_value(matrixSolverType, SOLVER\_PARALUTION\_AMG); // to use AMG solver + +\end{enumerate} + +\item {} +Solver classes of Hermes (NewtonSolver, PicardSolver, LinearSolver, ...) will then take this API setting into account and use PARALUTION as the matrix solver. + +\end{enumerate} + + +\section{Installation of ExodusII and NetCDF libraries} +\label{src/installation/exodusII_netcdf:installation-of-exodusii-and-netcdf-libraries}\label{src/installation/exodusII_netcdf::doc} +ExodusII and NetCDF libraries are necessary to read Cubit files in Hermes. + + +\subsection{Installing ExodusII} +\label{src/installation/exodusII::doc}\label{src/installation/exodusII:installing-exodusii} +To install the ExodusII library, insert the following commands in your command-line terminal +(be root user for system wide installation): + +Step 1) + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{cd} \PYG{o}{/} +\end{Verbatim} + +Step 2) + +64bit: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{wget} \PYG{n}{http}\PYG{o}{:}\PYG{c+c1}{//hpfem.org/downloads/exodusii\PYGZhy{}bin\PYGZhy{}amd64\PYGZhy{}4.81.tar.gz} +\end{Verbatim} + +32bit: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{wget} \PYG{n}{http}\PYG{o}{:}\PYG{c+c1}{//hpfem.org/downloads/exodusii\PYGZhy{}bin\PYGZhy{}i686\PYGZhy{}4.81.tar.gz} +\end{Verbatim} + +Step 3) + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{tar} \PYG{n}{xvzf} \PYG{n}{exodusii}\PYG{o}{\PYGZhy{}}\PYG{n}{bin}\PYG{o}{\PYGZhy{}}\PYG{o}{*}\PYG{p}{.}\PYG{n}{tar}\PYG{p}{.}\PYG{n}{gz} +\end{Verbatim} + +Step 4) + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{rm} \PYG{n}{exodusii}\PYG{o}{\PYGZhy{}}\PYG{n}{bin}\PYG{o}{\PYGZhy{}}\PYG{o}{*}\PYG{p}{.}\PYG{n}{tar}\PYG{p}{.}\PYG{n}{gz} +\end{Verbatim} + +The latter steps will unpack the binary package of ExodusII into /opt/packages/exodusii. +If you do not like the location, you may change it to whatever you like, just remember to also adjust the ``CMake'' variables accordingly (see below). + +To use ExodusII support in Hermes2d or 3d: - clone the Hermes repo (if you haven't done so yet), and +in your ``CMake.vars'' file (found in your Hermes directory) add the following lines (AFTER you are done installing BOTH {[}ExodusII and NetCDF{]} packages): + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{SET}\PYG{p}{(}\PYG{n}{WITH\PYGZus{}EXODUSII} \PYG{n}{YES}\PYG{p}{)} +\PYG{n}{SET}\PYG{p}{(}\PYG{n}{EXODUSII\PYGZus{}ROOT} \PYG{o}{/}\PYG{n}{opt}\PYG{o}{/}\PYG{n}{packages}\PYG{o}{/}\PYG{n}{exodusii}\PYG{p}{)} +\PYG{n}{SET}\PYG{p}{(}\PYG{n}{NETCDF\PYGZus{}ROOT} \PYG{o}{/}\PYG{n}{opt}\PYG{o}{/}\PYG{n}{packages}\PYG{o}{/}\PYG{n}{netcdf}\PYG{p}{)} +\end{Verbatim} + +After you are done adding these lines to your ``CMake.vars'' file, go back to your command-line +terminal and type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{cmake} \PYG{p}{.} +\PYG{n}{make} +\end{Verbatim} + +Congratulations (assuming everything worked out) you just installed the ExodusII library! + + +\subsection{Installing NetCDF} +\label{src/installation/netcdf:installing-netcdf}\label{src/installation/netcdf::doc} +To install the NetCDF library, insert the following commands in your command-line terminal +(be root user for system wide installation): + +Step 1) + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{cd} \PYG{o}{/} +\end{Verbatim} + +Step 2) + +64bit: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{wget} \PYG{n}{http}\PYG{o}{:}\PYG{c+c1}{//hpfem.org/downloads/netcdf\PYGZhy{}bin\PYGZhy{}amd64\PYGZhy{}4.0.1.tar.gz} +\end{Verbatim} + +32bit: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{wget} \PYG{n}{http}\PYG{o}{:}\PYG{c+c1}{//hpfem.org/downloads/netcdf\PYGZhy{}bin\PYGZhy{}i686\PYGZhy{}4.0.1.tar.gz} +\end{Verbatim} + +Step 3) + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{tar} \PYG{n}{xvzf} \PYG{n}{netcdf}\PYG{o}{\PYGZhy{}}\PYG{n}{bin}\PYG{o}{\PYGZhy{}}\PYG{o}{*}\PYG{p}{.}\PYG{n}{tar}\PYG{p}{.}\PYG{n}{gz} +\end{Verbatim} + +Step 4) + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{rm} \PYG{n}{netcdf}\PYG{o}{\PYGZhy{}}\PYG{n}{bin}\PYG{o}{\PYGZhy{}}\PYG{o}{*}\PYG{p}{.}\PYG{n}{tar}\PYG{p}{.}\PYG{n}{gz} +\end{Verbatim} + +The latter steps will unpack the binary package of NetCDF into /opt/packages/netcdf. +If you do not like the location, you may change it to whatever you like, just remember to also adjust the ``CMake'' variables accordingly (see below). + +To use ExodusII support in Hermes2d or 3d: - clone the Hermes repo (if you haven't done so yet), and +in your ``CMake.vars'' file (found in your Hermes directory) add the following lines (AFTER you are done installing BOTH {[}ExodusII and NetCDF{]} packages): + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{SET}\PYG{p}{(}\PYG{n}{WITH\PYGZus{}EXODUSII} \PYG{n}{YES}\PYG{p}{)} +\PYG{n}{SET}\PYG{p}{(}\PYG{n}{EXODUSII\PYGZus{}ROOT} \PYG{o}{/}\PYG{n}{opt}\PYG{o}{/}\PYG{n}{packages}\PYG{o}{/}\PYG{n}{exodusii}\PYG{p}{)} +\PYG{n}{SET}\PYG{p}{(}\PYG{n}{NETCDF\PYGZus{}ROOT} \PYG{o}{/}\PYG{n}{opt}\PYG{o}{/}\PYG{n}{packages}\PYG{o}{/}\PYG{n}{netcdf}\PYG{p}{)} +\end{Verbatim} + +After you are done adding these lines to your ``CMake.vars'' file, go back to your command-line +terminal and type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{cmake} \PYG{p}{.} +\PYG{n}{make} +\end{Verbatim} + +Congratulations (assuming everything worked out) you just installed the NetCDF library! + +Note: The binary packages were prepared on Ubuntu 9.10 (64bit and 32bit); they may or may not work on other +64bit and 32bit machines. + + +\chapter{Getting Started} +\label{src/documentation-start:getting-started}\label{src/documentation-start::doc} + +\section{First steps} +\label{src/getting_started:first-steps}\label{src/getting_started::doc} +After a successful compilation of Hermes library, you can install it by typing `make install' (probably with sudo prefix). This will install Hermes to the target directory of your previous choice (or the default ones). + +You can see what is being installed right on the screen (either in bash in Linux, or in Visual Studio output window on Windows). +It is: + +\begin{Verbatim}[commandchars=\\\{\}] +the two dynamically\PYGZhy{}linked libraries (\PYGZsq{}hermes\PYGZus{}common\PYGZsq{} and \PYGZsq{}hermes2d\PYGZsq{}), these will go to the \PYGZsq{}lib\PYGZsq{} subdirectory of your installation target (and on Windows, the .dll parts to \PYGZsq{}bin\PYGZsq{} subdirectory). +two include directories (\PYGZsq{}hermes\PYGZus{}common\PYGZsq{} and \PYGZsq{}hermes2d\PYGZsq{}), these will go to the \PYGZsq{}include\PYGZsq{} subdirectory of your installation target. +\end{Verbatim} + +The fact that they are linked dynamically is more important on Windows, where you have to \textbf{set your PATH environment variable} to point to the directory where you installed it. +If you do not know how to do that, google it. + +The recommended way of learning how to use Hermes for your purposes is to take a look at the small collection of what we call `test examples' right there in the directory. + +If you chose not to build them in cmake (using \textbf{set(H2D\_WITH\_TEST\_EXAMPLES NO)}), +change this, and rebuild the library to see them. + +If something is not clear enough from the comments in the code, please see the section \textbf{Hermes typical example structure}. + +These examples (located in hermes2d/test\_examples) are: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{l+m+mo}{00}\PYG{o}{\PYGZhy{}}\PYG{n}{quickShow} +\PYG{l+m+mo}{01}\PYG{o}{\PYGZhy{}}\PYG{n}{poisson} +\PYG{l+m+mo}{02}\PYG{o}{\PYGZhy{}}\PYG{n}{poisson}\PYG{o}{\PYGZhy{}}\PYG{n}{newton} +\PYG{l+m+mo}{03}\PYG{o}{\PYGZhy{}}\PYG{n}{navier}\PYG{o}{\PYGZhy{}}\PYG{n}{stokes} +\PYG{l+m+mo}{04}\PYG{o}{\PYGZhy{}}\PYG{n}{complex}\PYG{o}{\PYGZhy{}}\PYG{n}{adapt} +\PYG{l+m+mo}{05}\PYG{o}{\PYGZhy{}}\PYG{n}{hcurl}\PYG{o}{\PYGZhy{}}\PYG{n}{adapt} +\PYG{l+m+mo}{06}\PYG{o}{\PYGZhy{}}\PYG{n}{system}\PYG{o}{\PYGZhy{}}\PYG{n}{adapt} +\PYG{l+m+mo}{07}\PYG{o}{\PYGZhy{}}\PYG{n}{newton}\PYG{o}{\PYGZhy{}}\PYG{n}{heat}\PYG{o}{\PYGZhy{}}\PYG{n}{rk} +\PYG{l+m+mi}{08}\PYG{o}{\PYGZhy{}}\PYG{n}{nonlinearity} +\PYG{l+m+mi}{09}\PYG{o}{\PYGZhy{}}\PYG{n}{trilinos}\PYG{o}{\PYGZhy{}}\PYG{n}{nonlinear} +\PYG{l+m+mi}{10}\PYG{o}{\PYGZhy{}}\PYG{n}{linear}\PYG{o}{\PYGZhy{}}\PYG{n}{advection}\PYG{o}{\PYGZhy{}}\PYG{n}{dg}\PYG{o}{\PYGZhy{}}\PYG{n}{adapt} +\PYG{l+m+mi}{11}\PYG{o}{\PYGZhy{}}\PYG{n}{transient}\PYG{o}{\PYGZhy{}}\PYG{n}{adapt} +\PYG{l+m+mi}{12}\PYG{o}{\PYGZhy{}}\PYG{n}{picard} +\PYG{l+m+mi}{13}\PYG{o}{\PYGZhy{}}\PYG{n}{FCT} +\PYG{l+m+mi}{14}\PYG{o}{\PYGZhy{}}\PYG{n}{error}\PYG{o}{\PYGZhy{}}\PYG{n}{calculation} +\PYG{l+m+mi}{15}\PYG{o}{\PYGZhy{}}\PYG{n}{adaptivity}\PYG{o}{\PYGZhy{}}\PYG{n}{matrix}\PYG{o}{\PYGZhy{}}\PYG{n}{reuse}\PYG{o}{\PYGZhy{}}\PYG{n}{simple} +\PYG{l+m+mi}{16}\PYG{o}{\PYGZhy{}}\PYG{n}{adaptivity}\PYG{o}{\PYGZhy{}}\PYG{n}{matrix}\PYG{o}{\PYGZhy{}}\PYG{n}{reuse}\PYG{o}{\PYGZhy{}}\PYG{n}{layer}\PYG{o}{\PYGZhy{}}\PYG{n}{interior} +\end{Verbatim} + +And these examples are well-documented showcase examples of how to use Hermes. + +Take a look at the next section documenting a typical example structure \textbf{Hermes typical example structure}. + + +\section{Hermes typical example structure} +\label{src/typical_example:hermes-typical-example-structure}\label{src/typical_example::doc}\begin{itemize} +\item {} +a nice thing about Hermes is that it follows the math tightly, so the steps taken in solving the example with Hermes correspond to those taken in theory. + +\end{itemize} + +A beginning of each example can look like this: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// Include the main Hermes2D header.} +\PYG{n}{include} \PYG{l+s}{\PYGZdq{}}\PYG{l+s}{hermes2d.h}\PYG{l+s}{\PYGZdq{}} + +\PYG{c+c1}{// Two basic namespaces.} +\PYG{k}{using} \PYG{k}{namespace} \PYG{n}{Hermes}\PYG{p}{;} +\PYG{k}{using} \PYG{k}{namespace} \PYG{n}{Hermes}\PYG{o}{:}\PYG{o}{:}\PYG{n}{Hermes2D}\PYG{p}{;} + +\PYG{c+c1}{// For adaptivity.} +\PYG{k}{using} \PYG{k}{namespace} \PYG{n}{Hermes}\PYG{o}{:}\PYG{o}{:}\PYG{n}{Hermes2D}\PYG{o}{:}\PYG{o}{:}\PYG{n}{RefinementSelectors}\PYG{p}{;} + +\PYG{c+c1}{// For visualization.} +\PYG{k}{using} \PYG{k}{namespace} \PYG{n}{Hermes}\PYG{o}{:}\PYG{o}{:}\PYG{n}{Hermes2D}\PYG{o}{:}\PYG{o}{:}\PYG{n}{Views}\PYG{p}{;} +\end{Verbatim} + + +\subsection{Mesh} +\label{src/typical_example/mesh:mesh}\label{src/typical_example/mesh::doc} +First part one needs to handle is the computational mesh, typically the following would be used: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// Shared pointers are used for easier memory handling.} +\PYG{n}{MeshSharedPtr} \PYG{n+nf}{mesh}\PYG{p}{(}\PYG{k}{new} \PYG{n}{Mesh}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// Either: Native Hermes mesh format.} +\PYG{n}{MeshReaderH2D} \PYG{n}{mloader}\PYG{p}{;} +\PYG{n}{mloader}\PYG{p}{.}\PYG{n}{load}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s}{domain.mesh}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,} \PYG{n}{mesh}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// Or: XML Hermes mesh format.} +\PYG{n}{MeshReaderH2DXML} \PYG{n}{mloader}\PYG{p}{;} +\PYG{n}{mloader}\PYG{p}{.}\PYG{n}{load}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s}{domain.xml}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,} \PYG{n}{mesh}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// Or: BSON (Binary JSON) format for fast binary load/save \PYGZhy{} used primarily in Agros.} +\PYG{n}{MeshReaderH2DBSON} \PYG{n}{mloader}\PYG{p}{;} +\PYG{n}{mloader}\PYG{p}{.}\PYG{n}{load}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s}{domain.bson}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,} \PYG{n}{mesh}\PYG{p}{)}\PYG{p}{;} +\end{Verbatim} + +More about meshes can be found in the `hermes-tutorial' documentation, section `A-linear', chapter `01-mesh' and in the \textbf{Doxygen documentation}. + + +\subsection{Space} +\label{src/typical_example/space::doc}\label{src/typical_example/space:space} +Secondly, the Finite Element space must be set on the computational mesh. One of the following is typically used (including setting of Dirichlet boundary conditions): + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// H1 Space.} +\PYG{c+c1}{// Polynomial order.} +\PYG{k+kt}{int} \PYG{n}{POLYNOMIAL\PYGZus{}ORDER} \PYG{o}{=} \PYG{l+m+mi}{3}\PYG{p}{;} + +\PYG{c+c1}{// Initialize boundary conditions.} +\PYG{c+c1}{// This is a custom (derived) boundary condition. More about this in the section} +\PYG{c+c1}{// \PYGZsq{}Object model \PYGZhy{} deriving your own specialized classes\PYGZsq{}.} +\PYG{n}{CustomDirichletCondition} \PYG{n+nf}{bc\PYGZus{}essential}\PYG{p}{(} + \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{vector}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{string}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{p}{\PYGZob{}}\PYG{l+s}{\PYGZdq{}}\PYG{l+s}{Bottom}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,} \PYG{l+s}{\PYGZdq{}}\PYG{l+s}{Inner}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,} \PYG{l+s}{\PYGZdq{}}\PYG{l+s}{Outer}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,} \PYG{l+s}{\PYGZdq{}}\PYG{l+s}{Left}\PYG{l+s}{\PYGZdq{}}\PYG{p}{\PYGZcb{}}\PYG{p}{)}\PYG{p}{,} + \PYG{n}{BDY\PYGZus{}A\PYGZus{}PARAM}\PYG{p}{,} \PYG{n}{BDY\PYGZus{}B\PYGZus{}PARAM}\PYG{p}{,} \PYG{n}{BDY\PYGZus{}C\PYGZus{}PARAM}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// Initialize the container to pass the boundary conditions to the Space.} +\PYG{n}{EssentialBCs}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{bcs}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{bc\PYGZus{}essential}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// Create an H1 space.} +\PYG{n}{SpaceSharedPtr}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{space}\PYG{p}{(}\PYG{k}{new} \PYG{n}{H1Space}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{n}{mesh}\PYG{p}{,} \PYG{o}{\PYGZam{}}\PYG{n}{bcs}\PYG{p}{,} \PYG{n}{POLYNOMIAL\PYGZus{}ORDER}\PYG{p}{)}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// HCurl Space.} +\PYG{c+c1}{// Polynomial order.} +\PYG{k+kt}{int} \PYG{n}{POLYNOMIAL\PYGZus{}ORDER} \PYG{o}{=} \PYG{l+m+mi}{5}\PYG{p}{;} + +\PYG{c+c1}{// Initialize boundary conditions.} +\PYG{n}{Hermes}\PYG{o}{:}\PYG{o}{:}\PYG{n}{Hermes2D}\PYG{o}{:}\PYG{o}{:}\PYG{n}{DefaultEssentialBCConst}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}} \PYG{n}{bc\PYGZus{}essential} +\PYG{p}{(}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{vector}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{string}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{p}{\PYGZob{}}\PYG{l+s}{\PYGZdq{}}\PYG{l+s}{Corner\PYGZus{}horizontal}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,} \PYG{l+s}{\PYGZdq{}}\PYG{l+s}{Corner\PYGZus{}vertical}\PYG{l+s}{\PYGZdq{}}\PYG{p}{\PYGZcb{}}\PYG{p}{)}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{)}\PYG{p}{;} +\PYG{n}{EssentialBCs}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}} \PYG{n}{bcs}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{bc\PYGZus{}essential}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// Create an Hcurl space.} +\PYG{n}{SpaceSharedPtr}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}} \PYG{n}{space}\PYG{p}{(}\PYG{k}{new} \PYG{n}{HcurlSpace}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{n}{mesh}\PYG{p}{,} \PYG{o}{\PYGZam{}}\PYG{n}{bcs}\PYG{p}{,} \PYG{n}{POLYNOMIAL\PYGZus{}ORDER}\PYG{p}{)}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// HDiv Space. This example does not use any Dirichlet boundary conditions.} +\PYG{k+kt}{int} \PYG{n}{POLYNOMIAL\PYGZus{}ORDER} \PYG{o}{=} \PYG{l+m+mi}{2}\PYG{p}{;} +\PYG{n}{SpaceSharedPtr}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{space}\PYG{p}{(}\PYG{k}{new} \PYG{n}{HdivSpace}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{n}{mesh}\PYG{p}{,} \PYG{n}{POLYNOMIAL\PYGZus{}ORDER}\PYG{p}{)}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// L2 Space. This Space does not take any boundary conditions which corresponds to the} +\PYG{c+c1}{// fact that the FE space is a space of discontinuous functions.} +\PYG{c+c1}{// If we for example use polynomial order = 0, we use just piecewise} +\PYG{c+c1}{// constant basis functions.} +\PYG{n}{SpaceSharedPtr}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{space}\PYG{p}{(}\PYG{k}{new} \PYG{n}{L2Space}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{n}{mesh}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{)}\PYG{p}{)}\PYG{p}{;} +\end{Verbatim} + +More about spaces can be found in the `hermes-tutorial' documentation, section `A-linear', chapter `02-space' and in the \textbf{Doxygen documentation}. + +More about Dirichlet boundary conditions can be found in the `hermes-tutorial' documentation, section `A-linear', chapter `04-bc-dirichlet', and for defining a non-constant custom boundary condition, see the chapter `07-general'. + + +\subsection{Weak formulation} +\label{src/typical_example/weak_formulation:weak-formulation}\label{src/typical_example/weak_formulation::doc} +When we already have a mesh and a space, we have to know what equations we will be solving on those. And that is where the weak formulation comes to the light. +Of course, there is a vast mathematical background of differential equations, their weak solutions, Sobolev spaces, etc., but we assume of those, our users already have a good knowledge. Right here we are concerned with the implementation. A typical creation of a weak formulation for the use with Hermes might look like this: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// Initialize the weak formulation (strictly speaking, shared pointer to the weak formulation)} +\PYG{c+c1}{// This is a weak formulation for linear elasticity, with custom} +\PYG{c+c1}{// parameters of the constructor.} +\PYG{c+c1}{// There is a lot of documentation for using some predefined} +\PYG{c+c1}{// weak forms, as well as creating your own. See the info below.} +\PYG{n}{WeakFormSharedPtr}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{wf}\PYG{p}{(}\PYG{k}{new} \PYG{n}{CustomWeakFormLinearElasticity}\PYG{p}{(}\PYG{n}{E}\PYG{p}{,} \PYG{n}{nu}\PYG{p}{,} \PYG{n}{rho}\PYG{o}{*}\PYG{n}{g1}\PYG{p}{,} \PYG{l+s}{\PYGZdq{}}\PYG{l+s}{Top}\PYG{l+s}{\PYGZdq{}}\PYG{p}{,} \PYG{n}{f0}\PYG{p}{,} \PYG{n}{f1}\PYG{p}{)}\PYG{p}{)}\PYG{p}{;} +\end{Verbatim} + +More about a typical basic weak form can be found in the `hermes-tutorial' documentation, section `A-linear', chapter `03-poisson'. + +More about creating a custom weak form can be found in other tutorial examples. One always needs to subclass the Hermes::Hermes2D::WeakForm\textless{}Scalar\textgreater{} class template. +For defining custom forms (integrals), one needs to subclass templates Hermes::Hermes2D::MatrixFormVol\textless{}Scalar\textgreater{}, MatrixFormSurf\textless{}Scalar\textgreater{}, VectorFormVol\textless{}Scalar\textgreater{}, VectorFormSurf\textless{}Scalar\textgreater{}. +A typical constructor of a derived class: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k}{template}\PYG{o}{\PYGZlt{}}\PYG{o}{\PYGZgt{}} \PYG{n}{DefaultMatrixFormVol}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}}\PYG{o}{:}\PYG{o}{:}\PYG{n}{DefaultMatrixFormVol} + \PYG{p}{(}\PYG{k+kt}{int} \PYG{n}{i}\PYG{p}{,} \PYG{k+kt}{int} \PYG{n}{j}\PYG{p}{,} \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{string} \PYG{n}{area}\PYG{p}{,} \PYG{n}{Hermes2DFunction}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}}\PYG{o}{*} \PYG{n}{coeff}\PYG{p}{,} + \PYG{n}{SymFlag} \PYG{n}{sym}\PYG{p}{,} \PYG{n}{GeomType} \PYG{n}{gt}\PYG{p}{)} + \PYG{o}{:} \PYG{n}{MatrixFormVol}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{n}{i}\PYG{p}{,} \PYG{n}{j}\PYG{p}{,} \PYG{n}{area}\PYG{p}{,} \PYG{n}{sym}\PYG{p}{)}\PYG{p}{,} \PYG{n}{coeff}\PYG{p}{(}\PYG{n}{coeff}\PYG{p}{)}\PYG{p}{,} \PYG{n}{gt}\PYG{p}{(}\PYG{n}{gt}\PYG{p}{)} +\PYG{p}{\PYGZob{}} + \PYG{c+c1}{// If coeff is HERMES\PYGZus{}ONE, initialize it to be constant 1.0.} + \PYG{k}{if}\PYG{p}{(}\PYG{n}{coeff} \PYG{o}{=}\PYG{o}{=} \PYG{n}{HERMES\PYGZus{}ONE}\PYG{p}{)} + \PYG{k}{this}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{coeff} \PYG{o}{=} \PYG{k}{new} \PYG{n}{Hermes2DFunction}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}} + \PYG{p}{(}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{l+m+mf}{1.0}\PYG{p}{,} \PYG{l+m+mf}{1.0}\PYG{p}{)}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\end{Verbatim} + +In this constructor: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k}{template}\PYG{o}{\PYGZlt{}}\PYG{o}{\PYGZgt{}} \PYG{n}{DefaultMatrixFormVol}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}} +\PYG{c+c1}{// means that this is an explicit instantiation of a template for} +\PYG{c+c1}{// complex numbers (DefaultMatrixFormVol, the derived class, is actually also} +\PYG{c+c1}{// a template, as the prent class is).} + +\PYG{k+kt}{int} \PYG{n}{i}\PYG{p}{,} \PYG{n}{j} +\PYG{c+c1}{// coordinates in the system of equations, first is the row (basis functions),} +\PYG{c+c1}{// second the column (test functions).} + +\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{string} \PYG{n}{area} \PYG{c+c1}{//(typically optional)} +\PYG{c+c1}{// either a std::string for the marker on which this form will be evaluated,} +\PYG{c+c1}{// or HERMES\PYGZus{}ANY constant for \PYGZsq{}any\PYGZsq{}, i.e. all markers} +\PYG{c+c1}{// (this is the default in the parent class constructor).} + +\PYG{n}{Hermes2DFunction}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}}\PYG{o}{*}\PYG{n}{coeff} \PYG{c+c1}{//(typically optional)} +\PYG{c+c1}{// custom function having its meaning specified in the} +\PYG{c+c1}{// calculating methods (see further). The constant HERMES\PYGZus{}ONE,} +\PYG{c+c1}{// that really represents the number 1.0, is the default} +\PYG{c+c1}{// in the parent class constructor.} + +\PYG{n}{SymFlag} \PYG{n}{sym} \PYG{c+c1}{//(typically optional)} +\PYG{c+c1}{// symmetry flag} +\PYG{c+c1}{// see the \PYGZsq{}hermes\PYGZhy{}tutorial\PYGZsq{} documentation, section \PYGZsq{}A\PYGZhy{}linear\PYGZsq{}, chapter \PYGZsq{}03\PYGZhy{}poisson\PYGZsq{}.} + +\PYG{n}{GeomType} \PYG{n}{gt} \PYG{c+c1}{//(typically optional)} +\PYG{c+c1}{// type of geometry: HERMES\PYGZus{}PLANAR, HERMES\PYGZus{}AXISYM\PYGZus{}X, HERMES\PYGZus{}AXISYM\PYGZus{}Z,} +\PYG{c+c1}{// to distinguish between the normal 2D settings (HERMES\PYGZus{}PLANAR),} +\PYG{c+c1}{// or an axisymmetric one. See the \PYGZsq{}hermes\PYGZhy{}tutorial\PYGZsq{} documentation,} +\PYG{c+c1}{// section \PYGZsq{}A\PYGZhy{}linear\PYGZsq{}, chapter \PYGZsq{}09\PYGZhy{}axisym\PYGZsq{} for more details.} +\end{Verbatim} + +In those, the main methods to override are value(...), and ord(...), calculating the value and integration order respectively. It is a good idea to refer to the default forms (located in the library repository, with headers in hermes2d/include/weakform\_library/\emph{.h and the sources in hermes2d/src/weakform\_library/}.cpp). +The header is pretty self-explanatory: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// MatrixFormVol \PYGZhy{} MatrixFormSurf differs in the use of GeomSurf instead of GeomVol.} +\PYG{k}{virtual} \PYG{n}{Scalar} \PYG{n}{value}\PYG{p}{(}\PYG{k+kt}{int} \PYG{n}{n}\PYG{p}{,} \PYG{k+kt}{double} \PYG{o}{*}\PYG{n}{wt}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{u\PYGZus{}ext}\PYG{p}{[}\PYG{p}{]}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{u}\PYG{p}{,} + \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{v}\PYG{p}{,} \PYG{n}{GeomVol}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{e}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{o}{*}\PYG{n}{ext}\PYG{p}{)} \PYG{k}{const}\PYG{p}{;} + +\PYG{c+c1}{// A typical implementation.} +\PYG{k}{template}\PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} \PYG{n}{Scalar} \PYG{n}{DefaultMatrixFormVol}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}}\PYG{o}{:}\PYG{o}{:}\PYG{n}{value}\PYG{p}{(}\PYG{k+kt}{int} \PYG{n}{n}\PYG{p}{,} + \PYG{k+kt}{double} \PYG{o}{*}\PYG{n}{wt}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{u\PYGZus{}ext}\PYG{p}{[}\PYG{p}{]}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{u}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{v}\PYG{p}{,} + \PYG{n}{GeomVol}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{e}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{o}{*}\PYG{n}{ext}\PYG{p}{)} \PYG{k}{const} +\PYG{p}{\PYGZob{}} + \PYG{n}{Scalar} \PYG{n}{result} \PYG{o}{=} \PYG{l+m+mi}{0}\PYG{p}{;} + + \PYG{k}{for} \PYG{p}{(}\PYG{k+kt}{int} \PYG{n}{i} \PYG{o}{=} \PYG{l+m+mi}{0}\PYG{p}{;} \PYG{n}{i} \PYG{o}{\PYGZlt{}} \PYG{n}{n}\PYG{p}{;} \PYG{n}{i}\PYG{o}{+}\PYG{o}{+}\PYG{p}{)} + \PYG{n}{result} \PYG{o}{+}\PYG{o}{=} \PYG{n}{wt}\PYG{p}{[}\PYG{n}{i}\PYG{p}{]} \PYG{o}{*} \PYG{n}{coeff}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{value}\PYG{p}{(}\PYG{n}{e}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{x}\PYG{p}{[}\PYG{n}{i}\PYG{p}{]}\PYG{p}{,} \PYG{n}{e}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{y}\PYG{p}{[}\PYG{n}{i}\PYG{p}{]}\PYG{p}{)} \PYG{o}{*} \PYG{n}{u}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{[}\PYG{n}{i}\PYG{p}{]} \PYG{o}{*} \PYG{n}{v}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{[}\PYG{n}{i}\PYG{p}{]}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} + +\PYG{c+c1}{// VectorFormVol \PYGZhy{} VectorFormSurf differs in the use of GeomSurf instead of GeomVol.} +\PYG{c+c1}{// Identical to MatrixFormVol, only the basis function is missing for obvious reasons.} +\PYG{k}{virtual} \PYG{n}{Scalar} \PYG{n}{value}\PYG{p}{(}\PYG{k+kt}{int} \PYG{n}{n}\PYG{p}{,} \PYG{k+kt}{double} \PYG{o}{*}\PYG{n}{wt}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{u\PYGZus{}ext}\PYG{p}{[}\PYG{p}{]}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{v}\PYG{p}{,} + \PYG{n}{GeomVol}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{e}\PYG{p}{,} \PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{o}{*}\PYG{n}{ext}\PYG{p}{)} \PYG{k}{const}\PYG{p}{;} +\end{Verbatim} + +In these: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k+kt}{int} \PYG{n}{n} +\PYG{c+c1}{// number of integration points.} + +\PYG{k+kt}{double} \PYG{o}{*}\PYG{n}{wt} +\PYG{c+c1}{// integration weights (an array containing \PYGZsq{}n\PYGZsq{} values).} + +\PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{u\PYGZus{}ext} +\PYG{c+c1}{// values from previous Newton iterations, as many as there are spaces} +\PYG{c+c1}{// (equations) in the system.} + +\PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{u} +\PYG{c+c1}{// the basis function, represented by the class Func.} +\PYG{c+c1}{// For more info about the class, see the developers documentation (in doxygen).} +\PYG{c+c1}{// How to get that, see the documentation section.} + +\PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{v} +\PYG{c+c1}{// the test function, represented by the class Func.} +\PYG{c+c1}{// For more info about the class, see the developers documentation (in doxygen).} + +\PYG{n}{GeomVol}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{e} +\PYG{c+c1}{// geometry attributes: coordinates, element size,} +\PYG{c+c1}{// normal directions (for surface forms), you name it.} +\PYG{c+c1}{// \PYGZhy{} this is for volumetric forms (for surface forms one uses GeomSurf).} +\PYG{c+c1}{// For more info about the class, see the developers documentation (in doxygen).} + +\PYG{n}{Func}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{o}{*}\PYG{n}{ext} +\PYG{c+c1}{// external functions, as many as you like} +\PYG{c+c1}{// (provided you set it up in constructor of your weak formulation} +\PYG{c+c1}{// derived from the class WeakForm).} +\PYG{c+c1}{// For more info about the class, see the developers documentation (in doxygen).} +\end{Verbatim} + +Now we have a space and a weak formulation, we are ready to calculate! + + +\subsection{Calculation} +\label{src/typical_example/calculation:calculation}\label{src/typical_example/calculation::doc} +We are going to get a solution vector from what we already have in the most general setup. This means for a time-dependent, adaptive example. +This is to illustrate the various classes and methods, and the best thing about them, they are used pretty much the same way. + +For details about time-dependent examples, and various aspects of that, see the `hermes-tutorial' documentation, section `C-transient'. +For details about adaptive examples, and various aspects of that, see the `hermes-tutorial' documentation, section `D-adaptivity'. +Right here we focus on the calculation: + +\begin{Verbatim}[commandchars=\\\{\}] +double current\PYGZus{}time = \PYGZsq{}some number\PYGZsq{}; +double current\PYGZus{}time\PYGZus{}step = \PYGZsq{}also some number\PYGZsq{}; +Time\PYGZhy{}loop +\PYGZob{} + Adaptive\PYGZhy{}loop // not necessarily on each time step. + \PYGZob{} + // create reference space(s), see the adaptivity section of hermes\PYGZhy{}tutorial + // documentation for this. e.g. + Space\PYGZlt{}double\PYGZgt{}* ref\PYGZus{}space = construct\PYGZus{}refined\PYGZus{}space(\PYGZam{}space); + + // WE ARE NOW HERE. + // The calculation + // WE ARE NOW HERE + + // do the adaptivity thing, see the adaptivity section of hermes\PYGZhy{}tutorial + // documentation for this. + // This would change the \PYGZsq{}coarse\PYGZsq{} Space instance: \PYGZsq{}Space\PYGZlt{}double\PYGZgt{} space\PYGZsq{}. + + // Do some cleaning. + \PYGZcb{} + // adjust time, and time step any way you want + // (stability conditions, time\PYGZhy{}adaptivity, ...). +\PYGZcb{} +\end{Verbatim} + +In the following, basically everywhere where one can pass an instance of Space\textless{}Scalar\textgreater{}*, one can pass +an instance of std::vector\textless{}Space\textless{}Scalar\textgreater{}*\textgreater{}, if the problem is a system of equations. + +We shall start from the simplest case. + + +\subsection{1 - linear example} +\label{src/typical_example/calculation:linear-example} +Once we created the Space(s), and the WeakForm (always one!), we create (outside of the loops!) an instance of LinearSolver\textless{}Scalar\textgreater{}: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// Let us say that for real numbers, but for complex, it would be analogic.} +\PYG{n}{LinearSolver}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{solver}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{space}\PYG{p}{,} \PYG{o}{\PYGZam{}}\PYG{n}{wf}\PYG{p}{)}\PYG{p}{.} +\end{Verbatim} + +Then the following code inside the loops would do the trick: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{solver}\PYG{p}{.}\PYG{n}{set\PYGZus{}time}\PYG{p}{(}\PYG{n}{current\PYGZus{}time}\PYG{p}{)}\PYG{p}{;} +\PYG{n}{solver}\PYG{p}{.}\PYG{n}{set\PYGZus{}time\PYGZus{}tep}\PYG{p}{(}\PYG{n}{current\PYGZus{}time\PYGZus{}step}\PYG{p}{)}\PYG{p}{;} +\PYG{c+c1}{// Yes! You are right, these can be used outside of the adaptivity loop!} + +\PYG{c+c1}{// Set the new Space.} +\PYG{n}{solver}\PYG{p}{.}\PYG{n}{set\PYGZus{}space}\PYG{p}{(}\PYG{n}{ref\PYGZus{}space}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// This is usually the place where something can go wrong,} +\PYG{c+c1}{// so we use the try\PYGZhy{}catch block. Note that the exceptions} +\PYG{c+c1}{// we use in Hermes are std::exception descendants (so only one catch block is enough),} +\PYG{c+c1}{// but you can choose to act differently upon a different exception type as shown.} +\PYG{n}{try} +\PYG{p}{\PYGZob{}} + \PYG{c+c1}{// Do the magic (assemble the matrix, right\PYGZhy{}hand side, solve).} + \PYG{n}{solver}\PYG{p}{.}\PYG{n}{solve}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\PYG{k}{catch}\PYG{p}{(}\PYG{n}{Hermes}\PYG{o}{:}\PYG{o}{:}\PYG{n}{Exception}\PYG{o}{:}\PYG{o}{:}\PYG{n}{Exception}\PYG{o}{\PYGZam{}} \PYG{n}{e}\PYG{p}{)} +\PYG{p}{\PYGZob{}} + \PYG{n}{e}\PYG{p}{.}\PYG{n}{print\PYGZus{}msg}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\PYG{k}{catch}\PYG{p}{(}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{exception}\PYG{o}{\PYGZam{}} \PYG{n}{e}\PYG{p}{)} +\PYG{p}{\PYGZob{}} + \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{cout} \PYG{o}{\PYGZlt{}}\PYG{o}{\PYGZlt{}} \PYG{n}{e}\PYG{p}{.}\PYG{n}{what}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} + +\PYG{c+c1}{// Get the solution.} +\PYG{c+c1}{// The Solution class is described in the developers (doxygen) documentation.} +\PYG{c+c1}{// The method vector\PYGZus{}to\PYGZus{}solution(s) too.} +\PYG{n}{MeshFunctionSharedPtr}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{ref\PYGZus{}sln}\PYG{p}{(}\PYG{k}{new} \PYG{n}{Solution}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{)}\PYG{p}{;} +\PYG{n}{Solution}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{o}{:}\PYG{o}{:}\PYG{n}{vector\PYGZus{}to\PYGZus{}solution}\PYG{p}{(}\PYG{n}{solver}\PYG{p}{.}\PYG{n}{get\PYGZus{}sln\PYGZus{}vector}\PYG{p}{(}\PYG{p}{)}\PYG{p}{,} \PYG{n}{ref\PYGZus{}space}\PYG{p}{,} \PYG{n}{ref\PYGZus{}sln}\PYG{p}{)}\PYG{p}{;} +\end{Verbatim} + +And that is it, we have the solution of the problem in that adaptivity step on that time level. What to do with it (visualize, do some calculations, projections, limiting, whatever) and how to do it is described in various points in the tutorial. +But let us say that we would like to see it, the following will make us happy: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{ScalarView}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{view}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}}\PYG{l+s}{My Solution}\PYG{l+s}{\PYGZdq{}}\PYG{p}{)}\PYG{p}{;} +\PYG{n}{view}\PYG{p}{.}\PYG{n}{show}\PYG{p}{(}\PYG{n}{ref\PYGZus{}sln}\PYG{p}{)}\PYG{p}{;} +\end{Verbatim} + + +\subsection{2 - nonlinear example} +\label{src/typical_example/calculation:nonlinear-example} +In this surprisingly short section, we will learn how to use NewtonSolver, and PicardSolver. + +It is literaly the same as in the previous section, just take out `LinearSolver', and pass `NewtonSolver', or `PicardSolver'. + +There is one more thing, if you want your NewtonSolver not to start from a zero initial guess, the following helps: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// Initialize the vector for initial guess. Real case.} +\PYG{c+c1}{// Also do not forget to \PYGZsq{}delete []\PYGZsq{} this after you do not need it.} +\PYG{k+kt}{double}\PYG{o}{*} \PYG{n}{coeff\PYGZus{}vec} \PYG{o}{=} \PYG{k}{new} \PYG{k+kt}{double}\PYG{p}{[}\PYG{n}{Space}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{o}{:}\PYG{o}{:}\PYG{n}{get\PYGZus{}num\PYGZus{}dofs}\PYG{p}{(}\PYG{o}{\PYGZam{}}\PYG{n}{ref\PYGZus{}space}\PYG{p}{)}\PYG{p}{]}\PYG{p}{;} + +\PYG{c+c1}{// For example let us project the previous time level solution and} +\PYG{c+c1}{// use it as an initial guess.} +\PYG{c+c1}{// And now use it in the NewtonSolver\PYGZlt{}Scalar\PYGZgt{}::solve.} +\PYG{c+c1}{// (solver is now NewtonSolver\PYGZlt{}double\PYGZgt{}) method.} +\PYG{n}{solver}\PYG{p}{.}\PYG{n}{solve}\PYG{p}{(}\PYG{n}{previous\PYGZus{}time\PYGZus{}level\PYGZus{}sln}\PYG{p}{)}\PYG{p}{;} +\end{Verbatim} + +One can also use the NOX solver from the Trilinos package (with analogic, but not exactly same methods). One needs Trilinos for that. And documentation for that is coming. + + +\subsection{3 - RungeKutta solver.} +\label{src/typical_example/calculation:rungekutta-solver} +Again, pretty much the same as in the LinearSolver case, but the solve() method will now take the previous time level Solution(s) and return the new Solution(s), so there is no need for using the vector\_to\_solution(s) method: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// Initialize the solution(it can be outside of the loops,} +\PYG{c+c1}{// the solution would always be rewritten when it is natural)} +\PYG{n}{MeshFunctionSharedPtr}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{ref\PYGZus{}sln}\PYG{p}{(}\PYG{k}{new} \PYG{n}{Solution}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// \PYGZdq{}solver\PYGZdq{} is now an instance of RungeKutta\PYGZlt{}double\PYGZgt{}.} +\PYG{n}{solver}\PYG{p}{.}\PYG{n}{set\PYGZus{}time}\PYG{p}{(}\PYG{n}{current\PYGZus{}time}\PYG{p}{)}\PYG{p}{;} +\PYG{n}{solver}\PYG{p}{.}\PYG{n}{set\PYGZus{}time\PYGZus{}tep}\PYG{p}{(}\PYG{n}{current\PYGZus{}time\PYGZus{}step}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// Yes! You are right, these can be used outside of the adaptivity loop!} +\PYG{c+c1}{// Set the new Space.} +\PYG{n}{solver}\PYG{p}{.}\PYG{n}{set\PYGZus{}space}\PYG{p}{(}\PYG{n}{ref\PYGZus{}space}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// This is usually the place where something can go wrong,} +\PYG{c+c1}{// so we use the try\PYGZhy{}catch block. Note that the exceptions} +\PYG{c+c1}{// we use in Hermes are std::exception descendants (so only one catch block is enough).} +\PYG{n}{try} +\PYG{p}{\PYGZob{}} + \PYG{c+c1}{// Do the usual magic, plus put the result in the ref\PYGZus{}sln instance.} + \PYG{n}{solver}\PYG{p}{.}\PYG{n}{solve}\PYG{p}{(}\PYG{n}{previous\PYGZus{}time\PYGZus{}level\PYGZus{}sln}\PYG{p}{,} \PYG{n}{ref\PYGZus{}sln}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\PYG{k}{catch}\PYG{p}{(}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{exception}\PYG{o}{\PYGZam{}} \PYG{n}{e}\PYG{p}{)} +\PYG{p}{\PYGZob{}} + \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{cout} \PYG{o}{\PYGZlt{}}\PYG{o}{\PYGZlt{}} \PYG{n}{e}\PYG{p}{.}\PYG{n}{what}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\end{Verbatim} + + +\subsection{4 - use DiscreteProblem class directly} +\label{src/typical_example/calculation:use-discreteproblem-class-directly} +For special purposes, like DG or FVM (Finite Volume Method), where one needs to access the matrix or right-hand side, or needs to have the solution in hand before projection (to do limiting etc.), one can also directly use this class. + +It shares some methods with the above `calculation' classes, but of course does not do any calculation. The usage would look like this: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// We assume we have an instance DiscreteProblem\PYGZlt{}double\PYGZgt{} dp(\PYGZam{}wf, \PYGZam{}space);} + +\PYG{c+c1}{// These can be outside the loop, the memory would get properly freed / reallocated} +\PYG{c+c1}{// every time without worrying about it.} +\PYG{n}{SparseMatrix}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{o}{*} \PYG{n}{matrix} \PYG{o}{=} \PYG{n}{create\PYGZus{}matrix}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} +\PYG{n}{Vector}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{o}{*} \PYG{n}{rhs} \PYG{o}{=} \PYG{n}{create\PYGZus{}vector}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} +\PYG{n}{LinearMatrixSolver}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{o}{*} \PYG{n}{linear\PYGZus{}matrix\PYGZus{}solver} \PYG{o}{=} \PYG{n}{create\PYGZus{}linear\PYGZus{}solver}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{n}{matrix}\PYG{p}{,} \PYG{n}{rhs}\PYG{p}{)}\PYG{p}{;} + +\PYG{n}{dp}\PYG{p}{.}\PYG{n}{set\PYGZus{}time}\PYG{p}{(}\PYG{n}{current\PYGZus{}time}\PYG{p}{)}\PYG{p}{;} +\PYG{n}{dp}\PYG{p}{.}\PYG{n}{set\PYGZus{}time\PYGZus{}tep}\PYG{p}{(}\PYG{n}{current\PYGZus{}time\PYGZus{}step}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// Set the new Space.} +\PYG{n}{dp}\PYG{p}{.}\PYG{n}{set\PYGZus{}space}\PYG{p}{(}\PYG{n}{ref\PYGZus{}space}\PYG{p}{)}\PYG{p}{;} + +\PYG{c+c1}{// This is usually the place where something can go wrong,} +\PYG{c+c1}{// so we use the try\PYGZhy{}catch block. Note that the exceptions} +\PYG{c+c1}{// we use in Hermes are std::exception descendants (so only one catch block is enough).} +\PYG{n}{try} +\PYG{p}{\PYGZob{}} + \PYG{n}{dp}\PYG{p}{.}\PYG{n}{assemble}\PYG{p}{(}\PYG{n}{matrix}\PYG{p}{,} \PYG{n}{rhs}\PYG{p}{)}\PYG{p}{;} + + \PYG{c+c1}{// NOW WE HAVE THE MATRIX and RHS ASSEMBLED and we can do whatever we want with it.} + \PYG{n}{linear\PYGZus{}matrix\PYGZus{}solver}\PYG{p}{.}\PYG{n}{solve}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\PYG{k}{catch}\PYG{p}{(}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{exception}\PYG{o}{\PYGZam{}} \PYG{n}{e}\PYG{p}{)} +\PYG{p}{\PYGZob{}} + \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{cout} \PYG{o}{\PYGZlt{}}\PYG{o}{\PYGZlt{}} \PYG{n}{e}\PYG{p}{.}\PYG{n}{what}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} + +\PYG{c+c1}{// Get the solution.} +\PYG{c+c1}{// The Solution class is described in the developers documentation.} +\PYG{c+c1}{// The method vector\PYGZus{}to\PYGZus{}solution(s) too.} +\PYG{n}{MeshFunctionSharedPtr}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{ref\PYGZus{}sln}\PYG{p}{(}\PYG{k}{new} \PYG{n}{Solution}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{)}\PYG{p}{;} +\PYG{n}{Solution}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{o}{:}\PYG{o}{:}\PYG{n}{vector\PYGZus{}to\PYGZus{}solution}\PYG{p}{(}\PYG{n}{linear\PYGZus{}matrix\PYGZus{}solver}\PYG{p}{.}\PYG{n}{get\PYGZus{}sln\PYGZus{}vector}\PYG{p}{(}\PYG{p}{)}\PYG{p}{,} \PYG{n}{ref\PYGZus{}space}\PYG{p}{,} \PYG{n}{ref\PYGZus{}sln}\PYG{p}{)}\PYG{p}{;} +\end{Verbatim} + +And that is it. There is not much more to it. See the `transient', and `adaptivity' sections of the hermes-tutorial documentation and all will fall into place. + +Of course every problem is different, such as in the case of DG, one needs to do some limiting, shock capturing etc... +One can also save / load various entities (Spaces, Solutions, Meshes, time steps, ...) during calculation. + +And especially, one needs to be careful not to forget deallocating stuff. How to do that, see the hermes-tutorial, and hermes-examples repositories. The examples there should be done properly. + + +\section{Introduction to advanced C++ object-oriented features} +\label{src/introOOP:introduction-to-advanced-c-object-oriented-features}\label{src/introOOP::doc} +There is plenty of material on the internet that is concerned with advanced C++. +\begin{description} +\item[{This list was put together in February, 2013}] \leavevmode\begin{itemize} +\item {} +\href{http://www.cs.utexas.edu/~jbsartor/cs105/CS105\_spr10\_lec8.pptx.pdf}{http://www.cs.utexas.edu/\textasciitilde{}jbsartor/cs105/CS105\_spr10\_lec8.pptx.pdf} + +\item {} +\href{http://www.cs.ust.hk/~dekai/library/ECKEL\_Bruce}{http://www.cs.ust.hk/\textasciitilde{}dekai/library/ECKEL\_Bruce} + +\item {} +\href{http://www10.informatik.uni-erlangen.de/~pflaum/pflaum/ProSeminar/meta-art.html}{http://www10.informatik.uni-erlangen.de/\textasciitilde{}pflaum/pflaum/ProSeminar/meta-art.html} + +\end{itemize} + +\end{description} + + +\section{Hermes C++ object model - deriving your own specialized classes} +\label{src/hermesOO::doc}\label{src/hermesOO:hermes-c-object-model-deriving-your-own-specialized-classes} +\begin{notice}{note}{DOXYGEN documentation} + +Anything that is written here can be much faster and in much more complex way read and understood from the Doxygen documentation - please, please, use it - many an hour has been spent to make Doxygen documentation a useful resource for programmers. +\end{notice} + +There are several classes that represent some piece of the whole FEM discretization and calculation process that hold the custom informaion for a specific problem. + +Be sure to have checked the section ``Typical example'' that will give you an idea of the basics. This section is more technically focused. + +These are +\begin{itemize} +\item {} +Forms (= integrals) of the weak formulation + +\item {} +Essential (= Dirichlet) boundary conditions + +\item {} +Mesh functions (= initial conditions, exact solutions, etc.) + +\item {} +Mathematical functions (= nonlinear relations, etc.) + +\item {} +Filters (= functions of solutions, for post-processing) + +\end{itemize} + +Each of these is described in what follows. + + +\subsection{Notes on templating} +\label{src/hermesOO:notes-on-templating} +In the section of advanced Object-Oriented aspects of C++ and especially its template metaprogramming capabilities, you should find enough information on the subject to start with, should you need. +The templates in Hermes are very simple. Most classes (and all that are discussed in this section) come only in two forms - there exist only two \emph{template instantiations} - for real and for complex numbers. +Also, since we do not see much use in using single-precision calculations, only the two following instantiations exist for most classes: +\begin{itemize} +\item {} +double + +\item {} +std::complex\textless{}double\textgreater{} + +\end{itemize} + +So whenever there is a class header that looks like this: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k}{template}\PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{Scalar}\PYG{o}{\PYGZgt{}} +\PYG{k}{class} \PYG{n+nc}{AClass} +\PYG{p}{\PYGZob{}} + \PYG{p}{.}\PYG{p}{.}\PYG{p}{.} +\PYG{p}{\PYGZcb{}}\PYG{p}{;} +\end{Verbatim} + +It is exactly this case, you can use AClass\textless{}double\textgreater{} for real problems, and AClass\textless{}std::complex\textless{}double\textgreater{} \textgreater{} for complex problems. + +The explicit instantiations, should you need to add such, need to be at the end of the \textbf{source} file (.cpp), \textbf{not} the header file. + + +\subsection{Forms} +\label{src/hermesOO:forms} +Weak formulation is the key part of the FEM discretization. +The whole weak formulation with all the integrals that it contains and their specification (over what part of the domain is the integration, on which coordinates of the system of PDEs it is located, etc.) is represented by the class template +\begin{quote} + +WeakForm\textless{}Scalar\textgreater{} (file: hermes2d/include/weakform/weakform.h) +\end{quote} + +In the implementation of your programs, you need to subclass (or derive from) this class as was seen in the ``Weak formulation'' part of the ``Typical example'' section: +\begin{quote} + +class MyWeakForm : public WeakForm\textless{}double\textgreater{} +\end{quote} + +What is necessary to say is that WeakForm is usually passed by means of shared pointers, using class template WeakFormSharedPtr (see examples for how to use this). + +The important methods and attributes to note in this class are: +\begin{itemize} +\item {} +the constructor WeakForm(unsigned int neq = 1, bool mat\_free = false) +\begin{itemize} +\item {} +neq stands for Number Of Equations + +\item {} +in the body, you need to use the following methods to add single forms (integrals) to the weak formulation +\begin{itemize} +\item {} +void add\_matrix\_form(MatrixFormVol\textless{}Scalar\textgreater{}* mfv); + +\item {} +void add\_matrix\_form\_surf(MatrixFormSurf\textless{}Scalar\textgreater{}* mfs); + +\item {} +... + +\end{itemize} + +\item {} +other methods (set\_ext(...), set\_current\_time(...)) are described in the Doxygen documentation. + +\item {} +\textbf{clone()} - the cloning method, for parallelization +\begin{itemize} +\item {} +the purpose of this method is to create an exact copy of the instance at hand (as simple as that - return a copy, but with no shared data) + +\item {} +the reason is that in the openMP parallel assembling, each thread will receive a copy of the instance for its own processing (and this will eliminate the potential parallelization issues) + +\item {} +this is there just for the case that you have any data that are not thread-safe and you do not want to take care about this on your own (using openMP directives like \textbf{pragma omp critical} etc.) + +\end{itemize} + +\end{itemize} + +\end{itemize} + +Right after the WeakForm come the most difficutlt and problem causing classes - \textbf{Forms} - here is the list of form types: +\begin{itemize} +\item {} +MatrixFormVol - a bilinear form that represent integration over a volume + +\item {} +MatrixFormSurf - a bilinear form that represent integration over a surface + +\item {} +MatrixFormDG - a bilinear form that represent integration over an inner edge - for DG + +\item {} +VectorFormVol - a linear form that represent integration over a volume + +\item {} +VectorFormSurf - a linear form that represent integration over a surface + +\item {} +VectorFormDG - a linear form that represent integration over an inner edge - for DG + +\end{itemize} + +How to subclass these should be obvious from the ``Weak formulation'' part of the ``Typical example'' section. + + +\subsection{Essential boundary conditions} +\label{src/hermesOO:essential-boundary-conditions} +There is three classes to note for handling of Dirichlet boundary conditions (all in hermes2d/include/boundary\_conditions/essential\_boundary\_conditions.h) +\begin{itemize} +\item {} +DefaultEssentialBCConst - a class you may use directly, without any subclassing +\begin{itemize} +\item {} +only thing is to specify the constant value in the constructor: + +DefaultEssentialBCConst(std::string marker, Scalar \textbf{value\_const}); + +\end{itemize} + +\item {} +DefaultEssentialBCNonConst - a class you again may use directly, \textbf{or} subclass, should you wish to use a non-Constant Dirichlet BC +\begin{itemize} +\item {} +if you wish to use the class directly, you need to specify an instance of the following in the constructor: + +ExactSolutionScalar\textless{}Scalar\textgreater{} + +\item {} +if you wish to use a specific value function, you may just subclass this class and override the value() method + +\item {} +instructions for subclassing can be found in the file hermes2d/include/boundary\_conditions/essential\_boundary\_conditions.h just above the class + +\end{itemize} + +\item {} +EssentialBCs - a class you will never subclass, it is a container that you pass to a constructor of a Space (see the ``Space'' part of the ``Typical example'' section). + +\end{itemize} + +An example usage of the non-constant boundary condition with subclassing is in the test examples: + +\begin{Verbatim}[commandchars=\\\{\}] +hermes2d\PYGZbs{}test\PYGZus{}examples\PYGZbs{}03\PYGZhy{}navier\PYGZhy{}stokes\PYGZbs{}definitions.cpp at the very bottom +\end{Verbatim} + + +\subsection{Mesh functions} +\label{src/hermesOO:mesh-functions} +Very important thing regarding the Mesh functions is the use of shared pointers, in this sense, the class template MeshFunctionSharedPtr, in this example the mesh function is a solution: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{MeshFunctionSharedPtr}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{n}{my\PYGZus{}mesh\PYGZus{}function}\PYG{p}{(}\PYG{k}{new} \PYG{n}{Solution}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{p}{(}\PYG{n}{mesh}\PYG{p}{)}\PYG{p}{)}\PYG{p}{;} +\end{Verbatim} + +An example of this is the following code from the test example 06: + +\begin{Verbatim}[commandchars=\\\{\}] +hermes2d\PYGZbs{}test\PYGZus{}examples\PYGZbs{}06\PYGZhy{}system\PYGZhy{}adapt\PYGZbs{}definitions.cpp (.h) +\end{Verbatim} + +The point here are the two classes ExactSolutionFitzHughNagumo1, ExactSolutionFitzHughNagumo2. This is the definition of the class \textbf{ExactSolutionFitzHughNagumo1} and the declaration of its methods in definitions.h: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k}{class} \PYG{n+nc}{ExactSolutionFitzHughNagumo1} \PYG{o}{:} \PYG{k}{public} \PYG{n}{ExactSolutionScalar}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} +\PYG{p}{\PYGZob{}} +\PYG{n+nl}{public:} + \PYG{n}{ExactSolutionFitzHughNagumo1}\PYG{p}{(}\PYG{n}{MeshSharedPtr} \PYG{n}{mesh}\PYG{p}{)}\PYG{p}{;} + + \PYG{k}{virtual} \PYG{k+kt}{double} \PYG{n}{value}\PYG{p}{(}\PYG{k+kt}{double} \PYG{n}{x}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{y}\PYG{p}{)} \PYG{k}{const}\PYG{p}{;} + + \PYG{k}{virtual} \PYG{k+kt}{void} \PYG{n}{derivatives}\PYG{p}{(}\PYG{k+kt}{double} \PYG{n}{x}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{y}\PYG{p}{,} \PYG{k+kt}{double}\PYG{o}{\PYGZam{}} \PYG{n}{dx}\PYG{p}{,} \PYG{k+kt}{double}\PYG{o}{\PYGZam{}} \PYG{n}{dy}\PYG{p}{)} \PYG{k}{const}\PYG{p}{;} + + \PYG{k}{virtual} \PYG{n}{Ord} \PYG{n}{ord}\PYG{p}{(}\PYG{k+kt}{double} \PYG{n}{x}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{y}\PYG{p}{)} \PYG{k}{const}\PYG{p}{;} + + \PYG{o}{\PYGZti{}}\PYG{n}{ExactSolutionFitzHughNagumo1}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} + + \PYG{k}{virtual} \PYG{n}{MeshFunction}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{o}{*} \PYG{n}{clone}\PYG{p}{(}\PYG{p}{)} \PYG{k}{const}\PYG{p}{;} + + \PYG{n}{CustomExactFunction1}\PYG{o}{*} \PYG{n}{cef1}\PYG{p}{;} +\PYG{p}{\PYGZcb{}}\PYG{p}{;} +\end{Verbatim} + +Note the subclassing line: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// This should be obvious for any C++ user} +\PYG{k}{class} \PYG{n+nc}{ExactSolutionFitzHughNagumo1} \PYG{o}{:} \PYG{k}{public} \PYG{n}{ExactSolutionScalar}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} +\end{Verbatim} +\begin{description} +\item[{Then we can see the important methods are overriden in the source file definitions.cpp:}] \leavevmode\begin{itemize} +\item {} +value(double x, double y) const + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k+kt}{double} \PYG{n}{ExactSolutionFitzHughNagumo1}\PYG{o}{:}\PYG{o}{:}\PYG{n}{value}\PYG{p}{(}\PYG{k+kt}{double} \PYG{n}{x}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{y}\PYG{p}{)} \PYG{k}{const} +\PYG{p}{\PYGZob{}} + \PYG{k}{return} \PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)}\PYG{o}{*}\PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{y}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\end{Verbatim} + +\item {} +derivatives(double x, double y, double\& dx, double\& dy) const + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k+kt}{void} \PYG{n}{ExactSolutionFitzHughNagumo1}\PYG{o}{:}\PYG{o}{:}\PYG{n}{derivatives}\PYG{p}{(}\PYG{k+kt}{double} \PYG{n}{x}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{y}\PYG{p}{,} + \PYG{k+kt}{double}\PYG{o}{\PYGZam{}} \PYG{n}{dx}\PYG{p}{,} \PYG{k+kt}{double}\PYG{o}{\PYGZam{}} \PYG{n}{dy}\PYG{p}{)} \PYG{k}{const} +\PYG{p}{\PYGZob{}} + \PYG{n}{dx} \PYG{o}{=} \PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{dx}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)}\PYG{o}{*}\PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{y}\PYG{p}{)}\PYG{p}{;} + \PYG{n}{dy} \PYG{o}{=} \PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)}\PYG{o}{*}\PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{dx}\PYG{p}{(}\PYG{n}{y}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\end{Verbatim} + +\item {} +ord(double x, double y) const + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{Ord} \PYG{n}{ExactSolutionFitzHughNagumo1}\PYG{o}{:}\PYG{o}{:}\PYG{n}{ord}\PYG{p}{(}\PYG{k+kt}{double} \PYG{n}{x}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{y}\PYG{p}{)} \PYG{k}{const} +\PYG{p}{\PYGZob{}} + \PYG{k}{return} \PYG{n}{Ord}\PYG{p}{(}\PYG{l+m+mi}{10}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\end{Verbatim} + +\item {} +clone() const + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{MeshFunction}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{o}{*} \PYG{n}{ExactSolutionFitzHughNagumo1}\PYG{o}{:}\PYG{o}{:}\PYG{n}{clone}\PYG{p}{(}\PYG{p}{)} \PYG{k}{const} +\PYG{p}{\PYGZob{}} + \PYG{k}{return} \PYG{k}{new} \PYG{n}{ExactSolutionFitzHughNagumo1}\PYG{p}{(}\PYG{k}{this}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{mesh}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\end{Verbatim} + +\end{itemize} + +\end{description} + + +\subsection{Mathematical functions} +\label{src/hermesOO:mathematical-functions} +Once again we shall use the example 06: + +\begin{Verbatim}[commandchars=\\\{\}] +hermes2d\PYGZbs{}test\PYGZus{}examples\PYGZbs{}06\PYGZhy{}system\PYGZhy{}adapt\PYGZbs{}definitions.cpp (.h) +\end{Verbatim} + +In the header file (definitions.h) we can see the following class definition: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k}{class} \PYG{n+nc}{CustomRightHandSide1}\PYG{o}{:} \PYG{k}{public} \PYG{n}{Hermes2DFunction}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} +\PYG{p}{\PYGZob{}} +\PYG{n+nl}{public:} + \PYG{n}{CustomRightHandSide1}\PYG{p}{(}\PYG{k+kt}{double} \PYG{n}{K}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{d\PYGZus{}u}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{sigma}\PYG{p}{)}\PYG{p}{;} + + \PYG{k}{virtual} \PYG{k+kt}{double} \PYG{n}{value}\PYG{p}{(}\PYG{k+kt}{double} \PYG{n}{x}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{y}\PYG{p}{)} \PYG{k}{const}\PYG{p}{;} + + \PYG{k}{virtual} \PYG{n}{Ord} \PYG{n}{value}\PYG{p}{(}\PYG{n}{Ord} \PYG{n}{x}\PYG{p}{,} \PYG{n}{Ord} \PYG{n}{y}\PYG{p}{)} \PYG{k}{const}\PYG{p}{;} + + \PYG{o}{\PYGZti{}}\PYG{n}{CustomRightHandSide1}\PYG{p}{(}\PYG{p}{)}\PYG{p}{;} + + \PYG{n}{CustomExactFunction1}\PYG{o}{*} \PYG{n}{cef1}\PYG{p}{;} + \PYG{n}{CustomExactFunction2}\PYG{o}{*} \PYG{n}{cef2}\PYG{p}{;} + \PYG{k+kt}{double} \PYG{n}{d\PYGZus{}u}\PYG{p}{,} \PYG{n}{sigma}\PYG{p}{;} +\PYG{p}{\PYGZcb{}}\PYG{p}{;} +\end{Verbatim} +\begin{description} +\item[{The important methods here are (definitions - method bodies from definitions.cpp):}] \leavevmode\begin{itemize} +\item {} +value(double x, double y) const + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k+kt}{double} \PYG{n}{CustomRightHandSide1}\PYG{o}{:}\PYG{o}{:}\PYG{n}{value}\PYG{p}{(}\PYG{k+kt}{double} \PYG{n}{x}\PYG{p}{,} \PYG{k+kt}{double} \PYG{n}{y}\PYG{p}{)} \PYG{k}{const} +\PYG{p}{\PYGZob{}} + \PYG{k+kt}{double} \PYG{n}{Laplace\PYGZus{}u} \PYG{o}{=} \PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{ddxx}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)} \PYG{o}{*} \PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{y}\PYG{p}{)} + \PYG{o}{+} \PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)} \PYG{o}{*} \PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{ddxx}\PYG{p}{(}\PYG{n}{y}\PYG{p}{)}\PYG{p}{;} + \PYG{k+kt}{double} \PYG{n}{u} \PYG{o}{=} \PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)} \PYG{o}{*} \PYG{n}{cef1}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{y}\PYG{p}{)}\PYG{p}{;} + \PYG{k+kt}{double} \PYG{n}{v} \PYG{o}{=} \PYG{n}{cef2}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)} \PYG{o}{*} \PYG{n}{cef2}\PYG{o}{\PYGZhy{}}\PYG{o}{\PYGZgt{}}\PYG{n}{val}\PYG{p}{(}\PYG{n}{y}\PYG{p}{)}\PYG{p}{;} + \PYG{k}{return} \PYG{o}{\PYGZhy{}}\PYG{n}{d\PYGZus{}u} \PYG{o}{*} \PYG{n}{d\PYGZus{}u} \PYG{o}{*} \PYG{n}{Laplace\PYGZus{}u} \PYG{o}{\PYGZhy{}} \PYG{n}{u} \PYG{o}{+} \PYG{n}{sigma} \PYG{o}{*} \PYG{n}{v}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\end{Verbatim} + +\item {} +value(Ord x, Ord y) const + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// Note here that we are saying that this function is ok to be integrated with a} +\PYG{c+c1}{// quadrature rule precise for polynomials of order 10.} +\PYG{n}{Ord} \PYG{n}{CustomRightHandSide1}\PYG{o}{:}\PYG{o}{:}\PYG{n}{value}\PYG{p}{(}\PYG{n}{Ord} \PYG{n}{x}\PYG{p}{,} \PYG{n}{Ord} \PYG{n}{y}\PYG{p}{)} \PYG{k}{const} +\PYG{p}{\PYGZob{}} + \PYG{k}{return} \PYG{n}{Ord}\PYG{p}{(}\PYG{l+m+mi}{10}\PYG{p}{)}\PYG{p}{;} +\PYG{p}{\PYGZcb{}} +\end{Verbatim} + +\item {} +Note that there is no \textbf{clone} method here. That is because these classes - mathematical functions - are used in OpenMP paralell blocks only inside methods of already cloned class instances - like Form::value() etc. + +\end{itemize} + +\end{description} + + +\subsection{Filters} +\label{src/hermesOO:filters} +There is a number of pre-defined Filters for you in: + +\begin{Verbatim}[commandchars=\\\{\}] +hermes2d\PYGZbs{}include\PYGZbs{}function\PYGZbs{}filter.h +\end{Verbatim} +\begin{description} +\item[{These include}] \leavevmode\begin{itemize} +\item {} +AngleFilter + +\item {} +VonMisesFilter + +\item {} +LinearFilter + +\item {} +ValFilter + +\item {} +MagFilter + +\item {} +... + +\end{itemize} + +\end{description} + +They all come from the base class template Filter\textless{}Scalar\textgreater{}. + +Underneath there is a distinction between the filters that come from the classes SimpleFilter or DXDYFilter (real function of real solutions, or complex one of complex) and those coming from ComplexFilter (real function of complex solutions). + +The difference is obvious, the Solution\textless{}Scalar\textgreater{} template instances it operates with differ: for SimpleFilter / DXDYFilter successors, the type (real vs. complex) depends on the type of the filter, and in the case of ComplexFilter successors it is always: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{MeshFunction}\PYG{o}{\PYGZlt{}}\PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZgt{}}\PYG{o}{*} \PYG{n}{solution} +\end{Verbatim} + +Also note that whereas SimpleFilter / DXDYFilter are class \textbf{templates} - as explained in the previous paragraph, the ComplexFilter is just a class, and it inherits from Filter\textless{}double\textgreater{}. + +SimpleFilter serves for functions of the solutions(s) values, DXDYFilter for functions of the solution(s) derivatives. + +The common method all filters must override is: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{k}{virtual} \PYG{n}{MeshFunction}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar}\PYG{o}{\PYGZgt{}}\PYG{o}{*} \PYG{n}{clone}\PYG{p}{(}\PYG{p}{)} \PYG{k}{const} +\end{Verbatim} + +Then there is always the method \textbf{filter\_fn(...)} that comes in the following versions: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{c+c1}{// SimpleFilter \PYGZhy{} values here represent the solution values, n is the number of points.} +\PYG{k}{virtual} \PYG{k+kt}{void} \PYG{n}{filter\PYGZus{}fn}\PYG{p}{(}\PYG{k+kt}{int} \PYG{n}{n}\PYG{p}{,} \PYG{k}{const} \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{vector}\PYG{o}{\PYGZlt{}}\PYG{k}{const} \PYG{n}{Scalar}\PYG{o}{*}\PYG{o}{\PYGZgt{}}\PYG{o}{\PYGZam{}} \PYG{n}{values}\PYG{p}{,} \PYG{n}{Scalar}\PYG{o}{*} \PYG{n}{result}\PYG{p}{)} \PYG{o}{=} \PYG{l+m+mi}{0}\PYG{p}{;} + +\PYG{c+c1}{// DXDYFilter \PYGZhy{} contains values, dx \PYGZhy{} derivatives w.r.t. x, dy \PYGZhy{} derivatives w.r.t. y,} +\PYG{c+c1}{// and also the resulting derivatives, should those be necessary.} +\PYG{k}{virtual} \PYG{k+kt}{void} \PYG{n}{filter\PYGZus{}fn} \PYG{p}{(}\PYG{k+kt}{int} \PYG{n}{n}\PYG{p}{,} \PYG{k}{const} \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{vector}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar} \PYG{o}{*}\PYG{o}{\PYGZgt{}}\PYG{o}{\PYGZam{}} \PYG{n}{values}\PYG{p}{,} \PYG{k}{const} \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{vector}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar} \PYG{o}{*}\PYG{o}{\PYGZgt{}}\PYG{o}{\PYGZam{}} \PYG{n}{dx}\PYG{p}{,} \PYG{k}{const} \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{vector}\PYG{o}{\PYGZlt{}}\PYG{n}{Scalar} \PYG{o}{*}\PYG{o}{\PYGZgt{}}\PYG{o}{\PYGZam{}} \PYG{n}{dy}\PYG{p}{,} \PYG{n}{Scalar}\PYG{o}{*} \PYG{n}{rslt}\PYG{p}{,} \PYG{n}{Scalar}\PYG{o}{*} \PYG{n}{rslt\PYGZus{}dx}\PYG{p}{,} \PYG{n}{Scalar}\PYG{o}{*} \PYG{n}{rslt\PYGZus{}dy}\PYG{p}{)} \PYG{o}{=} \PYG{l+m+mi}{0}\PYG{p}{;} + +\PYG{c+c1}{// ComplexFilter \PYGZhy{} values here represent the solution values, n is the number of points,} +\PYG{c+c1}{// note that here, the values are complex.} +\PYG{k}{virtual} \PYG{k+kt}{void} \PYG{n}{filter\PYGZus{}fn}\PYG{p}{(}\PYG{k+kt}{int} \PYG{n}{n}\PYG{p}{,} \PYG{k}{const} \PYG{n}{std}\PYG{o}{:}\PYG{o}{:}\PYG{n}{complex}\PYG{o}{\PYGZlt{}}\PYG{k+kt}{double}\PYG{o}{\PYGZgt{}}\PYG{o}{*} \PYG{n}{values}\PYG{p}{,} \PYG{k+kt}{double}\PYG{o}{*} \PYG{n}{result}\PYG{p}{)} \PYG{o}{=} \PYG{l+m+mi}{0}\PYG{p}{;} +\end{Verbatim} + + +\chapter{Extended documentation} +\label{src/documentation-extended:extended-documentation}\label{src/documentation-extended::doc} + +\section{Hermes Documentation overview} +\label{src/documentation:hermes-documentation-overview}\label{src/documentation::doc} + +\subsection{Building user documentation (this one) in HTML} +\label{src/documentation:building-user-documentation-this-one-in-html} +Before building User Documentation, install the Python Sphinx package: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n+nl}{Linux:} \PYG{n}{sudo} \PYG{n}{apt}\PYG{o}{\PYGZhy{}}\PYG{n}{get} \PYG{n}{install} \PYG{n}{python}\PYG{o}{\PYGZhy{}}\PYG{n}{sphinx} +\PYG{n+nl}{Windows:} \PYG{n}{download} \PYG{n}{Python} \PYG{p}{(}\PYG{n}{http}\PYG{o}{:}\PYG{c+c1}{//python.org), download setup tools (http://pypi.python.org/pypi/setuptools), adjust PATH env. variable} +\end{Verbatim} + +The user documentation can be found in the directory doc/. Type ``make html'' there +to build it. The HTML pages can then be displayed by typing: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{firefox} \PYG{n}{\PYGZus{}build}\PYG{o}{/}\PYG{n}{html} +\end{Verbatim} + +or using another web browser. + + +\subsection{Building user documentation (this one) in PDF} +\label{src/documentation:building-user-documentation-this-one-in-pdf} +In the directory doc/ type ``make latex'' and you will be instructed how to build +the PDF: + +\begin{Verbatim}[commandchars=\\\{\}] +Build finished; the LaTeX files are in \PYGZus{}build/latex. +Run {}`make all\PYGZhy{}pdf\PYGZsq{} or {}`make all\PYGZhy{}ps\PYGZsq{} in that directory to run these through (pdf)latex. +\end{Verbatim} + + +\subsection{Developer Documentation (in Doxygen)} +\label{src/documentation:developer-documentation-in-doxygen} +The documentation is accessible online. +\begin{quote} + +\href{http://hpfem.org/~hermes/hermes/hermes\_common/doc/html/index.html}{Hermes - common code}. + +\href{http://hpfem.org/~hermes/hermes/hermes2d/doc/html/index.html}{Hermes - 2D specific code}. +\end{quote} + +In order to build developers documentation, install Doxygen: + +\begin{Verbatim}[commandchars=\\\{\}] +Linux: sudo apt\PYGZhy{}get install doxygen +Windows: {}`\PYGZlt{}http://ftp.stack.nl/pub/users/dimitri/doxygen\PYGZhy{}1.8.2\PYGZhy{}setup.exe\PYGZgt{}{}`\PYGZus{}. +\end{Verbatim} + +There are separate Doxygen files for hermes-common (dimension-independent functionality +such as matrix solvers) and for Hermes2D. To build the former, go to the directory +hermes-common/ and type ``doxygen Doxyfile''. The HTML docs will be located in a new +subfolder doc/html/ and you can view them in any web browser, such as: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{firefox} \PYG{n}{doc}\PYG{o}{/}\PYG{n}{html}\PYG{o}{/}\PYG{n}{index}\PYG{p}{.}\PYG{n}{html} +\end{Verbatim} + +To build Doxygen files for Hermes2D, go to the directory hermes2d/ and type again +``doxygen Doxyfile''. The HTML docs will be located in the file doc/html/index.html. + + +\subsection{Other Resources} +\label{src/documentation:other-resources} +See the section ``Citing Hermes'' in this document for a representative selection of +books and scientific papers about Hermes. A more complete overview of publications +about Hermes and adaptive \emph{hp}-FEM can be found in the \href{http://hpfem.org/people/}{publications section}. +at hpfem.org. The most recent list is probably the one +on \href{http://hpfem.org/~pavel/public/papers.html}{Pavel Solin's publications page}. + + +\section{Hermes Tutorial} +\label{src/documentation-tutorial::doc}\label{src/documentation-tutorial:hermes-tutorial} + +\subsection{Getting the repository with tutorial code} +\label{src/documentation-tutorial:getting-the-repository-with-tutorial-code} +To get the hermes-tutorial repository, clone: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{clone} \PYG{n}{git}\PYG{o}{:}\PYG{c+c1}{//github.com/hpfem/hermes\PYGZhy{}tutorial.git} +\end{Verbatim} + +After cloning, go to hermes-tutorial/doc folder and type ``make'' in the doc/ directory. + +Please refer to the documentation there for the instructions how to install the tutorial in the hermes-tutorial repository and for +the step-by-step tutorials descriptions. + + +\section{Examples Documentation} +\label{src/documentation-examples::doc}\label{src/documentation-examples:examples-documentation} + +\subsection{Getting the repository with examples code} +\label{src/documentation-examples:getting-the-repository-with-examples-code} +To get the hermes-examples repository, clone: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{clone} \PYG{n}{git}\PYG{o}{:}\PYG{c+c1}{//github.com/hpfem/hermes\PYGZhy{}examples.git} +\end{Verbatim} + +After cloning, go to hermes-examples/doc folder and type ``make'' in the doc/ directory. + +Please refer to the documentation there for the instructions how to install the examples in the hermes-examples repository and for +the step-by-step examples descriptions. + + +\chapter{Collaboration} +\label{src/collaboration:collaboration}\label{src/collaboration::doc} + +\section{Collaboration via Github} +\label{src/collaboration:collaboration-via-github} +The following is a very simple primer on Github and Git whose objective is +to show you how to effortlessly download Hermes and eventually contribute +to the project by creating an interesting example, fixing a bug, improving +documentation, etc. We begin with creating a free account at Github, fork +the Hermes git repository, clone your Github copy to your local computer, +and continue through setting up the .gitconfig file, creating a new branch, +committing changes, pushing them to your Github repository, and generating +a pull request. Some good references for further reading are given after +that. + + +\subsection{Create a Free Github Account} +\label{src/collaboration:create-a-free-github-account} +Go to the \href{http://github.com}{Github home page}. Click on ``Plans, Pricing and Signup'' +and then on ``Create a free account''. You'll be asked to enter your username, email, +and a password. That's it, it does not take much time, and it is free for open source +projects. + + +\subsection{Fork the Hermes Git Repository} +\label{src/collaboration:fork-the-hermes-git-repository} +Enter your account using the ``Login'' link in the upper right corner. Type +``hpfem'' into the search line in the upper right corner and hit enter. You +will see a list of several repositories and one of them will be ``hpfem / hermes''. +Click on it and this will bring you to the \href{http://github.com/hpfem/hermes}{Hermes page at Github}. +Click on the ``Fork'' button in the upper part of the page. This will create a copy +of the Hermes repository in your Github account, establish important links to +the master Hermes repository, and add you to the Hermes network. + + +\subsection{Generate and Register Your Public SSH Key} +\label{src/collaboration:generate-and-register-your-public-ssh-key} +Start by generating the public ssh key typing (on Linux): +\begin{quote} + +ssh-keygen +\end{quote} + +You will be asked to enter a file for the key to be stored, and +a passphrase. The passphrase may be left empty. After the file with +the key is generated, open it in some text editor. Then return to your +Github page, click on ``Account Settings'', and on ``SSH Public Keys''. +This is where you need to paste the public key that you just generated +on your computer. + + +\subsection{Download Hermes to Your Local Computer} +\label{src/collaboration:download-hermes-to-your-local-computer} +Once your public SSH key is registered at Github, you can +clone the Hermes repository from your Github account to +your local computer. This is done by typing: + +\begin{Verbatim}[commandchars=\\\{\}] +git clone git@github.com:your\PYGZus{}name/hermes.git +\end{Verbatim} + +Now you can build Hermes as described in the Installation +section above. + +In the next paragraphs we describe how to work inside +the Hermes Git repository on your local computer. + + +\subsection{Create the .gitconfig File} +\label{src/collaboration:create-the-gitconfig-file} +The .gitconfig file can be used to define your identity +for git as well as useful abbreviations. Change dir to your +home directory. Then adjust and save the following as +``\textasciitilde{}/.gitconfig'': + +\begin{Verbatim}[commandchars=\\\{\}] +[user] + name = Pavel Solin + email = solin.pavel@gmail.com + +[core] + editor = vim + +[color] + ui = true +[color \PYGZdq{}branch\PYGZdq{}] + current = yellow reverse + local = yellow + remote = green +[color \PYGZdq{}diff\PYGZdq{}] + meta = yellow bold + frag = magenta bold + old = red bold + new = green bold + whitespace = red reverse +[color \PYGZdq{}status\PYGZdq{}] + added = yellow + changed = green + untracked = cyan +[core] + whitespace=fix,\PYGZhy{}indent\PYGZhy{}with\PYGZhy{}non\PYGZhy{}tab,trailing\PYGZhy{}space,cr\PYGZhy{}at\PYGZhy{}eol + +[alias] + st = status + ci = commit + br = branch + co = checkout + df = diff + lg = log \PYGZhy{}p +\end{Verbatim} + + +\subsection{Create a Local Branch} +\label{src/collaboration:create-a-local-branch} +Change dir back to hermes/hermes2d/ or hermes/hermes3d/ +where you were before. Whenever you want to do any changes, such as modify +an existing example or create a new one, always create a local branch - +do not work in the master branch. + +You can get an overview of existing branches by typing: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{branch} +\end{Verbatim} + +This will show you something like this: +\begin{quote} +\begin{figure}[htbp] +\centering + +\scalebox{0.600000}{\includegraphics{terminal-git.png}} +\end{figure} +\end{quote} + +If this is your first time, then you will see +just the master branch with the star next to it, +which tells you that there are no other branches. + +A new branch is created by typing: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{co} \PYG{o}{\PYGZhy{}}\PYG{n}{b} \PYG{n}{test}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1} +\end{Verbatim} + +where test-1 is the name of your new local branch. Now you +can do any changes you like and you do not have to be afraid +of damaging your master branch. HOWEVER, you always must +commit your changes as described below. +Unless you commit your changes, Git does not +know that they belong to your local branch. This may cause +conflicts, you may not be able to update your local repository, +you may not be able to switch branches at all, etc. + + +\subsection{Commit Your Changes} +\label{src/collaboration:commit-your-changes} +Say that you modified an existing or added a new +file ``file.cpp''. In order to register the new changes, +type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{add} \PYG{n}{file}\PYG{p}{.}\PYG{n}{cpp} +\end{Verbatim} + +You can do this with as many files as you like. Use the +command: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{diff} +\end{Verbatim} + +to see whether you have unregistered changes. If all +your changes are registered, the command will print +nothing. + +After all your changes are registered, type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{commit} +\end{Verbatim} + +This will invoke a basic text editor +where you will be asked to enter a one-line comment +describing your changes. Without this line, +your commit will not be accepted. + + +\subsection{Push the Changes to Your Github Account} +\label{src/collaboration:push-the-changes-to-your-github-account} +You cannot push to the master repository +of Hermes directly. The way to get your changes there +is to first push them to your Github fork and then send +a pull request to the Hermes network. To push your +changes, type: + +\begin{Verbatim}[commandchars=\\\{\}] +git push git@github.com:your\PYGZus{}name/hermes.git test\PYGZhy{}1:test\PYGZhy{}1 +\end{Verbatim} + +This will push your local branch test-1 to a branch of the +same name at Github. Now you can go back to your Github account, +click on ``Commits'' and you should see your changes there. + + +\subsection{Send a Pull Request} +\label{src/collaboration:send-a-pull-request} +In order to submit your changes to the Hermes network, +click on the button ``Pull request'' in the upper right +part of your Github page. +Describe the changes you did in the text window that +appears. On the right you can see +a list of people who wil be notified about your changes. +You can preview your pull request by clicking on +``Preview'' above the text window. The source and target +branch are displayed above the text window and you can +change them when you click on them. When you are ready, +click on ``Send pull request''. + +For more details on pull requests visit \href{http://help.github.com/pull-requests/}{this page}. + + +\subsection{Switching Branches} +\label{src/collaboration:switching-branches} +Before changing to a different branch in your +local repository, type: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{status} +\end{Verbatim} + +You will see something like this: +\begin{quote} +\begin{figure}[htbp] +\centering + +\scalebox{0.600000}{\includegraphics{terminal-git-2.png}} +\end{figure} +\end{quote} + +The green font tells you that git has the latest +version of the file. All modified files in red +need to be added using ``git add''. It is a good +idea to go through the untracked files too, in case +that you wish to add some of them as well. +Related to the sample screenshot above, after +typing: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{add} \PYG{n}{src}\PYG{o}{/}\PYG{n}{intro}\PYG{o}{\PYGZhy{}}\PYG{l+m+mf}{2.}\PYG{n}{rst} +\PYG{n}{git} \PYG{n}{st} +\end{Verbatim} + +you will see +\begin{quote} +\begin{figure}[htbp] +\centering + +\scalebox{0.600000}{\includegraphics{terminal-git-3.png}} +\end{figure} +\end{quote} + +Now you can proceed with ``git commit'' as described above. +After the commit, you can switch to a different branch +by typing: + +\begin{Verbatim}[commandchars=\\\{\}] +\PYG{n}{git} \PYG{n}{co} \PYG{n}{branch}\PYG{o}{\PYGZhy{}}\PYG{n}{name} +\end{Verbatim} + + +\subsection{Further Reading} +\label{src/collaboration:further-reading} +Git and Github are very powerful tools and we covered just a tiny part +of the story. After you familiarize yourself with the contents of +this simple primer, read more in \href{http://progit.org/book/}{Pro Git}. + +Also watch this \href{http://www.youtube.com/watch?v=OFkgSjRnay4}{YouTube video}. +by Scott Chacon. + +Good luck and let us know if you think that this document could be improved! + +\renewcommand{\indexname}{Index} +\printindex +\end{document} diff --git a/doc/HermesFlyer.jpg b/doc/HermesFlyer.jpg new file mode 100644 index 0000000000..53dffc9ca2 Binary files /dev/null and b/doc/HermesFlyer.jpg differ diff --git a/doc/HermesPresentation.pdf b/doc/HermesPresentation.pdf new file mode 100644 index 0000000000..0581372f11 Binary files /dev/null and b/doc/HermesPresentation.pdf differ diff --git a/doc/_build/html/_images/HermesFlyer.jpg b/doc/_build/html/_images/HermesFlyer.jpg new file mode 100644 index 0000000000..5a4da28f9f Binary files /dev/null and b/doc/_build/html/_images/HermesFlyer.jpg differ diff --git a/doc/_static/HermesFlyer.jpg b/doc/_static/HermesFlyer.jpg new file mode 100644 index 0000000000..5a4da28f9f Binary files /dev/null and b/doc/_static/HermesFlyer.jpg differ diff --git a/doc/conf.py b/doc/conf.py index a28d95d81f..91be50276d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -207,9 +207,9 @@ # built documents. # # The short X.Y version. -version = '2.0' +version = '3.1' # The full version, including alpha/beta/rc tags. -release = '2.0' +release = '3.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/exts/latexcode.pyc b/doc/exts/latexcode.pyc index 4381a74b89..3a5f44a8b5 100644 Binary files a/doc/exts/latexcode.pyc and b/doc/exts/latexcode.pyc differ diff --git a/doc/exts/math_dollar.pyc b/doc/exts/math_dollar.pyc index ebf341e349..b3177b0aec 100644 Binary files a/doc/exts/math_dollar.pyc and b/doc/exts/math_dollar.pyc differ diff --git a/doc/exts/popup.pyc b/doc/exts/popup.pyc index e2e1308029..cf63cc4a13 100644 Binary files a/doc/exts/popup.pyc and b/doc/exts/popup.pyc differ diff --git a/doc/exts/sourcecode.pyc b/doc/exts/sourcecode.pyc index 31d2599a8b..27d66e884a 100644 Binary files a/doc/exts/sourcecode.pyc and b/doc/exts/sourcecode.pyc differ diff --git a/doc/exts/youtube.pyc b/doc/exts/youtube.pyc index cdf8b1dc02..8a5728b66c 100644 Binary files a/doc/exts/youtube.pyc and b/doc/exts/youtube.pyc differ diff --git a/doc/index.rst b/doc/index.rst index 8a1f2ea73d..4a55ac7980 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -2,6 +2,17 @@ Hermes =============== +.. only:: html + + .. raw:: html + +
+ + _images/HermesFlyer.jpg + +
+ + .. toctree:: :maxdepth: 4 @@ -10,4 +21,4 @@ Hermes src/installation src/documentation-start src/documentation-extended - src/collaboration + src/collaboration \ No newline at end of file diff --git a/doc/src/about-hermes.rst b/doc/src/about-hermes.rst index 2612a1f5ad..8ee851e553 100644 --- a/doc/src/about-hermes.rst +++ b/doc/src/about-hermes.rst @@ -3,16 +3,14 @@ About Hermes Hermes is a free C++ library for rapid development of adaptive *hp*-FEM and *hp*-DG solvers for partial differential equations (PDE) -and multiphysics PDE systems. The development team includes the -`hp-FEM group `_ at the `University of Nevada, Reno `_ -and their `collaborators `_ -from numerous places around the globe. +and multiphysics PDE systems. The development team now includes mostly the department of Theory of Electrical Engineering at the University of West Bohemia in Pilsen (contact: korous@rice.zcu.cz), in the past the main development was done by the `hp-FEM group `_ at the `University of Nevada, Reno `_. +Information about further collaborators from numerous places around the globe can be found at ``_. A standard way to use Hermes is to write short C++ user programs that use the functionality provided by the library, but for those who prefer to use a graphical interface, the group located at the -University of West Bohemia develops a graphical Engineering tool based on Hermes2D: -`Agros2D `_. +University of West Bohemia also develops a graphical Engineering tool based on Hermes2D: +`Agros2D `_. .. figure:: img/agros.png :align: center diff --git a/doc/src/citing-hermes.rst b/doc/src/citing-hermes.rst index b1b5121bb0..501a85f8c0 100644 --- a/doc/src/citing-hermes.rst +++ b/doc/src/citing-hermes.rst @@ -346,10 +346,8 @@ If you use Hermes for your work, please be so kind to include some of the refere .. only:: html - Other papers that may be still closer to what you need can be found in the `publications section `_ of the hp-FEM group home page or on `Pavel Solin's home page `_. + Other papers that may be still closer to what you need can be found in the `citing section `_ of the hp-FEM group home page. .. only:: latex - Other papers that may be still closer to what you need can be found in the `publications section - `_ of the hp-FEM group home page or on `Pavel Solin's home page - `_. + Other papers that may be still closer to what you need can be found in the `citing section `_ of the hp-FEM group home page. diff --git a/doc/src/collaboration.rst b/doc/src/collaboration.rst index 09e271ddf2..4b90a8011e 100644 --- a/doc/src/collaboration.rst +++ b/doc/src/collaboration.rst @@ -54,7 +54,7 @@ Once your public SSH key is registered at Github, you can clone the Hermes repository from your Github account to your local computer. This is done by typing:: - git clone git@github.com:your_name/hermes.git + git clone https://github.com/your_name/hermes.git Now you can build Hermes as described in the Installation section above. @@ -179,7 +179,7 @@ is to first push them to your Github fork and then send a pull request to the Hermes network. To push your changes, type:: - git push git@github.com:your_name/hermes.git test-1:test-1 + git push https://github.com/your_name/hermes.git test-1:test-1 This will push your local branch test-1 to a branch of the same name at Github. Now you can go back to your Github account, @@ -250,17 +250,7 @@ Git and Github are very powerful tools and we covered just a tiny part of the story. After you familiarize yourself with the contents of this simple primer, read more in `Pro Git `_. -Also watch this `YouTube video `_ +Also watch this `YouTube video `_. by Scott Chacon. -Good luck and let us know if you think that this document could be improved! - - - - - - - - - - +Good luck and let us know if you think that this document could be improved! \ No newline at end of file diff --git a/doc/src/documentation.rst b/doc/src/documentation.rst index aa965fc4be..294f7a1cb7 100644 --- a/doc/src/documentation.rst +++ b/doc/src/documentation.rst @@ -32,15 +32,15 @@ Developer Documentation (in Doxygen) ------------------------------------ The documentation is accessible online. - `Hermes - common code `_ + `Hermes - common code `_. - `Hermes - 2D specific code `_ + `Hermes - 2D specific code `_. In order to build developers documentation, install Doxygen:: Linux: sudo apt-get install doxygen - Windows: http://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.2-setup.exe + Windows: ``_. There are separate Doxygen files for hermes-common (dimension-independent functionality such as matrix solvers) and for Hermes2D. To build the former, go to the directory @@ -58,7 +58,7 @@ Other Resources See the section "Citing Hermes" in this document for a representative selection of books and scientific papers about Hermes. A more complete overview of publications -about Hermes and adaptive *hp*-FEM can be found in the `publications section `_ +about Hermes and adaptive *hp*-FEM can be found in the `publications section `_. at hpfem.org. The most recent list is probably the one on `Pavel Solin's publications page `_. diff --git a/doc/src/getting_started.rst b/doc/src/getting_started.rst index 878d4a9ce6..b7fe0dd06c 100644 --- a/doc/src/getting_started.rst +++ b/doc/src/getting_started.rst @@ -21,6 +21,7 @@ If something is not clear enough from the comments in the code, please see the s These examples (located in hermes2d/test_examples) are:: + 00-quickShow 01-poisson 02-poisson-newton 03-navier-stokes @@ -28,11 +29,15 @@ These examples (located in hermes2d/test_examples) are:: 05-hcurl-adapt 06-system-adapt 07-newton-heat-rk - 08-eigenvalue + 08-nonlinearity 09-trilinos-nonlinear 10-linear-advection-dg-adapt - 11-FCT - 12-transient-adapt + 11-transient-adapt + 12-picard + 13-FCT + 14-error-calculation + 15-adaptivity-matrix-reuse-simple + 16-adaptivity-matrix-reuse-layer-interior And these examples are well-documented showcase examples of how to use Hermes. diff --git a/doc/src/hermes2d/img/presentation.jpg b/doc/src/hermes2d/img/presentation.jpg new file mode 100644 index 0000000000..e63a3d88ea Binary files /dev/null and b/doc/src/hermes2d/img/presentation.jpg differ diff --git a/doc/src/hermes2d/img/redRow.jpg b/doc/src/hermes2d/img/redRow.jpg new file mode 100644 index 0000000000..0fecf1e52b Binary files /dev/null and b/doc/src/hermes2d/img/redRow.jpg differ diff --git a/doc/src/hermesOO.rst b/doc/src/hermesOO.rst index 9e65f23d52..9149bf773f 100644 --- a/doc/src/hermesOO.rst +++ b/doc/src/hermesOO.rst @@ -1,6 +1,10 @@ Hermes C++ object model - deriving your own specialized classes --------------------------------------------------------------- +.. admonition:: DOXYGEN documentation + + Anything that is written here can be much faster and in much more complex way read and understood from the Doxygen documentation - please, please, use it - many an hour has been spent to make Doxygen documentation a useful resource for programmers. + There are several classes that represent some piece of the whole FEM discretization and calculation process that hold the custom informaion for a specific problem. Be sure to have checked the section "Typical example" that will give you an idea of the basics. This section is more technically focused. @@ -47,6 +51,8 @@ In the implementation of your programs, you need to subclass (or derive from) th class MyWeakForm : public WeakForm +What is necessary to say is that WeakForm is usually passed by means of shared pointers, using class template WeakFormSharedPtr (see examples for how to use this). + The important methods and attributes to note in this class are: - the constructor WeakForm(unsigned int neq = 1, bool mat_free = false) @@ -258,15 +264,14 @@ The common method all filters must override is:: Then there is always the method **filter_fn(...)** that comes in the following versions:: // SimpleFilter - values here represent the solution values, n is the number of points. - virtual void filter_fn(int n, Hermes::vector values, Scalar* result) = 0; + virtual void filter_fn(int n, const std::vector& values, Scalar* result) = 0; // DXDYFilter - contains values, dx - derivatives w.r.t. x, dy - derivatives w.r.t. y, // and also the resulting derivatives, should those be necessary. - virtual void filter_fn (int n, Hermes::vector values, Hermes::vector dx, Hermes::vector dy, Scalar* rslt, Scalar* rslt_dx, Scalar* rslt_dy) = 0; + virtual void filter_fn (int n, const std::vector& values, const std::vector& dx, const std::vector& dy, Scalar* rslt, Scalar* rslt_dx, Scalar* rslt_dy) = 0; // ComplexFilter - values here represent the solution values, n is the number of points, // note that here, the values are complex. - virtual void filter_fn(int n, std::complex* values, double* result) = 0; - - + virtual void filter_fn(int n, const std::complex* values, double* result) = 0; + \ No newline at end of file diff --git a/doc/src/img/HermesFlyer.jpg b/doc/src/img/HermesFlyer.jpg new file mode 100644 index 0000000000..5a4da28f9f Binary files /dev/null and b/doc/src/img/HermesFlyer.jpg differ diff --git a/doc/src/installation/linux.rst b/doc/src/installation/linux.rst index 01ed98cb94..bd6382a2ed 100644 --- a/doc/src/installation/linux.rst +++ b/doc/src/installation/linux.rst @@ -4,35 +4,29 @@ Linux Download and compilation ~~~~~~~~~~~~~~~~~~~~~~~~ -If you are using a Debian-based system, install the (required) libraries first: +.. figure:: ../hermes2d/img/redRow.jpg + :align: center + :scale: 100% + :figclass: align-center -.. sourcecode:: - . +.. admonition:: [NEW] - debian packages on Launchpad - apt-get install git git-core cmake g++ gfortran freeglut3-dev libsuitesparse-dev libglew1.5-dev libxerces-c-dev xsdcxx libmatio-dev + You can download a package directly from ``_. -.. latexcode:: - . +.. figure:: ../hermes2d/img/redRow.jpg + :align: center + :scale: 100% + :figclass: align-center - apt-get install cmake g++ gfortran freeglut3-dev libsuitesparse-dev libglew1.5-dev +The rest of the instructions here are for building Hermes from source. -If you want to use fast saving / loading of Hermes entities, install +If you are using a Debian-based system, install the (required) libraries first:: - - BSON - - - Clone the BSON Mongo driver git repository from git@github.com:l-korous/mongo-c-driver.git (if you don't know how, here is a tip: `Getting a Git Repository `_) - - Compile and install using 'make install' - -For thread caching memory allocator from Google, see - - - TCMalloc - - - Get TCMalloc from the SVN repository at http://code.google.com/p/gperftools/source/checkout - - Make & install + apt-get install git git-core cmake g++ freeglut3-dev libsuitesparse-dev libglew-dev libxerces-c-dev xsdcxx libmatio-dev gfortran To obtain the source code, clone the Git repository from Github:: - git clone git://github.com/hpfem/hermes.git + git clone https://github.com/hpfem/hermes.git These two repositories are synchronized. For more advanced users we recommend to create a free account at `Github `_ (if you do not have one yet), @@ -42,33 +36,33 @@ your local copy and the master repository, and you'll become part of the Hermes network at Github. Once you have a local copy of the Hermes repository on your computer, change dir -to hermes/. There you will find a CMakeLists.txt file that contains the lines:: +to hermes/. There you will find a CMake.vars.example.Linux file that looks like this:: - # OpenMP - # "-1" stands for using as many threads as is the number of available cores. - # Please be aware that the variable OMP_NUM_THREADS, that is often used for this purpose, is ignored. - set(NUM_THREADS -1) - - # HermesCommon - set(HERMES_COMMON_DEBUG YES) - set(HERMES_COMMON_RELEASE YES) - ... + # LINUX + # On linux, there should be no need to set up *_ROOT directories, in the default settings, they all point to /usr/local, as should be true on Debian systems. + # We mainly support gcc and CLang compilers with C++11 support. + + # BASIC CONFIGURATION + + # Global + # Generate static libs (instead of dynamic) + set(HERMES_STATIC_LIBS NO) + # Target path + set(CMAKE_INSTALL_PREFIX "/usr/local") - # Hermes2D: - set(WITH_H2D YES) - set(H2D_DEBUG YES) - set(H2D_RELEASE YES) - # Optional parts of the library. - set(H2D_WITH_GLUT YES) - ... + # Paths for compulsory dependencies + set(XERCES_ROOT "/usr/local") + set(XSD_ROOT "/usr/local") - set(WITH_SUPERLU NO) - ... + # HermesCommon + + # Release and debug versions + set(HERMES_COMMON_DEBUG YES) + set(HERMES_COMMON_RELEASE YES) + ... -Create a file called "CMake.vars" where you set all -these variables according to your needs. Examples of CMake.vars files can -be found in the CMakeVars folder. +Copy this file to "CMake.vars" and set the variables according to your needs. After that, type:: cmake . @@ -93,12 +87,26 @@ In Eclipse: - Browse where your build tree is and select the root build tree directory. - Keep "Copy projects into workspace" unchecked. +Optional external packages +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +[OPTIONAL] If you want to use fast saving / loading of Hermes entities, install + + - BSON + + - Clone the BSON Mongo driver git repository from https://github.com/l-korous/mongo-c-driver.git (if you don't know how, here is a tip: `Getting a Git Repository `_) + - Compile and install using 'make install' + +[OPTIONAL] For thread caching memory allocator from Google, see + + - TCMalloc + + - Get TCMalloc from the SVN repository at ``_. + - Make & install Install Hermes ~~~~~~~~~~~~~~ :: - cmake -DCMAKE_INSTALL_PREFIX=~/usr . - make make install diff --git a/doc/src/installation/mac.rst b/doc/src/installation/mac.rst index 7f3d6e85f8..230087c785 100644 --- a/doc/src/installation/mac.rst +++ b/doc/src/installation/mac.rst @@ -19,7 +19,7 @@ application which allows you to easily install and manage UNIX libraries and applications on your Mac) by doing the following: (a) Download and install MacPorts from - http://www.macports.org/install.php. + ``_. (b) Do 'sudo port install suitesparse glew'. (c) If you don't already have git installed, do 'sudo port install git'. @@ -31,7 +31,7 @@ above. Change to the directory where you want to download the Hermes source and clone the git repository either from the hpfem.org server:: - git clone http://git.hpfem.org/git/hermes.git + git clone ``_. or from Github:: diff --git a/doc/src/installation/matrix_solvers/mumps.rst b/doc/src/installation/matrix_solvers/mumps.rst index 6fc87a42e6..d5851df904 100644 --- a/doc/src/installation/matrix_solvers/mumps.rst +++ b/doc/src/installation/matrix_solvers/mumps.rst @@ -1,9 +1,7 @@ Mumps ----- -.. _MUMPS home page: http://graal.ens-lyon.fr/MUMPS/index.php -.. _solvers repository: https://github.com/hpfem/solvers -.. _manual: https://github.com/hpfem/solvers/raw/master/manuals/MUMPS_4.9.2.pdf +.. _MUMPS home page: ``_. Linux ~~~~~ @@ -11,17 +9,15 @@ Linux Using standard Debian packages ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -For sequential version, install packages `libmumps-seq-4.9.2` and `libmumps-seq-dev`. -For parallel version, install `libmumps-4.9.2` and `libmumps-dev`. Newer versions -may be available. In Ubuntu 6.06 (Dapper) -or newer, you can use the Synaptic package manager for that, or type:: +For sequential version, install package `libmumps-seq-dev`. +For parallel version, install `libmumps-dev` (this will require some changes in Hermes CMake configuration). In Ubuntu, you can use the Synaptic package manager for that, or type:: - sudo apt-get install libmumps-seq-4.9.2 libmumps-seq-dev + sudo apt-get install libmumps-seq-dev for the sequential version and :: - sudo apt-get install libmumps-4.9.2 libmumps-dev + sudo apt-get install libmumps-dev for the parallel one. @@ -30,7 +26,7 @@ following line (or append to the existing one):: set(WITH_MUMPS YES) -Finally execute:: +Finally execute (first line is deleting the CMake cache just to be sure we have a clean build):: rm CMakeCache.txt cmake . @@ -45,10 +41,10 @@ Installation of MUMPS using MSVC is rather easy: - preparation - - download MUMPS from http://mumps.enseeiht.fr/MUMPS_4.10.0.tar.gz (if the link does not work, look for 4.10 version of MUMPS) - - download WinMUMPS utility from http://sourceforge.net/projects/winmumps/ - - download a Fortran compiler (e.g. http://software.intel.com/en-us/intel-fortran-studio-xe-evaluation-options) - - download BLAS (Debug/Release, static/dynamic, 32-bit/64-bit as you like) from http://icl.cs.utk.edu/lapack-for-windows/lapack/index.html#libraries + - download MUMPS from ``_. + - download a Fortran compiler (e.g. ``_. + - download BLAS (Debug/Release, static/dynamic, 32-bit/64-bit as you like) from ``_. - you have to have Visual Studio version >= 2008 - you have to have Python 2.6 or 2.7 available diff --git a/doc/src/installation/matrix_solvers/paralution.rst b/doc/src/installation/matrix_solvers/paralution.rst index dd3b7c595b..d8550cb614 100644 --- a/doc/src/installation/matrix_solvers/paralution.rst +++ b/doc/src/installation/matrix_solvers/paralution.rst @@ -1,25 +1,32 @@ PARALUTION -------- +---------- -.. _PARALUTION home page: http://www.paralution.com +1. Download PARALUTION from ``_. +2. Compile, build PARALUTION, and copy headers, and libraries so that Hermes's CMake system can find them (as with other dependencies) + + 1. On Linux, installing PARALUTION to default install directories is sufficient, on Windows some paths have to be set + +3. In your CMake.vars file (or directly in CMakeLists.txt) in the root of Hermes (see step 0) add "set(WITH_PARALUTION YES)" + + 1. It is on by default, so by default one has to include PARALUTION to build Hermes + +4. That is it, build Hermes, it will automatically link to PARALUTION, include headers and make it usable. -1) Download PARALUTION from http://www.paralution.com/ -2) Compile, build PARALUTION, and copy headers, and libraries so that Hermes's CMake system can find them (as with other dependencies) -2.1) On Linux, installing PARALUTION to default install directories is sufficient, on Windows some paths have to be set -3) In your CMake.vars file (or directly in CMakeLists.txt) in the root of Hermes (see step 0) add "set(WITH_PARALUTION YES)" -3.1) It is on by default, so by default one has to include PARALUTION to build Hermes -4) That is it, build Hermes, it will automatically link to PARALUTION, include headers and make it usable. How to use PARALUTION --------------- -5) Read the doxygen manual of the classes -5.1) Hermes::Algebra::ParalutionMatrix -5.2) Hermes::Algebra::ParalutionVector -5.3) Hermes::Preconditioners::ParalutionPrecond -5.4) Hermes::Solvers::IterativeParalutionLinearMatrixSolver -5.5) Hermes::Solvers::AMGParalutionLinearMatrixSolver -5.6) and all classes that these inherit from -6) If you want to see Hermes & PARALUTION readily work together, take any test example in the /hermes2d folder in the Hermes root and add one of these lines at the beginning of your main() -6.1) HermesCommonApi.set_integral_param_value(matrixSolverType, SOLVER_PARALUTION_ITERATIVE); // to use iterative solver -6.2) HermesCommonApi.set_integral_param_value(matrixSolverType, SOLVER_PARALUTION_AMG); // to use AMG solver -7) Solver classes of Hermes (NewtonSolver, PicardSolver, LinearSolver, ...) will then take this API setting into account and use PARALUTION as the matrix solver. \ No newline at end of file +--------------------- +5. Read the doxygen manual of the classes + + 1. Hermes::Algebra::ParalutionMatrix + 2. Hermes::Algebra::ParalutionVector + 3. Hermes::Preconditioners::ParalutionPrecond + 4. Hermes::Solvers::IterativeParalutionLinearMatrixSolver + 5. Hermes::Solvers::AMGParalutionLinearMatrixSolver + 6. and all classes that these inherit from / use + +6. If you want to see Hermes & PARALUTION readily work together, take any test example in the /hermes2d folder in the Hermes root and add one of these lines at the beginning of your main() + + 1. HermesCommonApi.set_integral_param_value(matrixSolverType, SOLVER_PARALUTION_ITERATIVE); // to use iterative solver + 2. HermesCommonApi.set_integral_param_value(matrixSolverType, SOLVER_PARALUTION_AMG); // to use AMG solver + +7. Solver classes of Hermes (NewtonSolver, PicardSolver, LinearSolver, ...) will then take this API setting into account and use PARALUTION as the matrix solver. \ No newline at end of file diff --git a/doc/src/installation/matrix_solvers/petsc.rst b/doc/src/installation/matrix_solvers/petsc.rst index 2aaa9f5d3d..1be62b3298 100644 --- a/doc/src/installation/matrix_solvers/petsc.rst +++ b/doc/src/installation/matrix_solvers/petsc.rst @@ -1,9 +1,7 @@ PETSc ----- -.. _PETSc home page: http://www.mcs.anl.gov/petsc/ -.. _solvers repository: https://github.com/hpfem/solvers -.. _manual: https://github.com/hpfem/solvers/raw/master/manuals/petsc.pdf +.. _PETSc home page: ``_. Linux ~~~~~ @@ -22,7 +20,21 @@ following line (or append to the existing one):: set(WITH_PETSC YES) -Finally execute:: +Finally execute + +[OPTIONAL] If you want to use fast saving / loading of Hermes entities, install + + - BSON + + - Clone the BSON Mongo driver git repository from https://github.com/l-korous/mongo-c-driver.git (if you don't know how, here is a tip: `Getting a Git Repository `_) + - Compile and install using 'make install' + +[OPTIONAL] For thread caching memory allocator from Google, see + + - TCMalloc + + - Get TCMalloc from the SVN repository at ``_. + - Make & install:: rm CMakeCache.txt cmake . diff --git a/doc/src/installation/matrix_solvers/superlu.rst b/doc/src/installation/matrix_solvers/superlu.rst index b592c05528..6ac13920f9 100644 --- a/doc/src/installation/matrix_solvers/superlu.rst +++ b/doc/src/installation/matrix_solvers/superlu.rst @@ -1,13 +1,9 @@ SuperLU -------- -.. _SuperLU home page: http://crd.lbl.gov/~xiaoye/SuperLU/ -.. _solvers repository: https://github.com/hpfem/solvers -.. _manual: https://github.com/hpfem/solvers/raw/master/manuals/SuperLU.pdf - Hermes currently supports two versions of the SuperLU library - the sequential one and the multithreaded one. Support for the MPI version will be added in the -future. Please visit the `SuperLU home page`_ for more information about the +future. Please visit ``_ for more information about the library. Linux @@ -28,7 +24,21 @@ following lines (or append to the existing one):: set(SUPERLU_ROOT ~/solvers/superlu_mt) #(or your own installation destination) set(SUPERLU_MT NO) -Finally execute:: +Finally execute + +[OPTIONAL] If you want to use fast saving / loading of Hermes entities, install + + - BSON + + - Clone the BSON Mongo driver git repository from https://github.com/l-korous/mongo-c-driver.git (if you don't know how, here is a tip: `Getting a Git Repository `_) + - Compile and install using 'make install' + +[OPTIONAL] For thread caching memory allocator from Google, see + + - TCMalloc + + - Get TCMalloc from the SVN repository at ``_. + - Make & install:: rm CMakeCache.txt cmake . diff --git a/doc/src/installation/matrix_solvers/trilinos.rst b/doc/src/installation/matrix_solvers/trilinos.rst index 052d613399..254803c701 100644 --- a/doc/src/installation/matrix_solvers/trilinos.rst +++ b/doc/src/installation/matrix_solvers/trilinos.rst @@ -1,9 +1,7 @@ Trilinos -------- -.. _Trilinos home page: http://trilinos.sandia.gov/ -.. _solvers repository: https://github.com/hpfem/solvers -.. _manual: https://github.com/hpfem/solvers/raw/master/manuals/Trilinos10.6Tutorial.pdf +.. _Trilinos home page: ``_. Linux ~~~~~ @@ -21,7 +19,21 @@ following line (or append to the existing one):: set(WITH_TRILINOS YES) -Finally execute:: +Finally execute + +[OPTIONAL] If you want to use fast saving / loading of Hermes entities, install + + - BSON + + - Clone the BSON Mongo driver git repository from https://github.com/l-korous/mongo-c-driver.git (if you don't know how, here is a tip: `Getting a Git Repository `_) + - Compile and install using 'make install' + +[OPTIONAL] For thread caching memory allocator from Google, see + + - TCMalloc + + - Get TCMalloc from the SVN repository at ``_. + - Make & install:: rm CMakeCache.txt cmake . @@ -31,21 +43,22 @@ Find more about :ref:`ref-usage-trilinos`. Windows ~~~~~~~ -First of all - to build Trilinos, one needs CLAPACK (see the optional package in the library installation documentation). +First of all - to build Trilinos, one needs LAPACK (CLAPACK) (see the optional package in the library installation documentation). -| Download the sources for the latest version from the `Trilinos page `__ and unpack them in some temporary directory. +| Download the sources for the latest version from the `Trilinos page `__ and unpack them in some temporary directory. | | Go to the Trilinos source directory. | -| In the following, replace {CLAPACK_DIR}, {TPL_BLAS_LIBRARIES} with the full path to your clapack-3.2.1-CMAKE directory and blas.lib filepath without any quotes. -| Also, replace {CMAKE_INSTALL_PREFIX} with either your dependency root, or any other folder where you want to install Trilinos packages.:: +| In the following, replace {TPL_LAPACK_LIBRARIES}, {TPL_BLAS_LIBRARIES} with the full path to your lapack.lib and blas.lib without any quotes. +| Also, replace {CMAKE_INSTALL_PREFIX} with either your dependency root, or any other folder where you want to install Trilinos packages. +:: mkdir build_dir cd build_dir cmake \ -D CMAKE_BUILD_TYPE:STRING=DEBUG \ - -D CLAPACK_DIR:STRING=d:\\hpfem\\hermes\\dependencies\\install\\clapack-3.2.1-CMAKE \ + -D TPL_LAPACK_LIBRARIES:FILEPATH=d:\\hpfem\\hermes\\dependencies\\lib\\lapack.lib \ -D TPL_BLAS_LIBRARIES:FILEPATH=d:\\hpfem\\hermes\\dependencies\\lib\\blas.lib \ -D CMAKE_Fortran_FLAGS:STRING="-fPIC" \ -D Trilinos_ENABLE_ALL_PACKAGES:BOOL=OFF \ diff --git a/doc/src/installation/matrix_solvers/umfpack.rst b/doc/src/installation/matrix_solvers/umfpack.rst index 3c395db3a4..e0189474fe 100644 --- a/doc/src/installation/matrix_solvers/umfpack.rst +++ b/doc/src/installation/matrix_solvers/umfpack.rst @@ -1,7 +1,7 @@ UMFpack ------- -.. _UMFPack home page: http://www.cise.ufl.edu/research/sparse/umfpack/ +.. _UMFPack home page: ``_. Linux ~~~~~ @@ -18,7 +18,21 @@ following lines (or append to the existing one):: set(WITH_UMFPACK YES) -and execute:: +and execute + +[OPTIONAL] If you want to use fast saving / loading of Hermes entities, install + + - BSON + + - Clone the BSON Mongo driver git repository from https://github.com/l-korous/mongo-c-driver.git (if you don't know how, here is a tip: `Getting a Git Repository `_) + - Compile and install using 'make install' + +[OPTIONAL] For thread caching memory allocator from Google, see + + - TCMalloc + + - Get TCMalloc from the SVN repository at ``_. + - Make & install:: rm CMakeCache.txt cmake . diff --git a/doc/src/installation/win.rst b/doc/src/installation/win.rst index 46c23d001c..4176224e2b 100644 --- a/doc/src/installation/win.rst +++ b/doc/src/installation/win.rst @@ -1,11 +1,30 @@ Windows ---------- -These installation instructions have been tested with Microsoft Visual Studio 2005, 2008, 2010, 2012, and with MinGW +Download and compilation +~~~~~~~~~~~~~~~~~~~~~~~~ -- Probably with small modifications, they should also work for NMake -- If you would like to use NMake and you run in troubles, drop us a line to `Hermes2D mailing list `_. -- On windows, a crucial file to edit is CMake.vars.example (see further). +.. figure:: ../hermes2d/img/redRow.jpg + :align: center + :scale: 100% + :figclass: align-center + +.. admonition:: [NEW] - prebuilt binaries + + You can download both the dependency libraries and header files, as well as Hermes libraries and header files from ``_. + +.. figure:: ../hermes2d/img/redRow.jpg + :align: center + :scale: 100% + :figclass: align-center + +The rest of the instructions here are for building Hermes from source. + +To obtain the source code, clone the Git repository from Github:: + + git clone https://github.com/hpfem/hermes.git + +[IMPORTANT] As Hermes uses features of C++11 (such as initializer lists, nullptr_t, etc.), the only Visual Studio family compiler you can use is Visual Studio 2013 (both Express and 'Full' versions). Dependency check-list - overview ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -50,14 +69,14 @@ Please note that e.g. TCMalloc, BSON, UMFPACK are also 'optional', but to get th - XERCES - - Download Xerces 3.1.1 source code from http://xerces.apache.org/xerces-c/download.cgi. + - Download Xerces 3.1.1 source code from ``_. - Build using your favorite compiler. - Copy all bin files to 'bin' dependencies directory - Copy all header files to 'include' dependencies directory - Copy the lib files to 'lib' dependencies directory - XSD - - Download XSD library from http://www.codesynthesis.com/download/xsd/3.3/windows/i686/xsd-3.3.0-i686-windows.zip, instructions how to build the library are available at http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio. + - Download XSD library from http://www.codesynthesis.com/download/xsd/3.3/windows/i686/xsd-3.3.0-i686-windows.zip, instructions how to build the library are available at ``_. - Copy all bin files to 'bin' dependencies directory - Copy all header files to 'include' dependencies directory @@ -82,13 +101,13 @@ Please note that e.g. TCMalloc, BSON, UMFPACK are also 'optional', but to get th - - The rest is optional. If a directive WITH_BSON is *not* used, this step including all sub-steps can be skipped and you can proceed to `build Hermes `_. + - The rest is optional. If a directive WITH_BSON is *not* used, this step including all sub-steps can be skipped and you can proceed to "**Building Hermes**". - MATIO (1.5.2) - - Download HDF5 `_. + - Download HDF5 ``_. - Install HDF5, note the path (you will need it for MATIO) - - Download MATIO from `_. + - Download MATIO from ``_. - Open the sln file in the folder visual_studio - Add to the Include Directories under the libmatio project settings the directory where you installed HDF5's headers - Add to the Libraries Directories under the libmatio project settings the directory where you installed HDF5's libs @@ -98,9 +117,9 @@ Please note that e.g. TCMalloc, BSON, UMFPACK are also 'optional', but to get th - BSON - - Clone the BSON Mongo driver git repository from git@github.com:l-korous/mongo-c-driver.git (if you don't know how, here is a tip:`Getting a Git Repository `_) + - Clone the BSON Mongo driver git repository from https://github.com/l-korous/mongo-c-driver.git (if you don't know how, here is a tip:`Getting a Git Repository `_) - - Download SCONS build tool from http://sourceforge.net/projects/scons/files/latest/download?source=files + - Download SCONS build tool from ``_. - Install SCONS (you need to have PYTHON installed for that), run it (e.g. issuing C:\Python27\Scripts\scons.bat) in the BSON Mongo driver root directory - Use flags --m32 and --c99 ("C:\Python27\Scripts\scons.bat --c99 --m32") @@ -110,7 +129,7 @@ Please note that e.g. TCMalloc, BSON, UMFPACK are also 'optional', but to get th - TCMalloc - - Get TCMalloc from the SVN repository at http://code.google.com/p/gperftools/source/checkout + - Get TCMalloc from the SVN repository at ``_. - Open gperftools.sln in your Visual Studio, build the appropriate version (default works fine - just select Debug/Release) - Copy Win32\"Release/Debug"\libtcmalloc_minimal.dll to 'bin' dependency directory, Win32\"Release/Debug"\libtcmalloc_minimal.lib to 'lib' dependency directory - Copy the contents of src/google to 'include' dependency directory @@ -146,7 +165,7 @@ Please note that e.g. TCMalloc, BSON, UMFPACK are also 'optional', but to get th - CLAPACK - First, you need to install CLAPACK/CBLAS: - - Download the file clapack-3.2.1-CMAKE.tgz from http://www.netlib.org/clapack/. + - Download the file clapack-3.2.1-CMAKE.tgz from ``_. - Use cmake to configure and build the debug version of clapack. - Copy '\\clapack-3.2.1-CMAKE\\BLAS\\SRC\\Debug\\blas.lib', '\\clapack-3.2.1-CMAKE\\F2CLIBS\\libf2c\\Debug\\libf2c.lib', and '\\clapack-3.2.1-CMAKE\\SRC\\Debug\\lapack.lib' to 'lib' dependency directory. - Copy the contains of '\\clapack-3.2.1-CMAKE\\INCLUDE\\' to 'include' dependency directory. @@ -173,7 +192,7 @@ Dependency check-list - 64-bit - XERCES - - Download Xerces 3.1.1 source code from http://xerces.apache.org/xerces-c/download.cgi. + - Download Xerces 3.1.1 source code from ``_. - Build using your favorite compiler for 64-bit. - Copy all bin files to 'bin' dependencies directory - Copy all header files to 'include' dependencies directory @@ -181,7 +200,7 @@ Dependency check-list - 64-bit - XSD - - Download XSD library from http://www.codesynthesis.com/download/xsd/3.3/windows/i686/xsd-3.3.0-i686-windows.zip, instructions how to build the library are available at http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio. + - Download XSD library from http://www.codesynthesis.com/download/xsd/3.3/windows/i686/xsd-3.3.0-i686-windows.zip, instructions how to build the library are available at ``_. - Build the x64 version - Copy all bin files to 'bin' dependencies directory - Copy all header files to 'include' dependencies directory @@ -200,7 +219,7 @@ Dependency check-list - 64-bit - Download glew x64 precompiled binaries (http://glew.sourceforge.net/) and unpack it. - Copy 'my_glew_root\\bin\\glew32.dll', 'my_glew_root\\include\\GL\\\*.h', and 'my_glew_root\\lib\\glew32.lib' to 'bin', 'include\\GL', and 'lib' dependency directories respectively. - - The rest is optional. If a directive WITH_BSON is *not* used, this step including all sub-steps can be skipped and you can proceed to `build Hermes `_. + - The rest is optional. If a directive WITH_BSON is *not* used, this step including all sub-steps can be skipped and you can proceed to "**Building Hermes**". - MATIO (1.5.2) @@ -208,15 +227,15 @@ Dependency check-list - 64-bit - TCMalloc - - Get TCMalloc from the SVN repository at http://code.google.com/p/gperftools/source/checkout + - Get TCMalloc from the SVN repository at ``_. - Open gperftools.sln in your Visual Studio, build the appropriate version (default works fine - just select Debug/Release) - Copy x64\"Release/Debug"\libtcmalloc_minimal.dll to 'bin' dependency directory, x64\"Release/Debug"\libtcmalloc_minimal.lib to 'lib' dependency directory - Copy the contents of src/google to 'include' dependency directory - BSON - - Clone the BSON Mongo driver git repository from git@github.com:l-korous/mongo-c-driver.git (if you don't know how, here is a tip:`Getting a Git Repository `_) - - Download SCONS build tool from http://sourceforge.net/projects/scons/files/latest/download?source=files + - Clone the BSON Mongo driver git repository from ``_ (if you don't know how, here is a tip:`Getting a Git Repository `_) + - Download SCONS build tool from ``_. - Install SCONS (you need to have PYTHON installed for that), run it (e.g. issuing C:\Python27\Scripts\scons.bat) in the BSON Mongo driver root directory - Use the flag --c99 ("C:\Python27\Scripts\scons.bat --c99") @@ -229,34 +248,16 @@ Building Hermes In order to build the library and examples, you need to: - Prepare dependecy libraries, see 'Dependency Check-list'. - - Copy a file 'CMake.vars.example' to 'CMake.vars'. The file contains settings for the project. - - Modify the file 'CMake.vars'. For example, you - could set the first line as:: + - Copy the file 'CMake.vars.example.Windows' to 'CMake.vars'. The file contains settings for the project. + - In the root Hermes directory, generate project files by running CMAKE from a command prompt:: - set(DEP_ROOT "../dependencies") + cmake . -G "Visual Studio 12" # MSVC2013 as the generator - - In the root Hermes directory, to create project files by running CMAKE from a command prompt:: - - cmake . -G "Visual Studio 8 2005" # MSVC2005 user - cmake . -G "Visual Studio 9 2008" # MSVC2008 user - cmake . -G "Visual Studio 10" # MSVC2010 user - cmake . -G "Visual Studio 11" # MSVC2012 user - cmake . -G "MinGW Makefiles" # MinGW user - - If you have Cygwin installed, your might have an error "Coulld not create named generator Visual Studio 10". This is because your + If you have Cygwin installed, your might have an error "Could not create named generator Visual Studio 12". This is because your cmake path is contaminated by Cygwin's cmake. Try to use absolute path for windows cmake.exe. - Open the SLN file 'hermes.sln' and build Hermes. -Configuration options -~~~~~~~~~~~~~~~~~~~~~ - - Hermes is configured through preprocessor directives. Directives are generated by CMAKE and your settings might be overriden by CMAKE. The directives are: - - - H2D_WITH_GLUT : If the line in your CMake.vars "set(H2D_WITH_GLUT NO)" is uncommented, it excludes GLUT-dependant parts. This replaces viewers with an empty implementation that does nothing if invoked. If used, the library 'freeglut.lib' does not need to be linked. - - - H2D_WITH_TEST_EXAMPLES : Produce project files for the test examples, which are a quick hands-on introduction to how Hermes works. - Using Hermes ~~~~~~~~~~~~ diff --git a/doc/src/intro.rst b/doc/src/intro.rst index e299ec35f2..b7a484c55c 100644 --- a/doc/src/intro.rst +++ b/doc/src/intro.rst @@ -13,7 +13,7 @@ with emphasis on nonlinear, time-dependent, multi-physics problems. This document is organized as follows: * Section 1 provides general information about Hermes and the computational methods it uses, - and how to install Hermes on various hardware platforms. + and how to install Hermes on various platforms. * Section 2 is the Getting Started Guide - to get you started in no time. * Section 3 is the extended documentation section, you will find developers documentation in Doxygen, as well as step-by-step user documentation in tutorials and advanced examples. diff --git a/doc/src/introOOP.rst b/doc/src/introOOP.rst index 03a05b19c0..557c177eb3 100644 --- a/doc/src/introOOP.rst +++ b/doc/src/introOOP.rst @@ -4,6 +4,6 @@ Introduction to advanced C++ object-oriented features There is plenty of material on the internet that is concerned with advanced C++. This list was put together in February, 2013 - - http://www.cs.utexas.edu/~jbsartor/cs105/CS105_spr10_lec8.pptx.pdf - - http://www.cs.ust.hk/~dekai/library/ECKEL_Bruce - - http://www10.informatik.uni-erlangen.de/~pflaum/pflaum/ProSeminar/meta-art.html \ No newline at end of file + - ``_ + - ``_ + - ``_ \ No newline at end of file diff --git a/doc/src/introduction.rst b/doc/src/introduction.rst index 8da4ed2a87..a17174b384 100644 --- a/doc/src/introduction.rst +++ b/doc/src/introduction.rst @@ -5,3 +5,4 @@ Introduction :maxdepth: 2 intro + diff --git a/doc/src/introduction1.rst b/doc/src/introduction1.rst index 9ef7a1bc7a..29932d4716 100644 --- a/doc/src/introduction1.rst +++ b/doc/src/introduction1.rst @@ -6,4 +6,4 @@ Hermes Overview about-hermes math-background - citing-hermes + citing-hermes \ No newline at end of file diff --git a/doc/src/math-background.rst b/doc/src/math-background.rst index 938461a0aa..29db10e480 100644 --- a/doc/src/math-background.rst +++ b/doc/src/math-background.rst @@ -2,7 +2,7 @@ Mathematical Background ---------------------------------- The main strength of Hermes is a modern adaptive higher-order -finite element technology. +finite element technology combined with very easy-to-use implementation approaches. Features ~~~~~~~~ @@ -108,3 +108,31 @@ Same graphs as above but now in terms of CPU time: :figclass: align-center :alt: Image of incompressible viscous flow. + +Implementation point of view +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + * OpenMP parallelization + * C++ templates for unified handling of real and complex problems + * Own OpenGL visualization & VTK outputs of meshes, spaces, solutions + * User-friendly written easy-to-grasp code + * XML, BSON save / load of the most important classes + * Solvers interfaces: UMFPACK, PARALUTION, PETSc, MUMPS, … + * GMSH, ExodusII mesh formats + * Matlab, MatrixMarket matrix exports + * Well arranged doxygen documentation + * Exception safe API + + +Presentation about Hermes given at ESCO 2014 conference +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A number of presentations about Hermes have been given. + +.. figure:: hermes2d/img/presentation.jpg + :align: center + :scale: 70% + :figclass: align-center + :alt: Hermes presentation. + +Here is a link to one of them: ``_. diff --git a/doc/src/typical_example/calculation.rst b/doc/src/typical_example/calculation.rst index 388844958e..a93c6c02e5 100644 --- a/doc/src/typical_example/calculation.rst +++ b/doc/src/typical_example/calculation.rst @@ -6,9 +6,9 @@ This is to illustrate the various classes and methods, and the best thing about For details about time-dependent examples, and various aspects of that, see the 'hermes-tutorial' documentation, section 'C-transient'. For details about adaptive examples, and various aspects of that, see the 'hermes-tutorial' documentation, section 'D-adaptivity'. Right here we focus on the calculation:: - - double current_time = 'something'; - double current_time_step = 'also something'; + + double current_time = 'some number'; + double current_time_step = 'also some number'; Time-loop { Adaptive-loop // not necessarily on each time step. @@ -18,7 +18,7 @@ Right here we focus on the calculation:: Space* ref_space = construct_refined_space(&space); // WE ARE NOW HERE. - The calculation + // The calculation // WE ARE NOW HERE // do the adaptivity thing, see the adaptivity section of hermes-tutorial @@ -31,8 +31,8 @@ Right here we focus on the calculation:: // (stability conditions, time-adaptivity, ...). } -In the following, some parameters are supposed to be passed as 'const', and everywhere, where one can pass an instance of Space*, one can pass -an instance of Hermes::vector*> (Hermes::vector*>), if the problem is a system of equations. +In the following, basically everywhere where one can pass an instance of Space*, one can pass +an instance of std::vector*>, if the problem is a system of equations. We shall start from the simplest case. @@ -116,8 +116,8 @@ Again, pretty much the same as in the LinearSolver case, but the solve() method // "solver" is now an instance of RungeKutta. solver.set_time(current_time); solver.set_time_tep(current_time_step); - // Yes! You are right, these can be used outside of the adaptivity loop! + // Yes! You are right, these can be used outside of the adaptivity loop! // Set the new Space. solver.set_space(ref_space); diff --git a/doc/src/typical_example/mesh.rst b/doc/src/typical_example/mesh.rst index 4176d1e61f..77e246dd79 100644 --- a/doc/src/typical_example/mesh.rst +++ b/doc/src/typical_example/mesh.rst @@ -4,12 +4,17 @@ First part one needs to handle is the computational mesh, typically the followin // Shared pointers are used for easier memory handling. MeshSharedPtr mesh(new Mesh); - // Native Hermes mesh format. + + // Either: Native Hermes mesh format. MeshReaderH2D mloader; mloader.load("domain.mesh", mesh); - // XML Hermes mesh format. + // Or: XML Hermes mesh format. MeshReaderH2DXML mloader; mloader.load("domain.xml", mesh); -More about meshes can be found in the 'hermes-tutorial' documentation, section 'A-linear', chapter '01-mesh'. \ No newline at end of file + // Or: BSON (Binary JSON) format for fast binary load/save - used primarily in Agros. + MeshReaderH2DBSON mloader; + mloader.load("domain.bson", mesh); + +More about meshes can be found in the 'hermes-tutorial' documentation, section 'A-linear', chapter '01-mesh' and in the **Doxygen documentation**. \ No newline at end of file diff --git a/doc/src/typical_example/space.rst b/doc/src/typical_example/space.rst index 9e82256d61..cfb5fedb7e 100644 --- a/doc/src/typical_example/space.rst +++ b/doc/src/typical_example/space.rst @@ -10,7 +10,7 @@ Secondly, the Finite Element space must be set on the computational mesh. One of // This is a custom (derived) boundary condition. More about this in the section // 'Object model - deriving your own specialized classes'. CustomDirichletCondition bc_essential( - Hermes::vector("Bottom", "Inner", "Outer", "Left"), + std::vector({"Bottom", "Inner", "Outer", "Left"}), BDY_A_PARAM, BDY_B_PARAM, BDY_C_PARAM); // Initialize the container to pass the boundary conditions to the Space. @@ -25,7 +25,7 @@ Secondly, the Finite Element space must be set on the computational mesh. One of // Initialize boundary conditions. Hermes::Hermes2D::DefaultEssentialBCConst > bc_essential - (Hermes::vector("Corner_horizontal", "Corner_vertical"), 0); + (std::vector({"Corner_horizontal", "Corner_vertical"}), 0); EssentialBCs > bcs(&bc_essential); // Create an Hcurl space. @@ -41,6 +41,6 @@ Secondly, the Finite Element space must be set on the computational mesh. One of // constant basis functions. SpaceSharedPtr space(new L2Space(mesh, 0)); -More about spaces can be found in the 'hermes-tutorial' documentation, section 'A-linear', chapter '02-space'. +More about spaces can be found in the 'hermes-tutorial' documentation, section 'A-linear', chapter '02-space' and in the **Doxygen documentation**. More about Dirichlet boundary conditions can be found in the 'hermes-tutorial' documentation, section 'A-linear', chapter '04-bc-dirichlet', and for defining a non-constant custom boundary condition, see the chapter '07-general'. diff --git a/doc/src/typical_example/weak_formulation.rst b/doc/src/typical_example/weak_formulation.rst index 214d6ac4db..ac6a59475a 100644 --- a/doc/src/typical_example/weak_formulation.rst +++ b/doc/src/typical_example/weak_formulation.rst @@ -3,12 +3,12 @@ Weak formulation When we already have a mesh and a space, we have to know what equations we will be solving on those. And that is where the weak formulation comes to the light. Of course, there is a vast mathematical background of differential equations, their weak solutions, Sobolev spaces, etc., but we assume of those, our users already have a good knowledge. Right here we are concerned with the implementation. A typical creation of a weak formulation for the use with Hermes might look like this:: - // Initialize the weak formulation. + // Initialize the weak formulation (strictly speaking, shared pointer to the weak formulation) // This is a weak formulation for linear elasticity, with custom // parameters of the constructor. // There is a lot of documentation for using some predefined // weak forms, as well as creating your own. See the info below. - CustomWeakFormLinearElasticity wf(E, nu, rho*g1, "Top", f0, f1); + WeakFormSharedPtr wf(new CustomWeakFormLinearElasticity(E, nu, rho*g1, "Top", f0, f1)); More about a typical basic weak form can be found in the 'hermes-tutorial' documentation, section 'A-linear', chapter '03-poisson'. @@ -62,14 +62,14 @@ In this constructor:: In those, the main methods to override are value(...), and ord(...), calculating the value and integration order respectively. It is a good idea to refer to the default forms (located in the library repository, with headers in hermes2d/include/weakform_library/*.h and the sources in hermes2d/src/weakform_library/*.cpp). The header is pretty self-explanatory:: - // MatrixForm. + // MatrixFormVol - MatrixFormSurf differs in the use of GeomSurf instead of GeomVol. virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; // A typical implementation. template Scalar DefaultMatrixFormVol::value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar result = 0; @@ -77,10 +77,10 @@ The header is pretty self-explanatory:: result += wt[i] * coeff->value(e->x[i], e->y[i]) * u->val[i] * v->val[i]; } - // VectorForm. - // Identical to MatrixForm, only the basis function is missing for obvious reasons. + // VectorFormVol - VectorFormSurf differs in the use of GeomSurf instead of GeomVol. + // Identical to MatrixFormVol, only the basis function is missing for obvious reasons. virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; In these:: @@ -103,9 +103,10 @@ In these:: // the test function, represented by the class Func. // For more info about the class, see the developers documentation (in doxygen). - Geom *e + GeomVol *e // geometry attributes: coordinates, element size, // normal directions (for surface forms), you name it. + // - this is for volumetric forms (for surface forms one uses GeomSurf). // For more info about the class, see the developers documentation (in doxygen). Func **ext diff --git a/hermes2d/CMakeLists.txt b/hermes2d/CMakeLists.txt index 470707de33..1390f414aa 100644 --- a/hermes2d/CMakeLists.txt +++ b/hermes2d/CMakeLists.txt @@ -91,6 +91,7 @@ project(hermes2d) include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR}/include) include_directories(${PROJECT_SOURCE_DIR}/include/form) + include_directories(${PROJECT_SOURCE_DIR}/include/discrete_problem) include_directories(${PROJECT_SOURCE_DIR}/include/space) include_directories(${PROJECT_SOURCE_DIR}/include/mesh) include_directories(${PROJECT_SOURCE_DIR}/include/boundary_conditions) @@ -172,7 +173,6 @@ project(hermes2d) src/views/mesh_view.cpp src/views/order_view.cpp src/views/scalar_view.cpp - #src/views/stream_view.cpp src/views/vector_base_view.cpp src/views/vector_view.cpp src/views/view.cpp @@ -188,7 +188,7 @@ project(hermes2d) src/weakform_library/weakforms_maxwell.cpp src/weakform_library/weakforms_neutronics.cpp - src/discrete_problem.cpp + src/discrete_problem/discrete_problem.cpp src/discrete_problem/discrete_problem_helpers.cpp src/discrete_problem/discrete_problem_selective_assembler.cpp src/discrete_problem/discrete_problem_thread_assembler.cpp @@ -205,6 +205,7 @@ project(hermes2d) src/solver/runge_kutta.cpp src/adapt/adapt.cpp + src/adapt/adapt_solver.cpp src/adapt/kelly_type_adapt.cpp src/adapt/error_calculator.cpp src/adapt/error_thread_calculator.cpp @@ -280,7 +281,6 @@ project(hermes2d) src/views/mesh_view.cpp src/views/order_view.cpp src/views/scalar_view.cpp - #src/views/stream_view.cpp src/views/vector_base_view.cpp src/views/vector_view.cpp src/views/view.cpp @@ -323,7 +323,7 @@ project(hermes2d) SOURCE_GROUP( "Source Files\\Discrete Problem" FILES - src/discrete_problem.cpp + src/discrete_problem/discrete_problem.cpp src/discrete_problem/discrete_problem_helpers.cpp src/discrete_problem/discrete_problem_selective_assembler.cpp src/discrete_problem/discrete_problem_thread_assembler.cpp @@ -336,6 +336,7 @@ project(hermes2d) SOURCE_GROUP( "Source Files\\Adaptivity" FILES src/adapt/adapt.cpp + src/adapt/adapt_solver.cpp src/adapt/kelly_type_adapt.cpp src/adapt/error_calculator.cpp src/adapt/error_thread_calculator.cpp @@ -367,7 +368,6 @@ project(hermes2d) include/asmlist.h include/forms.h include/neighbor_search.h - include/sub_element_map.h include/norm_form.h include/spline.h include/quadrature/limit_order.h @@ -387,6 +387,7 @@ project(hermes2d) include/mesh/curved.h include/mesh/mesh_reader_exodusii.h include/mesh/hash.h + include/mesh/mesh_reader.h include/mesh/mesh_reader_h2d.h include/mesh/mesh_reader_h2d_bson.h include/mesh/mesh_reader_h2d_xml.h @@ -418,13 +419,13 @@ project(hermes2d) include/views/mesh_view.h include/views/order_view.h include/views/scalar_view.h - #include/views/stream_view.h include/views/vector_base_view.h include/views/vector_view.h include/views/view.h include/views/view_support.h include/views/thread_linearizer.h include/views/linearizer.h + include/views/linearizer_utils.h include/views/orderizer.h include/weakform_library/weakforms_elasticity.h @@ -434,7 +435,7 @@ project(hermes2d) include/weakform_library/weakforms_maxwell.h include/weakform_library/weakforms_neutronics.h - include/discrete_problem.h + include/discrete_problem/discrete_problem.h include/discrete_problem/discrete_problem_helpers.h include/discrete_problem/discrete_problem_selective_assembler.h include/discrete_problem/discrete_problem_thread_assembler.h @@ -451,6 +452,7 @@ project(hermes2d) include/solver/runge_kutta.h include/adapt/adapt.h + include/adapt/adapt_solver.h include/adapt/kelly_type_adapt.h include/adapt/error_calculator.h include/adapt/error_thread_calculator.h @@ -474,7 +476,6 @@ project(hermes2d) include/asmlist.h include/forms.h include/neighbor_search.h - include/sub_element_map.h include/norm_form.h include/spline.h include/quadrature/limit_order.h @@ -510,6 +511,7 @@ project(hermes2d) include/mesh/curved.h include/mesh/mesh_reader_exodusii.h include/mesh/hash.h + include/mesh/mesh_reader.h include/mesh/mesh_reader_h2d.h include/mesh/mesh_reader_h2d_bson.h include/mesh/mesh_reader_h2d_xml.h @@ -530,13 +532,13 @@ project(hermes2d) include/views/mesh_view.h include/views/order_view.h include/views/scalar_view.h - #include/views/stream_view.h include/views/vector_base_view.h include/views/vector_view.h include/views/view.h include/views/view_support.h include/views/thread_linearizer.h include/views/linearizer.h + include/views/linearizer_utils.h include/views/orderizer.h ) @@ -570,7 +572,7 @@ project(hermes2d) SOURCE_GROUP( "Header Files\\Discrete Problem" FILES - include/discrete_problem.h + include/discrete_problem/discrete_problem.h include/discrete_problem/discrete_problem_helpers.h include/discrete_problem/discrete_problem_selective_assembler.h include/discrete_problem/discrete_problem_thread_assembler.h @@ -583,6 +585,7 @@ project(hermes2d) SOURCE_GROUP( "Header Files\\Adaptivity" FILES include/adapt/adapt.h + include/adapt/adapt_solver.h include/adapt/kelly_type_adapt.h include/adapt/error_calculator.h include/adapt/error_thread_calculator.h @@ -619,13 +622,14 @@ project(hermes2d) set(_FLAGS ${BUILD_FLAGS}) set_target_properties(${HERMES_LIB} PROPERTIES COMPILE_FLAGS ${_FLAGS}) endif() - + target_link_libraries( ${HERMES_LIB} ${HERMES_COMMON_LIB} - ${GLUT_LIBRARY} ${GLEW_LIBRARY} ${PTHREAD_LIBRARY} + ${GLUT_LIBRARY} ${GL_LIBRARY} ${GLEW_LIBRARY} ${PTHREAD_LIBRARY} ${ANTTWEAKBAR_LIBRARY} ${XSD_LIBRARY} ${XERCES_LIBRARY} + ${LIBIBERTY_LIBRARY} ${PJLIB_LIBRARY} ${LAPACK_LIBRARY} ${CLAPACK_LIBRARY} ${BLAS_LIBRARY} @@ -683,11 +687,16 @@ project(hermes2d) install(FILES ${INC_DP} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/discrete_problem) install(FILES ${INC_DP_DG} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/discrete_problem/dg) install(FILES ${INC_SPACE} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/space) + install(FILES "include/space/space_h2d_xml.h" DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/space) install(FILES ${INC_MESH} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/mesh) + install(FILES "include/mesh/mesh_h1d_xml.h" DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/mesh) + install(FILES "include/mesh/mesh_h2d_xml.h" DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/mesh) + install(FILES "include/mesh/subdomains_h2d_xml.h" DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/mesh) install(FILES ${XSD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/xml_schemas) install(FILES ${INC_BC} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/boundary_conditions) install(FILES ${INC_SHAPESET} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/shapeset) install(FILES ${INC_FUNCTION} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/function) + install(FILES "include/function/solution_h2d_xml.h" DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/function) install(FILES ${INC_INTEGRALS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/integrals) install(FILES ${INC_LINEARIZER} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/linearizer) install(FILES ${INC_ADAPT} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes2d/adapt) diff --git a/hermes2d/Doxyfile b/hermes2d/Doxyfile index 88f98743d3..215b7648ab 100644 --- a/hermes2d/Doxyfile +++ b/hermes2d/Doxyfile @@ -687,7 +687,7 @@ HTML_OUTPUT = html # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. -HTML_FILE_EXTENSION = .php +HTML_FILE_EXTENSION = .html HTML_DYNAMIC_SECTIONS = YES diff --git a/hermes2d/include/adapt/adapt.h b/hermes2d/include/adapt/adapt.h index d5c7e18602..05ba85e559 100644 --- a/hermes2d/include/adapt/adapt.h +++ b/hermes2d/include/adapt/adapt.h @@ -59,7 +59,7 @@ namespace Hermes /// The method add_refinement will return false as soon as the already processed refinements counted for AdaptStoppingCriterionCumulative::threshold /// of the total error. template - class HERMES_API AdaptStoppingCriterionCumulative : public AdaptivityStoppingCriterion + class HERMES_API AdaptStoppingCriterionCumulative : public AdaptivityStoppingCriterion < Scalar > { public: /// Constructor specifying the threshold (see description of threshold). @@ -79,7 +79,7 @@ namespace Hermes /// The method add_refinement will return false as soon as the particular element carries lower error than AdaptStoppingCriterionSingleElement::threshold /// times the maximum element error. template - class HERMES_API AdaptStoppingCriterionSingleElement : public AdaptivityStoppingCriterion + class HERMES_API AdaptStoppingCriterionSingleElement : public AdaptivityStoppingCriterion < Scalar > { public: /// Constructor specifying the threshold (see description of threshold). @@ -97,7 +97,7 @@ namespace Hermes /// The method add_refinement will return false as soon as the particular element carries significantly less error than the previous one in the descending sequence. /// Useful e.g. when we are more interested in overall solution quality than resolution of a steep singularity etc. template - class HERMES_API AdaptStoppingCriterionLevels : public AdaptivityStoppingCriterion + class HERMES_API AdaptStoppingCriterionLevels : public AdaptivityStoppingCriterion < Scalar > { public: /// Constructor specifying the threshold (see description of threshold). @@ -128,17 +128,19 @@ namespace Hermes public: /// Constructor. Suitable for problems where various solution components belong to different spaces (L2, H1, Hcurl, /// Hdiv). If proj_norms are not specified, they are defined according to the spaces. - Adapt(Hermes::vector > spaces, ErrorCalculator* error_calculator, AdaptivityStoppingCriterion* strategy = nullptr); + Adapt(std::vector > spaces, ErrorCalculator* error_calculator, AdaptivityStoppingCriterion* strategy = nullptr); Adapt(SpaceSharedPtr space, ErrorCalculator* error_calculator, AdaptivityStoppingCriterion* strategy = nullptr); Adapt(ErrorCalculator* error_calculator, AdaptivityStoppingCriterion* strategy = nullptr); - virtual ~Adapt(); ///< Destructor. Deallocates allocated private data. - void free(); ///< Deallocates allocated private data. + /// Destructor. Deallocates allocated private data. + virtual ~Adapt(); + /// Deallocates allocated private data. + void free(); /// Refines elements based on results from the ErrorCalculator class. /** * \param[in] refinement_selectors Vector of selectors. * \return True if no element was refined. In usual case, this indicates that adaptivity is not able to refine anything and the adaptivity loop should end. */ - bool adapt(Hermes::vector*> refinement_selectors); + bool adapt(std::vector*> refinement_selectors); /// Refines elements based on results from the ErrorCalculator class. /** @@ -159,7 +161,7 @@ namespace Hermes inline std::string getClassName() const { return "Adapt"; } /// Set spaces. - void set_spaces(Hermes::vector > spaces); + void set_spaces(std::vector > spaces); void set_space(SpaceSharedPtr space); /// Return the error mesh function - for postprocessing the information about which elements have been refined. @@ -170,7 +172,7 @@ namespace Hermes void set_defaults(); /// Initialization. - void init_adapt(Hermes::vector*>& refinement_selectors, ElementToRefine*** element_refinement_location, MeshSharedPtr* meshes); + void init_adapt(std::vector*>& refinement_selectors, ElementToRefine*** element_refinement_location, MeshSharedPtr* meshes); /// Return the number of element where a refinement will be sought. int calculate_attempted_element_refinements_count(); /// Handle meshes and spaces at the end of the routine. @@ -212,9 +214,9 @@ namespace Hermes int regularization; /// Meshes. - Hermes::vector meshes; + std::vector meshes; /// Spaces. - Hermes::vector > spaces; + std::vector > spaces; /// Error calculator. ErrorCalculator* errorCalculator; @@ -227,6 +229,7 @@ namespace Hermes MeshFunctionSharedPtr refinementInfoMeshFunction[H2D_MAX_COMPONENTS]; /// Mesh function for postprocessing the information about which elements have been refined - for the whole system. MeshFunctionSharedPtr refinementInfoMeshFunctionGlobal; + template friend class AdaptSolver; }; } } diff --git a/hermes2d/include/adapt/adapt_solver.h b/hermes2d/include/adapt/adapt_solver.h new file mode 100644 index 0000000000..cf81cb3d13 --- /dev/null +++ b/hermes2d/include/adapt/adapt_solver.h @@ -0,0 +1,227 @@ +// This file is part of Hermes2D. +// +// Hermes2D is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// Hermes2D 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 Hermes2D. If not, see . + +#ifndef __H2D_ADAPT_SOLVER_H +#define __H2D_ADAPT_SOLVER_H + +#include "adapt.h" +#include "error_calculator.h" +#include "../solver/linear_solver.h" +#include "../solver/newton_solver.h" +#include "../solver/picard_solver.h" +#include "../refinement_selectors/selector.h" +#include + +namespace Hermes +{ + namespace Hermes2D + { + class HERMES_API AdaptSolverCriterion + { + public: + AdaptSolverCriterion(); + virtual bool done(double error, unsigned short iteration) = 0; + }; + + class HERMES_API AdaptSolverCriterionErrorThreshold : public AdaptSolverCriterion + { + public: + AdaptSolverCriterionErrorThreshold(double error_threshold); + virtual bool done(double error, unsigned short iteration); + double error_threshold; + }; + + class HERMES_API AdaptSolverCriterionFixed : public AdaptSolverCriterion + { + public: + AdaptSolverCriterionFixed(unsigned short refinement_levels); + virtual bool done(double error, unsigned short iteration); + unsigned short refinement_levels; + }; + + /// h-, p-, hp-adaptivity + /// Also influences the selectors - i.e. for h-, or p- adaptivity + enum AdaptivityType + { + pAdaptivity, + hAdaptivity, + hpAdaptivity + }; + + /// A complete adaptivity solver class handling the matrix reuse. + /// \ingroup g_adapt + template + class HERMES_API AdaptSolver : + public Hermes::Mixins::TimeMeasurable, + public Hermes::Mixins::Loggable, + public Hermes::Mixins::StateQueryable + { + public: + /// Constructor. + AdaptSolver(std::vector > initial_spaces, WeakFormSharedPtr wf, ErrorCalculator* error_calculator, AdaptivityStoppingCriterion* stopping_criterion_single_step, std::vector*> selectors, AdaptSolverCriterion* stopping_criterion_global); + AdaptSolver(SpaceSharedPtr initial_space, WeakFormSharedPtr wf, ErrorCalculator* error_calculator, AdaptivityStoppingCriterion* stopping_criterion_single_step, RefinementSelectors::Selector* selector, AdaptSolverCriterion* stopping_criterion_global); + + /// Common code for the constructors. + void init(); + + /// Destruct this instance. + ~AdaptSolver(); + + /// The main method - solve. + void solve(AdaptivityType adaptivityType); + + /// Get the solutions. + std::vector > get_slns(); + + /// Get i-th solution. + MeshFunctionSharedPtr get_sln(int index); + + /// Get the solutions. + std::vector > get_ref_slns(); + + /// Get i-th solution. + MeshFunctionSharedPtr get_ref_sln(int index); + + /// Switch visualization on / off. + void switch_visualization(bool on_off, bool wait_for_keypress); + + /// Add exact solutions for exact solver calculation. + void set_exact_solutions(std::vector > exact_slns); + + /// Setters. + void set_initial_spaces(std::vector >); + void set_wf(WeakFormSharedPtr); + void set_error_calculator(ErrorCalculator*); + void set_stopping_criterion_single_step(AdaptivityStoppingCriterion*); + void set_selectors(std::vector*>); + void set_stopping_criterion_global(AdaptSolverCriterion* stopping_criterion_global); + + /// Getters. + SolverType* get_solver(); + std::vector > get_initial_spaces(); + WeakFormSharedPtr get_wf(); + ErrorCalculator* get_error_calculator(); + AdaptivityStoppingCriterion* get_stopping_criterion_single_step(); + std::vector*> get_selectors(); + AdaptSolverCriterion* get_stopping_criterion_global(); + + /// See Hermes::Mixins::Loggable. + virtual void set_verbose_output(bool to_set); + + private: + + /// State querying helpers. + virtual bool isOkay() const; + inline std::string getClassName() const { return "AdaptSolver"; } + + /// Initialize data for one solution (one adaptivity loop) + void init_solving(AdaptivityType adaptivityType); + + /// De-initialize data for one solution (one adaptivity loop) + void deinit_solving(); + + /// Fill the array element_ids_to_reassemble. + /// This is in fact the main method responsible of any re-use logic: + /// - not only it fills the array with elements that were directly changed in adaptivity (that is easy) + /// - it has to also correctly identify all other elements that need to be reassembled (that is not easy). + void mark_elements_to_reassemble(); + + /// (Optional) visualization. + void visualize(std::vector >& ref_spaces); + + /// The stopping_criterion_global for the loop to stop - the quantity measured is the total error as measured by the provided instance of error calculator. + AdaptSolverCriterion* stopping_criterion_global; + + /// Information if the solve method is running. + /// Used for banning descendants of this class to perform some actions + bool solve_method_running; + + /// Internal structures - Spaces. + /// This class changes this instance during the solve() method: yes. + /// Can user change this during adaptation: no. + std::vector > spaces; + + /// This is to hold the ref_spaces for matrix reuse. + std::vector > ref_spaces; + std::vector > prev_ref_spaces; + + /// Internal structures - Weak form. + /// This class changes this instance during the solve() method: no. + /// Can user change this during adaptation: no [technically why not, but makes no sense]. + WeakFormSharedPtr wf; + + /// Internal structures - Error calculator. + /// This class changes this instance during the solve() method: no. + /// Can user change this during adaptation: yes [will be used from the following step onwards]. + ErrorCalculator* error_calculator; + + /// Internal structures - Stopping criterion for each refinement step. + /// This class changes this instance during the solve() method: no. + /// Can user change this during adaptation: yes [will be used from the following step onwards]. + AdaptivityStoppingCriterion* stopping_criterion_single_step; + + /// Internal structures - Stopping criterion for each refinement step. + /// This class changes this instance during the solve() method: no. + /// Can user change this during adaptation: yes [will be used from the following step onwards]. + std::vector*> selectors; + + /// The solution being returned on demand. + std::vector > ref_slns; + std::vector > slns; + std::vector > exact_slns; + + /// Views - used only if visualization is ON. + std::vector scalar_views; + std::vector order_views; + std::vector*> base_views; + + /// Strictly private - Adapt instance. + Adapt* adaptivity_internal; + + /// Strictly private - solver. + SolverType* solver; + + /// Strictly private - adaptivity steps counter. + unsigned short adaptivity_step; + + /// Strictly private - elements to reassemble. + /// Internal data: std::pair: [0] - element id, [1] - component (for multimesh). + std::unordered_set elements_to_reassemble[H2D_MAX_COMPONENTS]; + std::unordered_set DOFs_to_reassemble[H2D_MAX_COMPONENTS]; + + /// Previous algebraic structures for reusal - matrix. + CSCMatrix* prev_mat; + /// Previous algebraic structures for reusal - rhs. + Vector* prev_rhs, *prev_dirichlet_lift_rhs; + + /// Use Hermes views to display stuff. + bool visualization; + + /// Wait for keypress to continue with calculation when views are updated. + bool wait_for_keypress; + + /// For info only. + unsigned int total_elements_prev_spaces; + + /// Utility simple selectors. + std::vector*> hOnlySelectors; + std::vector*> pOnlySelectors; + + /// Strictly private - size of the system (this dimension is what the size of all other data structures is compared to). + unsigned char number_of_equations; + }; + } +} +#endif \ No newline at end of file diff --git a/hermes2d/include/adapt/error_calculator.h b/hermes2d/include/adapt/error_calculator.h index a874db7ed3..5d4355ceea 100644 --- a/hermes2d/include/adapt/error_calculator.h +++ b/hermes2d/include/adapt/error_calculator.h @@ -52,13 +52,14 @@ namespace Hermes /// Calculates the errors between coarse_solutions and fine_solutions. /// \param[in] sort_and_store If true, these errors are going to be sorted, stored and used for the purposes of adaptivity. /// IMPORTANT: if the parameter is passed as false, this, and also any previous error calculations are lost and it is not possible to get back to them. - void calculate_errors(Hermes::vector > coarse_solutions, Hermes::vector > fine_solutions, bool sort_and_store = true); + void calculate_errors(std::vector > coarse_solutions, std::vector > fine_solutions, bool sort_and_store = true); /// Calculates the errors between coarse_solutions and fine_solutions. /// \param[in] sort_and_store If true, these errors are going to be sorted, stored and used for the purposes of adaptivity. - void calculate_errors(MeshFunctionSharedPtr& coarse_solution, MeshFunctionSharedPtr& fine_solution, bool sort_and_store = true); + void calculate_errors(MeshFunctionSharedPtr coarse_solution, MeshFunctionSharedPtr fine_solution, bool sort_and_store = true); - virtual ~ErrorCalculator(); ///< Destructor. Deallocates allocated private data. + /// Destructor. Deallocates allocated private data. + virtual ~ErrorCalculator(); /// Adds user defined norm form which is used to calculate error. /// If the errorType is CalculatedErrorType::RelativeError, this form is also used as a "norm" form to divide the absolute error by the norm of the "fine" solution(s). @@ -85,10 +86,14 @@ namespace Hermes ElementReference() : element_id(-1), comp(-1), error(nullptr), norm(nullptr) {}; ElementReference(int comp, int element_id, double* error, double* norm) : element_id(element_id), comp(comp), error(error), norm(norm) {}; - int element_id; ///< An element ID. Invalid if below 0. - int comp; ///< A component which this element belongs to. Invalid if below 0. - double* error;///< Pointer to the final error, respecting the errorType. - double* norm;///< Pointer to the norm. + /// An element ID. Invalid if below 0. + int element_id; + /// A component which this element belongs to. Invalid if below 0. + int comp; + /// Pointer to the final error, respecting the errorType. + double* error; + /// Pointer to the norm. + double* norm; }; /// A queue of elements which should be processes. The queue had to be filled by the method fill_regular_queue(). @@ -117,8 +122,8 @@ namespace Hermes void postprocess_error(); /// Data. - Hermes::vector > coarse_solutions; - Hermes::vector > fine_solutions; + std::vector > coarse_solutions; + std::vector > fine_solutions; /// Absolute / Relative error. CalculatedErrorType errorType; @@ -145,11 +150,11 @@ namespace Hermes MeshFunctionSharedPtr errorMeshFunction[H2D_MAX_COMPONENTS]; /// Holds volumetric matrix forms. - Hermes::vector *> mfvol; + std::vector *> mfvol; /// Holds surface matrix forms. - Hermes::vector *> mfsurf; + std::vector *> mfsurf; /// Holds DG matrix forms. - Hermes::vector *> mfDG; + std::vector *> mfDG; /// This is for adaptivity, saying that the errors are the correct ones. bool elements_stored; @@ -164,12 +169,12 @@ namespace Hermes return 1; }; - friend class Adapt; - friend class ErrorThreadCalculator; + friend class Adapt < Scalar > ; + friend class ErrorThreadCalculator < Scalar > ; }; template - class HERMES_API DefaultErrorCalculator : public ErrorCalculator + class HERMES_API DefaultErrorCalculator : public ErrorCalculator < Scalar > { public: DefaultErrorCalculator(CalculatedErrorType errorType, int component_count); @@ -177,16 +182,16 @@ namespace Hermes }; template - class HERMES_API DefaultNormCalculator : protected ErrorCalculator + class HERMES_API DefaultNormCalculator : public ErrorCalculator < Scalar > { public: DefaultNormCalculator(int component_count); virtual ~DefaultNormCalculator(); /// Norms calculation. - double calculate_norms(Hermes::vector >& solutions); + double calculate_norms(std::vector >& solutions); /// Norms calculation. - double calculate_norm(MeshFunctionSharedPtr & solution); + double calculate_norm(MeshFunctionSharedPtr solution); }; } } diff --git a/hermes2d/include/adapt/error_thread_calculator.h b/hermes2d/include/adapt/error_thread_calculator.h index 1f64f5c479..2da18c4d3a 100644 --- a/hermes2d/include/adapt/error_thread_calculator.h +++ b/hermes2d/include/adapt/error_thread_calculator.h @@ -17,6 +17,7 @@ #define __H2D_ERROR_THREAD_CALCULATOR_H #include "error_calculator.h" +#include "../forms.h" namespace Hermes { @@ -24,6 +25,8 @@ namespace Hermes { template class ErrorCalculator; template class NeighborSearch; + template class GeomVol; + template class GeomSurf; template class ErrorThreadCalculator @@ -54,7 +57,7 @@ namespace Hermes Traverse::State* current_state; NeighborSearch** neighbor_searches; - int num_neighbors; + unsigned int num_neighbors; }; private: void evaluate_volumetric_forms(Traverse::State* current_state, int order); @@ -72,9 +75,10 @@ namespace Hermes void evaluate_DG_form(NormFormDG* form, DiscontinuousFunc* difference_func_i, DiscontinuousFunc* difference_func_j, DiscontinuousFunc* rsln_i, DiscontinuousFunc* rsln_j, double* error, double* norm); - int n_quadrature_points; - Geom* geometry; - double* jacobian_x_weights; + unsigned char n_quadrature_points; + GeomVol geometry_vol; + GeomSurf geometry_surf; + double jacobian_x_weights[H2D_MAX_INTEGRATION_POINTS_COUNT]; Solution** slns; Solution** rslns; diff --git a/hermes2d/include/adapt/kelly_type_adapt.h b/hermes2d/include/adapt/kelly_type_adapt.h index ebc0b58818..53f21faa30 100644 --- a/hermes2d/include/adapt/kelly_type_adapt.h +++ b/hermes2d/include/adapt/kelly_type_adapt.h @@ -22,361 +22,369 @@ namespace Hermes { - namespace Hermes2D - { - /// Functor representing the interface estimator scaling function. - class InterfaceEstimatorScalingFunction - { - private: - virtual double value(double e_diam, const std::string& e_marker) const = 0; - template friend class KellyTypeAdapt; - }; - - /// Pre-defined function used for scaling interface error estimates (see the KellyTypeAdapt constructor). - class ScaleByElementDiameter : public InterfaceEstimatorScalingFunction - { - private: - virtual double value(double e_diam, const std::string& e_marker) const { - return e_diam; - } - template friend class KellyTypeAdapt; - }; - - /// \class KellyTypeAdapt - /// \ingroup g_adapt - /// \brief A framework for explicit aposteriori error estimators. - /// - /// Explicit error estimators estimate the error of approximate solution on an element by evaluating - /// element residuals and jumps of the solution across element edges ([2]). A typical example is - /// the Kelly error estimator ([1]) where a sum of the L2 norms of element residual and jumps of - /// solution gradients across the element boundaries defines the element error. - /// - /// References: - /// [1] Kelly D. W., Gago O. C., Zienkiewicz O. C., Babuska I.: - ///  A posteriori error analysis and adaptive processes in the finite element method: Part I—error analysis. - ///  Int. J. Numer. Methods Engng. 1983;19:1593–619. - /// [2] Gratsch T., Bathe K. J.: - ///  A posteriori error estimation techniques in practical finite element analysis. - ///  Computers and Structures 83 (2005) 235–265. - /// [3] Zienkiewicz O. C., Taylor R. L., Zhu J. Z.: - ///  The finite element method: its basis and fundamentals (Section 13.7.1). - ///  6th ed. (2005), Elsevier. - /// - template - class HERMES_API KellyTypeAdapt : public Adapt - { - public: - /// Class representing the weak form of an error estimator. - /// - /// A user must derive his own representation of the estimator from this class (an example is provided by the class - /// \c BasicKellyAdapt below). The three attributes have the following meaning: - /// - /// - i ... with a multi-component solution, this defines for which component this estimate applies, - /// - area ... defines in which geometric parts of the domain should the estimate be used - e.g. by defining - ///  area = H2D_DG_INNER_EDGE, errors at element interfaces will be tracked by the estimator, - /// - ext ... vector with external functions possibly used within the estimator (e.g. previous time-level - ///  solutions appearing in the residual) - currently not used. - /// - /// Every estimator form must also implement the two methods \c ord and \c value, which are used for determining - /// the integration order and for the actual evaluation of the form, respectively. During the evaluation, their - /// parameters will be interpreted as follows: - /// - /// - int n, ... number of integration points in the currently processed element - /// - double *wt, ... corresponding integration weights - /// - Func\ *u[], ... all solution components - /// - Func\ *u, ... currently processed solution component - /// - Geom\ *e, ... geometric data of the currently processed element - /// - class HERMES_API ErrorEstimatorForm : public Form - { - public: - int i; ///< Component. - std::string area; ///< Geometric region where this estimator is applied. - Hermes::vector > ext; ///< Additional functions required by the estimator. - /// Set this error form to be an interface one. - void setAsInterface(); - /// Constructor. - ErrorEstimatorForm(int i, std::string area = HERMES_ANY, - Hermes::vector > ext = Hermes::vector >()) - : i(i), area(area), ext(ext) {} - - /// Value calculation. - virtual Scalar value(int n, double *wt, Func *u_ext[], - DiscontinuousFunc *u, Geom *e, - Func **ext) const - { - throw Exceptions::MethodNotOverridenException("KellyTypeAdapt::ErrorEstimatorForm::value()"); - return 0.0; - } - - /// Integration order. - virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], - DiscontinuousFunc *u, Geom *e, - Func **ext) const - { - throw Exceptions::MethodNotOverridenException("KellyTypeAdapt::ErrorEstimatorForm::ord()."); - return Hermes::Ord(); - } - - /// FIXME - temporary - KellyTypeAdapt *adapt; - }; - - protected: - DiscreteProblem dp; // Only needed for gaining access to NeighborSearch methods. - - /// - /// Functions used for evaluating the actual error estimator forms for an active element or edge segment. - /// - double eval_volumetric_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, - RefMap* rm); - double eval_boundary_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, - RefMap* rm, - SurfPos* surf_pos); - double eval_interface_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, - RefMap *rm, - SurfPos* surf_pos, - LightArray*>& neighbor_searches, - int neighbor_index); - double eval_solution_norm(typename Adapt::MatrixFormVolError* form, - RefMap* rm, - MeshFunctionSharedPtr sln); - - /// - /// Linear forms used to calculate the error estimator value for each component. - /// - Hermes::vector error_estimators_vol; - Hermes::vector error_estimators_surf; - - Mesh::ElementMarkersConversion element_markers_conversion; - Mesh::BoundaryMarkersConversion boundary_markers_conversion; - - /// Scaling of the interface error estimates. May be specified by the user during construction. - /// - Hermes::vector interface_scaling_fns; - bool use_aposteriori_interface_scaling; ///< Specifies whether the interface error estimators for each - ///< component will be multiplied by \c interface_scaling_fns - ///< after being evaluated. - - /// - /// Constant scaling. Reserved for the derived classes, not to be used by the user explicitly. - /// - double interface_scaling_const; ///< Constant scaling of the boundary error estimates. - double volumetric_scaling_const; ///< Constant scaling of the volumetric error estimates (like the residual norm). - double boundary_scaling_const; ///< Constant scaling of the boundary error estimates. - - /// Specifies whether the interface error estimator will be evaluated from each side of each interface - /// (when ignore_visited_segments == false ), or only once for each interface - /// (ignore_visited_segments == true). - bool ignore_visited_segments; - - /// Calculates error estimates for each solution component, the total error estimate, and possibly also - /// their normalizations. If called with a pair of solutions, the version from Adapt is used (this is e.g. - /// done when comparing approximate solution to the exact one - in this case, we do not want to compute - /// the Kelly estimator value, but rather the ordinary difference between the solutions). - virtual double calc_err_internal(Hermes::vector > slns, - Hermes::vector* component_errors, - unsigned int error_flags); - - public: - - /// Constructor. - /// - /// \param[in] spaces_ Approximation space of each solution component. - /// \param[in] ignore_visited_segments_ If true, error estimator for each inner edge will be evaluated only - ///  once. It will be added to the total error estimate for both the active - ///  element and its neighbors across that edge, after possibly being scaled by - ///  \c interface_scaling_fns_ for the current component (with the diameter of - ///  the appropriate element). This saves duplicate evaluations with same - ///  results when the estimator is given e.g. by the jumps of the solution. - /// - ///  If false, error estimator for each surface of each element will be - ///  evaluated, regardless of whether the neighbor side of the interface - ///  has already been processed. - /// - ///  Note that if \c interface_scaling_fns_ is empty (or unspecified) then the - ///  default scaling by element diameter will be always performed unless it is - ///  switched off by a call to \c disable_aposteriori_interface_scaling. - /// \param[in] interface_scaling_fns_ Specifies functions used for scaling the interface error estimator for - ///  each component. The scale is defined as a real function of the element - ///  diameter (and possibly equation coefficients associated to the element) - ///  and multiplies the result of the interface estimators. It may thus be already - ///  present in the interface estimator forms themselves, in which case call - ///  \c disable_aposteriori_interface_scaling. In this case, it may also be required - ///  that \c ignore_visited_segments be false in order to always ensure that the - ///  diameter belongs to the element whose error is being calculated. - /// \param[in] norms_ Norms used for making relative error estimates. - ///  If not specified, they are defined according to the spaces. - /// - /// - KellyTypeAdapt(Hermes::vector > spaces, - bool ignore_visited_segments = true, - Hermes::vector - interface_scaling_fns_ = Hermes::vector(), - Hermes::vector norms_ = Hermes::vector()); - - KellyTypeAdapt(SpaceSharedPtr space, - bool ignore_visited_segments = true, - const InterfaceEstimatorScalingFunction* interface_scaling_fn_ = nullptr, - NormType norm_ = HERMES_UNSET_NORM); - - /// Destructor. - virtual ~KellyTypeAdapt() - { - for (unsigned int i = 0; i < error_estimators_surf.size(); i++) - delete error_estimators_surf[i]; - error_estimators_surf.clear(); - - for (unsigned int i = 0; i < error_estimators_vol.size(); i++) - delete error_estimators_vol[i]; - error_estimators_vol.clear(); - - for (unsigned int i = 0; i < interface_scaling_fns.size(); i++) - delete interface_scaling_fns[i]; - interface_scaling_fns.clear(); - } - - Mesh::ElementMarkersConversion* get_element_markers_conversion() - { - return &this->element_markers_conversion; - } - Mesh::BoundaryMarkersConversion* get_boundary_markers_conversion() - { - return &this->boundary_markers_conversion; - } - - /// Append volumetric error estimator form. - /// - /// For example, element residual norms may be represented by such a form. - /// - /// \param[in] form ... object representing the form. A class derived from \c KellyTypeAdapt::ErrorEstimatorForm - ///  defines its datatype. - /// - void add_error_estimator_vol(ErrorEstimatorForm* form); - - /// Append boundary or interface error estimator form. - /// - /// Interface form is defined by form::area == H2D_DG_INNER_EDGE . The effective types for \c u_ext, \c u - /// and \c e (three of the obligatory parameters of form::value() and form::ord()) will then be, respectively - /// \c DiscontinuousFunc*[], \c DiscontinuousFunc* and \c InterfaceGeom*. - /// - void add_error_estimator_surf(ErrorEstimatorForm* form); - - /// - /// The following two methods calculate the error of the given \c sln, using \code calc_err_internal \endcode. - /// - - double calc_err_est(MeshFunctionSharedPtrsln, - unsigned int error_flags = HERMES_TOTAL_ERROR_REL | HERMES_ELEMENT_ERROR_REL) - { - if(this->num != 1) - throw Exceptions::Exception("Wrong number of solutions."); - Hermes::vector > slns; - slns.push_back(sln); - return calc_err_est(slns, nullptr, error_flags); - } - - double calc_err_est(Hermes::vector > slns, - Hermes::vector* component_errors = nullptr, - unsigned int error_flags = HERMES_TOTAL_ERROR_REL | HERMES_ELEMENT_ERROR_REL) - { - return calc_err_internal(slns, component_errors, error_flags); - } - - /// Refines the elements selected by the \code RefinementSelectors::HOnlySelector \endcode according - /// to the errors calculated by \code calc_err_est \endcode. - /// - bool adapt(double thr, int strat = 0, int regularize = -1, double to_be_processed = 0.0); - - void disable_aposteriori_interface_scaling() { use_aposteriori_interface_scaling = false; } - - void set_volumetric_scaling_const(double C) { volumetric_scaling_const = C; } - void set_boundary_scaling_const(double C) { boundary_scaling_const = C; } - }; - - /// \class BasicKellyAdapt - /// \ingroup g_adapt - /// \brief Simple Kelly-estimator based adaptivity for elliptic problems. - /// - /// Original error estimator that Kelly et. al. ([1]) derived for the Laplace equation with constant - /// coefficient, approximated on a quadrilateral mesh. The error of each element is estimated by the - /// L2 norm of jumps of gradients across element faces (the contribution of the residual norm is - /// relatively insignificant and is neglected, see[3]). Note that the estimator has been successfully - /// used also for other problems than that for which it had been originally derived. - /// - ///\todo Add handling of boundary conditions. - ///  Currently, the forms for the Neumann and Newton boundary conditions must be specified by - ///  the user, see the example \c poisson-kelly-adapt. - /// - template - class HERMES_API BasicKellyAdapt : public KellyTypeAdapt - { - public: - class HERMES_API ErrorEstimatorFormKelly : public KellyTypeAdapt::ErrorEstimatorForm - { - public: - /// Constructor. - ErrorEstimatorFormKelly(int i = 0, double const_by_laplacian = 1.0); - - virtual Scalar value(int n, double *wt, Func *u_ext[], - DiscontinuousFunc *u, Geom *e, - Func **ext) const - { - Scalar result = 0.; - if(u->fn_central != nullptr) - for (int i = 0; i < n; i++) - result += wt[i] * Hermes::sqr( const_by_laplacian * ( e->nx[i] * u->dx[i] + e->ny[i] * u->dy[i])); - else - for (int i = 0; i < n; i++) - result += wt[i] * Hermes::sqr( const_by_laplacian * ( e->nx[i] * u->dx_neighbor[i] + e->ny[i] * u->dy_neighbor[i])); - - return result; - } - - virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], - DiscontinuousFunc *u, Geom *e, - Func **ext) const - { - if(u->fn_central != nullptr) - return Hermes::sqr(u->dx[0] + u->dy[0]); - else - return Hermes::sqr(u->dx_neighbor[0] + u->dy_neighbor[0]); - } - - private: - double const_by_laplacian; - }; - - /// Constructor. - /// - /// For the equation \f$ -K \Delta u = f \f$, the argument \c const_by_laplacian is equal to \$ K \$. - /// - BasicKellyAdapt(Hermes::vector > spaces_, - double const_by_laplacian = 1.0, - Hermes::vector norms_ = Hermes::vector()) - : KellyTypeAdapt(spaces_, true, Hermes::vector(), norms_) - { - set_scaling_consts(const_by_laplacian); - for (int i = 0; i < this->num; i++) - this->error_estimators_surf.push_back(new ErrorEstimatorFormKelly(i, const_by_laplacian)); - } - - BasicKellyAdapt(SpaceSharedPtr space_, double const_by_laplacian = 1.0, NormType norm_ = HERMES_UNSET_NORM) - : KellyTypeAdapt(space_, true, nullptr, norm_) - { - set_scaling_consts(const_by_laplacian); - this->error_estimators_surf.push_back(new ErrorEstimatorFormKelly(0, const_by_laplacian)); - } - - private: - void set_scaling_consts(double C) - { - this->interface_scaling_const = 1./(24.*C); - this->volumetric_scaling_const = this->interface_scaling_const; - this->boundary_scaling_const = this->interface_scaling_const; - } - }; - } +namespace Hermes2D +{ +/// Functor representing the interface estimator scaling function. +class InterfaceEstimatorScalingFunction +{ +private: +virtual double value(double e_diam, const std::string& e_marker) const = 0; +template friend class KellyTypeAdapt; +}; + +/// Pre-defined function used for scaling interface error estimates (see the KellyTypeAdapt constructor). +class ScaleByElementDiameter : public InterfaceEstimatorScalingFunction +{ +private: +virtual double value(double e_diam, const std::string& e_marker) const { +return e_diam; +} +template friend class KellyTypeAdapt; +}; + +/// \class KellyTypeAdapt +/// \ingroup g_adapt +/// \brief A framework for explicit aposteriori error estimators. +/// +/// Explicit error estimators estimate the error of approximate solution on an element by evaluating +/// element residuals and jumps of the solution across element edges ([2]). A typical example is +/// the Kelly error estimator ([1]) where a sum of the L2 norms of element residual and jumps of +/// solution gradients across the element boundaries defines the element error. +/// +/// References: +/// [1] Kelly D. W., Gago O. C., Zienkiewicz O. C., Babuska I.: +///  A posteriori error analysis and adaptive processes in the finite element method: Part I—error analysis. +///  Int. J. Numer. Methods Engng. 1983;19:1593–619. +/// [2] Gratsch T., Bathe K. J.: +///  A posteriori error estimation techniques in practical finite element analysis. +///  Computers and Structures 83 (2005) 235–265. +/// [3] Zienkiewicz O. C., Taylor R. L., Zhu J. Z.: +///  The finite element method: its basis and fundamentals (Section 13.7.1). +///  6th ed. (2005), Elsevier. +/// +template +class HERMES_API KellyTypeAdapt : public Adapt +{ +public: +/// Class representing the weak form of an error estimator. +/// +/// A user must derive his own representation of the estimator from this class (an example is provided by the class +/// \c BasicKellyAdapt below). The three attributes have the following meaning: +/// +/// - i ... with a multi-component solution, this defines for which component this estimate applies, +/// - area ... defines in which geometric parts of the domain should the estimate be used - e.g. by defining +///  area = H2D_DG_INNER_EDGE, errors at element interfaces will be tracked by the estimator, +/// - ext ... vector with external functions possibly used within the estimator (e.g. previous time-level +///  solutions appearing in the residual) - currently not used. +/// +/// Every estimator form must also implement the two methods \c ord and \c value, which are used for determining +/// the integration order and for the actual evaluation of the form, respectively. During the evaluation, their +/// parameters will be interpreted as follows: +/// +/// - int n, ... number of integration points in the currently processed element +/// - double *wt, ... corresponding integration weights +/// - Func\ *u[], ... all solution components +/// - Func\ *u, ... currently processed solution component +/// - Geom\ *e, ... geometric data of the currently processed element +/// +class HERMES_API ErrorEstimatorForm : public Form +{ +public: +/// Component. +int i; +/// Geometric region where this estimator is applied. +std::string area; +/// Additional functions required by the estimator. +std::vector > ext; +/// Set this error form to be an interface one. +void setAsInterface(); +/// Constructor. +ErrorEstimatorForm(int i, std::string area = HERMES_ANY, +std::vector > ext = std::vector >()) +: i(i), area(area), ext(ext) {} + +/// Value calculation. +virtual Scalar value(int n, double *wt, Func *u_ext[], +DiscontinuousFunc *u, Geom *e, +Func **ext) const +{ +throw Exceptions::MethodNotOverridenException("KellyTypeAdapt::ErrorEstimatorForm::value()"); +return 0.0; +} + +/// Integration order. +virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], +DiscontinuousFunc *u, Geom *e, +Func **ext) const +{ +throw Exceptions::MethodNotOverridenException("KellyTypeAdapt::ErrorEstimatorForm::ord()."); +return Hermes::Ord(); +} + +/// FIXME - temporary +KellyTypeAdapt *adapt; +}; + +protected: +// Only needed for gaining access to NeighborSearch methods. +DiscreteProblem dp; + +/// +/// Functions used for evaluating the actual error estimator forms for an active element or edge segment. +/// +double eval_volumetric_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, +RefMap* rm); +double eval_boundary_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, +RefMap* rm, +SurfPos* surf_pos); +double eval_interface_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, +RefMap *rm, +SurfPos* surf_pos, +LightArray*>& neighbor_searches, +int neighbor_index); +double eval_solution_norm(typename Adapt::MatrixFormVolError* form, +RefMap* rm, +MeshFunctionSharedPtr sln); + +/// +/// Linear forms used to calculate the error estimator value for each component. +/// +std::vector error_estimators_vol; +std::vector error_estimators_surf; + +Mesh::ElementMarkersConversion element_markers_conversion; +Mesh::BoundaryMarkersConversion boundary_markers_conversion; + +/// Scaling of the interface error estimates. May be specified by the user during construction. +/// +std::vector interface_scaling_fns; +/// Specifies whether the interface error estimators for each +bool use_aposteriori_interface_scaling; +///< component will be multiplied by \c interface_scaling_fns +///< after being evaluated. + +/// +/// Constant scaling. Reserved for the derived classes, not to be used by the user explicitly. +/// +/// Constant scaling of the boundary error estimates. +double interface_scaling_const; +/// Constant scaling of the volumetric error estimates (like the residual norm). +double volumetric_scaling_const; +/// Constant scaling of the boundary error estimates. +double boundary_scaling_const; + +/// Specifies whether the interface error estimator will be evaluated from each side of each interface +/// (when ignore_visited_segments == false ), or only once for each interface +/// (ignore_visited_segments == true). +bool ignore_visited_segments; + +/// Calculates error estimates for each solution component, the total error estimate, and possibly also +/// their normalizations. If called with a pair of solutions, the version from Adapt is used (this is e.g. +/// done when comparing approximate solution to the exact one - in this case, we do not want to compute +/// the Kelly estimator value, but rather the ordinary difference between the solutions). +virtual double calc_err_internal(std::vector > slns, +std::vector* component_errors, +unsigned int error_flags); + +public: + +/// Constructor. +/// +/// \param[in] spaces_ Approximation space of each solution component. +/// \param[in] ignore_visited_segments_ If true, error estimator for each inner edge will be evaluated only +///  once. It will be added to the total error estimate for both the active +///  element and its neighbors across that edge, after possibly being scaled by +///  \c interface_scaling_fns_ for the current component (with the diameter of +///  the appropriate element). This saves duplicate evaluations with same +///  results when the estimator is given e.g. by the jumps of the solution. +/// +///  If false, error estimator for each surface of each element will be +///  evaluated, regardless of whether the neighbor side of the interface +///  has already been processed. +/// +///  Note that if \c interface_scaling_fns_ is empty (or unspecified) then the +///  default scaling by element diameter will be always performed unless it is +///  switched off by a call to \c disable_aposteriori_interface_scaling. +/// \param[in] interface_scaling_fns_ Specifies functions used for scaling the interface error estimator for +///  each component. The scale is defined as a real function of the element +///  diameter (and possibly equation coefficients associated to the element) +///  and multiplies the result of the interface estimators. It may thus be already +///  present in the interface estimator forms themselves, in which case call +///  \c disable_aposteriori_interface_scaling. In this case, it may also be required +///  that \c ignore_visited_segments be false in order to always ensure that the +///  diameter belongs to the element whose error is being calculated. +/// \param[in] norms_ Norms used for making relative error estimates. +///  If not specified, they are defined according to the spaces. +/// +/// +KellyTypeAdapt(std::vector > spaces, +bool ignore_visited_segments = true, +std::vector +interface_scaling_fns_ = std::vector(), +std::vector norms_ = std::vector()); + +KellyTypeAdapt(SpaceSharedPtr space, +bool ignore_visited_segments = true, +const InterfaceEstimatorScalingFunction* interface_scaling_fn_ = nullptr, +NormType norm_ = HERMES_UNSET_NORM); + +/// Destructor. +virtual ~KellyTypeAdapt() +{ +for (unsigned int i = 0; i < error_estimators_surf.size(); i++) +delete error_estimators_surf[i]; +error_estimators_surf.clear(); + +for (unsigned int i = 0; i < error_estimators_vol.size(); i++) +delete error_estimators_vol[i]; +error_estimators_vol.clear(); + +for (unsigned int i = 0; i < interface_scaling_fns.size(); i++) +delete interface_scaling_fns[i]; +interface_scaling_fns.clear(); +} + +Mesh::ElementMarkersConversion* get_element_markers_conversion() +{ +return &this->element_markers_conversion; +} +Mesh::BoundaryMarkersConversion* get_boundary_markers_conversion() +{ +return &this->boundary_markers_conversion; +} + +/// Append volumetric error estimator form. +/// +/// For example, element residual norms may be represented by such a form. +/// +/// \param[in] form ... object representing the form. A class derived from \c KellyTypeAdapt::ErrorEstimatorForm +///  defines its datatype. +/// +void add_error_estimator_vol(ErrorEstimatorForm* form); + +/// Append boundary or interface error estimator form. +/// +/// Interface form is defined by form::area == H2D_DG_INNER_EDGE . The effective types for \c u_ext, \c u +/// and \c e (three of the obligatory parameters of form::value() and form::ord()) will then be, respectively +/// \c DiscontinuousFunc*[], \c DiscontinuousFunc* and \c InterfaceGeom*. +/// +void add_error_estimator_surf(ErrorEstimatorForm* form); + +/// +/// The following two methods calculate the error of the given \c sln, using \code calc_err_internal \endcode. +/// + +double calc_err_est(MeshFunctionSharedPtrsln, +unsigned int error_flags = HERMES_TOTAL_ERROR_REL | HERMES_ELEMENT_ERROR_REL) +{ +if(this->num != 1) +throw Exceptions::Exception("Wrong number of solutions."); +std::vector > slns; +slns.push_back(sln); +return calc_err_est(slns, nullptr, error_flags); +} + +double calc_err_est(std::vector > slns, +std::vector* component_errors = nullptr, +unsigned int error_flags = HERMES_TOTAL_ERROR_REL | HERMES_ELEMENT_ERROR_REL) +{ +return calc_err_internal(slns, component_errors, error_flags); +} + +/// Refines the elements selected by the \code RefinementSelectors::HOnlySelector \endcode according +/// to the errors calculated by \code calc_err_est \endcode. +/// +bool adapt(double thr, int strat = 0, int regularize = -1, double to_be_processed = 0.0); + +void disable_aposteriori_interface_scaling() { use_aposteriori_interface_scaling = false; } + +void set_volumetric_scaling_const(double C) { volumetric_scaling_const = C; } +void set_boundary_scaling_const(double C) { boundary_scaling_const = C; } +}; + +/// \class BasicKellyAdapt +/// \ingroup g_adapt +/// \brief Simple Kelly-estimator based adaptivity for elliptic problems. +/// +/// Original error estimator that Kelly et. al. ([1]) derived for the Laplace equation with constant +/// coefficient, approximated on a quadrilateral mesh. The error of each element is estimated by the +/// L2 norm of jumps of gradients across element faces (the contribution of the residual norm is +/// relatively insignificant and is neglected, see[3]). Note that the estimator has been successfully +/// used also for other problems than that for which it had been originally derived. +/// +///\todo Add handling of boundary conditions. +///  Currently, the forms for the Neumann and Newton boundary conditions must be specified by +///  the user, see the example \c poisson-kelly-adapt. +/// +template +class HERMES_API BasicKellyAdapt : public KellyTypeAdapt +{ +public: +class HERMES_API ErrorEstimatorFormKelly : public KellyTypeAdapt::ErrorEstimatorForm +{ +public: +/// Constructor. +ErrorEstimatorFormKelly(int i = 0, double const_by_laplacian = 1.0); + +virtual Scalar value(int n, double *wt, Func *u_ext[], +DiscontinuousFunc *u, Geom *e, +Func **ext) const +{ +Scalar result = 0.; +if(u->fn_central != nullptr) +for (int i = 0; i < n; i++) +result += wt[i] * Hermes::sqr( const_by_laplacian * ( e->nx[i] * u->dx[i] + e->ny[i] * u->dy[i])); +else +for (int i = 0; i < n; i++) +result += wt[i] * Hermes::sqr( const_by_laplacian * ( e->nx[i] * u->dx_neighbor[i] + e->ny[i] * u->dy_neighbor[i])); + +return result; +} + +virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], +DiscontinuousFunc *u, Geom *e, +Func **ext) const +{ +if(u->fn_central != nullptr) +return Hermes::sqr(u->dx[0] + u->dy[0]); +else +return Hermes::sqr(u->dx_neighbor[0] + u->dy_neighbor[0]); +} + +private: +double const_by_laplacian; +}; + +/// Constructor. +/// +/// For the equation \f$ -K \Delta u = f \f$, the argument \c const_by_laplacian is equal to \$ K \$. +/// +BasicKellyAdapt(std::vector > spaces_, +double const_by_laplacian = 1.0, +std::vector norms_ = std::vector()) +: KellyTypeAdapt(spaces_, true, std::vector(), norms_) +{ +set_scaling_consts(const_by_laplacian); +for (int i = 0; i < this->num; i++) +this->error_estimators_surf.push_back(new ErrorEstimatorFormKelly(i, const_by_laplacian)); +} + +BasicKellyAdapt(SpaceSharedPtr space_, double const_by_laplacian = 1.0, NormType norm_ = HERMES_UNSET_NORM) +: KellyTypeAdapt(space_, true, nullptr, norm_) +{ +set_scaling_consts(const_by_laplacian); +this->error_estimators_surf.push_back(new ErrorEstimatorFormKelly(0, const_by_laplacian)); +} + +private: +void set_scaling_consts(double C) +{ +this->interface_scaling_const = 1./(24.*C); +this->volumetric_scaling_const = this->interface_scaling_const; +this->boundary_scaling_const = this->interface_scaling_const; +} +}; +} } #endif */ \ No newline at end of file diff --git a/hermes2d/include/api2d.h b/hermes2d/include/api2d.h index 2be39f4e05..cbd14e9159 100644 --- a/hermes2d/include/api2d.h +++ b/hermes2d/include/api2d.h @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -37,8 +37,8 @@ namespace Hermes /// Enumeration of potential keys in the Api2D::parameters storage. enum Hermes2DApiParam { - xmlSchemasDirPath, - precalculatedFormsDirPath + xmlSchemasDirPath, + precalculatedFormsDirPath }; /// API Class containing settings for the whole Hermes2D. @@ -50,7 +50,7 @@ namespace Hermes protected: /// Parameter class, representing one parameter. /// Its identifier is a string identifier according to which, the instance is inserted into Api2D::parameters. - template + template class HERMES_API Parameter { public: @@ -67,18 +67,18 @@ namespace Hermes /// This storage is not optimized for speed, but for comfort of users. /// There should not be any parameters, values of which are sought very often, because of the above reason. - std::map*> integral_parameters; + std::map*> integral_parameters; std::map*> text_parameters; public: - int get_integral_param_value(Hermes2DApiParam); + int get_integral_param_value(Hermes2DApiParam); std::string get_text_param_value(Hermes2DApiParam); - void set_integral_param_value(Hermes2DApiParam, int value); - void set_text_param_value(Hermes2DApiParam, std::string value); - private: + void set_integral_param_value(Hermes2DApiParam, int value); + void set_text_param_value(Hermes2DApiParam, std::string value); + private: - friend class Mesh; - friend class MeshReaderH2DXML; + friend class Mesh; + friend class MeshReaderH2DXML; template friend class Space; template friend class Solution; }; diff --git a/hermes2d/include/asmlist.h b/hermes2d/include/asmlist.h index 777e62ebbd..f9fa2d8d43 100644 --- a/hermes2d/include/asmlist.h +++ b/hermes2d/include/asmlist.h @@ -29,7 +29,6 @@ namespace Hermes /// automatically by the class. The class provides a list of triples (idx, dof, coef). /// The triples are flattened to separate arrays of length 'cnt'. /// - /// @ingroup inner template class HERMES_API AsmList { @@ -45,10 +44,14 @@ namespace Hermes Scalar* get_coef(); unsigned int get_cnt(); - int idx[H2D_MAX_LOCAL_BASIS_SIZE]; ///< array of shape function indices - int dof[H2D_MAX_LOCAL_BASIS_SIZE]; ///< array of basis function numbers (DOFs) - Scalar coef[H2D_MAX_LOCAL_BASIS_SIZE]; ///< array of coefficients - unsigned int cnt; ///< the number of items in the arrays idx, dof and coef + /// array of shape function indices + int idx[H2D_MAX_LOCAL_BASIS_SIZE]; + /// array of basis function numbers (DOFs) + int dof[H2D_MAX_LOCAL_BASIS_SIZE]; + /// array of coefficients + Scalar coef[H2D_MAX_LOCAL_BASIS_SIZE]; + /// the number of items in the arrays idx, dof and coef + unsigned short cnt; /// Adds a record for one basis function (shape functions index, basis functions index, coefficient). void add_triplet(int i, int d, Scalar c); diff --git a/hermes2d/include/boundary_conditions/essential_boundary_conditions.h b/hermes2d/include/boundary_conditions/essential_boundary_conditions.h index 5b3869a341..91e5c947aa 100644 --- a/hermes2d/include/boundary_conditions/essential_boundary_conditions.h +++ b/hermes2d/include/boundary_conditions/essential_boundary_conditions.h @@ -1,7 +1,7 @@ // This file is part of Hermes3D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes3D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -29,26 +29,27 @@ namespace Hermes template class ExactSolutionVector; template class EssentialBCs; + /// Types of description of boundary values, either a function (callback), or a constant. + enum EssentialBCValueType + { + BC_FUNCTION, + BC_CONST + }; + /// Base, abstract class representing Essential boundary condition of the form u|_{\Gamma_Essential} = u_Essential. /// Internal. - /// @ingroup inner template class HERMES_API EssentialBoundaryCondition : public Hermes::Mixins::Loggable { public: /// Default constructor. - EssentialBoundaryCondition(Hermes::vector markers); + EssentialBoundaryCondition(); + EssentialBoundaryCondition(std::vector markers); EssentialBoundaryCondition(std::string marker); /// Virtual destructor. virtual ~EssentialBoundaryCondition(); - /// Types of description of boundary values, either a function (callback), or a constant. - enum EssentialBCValueType { - BC_FUNCTION, - BC_CONST - }; - /// Pure virtual function reporting the type of the essential boundary condition. virtual EssentialBCValueType get_value_type() const = 0; @@ -60,7 +61,7 @@ namespace Hermes /// \param[in] n_y the y-component of the unit outer normal. /// \param[in] t_x the x-component of the tangent(perpendicular to normal). /// \param[in] t_y the y-component of the tangent(perpendicular to normal). - virtual Scalar value(double x, double y, double n_x, double n_y, double t_x, double t_y) const = 0; + virtual Scalar value(double x, double y) const = 0; /// Set the current time for time-dependent boundary conditions. void set_current_time(double time); @@ -76,7 +77,7 @@ namespace Hermes double current_time; /// Markers. - Hermes::vector markers; + std::vector markers; template friend class EssentialBCs; template friend class Space; @@ -88,16 +89,17 @@ namespace Hermes /// Class representing constant essential boundary condition. template - class HERMES_API DefaultEssentialBCConst : public EssentialBoundaryCondition { + class HERMES_API DefaultEssentialBCConst : public EssentialBoundaryCondition < Scalar > + { public: /// Constructors. - DefaultEssentialBCConst(Hermes::vector markers, Scalar value_const); + DefaultEssentialBCConst(std::vector markers, Scalar value_const); DefaultEssentialBCConst(std::string marker, Scalar value_const); - Scalar value(double x, double y, double n_x, double n_y, double t_x, double t_y) const; + Scalar value(double x, double y) const; /// Function giving info that u_Essential is a constant. - inline typename EssentialBoundaryCondition::EssentialBCValueType get_value_type() const { return EssentialBoundaryCondition::BC_CONST; } + inline EssentialBCValueType get_value_type() const { return BC_CONST; } }; /// Class representing non-constant essential boundary condition for Scalar approximation. @@ -105,68 +107,49 @@ namespace Hermes /// class MyEssentialBCNonConst : public DefaultEssentialBCNonConst /// { /// public: - /// // Constructor with multiple markers, setting velocity at inlet(vel_inlet), domain height(H) and startup time(startup_time) - all parameters are of this example - DERIVED - class. - /// MyEssentialBCNonConst(Hermes::vector markers, double vel_inlet, double H, double startup_time) : + // Constructor with multiple markers, setting velocity at inlet(vel_inlet), domain height(H) and startup time(startup_time) - all parameters are of this example - DERIVED - class. + ///  + /// MyEssentialBCNonConst(std::vector markers, double vel_inlet, double H, double startup_time) : ///  EssentialBoundaryCondition(markers), vel_inlet(vel_inlet), H(H), startup_time(startup_time) {}; /// /// // VERY IMPORTANT - overriding the method of the base class (DefaultEssentialBCNonConst::value) with a custom implementation. /// // NOTE - one can use the top-level base class (EssentialBoundaryCondition)'s methods for handling the time variable for time-dependent problems: get_current_time(). /// // NOTE - the 'virtual' keyword is not here anymore - because we will not need to further derive from this class and override this method. - /// double value(double x, double y, double n_x, double n_y, double t_x, double t_y) const { + /// double value(double x, double y) const { ///  double val_y = vel_inlet * y*(H-y) / (H/2.)/(H/2.); - ///  if (get_current_time() <= startup_time) + ///  if (get_current_time() <= startup_time) ///  return val_y * get_current_time()/startup_time; - ///  else + ///  else ///  return val_y; /// }; /// /// protected: - /// // Members of MyEssentialBCNonConst. + // Members of MyEssentialBCNonConst. + ///  /// double vel_inlet; /// double H; /// double startup_time; - ///}; + ///}; template - class HERMES_API DefaultEssentialBCNonConst : public EssentialBoundaryCondition + class HERMES_API DefaultEssentialBCNonConst : public EssentialBoundaryCondition < Scalar > { public: - DefaultEssentialBCNonConst(Hermes::vector markers_, + DefaultEssentialBCNonConst(std::vector markers_, MeshFunctionSharedPtr exact_solution); DefaultEssentialBCNonConst(std::string marker, MeshFunctionSharedPtr exact_solution); ~DefaultEssentialBCNonConst() {}; - virtual Scalar value(double x, double y, double n_x, double n_y, double t_x, double t_y) const; + virtual Scalar value(double x, double y) const; /// Function giving info that u_Essential is a non-constant function. - inline typename EssentialBoundaryCondition::EssentialBCValueType get_value_type() const { return EssentialBoundaryCondition::BC_FUNCTION; } + inline EssentialBCValueType get_value_type() const { return BC_FUNCTION; } ExactSolutionScalar* exact_solution; }; - /// Class representing non-constant essential boundary condition - /// (tangential component for Hcurl approximations). - template - class HERMES_API DefaultEssentialBCNonConstHcurl : public EssentialBoundaryCondition - { - public: - // Tangential values given by a vector-valued solution. - DefaultEssentialBCNonConstHcurl(Hermes::vector markers_, - MeshFunctionSharedPtr exact_solution2); - DefaultEssentialBCNonConstHcurl(std::string marker, MeshFunctionSharedPtr exact_solution2); - - ~DefaultEssentialBCNonConstHcurl() {}; - - virtual Scalar value(double x, double y, double n_x, double n_y, double t_x, double t_y) const; - - /// Function giving info that u_Essential is a non-constant function. - inline typename EssentialBoundaryCondition::EssentialBCValueType get_value_type() const { return EssentialBoundaryCondition::BC_FUNCTION; } - - ExactSolutionVector* exact_solution2; - }; - /// Class encapsulating all boundary conditions of one problem. /// Using the class EssentialBCs and its descendants. /// Usage: for passing to Hermes2D::Space in the constructor or set_essential_bcs() method. @@ -177,34 +160,38 @@ namespace Hermes EssentialBCs(); /// Constructor with all boundary conditions of a problem. - EssentialBCs(Hermes::vector *> essential_bcs); + EssentialBCs(std::vector *> essential_bcs); EssentialBCs(EssentialBoundaryCondition* boundary_condition); /// Default destructor. ~EssentialBCs(); /// Initializes the class, fills the structures. - void add_boundary_conditions(Hermes::vector *> essential_bcs); + void add_boundary_conditions(std::vector *> essential_bcs); void add_boundary_condition(EssentialBoundaryCondition* essential_bc); /// Public iterators for the private data structures. - typename Hermes::vector *>::const_iterator iterator; - typename Hermes::vector *>::const_iterator begin() const; - typename Hermes::vector *>::const_iterator end() const; + typename std::vector *>::const_iterator iterator; + typename std::vector *>::const_iterator begin() const; + typename std::vector *>::const_iterator end() const; + /// Return the essential BC on the specified marker. EssentialBoundaryCondition* get_boundary_condition(std::string marker); + /// Return all the markers where this set of conditions is defined. + const std::vector& get_markers() const; + /// Sets the current time for time-dependent boundary conditions. void set_current_time(double time); private: /// All boundary conditions together. - Hermes::vector *> all; + std::vector *> all; /// Boundary markers. - Hermes::vector markers; + std::vector markers; /// Boundary conditions with the same order. - Hermes::vector *> BCs; + std::vector *> BCs; /// Special boundary condition when it is defined on all boundary markers. EssentialBoundaryCondition * HermesAnyBC; diff --git a/hermes2d/include/discrete_problem.h b/hermes2d/include/discrete_problem.h deleted file mode 100644 index baaf590af8..0000000000 --- a/hermes2d/include/discrete_problem.h +++ /dev/null @@ -1,138 +0,0 @@ -/// This file is part of Hermes2D. -/// -/// Hermes2D is free software: you can redistribute it and/or modify -/// it under the terms of the GNU General Public License as published by -/// the Free Software Foundation, either version 2 of the License, or -/// (at your option) any later version. -/// -/// Hermes2D 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 Hermes2D. If not, see . - -#ifndef __H2D_DISCRETE_PROBLEM_H -#define __H2D_DISCRETE_PROBLEM_H - -#include "hermes_common.h" -#include "weakform/weakform.h" -#include "function/function.h" -#include "exceptions.h" -#include "mixins2d.h" -#include "discrete_problem/discrete_problem_helpers.h" -#include "discrete_problem/discrete_problem_thread_assembler.h" - -namespace Hermes -{ - namespace Hermes2D - { - class PrecalcShapeset; - /// @ingroup inner - /// Discrete problem class. - /// - /// This class does assembling into external matrix / vector structures. - /// - template - class HERMES_API DiscreteProblem : - public Hermes::Mixins::TimeMeasurable, - public Hermes::Hermes2D::Mixins::SettableSpaces, - public Hermes::Mixins::StateQueryable, - public Hermes::Hermes2D::Mixins::DiscreteProblemRungeKutta, - public Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm, - public Hermes::Mixins::IntegrableWithGlobalOrder, - public Hermes::Hermes2D::Mixins::DiscreteProblemMatrixVector, - public Hermes::Hermes2D::Mixins::Parallel - { - public: - /// Constructor for multiple components / equations. - DiscreteProblem(WeakForm* wf, Hermes::vector >& spaces); - /// Constructor for one equation. - DiscreteProblem(WeakForm* wf, SpaceSharedPtr& space); - /// Non-parameterized constructor. - DiscreteProblem(); - /// Destuctor. - virtual ~DiscreteProblem(); - - /// Make this DiscreteProblem linear. - /// Does 2 things - /// 1 - turns off initialization of previous iterations for nonlinear solvers. - /// 2 - allows for assembling Dirichlet boundary conditions using a Dirichlet lift. - /// \param[in] dirichlet_lift_accordingly If true, the appropriate settings for (linear / nonlinear) - /// problem will be used (use Dirichlet lift iff the problem is linear). If false, the other way round. - void set_linear(bool to_set = true, bool dirichlet_lift_accordingly = true); - - /// Assembling. - void assemble(Scalar* coeff_vec, SparseMatrix* mat, Vector* rhs = nullptr); - /// Assembling. - /// Without the matrix. - void assemble(Scalar* coeff_vec, Vector* rhs = nullptr); - /// Light version passing nullptr for the coefficient vector. External solutions - /// are initialized with zeros. - void assemble(SparseMatrix* mat, Vector* rhs = nullptr); - /// Light version passing nullptr for the coefficient vector. External solutions - /// are initialized with zeros. - /// Without the matrix. - void assemble(Vector* rhs); - /// Assembling. - void assemble(Solution** u_ext_sln, SparseMatrix* mat, Vector* rhs); - - /// set time information for time-dependent problems. - void set_time(double time); - void set_time_step(double time_step); - - /// Sets new_ spaces for the instance. - void set_spaces(Hermes::vector >& spaces); - void set_space(SpaceSharedPtr& space); - - /// Set the weak forms. - void set_weak_formulation(WeakForm* wf); - - /// Get all spaces as a Hermes::vector. - Hermes::vector >& get_spaces(); - - protected: - /// Initialize states. - void init_assembling(Traverse::State**& states, int& num_states, Solution** u_ext_sln, Hermes::vector& meshes); - void deinit_assembling(Traverse::State** states, int num_states); - - /// RungeKutta helpers. - void set_RK(int original_spaces_count, bool force_diagonal_blocks = nullptr, Table* block_weights = nullptr); - - /// State querying helpers. - bool isOkay() const; - inline std::string getClassName() const { return "DiscreteProblem"; } - - /// Init function. Common code for the constructors. - void init(); - - /// Space instances for all equations in the system. - Hermes::vector > spaces; - int spaces_size; - - /// Internal. - bool nonlinear, add_dirichlet_lift; - - /// DiscreteProblemMatrixVector methods. - void set_matrix(SparseMatrix* mat); - void set_rhs(Vector* rhs); - void invalidate_matrix(); - - /// Assembly data. - DiscreteProblemThreadAssembler** threadAssembler; - - /// Select the right things to assemble - DiscreteProblemSelectiveAssembler selectiveAssembler; - - template friend class Solver; - template friend class LinearSolver; - template friend class NonlinearSolver; - template friend class NewtonSolver; - template friend class PicardSolver; - template friend class RungeKutta; - template friend class KellyTypeAdapt; - }; - } -} -#endif diff --git a/hermes2d/include/discrete_problem/dg/discrete_problem_dg_assembler.h b/hermes2d/include/discrete_problem/dg/discrete_problem_dg_assembler.h index 17729bae8a..e57eac9a78 100644 --- a/hermes2d/include/discrete_problem/dg/discrete_problem_dg_assembler.h +++ b/hermes2d/include/discrete_problem/dg/discrete_problem_dg_assembler.h @@ -31,8 +31,6 @@ namespace Hermes { namespace Hermes2D { - class PrecalcShapeset; - /// @ingroup inner /// Discrete problem DG assembling class. /// /// This class provides methods for assembling DG forms (forms evaluated on internal edges) into external matrix / vector structures. @@ -42,8 +40,8 @@ namespace Hermes { public: /// Constructor copying data from DiscreteProblemThreadAssembler. - DiscreteProblemDGAssembler(DiscreteProblemThreadAssembler* threadAssembler, const Hermes::vector >& spaces, Hermes::vector& meshes); - + DiscreteProblemDGAssembler(DiscreteProblemThreadAssembler* threadAssembler, const std::vector > spaces, std::vector& meshes); + /// Destructor. ~DiscreteProblemDGAssembler(); @@ -70,7 +68,7 @@ namespace Hermes void deinit_assembling_one_neighbor(); /// Initialize external functions for DG forms. - DiscontinuousFunc** init_ext_fns(Hermes::vector > ext, + DiscontinuousFunc** init_ext_fns(std::vector > ext, NeighborSearch** neighbor_searches, int order); /// Initialize neighbors. @@ -79,38 +77,38 @@ namespace Hermes void deinit_neighbors(NeighborSearch** neighbor_searches, Traverse::State* current_state); NeighborSearch*** neighbor_searches; - int* num_neighbors; + unsigned int* num_neighbors; bool** processed; // Neighbor psss, refmaps. - PrecalcShapeset ** npss; + PrecalcShapesetAssembling ** npss; RefMap ** nrefmaps; - PrecalcShapeset** pss; + PrecalcShapesetAssembling** pss; RefMap** refmaps; Solution** u_ext; AsmList* als; - Hermes::vector fns; - WeakForm* wf; + std::vector fns; + WeakFormSharedPtr wf; int spaces_size; bool nonlinear; DiscreteProblemSelectiveAssembler* selectiveAssembler; SparseMatrix* current_mat; Vector* current_rhs; - + Traverse::State* current_state; /// Current local matrix. Scalar local_stiffness_matrix[H2D_MAX_LOCAL_BASIS_SIZE * H2D_MAX_LOCAL_BASIS_SIZE * 4]; - const Hermes::vector >& spaces; - const Hermes::vector& meshes; + const std::vector > spaces; + const std::vector& meshes; template friend class DiscreteProblem; template friend class DiscreteProblemIntegrationOrderCalculator; /// Finds the correct NeighborSearch. - static NeighborSearch* get_neighbor_search_ext(WeakForm* wf, NeighborSearch** neighbor_searches, int index); + static NeighborSearch* get_neighbor_search_ext(WeakFormSharedPtr wf, NeighborSearch** neighbor_searches, int index); #ifdef DEBUG_DG_ASSEMBLING void debug(); diff --git a/hermes2d/include/discrete_problem/dg/multimesh_dg_neighbor_tree.h b/hermes2d/include/discrete_problem/dg/multimesh_dg_neighbor_tree.h index 16d455d657..470ec52a08 100644 --- a/hermes2d/include/discrete_problem/dg/multimesh_dg_neighbor_tree.h +++ b/hermes2d/include/discrete_problem/dg/multimesh_dg_neighbor_tree.h @@ -24,7 +24,6 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup inner /// Multimesh neighbors traversal class. /// Internal. template @@ -32,8 +31,8 @@ namespace Hermes { public: /// The main method, for the passed neighbor searches, it will process all multi-mesh neighbor consolidation. - static void process_edge(NeighborSearch** neighbor_searches, int num_neighbor_searches, int& num_neighbors, bool*& processed); - + static void process_edge(NeighborSearch** neighbor_searches, unsigned char num_neighbor_searches, unsigned int& num_neighbors, bool*& processed); + private: /// Initialize the tree for traversing multimesh neighbors. static void build_multimesh_tree(MultimeshDGNeighborTreeNode* root, NeighborSearch** neighbor_searches, int number); @@ -42,10 +41,10 @@ namespace Hermes static void insert_into_multimesh_tree(MultimeshDGNeighborTreeNode* node, unsigned int* transformations, unsigned int transformation_count); /// Return a global (unified list of central element transformations representing the neighbors on the union mesh. - static Hermes::vector*> get_multimesh_neighbors_transformations(MultimeshDGNeighborTreeNode* multimesh_tree); + static std::vector*> get_multimesh_neighbors_transformations(MultimeshDGNeighborTreeNode* multimesh_tree); /// Traverse the multimesh tree. Used in the function get_multimesh_neighbors_transformations(). - static void traverse_multimesh_tree(MultimeshDGNeighborTreeNode* node, Hermes::vector*>& running_transformations); + static void traverse_multimesh_tree(MultimeshDGNeighborTreeNode* node, std::vector*>& running_transformations); /// Update the NeighborSearch according to the multimesh tree. static void update_neighbor_search(NeighborSearch* ns, MultimeshDGNeighborTreeNode* multimesh_tree); @@ -59,12 +58,12 @@ namespace Hermes static int update_ns_subtree(NeighborSearch* ns, MultimeshDGNeighborTreeNode* node, unsigned int ith_neighbor); /// Traverse the multimesh subtree. Used in the function update_ns_subtree(). - static void traverse_multimesh_subtree(MultimeshDGNeighborTreeNode* node, Hermes::vector*>& running_central_transformations, - Hermes::vector*>& running_neighbor_transformations, const typename NeighborSearch::NeighborEdgeInfo& edge_info, const int& active_edge, const int& mode); + static void traverse_multimesh_subtree(MultimeshDGNeighborTreeNode* node, std::vector*>& running_central_transformations, + std::vector*>& running_neighbor_transformations, const typename NeighborSearch::NeighborEdgeInfo& edge_info, const int& active_edge, const int& mode); - friend class DiscreteProblem; - friend class DiscreteProblemDGAssembler; - friend class KellyTypeAdapt; + friend class DiscreteProblem < Scalar > ; + friend class DiscreteProblemDGAssembler < Scalar > ; + friend class KellyTypeAdapt < Scalar > ; }; } } diff --git a/hermes2d/include/discrete_problem/dg/multimesh_dg_neighbor_tree_node.h b/hermes2d/include/discrete_problem/dg/multimesh_dg_neighbor_tree_node.h index cb9212bd10..d7156228c9 100644 --- a/hermes2d/include/discrete_problem/dg/multimesh_dg_neighbor_tree_node.h +++ b/hermes2d/include/discrete_problem/dg/multimesh_dg_neighbor_tree_node.h @@ -11,7 +11,7 @@ /// GNU General Public License for more details. /// /// You should have received a copy of the GNU General Public License -/// along with Hermes2D. If not, see . +/// along with Hermes2D. If not, see . #ifndef __H2D_MULTIMESH_DG_NEIGHBOR_TREE_NODE_H #define __H2D_MULTIMESH_DG_NEIGHBOR_TREE_NODE_H @@ -20,7 +20,6 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup inner /// Multimesh neighbors traversal inner class. /// Completely internal. class MultimeshDGNeighborTreeNode diff --git a/hermes2d/include/discrete_problem/discrete_problem.h b/hermes2d/include/discrete_problem/discrete_problem.h new file mode 100644 index 0000000000..1e29f00036 --- /dev/null +++ b/hermes2d/include/discrete_problem/discrete_problem.h @@ -0,0 +1,165 @@ +/// This file is part of Hermes2D. +/// +/// Hermes2D is free software: you can redistribute it and/or modify +/// it under the terms of the GNU General Public License as published by +/// the Free Software Foundation, either version 2 of the License, or +/// (at your option) any later version. +/// +/// Hermes2D 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 Hermes2D. If not, see . + +#ifndef __H2D_DISCRETE_PROBLEM_H +#define __H2D_DISCRETE_PROBLEM_H + +#include "hermes_common.h" +#include "weakform/weakform.h" +#include "function/function.h" +#include "exceptions.h" +#include "mixins2d.h" +#include "discrete_problem_helpers.h" +#include "discrete_problem_thread_assembler.h" + +namespace Hermes +{ + namespace Hermes2D + { + class PrecalcShapeset; + /// Discrete problem class. + /// + /// This class does assembling into external matrix / vector structures. + /// + template + class HERMES_API DiscreteProblem : + public Hermes::Mixins::Loggable, + public Hermes::Mixins::TimeMeasurable, + public Hermes::Hermes2D::Mixins::SettableSpaces, + public Hermes::Mixins::StateQueryable, + public Hermes::Hermes2D::Mixins::DiscreteProblemRungeKutta, + public Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm, + public Hermes::Mixins::IntegrableWithGlobalOrder, + public Hermes::Hermes2D::Mixins::DiscreteProblemMatrixVector, + public Hermes::Hermes2D::Mixins::Parallel + { + public: + /// Constructor for multiple components / equations. + /// Making this DiscreteProblem linear does 2 things + /// 1 - turns off initialization of previous iterations for nonlinear solvers. + /// 2 - allows for assembling Dirichlet boundary conditions using a Dirichlet lift. + /// \param[in] dirichlet_lift_accordingly If true, the appropriate settings for (linear / nonlinear) + /// problem will be used (use Dirichlet lift iff the problem is linear). If false, the other way round. + DiscreteProblem(WeakFormSharedPtr wf, std::vector > spaces, bool linear = false, bool dirichlet_lift_accordingly = true, bool use_direct_for_Dirichlet_lift = false); + /// Constructor for one equation. + /// Making this DiscreteProblem linear does 2 things + /// 1 - turns off initialization of previous iterations for nonlinear solvers. + /// 2 - allows for assembling Dirichlet boundary conditions using a Dirichlet lift. + /// \param[in] dirichlet_lift_accordingly If true, the appropriate settings for (linear / nonlinear) + /// problem will be used (use Dirichlet lift iff the problem is linear). If false, the other way round. + DiscreteProblem(WeakFormSharedPtr wf, SpaceSharedPtr space, bool linear = false, bool dirichlet_lift_accordingly = true, bool use_direct_for_Dirichlet_lift = false); + /// Non-parameterized constructor. + /// Making this DiscreteProblem linear does 2 things + /// 1 - turns off initialization of previous iterations for nonlinear solvers. + /// 2 - allows for assembling Dirichlet boundary conditions using a Dirichlet lift. + /// \param[in] dirichlet_lift_accordingly If true, the appropriate settings for (linear / nonlinear) + /// problem will be used (use Dirichlet lift iff the problem is linear). If false, the other way round. + DiscreteProblem(bool linear = false, bool dirichlet_lift_accordingly = true, bool use_direct_for_Dirichlet_lift = false); + /// Destuctor. + virtual ~DiscreteProblem(); + + /// Assembling. + bool assemble(Scalar*& coeff_vec, SparseMatrix* mat, Vector* rhs = nullptr); + /// Assembling. + /// Without the matrix. + bool assemble(Scalar*& coeff_vec, Vector* rhs = nullptr); + /// Light version passing nullptr for the coefficient vector. External solutions + /// are initialized with zeros. + bool assemble(SparseMatrix* mat, Vector* rhs = nullptr); + /// Light version passing nullptr for the coefficient vector. External solutions + /// are initialized with zeros. + /// Without the matrix. + bool assemble(Vector* rhs); + + /// set time information for time-dependent problems. + void set_time(double time); + void set_time_step(double time_step); + + /// Sets new_ spaces for the instance. + void set_spaces(std::vector > spaces); + void set_space(SpaceSharedPtr space); + + /// Set the weak forms. + void set_weak_formulation(WeakFormSharedPtr wf); + + /// Get all spaces as a std::vector. + std::vector > get_spaces(); + + /// Experimental. + typedef void(*reassembled_states_reuse_linear_system_fn)(Traverse::State**& states, unsigned int& num_states, SparseMatrix* mat, Vector* rhs, Vector* dirichlet_lift_rhs, Scalar*& coeff_vec); + void set_reassembled_states_reuse_linear_system_fn(reassembled_states_reuse_linear_system_fn fn) { + this->reassembled_states_reuse_linear_system = fn; + } + reassembled_states_reuse_linear_system_fn reassembled_states_reuse_linear_system; + void set_reusable_DOFs(bool **reusable_DOFs, bool **reusable_Dirichlet) + { + for (int i = 0; i < this->num_threads_used; i++) + { + this->threadAssembler[i]->reusable_DOFs = reusable_DOFs; + this->threadAssembler[i]->reusable_Dirichlet = reusable_Dirichlet; + } + } + + /// See Hermes::Mixins::Loggable. + virtual void set_verbose_output(bool to_set); + + protected: + /// Initialize states. + void init_assembling(Traverse::State**& states, unsigned int& num_states, std::vector& meshes); + void deinit_assembling(Traverse::State** states, unsigned int num_states); + + /// RungeKutta helpers. + void set_RK(int original_spaces_count, bool force_diagonal_blocks = nullptr, Table* block_weights = nullptr); + + /// State querying helpers. + bool isOkay() const; + inline std::string getClassName() const { return "DiscreteProblem"; } + + /// Init function. Common code for the constructors. + void init(bool linear, bool dirichlet_lift_accordingly, bool use_direct_for_Dirichlet_lift); + + /// Space instances for all equations in the system. + std::vector > spaces; + int spaces_size; + + /// Dirichlet lift rhs part. + Vector* dirichlet_lift_rhs; + + /// Internal. + bool nonlinear, add_dirichlet_lift, use_direct_for_Dirichlet_lift; + + /// DiscreteProblemMatrixVector methods. + bool set_matrix(SparseMatrix* mat); + bool set_rhs(Vector* rhs); + void invalidate_matrix(); + + /// Assembly data. + DiscreteProblemThreadAssembler** threadAssembler; + + /// Select the right things to assemble + DiscreteProblemSelectiveAssembler selectiveAssembler; + + template friend class Solver; + template friend class LinearSolver; + template friend class AdaptSolver; + template friend class NonlinearSolver; + template friend class NewtonSolver; + template friend class PicardSolver; + template friend class RungeKutta; + template friend class KellyTypeAdapt; + }; + } +} +#endif diff --git a/hermes2d/include/discrete_problem/discrete_problem_helpers.h b/hermes2d/include/discrete_problem/discrete_problem_helpers.h index 51c99409fb..8681ec88d4 100644 --- a/hermes2d/include/discrete_problem/discrete_problem_helpers.h +++ b/hermes2d/include/discrete_problem/discrete_problem_helpers.h @@ -54,15 +54,15 @@ namespace Hermes class HERMES_API DiscreteProblemWeakForm { public: - WeakForm* get_weak_formulation() const; + WeakFormSharedPtr get_weak_formulation() const; protected: - DiscreteProblemWeakForm(WeakForm* wf = nullptr); + DiscreteProblemWeakForm(WeakFormSharedPtr wf = WeakFormSharedPtr(nullptr)); + + virtual void set_weak_formulation(WeakFormSharedPtr wf); - virtual void set_weak_formulation(WeakForm* wf); - /// Weak formulation. - WeakForm* wf; + WeakFormSharedPtr wf; }; template @@ -71,8 +71,8 @@ namespace Hermes protected: DiscreteProblemMatrixVector(); - virtual void set_matrix(SparseMatrix* mat); - virtual void set_rhs(Vector* rhs); + virtual bool set_matrix(SparseMatrix* mat); + virtual bool set_rhs(Vector* rhs); SparseMatrix* current_mat; Vector* current_rhs; @@ -81,10 +81,10 @@ namespace Hermes /// \ingroup Helper methods inside {calc_order_*, assemble_*} /// Init geometry, jacobian * weights, return the number of integration points. - HERMES_API int init_geometry_points_allocated_jwt(RefMap* rep_reference_mapping, int order, Geom*& geometry, double* jacobian_x_weights); - HERMES_API int init_geometry_points(RefMap** reference_mapping, int reference_mapping_count, int order, Geom*& geometry, double*& jacobian_x_weights); - HERMES_API int init_surface_geometry_points_allocated_jwt(RefMap* rep_reference_mapping, int& order, int isurf, int marker, Geom*& geometry, double* jacobian_x_weights); - HERMES_API int init_surface_geometry_points(RefMap** reference_mapping, int reference_mapping_count, int& order, int isurf, int marker, Geom*& geometry, double*& jacobian_x_weights); + HERMES_API unsigned char init_geometry_points_allocated(RefMap** reference_mapping, unsigned short reference_mapping_count, int order, GeomVol& geometry, double* jacobian_x_weights); + HERMES_API unsigned char init_geometry_points_allocated(RefMap* rep_reference_mapping, int order, GeomVol& geometry, double* jacobian_x_weights); + HERMES_API unsigned char init_surface_geometry_points_allocated(RefMap** reference_mapping, unsigned short reference_mapping_count, int& order, unsigned char isurf, int marker, GeomSurf& geometry, double* jacobian_x_weights); + HERMES_API unsigned char init_surface_geometry_points_allocated(RefMap* rep_reference_mapping, int& order, unsigned char isurf, int marker, GeomSurf& geometry, double* jacobian_x_weights); } } #endif diff --git a/hermes2d/include/discrete_problem/discrete_problem_integration_order_calculator.h b/hermes2d/include/discrete_problem/discrete_problem_integration_order_calculator.h index a089293871..bf008aec3e 100644 --- a/hermes2d/include/discrete_problem/discrete_problem_integration_order_calculator.h +++ b/hermes2d/include/discrete_problem/discrete_problem_integration_order_calculator.h @@ -33,12 +33,11 @@ namespace Hermes namespace Hermes2D { class PrecalcShapeset; - /// @ingroup inner /// DiscreteProblemIntegrationOrderCalculator class. /// \brief Provides methods of integration order calculation. template class HERMES_API DiscreteProblemIntegrationOrderCalculator : - public Hermes::Hermes2D::Mixins::DiscreteProblemRungeKutta + public Hermes::Hermes2D::Mixins::DiscreteProblemRungeKutta < Scalar > { private: DiscreteProblemIntegrationOrderCalculator(DiscreteProblemSelectiveAssembler* selectiveAssembler); @@ -47,14 +46,16 @@ namespace Hermes void adjust_order_to_refmaps(Form *form, int& order, Hermes::Ord* o, RefMap** current_refmaps); /// Matrix volumetric forms - calculate the integration order. - int calc_order_matrix_form(const Hermes::vector >& spaces, MatrixForm* mfv, RefMap** current_refmaps, Func** ext, Func** u_ext); + template + int calc_order_matrix_form(const std::vector >& spaces, MatrixFormType* mf, RefMap** current_refmaps, Func** ext, Func** u_ext); /// Vector volumetric forms - calculate the integration order. - int calc_order_vector_form(const Hermes::vector >& spaces, VectorForm* mfv, RefMap** current_refmaps, Func** ext, Func** u_ext); + template + int calc_order_vector_form(const std::vector >& spaces, VectorFormType* vf, RefMap** current_refmaps, Func** ext, Func** u_ext); /// Order calculation. - int calculate_order(const Hermes::vector >& spaces, RefMap** current_refmaps, WeakForm* current_wf); - + int calculate_order(const std::vector >& spaces, RefMap** current_refmaps, WeakFormSharedPtr current_wf); + /// \ingroup Helper methods inside {calc_order_*, assemble_*} /// Calculates orders for previous nonlinear iterations. Func** init_u_ext_orders(); @@ -64,24 +65,24 @@ namespace Hermes /// \ingroup Helper methods inside {calc_order_*, assemble_*} /// Calculates orders for external functions. - Func** init_ext_orders(Hermes::vector >& ext, Hermes::vector >& u_ext_fns, Func** u_ext_func); + Func** init_ext_orders(std::vector >& ext, std::vector >& u_ext_fns, Func** u_ext_func); /// \ingroup Helper methods inside {calc_order_*, assemble_*} /// Cleans up after init_ext_orders. - void deinit_ext_orders(Hermes::vector >& ext, Hermes::vector >& u_ext_fns, Func** ext_func); + void deinit_ext_orders(Func** ext_func); /// Calculates integration order for DG matrix forms. - int calc_order_dg_matrix_form(const Hermes::vector >& spaces, Traverse::State* state, MatrixFormDG* mfDG, RefMap** current_refmaps, Solution** current_u_ext, bool neighbor_supp_u, bool neighbor_supp_v, NeighborSearch** neighbor_searches); + int calc_order_dg_matrix_form(const std::vector > spaces, Traverse::State* state, MatrixFormDG* mfDG, RefMap** current_refmaps, Solution** current_u_ext, bool neighbor_supp_u, bool neighbor_supp_v, NeighborSearch** neighbor_searches); /// Calculates integration order for DG vector forms. - int calc_order_dg_vector_form(const Hermes::vector >& spaces, Traverse::State* state, VectorFormDG* vfDG, RefMap** current_refmaps, Solution** current_u_ext, bool neighbor_supp_v, NeighborSearch** neighbor_searches); + int calc_order_dg_vector_form(const std::vector > spaces, Traverse::State* state, VectorFormDG* vfDG, RefMap** current_refmaps, Solution** current_u_ext, bool neighbor_supp_v, NeighborSearch** neighbor_searches); /// One external function for DG. DiscontinuousFunc* init_ext_fn_ord(NeighborSearch* ns, MeshFunctionSharedPtr fu); /// Initialize orders of external functions for DG forms. - DiscontinuousFunc** init_ext_fns_ord(Hermes::vector > &ext, + DiscontinuousFunc** init_ext_fns_ord(std::vector > &ext, NeighborSearch** neighbor_searches); - + /// Deinitialize orders of external functions for DG forms. template void deinit_ext_fns_ord(Form *form, FormType** oi, FormType** oext); @@ -91,6 +92,8 @@ namespace Hermes /// For initialization of external functions. Solution** u_ext; + Func** ext_orders; + Func** u_ext_orders; Traverse::State* current_state; template friend class DiscreteProblem; diff --git a/hermes2d/include/discrete_problem/discrete_problem_selective_assembler.h b/hermes2d/include/discrete_problem/discrete_problem_selective_assembler.h index 60845de937..6bc1170625 100644 --- a/hermes2d/include/discrete_problem/discrete_problem_selective_assembler.h +++ b/hermes2d/include/discrete_problem/discrete_problem_selective_assembler.h @@ -30,20 +30,22 @@ namespace Hermes { class PrecalcShapeset; template class Solver; - /// @ingroup inner /// Discrete problem selective assembling class. /// \brief Provides capabilities to (re-)assemble a matrix / vector only where necessary. /// See also Solver::keep_element_values() /// template - class HERMES_API DiscreteProblemSelectiveAssembler : + class HERMES_API DiscreteProblemSelectiveAssembler : + public Hermes::Mixins::TimeMeasurable, + public Hermes::Hermes2D::Mixins::Parallel, + public Hermes::Mixins::Loggable, public Hermes::Hermes2D::Mixins::DiscreteProblemRungeKutta, - public Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm + public Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm < Scalar > { public: DiscreteProblemSelectiveAssembler(); ~DiscreteProblemSelectiveAssembler(); - + /// Preassembling. /// Precalculate matrix sparse structure. /// If force_diagonal_block == true, then (zero) matrix @@ -52,14 +54,14 @@ namespace Hermes /// a matrix that has nonzeros in these blocks. The Table serves for optional /// weighting of matrix blocks in systems. /// Returns false if there are no states to assemble. - bool prepare_sparse_structure(SparseMatrix* mat, Vector* rhs, Hermes::vector >& spaces, Traverse::State**& states, int& num_states); - + bool prepare_sparse_structure(SparseMatrix* mat, Vector* rhs, std::vector > spaces, Traverse::State**& states, unsigned int& num_states); + /// Sets new_ spaces for the instance. - void set_spaces(Hermes::vector >& spaces); - + void set_spaces(std::vector > spaces); + /// Set the weak forms. - void set_weak_formulation(WeakForm* wf); - + void set_weak_formulation(WeakFormSharedPtr wf); + /// Decides if the form will be assembled on this State. bool form_to_be_assembled(MatrixForm* form, Traverse::State* current_state); /// Decides if the form will be assembled on this State. @@ -80,7 +82,7 @@ namespace Hermes protected: /// Spaces. - int spaces_size; + unsigned int spaces_size; /// Seq numbers of Space instances in spaces. int* sp_seq; @@ -88,11 +90,13 @@ namespace Hermes /// Matrix structure can be reused. /// If other conditions apply. bool matrix_structure_reusable; + SparseMatrix* previous_mat; bool vector_structure_reusable; + Vector* previous_rhs; - friend class DiscreteProblem; - friend class DiscreteProblemIntegrationOrderCalculator; - friend class Solver; + friend class DiscreteProblem < Scalar > ; + friend class DiscreteProblemIntegrationOrderCalculator < Scalar > ; + friend class Solver < Scalar > ; }; } } diff --git a/hermes2d/include/discrete_problem/discrete_problem_thread_assembler.h b/hermes2d/include/discrete_problem/discrete_problem_thread_assembler.h index ed03a743b5..709d3bac94 100644 --- a/hermes2d/include/discrete_problem/discrete_problem_thread_assembler.h +++ b/hermes2d/include/discrete_problem/discrete_problem_thread_assembler.h @@ -27,63 +27,71 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup inner /// Discrete problem thread assembler class /// \brief This class is a one-thread (non-DG) assembly worker. /// template - class HERMES_API DiscreteProblemThreadAssembler : + class HERMES_API DiscreteProblemThreadAssembler : public Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm, public Hermes::Hermes2D::Mixins::DiscreteProblemRungeKutta, - public Hermes::Hermes2D::Mixins::DiscreteProblemMatrixVector + public Hermes::Hermes2D::Mixins::DiscreteProblemMatrixVector < Scalar > { public: /// Free all data. void free(); private: - DiscreteProblemThreadAssembler(DiscreteProblemSelectiveAssembler* selectiveAssembler); + DiscreteProblemThreadAssembler(DiscreteProblemSelectiveAssembler* selectiveAssembler, bool nonlinear); ~DiscreteProblemThreadAssembler(); /// Initialization of all structures concerning space - assembly lists, precalculated shapesets, .. - void init_spaces(const Hermes::vector >& spaces); + void init_spaces(const std::vector > spaces); /// Initialization of the weak formulation. - void set_weak_formulation(WeakForm* wf); + void set_weak_formulation(WeakFormSharedPtr wf); /// Initialization of previous iterations for non-linear solvers. - void init_u_ext(const Hermes::vector >& spaces, Solution** u_ext_sln); + void init_u_ext(const std::vector > spaces, Solution** u_ext_sln); /// Initializes the Transformable array for doing transformations. - void init_assembling(Solution** u_ext_sln, const Hermes::vector >& spaces, bool nonlinear, bool add_dirichlet_lift); + void init_assembling(Solution** u_ext_sln, const std::vector >& spaces, bool add_dirichlet_lift); /// Initialize Func storages. - void init_funcs(); + void init_funcs_wf(); + void init_funcs_space(); /// Func Memory Pool pj_pool_t *FuncMemoryPool; void init_funcs_memory_pool(); /// De-initialize Func storages. void deinit_funcs(); + + void deinit_funcs_space(); + bool funcs_space_initialized; + void deinit_funcs_wf(); + bool funcs_wf_initialized; /// Initializitation of u-ext values into Funcs void init_u_ext_values(int order); /// Initializitation of ext values into Funcs - void init_ext_values(Func** target_array, Hermes::vector >& ext, Hermes::vector >& u_ext_fns, int order, Func** u_ext_func, Geom* geometry); + template + void init_ext_values(Func** target_array, std::vector >& ext, std::vector >& u_ext_fns, int order, Func** u_ext_func, Geom* geometry); /// Sets active elements & transformations - void init_assembling_one_state(const Hermes::vector >& spaces, Traverse::State* current_state); + void init_assembling_one_state(const std::vector >& spaces, Traverse::State* current_state); /// Assemble the state. void assemble_one_state(); /// Matrix volumetric forms - assemble the form. - void assemble_matrix_form(MatrixForm* form, int order, Func** base_fns, Func** test_fns, - AsmList* current_als_i, AsmList* current_als_j, int n_quadrature_points, Geom* geometry, double* jacobian_x_weights); + template + void assemble_matrix_form(MatrixFormType* form, int order, Func** base_fns, Func** test_fns, + AsmList* current_als_i, AsmList* current_als_j, int n_quadrature_points, Geom* geometry, double* jacobian_x_weights); /// Vector volumetric forms - assemble the form. - void assemble_vector_form(VectorForm* form, int order, Func** test_fns, AsmList* current_als, - int n_quadrature_points, Geom* geometry, double* jacobian_x_weights); + template + void assemble_vector_form(VectorFormType* form, int order, Func** test_fns, AsmList* current_als, + int n_quadrature_points, Geom* geometry, double* jacobian_x_weights); /// De-initialization of 1 state assembly void deinit_assembling_one_state(); - + /// De-initialization. void deinit_assembling(); - + /// Free space-related data. void free_spaces(); /// Free weak formulation data. @@ -91,15 +99,18 @@ namespace Hermes /// Free nonlinearities-related data. void free_u_ext(); - PrecalcShapeset** pss; + /// Dirichlet lift rhs part. + Vector* dirichlet_lift_rhs; + + PrecalcShapesetAssembling** pss; RefMap** refmaps; RefMap* rep_refmap; Solution** u_ext; - Hermes::vector fns; - + std::vector fns; + /// For selective reassembling. DiscreteProblemSelectiveAssembler* selectiveAssembler; - + /// Currently assembled state. Traverse::State* current_state; /// Current local matrix. @@ -118,8 +129,8 @@ namespace Hermes void deinit_calculation_variables(); Func* funcs[H2D_MAX_COMPONENTS][H2D_MAX_LOCAL_BASIS_SIZE]; Func* funcsSurface[H2D_MAX_NUMBER_EDGES][H2D_MAX_COMPONENTS][H2D_MAX_LOCAL_BASIS_SIZE]; - Geom* geometry; - Geom* geometrySurface[H2D_MAX_NUMBER_EDGES]; + GeomVol geometry; + GeomSurf geometrySurface[H2D_MAX_NUMBER_EDGES]; double jacobian_x_weights[H2D_MAX_INTEGRATION_POINTS_COUNT]; double jacobian_x_weightsSurface[H2D_MAX_NUMBER_EDGES][H2D_MAX_INTEGRATION_POINTS_COUNT]; int n_quadrature_points; @@ -134,11 +145,15 @@ namespace Hermes AsmList als[H2D_MAX_COMPONENTS]; AsmList alsSurface[H2D_MAX_NUMBER_EDGES][H2D_MAX_COMPONENTS]; - int spaces_size; + unsigned short spaces_size; bool nonlinear, add_dirichlet_lift; - friend class DiscreteProblem; - friend class DiscreteProblemDGAssembler; + friend class DiscreteProblem < Scalar > ; + friend class DiscreteProblemDGAssembler < Scalar > ; + + /// Experimental. + bool** reusable_DOFs; + bool** reusable_Dirichlet; }; } } diff --git a/hermes2d/include/forms.h b/hermes2d/include/forms.h index f5b79b2c8b..ee94cf8c6c 100644 --- a/hermes2d/include/forms.h +++ b/hermes2d/include/forms.h @@ -33,102 +33,185 @@ namespace Hermes "Neighboring elements are not defined and so are not function traces on their interface. " "Did you forget setting H2D_ANY_INNER_EDGE in add_matrix/vector_form?"; - - #pragma region Geometry + /// Geometry (coordinates, normals, tangents) of either an element or an edge. - /// @ingroup inner template class HERMES_API Geom { public: - /// Constructor. - Geom(); - - T *x, *y; ///< Coordinates[in physical domain]. - T *nx, *ny; ///< Normals[in physical domain] (locally oriented - ///< to point outside the element). Only for edge - ///< (undefined for element). - T *tx, *ty; ///< Tangents[in physical domain]. Only for edge. - int id; ///< ID number of the element (undefined for edge). - int isurf; ///< Order number of an edge of the element. - - /// Methods designed for discontinuous functions, return errors here. - virtual int get_neighbor_marker() const { throw Hermes::Exceptions::Exception(ERR_UNDEFINED_NEIGHBORING_ELEMENTS); return -1; } - /// Methods designed for discontinuous functions, return errors here. - virtual int get_neighbor_id() const { throw Hermes::Exceptions::Exception(ERR_UNDEFINED_NEIGHBORING_ELEMENTS); return -1; } - /// Methods designed for discontinuous functions, return errors here. - virtual T get_neighbor_diam() const { throw Hermes::Exceptions::Exception(ERR_UNDEFINED_NEIGHBORING_ELEMENTS); return T(); } - - /// Element diameter (for edge, diameter of the parent element). - T get_diam_approximation(int n); - /// Element area (for edge, area of the parent element). - T get_area(int n, double* wt); - - /// Virtual destructor allowing deallocation of inherited classes (InterfaceGeom) in polymorphic cases. - virtual ~Geom() {}; - - /// Deallocation. - virtual void free(); - virtual void free_ord() {}; - int elem_marker; ///< Element marker (for both volumetric and surface forms). - int edge_marker; ///< Edge marker (for surface forms only). - - int orientation; ///< 0 .... if(nx, ny) is equal to the global normal, - ///< otherwise 1 (each edge has a unique global normal). - ///< Only for edge. + /// x-coordinates[in physical domain]. + T x[H2D_MAX_INTEGRATION_POINTS_COUNT]; + /// y-coordinates[in physical domain]. + T y[H2D_MAX_INTEGRATION_POINTS_COUNT]; + + /// Element marker (for both volumetric and surface forms). + int elem_marker; + }; + + /// Geometry - volumetric. + template + class HERMES_API GeomVol : public Geom < T > + { + public: + /// ID number of the element. + int id; + + /// Element diameter approximation. + T get_diam_approximation(unsigned char n); + /// Element area. + T get_area(unsigned char n, double* wt); + }; + + /// Geometry - surface. + template + class HERMES_API GeomSurf : public Geom < T > + { + public: + T nx[H2D_MAX_INTEGRATION_POINTS_COUNT]; + T ny[H2D_MAX_INTEGRATION_POINTS_COUNT]; + T tx[H2D_MAX_INTEGRATION_POINTS_COUNT]; + T ty[H2D_MAX_INTEGRATION_POINTS_COUNT]; + + /// Internal number of an edge of the element. + unsigned char isurf; + + /// Edge marker. + int edge_marker; + + /// 0 .... if(nx, ny) is equal to the global normal, + /// otherwise 1 (each edge has a unique global normal). + /// Only for edge. + bool orientation; + }; + + /// Geometry - volumetric - for order calculation. + template<> + class HERMES_API GeomVol < Hermes::Ord > + { + public: + GeomVol() + { + x[0] = y[0] = Hermes::Ord(1); + } + Hermes::Ord x[1]; + Hermes::Ord y[1]; + + /// Element marker (for both volumetric and surface forms). + int elem_marker; + + /// Element diameter approximation. + Hermes::Ord get_diam_approximation(unsigned char n) { return Hermes::Ord(1); }; + /// Element area. + Hermes::Ord get_area(unsigned char n, double* wt) { return Hermes::Ord(1); }; + }; + + /// Geometry - surface - for order calculation. + template<> + class HERMES_API GeomSurf < Hermes::Ord > + { + public: + GeomSurf() + { + x[0] = y[0] = tx[0] = ty[0] = nx[0] = ny[0] = Hermes::Ord(1); + } + Hermes::Ord x[1]; + Hermes::Ord y[1]; + Hermes::Ord tx[1]; + Hermes::Ord ty[1]; + Hermes::Ord nx[1]; + Hermes::Ord ny[1]; + + /// For InterfaceGeom purposes. + unsigned char np; }; /// Small class which contains information about the element on the other side of an interface. /// - /// It just appends three new_ parameters to an instance of Geom. During destruction, the wrapped - /// instance is not touched - it must be destroyed separately. You may call the overriden methods - /// \c free or \c free_ord in order to do this via the instance of InterfaceGeom. + /// Due to a very varied nature of data one may need in DG assembling, both central and neighbor elements are fully accessible in this class. /// - /// @ingroup inner template - class HERMES_API InterfaceGeom : public Geom + class HERMES_API InterfaceGeom { public: - int neighb_id; - T neighb_diam; - int get_neighbor_marker() const; - int get_neighbor_id() const; - T get_neighbor_diam() const; - /// Constructor. - InterfaceGeom(Geom* geom, int n_marker, int n_id, T n_diam); - - void free(); - void free_ord(); + InterfaceGeom(GeomSurf* geom, Element* central_el, Element* neighb_el); + T* x; + T* y; + T* nx; + T* ny; + T* tx; + T* ty; + Element* central_el; + Element* neighb_el; + + /// Element marker (for both volumetric and surface forms). + int elem_marker; + /// Edge marker. + int edge_marker; + + /// 0 .... if(nx, ny) is equal to the global normal, + /// otherwise 1 (each edge has a unique global normal). + /// Only for edge. + bool orientation; + + /// Internal number of an edge of the element. + unsigned char isurf; + + /// Element diameter approximation. + T get_diam_approximation(unsigned char n); + /// Element area. + T get_area(unsigned char n, double* wt); private: - Geom* wrapped_geom; - int neighb_marker; + GeomSurf* wrapped_geom; template friend class KellyTypeAdapt; }; - /// Init element geometry for calculating the integration order. - HERMES_API Geom* init_geom_ord(); + /// Geometry - interface (DG) - for order calculation. + template<> + class HERMES_API InterfaceGeom < Hermes::Ord > + { + public: + /// Constructor. + InterfaceGeom() + { + x[0] = y[0] = tx[0] = ty[0] = nx[0] = ny[0] = Hermes::Ord(1); + } + Hermes::Ord x[1]; + Hermes::Ord y[1]; + Hermes::Ord tx[1]; + Hermes::Ord ty[1]; + Hermes::Ord nx[1]; + Hermes::Ord ny[1]; + + /// Element diameter approximation. + Hermes::Ord get_diam_approximation(unsigned char n) { return Hermes::Ord(1); }; + /// Element area. + Hermes::Ord get_area(unsigned char n, double* wt) { return Hermes::Ord(1); }; + }; + + /// Init element geometry for volumetric integrals. + HERMES_API GeomVol* init_geom_vol(RefMap *rm, const int order); /// Init element geometry for volumetric integrals. - HERMES_API Geom* init_geom_vol(RefMap *rm, const int order); + HERMES_API void init_geom_vol_allocated(GeomVol& geom, RefMap *rm, const int order); + /// Init element geometry for surface integrals. + HERMES_API GeomSurf* init_geom_surf(RefMap *rm, unsigned char isurf, int marker, const int order, double3*& tan); /// Init element geometry for surface integrals. - HERMES_API Geom* init_geom_surf(RefMap *rm, int isurf, int marker, const int order, double3*& tan); + HERMES_API void init_geom_surf_allocated(GeomSurf& geom, RefMap *rm, unsigned char isurf, int marker, const int order, double3*& tan); #pragma endregion #pragma region Func /// Calculated function values (from the class Function) on an element for assembling. /// Internal. - /// @ingroup inner template class HERMES_API Func { }; /// Calculated function values (from the class Function) on an element for assembling. - /// @ingroup inner template<> - class HERMES_API Func + class HERMES_API Func < double > { public: /// Constructor. @@ -178,9 +261,8 @@ namespace Hermes }; /// Calculated function values (from the class Function) on an element for assembling. - /// @ingroup inner template<> - class HERMES_API Func > + class HERMES_API Func < std::complex > { public: /// Constructor. @@ -219,9 +301,11 @@ namespace Hermes }; template<> - class HERMES_API Func + class HERMES_API Func < Ord > { public: + Func(const int order); + const int order; Ord val; Ord dx; Ord dy; @@ -234,32 +318,36 @@ namespace Hermes void subtract(Func* func); }; - - /// @ingroup inner /** \class DiscontinuousFunc forms.h "src/form/forms.h" - * \brief This class represents a function with jump discontinuity on an interface of two elements. - * - * We will refer to one of the elements sharing the interface of discontinuity as to the \em central element, - * while to the other one as to the \em neighbor element. - * - * Instance of the class may be constructed either with two \c Func objects, which represent the continuous - * components on the central and the neighbor element, respectively, or with only one \c Func object and - * information about its support (where it attains non-zero value). The discontinuous function is in the latter - * case constructed by extending the supplied function by zero to the other element. Values and derivatives from - * both elements may then be obtained by querying the corresponding \c Func object, using methods - * \c get_val_central, \c get_val_neighbor, etc. - **/ +* \brief This class represents a function with jump discontinuity on an interface of two elements. +* +* We will refer to one of the elements sharing the interface of discontinuity as to the \em central element, +* while to the other one as to the \em neighbor element. +* +* Instance of the class may be constructed either with two \c Func objects, which represent the continuous +* components on the central and the neighbor element, respectively, or with only one \c Func object and +* information about its support (where it attains non-zero value). The discontinuous function is in the latter +* case constructed by extending the supplied function by zero to the other element. Values and derivatives from +* both elements may then be obtained by querying the corresponding \c Func object, using methods +* \c get_val_central, \c get_val_neighbor, etc. +**/ template - class HERMES_API DiscontinuousFunc : public Func + class HERMES_API DiscontinuousFunc : public Func < T > { public: - Func *fn_central; ///< Central element's component. - Func *fn_neighbor; ///< Neighbor element's component. - - T *val; ///< Function values. If T == Hermes::Ord and orders vary with direction, this returns max(h_order, v_order). - T *dx, *dy; ///< First-order partial derivatives. - T *val_neighbor; ///< Function values. If T == Hermes::Ord and orders vary with direction, this returns max(h_order, v_order). - T *dx_neighbor, *dy_neighbor; ///< First-order partial derivatives. + /// Central element's component. + Func *fn_central; + /// Neighbor element's component. + Func *fn_neighbor; + + /// Function values. If T == Hermes::Ord and orders vary with direction, this returns max(h_order, v_order). + T *val; + /// First-order partial derivatives. + T *dx, *dy; + /// Function values. If T == Hermes::Ord and orders vary with direction, this returns max(h_order, v_order). + T *val_neighbor; + /// First-order partial derivatives. + T *dx_neighbor, *dy_neighbor; /// One-component constructor. /// @@ -283,17 +371,21 @@ namespace Hermes using Func::subtract; void subtract(const DiscontinuousFunc& func); - bool reverse_neighbor_side; ///< True if values from the neighbor have to be retrieved in reverse order + /// True if values from the neighbor have to be retrieved in reverse order + bool reverse_neighbor_side; ///< (when retrieving values on an edge that is oriented differently in both elements). - static T zero; ///< Zero value used for the zero-extension. + /// Zero value used for the zero-extension. + static T zero; }; template<> - class HERMES_API DiscontinuousFunc : public Func + class HERMES_API DiscontinuousFunc : public Func < Ord > { public: - Func *fn_central; ///< Central element's component. - Func *fn_neighbor; ///< Neighbor element's component. + /// Central element's component. + Func *fn_central; + /// Neighbor element's component. + Func *fn_neighbor; Ord val; Ord dx, dy; @@ -319,22 +411,19 @@ namespace Hermes using Func::subtract; void subtract(const DiscontinuousFunc& func); - bool reverse_neighbor_side; ///< True if values from the neighbor have to be retrieved in reverse order + /// True if values from the neighbor have to be retrieved in reverse order + bool reverse_neighbor_side; ///< (when retrieving values on an edge that is oriented differently in both elements). - static Ord zero; ///< Zero value used for the zero-extension. + /// Zero value used for the zero-extension. + static Ord zero; }; - - /// Init the function for calculation the integration order. - HERMES_API Func* init_fn_ord(const int order); - /// Init the shape function for the evaluation of the volumetric/surface integral (transformation of values). HERMES_API Func* init_fn(PrecalcShapeset *fu, RefMap *rm, const int order); /// Init the mesh-function for the evaluation of the volumetric/surface integral. template HERMES_API Func* init_fn(MeshFunction* fu, const int order); - /// Preallocate the Func (all we need is np & nc). template HERMES_API Func* preallocate_fn(pj_pool_t* memoryPool = nullptr); @@ -348,13 +437,12 @@ namespace Hermes template HERMES_API void init_fn_preallocated(Func* u, UExtFunction* fu, Func** ext, Func** u_ext, const int order, Geom* geometry, ElementMode2D mode); - /// Utilities follow /// Init zero function template HERMES_API Func* init_zero_fn(ElementMode2D mode, int order, Quad2D* quad_2d = nullptr, int nc = 1); - /// Init UExt function + /// Init UExt function - volumetric template HERMES_API Func* init_fn(UExtFunction* fu, Func** ext, Func** u_ext, const int order, Geom* geometry, ElementMode2D mode); #pragma endregion diff --git a/hermes2d/include/function/exact_solution.h b/hermes2d/include/function/exact_solution.h index 51438fc29c..804ac24238 100644 --- a/hermes2d/include/function/exact_solution.h +++ b/hermes2d/include/function/exact_solution.h @@ -22,14 +22,15 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup meshFunctions + template class Geom; + /// \brief Represents an exact solution of a PDE. /// /// ExactSolution represents an arbitrary user-specified function defined on a domain (mesh), /// typically an exact solution to a PDE. This can be used to compare an approximate solution /// with an exact solution (see DiffFilter). template - class HERMES_API ExactSolution : public Solution + class HERMES_API ExactSolution : public Solution < Scalar > { public: ExactSolution(MeshSharedPtr mesh); @@ -57,11 +58,10 @@ namespace Hermes template friend class Solution; }; - /// @ingroup meshFunctions /// These classes are abstract (pure virtual destructor). /// The user is supposed to subclass them (see e.g. NIST benchmarks). template - class HERMES_API ExactSolutionScalar : public ExactSolution + class HERMES_API ExactSolutionScalar : public ExactSolution < Scalar > { public: ExactSolutionScalar(MeshSharedPtr mesh); @@ -83,12 +83,10 @@ namespace Hermes }; }; - - /// @ingroup meshFunctions. /// Serves for postprocessing of element-wise constant values (such as the error in adaptivity). /// The second template parameter ValueType must be a type castable to Scalar. template - class HERMES_API ExactSolutionConstantArray : public ExactSolutionScalar + class HERMES_API ExactSolutionConstantArray : public ExactSolutionScalar < Scalar > { public: /// Constructor. @@ -119,10 +117,8 @@ namespace Hermes template friend class Solution; }; - - /// @ingroup meshFunctions template - class HERMES_API ExactSolutionVector : public ExactSolution + class HERMES_API ExactSolutionVector : public ExactSolution < Scalar > { public: ExactSolutionVector(MeshSharedPtr mesh); @@ -144,9 +140,8 @@ namespace Hermes }; }; - /// @ingroup meshFunctions template - class HERMES_API ConstantSolution : public ExactSolutionScalar + class HERMES_API ConstantSolution : public ExactSolutionScalar < Scalar > { public: ConstantSolution(MeshSharedPtr mesh, Scalar constant); @@ -169,9 +164,8 @@ namespace Hermes Scalar constant; }; - /// @ingroup meshFunctions template - class HERMES_API ZeroSolution : public ExactSolutionScalar + class HERMES_API ZeroSolution : public ExactSolutionScalar < Scalar > { public: ZeroSolution(MeshSharedPtr mesh); @@ -185,9 +179,8 @@ namespace Hermes virtual MeshFunction* clone() const; }; - /// @ingroup meshFunctions template - class HERMES_API ConstantSolutionVector : public ExactSolutionVector + class HERMES_API ConstantSolutionVector : public ExactSolutionVector < Scalar > { public: ConstantSolutionVector(MeshSharedPtr mesh, Scalar constantX, Scalar constantY); @@ -210,9 +203,8 @@ namespace Hermes Scalar constantY; }; - /// @ingroup meshFunctions template - class HERMES_API ZeroSolutionVector : public ExactSolutionVector + class HERMES_API ZeroSolutionVector : public ExactSolutionVector < Scalar > { public: ZeroSolutionVector(MeshSharedPtr mesh); @@ -226,9 +218,8 @@ namespace Hermes virtual MeshFunction* clone() const; }; - /// @ingroup meshFunctions /// Eggshell function. - class HERMES_API ExactSolutionEggShell : public ExactSolutionScalar + class HERMES_API ExactSolutionEggShell : public ExactSolutionScalar < double > { public: /// \param[in] polynomialOrder The polynomial order used for the space where the solution of the @@ -249,10 +240,9 @@ namespace Hermes MeshFunction* clone() const; }; - /// @ingroup meshFunctions /// Function operating on previous nonlinear solutions in assembling (u_ext) template - class HERMES_API UExtFunction : public Function + class HERMES_API UExtFunction : public Function < Scalar > { public: /// \param[in] polynomialOrder The polynomial order used for the space where the solution of the @@ -266,11 +256,11 @@ namespace Hermes virtual Func* get_pt_value(double x, double y, bool use_MeshHashGrid = false, Element* e = nullptr); void free(void); - virtual void precalculate(int order, int mask); + virtual void precalculate(unsigned short order, unsigned short mask); }; template - class HERMES_API UExtFunctionSharedPtr : public std::tr1::shared_ptr > + class HERMES_API UExtFunctionSharedPtr : public std::tr1::shared_ptr < UExtFunction > { public: UExtFunctionSharedPtr(UExtFunction* ptr = nullptr); diff --git a/hermes2d/include/function/filter.h b/hermes2d/include/function/filter.h index 9b05cda43b..3b16027a34 100644 --- a/hermes2d/include/function/filter.h +++ b/hermes2d/include/function/filter.h @@ -25,7 +25,6 @@ namespace Hermes { struct UniData; - /// @ingroup meshFunctions /// Filter is a general postprocessing class, intended for visualization. /// The output of Filter is an arbitrary combination of up to three input functions, /// which usually are Solutions to PDEs, but can also be other Filters. @@ -33,25 +32,22 @@ namespace Hermes /// (This class cannot be instantiated.) /// template - class HERMES_API Filter : public MeshFunction + class HERMES_API Filter : public MeshFunction < Scalar > { public: Filter(); - Filter(Hermes::vector > solutions); - Filter(MeshFunctionSharedPtr* solutions, int num); + Filter(std::vector > solutions); virtual ~Filter(); virtual void reinit(); - + inline SpaceType get_space_type() const { return space_type; }; /// State querying helpers. inline std::string getClassName() const { return "Filter"; } protected: - void init(Hermes::vector > solutions); - virtual void set_quad_2d(Quad2D* quad_2d); virtual void set_active_element(Element* e); @@ -64,22 +60,19 @@ namespace Hermes virtual void init(); - int num; - - MeshFunctionSharedPtr sln[H2D_MAX_COMPONENTS]; + std::vector > solutions; - uint64_t sln_sub[H2D_MAX_COMPONENTS]; + std::vector solutions_sub_idx; bool unimesh; SpaceType space_type; - + UniData** unidata; void copy_base(Filter* flt); }; - /// @ingroup meshFunctions /// SimpleFilter is a base class for predefined simple filters (MagFilter, DiffFilter...). /// The 'simplicity' lies in the fact that only one value per input function can be /// combined (e.g., not a value and a derivative). If this is not sufficient, a full-fledged @@ -96,30 +89,28 @@ namespace Hermes /// Otherwise it is Scalar-valued. /// template - class HERMES_API SimpleFilter : public Filter + class HERMES_API SimpleFilter : public Filter < Scalar > { public: SimpleFilter(); virtual ~SimpleFilter(); - SimpleFilter(Hermes::vector > solutions, Hermes::vector items = Hermes::vector()); + SimpleFilter(std::vector > solutions, std::vector items = std::vector()); virtual Func* get_pt_value(double x, double y, bool use_MeshHashGrid = false, Element* e = nullptr); protected: - int item[H2D_MAX_COMPONENTS]; + std::vector items; - virtual void filter_fn(int n, Hermes::vector values, Scalar* result) = 0; + virtual void filter_fn(int n, const std::vector& values, Scalar* result) = 0; void init_components(); - virtual void precalculate(int order, int mask); - + virtual void precalculate(unsigned short order, unsigned short mask); }; - /// @ingroup meshFunctions /// ComplexFilter is used to transform complex solutions into its real parts. /// - class HERMES_API ComplexFilter : public Filter + class HERMES_API ComplexFilter : public Filter < double > { public: ComplexFilter(); @@ -143,163 +134,157 @@ namespace Hermes int item; - virtual void filter_fn(int n, std::complex* values, double* result) = 0; + virtual void filter_fn(int n, const std::complex* values, double* result) = 0; - virtual void precalculate(int order, int mask); + virtual void precalculate(unsigned short order, unsigned short mask); }; - /// @ingroup meshFunctions /// DXDYFilter is a more advanced version of SimpleFilter. It allows combining derivatives /// of the inputs and also, unlike SimpleFilter, it defines derivatives of the filtered /// result. The user-supplied combining function has a different format: it takes and must /// return also the DX and DY values. /// template - class HERMES_API DXDYFilter : public Filter + class HERMES_API DXDYFilter : public Filter < Scalar > { public: // one result (rslt), all inputs and result including derivatives DXDYFilter(); - DXDYFilter(Hermes::vector > solutions); + DXDYFilter(std::vector > solutions); virtual ~DXDYFilter(); protected: - void init(Hermes::vector > solutions); + void init(std::vector > solutions); virtual Func* get_pt_value(double x, double y, bool use_MeshHashGrid = false, Element* e = nullptr); - virtual void filter_fn(int n, double* x, double* y, Hermes::vector values, Hermes::vector dx, Hermes::vector dy, Scalar* rslt, Scalar* rslt_dx, Scalar* rslt_dy) = 0; + virtual void filter_fn(int n, double* x, double* y, const std::vector& values, const std::vector& dx, const std::vector& dy, Scalar* rslt, Scalar* rslt_dx, Scalar* rslt_dy) = 0; void init_components(); - virtual void precalculate(int order, int mask); + virtual void precalculate(unsigned short order, unsigned short mask); }; - /// @ingroup meshFunctions /// MagFilter takes two functions representing the components of a vector function and /// calculates the vector magnitude, sqrt(x^2 + y^2). /// \brief Calculates the magnitude of a vector function. template - class HERMES_API MagFilter : public SimpleFilter + class HERMES_API MagFilter : public SimpleFilter < Scalar > { public: - MagFilter(Hermes::vector > solutions, Hermes::vector items = *(new Hermes::vector)); + MagFilter(std::vector > solutions, std::vector items = std::vector()); - MagFilter(MeshFunctionSharedPtr sln1, int item1 = H2D_FN_VAL); ///< for vector-valued sln1 + /// for vector-valued sln1 + MagFilter(MeshFunctionSharedPtr sln1, int item1 = H2D_FN_VAL); virtual MeshFunction* clone() const; virtual ~MagFilter(); protected: - virtual void filter_fn(int n, Hermes::vector values, Scalar* result); + virtual void filter_fn(int n, const std::vector& values, Scalar* result); }; - /// @ingroup meshFunctions /// TopValFilter takes functions and puts a threshold on their highest values. - class HERMES_API TopValFilter : public SimpleFilter + class HERMES_API TopValFilter : public SimpleFilter < double > { public: - TopValFilter(Hermes::vector > solutions, Hermes::vector limits, Hermes::vector items = *(new Hermes::vector)); + TopValFilter(std::vector > solutions, std::vector limits, std::vector items = *(new std::vector)); - TopValFilter(MeshFunctionSharedPtr sln, double limit, int item = H2D_FN_VAL_0); ///< for vector-valued sln1 + /// for vector-valued sln1 + TopValFilter(MeshFunctionSharedPtr sln, double limit, int item = H2D_FN_VAL_0); virtual MeshFunction* clone() const; virtual ~TopValFilter(); protected: - virtual void filter_fn(int n, Hermes::vector values, double* result); - Hermes::vector limits; + virtual void filter_fn(int n, const std::vector& values, double* result); + std::vector limits; }; - /// @ingroup meshFunctions /// BottomValFilter takes functions and puts a threshold on their lowest values. - class HERMES_API BottomValFilter : public SimpleFilter + class HERMES_API BottomValFilter : public SimpleFilter < double > { public: - BottomValFilter(Hermes::vector > solutions, Hermes::vector limits, Hermes::vector items = *(new Hermes::vector)); + BottomValFilter(std::vector > solutions, std::vector limits, std::vector items = *(new std::vector)); - BottomValFilter(MeshFunctionSharedPtr sln, double limit, int item = H2D_FN_VAL_0); ///< for vector-valued sln1 + /// for vector-valued sln1 + BottomValFilter(MeshFunctionSharedPtr sln, double limit, int item = H2D_FN_VAL_0); virtual MeshFunction* clone() const; virtual ~BottomValFilter(); protected: - virtual void filter_fn(int n, Hermes::vector values, double* result); - Hermes::vector limits; + virtual void filter_fn(int n, const std::vector& values, double* result); + std::vector limits; }; - /// @ingroup meshFunctions /// ValFilter takes functions and puts a threshold on their lowest AND highest values. - class HERMES_API ValFilter : public SimpleFilter + class HERMES_API ValFilter : public SimpleFilter < double > { public: - ValFilter(Hermes::vector > solutions, Hermes::vector low_limits, Hermes::vector high_limits, Hermes::vector items = *(new Hermes::vector)); + ValFilter(std::vector > solutions, std::vector low_limits, std::vector high_limits, std::vector items = *(new std::vector)); - ValFilter(MeshFunctionSharedPtr sln, double low_limit, double high_limit, int item = H2D_FN_VAL_0); ///< for vector-valued sln1 + /// for vector-valued sln1 + ValFilter(MeshFunctionSharedPtr sln, double low_limit, double high_limit, int item = H2D_FN_VAL_0); virtual MeshFunction* clone() const; virtual ~ValFilter(); protected: - virtual void filter_fn(int n, Hermes::vector values, double* result); - Hermes::vector low_limits; - Hermes::vector high_limits; + virtual void filter_fn(int n, const std::vector& values, double* result); + std::vector low_limits; + std::vector high_limits; }; - /// @ingroup meshFunctions /// Calculates the difference of two functions. template - class HERMES_API DiffFilter : public SimpleFilter + class HERMES_API DiffFilter : public SimpleFilter < Scalar > { public: - DiffFilter(Hermes::vector > solutions, Hermes::vector items = *(new Hermes::vector)); + DiffFilter(std::vector > solutions, std::vector items = *(new std::vector)); virtual MeshFunction* clone() const; virtual ~DiffFilter(); protected: - virtual void filter_fn(int n, Hermes::vector values, Scalar* result); + virtual void filter_fn(int n, const std::vector& values, Scalar* result); }; - /// @ingroup meshFunctions /// Calculates the sum of two functions. template - class HERMES_API SumFilter : public SimpleFilter + class HERMES_API SumFilter : public SimpleFilter < Scalar > { public: - SumFilter(Hermes::vector > solutions, Hermes::vector items = *(new Hermes::vector)); + SumFilter(std::vector > solutions, std::vector items = *(new std::vector)); virtual MeshFunction* clone() const; virtual ~SumFilter(); protected: - virtual void filter_fn(int n, Hermes::vector values, Scalar* result); + virtual void filter_fn(int n, const std::vector& values, Scalar* result); }; - /// @ingroup meshFunctions /// Calculates the square of a function. template - class HERMES_API SquareFilter : public SimpleFilter + class HERMES_API SquareFilter : public SimpleFilter < Scalar > { public: - SquareFilter(Hermes::vector > solutions, Hermes::vector items = *(new Hermes::vector)); + SquareFilter(std::vector > solutions, std::vector items = *(new std::vector)); virtual MeshFunction* clone() const; virtual ~SquareFilter(); protected: - virtual void filter_fn(int n, Hermes::vector values, Scalar* result); + virtual void filter_fn(int n, const std::vector& values, Scalar* result); }; - /// @ingroup meshFunctions /// Calculates absolute value of a real solution. - class HERMES_API AbsFilter : public SimpleFilter + class HERMES_API AbsFilter : public SimpleFilter < double > { public: - AbsFilter(Hermes::vector > solutions, Hermes::vector items = *(new Hermes::vector)); + AbsFilter(std::vector > solutions, std::vector items = *(new std::vector)); AbsFilter(MeshFunctionSharedPtr solution); virtual MeshFunction* clone() const; virtual ~AbsFilter(); protected: - virtual void filter_fn(int n, Hermes::vector values, double* result); + virtual void filter_fn(int n, const std::vector& values, double* result); }; - /// @ingroup meshFunctions /// Removes the imaginary part from a function. class HERMES_API RealFilter : public ComplexFilter { @@ -311,10 +296,9 @@ namespace Hermes virtual MeshFunction* clone() const; protected: - virtual void filter_fn(int n, std::complex* values, double* result); + virtual void filter_fn(int n, const std::complex* values, double* result); }; - /// @ingroup meshFunctions /// ImagFilter puts the imaginary part of the input function to the Real part of the /// output, allowing it to be visualized. class HERMES_API ImagFilter : public ComplexFilter @@ -325,10 +309,9 @@ namespace Hermes virtual MeshFunction* clone() const; protected: - virtual void filter_fn(int n, std::complex* values, double* result); + virtual void filter_fn(int n, const std::complex* values, double* result); }; - /// @ingroup meshFunctions /// Computes the absolute value of a complex solution. class HERMES_API ComplexAbsFilter : public ComplexFilter { @@ -339,33 +322,29 @@ namespace Hermes virtual MeshFunction* clone() const; protected: - virtual void filter_fn(int n, std::complex* values, double* result); + virtual void filter_fn(int n, const std::complex* values, double* result); }; - /// @ingroup meshFunctions /// Computes the angle of a complex solution. - class HERMES_API AngleFilter : public SimpleFilter > + class HERMES_API AngleFilter : public SimpleFilter < std::complex > { public: - AngleFilter(Hermes::vector > > solutions, Hermes::vector items = *(new Hermes::vector)); + AngleFilter(std::vector > > solutions, std::vector items = *(new std::vector)); virtual ~AngleFilter(); protected: - virtual void filter_fn(int n, Hermes::vector*> values, double* result); + virtual void filter_fn(int n, const std::vector*>& values, double* result); }; - /// @ingroup meshFunctions /// VonMisesFilter is a postprocessing filter for visualizing elastic stresses in a body. /// It calculates the stress tensor and applies the Von Mises equivalent stress formula /// to obtain the resulting stress measure. /// \brief Calculates the Von Mises stress. - class HERMES_API VonMisesFilter : public Filter + class HERMES_API VonMisesFilter : public Filter < double > { public: /// \todo cylindrical coordinates - VonMisesFilter(Hermes::vector > solutions, double lambda, double mu, - int cyl = 0, int item1 = H2D_FN_VAL, int item2 = H2D_FN_VAL); - VonMisesFilter(MeshFunctionSharedPtr* solutions, int num, double lambda, double mu, + VonMisesFilter(std::vector > solutions, double lambda, double mu, int cyl = 0, int item1 = H2D_FN_VAL, int item2 = H2D_FN_VAL); virtual Func* get_pt_value(double x, double y, bool use_MeshHashGrid = false, Element* e = nullptr); @@ -378,15 +357,14 @@ namespace Hermes int cyl, item1, item2; - virtual void precalculate(int order, int mask); + virtual void precalculate(unsigned short order, unsigned short mask); }; - /// @ingroup meshFunctions /// Linearization filter for use in nonlinear problems. From one or two previous /// solution values it extrapolates an estimate of the new_ one. /// With adaptive time step: tau_frac = tau_new_ / tau_old template - class HERMES_API LinearFilter : public Filter + class HERMES_API LinearFilter : public Filter < Scalar > { public: LinearFilter(MeshFunctionSharedPtr old); @@ -400,7 +378,7 @@ namespace Hermes protected: double tau_frac; - virtual void precalculate(int order, int mask); + virtual void precalculate(unsigned short order, unsigned short mask); void init_components(); diff --git a/hermes2d/include/function/function.h b/hermes2d/include/function/function.h index 56a8856782..f53fb39ca3 100644 --- a/hermes2d/include/function/function.h +++ b/hermes2d/include/function/function.h @@ -16,7 +16,6 @@ #ifndef __H2D_FUNCTION_H #define __H2D_FUNCTION_H -#include "sub_element_map.h" #include "transformable.h" #include "../quadrature/quad.h" #include "exceptions.h" @@ -36,7 +35,6 @@ namespace Hermes template class H1ProjBasedSelector; template class HcurlProjBasedSelector; }; - template class Geom; /// Precalculation masks enum @@ -55,7 +53,8 @@ namespace Hermes const int H2D_FN_VAL = H2D_FN_VAL_0 | H2D_FN_VAL_1; const int H2D_FN_DX = H2D_FN_DX_0 | H2D_FN_DX_1; const int H2D_FN_DY = H2D_FN_DY_0 | H2D_FN_DY_1; - const int H2D_FN_DEFAULT = H2D_FN_VAL | H2D_FN_DX | H2D_FN_DY; ///< default precalculation mask + /// default precalculation mask + const int H2D_FN_DEFAULT = H2D_FN_VAL | H2D_FN_DX | H2D_FN_DY; #ifdef H2D_USE_SECOND_DERIVATIVES const int H2D_FN_COMPONENT_0 = H2D_FN_VAL_0 | H2D_FN_DX_0 | H2D_FN_DY_0 | H2D_FN_DXX_0 | H2D_FN_DYY_0 | H2D_FN_DXY_0; @@ -75,10 +74,10 @@ namespace Hermes const int H2D_SECOND = H2D_FN_DXX_0 | H2D_FN_DXY_0 | H2D_FN_DYY_0; - const int H2D_FN_ALL = H2D_FN_DEFAULT | H2D_FN_DXX | H2D_FN_DYY | H2D_FN_DXY; ///< precalculate everything + /// precalculate everything + const int H2D_FN_ALL = H2D_FN_DEFAULT | H2D_FN_DXX | H2D_FN_DYY | H2D_FN_DXY; #endif - /// @ingroup meshFunctions /// \brief Represents an arbitrary function defined on an element. /// /// The Function class is an abstraction of a function defined in integration points on an @@ -116,38 +115,38 @@ namespace Hermes virtual ~Function(); /// \brief Returns the number of components of the function being represented by the class. - int get_num_components() const; + unsigned char get_num_components() const; /// \brief Returns function values. /// \param component[in] The component of the function (0 or 1). /// \return The values of the function at all points of the current integration rule. - const Scalar* get_fn_values(int component = 0) const; + virtual const Scalar* get_fn_values(int component = 0) const; /// \brief Returns the x partial derivative. /// \param component[in] The component of the function (0 or 1). /// \return The x partial derivative of the function at all points of the current integration rule. - const Scalar* get_dx_values(int component = 0) const; + virtual const Scalar* get_dx_values(int component = 0) const; /// \brief Returns the y partial derivative. /// \param component[in] The component of the function (0 or 1). /// \return The y partial derivative of the function at all points of the current integration rule. - const Scalar* get_dy_values(int component = 0) const; + virtual const Scalar* get_dy_values(int component = 0) const; #ifdef H2D_USE_SECOND_DERIVATIVES /// \brief Returns the second x partial derivative. /// \param component[in] The component of the function (0 or 1). /// \return The x second partial derivative of the function at all points of the current integration rule. - const Scalar* get_dxx_values(int component = 0) const; + virtual const Scalar* get_dxx_values(int component = 0) const; /// \brief Returns the second y partial derivative. /// \param component[in] The component of the function (0 or 1). /// \return The y second partial derivative of the function at all points of the current integration rule. - const Scalar* get_dyy_values(int component = 0) const; + virtual const Scalar* get_dyy_values(int component = 0) const; /// \brief Returns the second mixed derivative. /// \param component[in] The component of the function (0 or 1). /// \return The second mixed derivative of the function at all points of the current integration rule. - const Scalar* get_dxy_values(int component = 0) const; + virtual const Scalar* get_dxy_values(int component = 0) const; #endif /// \brief Returns function values. @@ -162,9 +161,9 @@ namespace Hermes /// get_values(), get_dx_values() etc. will be returning function values at these points. /// \param order[in] Integration rule order. /// \param mask[in] A combination of one or more of the constants H2D_FN_VAL, H2D_FN_DX, H2D_FN_DY, ... - void set_quad_order(unsigned int order, int mask = H2D_FN_DEFAULT); + void set_quad_order(unsigned short order, unsigned short mask = H2D_FN_DEFAULT); - const Scalar* get_values(int a, int b) const; + virtual const Scalar* get_values(int component, int item) const; /// \brief Returns the polynomial degree of the function being represented by the class. virtual int get_fn_order() const; @@ -207,16 +206,16 @@ namespace Hermes /// \brief Returns the polynomial degree of the function at given edge. To be overridden in derived classes. /// \param edge[in] Edge at which the order should be evaluated. (0-3) - virtual int get_edge_fn_order(int edge) const; + virtual int get_edge_fn_order(unsigned char edge) const; /// precalculates the current function at the current integration points. - virtual void precalculate(int order, int mask); + virtual void precalculate(unsigned short order, unsigned short mask); /// Current function polynomial order int order; /// Number of vector components - int num_components; + unsigned char num_components; /// With changed sub-element mapping, or an element, or anything else there comes the need for a change of the current values. /// This invalidates the current values. @@ -242,13 +241,11 @@ namespace Hermes friend class CurvMap; template friend class Func; - template friend class Geom; template friend class Filter; template friend class SimpleFilter; template friend class DXDYFilter; friend class ComplexFilter; friend class VonMisesFilter; - friend HERMES_API Geom* init_geom_vol(RefMap *rm, const int order); friend HERMES_API Func* init_fn(PrecalcShapeset *fu, RefMap *rm, const int order); template friend HERMES_API Func* init_fn(MeshFunction*fu, const int order); }; diff --git a/hermes2d/include/function/mesh_function.h b/hermes2d/include/function/mesh_function.h index f73f66534f..b3bc621a1b 100644 --- a/hermes2d/include/function/mesh_function.h +++ b/hermes2d/include/function/mesh_function.h @@ -26,7 +26,7 @@ namespace Hermes namespace Hermes2D { template - class HERMES_API MeshFunctionSharedPtr : public std::tr1::shared_ptr > + class HERMES_API MeshFunctionSharedPtr : public std::tr1::shared_ptr < Hermes::Hermes2D::MeshFunction > { public: MeshFunctionSharedPtr(Hermes::Hermes2D::MeshFunction* ptr = nullptr); @@ -43,7 +43,6 @@ namespace Hermes * These comprise solutions, exact & initial solutions, filters (functions of the solutions) etc. */ - /// @ingroup meshFunctions /// \brief Represents a function defined on a mesh. /// /// MeshFunction is a base class for all classes representing an arbitrary function @@ -88,7 +87,7 @@ namespace Hermes /// Adds another mesh function on the given space. /// ! Resulting mesh function is a solution. - virtual void add(MeshFunctionSharedPtr other_mesh_function, SpaceSharedPtr target_space); + virtual void add(MeshFunctionSharedPtr& other_mesh_function, SpaceSharedPtr target_space); /// Return the approximate maximum value of this instance. virtual Scalar get_approx_max_value(int item = H2D_FN_VAL_0); @@ -118,16 +117,12 @@ namespace Hermes /// Internal. virtual void set_active_element(Element* e); - /// Set the reference mapping. - /// Internal. - void set_refmap(RefMap* refmap_to_set); - /// Returns the order of the edge number edge of the current active element. virtual int get_edge_fn_order(int edge); protected: ElementMode2D mode; MeshSharedPtr mesh; - RefMap* refmap; + RefMap refmap; void update_refmap(); @@ -136,7 +131,6 @@ namespace Hermes template friend class Adapt; template friend class Func; - template friend class Geom; template friend HERMES_API Func* init_fn(MeshFunction*fu, const int order); diff --git a/hermes2d/include/function/postprocessing.h b/hermes2d/include/function/postprocessing.h index d186bb9457..a01830c433 100644 --- a/hermes2d/include/function/postprocessing.h +++ b/hermes2d/include/function/postprocessing.h @@ -16,6 +16,7 @@ #ifndef __H2D_POSTPROCESSING_H #define __H2D_POSTPROCESSING_H +#include "../forms.h" #include "../function/mesh_function.h" #include "../space/space.h" @@ -35,15 +36,15 @@ namespace Hermes { public: Limiter(SpaceSharedPtr space, Scalar* solution_vector); - Limiter(Hermes::vector > spaces, Scalar* solution_vector); + Limiter(std::vector > spaces, Scalar* solution_vector); virtual ~Limiter(); /// Get the zero-th solution. MeshFunctionSharedPtr get_solution(); /// Get all solutions. - void get_solutions(Hermes::vector > solutions); + void get_solutions(std::vector > solutions); /// Get changed element ids. - Hermes::vector get_changed_element_ids() const; + std::vector get_changed_element_ids() const; /// Helpers for state querying. virtual bool isOkay() const; @@ -57,10 +58,10 @@ namespace Hermes protected: int component_count; - Hermes::vector > spaces; + std::vector > spaces; Scalar* solution_vector; - Hermes::vector > limited_solutions; - Hermes::vector changed_element_ids; + std::vector > limited_solutions; + std::vector changed_element_ids; virtual void process() = 0; @@ -69,14 +70,13 @@ namespace Hermes }; class HERMES_API VertexBasedLimiter - : public Limiter + : public Limiter < double > { public: VertexBasedLimiter(SpaceSharedPtr space, double* solution_vector, int maximum_polynomial_order); - VertexBasedLimiter(Hermes::vector > spaces, double* solution_vector, int maximum_polynomial_order); + VertexBasedLimiter(std::vector > spaces, double* solution_vector, int maximum_polynomial_order); virtual ~VertexBasedLimiter(); - Hermes::vector > get_correction_factors() const; - void print_detailed_info(bool print_details = true); + std::vector > get_correction_factors() const; int maximum_polynomial_order; void set_p_coarsening_only(); static bool wider_bounds_on_boundary; @@ -93,7 +93,7 @@ namespace Hermes /// Get mean value of the mixed derivative (mixed_derivative_index) on element e, of the "component" - component /// of the solution. double get_centroid_value_multiplied(Element* e, int component, int mixed_derivative_index); - + double get_edge_midpoint_value_multiplied(Element* e, int component, int mixed_derivative_index, int edge); void impose_linear_correction_factor(Element* e, int component); @@ -107,8 +107,7 @@ namespace Hermes void deallocate_vertex_values(); int mixed_derivatives_count; - Hermes::vector > correction_factors; - bool print_details; + std::vector > correction_factors; }; /// Integral calculator @@ -121,28 +120,23 @@ namespace Hermes public: /// \param[in] source_functions The functions forming the integral expression. /// \param[in] number_of_integrals Number of results (expressions) evaluated. The method integral will get the array result allocated according to this parameter. - /// + /// IntegralCalculator(MeshFunctionSharedPtr source_function, int number_of_integrals); - IntegralCalculator(Hermes::vector > source_functions, int number_of_integrals); + IntegralCalculator(std::vector > source_functions, int number_of_integrals); /// Main method returning the value(s). /// \return The values (more values at once for saving time with initialization etc.) - virtual Scalar* calculate(Hermes::vector markers) = 0; + virtual Scalar* calculate(std::vector markers) = 0; /// Main method returning the value(s). /// One marker overload. virtual Scalar* calculate(std::string marker); - /// The integral description. - /// \param[in] n - number of integration points. - /// \param[in] result - preallocated (see number_of_integrals in the constructor) and zeroed array for the results. - virtual void integral(int n, double* wt, Func **fns, Geom *e, Scalar* result) = 0; - /// The integration order calculation. virtual void order(Func **fns, Hermes::Ord* result) = 0; - + protected: - Hermes::vector > source_functions; + std::vector > source_functions; int number_of_integrals; void add_results(Scalar* results_local, Scalar* results); @@ -150,29 +144,39 @@ namespace Hermes /// Volumetric integral calculator template - class HERMES_API VolumetricIntegralCalculator : public IntegralCalculator + class HERMES_API VolumetricIntegralCalculator : public IntegralCalculator < Scalar > { public: VolumetricIntegralCalculator(MeshFunctionSharedPtr source_function, int number_of_integrals); - VolumetricIntegralCalculator(Hermes::vector > source_functions, int number_of_integrals); + VolumetricIntegralCalculator(std::vector > source_functions, int number_of_integrals); + + /// The integral description. + /// \param[in] n - number of integration points. + /// \param[in] result - preallocated (see number_of_integrals in the constructor) and zeroed array for the results. + virtual void integral(int n, double* wt, Func **fns, GeomVol *e, Scalar* result) = 0; /// Main method returning the value. /// Not designed to be overriden. - Scalar* calculate(Hermes::vector markers); - using IntegralCalculator::calculate; + Scalar* calculate(std::vector markers); + using IntegralCalculator::calculate; }; /// Surface integral calculator template - class HERMES_API SurfaceIntegralCalculator : public IntegralCalculator + class HERMES_API SurfaceIntegralCalculator : public IntegralCalculator < Scalar > { public: SurfaceIntegralCalculator(MeshFunctionSharedPtr source_function, int number_of_integrals); - SurfaceIntegralCalculator(Hermes::vector > source_functions, int number_of_integrals); + SurfaceIntegralCalculator(std::vector > source_functions, int number_of_integrals); + + /// The integral description. + /// \param[in] n - number of integration points. + /// \param[in] result - preallocated (see number_of_integrals in the constructor) and zeroed array for the results. + virtual void integral(int n, double* wt, Func **fns, GeomSurf *e, Scalar* result) = 0; /// Main method returning the value. /// Not designed to be overriden. - Scalar* calculate(Hermes::vector markers); + Scalar* calculate(std::vector markers); using IntegralCalculator::calculate; }; } diff --git a/hermes2d/include/function/solution.h b/hermes2d/include/function/solution.h index 651b1931b4..084c960de1 100644 --- a/hermes2d/include/function/solution.h +++ b/hermes2d/include/function/solution.h @@ -37,7 +37,6 @@ namespace Hermes HERMES_EXACT = 1 }; - /// @ingroup meshFunctions /// \brief Represents the solution of a PDE.
/// /// The Solution class represents the solution of a PDE. Given a space and a solution vector, @@ -91,7 +90,7 @@ namespace Hermes virtual void copy(const MeshFunction* sln); /// Sets solution equal to Dirichlet lift only, solution vector = 0. - void set_dirichlet_lift(SpaceSharedPtr space, PrecalcShapeset* pss = nullptr); + void set_dirichlet_lift(SpaceSharedPtr space); /// Saves the complete solution (i.e., including the internal copy of the mesh and /// element orders) to an XML file. @@ -135,7 +134,7 @@ namespace Hermes /// Adds another mesh function on the given space. /// See method of parent class. - virtual void add(MeshFunctionSharedPtr other_mesh_function, SpaceSharedPtr target_space); + virtual void add(MeshFunctionSharedPtr& other_mesh_function, SpaceSharedPtr target_space); /// Multiplies the function represented by this class by the given coefficient. virtual void multiply(Scalar coef); @@ -162,8 +161,6 @@ namespace Hermes int* elem_orders; protected: - virtual int get_edge_fn_order(int edge) { return MeshFunction::get_edge_fn_order(edge); } - /// Enables or disables transformation of the solution derivatives (H1 case) /// or values (vector (Hcurl) case). This means H2D_FN_DX_0 and H2D_FN_DY_0 or /// H2D_FN_VAL_0 and H2D_FN_VAL_1 will or will not be returned premultiplied by the reference @@ -175,8 +172,6 @@ namespace Hermes /// Converts a coefficient vector into a Solution. virtual void set_coeff_vector(SpaceSharedPtr space, const Vector* vec, bool add_dir_lift, int start_index); - virtual void set_coeff_vector(SpaceSharedPtr space, PrecalcShapeset* pss, const Scalar* coeffs, bool add_dir_lift, int start_index); - virtual void set_coeff_vector(SpaceSharedPtr space, const Scalar* coeffs, bool add_dir_lift, int start_index); SolutionType sln_type; @@ -184,19 +179,20 @@ namespace Hermes bool transform; - int* elem_coeffs[H2D_MAX_SOLUTION_COMPONENTS]; ///< array of pointers into mono_coeffs + /// array of pointers into mono_coeffs + int* elem_coeffs[H2D_MAX_SOLUTION_COMPONENTS]; int num_coeffs, num_elems; int num_dofs; void transform_values(int order, int mask, int np); - virtual void precalculate(int order, int mask); + virtual void precalculate(unsigned short order, unsigned short mask); Scalar* dxdy_coeffs[H2D_MAX_SOLUTION_COMPONENTS][H2D_NUM_FUNCTION_VALUES]; Scalar* dxdy_buffer; - double** calc_mono_matrix(int mode, int o); + double** calc_mono_matrix(int mode, unsigned char o); void init_dxdy_buffer(); @@ -229,51 +225,44 @@ namespace Hermes #pragma endregion #pragma region static - public: - static void vector_to_solution(const Scalar* solution_vector, SpaceSharedPtr space, MeshFunctionSharedPtr solution, - PrecalcShapeset* pss, bool add_dir_lift = true, int start_index = 0); - - static bool static_verbose_output; + public: + static bool static_verbose_output; - // Calculate derivative wrt. x of mono into result. - static void make_dx_coeffs(int mode, int o, Scalar* mono, Scalar* result); - // Calculate derivative wrt. y of mono into result. - static void make_dy_coeffs(int mode, int o, Scalar* mono, Scalar* result); + // Calculate derivative wrt. x of mono into result. + static void make_dx_coeffs(int mode, int o, Scalar* mono, Scalar* result); + // Calculate derivative wrt. y of mono into result. + static void make_dy_coeffs(int mode, int o, Scalar* mono, Scalar* result); - static void set_static_verbose_output(bool verbose); + static void set_static_verbose_output(bool verbose); - /// Passes solution components calculated from solution vector as Solutions. - static void vector_to_solutions(const Scalar* solution_vector, Hermes::vector > spaces, - Hermes::vector > solutions, - Hermes::vector add_dir_lift = Hermes::vector(), - Hermes::vector start_indices = Hermes::vector()); + /// Passes solution components calculated from solution vector as Solutions. + static void vector_to_solutions(const Scalar* solution_vector, std::vector > spaces, + std::vector > solutions, + std::vector add_dir_lift = std::vector(), + std::vector start_indices = std::vector()); - static void vector_to_solution(const Scalar* solution_vector, SpaceSharedPtr space, MeshFunctionSharedPtr solution, - bool add_dir_lift = true, int start_index = 0); + static void vector_to_solution(const Scalar* solution_vector, SpaceSharedPtr space, MeshFunctionSharedPtr solution, + bool add_dir_lift = true, int start_index = 0); - static void vector_to_solution(const Scalar* solution_vector, SpaceSharedPtr space, Solution* solution, - bool add_dir_lift = true, int start_index = 0); + static void vector_to_solution(const Scalar* solution_vector, SpaceSharedPtr space, Solution* solution, + bool add_dir_lift = true, int start_index = 0); - static void vector_to_solutions(const Vector* vec, Hermes::vector > spaces, - Hermes::vector > solutions, - Hermes::vector add_dir_lift = Hermes::vector(), - Hermes::vector start_indices = Hermes::vector()); + static void vector_to_solutions(const Vector* vec, std::vector > spaces, + std::vector > solutions, + std::vector add_dir_lift = std::vector(), + std::vector start_indices = std::vector()); - static void vector_to_solutions_common_dir_lift(const Vector* vec, Hermes::vector > spaces, - Hermes::vector > solutions, - bool add_dir_lift = false); + static void vector_to_solutions_common_dir_lift(const Vector* vec, std::vector > spaces, + std::vector > solutions, + bool add_dir_lift = false); - static void vector_to_solutions_common_dir_lift(const Scalar* solution_vector, Hermes::vector > spaces, - Hermes::vector > solutions, - bool add_dir_lift = false); + static void vector_to_solutions_common_dir_lift(const Scalar* solution_vector, std::vector > spaces, + std::vector > solutions, + bool add_dir_lift = false); - static void vector_to_solution(const Vector* vec, SpaceSharedPtr space, MeshFunctionSharedPtr solution, - bool add_dir_lift = true, int start_index = 0); + static void vector_to_solution(const Vector* vec, SpaceSharedPtr space, MeshFunctionSharedPtr solution, + bool add_dir_lift = true, int start_index = 0); - static void vector_to_solutions(const Scalar* solution_vector, Hermes::vector > spaces, - Hermes::vector > solutions, Hermes::vector pss, - Hermes::vector add_dir_lift = Hermes::vector(), - Hermes::vector start_indices = Hermes::vector()); #pragma endregion }; } diff --git a/hermes2d/include/function/transformable.h b/hermes2d/include/function/transformable.h index d20a8a6502..787241bf9a 100644 --- a/hermes2d/include/function/transformable.h +++ b/hermes2d/include/function/transformable.h @@ -37,7 +37,6 @@ namespace Hermes /// A table of quad sub-subdomain transforms. Only first ::H2D_TRF_QUAD_NUM transformations are valid, the rest are identity transformation. extern HERMES_API Trf quad_trf[H2D_TRF_NUM]; - /// @ingroup meshFunctions /// Transformable is a base class for all classes that perform some kind of precalculation of /// function values on elements. These classes (PrecalcShapeset, Solution, RefMap) inherit /// from Transformable the ability to transform integration points to the sub-elements diff --git a/hermes2d/include/global.h b/hermes2d/include/global.h index e026e9328c..006cb535a0 100644 --- a/hermes2d/include/global.h +++ b/hermes2d/include/global.h @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -116,6 +116,8 @@ namespace Hermes HERMES_UNSET_NORM }; + /// Element type identification. + /// The enum values must not change. enum ElementMode2D { HERMES_MODE_TRIANGLE = 0, HERMES_MODE_QUAD = 1 @@ -130,6 +132,15 @@ namespace Hermes HERMES_INVALID_SPACE = -9999 }; + /// Important not to change the indices - used in an array enumeration + enum ShapesetType { + HERMES_H1_JACOBI = 0, + HERMES_L2_LEGENDRE = 1, + HERMES_L2_TAYLOR = 2, + HERMES_HDIV_LEGENDRE = 3, + HERMES_HCURL_GRADLEG = 4 + }; + const char* spaceTypeToString(SpaceType spaceType); SpaceType spaceTypeFromString(const char* spaceTypeString); @@ -159,4 +170,4 @@ namespace Hermes }; } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/include/graph.h b/hermes2d/include/graph.h index 02f40e36d1..8189130175 100644 --- a/hermes2d/include/graph.h +++ b/hermes2d/include/graph.h @@ -47,7 +47,8 @@ namespace Hermes void set_row_style(int row, const char* color = "k", const char* line = "-", const char* marker = ""); void add_values(int row, double x, double y); - void add_values(double x, double y); // same as previous but uses row = 0 + // same as previous but uses row = 0 + void add_values(double x, double y); void add_values(int row, int n, double* x, double* y); void add_values(int row, int n, double2* xy); @@ -67,10 +68,10 @@ namespace Hermes struct Row { std::string name, color, line, marker; - Hermes::vector data; + std::vector data; }; - Hermes::vector rows; + std::vector rows; }; /// Outputs just two numbers per row. @@ -109,7 +110,7 @@ namespace Hermes GnuplotGraph(const char* title = nullptr, const char* x_axis_name = nullptr, const char* y_axis_name = nullptr, double lines_width = 1.0, const std::string& terminal_str = default_terminal) : - Graph(title, x_axis_name, y_axis_name), + Graph(title, x_axis_name, y_axis_name), legend_pos(), terminal_str(terminal_str), lw(lines_width) { diff --git a/hermes2d/include/hermes2d.h b/hermes2d/include/hermes2d.h index a50f9df9a9..5f79d7a9df 100644 --- a/hermes2d/include/hermes2d.h +++ b/hermes2d/include/hermes2d.h @@ -30,7 +30,6 @@ #include "quadrature/limit_order.h" #include "api2d.h" -#include "sub_element_map.h" #include "mixins2d.h" #include "mesh/mesh.h" @@ -58,7 +57,7 @@ #include "mesh/traverse.h" #include "weakform/weakform.h" -#include "discrete_problem.h" +#include "discrete_problem/discrete_problem.h" #include "forms.h" #include "function/exact_solution.h" @@ -74,7 +73,6 @@ #include "views/mesh_view.h" #include "views/order_view.h" #include "views/scalar_view.h" -#include "views/stream_view.h" #include "views/vector_base_view.h" #include "views/vector_view.h" @@ -88,6 +86,7 @@ #include "refinement_selectors/hcurl_proj_based_selector.h" #include "adapt/adapt.h" +#include "adapt/adapt_solver.h" #include "adapt/error_calculator.h" #include "adapt/error_thread_calculator.h" #include "adapt/kelly_type_adapt.h" diff --git a/hermes2d/include/mesh/curved.h b/hermes2d/include/mesh/curved.h index d004bdc6e8..34f050980c 100644 --- a/hermes2d/include/mesh/curved.h +++ b/hermes2d/include/mesh/curved.h @@ -25,6 +25,7 @@ namespace Hermes namespace Hermes2D { class Element; + class RefMap; class Quad1DStd; class Quad2DStd; struct Trf; @@ -50,15 +51,16 @@ namespace Hermes Arc(double angle); Arc(const Arc* other); - double angle; ///< arc angle + /// arc angle + double angle; /// Arc degree is 2. - static const int degree = 2; + static const unsigned char degree = 2; /// Arc has 3 control points - static const int np = 3; + static const unsigned char np = 3; // there are 6 knots: {0, 0, 0, 1, 1, 1} - static const int nk = 6; + static const unsigned char nk = 6; double kv[6]; double3 pt[3]; }; @@ -79,11 +81,16 @@ namespace Hermes Nurbs(const Nurbs* other); ~Nurbs(); - int degree; ///< curve degree (2=quadratic, etc.) - int np; ///< number of control points - double3* pt; ///< control points and their weights - int nk; ///< knot vector length - double* kv; ///< knot vector + /// curve degree (2=quadratic, etc.) + unsigned char degree; + /// number of control points + unsigned char np; + /// control points and their weights + double3* pt; + /// knot vector length + unsigned char nk; + /// knot vector + double* kv; }; /// CurvMap is a structure storing complete information on the curved edges of @@ -101,33 +108,18 @@ namespace Hermes /// this structure defines a curved mapping of an element; it has two /// modes, depending on the value of 'toplevel' bool toplevel; - union - { - // if toplevel=true, this structure belongs to a base mesh element - // and the array 'nurbs' points to (up to four) NURBS curved edges - Curve* curves[H2D_MAX_NUMBER_EDGES]; - struct - { - // if toplevel=false, this structure belongs to a refined element - // and 'parent' points to the base mesh element CurvMap structure; - Element* parent; - uint64_t sub_idx; - }; - }; - /// current polynomial degree of the refmap approximation - int order; - - private: - PrecalcShapeset ref_map_pss; + // if toplevel=true, this structure belongs to a base mesh element + // and the array 'nurbs' points to (up to four) NURBS curved edges + Curve* curves[H2D_MAX_NUMBER_EDGES]; - /// Transformation (2x2) matrix. - Trf* ctm; + // if toplevel=false, this structure belongs to a refined element + // and 'parent' points to the base mesh element CurvMap structure; + Element* parent; + uint64_t sub_idx; - /// finally here are the coefficients of the higher-order basis functions - /// that constitute the projected reference mapping: - int nc; ///< number of coefficients - double2* coeffs; ///< array of the coefficients + /// current polynomial degree of the refmap approximation + unsigned short order; /// this is called for every curvilinear element when it is created /// or when it is necessary to re-calculate coefficients for another @@ -136,22 +128,36 @@ namespace Hermes /// then new_ coefficients are projected. void update_refmap_coeffs(Element* e); - void get_mid_edge_points(Element* e, double2* pt, int n); + private: + PrecalcShapesetAssembling ref_map_pss; + + /// Transformation (2x2) matrix. + Trf* ctm; + + /// finally here are the coefficients of the higher-order basis functions + /// that constitute the projected reference mapping: + /// number of coefficients + unsigned short nc; + /// array of the coefficients + double2* coeffs; + + void get_mid_edge_points(Element* e, double2* pt, unsigned short n); /// Recursive calculation of the basis function N_i,k(int i, int k, double t, double* knot). - static double nurbs_basis_fn(int i, int k, double t, double* knot); + static double nurbs_basis_fn(unsigned short i, unsigned short k, double t, double* knot); /// Nurbs curve: t goes from -1 to 1, function returns x, y coordinates in plane /// as well as the unit normal and unit tangential vectors. This is done using /// the Wikipedia page http://en.wikipedia.org/wiki/Non-uniform_rational_B-spline. static void nurbs_edge(Element* e, Curve* curve, int edge, double t, double& x, - double& y, double& n_x, double& n_y, double& t_x, double& t_y); + double& y); //// non-polynomial reference map ////////////////////////////////////////////////////////////////////////////////// static const double2 ref_vert[2][H2D_MAX_NUMBER_VERTICES]; /// Subtraction of straight edge and nurbs curve. - static void nurbs_edge_0(Element* e, Curve* nurbs, int edge, double t, double& x, double& y, double& n_x, double& n_y, double& t_x, double& t_y); + static void nurbs_edge_0(Element* e, Curve* nurbs, unsigned short edge, double t, double& x, double& y, double& n_x, double& n_y, double& t_x, double& t_y); + /// Calculation of nonpolynomial reference mapping on curved element static void calc_ref_map_tri(Element* e, Curve** nurbs, double xi_1, double xi_2, double& x, double& y); static void calc_ref_map_quad(Element* e, Curve** nurbs, double xi_1, double xi_2, @@ -161,12 +167,12 @@ namespace Hermes /// Edge part of projection based interpolation /////////////////////////////////////////////////// /// Compute point (x, y) in reference element, edge vector (v1, v2) - void edge_coord(Element* e, int edge, double t, double2& x, double2& v) const; - void calc_edge_projection(Element* e, int edge, Curve** nurbs, int order, double2* proj) const; + void edge_coord(Element* e, unsigned short edge, double t, double2& x) const; + void calc_edge_projection(Element* e, unsigned short edge, Curve** nurbs, unsigned short order, double2* proj) const; //// Bubble part of projection based interpolation ///////////////////////////////////////////////// - void old_projection(Element* e, int order, double2* proj, double* old[2]); - void calc_bubble_projection(Element* e, Curve** nurbs, int order, double2* proj); + void old_projection(Element* e, unsigned short order, double2* proj, double* old[2]); + void calc_bubble_projection(Element* e, Curve** nurbs, unsigned short order, double2* proj); static CurvMap* create_son_curv_map(Element* e, int son); @@ -184,8 +190,6 @@ namespace Hermes friend class MeshReaderH2D; friend class MeshReaderH2DXML; friend class MeshReaderH2DBSON; - - static bool warning_issued; }; class CurvMapStatic @@ -198,19 +202,25 @@ namespace Hermes /// Preparation of projection matrices, Cholesky factorization void precalculate_cholesky_projection_matrix_edge(); /// Calculate the H1 seminorm products (\phi_i, \phi_j) for all 0 <= i, j < n, n is the number of bubble functions - double** calculate_bubble_projection_matrix(int* indices, ElementMode2D mode); + double** calculate_bubble_projection_matrix(short* indices, ElementMode2D mode); void precalculate_cholesky_projection_matrices_bubble(); - double** edge_proj_matrix; ///< projection matrix for each edge is the same - int edge_proj_matrix_size; - double** bubble_proj_matrix_tri; ///< projection matrix for triangle bubbles - double** bubble_proj_matrix_quad; ///< projection matrix for quad bubbles - - double* edge_p; ///< diagonal vector in cholesky factorization - double* bubble_tri_p; ///< diagonal vector in cholesky factorization - int tri_bubble_np; - double* bubble_quad_p; ///< diagonal vector in cholesky factorization - int quad_bubble_np; + /// projection matrix for each edge is the same + double** edge_proj_matrix; + unsigned short edge_proj_matrix_size; + /// projection matrix for triangle bubbles + double** bubble_proj_matrix_tri; + /// projection matrix for quad bubbles + double** bubble_proj_matrix_quad; + + /// diagonal vector in cholesky factorization + double* edge_p; + /// diagonal vector in cholesky factorization + double* bubble_tri_p; + unsigned short tri_bubble_np; + /// diagonal vector in cholesky factorization + double* bubble_quad_p; + unsigned short quad_bubble_np; }; /// Global instance used inside Hermes which is also accessible to users. diff --git a/hermes2d/include/mesh/element.h b/hermes2d/include/mesh/element.h index 4184293f7d..15883b91d3 100644 --- a/hermes2d/include/mesh/element.h +++ b/hermes2d/include/mesh/element.h @@ -44,27 +44,37 @@ namespace Hermes /// struct HERMES_API Node { - int id; ///< node id number - unsigned ref:29; ///< the number of elements using the node - unsigned type:1; ///< 0 = vertex node; 1 = edge node - unsigned bnd:1; ///< 1 = boundary node; 0 = inner node - unsigned used:1; ///< array item usage flag + /// node id number + int id; + /// the number of elements using the node + unsigned ref : 29; + /// 0 = vertex node; 1 = edge node + unsigned type : 1; + /// 1 = boundary node; 0 = inner node + unsigned bnd : 1; + /// array item usage flag + unsigned used : 1; union { struct { - double x, y; ///< vertex node coordinates + /// vertex node coordinates + double x, y; }; struct { - int marker; ///< edge marker - Element* elem[2]; ///< elements sharing the edge node + /// edge marker + int marker; + /// elements sharing the edge node + Element* elem[2]; }; }; - int p1, p2; ///< parent id numbers - Node* next_hash; ///< next node in hash synonym list + /// parent id numbers + int p1, p2; + /// next node in hash synonym list + Node* next_hash; /// Returns true if the (vertex) node is constrained. bool is_constrained_vertex() const; @@ -98,15 +108,20 @@ namespace Hermes { public: Element(); - int id; ///< element id number - bool active; ///< 0 = active, no sons; 1 = inactive (refined), has sons - bool used; ///< array item usage flag - Element* parent; ///< pointer to the parent element for the current son - bool visited; ///< true if the element has been visited during assembling + /// element id number + int id; + /// 0 = active, no sons; 1 = inactive (refined), has sons + bool active; + /// array item usage flag + bool used; + /// pointer to the parent element for the current son + Element* parent; + /// true if the element has been visited during assembling + bool visited; /// Calculates the area of the element. /// \param[in] precise_for_curvature If curved elements should be evaluated exactly. \ - /// This takes much longer. + /// This takes much longer. void calc_area(bool precise_for_curvature = false); /// Calculates the diameter. @@ -115,20 +130,24 @@ namespace Hermes /// Returns the center of gravity. void get_center(double& x, double& y); - Node* vn[H2D_MAX_NUMBER_VERTICES]; ///< vertex node pointers + /// vertex node pointers + Node* vn[H2D_MAX_NUMBER_VERTICES]; union { - Node* en[H2D_MAX_NUMBER_EDGES]; ///< edge node pointers - Element* sons[H2D_MAX_ELEMENT_SONS]; ///< son elements (up to four) + /// edge node pointers + Node* en[H2D_MAX_NUMBER_EDGES]; + /// son elements (up to four) + Element* sons[H2D_MAX_ELEMENT_SONS]; }; - int marker; ///< element marker + /// element marker + int marker; // returns the edge orientation. This works for the unconstrained edges. - int get_edge_orientation(int ie) const; - - inline ElementMode2D get_mode() const { - return (nvert == 3) ? HERMES_MODE_TRIANGLE : HERMES_MODE_QUAD; + bool get_edge_orientation(int ie) const; + + ElementMode2D get_mode() const { + return (nvert == 3) ? HERMES_MODE_TRIANGLE : HERMES_MODE_QUAD; } inline bool is_triangle() const { @@ -140,15 +159,33 @@ namespace Hermes inline bool is_curved() const { return cm != nullptr; } - inline int get_nvert() const { + inline unsigned char get_nvert() const { return this->nvert; } + inline bool is_parallelogram() const + { + if (this->nvert == 3) + return false; + else if (this->id == -1) + return true; + + const double eps = 1e-14; + return fabs(this->vn[2]->x - (this->vn[1]->x + this->vn[3]->x - this->vn[0]->x)) < eps && + fabs(this->vn[2]->y - (this->vn[1]->y + this->vn[3]->y - this->vn[0]->y)) < eps; + } + + inline bool has_const_ref_map() const + { + return (this->nvert == 3 || is_parallelogram()) && (!this->cm); + } + bool hsplit() const; bool vsplit() const; bool bsplit() const; - CurvMap* cm; ///< curved mapping, nullptr if not curvilinear + /// curved mapping, nullptr if not curvilinear + CurvMap* cm; /// Serves for saving the once calculated area of this element. double area; @@ -159,11 +196,18 @@ namespace Hermes double diameter; /// Increase in integration order, see RefMap::calc_inv_ref_order() - int iro_cache; + unsigned short iro_cache; /// Helper functions to obtain the index of the next or previous vertex/edge - int next_vert(int i) const; - int prev_vert(int i) const; + inline unsigned char next_vert(unsigned char i) const + { + return ((i + 1) % nvert); + } + + inline unsigned char prev_vert(unsigned char i) const + { + return ((i + nvert - 1) % nvert); + } /// Returns a pointer to the neighboring element across the edge 'ie', or /// nullptr if it does not exist or is across an irregular edge. @@ -174,7 +218,8 @@ namespace Hermes /// Internal. void unref_all_nodes(HashTable* ht); - unsigned nvert:30; ///< number of vertices (3 or 4) + /// number of vertices (3 or 4) + unsigned char nvert; }; static Node* get_edge_node(); diff --git a/hermes2d/include/mesh/hash.h b/hermes2d/include/mesh/hash.h index 5d0baf1192..8d3d97f3e8 100644 --- a/hermes2d/include/mesh/hash.h +++ b/hermes2d/include/mesh/hash.h @@ -45,8 +45,16 @@ namespace Hermes /// Returns the maximum node id number plus one. int get_max_node_id() const; - static const int H2D_DEFAULT_HASH_SIZE = 0x8000; // 32K entries + /// 32K entries + static const int H2D_DEFAULT_HASH_SIZE = 0x8000; + /// Returns a vertex node with parent id's p1 and p2 if it exists, nullptr otherwise. + Node* peek_vertex_node(int p1, int p2) const; + + /// Returns an edge node with parent id's p1 and p2 if it exists, nullptr otherwise. + Node* peek_edge_node(int p1, int p2) const; + + inline Array &get_nodes() { return nodes; } protected: HashTable(); @@ -55,12 +63,6 @@ namespace Hermes /// Returns the total number of nodes stored. int get_num_nodes() const; - /// Returns a vertex node with parent id's p1 and p2 if it exists, nullptr otherwise. - Node* peek_vertex_node(int p1, int p2) const; - - /// Returns an edge node with parent id's p1 and p2 if it exists, nullptr otherwise. - Node* peek_edge_node(int p1, int p2) const; - /// Central function: obtains a vertex node pointer given the id /// numbers of its parents. If the vertex node does not exist, it is /// created first. @@ -71,7 +73,8 @@ namespace Hermes /// created first. Node* get_edge_node(int p1, int p2); - Array nodes; ///< Array storing all nodes + /// Array storing all nodes + Array nodes; /// Initializes the hash table. /// \param size[in] Hash table size; must be a power of two. @@ -95,12 +98,14 @@ namespace Hermes // Internal members private: - Node** v_table; ///< Vertex node hash table - Node** e_table; ///< Edge node hash table + /// Vertex node hash table + Node** v_table; + /// Edge node hash table + Node** e_table; int mask; - inline int hash(int p1, int p2) const { return (984120265*p1 + 125965121*p2) & mask; } + inline int hash(int p1, int p2) const { return (984120265 * p1 + 125965121 * p2) & mask; } /// Searches a list of hash synonyms given the first list item. /// Returns the node matching the parent ids p1 and p2. diff --git a/hermes2d/include/mesh/mesh.h b/hermes2d/include/mesh/mesh.h index f85b6e7531..a1de48f689 100644 --- a/hermes2d/include/mesh/mesh.h +++ b/hermes2d/include/mesh/mesh.h @@ -32,7 +32,7 @@ namespace Hermes template class KellyTypeAdapt; struct MItem; struct Rect; - extern unsigned g_mesh_seq; + extern HERMES_API unsigned g_mesh_seq; namespace RefinementSelectors { @@ -66,7 +66,7 @@ namespace Hermes virtual ~Mesh(); /// Initializes the mesh. - /// \param size[in] Hash table size; must be a power of two. + /// \param[in] size Hash table size; must be a power of two. void init(int size = H2D_DEFAULT_HASH_SIZE); /// State querying helpers. @@ -132,10 +132,10 @@ namespace Hermes int get_num_edge_nodes() const; /// Get the mesh bounding box. - /// \param [out] bottom_left_x Bottom left corner - x coordinate. - /// \param [out] bottom_left_y Bottom left corner - y coordinate. - /// \param [out] top_right_x Top right corner - x coordinate. - /// \param [out] top_right_y Top right corner - y coordinate. + /// \param[out] bottom_left_x Bottom left corner - x coordinate. + /// \param[out] bottom_left_y Bottom left corner - y coordinate. + /// \param[out] top_right_x Top right corner - x coordinate. + /// \param[out] top_right_y Top right corner - y coordinate. void get_bounding_box(double& bottom_left_x, double& bottom_left_y, double& top_right_x, double& top_right_y); /// For internal use. @@ -147,15 +147,15 @@ namespace Hermes #pragma region refinements /// Refines an element. - /// \param id[in] Element id number. - /// \param refinement[in] Ignored for triangles. If the element + /// \param[in] id Element id number. + /// \param[in] refinement Ignored for triangles. If the element /// is a quad, 0 means refine in both directions, 1 means refine /// horizontally (with respect to the reference domain), 2 means /// refine vertically. void refine_element_id(int id, int refinement = 0); /// Refines all elements. - /// \param refinement[in] Same meaning as in refine_element_id(). + /// \param[in] refinement Same meaning as in refine_element_id(). void refine_all_elements(int refinement = 0, bool mark_as_initial = false); /// Selects elements to refine according to a given criterion and @@ -165,7 +165,7 @@ namespace Hermes /// should be refined uniformly, 1 if it is a quad and should be split /// horizontally, 2 if it is a quad and should be split vertically, /// and 3 if it is a triangle and should be split into three quads. - void refine_by_criterion(int (*criterion)(Element* e), int depth = 1, bool mark_as_initial = false); + void refine_by_criterion(int(*criterion)(Element* e), int depth = 1, bool mark_as_initial = false); /// Performs repeated refinements of elements containing the given vertex. /// A mesh graded towards the vertex is created. @@ -175,13 +175,13 @@ namespace Hermes /// boundary marked by 'marker'. Elements touching both by an edge or /// by a vertex are refined. 'aniso' allows or disables anisotropic /// splits of quads. - void refine_towards_boundary(Hermes::vector markers, int depth = 1, bool aniso = true, bool mark_as_initial = false); + void refine_towards_boundary(std::vector markers, int depth = 1, bool aniso = true, bool mark_as_initial = false); void refine_towards_boundary(std::string marker, int depth = 1, bool aniso = true, bool mark_as_initial = false); /// Refines all element sharing the marker passed. void refine_in_area(std::string marker, int depth = 1, int refinement = 0, bool mark_as_initial = false); /// Refines all element sharing the markers passed. - void refine_in_areas(Hermes::vector markers, int depth = 1, int refinement = 0, bool mark_as_initial = false); + void refine_in_areas(std::vector markers, int depth = 1, int refinement = 0, bool mark_as_initial = false); /// Regularizes the mesh by refining elements with hanging nodes of /// degree more than 'n'. As a result, n-irregular mesh is obtained. @@ -211,7 +211,7 @@ namespace Hermes public: /// Constructor. /// \param[in] coarse_mesh The coarse (original) mesh. - /// \param refinement[in] Ignored for triangles. If the element + /// \param[in] refinement Ignored for triangles. If the element /// is a quad, 0 means refine in both directions, 1 means refine /// horizontally (with respect to the reference domain), 2 means /// refine vertically. @@ -286,8 +286,8 @@ namespace Hermes /// the internal representation, or the user std::string value. std::map conversion_table_inverse; - friend class Space; - friend class Space >; + friend class Space < double > ; + friend class Space < std::complex > ; friend class Mesh; }; @@ -297,9 +297,32 @@ namespace Hermes /// For internal use. void set_seq(unsigned seq); - private:/// For internal use. + int nbase, ntopvert, ninitial, nactive; + + class ElementMarkersConversion : public MarkersConversion + { + public: + ElementMarkersConversion(); + virtual MarkersConversionType get_type() const; + }; + + class BoundaryMarkersConversion : public MarkersConversion + { + public: + BoundaryMarkersConversion(); + virtual MarkersConversionType get_type() const; + }; + + ElementMarkersConversion element_markers_conversion; + BoundaryMarkersConversion boundary_markers_conversion; + Array elements; + + unsigned seq; + + /// For internal use. void initial_single_check(); + private: /// Refines all quad elements to triangles. /// It refines a quadrilateral element into two triangles. /// Note: this function creates a base mesh. @@ -326,10 +349,6 @@ namespace Hermes void convert_triangles_to_base(Element* e); void convert_quads_to_base(Element* e); - Array elements; - int nactive; - unsigned seq; - /// Bounding box. double bottom_left_x, bottom_left_y, top_right_x, top_right_y; /// Bounding box calculated. @@ -337,9 +356,6 @@ namespace Hermes /// Bounding box calculation. void calc_bounding_box(); - int nbase, ntopvert; - int ninitial; - void unrefine_element_internal(Element* e); int* parents; @@ -366,37 +382,20 @@ namespace Hermes int elementId; }; - class ElementMarkersConversion : public MarkersConversion - { - public: - ElementMarkersConversion(); - virtual MarkersConversionType get_type() const; - }; - - class BoundaryMarkersConversion : public MarkersConversion - { - public: - BoundaryMarkersConversion(); - virtual MarkersConversionType get_type() const; - }; - - ElementMarkersConversion element_markers_conversion; - BoundaryMarkersConversion boundary_markers_conversion; - friend class MeshHashGrid; friend class MeshReaderH2D; friend class MeshReaderH2DBSON; friend class MeshReaderH2DXML; friend class MeshReaderH1DXML; friend class MeshReaderExodusII; - friend class DiscreteProblem; - friend class DiscreteProblem >; + friend class DiscreteProblem < double > ; + friend class DiscreteProblem < std::complex > ; template friend class DiscreteProblemDGAssembler; - friend class WeakForm; - friend class WeakForm >; + friend class WeakForm < double > ; + friend class WeakForm < std::complex > ; template friend class Adapt; - friend class KellyTypeAdapt; - friend class KellyTypeAdapt >; + friend class KellyTypeAdapt < double > ; + friend class KellyTypeAdapt < std::complex > ; template friend class Solution; template friend class Filter; template friend class MeshFunction; @@ -433,7 +432,7 @@ namespace Hermes /// Vector for storing refinements in order to be able to save/load meshes with identical element IDs. /// Refinement "-1" stands for unrefinement. - Hermes::vector > refinements; + std::vector > refinements; /// Refines a quad element into four quads, or two quads (horizontally or /// vertically. If mesh != nullptr, the new_ elements are incorporated into @@ -466,15 +465,14 @@ namespace Hermes /// \param[in] marker The marker /// \param[in] levels the number of layers of elements forming the "eggshell". Must be > 1. /// \param[in] n_element_guess(optional) Approximate number of elements that will be in this method. Used as an allocation hint. -1 for not-known. - static MeshSharedPtr get_egg_shell(MeshSharedPtr mesh, std::string marker, unsigned int levels, int n_element_guess = -1); + static MeshSharedPtr get_egg_shell(MeshSharedPtr mesh, std::string marker, unsigned int levels); /// Return the "Egg-shell". /// Finds all the elements that neighbor an area with any of markers in markers. /// \param[in] mesh The source mesh /// \param[in] markers The markers /// \param[in] levels the number of layers of elements forming the "eggshell". Must be > 1. - /// \param[in] n_element_guess(optional) Approximate number of elements that will be in this method. Used as an allocation hint. -1 for not-known. - static MeshSharedPtr get_egg_shell(MeshSharedPtr mesh, Hermes::vector markers, unsigned int levels, int n_element_guess = -1); + static MeshSharedPtr get_egg_shell(MeshSharedPtr mesh, std::vector markers, unsigned int levels); /// The mesh returned from get_egg_shell has this marker on the "1" boundary. static const std::string eggShell1Marker; @@ -483,33 +481,29 @@ namespace Hermes /// Internal marker for eggshell elements. static const std::string eggShellMarker; - + /// Verboseness of the static egg shell creation. /// Default: true. static bool egg_shell_verbose; private: /// Internal. - /// Return the "Egg-shell" internal structures. + /// Return the "Egg-shell" internal structures - basic search round (edge-based leveling, no hanging nodes). /// Finds all the elements that neighbor an area with a marker marker. /// \param[in] mesh The target mesh /// \param[in/out] elements The array where the elements will be returned. /// \param[in/out] n_elements Size of the array. - /// \param[in] marker The marker + /// \param[in] markers The markers /// \param[in] n_element_guess(optional) Approximate number of elements that will be in this method. Used as an allocation hint. -1 for not-known. - static void get_egg_shell_structures(MeshSharedPtr target_mesh, Element**& elements, int& n_elements, Hermes::vector markers, unsigned int levels, int n_element_guess = -1); + static void get_egg_shell_structures(MeshSharedPtr target_mesh, std::vector markers, unsigned int levels); /// Internal. - /// Return the "Egg-shell" mesh. - /// Finds all the elements that neighbor an area with a marker marker. - /// \param[in/out] mesh The target mesh - /// \param[in] elements The array from get_egg_shell_structures. - /// \param[in] n_elements Size of the array from get_egg_shell_structures. - static void make_egg_shell_mesh(MeshSharedPtr target_mesh, Element** elements, int n_elements); + /// Handle vertices. + static void handle_vertex_on_target_mesh(Element* e, int vertex, MeshSharedPtr target_mesh, std::vector markers, int* neighbor_targets_local); /// Internal. /// Handle hanging nodes. - static void fix_hanging_nodes(MeshSharedPtr target_mesh, Element** elements, int n_elements); + static void fix_hanging_nodes(MeshSharedPtr target_mesh); /// Internal. static void mark_elements_down_used(int eggShell_marker_volume, Element* element); diff --git a/hermes2d/include/mesh/mesh_data.h b/hermes2d/include/mesh/mesh_data.h index 97e02711df..3d6f7433bf 100644 --- a/hermes2d/include/mesh/mesh_data.h +++ b/hermes2d/include/mesh/mesh_data.h @@ -39,7 +39,8 @@ namespace Hermes ///. class MeshData { - std::string mesh_file_; ///< Mesh Filename (private) + /// Mesh Filename (private) + std::string mesh_file_; /// Removes brackets, commas and other unessential details from the input file. /// Meaningful blank spaces are temporarily replaced with a ';' @@ -49,39 +50,63 @@ namespace Hermes std::string restore(std::string &str); public: - std::map< std::string, std::vector< std::string > > vars_; ///< Map for storing variables in input mesh file - - int n_vert; ///< Number of vertices - int n_el; ///< Number of elements - int n_bdy; ///< Number of boundary edges - int n_curv; ///< Number of curved edges (including NURBS curves) - int n_ref; ///< Number of elements with specified refinements - - std::vector x_vertex; ///< x-coordinate of the vertices - std::vector y_vertex; ///< y-coordinate of the vertices - - std::vector en1; ///< Nodes with local node number 1 - std::vector en2; ///< Nodes with local node number 2 - std::vector en3; ///< Nodes with local node number 3 - std::vector en4; ///< Nodes with local node number 4. Only for quadrilateral elements. For triangular elements it is set to -1. - - std::vector e_mtl; ///< Element markers -- single word strings - - std::vector bdy_first; ///< First node of a boundary edge - std::vector bdy_second; ///< Second node of a boundary edge - std::vector bdy_type; ///< Boundary name - - std::vector curv_first; ///< First node of a curved edge - std::vector curv_second; ///< Second node of a curved edge - - std::vector curv_third; ///< Third entry of a curve specification. Angle for a circular arc and degree for a NURBS curve. - - std::vector curv_inner_pts; ///< Name of the list of the control points and weights of a NURBS curve. Set to "none" for a circular arc - std::vector curv_knots; ///< Name of the list of knot vectors of a NURBS curve. Set to "none" for a circular arc - std::vector curv_nurbs; ///< Nurbs Indicator. True if curve is modeled with NURBS. False if it is a circular arc. - - std::vector ref_elt; ///< List of elements to be refined - std::vector ref_type; ///< List of element refinement type + /// Map for storing variables in input mesh file + std::map< std::string, std::vector< std::string > > vars_; + + /// Number of vertices + int n_vert; + /// Number of elements + int n_el; + /// Number of boundary edges + int n_bdy; + /// Number of curved edges (including NURBS curves) + int n_curv; + /// Number of elements with specified refinements + int n_ref; + + /// x-coordinate of the vertices + std::vector x_vertex; + /// y-coordinate of the vertices + std::vector y_vertex; + + /// Nodes with local node number 1 + std::vector en1; + /// Nodes with local node number 2 + std::vector en2; + /// Nodes with local node number 3 + std::vector en3; + /// Nodes with local node number 4. Only for quadrilateral elements. For triangular elements it is set to -1. + std::vector en4; + + /// Element markers -- single word strings + std::vector e_mtl; + + /// First node of a boundary edge + std::vector bdy_first; + /// Second node of a boundary edge + std::vector bdy_second; + /// Boundary name + std::vector bdy_type; + + /// First node of a curved edge + std::vector curv_first; + /// Second node of a curved edge + std::vector curv_second; + + /// Third entry of a curve specification. Angle for a circular arc and degree for a NURBS curve. + std::vector curv_third; + + /// Name of the list of the control points and weights of a NURBS curve. Set to "none" for a circular arc + std::vector curv_inner_pts; + /// Name of the list of knot vectors of a NURBS curve. Set to "none" for a circular arc + std::vector curv_knots; + /// Nurbs Indicator. True if curve is modeled with NURBS. False if it is a circular arc. + std::vector curv_nurbs; + + /// List of elements to be refined + std::vector ref_elt; + /// List of element refinement type + std::vector ref_type; /// This function parses a given input mesh file line by line and extracts the necessary information into the MeshData class variables void parse_mesh(void); diff --git a/hermes2d/include/mesh/mesh_reader.h b/hermes2d/include/mesh/mesh_reader.h index de8e29d221..bdb6df8f5c 100644 --- a/hermes2d/include/mesh/mesh_reader.h +++ b/hermes2d/include/mesh/mesh_reader.h @@ -13,10 +13,11 @@ // You should have received a copy of the GNU General Public License // along with Hermes2D; if not, see . -#ifndef _MESHLOADER_H_ -#define _MESHLOADER_H_ +#ifndef _MESH_READER_H_ +#define _MESH_READER_H_ #include "mesh.h" +#include "refmap.h" namespace Hermes { namespace Hermes2D @@ -24,7 +25,7 @@ namespace Hermes /** @defgroup mesh_readers Mesh readers * \brief Collection of classes with the purpose of saving and loading Mesh class instances. */ - + /// Abstract class for mesh readers /// /// @ingroup mesh_readers @@ -37,6 +38,9 @@ namespace Hermes /// @param filename [in] The name of the file. /// @param mesh [out] The mesh. virtual void load(const char *filename, MeshSharedPtr mesg) = 0; + + /// Reference mapping for detecting the inverse reference mapping order. + RefMap ref_map; }; } } diff --git a/hermes2d/include/mesh/mesh_reader_exodusii.h b/hermes2d/include/mesh/mesh_reader_exodusii.h index 3d292339e8..639d3d71c4 100644 --- a/hermes2d/include/mesh/mesh_reader_exodusii.h +++ b/hermes2d/include/mesh/mesh_reader_exodusii.h @@ -23,7 +23,6 @@ namespace Hermes { /// Mesh loader from EXODUSII format /// - /// @ingroup mesh_readers class HERMES_API MeshReaderExodusII : public MeshReader { public: diff --git a/hermes2d/include/mesh/mesh_reader_h1d_xml.h b/hermes2d/include/mesh/mesh_reader_h1d_xml.h index 8d152c0e9b..3052371520 100644 --- a/hermes2d/include/mesh/mesh_reader_h1d_xml.h +++ b/hermes2d/include/mesh/mesh_reader_h1d_xml.h @@ -31,7 +31,6 @@ namespace Hermes { /// Mesh reader from Hermes1D XML format /// - /// @ingroup mesh_readers /// The format specification is in hermes2d/xml_schemas/mesh_h1d_xml.xsd class HERMES_API MeshReaderH1DXML : public MeshReader, public Hermes::Hermes2D::Mixins::XMLParsing { diff --git a/hermes2d/include/mesh/mesh_reader_h2d.h b/hermes2d/include/mesh/mesh_reader_h2d.h index 5fa126cfdc..85335d52ce 100644 --- a/hermes2d/include/mesh/mesh_reader_h2d.h +++ b/hermes2d/include/mesh/mesh_reader_h2d.h @@ -21,48 +21,41 @@ namespace Hermes { - namespace Hermes2D - { - /// Mesh reader from Hermes2D format - /// - /// @ingroup mesh_readers - /// Typical usage: - /// MeshSharedPtr mesh; - /// Hermes::Hermes2D::MeshReaderH2D mloader; - /// try - /// { - /// mloader.load("compressor.mesh", &mesh); - /// } - /// catch(Exceptions::MeshLoadFailureException& e) - /// { - /// e.print_msg(); - /// return -1; - /// } - class HERMES_API MeshReaderH2D : public MeshReader - { - public: - MeshReaderH2D(); - virtual ~MeshReaderH2D(); + namespace Hermes2D + { + /// Mesh reader from Hermes2D format + /// + /// Typical usage: + /// MeshSharedPtr mesh; + /// Hermes::Hermes2D::MeshReaderH2D mloader; + /// try + /// { + ///  mloader.load("compressor.mesh", &mesh); + /// } + /// catch(Exceptions::MeshLoadFailureException& e) + /// { + ///  e.print_msg(); + ///  return -1; + /// } + class HERMES_API MeshReaderH2D : public MeshReader + { + public: + MeshReaderH2D(); + virtual ~MeshReaderH2D(); - virtual void load(const char *filename, MeshSharedPtr mesh); - virtual void load(std::string filename, MeshSharedPtr mesh) - { - return this->load(filename.c_str(), mesh); - } - virtual void save(const char *filename, MeshSharedPtr mesh); - virtual void save(std::string filename, MeshSharedPtr mesh) - { - return this->save(filename.c_str(), mesh); - } + virtual void load(const char *filename, MeshSharedPtr mesh); + virtual void load(std::string filename, MeshSharedPtr mesh); + virtual void save(const char *filename, MeshSharedPtr mesh); + virtual void save(std::string filename, MeshSharedPtr mesh); - protected: - Curve* load_curve(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2); - Arc* load_arc(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2, Arc* arc); - Nurbs* load_nurbs(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2, Nurbs* nurbs); + protected: + Curve* load_curve(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2); + Arc* load_arc(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2, Arc* arc); + Nurbs* load_nurbs(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2, Nurbs* nurbs); - void save_refinements(MeshSharedPtr mesh, FILE* f, Element* e, int id, bool& first); - void save_curve(MeshSharedPtr mesh, FILE* f, int p1, int p2, Curve* curve); - }; - } + void save_refinements(MeshSharedPtr mesh, FILE* f, Element* e, int id, bool& first); + void save_curve(MeshSharedPtr mesh, FILE* f, int p1, int p2, Curve* curve); + }; + } } #endif \ No newline at end of file diff --git a/hermes2d/include/mesh/mesh_reader_h2d_bson.h b/hermes2d/include/mesh/mesh_reader_h2d_bson.h index 8991ab9012..99e44448d9 100644 --- a/hermes2d/include/mesh/mesh_reader_h2d_bson.h +++ b/hermes2d/include/mesh/mesh_reader_h2d_bson.h @@ -26,7 +26,6 @@ namespace Hermes { /// Mesh reader from BSON format /// - /// @ingroup mesh_readers /// Typical usage: /// MeshSharedPtr mesh; /// Hermes::Hermes2D::MeshReaderH2DBSON mloader; @@ -39,7 +38,7 @@ namespace Hermes /// e.print_msg(); /// return -1; /// } - /// + /// class HERMES_API MeshReaderH2DBSON : public MeshReader { public: @@ -55,10 +54,10 @@ namespace Hermes /// This method loads multiple meshes according to subdomains described in the meshfile. /// \param[in] meshes Meshes to be loaded, the number must correspond to the subdomains described in the file. ///  also the order is determined by the order in the file. - void load(const char *filename, Hermes::vector meshes); + void load(const char *filename, std::vector meshes); /// This method saves multiple meshes according to subdomains in the vector meshes. - void save(const char *filename, Hermes::vector meshes); + void save(const char *filename, std::vector meshes); private: struct vertex_BSON @@ -290,20 +289,19 @@ namespace Hermes this->refinements.push_back(refinement); } } - Hermes::vector vertices; - Hermes::vector elements; - Hermes::vector boundary_edges; - Hermes::vector inner_edges; - Hermes::vector refinements; + std::vector vertices; + std::vector elements; + std::vector boundary_edges; + std::vector inner_edges; + std::vector refinements; }; - static bool elementCompare (element_BSON el_i, element_BSON el_j) { return ( el_i.i < el_j.i ); } + static bool elementCompare(element_BSON el_i, element_BSON el_j) { return (el_i.i < el_j.i); } void load_domain(bson& br, MeshSharedPtr mesh, std::map& vertex_is, std::map& element_is, std::map& edge_is, - Hermes::vector& elements, Hermes::vector& edges, Hermes::vector& vertices, Hermes::vector& arcs, Hermes::vector& subdomains); + std::vector& elements, std::vector& edges, std::vector& vertices, std::vector& arcs, std::vector& subdomains); }; } } #endif #endif - diff --git a/hermes2d/include/mesh/mesh_reader_h2d_xml.h b/hermes2d/include/mesh/mesh_reader_h2d_xml.h index bf6e124236..38589fa6c8 100644 --- a/hermes2d/include/mesh/mesh_reader_h2d_xml.h +++ b/hermes2d/include/mesh/mesh_reader_h2d_xml.h @@ -37,7 +37,6 @@ namespace Hermes { /// Mesh reader from Hermes2D XML format /// - /// @ingroup mesh_readers /// Typical usage: /// MeshSharedPtr mesh; /// Hermes::Hermes2D::MeshReaderH2DXML mloader; @@ -50,7 +49,7 @@ namespace Hermes /// e.print_msg(); /// return -1; /// } - /// + /// /// The format specification is in hermes2d/xml_schemas/mesh_h2d_xml.xsd class HERMES_API MeshReaderH2DXML : public MeshReader, public Hermes::Hermes2D::Mixins::XMLParsing { @@ -70,15 +69,15 @@ namespace Hermes /// This method loads multiple meshes according to subdomains described in the meshfile. /// \param[in] meshes Meshes to be loaded, the number must correspond to the subdomains described in the file. ///  also the order is determined by the order in the file. - void load(const char *filename, Hermes::vector meshes); + void load(const char *filename, std::vector meshes); /// This method loads multiple meshes according to subdomains described in the meshfile. /// \param[in] meshes Meshes to be loaded, the number must correspond to the subdomains described in the provided XML structure. ///  also the order is determined by the order in the file. - void load(std::auto_ptr & parsed_xml_domain, Hermes::vector meshes); + void load(std::auto_ptr & parsed_xml_domain, std::vector meshes); /// This method saves multiple meshes according to subdomains in the vector meshes. - void save(const char *filename, Hermes::vector meshes); + void save(const char *filename, std::vector meshes); protected: /// Internal method loading contents of parsed_xml_mesh into mesh. diff --git a/hermes2d/include/mesh/mesh_util.h b/hermes2d/include/mesh/mesh_util.h index 0e791aaa73..3fd7bfaac9 100644 --- a/hermes2d/include/mesh/mesh_util.h +++ b/hermes2d/include/mesh/mesh_util.h @@ -26,6 +26,7 @@ namespace Hermes class MeshHashGrid; class Mesh; class Nurbs; + typedef std::tr1::shared_ptr MeshSharedPtr; class MeshHashGridElement @@ -34,7 +35,7 @@ namespace Hermes MeshHashGridElement(double lower_left_x, double lower_left_y, double upper_right_x, double upper_right_y, int depth = 0); ~MeshHashGridElement(); - /// Return the Element + /// Return the Element Hermes::Hermes2D::Element* getElement(double x, double y); private: @@ -60,7 +61,7 @@ namespace Hermes #define GRID_SIZE 50 - class MeshUtil + class HERMES_API MeshUtil { public: /// For internal use. @@ -215,50 +216,50 @@ namespace Hermes /// Helper macros for easy iteration through all elements, nodes etc. in a Mesh. #define for_all_elements(e, mesh) \ - for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ - if(((e) = (mesh)->get_element_fast(_id)) != nullptr) + for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ + if (((e) = (mesh)->get_element_fast(_id)) != nullptr) #define for_all_used_elements(e, mesh) \ - for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ - if(((e) = (mesh)->get_element_fast(_id))->used) + for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ + if (((e) = (mesh)->get_element_fast(_id))->used) #define for_all_base_elements(e, mesh) \ - for (int _id = 0; _id < (mesh)->get_num_base_elements(); _id++) \ - if(((e) = (mesh)->get_element_fast(_id))->used) + for (int _id = 0; _id < (mesh)->get_num_base_elements(); _id++) \ + if (((e) = (mesh)->get_element_fast(_id))->used) #define for_all_base_elements_incl_inactive(e, mesh) \ - for (int _id = 0; _id < (mesh)->get_num_base_elements(); _id++) \ - if(((e) = (mesh)->get_element_fast(_id))->used || !((e) = (mesh)->get_element_fast(_id))->used) + for (int _id = 0; _id < (mesh)->get_num_base_elements(); _id++) \ + if (((e) = (mesh)->get_element_fast(_id))->used || !((e) = (mesh)->get_element_fast(_id))->used) #define for_all_active_elements_fast(mesh) \ Element* e; \ - for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ -if (((e) = (mesh)->get_element_fast(_id))->used) \ -if ((e)->active) + for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ + if (((e) = (mesh)->get_element_fast(_id))->used) \ + if ((e)->active) #define for_all_active_elements(e, mesh) \ -for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ -if (((e) = (mesh)->get_element_fast(_id))->used) \ -if ((e)->active) + for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ + if (((e) = (mesh)->get_element_fast(_id))->used) \ + if ((e)->active) #define for_all_inactive_elements(e, mesh) \ - for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ - if(((e) = (mesh)->get_element_fast(_id))->used) \ - if(!(e)->active) + for (int _id = 0, _max = (mesh)->get_max_element_id(); _id < _max; _id++) \ + if (((e) = (mesh)->get_element_fast(_id))->used) \ + if (!(e)->active) #define for_all_nodes(n, mesh) \ - for (int _id = 0, _max = (mesh)->get_max_node_id(); _id < _max; _id++) \ - if(((n) = (mesh)->get_node(_id))->used) + for (int _id = 0, _max = (mesh)->get_max_node_id(); _id < _max; _id++) \ + if (((n) = (mesh)->get_node(_id))->used) #define for_all_vertex_nodes(n, mesh) \ - for (int _id = 0, _max = (mesh)->get_max_node_id(); _id < _max; _id++) \ - if(((n) = (mesh)->get_node(_id))->used) \ - if(!(n)->type) + for (int _id = 0, _max = (mesh)->get_max_node_id(); _id < _max; _id++) \ + if (((n) = (mesh)->get_node(_id))->used) \ + if (!(n)->type) #define for_all_edge_nodes(n, mesh) \ - for (int _id = 0, _max = (mesh)->get_max_node_id(); _id < _max; _id++) \ - if(((n) = (mesh)->get_node(_id))->used) \ - if((n)->type) + for (int _id = 0, _max = (mesh)->get_max_node_id(); _id < _max; _id++) \ + if (((n) = (mesh)->get_node(_id))->used) \ + if ((n)->type) } } #endif diff --git a/hermes2d/include/mesh/refmap.h b/hermes2d/include/mesh/refmap.h index e6717ff7a5..f014dda8a4 100644 --- a/hermes2d/include/mesh/refmap.h +++ b/hermes2d/include/mesh/refmap.h @@ -29,7 +29,6 @@ namespace Hermes class Element; class Mesh; - /// @ingroup meshFunctions /// \brief Represents the reference mapping. /// /// RefMap represents the mapping from the reference to the physical element. @@ -147,7 +146,7 @@ namespace Hermes #ifdef H2D_USE_SECOND_DERIVATIVES /// Returns coefficients for weak forms with second derivatives. double3x2* get_second_ref_map(int order); - + /// Calculates the second reference map at a particular point (xi1, xi2). void second_ref_map_at_point(double xi1, double xi2, double& x, double& y, double3x2& mm); #endif @@ -161,8 +160,6 @@ namespace Hermes /// For internal use only. void force_transform(uint64_t sub_idx, Trf* ctm); - static bool is_parallelogram(Element* e); - static void set_element_iro_cache(Element* element); private: @@ -170,7 +167,7 @@ namespace Hermes void reinit_storage(); H1ShapesetJacobi ref_map_shapeset; - PrecalcShapeset ref_map_pss; + PrecalcShapesetAssembling ref_map_pss; /// Constant reference mapping. bool is_const; @@ -221,7 +218,7 @@ namespace Hermes /// matrix alone. This is added to the total integration order in weak form itegrals. int calc_inv_ref_order(); - int indices[70]; + unsigned short indices[70]; int nc; diff --git a/hermes2d/include/mesh/traverse.h b/hermes2d/include/mesh/traverse.h index 06a303c4be..4fc675c177 100644 --- a/hermes2d/include/mesh/traverse.h +++ b/hermes2d/include/mesh/traverse.h @@ -23,48 +23,45 @@ namespace Hermes { namespace Hermes2D { - /** @defgroup inner Hermes hp-FEM/hp-DG assembling core - * Inner functionality classes that are not for the user to modify. - */ - - /// @ingroup inner /// \brief Determines the position on an element surface (edge in 2D and Face in 3D). /// \details Used for the retrieval of boundary condition values. /// \details Same in H2D and H3D. /// struct SurfPos { - int marker; ///< surface marker (surface = edge in 2D and face in 3D) - int surf_num; ///< local element surface number - - Element *base; ///< for internal use - - int v1, v2; ///< H2D only: edge endpoint vertex id numbers - double t; ///< H2D only: position between v1 and v2 in the range[0..1] - double lo, hi; ///< H2D only: for internal use + /// surface marker (surface = edge in 2D and face in 3D) + int marker; + /// local element surface number + int surf_num; + + /// for internal use + Element *base; + + /// H2D only: edge endpoint vertex id numbers + int v1, v2; + /// H2D only: position between v1 and v2 in the range[0..1] + double t; + /// H2D only: for internal use + double lo, hi; }; class Mesh; class Transformable; struct Rect; - /// @ingroup inner struct UniData { Element* e; uint64_t idx; }; - /// @ingroup inner - static const uint64_t ONE = (uint64_t) 1 << 63; + static const uint64_t ONE = (uint64_t)1 << 63; - /// @ingroup inner struct Rect { uint64_t l, b, r, t; }; - /// @ingroup inner /// Traverse is a multi-mesh traversal utility class. Given N meshes sharing the /// same base mesh it walks through all (pseudo-)elements of the union of all /// the N meshes. @@ -80,50 +77,49 @@ namespace Hermes uint64_t* sub_idx; bool bnd[H2D_MAX_NUMBER_EDGES]; bool isBnd; + unsigned char isurf; Element* rep; - uint64_t rep_subidx; - int rep_i; + unsigned short rep_i; ~State(); - int isurf; - int num; + unsigned short num; + static State* clone(const State * other); private: State(); //void operator=(const State * other); - static State* clone(const State * other); - void push_transform(int son, int i, bool is_triangle = false); + void push_transform(unsigned char son, unsigned char i, bool is_triangle = false); bool is_triangle(); - uint64_t get_transform(int i); + uint64_t get_transform(unsigned char i); bool visited; Rect cr; Rect* er; - friend class Traverse; - template friend class DiscreteProblem; - template friend class DiscreteProblemDGAssembler; - template friend class DiscreteProblemThreadAssembler; + friend class Traverse; + template friend class DiscreteProblem; + template friend class DiscreteProblemDGAssembler; + template friend class DiscreteProblemThreadAssembler; }; /// Returns all states on the passed meshes. /// \param[in] meshes Meshes. /// \param[out] num Number of states. /// \return The states. - State** get_states(Hermes::vector meshes, int& num); - State** get_states(MeshSharedPtr* meshes, int meshes_count, int& states_count); + State** get_states(std::vector meshes, unsigned int& states_count); + State** get_states(MeshSharedPtr* meshes, unsigned short meshes_count, unsigned int& states_count); /// Returns all states on the passed meshes. /// Overload for mesh functions. template - State** get_states(Hermes::vector > mesh_functions, int& num); - + State** get_states(std::vector > mesh_functions, unsigned int& states_count); + private: /// Used by get_states. void begin(int n); /// Used by get_states. void finish(); /// Used by get_states. - void init_transforms(State* s, int i); + void init_transforms(State* s, unsigned char i); #pragma region union-mesh - static UniData** construct_union_mesh(int n, MeshSharedPtr* meshes, MeshSharedPtr unimesh); + static UniData** construct_union_mesh(unsigned char n, MeshSharedPtr* meshes, MeshSharedPtr unimesh); void union_recurrent(Rect* cr, Element** e, Rect* er, uint64_t* idx, Element* uni); uint64_t init_idx(Rect* cr, Rect* er); @@ -132,7 +128,7 @@ namespace Hermes #pragma endregion /// Internal. - int num; + unsigned short num; /// Internal. State* stack; /// Internal. @@ -145,7 +141,7 @@ namespace Hermes /// Internal. void free_state(State* state); /// Internal. - int spaces_size; + unsigned char spaces_size; MeshSharedPtr unimesh; template friend class Adapt; diff --git a/hermes2d/include/mixins2d.h b/hermes2d/include/mixins2d.h index d84098f806..7e8bde3bf7 100644 --- a/hermes2d/include/mixins2d.h +++ b/hermes2d/include/mixins2d.h @@ -15,7 +15,6 @@ namespace Hermes namespace Mixins { - /// \ingroup g_mixins2d /// Any XML parsing class should inherit from this mixin. /// It serves various purposes, first of which is disabling / re-enabling of validation @@ -40,7 +39,7 @@ namespace Hermes protected: Parallel(); protected: - int num_threads_used; + unsigned char num_threads_used; std::string exceptionMessageCaughtInParallelBlock; }; } diff --git a/hermes2d/include/neighbor_search.h b/hermes2d/include/neighbor_search.h index a89c85074d..977ea11701 100644 --- a/hermes2d/include/neighbor_search.h +++ b/hermes2d/include/neighbor_search.h @@ -114,16 +114,16 @@ namespace Hermes bool set_active_edge_multimesh(const int& edge); /// Extract transformations in the correct direction from the provided sub_idx. - Hermes::vector get_transforms(uint64_t sub_idx) const; + std::vector get_transforms(uint64_t sub_idx) const; /// Gives an info if edge is an intra- or inter- element edge. - bool is_inter_edge(const int& edge, const Hermes::vector& transformations) const; + bool is_inter_edge(const int& edge, const std::vector& transformations) const; /// Update according to the subelement mapping of the central element. - void update_according_to_sub_idx(const Hermes::vector& transformations); + void update_according_to_sub_idx(const std::vector& transformations); /// Special function for handling subelement transformations in the case of more than one neighboring active elements. - void handle_sub_idx_way_down(const Hermes::vector& transformations); + void handle_sub_idx_way_down(const std::vector& transformations); /// Give the info if the two transformations are correct, w.r.t. the edge. /// Simply compares a to b in case of triangles, does more work in case of quads. @@ -145,7 +145,8 @@ namespace Hermes DiscontinuousFunc* init_ext_fn(MeshFunction* fu); class ExtendedShapeset; - ExtendedShapeset *supported_shapes; ///< Object allowing to set/get a particular shape function from the extended + /// Object allowing to set/get a particular shape function from the extended + ExtendedShapeset *supported_shapes; ///< shapeset and retrieve global assembly information for it. /// Form the extended shapeset. @@ -188,7 +189,7 @@ namespace Hermes /// /// \return pointer to the vector of neighboring elements. /// - const Hermes::vector* get_neighbors() const; + const std::vector* get_neighbors() const; /// Frees the memory occupied by the extended shapeset. void clear_supported_shapes(); @@ -227,15 +228,20 @@ namespace Hermes void update(NeighborSearch* neighborhood, SpaceSharedPtr space); public: - int cnt; ///< Number of shape functions in the extended shapeset. - int *dof; ///< Array of global DOF numbers of shape functions in the extended shapeset. + /// Number of shape functions in the extended shapeset. + int cnt; + /// Array of global DOF numbers of shape functions in the extended shapeset. + int *dof; bool has_support_on_neighbor(unsigned int index) const; - AsmList* central_al; ///< Assembly list for the currently assembled edge on the central elem. - AsmList* neighbor_al; ///< Assembly list for the currently assembled edge on the neighbor elem. + /// Assembly list for the currently assembled edge on the central elem. + AsmList* central_al; + /// Assembly list for the currently assembled edge on the neighbor elem. + AsmList* neighbor_al; - friend class NeighborSearch; // Only a NeighborSearch is allowed to create an ExtendedShapeset. + // Only a NeighborSearch is allowed to create an ExtendedShapeset. + friend class NeighborSearch; }; /*** Neighborhood information. ***/ @@ -245,8 +251,10 @@ namespace Hermes public: NeighborEdgeInfo() : local_num_of_edge(-1), orientation(false) {}; - int local_num_of_edge; ///< Local number of the edge on neighbor element. - bool orientation; ///< Relative orientation of the neighbor edge with respect to the active edge + /// Local number of the edge on neighbor element. + int local_num_of_edge; + /// Relative orientation of the neighbor edge with respect to the active edge + bool orientation; ///< (0 - same orientation, 1 - reverse orientation). }; @@ -282,22 +290,25 @@ namespace Hermes class HERMES_API Transformations { public: - static const int max_level = Transformable::H2D_MAX_TRN_LEVEL; ///< Number of allowed transformations (or equiv. number of neighbors + /// Number of allowed transformations (or equiv. number of neighbors + static const int max_level = Transformable::H2D_MAX_TRN_LEVEL; ///< in a go-down neighborhood) - see Transformable::push_transform. - unsigned int transf[max_level]; ///< Array holding the transformations at subsequent levels. - unsigned int num_levels; ///< Number of transformation levels actually used in \c transf. + /// Array holding the transformations at subsequent levels. + unsigned int transf[max_level]; + /// Number of transformation levels actually used in \c transf. + unsigned int num_levels; Transformations(); Transformations(const Transformations* t); void operator=(const Transformations* t); - Transformations(const Hermes::vector& t); + Transformations(const std::vector& t); - void copy_from(const Hermes::vector& t); + void copy_from(const std::vector& t); void copy_from(const Transformations* t); - void copy_to(Hermes::vector* t); + void copy_to(std::vector* t); void reset(); @@ -305,7 +316,7 @@ namespace Hermes void apply_on(Transformable* tr) const; - void apply_on(const Hermes::vector& tr) const; + void apply_on(const std::vector& tr) const; template friend class NeighborSearch; template friend class KellyTypeAdapt; @@ -315,39 +326,49 @@ namespace Hermes template friend class MultimeshDGNeighborTree; }; - MeshSharedPtr mesh; /*** Transformations. ***/ static const unsigned int H2D_INITIAL_NEIGHBOR_NUMBER_GUESS = 32; - Transformations** central_transformations; ///< Array of transformations of the central element to each neighbor + /// Array of transformations of the central element to each neighbor + Transformations** central_transformations; ///< (in a go-down neighborhood; stored as on \c Transformation structure ///< for each neighbor). void add_central_transformations(Transformations* to_add, int position, bool replace = false); unsigned int central_transformations_size; unsigned int central_transformations_alloc_size; - Transformations** neighbor_transformations; ///< Array of transformations of the neighbor to the central element (go-up). + /// Array of transformations of the neighbor to the central element (go-up). + Transformations** neighbor_transformations; void add_neighbor_transformations(Transformations* to_add, int position, bool replace = false); unsigned int neighbor_transformations_size; unsigned int neighbor_transformations_alloc_size; - uint64_t original_central_el_transform; ///< Sub-element transformation of any function that comes from the + /// Sub-element transformation of any function that comes from the + uint64_t original_central_el_transform; ///< assembly, before transforms from \c transformations are pushed to it. /*** Significant objects of the neighborhood. ***/ - Element* central_el; ///< Central (currently assembled) element. - Element* neighb_el; ///< Currently selected neighbor element (on the other side of active segment). + /// Central (currently assembled) element. + Element* central_el; + /// Currently selected neighbor element (on the other side of active segment). + Element* neighb_el; private: - int active_edge; ///< Local number of the currently assembled edge, w.r.t. the central element. - NeighborEdgeInfo neighbor_edge;///< Assembled edge, w.r.t. the element on the other side. - int active_segment; ///< Part of the active edge shared by central and neighbor elements. - - Hermes::vector neighbor_edges; ///< Active edge information from each neighbor. - Hermes::vector neighbors; ///< Vector with pointers to the neighbor elements. - unsigned int n_neighbors; ///< Number of neighbors (>1 for a go-down neighborhood, 1 otherwise). + /// Local number of the currently assembled edge, w.r.t. the central element. + int active_edge; + /// Assembled edge, w.r.t. the element on the other side. + NeighborEdgeInfo neighbor_edge; + /// Part of the active edge shared by central and neighbor elements. + int active_segment; + + /// Active edge information from each neighbor. + std::vector neighbor_edges; + /// Vector with pointers to the neighbor elements. + std::vector neighbors; + /// Number of neighbors (>1 for a go-down neighborhood, 1 otherwise). + unsigned int n_neighbors; /// Possible neighborhood types, according to which way we went on the neighbor element in order to get to the /// other side of the neighbor. The way is characterized by transformations needed to be pushed either on the @@ -425,8 +446,10 @@ namespace Hermes /*** Quadrature on the active edge. ***/ Quad2D* quad; - int central_quad_order; ///< Quadrature data of the active edge with respect to the central element. - int neighb_quad_order; ///< Quadrature data of the active edge with respect to the element on the other side. + /// Quadrature data of the active edge with respect to the central element. + int central_quad_order; + /// Quadrature data of the active edge with respect to the element on the other side. + int neighb_quad_order; template friend class KellyTypeAdapt; template friend class Adapt; diff --git a/hermes2d/include/norm_form.h b/hermes2d/include/norm_form.h index e706587096..d670ce77a6 100644 --- a/hermes2d/include/norm_form.h +++ b/hermes2d/include/norm_form.h @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -64,84 +64,84 @@ namespace Hermes class HERMES_API NormFormVol : public NormForm { public: - NormFormVol(int i, int j); + NormFormVol(int i, int j, FunctionsEvaluatedType functionType); - virtual Scalar value(int n, double *wt, Func *u, Func *v, Geom *e) const = 0; + virtual Scalar value(int n, double *wt, Func *u, Func *v, GeomVol *e) const = 0; }; template class HERMES_API NormFormSurf : public NormForm { public: - NormFormSurf(int i, int j); + NormFormSurf(int i, int j, FunctionsEvaluatedType functionType); - virtual Scalar value(int n, double *wt, Func *u, Func *v, Geom *e) const = 0; + virtual Scalar value(int n, double *wt, Func *u, Func *v, GeomSurf *e) const = 0; }; template class HERMES_API NormFormDG : public NormForm { public: - NormFormDG(int i, int j); + NormFormDG(int i, int j, FunctionsEvaluatedType functionType); - virtual Scalar value(int n, double *wt, DiscontinuousFunc *u, DiscontinuousFunc *v, Geom *e) const = 0; + virtual Scalar value(int n, double *wt, DiscontinuousFunc *u, DiscontinuousFunc *v, GeomSurf *e) const = 0; }; template - class HERMES_API DefaultNormFormVol : public NormFormVol + class HERMES_API DefaultNormFormVol : public NormFormVol < Scalar > { public: - DefaultNormFormVol(int i, int j, NormType normType); - - Scalar value(int n, double *wt, Func *u, Func *v, Geom *e) const; + DefaultNormFormVol(int i, int j, NormType normType, FunctionsEvaluatedType functionType); + + Scalar value(int n, double *wt, Func *u, Func *v, GeomVol *e) const; protected: NormType normType; }; template - class HERMES_API DefaultNormFormSurf : public NormFormSurf + class HERMES_API DefaultNormFormSurf : public NormFormSurf < Scalar > { public: - DefaultNormFormSurf(int i, int j, NormType normType); - - Scalar value(int n, double *wt, Func *u, Func *v, Geom *e) const; + DefaultNormFormSurf(int i, int j, NormType normType, FunctionsEvaluatedType functionType); + + Scalar value(int n, double *wt, Func *u, Func *v, GeomSurf *e) const; protected: NormType normType; }; template - class HERMES_API MatrixDefaultNormFormVol : public MatrixFormVol + class HERMES_API MatrixDefaultNormFormVol : public MatrixFormVol < Scalar > { public: MatrixDefaultNormFormVol(int i, int j, NormType normType); Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; - + GeomVol *e, Func **ext) const; + MatrixFormVol* clone() const; - protected: + protected: NormType normType; }; template - class HERMES_API VectorDefaultNormFormVol : public VectorFormVol + class HERMES_API VectorDefaultNormFormVol : public VectorFormVol < Scalar > { public: VectorDefaultNormFormVol(int i, NormType normType); - Scalar value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + Scalar value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; + + Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; - Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; - VectorFormVol* clone() const; - protected: + protected: NormType normType; }; } diff --git a/hermes2d/include/projections/ogprojection.h b/hermes2d/include/projections/ogprojection.h index 3704fce3ad..713c2add75 100644 --- a/hermes2d/include/projections/ogprojection.h +++ b/hermes2d/include/projections/ogprojection.h @@ -24,11 +24,6 @@ namespace Hermes { namespace Hermes2D { - /** @defgroup projections Projections - * \brief Projection classes for various kinds of projecting a MeshFunction onto a Space. - */ - - /// @ingroup projections /// \brief Class for (global) orthogonal projecting. If the projection is not necessary (if a solution belongs to the space), then its solution vector is used. template class HERMES_API OGProjection : public Hermes::Mixins::Loggable @@ -40,23 +35,23 @@ namespace Hermes VectorFormVol* custom_projection_residual, Scalar* target_vec); - /// Wrapper that delivers a Solution instead of a coefficient vector. + /// Wrapper that delivers a Solution instead of a coefficient vector. static void project_global(SpaceSharedPtr space, MatrixFormVol* custom_projection_jacobian, VectorFormVol* custom_projection_residual, MeshFunctionSharedPtr target_sln); /// This method allows to specify your own multiple OG-projection forms. - static void project_global(const Hermes::vector >& spaces, - const Hermes::vector*>& custom_projection_jacobian, - const Hermes::vector*>& custom_projection_residual, + static void project_global(const std::vector > spaces, + const std::vector*>& custom_projection_jacobian, + const std::vector*>& custom_projection_residual, Scalar* target_vec); - /// Wrapper that delivers a vector of Solutions instead of a coefficient vector. - static void project_global(const Hermes::vector >& spaces, - const Hermes::vector*>& custom_projection_jacobian, - const Hermes::vector*>& custom_projection_residual, - const Hermes::vector >& target_slns); + /// Wrapper that delivers a vector of Solutions instead of a coefficient vector. + static void project_global(const std::vector > spaces, + const std::vector*>& custom_projection_jacobian, + const std::vector*>& custom_projection_residual, + const std::vector >& target_slns); /** \fn static void OGProjection::project_global(SpaceSharedPtr space, @@ -86,15 +81,15 @@ namespace Hermes NormType proj_norm = HERMES_UNSET_NORM); /// Wrapper for multiple source MeshFunctions that delivers coefficient vector. - static void project_global(Hermes::vector > spaces, Hermes::vector > source_meshfns, - Scalar* target_vec, Hermes::vector proj_norms = Hermes::vector()); + static void project_global(std::vector > spaces, std::vector > source_meshfns, + Scalar* target_vec, std::vector proj_norms = std::vector()); + + static void project_global(std::vector > spaces, std::vector > source_meshfns, + Hermes::Algebra::Vector* target_vec, std::vector proj_norms = std::vector()); - static void project_global(Hermes::vector > spaces, Hermes::vector > source_meshfns, - Hermes::Algebra::Vector* target_vec, Hermes::vector proj_norms = Hermes::vector()); - - static void project_global(Hermes::vector > spaces, - Hermes::vector > source_slns, Hermes::vector > target_slns, - Hermes::vector proj_norms = Hermes::vector(), bool delete_old_mesh = false); + static void project_global(std::vector > spaces, + std::vector > source_slns, std::vector > target_slns, + std::vector proj_norms = std::vector(), bool delete_old_mesh = false); protected: /// Underlying function for global orthogonal projection. @@ -102,7 +97,7 @@ namespace Hermes /// a special projection weak form, which is different from /// the weak form of the PDE. If you supply a weak form of the /// PDE, the PDE will just be solved. - static void project_internal(SpaceSharedPtr space, WeakForm* proj_wf, Scalar* target_vec); + static void project_internal(SpaceSharedPtr space, WeakFormSharedPtr proj_wf, Scalar* target_vec); }; } } diff --git a/hermes2d/include/projections/ogprojection_nox.h b/hermes2d/include/projections/ogprojection_nox.h index 57f91172a8..6612e9d277 100644 --- a/hermes2d/include/projections/ogprojection_nox.h +++ b/hermes2d/include/projections/ogprojection_nox.h @@ -37,27 +37,24 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup projections template class HERMES_API OGProjectionNOX : public Hermes::Mixins::Loggable { public: - OGProjectionNOX(); - /// Main functionality is in the protected method project_internal(). /// This is a wrapper that allows the user to specify his own projection form. - void project_global(SpaceSharedPtr space, - MatrixFormVol* custom_projection_jacobian, - VectorFormVol* custom_projection_residual, - Scalar* target_vec, double newton_tol = 1e-6, int newton_max_iter = 10); + static void project_global(SpaceSharedPtr space, + MatrixFormVol* custom_projection_jacobian, + VectorFormVol* custom_projection_residual, + Scalar* target_vec, double newton_tol = 1e-6, int newton_max_iter = 10); /** \fn static void OGProjection::project_global(SpaceSharedPtr space, - MeshFunction* source_meshfn, Scalar* target_vec, - NormType proj_norm = HERMES_UNSET_NORM, double newton_tol = 1e-6, int newton_max_iter = 10); + MeshFunction* source_meshfn, Scalar* target_vec, + NormType proj_norm = HERMES_UNSET_NORM, double newton_tol = 1e-6, int newton_max_iter = 10); \brief The method checks source_meshfn if it is an instance of Solution, if so, it checks its sln_vector, and space_seq - if they can be used directly. + if they can be used directly. \author LK \date 10/29/2011 @@ -70,35 +67,35 @@ namespace Hermes \param newton_tol (optional) the newton tolerance. \param newton_max_iter (optional) the newton maximum iterator. */ - void project_global(SpaceSharedPtr space, MeshFunction* source_meshfn, - Scalar* target_vec, NormType proj_norm = HERMES_UNSET_NORM, - double newton_tol = 1e-6, int newton_max_iter = 10); + static void project_global(SpaceSharedPtr space, MeshFunction* source_meshfn, + Scalar* target_vec, NormType proj_norm = HERMES_UNSET_NORM, + double newton_tol = 1e-6, int newton_max_iter = 10); /// Wrapper that accepts MeshFunctionSharedPtr instead of the ordinary MeshFunction pointer. - void project_global(SpaceSharedPtr space, MeshFunctionSharedPtr source_meshfn, - Scalar* target_vec, NormType proj_norm = HERMES_UNSET_NORM, - double newton_tol = 1e-6, int newton_max_iter = 10); - + static void project_global(SpaceSharedPtr space, MeshFunctionSharedPtr source_meshfn, + Scalar* target_vec, NormType proj_norm = HERMES_UNSET_NORM, + double newton_tol = 1e-6, int newton_max_iter = 10); + /// Wrapper that delivers a MeshFunctionSharedPtr instead of coefficient vector. - void project_global(SpaceSharedPtr space, - MeshFunctionSharedPtr source_sln, MeshFunctionSharedPtr target_sln, - NormType proj_norm = HERMES_UNSET_NORM, - double newton_tol = 1e-6, int newton_max_iter = 10); + static void project_global(SpaceSharedPtr space, + MeshFunctionSharedPtr source_sln, MeshFunctionSharedPtr target_sln, + NormType proj_norm = HERMES_UNSET_NORM, + double newton_tol = 1e-6, int newton_max_iter = 10); /// Wrapper for multiple source MeshFunction pointers that delivers coefficient vector. - void project_global(Hermes::vector > spaces, Hermes::vector* > source_meshfns, - Scalar* target_vec, Hermes::vector proj_norms = Hermes::vector(), - double newton_tol = 1e-6, int newton_max_iter = 10); + static void project_global(std::vector > spaces, std::vector* > source_meshfns, + Scalar* target_vec, std::vector proj_norms = std::vector(), + double newton_tol = 1e-6, int newton_max_iter = 10); /// Wrapper for multiple source MeshFunctionSharedPtrs that delivers coefficient vector. - void project_global(Hermes::vector > spaces, Hermes::vector > source_slns, - Scalar* target_vec, Hermes::vector proj_norms = Hermes::vector(), - double newton_tol = 1e-6, int newton_max_iter = 10); + static void project_global(std::vector > spaces, std::vector > source_slns, + Scalar* target_vec, std::vector proj_norms = std::vector(), + double newton_tol = 1e-6, int newton_max_iter = 10); - void project_global(Hermes::vector > spaces, - Hermes::vector > source_slns, Hermes::vector > target_slns, - Hermes::vector proj_norms = Hermes::vector(), bool delete_old_mesh = false, - double newton_tol = 1e-6, int newton_max_iter = 10); + static void project_global(std::vector > spaces, + std::vector > source_slns, std::vector > target_slns, + std::vector proj_norms = std::vector(), bool delete_old_mesh = false, + double newton_tol = 1e-6, int newton_max_iter = 10); protected: /// Underlying function for global orthogonal projection. @@ -106,11 +103,11 @@ namespace Hermes /// a special projection weak form, which is different from /// the weak form of the PDE. If you supply a weak form of the /// PDE, the PDE will just be solved. - void project_internal(SpaceSharedPtr space, WeakForm* proj_wf, Scalar* target_vec, + static void project_internal(SpaceSharedPtr space, WeakForm* proj_wf, Scalar* target_vec, double newton_tol = 1e-6, int newton_max_iter = 10); /// Jacobian matrix (same as stiffness matrix since projections are linear). - class ProjectionMatrixFormVol : public MatrixFormVol + class ProjectionMatrixFormVol : public MatrixFormVol < Scalar > { public: ProjectionMatrixFormVol(int i, int j, NormType norm_type) : MatrixFormVol(i, j) @@ -224,7 +221,7 @@ namespace Hermes }; /// Residual. - class ProjectionVectorFormVol : public VectorFormVol + class ProjectionVectorFormVol : public VectorFormVol < Scalar > { public: ProjectionVectorFormVol(int i, NormType norm_type) : VectorFormVol(i) @@ -289,8 +286,8 @@ namespace Hermes SolFunctionDomain result = SolFunctionDomain(0); for (int i = 0; i < n; i++) result += wt[i] * ((u_ext[this->i]->val[i] - ext[0]->val[i]) * v->val[i] - + (u_ext[this->i]->dx[i] - ext[0]->dx[i]) * v->dx[i] - + (u_ext[this->i]->dy[i] - ext[0]->dy[i]) * v->dy[i]); + + (u_ext[this->i]->dx[i] - ext[0]->dx[i]) * v->dx[i] + + (u_ext[this->i]->dy[i] - ext[0]->dy[i]) * v->dy[i]); return result; } @@ -301,7 +298,7 @@ namespace Hermes SolFunctionDomain result = SolFunctionDomain(0); for (int i = 0; i < n; i++) result += wt[i] * ((u_ext[this->i]->dx[i] - ext[0]->dx[i]) * v->dx[i] - + (u_ext[this->i]->dy[i] - ext[0]->dy[i]) * v->dy[i]); + + (u_ext[this->i]->dy[i] - ext[0]->dy[i]) * v->dy[i]); return result; } @@ -343,8 +340,6 @@ namespace Hermes return result; } }; - - int ndof; }; } } diff --git a/hermes2d/include/quadrature/limit_order.h b/hermes2d/include/quadrature/limit_order.h index 2ee78e9c98..0f5de57fcf 100644 --- a/hermes2d/include/quadrature/limit_order.h +++ b/hermes2d/include/quadrature/limit_order.h @@ -22,11 +22,11 @@ namespace Hermes namespace Hermes2D { /// can be called to set a custom order limiting table - extern HERMES_API void set_order_limit_table(int* tri_table, int* quad_table, int n); + extern HERMES_API void set_order_limit_table(int* tri_table, unsigned short* quad_table, unsigned short n); /// limit_order is used in integrals - extern HERMES_API int g_safe_max_order; - extern HERMES_API int g_max_order; + extern HERMES_API unsigned short g_safe_max_order; + extern HERMES_API unsigned short g_max_order; extern HERMES_API void update_limit_table(ElementMode2D mode); extern HERMES_API void limit_order(int& o, ElementMode2D mode); diff --git a/hermes2d/include/quadrature/quad.h b/hermes2d/include/quadrature/quad.h index af9c26e204..ffcd060b5c 100644 --- a/hermes2d/include/quadrature/quad.h +++ b/hermes2d/include/quadrature/quad.h @@ -23,20 +23,25 @@ namespace Hermes { /// Indices of values in the value returned by Quad2D::get_points(). enum GIP2DIndices { - H2D_GIP2D_X = 0, ///< X-axis coordinate. - H2D_GIP2D_Y = 1, ///< Y-axis coordinate. - H2D_GIP2D_W = 2 ///< A weight. + /// X-axis coordinate. + H2D_GIP2D_X = 0, + /// Y-axis coordinate. + H2D_GIP2D_Y = 1, + /// A weight. + H2D_GIP2D_W = 2 }; - static int H2D_GIP1D_X = 0; - static int H2D_GIP1D_W = 1; + static unsigned short H2D_GIP1D_X = 0; + static unsigned short H2D_GIP1D_W = 1; // Maximum integration order for global quadrature, for quadrilaterals. - const int g_max_quad = 24; +#define g_max_quad 24 // Maximum integration order for global quadrature, for triangles. - const int g_max_tri = 20; +#define g_max_tri 20 // Maximum number of integration points. +#define H2D_MAX_INTEGRATION_POINTS_COUNT_TRI 79 +#define H2D_MAX_INTEGRATION_POINTS_COUNT_QUAD 169 #define H2D_MAX_INTEGRATION_POINTS_COUNT 169 /// Quad1D is a base class for all 1D quadrature points. @@ -46,44 +51,47 @@ namespace Hermes public: inline double2* get_points(int order) const { return tables[order]; } - inline int get_num_points(int order) const { return np[order]; }; + inline unsigned char get_num_points(int order) const { return np[order]; }; - inline int get_max_order() const { return max_order; } + inline unsigned short get_max_order() const { return max_order; } inline double get_ref_vertex(int n) const { return ref_vert[n]; } protected: double2** tables; - int* np; + unsigned char* np; double ref_vert[H2D_NUM_MODES]; - int max_order; + unsigned short max_order; - virtual void dummy_fn() = 0; // to prevent this class from being instantiated + /// to prevent this class from being instantiated + virtual void dummy_fn() = 0; }; /// Quad2D is a base class for all 2D quadrature points on triangles and quads. /// + class HERMES_API Quad2D { public: - inline int get_num_points(int order, ElementMode2D mode) const { assert(order < num_tables[mode]); return np[mode][order]; }; + inline unsigned char get_num_points(int order, ElementMode2D mode) const { assert(order < num_tables[mode]); return np[mode][order]; }; inline double3* get_points(int order, ElementMode2D mode) const { assert(order < num_tables[mode]); return tables[mode][order]; } - inline int get_edge_points(int edge, int order, ElementMode2D mode) { assert(order < num_tables[mode]); return max_order[mode] + 1 + (3 * (1 - mode) + 4 * mode)*order + edge; } + inline unsigned short get_edge_points(int edge, unsigned short order, ElementMode2D mode) { assert(order < num_tables[mode]); return max_order[mode] + 1 + (3 * (1 - mode) + 4 * mode)*order + edge; } - inline int get_max_order(ElementMode2D mode) const { return max_order[mode]; } - inline int get_safe_max_order(ElementMode2D mode) const { return safe_max_order[mode]; } - inline int get_num_tables(ElementMode2D mode) const { return num_tables[mode]; } + inline unsigned short get_max_order(ElementMode2D mode) const { return max_order[mode]; } + inline unsigned short get_safe_max_order(ElementMode2D mode) const { return safe_max_order[mode]; } + inline unsigned short get_num_tables(ElementMode2D mode) const { return num_tables[mode]; } inline double2* get_ref_vertex(int n, ElementMode2D mode) { return &ref_vert[mode][n]; } + virtual unsigned char get_id() = 0; protected: double3*** tables; - int** np; + unsigned char** np; - int num_tables[2]; - int max_order[2], safe_max_order[2]; - int max_edge_order; + unsigned short num_tables[2]; + unsigned short max_order[2], safe_max_order[2]; + unsigned short max_edge_order; double2 ref_vert[2][H2D_MAX_NUMBER_VERTICES]; }; diff --git a/hermes2d/include/quadrature/quad_all.h b/hermes2d/include/quadrature/quad_all.h index 59b20e91e1..44a1124487 100644 --- a/hermes2d/include/quadrature/quad_all.h +++ b/hermes2d/include/quadrature/quad_all.h @@ -37,6 +37,10 @@ namespace Hermes { public: Quad2DStd(); ~Quad2DStd(); + virtual unsigned char get_id() + { + return 1; + }; virtual void dummy_fn() {} }; @@ -59,13 +63,13 @@ namespace Hermes extern double3 lin_pts_1_quad[21]; - extern int quad_indices[9][5]; + extern unsigned short quad_indices[9][5]; - extern int tri_indices[5][3]; + extern unsigned short tri_indices[5][3]; - extern int lin_np_tri[2]; - extern int lin_np_quad[2]; - extern int* lin_np[2]; + extern unsigned char lin_np_tri[2]; + extern unsigned char lin_np_quad[2]; + extern unsigned char* lin_np[2]; extern double3* lin_tables_tri[2]; extern double3* lin_tables_quad[2]; @@ -75,6 +79,10 @@ namespace Hermes { public: Quad2DLin(); + virtual unsigned char get_id() + { + return 2; + }; }; extern HERMES_API Quad2DLin g_quad_lin; diff --git a/hermes2d/include/refinement_selectors/candidates.h b/hermes2d/include/refinement_selectors/candidates.h index 0f3a174120..f3d90eee73 100644 --- a/hermes2d/include/refinement_selectors/candidates.h +++ b/hermes2d/include/refinement_selectors/candidates.h @@ -18,34 +18,27 @@ #include #include "global.h" +#include "refinement_selectors/element_to_refine.h" namespace Hermes { namespace Hermes2D { - /// Possible refinements of an element. - enum RefinementType { - H2D_REFINEMENT_P = 0, ///< P-refinement. - H2D_REFINEMENT_H = 1, ///< H-refinement. - H2D_REFINEMENT_ANISO_H = 2, ///< ANISO-refienement. The element is split along the horizontal axis. Quadrilaterals only. - H2D_REFINEMENT_ANISO_V = 3 ///< ANISO-refienement. The element is split along the vertical axis. Quadrilaterals only. - }; - /// Retuns true if a given refinement is an ANISO-refinement. /** \param[in] refin_type A refinement type. Possible values are defined in the enum RefinementType. * \return True of a given refinement is an ANISO-refinement. */ - extern HERMES_API bool is_refin_aniso(const int refin_type); + extern HERMES_API bool is_refin_aniso(const RefinementType refin_type); /// Returns a maximum number of sons that will be generated if a given refinement is applied. /** \param[in] refin_type A refinement type. Possible values are defined in the enum RefinementType. * \return A number of possible sons. In a case of P-refinement, the function returns 1 even thought this refinement yields just a change in orders. */ - extern HERMES_API int get_refin_sons(const int refin_type); + extern HERMES_API int get_refin_sons(const RefinementType refin_type); /// Returns a string representation of the refinement. /** Used for debugging and event logging purposes. * \param[in] refin_type A refinement type. Possible values are defined in the enum RefinementType. * \return A string representation of a given refinement. */ - extern HERMES_API const std::string get_refin_str(const int refin_type); + extern HERMES_API const std::string get_refin_str(const RefinementType refin_type); namespace RefinementSelectors { @@ -84,20 +77,26 @@ namespace Hermes extern HERMES_API bool is_p_aniso(const CandList cand_list); /// A candidate. - class HERMES_API Cand + class HERMES_API Cand { public: - double error; ///< Error of this candidate's sons. - double errors[H2D_MAX_ELEMENT_SONS]; ///< Error of this candidate's sons. - int dofs; ///< An estimated number of DOFs. - int split; ///< A refinement, see the enum RefinementType. - int p[H2D_MAX_ELEMENT_SONS]; ///< Encoded orders of sons, see ::H2D_MAKE_QUAD_ORDER. In a case of a triangle, the vertical order is equal to the horizontal one. - double score; ///< A score of a candidate: the higher the better. If zero, the score is not valid and a candidate should be ignored. Evaluated in OptimumSelector::select_best_candidate. + /// Error of this candidate's sons. + double error; + /// Error of this candidate's sons. + double errors[H2D_MAX_ELEMENT_SONS]; + /// An estimated number of DOFs. + unsigned short dofs; + /// A refinement, see the enum RefinementType. + RefinementType split; + /// Encoded orders of sons, see ::H2D_MAKE_QUAD_ORDER. In a case of a triangle, the vertical order is equal to the horizontal one. + unsigned short p[H2D_MAX_ELEMENT_SONS]; + /// A score of a candidate: the higher the better. If zero, the score is not valid and a candidate should be ignored. Evaluated in OptimumSelector::select_best_candidate. + double score; /// Constructor. /** \param[in] split A refinement, see the enum RefinementTypes. * \param[in] order_elems Encoded orders for all element of candidate. If triangle, a vertical order has to be equal to the horizontal one. Unused elements of the array can be ignored. */ - Cand(const int split, const int order_elems[H2D_MAX_ELEMENT_SONS]); + Cand(const RefinementType split, const unsigned short order_elems[H2D_MAX_ELEMENT_SONS]); /// Constructor. /** \param[in] split A refinement, see the enum RefinementTypes. @@ -105,11 +104,11 @@ namespace Hermes * \param[in] order_elem1 Encoded order of the second element of the candidate, if any. If triangle, a vertical order has to be equal to the horizontal one. * \param[in] order_elem2 Encoded order of the third element of the candidate, if any. If triangle, a vertical order has to be equal to the horizontal one. * \param[in] order_elem3 Encoded order of the fourth element of the candidate, if any. If triangle, a vertical order has to be equal to the horizontal one. */ - Cand(const int split, const int order_elem0, const int order_elem1 = 0, const int order_elem2 = 0, const int order_elem3 = 0); + Cand(const RefinementType split, const unsigned short order_elem0, const unsigned short order_elem1 = 0, const unsigned short order_elem2 = 0, const unsigned short order_elem3 = 0); /// Returns a number of elements of a candidate. /** \return A number of elements of a candidate. */ - int get_num_elems() const; + unsigned char get_num_elems() const; }; } } diff --git a/hermes2d/include/refinement_selectors/element_to_refine.h b/hermes2d/include/refinement_selectors/element_to_refine.h index 41ff12cbfc..e3acb7c71f 100644 --- a/hermes2d/include/refinement_selectors/element_to_refine.h +++ b/hermes2d/include/refinement_selectors/element_to_refine.h @@ -22,11 +22,16 @@ namespace Hermes { namespace Hermes2D { - namespace RefinementSelectors{ - template class Selector; - template class HOnlySelector; - template class POnlySelector; - template class OptimumSelector; + /// Possible refinements of an element. + enum RefinementType { + /// P-refinement. + H2D_REFINEMENT_P = 0, + /// H-refinement. + H2D_REFINEMENT_H = 1, + /// ANISO-refienement. The element is split along the horizontal axis. Quadrilaterals only. + H2D_REFINEMENT_H_ANISO_H = 2, + /// ANISO-refienement. The element is split along the vertical axis. Quadrilaterals only. + H2D_REFINEMENT_H_ANISO_V = 3 }; /// A refinement record. \ingroup g_adapt @@ -40,44 +45,45 @@ namespace Hermes /// Constructor. /** \param[in] id An ID of the element. * \param[in] comp An index of a component. */ - ElementToRefine(int id, int comp); - - /// Copy-contructor. - ElementToRefine(const ElementToRefine &orig); + ElementToRefine(int id, unsigned short comp, bool space_only = false); /// Assignment operator. ElementToRefine& operator=(const ElementToRefine& orig); - + + /// Validity info. + bool valid; + /// For refinement of Space only for the case when mesh is shared. + bool space_only; + /// An ID of the element. int id; /// An index of the component. - int comp; + unsigned short comp; /// Proposed refinement. Possible values are defined in the enum ::RefinementType. - int split; + RefinementType split; /// Encoded orders of sons. - int refinement_polynomial_order[H2D_MAX_ELEMENT_SONS]; + unsigned short refinement_polynomial_order[H2D_MAX_ELEMENT_SONS]; /// Encoded orders of the best refinement of a certaint type. /// Indexed by enum RefinementType. - int best_refinement_polynomial_order_type[4][H2D_MAX_ELEMENT_SONS]; + unsigned short best_refinement_polynomial_order_type[4][H2D_MAX_ELEMENT_SONS]; /// Error of the selected candidate. double errors[H2D_MAX_ELEMENT_SONS]; /// Returns a number of sons. /** \return A number of sons of a given refinement. */ - int get_num_sons() const; + unsigned short get_num_sons() const; /// Copies array of orders. /** The length of the array is defubed by ::H2D_MAX_ELEMENT_SONS. * \param[in] dest A destination array. * \param[in] src A source arrapy. */ - static void copy_orders(int* dest, const int* src); + static void copy_orders(unsigned short* dest, const unsigned short* src); static void copy_errors(double* dest, const double* src); + private: + /// This array is internal. + bool refinement_polynomial_order_changed[H2D_MAX_ELEMENT_SONS]; template friend class Adapt; - template friend class ErrorCalculator; - template friend class RefinementSelectors::Selector; - template friend class RefinementSelectors::HOnlySelector; - template friend class RefinementSelectors::POnlySelector; - template friend class RefinementSelectors::OptimumSelector; + template friend class AdaptSolver; }; } } diff --git a/hermes2d/include/refinement_selectors/h1_proj_based_selector.h b/hermes2d/include/refinement_selectors/h1_proj_based_selector.h index 8428c2a1a2..cf67e95a03 100644 --- a/hermes2d/include/refinement_selectors/h1_proj_based_selector.h +++ b/hermes2d/include/refinement_selectors/h1_proj_based_selector.h @@ -30,14 +30,14 @@ namespace Hermes * it is suggested to create the instance outside the adaptivity * loop. */ template - class HERMES_API H1ProjBasedSelector : public ProjBasedSelector { + class HERMES_API H1ProjBasedSelector : public ProjBasedSelector < Scalar > { public: //API /// Constructor. /** \param[in] cand_list A predefined list of candidates. * \param[in] max_order A maximum order which considered. If ::H2DRS_DEFAULT_ORDER, a maximum order supported by the selector is used, see HcurlProjBasedSelector::H2DRS_MAX_H1_ORDER. * \param[in] user_shapeset A shapeset. If nullptr, it will use internal instance of the class H1Shapeset. */ H1ProjBasedSelector(CandList cand_list = H2D_HP_ANISO, int max_order = H2DRS_DEFAULT_ORDER, H1Shapeset* user_shapeset = nullptr); - + /// Destructor. ~H1ProjBasedSelector(); @@ -65,11 +65,11 @@ namespace Hermes /// Calculates values of shape function at GIP for all transformations. /** Overriden function. For details, see ProjBasedSelector::precalc_shapes(). */ - virtual void precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); + virtual void precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); /// Calculates values of orthogonalized shape function at GIP for all transformations. /** Overriden function. For details, see ProjBasedSelector::precalc_ortho_shapes(). */ - virtual void precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); + virtual void precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); /// Builds projection matrix using a given set of shapes. /** Overriden function. For details, see ProjBasedSelector::build_projection_matrix(). */ diff --git a/hermes2d/include/refinement_selectors/hcurl_proj_based_selector.h b/hermes2d/include/refinement_selectors/hcurl_proj_based_selector.h index dee9949c29..1293a0c5d4 100644 --- a/hermes2d/include/refinement_selectors/hcurl_proj_based_selector.h +++ b/hermes2d/include/refinement_selectors/hcurl_proj_based_selector.h @@ -29,7 +29,7 @@ namespace Hermes * it is suggested to create the instance outside the adaptivity * loop. */ template - class HERMES_API HcurlProjBasedSelector : public ProjBasedSelector { + class HERMES_API HcurlProjBasedSelector : public ProjBasedSelector < Scalar > { public: //API /// Constructor. /** \param[in] cand_list A predefined list of candidates. @@ -49,9 +49,11 @@ namespace Hermes H2D_HCFE_NUM = 3 ///< A total considered function expansion. }; - Scalar* precalc_rvals[H2D_MAX_ELEMENT_SONS][H2D_HCFE_NUM]; ///< Array of arrays of precalculates. The first index is an index of a subdomain, the second index is an index of a function expansion (see enum LocalFuncExpansion). + /// Array of arrays of precalculates. The first index is an index of a subdomain, the second index is an index of a function expansion (see enum LocalFuncExpansion). + Scalar* precalc_rvals[H2D_MAX_ELEMENT_SONS][H2D_HCFE_NUM]; - static const int H2DRS_MAX_HCURL_ORDER; ///< A maximum used order in this Hcurl-space selector. \todo Replace the numerical constant after a symbolic constant is added to Hcurl shapeset which would declare the maximum supported order. + /// A maximum used order in this Hcurl-space selector. \todo Replace the numerical constant after a symbolic constant is added to Hcurl shapeset which would declare the maximum supported order. + static const int H2DRS_MAX_HCURL_ORDER; /// Sets OptimumSelector::current_max_order and OptimumSelector::current_min_order. /** The default order range is[1, ::H2DRS_MAX_HCURL_ORDER]. If curved, the upper boundary of the range becomes lower. @@ -67,11 +69,11 @@ namespace Hermes /// Calculates values of shape function at GIP for all transformations. /** Overriden function. For details, see ProjBasedSelector::precalc_shapes(). */ - virtual void precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); + virtual void precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); /// Calculates values of orthogonalized shape function at GIP for all transformations. /** Overriden function. For details, see ProjBasedSelector::precalc_ortho_shapes(). */ - virtual void precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); + virtual void precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); /// Builds projection matrix using a given set of shapes. /** Overriden function. For details, see ProjBasedSelector::build_projection_matrix(). */ @@ -84,8 +86,8 @@ namespace Hermes /// Evaluates an squared error of a projection of an element of a candidate onto subdomains. /** Overriden function. For details, see ProjBasedSelector::evaluate_error_squared_subdomain(). */ virtual double evaluate_error_squared_subdomain(Element* sub_elem, const typename ProjBasedSelector::ElemGIP& sub_gip, int son, const typename ProjBasedSelector::ElemSubTrf& sub_trf, const typename ProjBasedSelector::ElemProj& elem_proj, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]); - - friend class ProjBasedSelector; + + friend class ProjBasedSelector < Scalar > ; }; } } diff --git a/hermes2d/include/refinement_selectors/l2_proj_based_selector.h b/hermes2d/include/refinement_selectors/l2_proj_based_selector.h index af10aff948..d070aa2d65 100644 --- a/hermes2d/include/refinement_selectors/l2_proj_based_selector.h +++ b/hermes2d/include/refinement_selectors/l2_proj_based_selector.h @@ -29,7 +29,7 @@ namespace Hermes * it is suggested to create the instance outside the adaptivity * loop. */ template - class HERMES_API L2ProjBasedSelector : public ProjBasedSelector { + class HERMES_API L2ProjBasedSelector : public ProjBasedSelector < Scalar > { public: //API /// Constructor. /** \param[in] cand_list A predefined list of candidates. @@ -62,11 +62,11 @@ namespace Hermes /// Calculates values of shape function at GIP for all transformations. /** Overriden function. For details, see ProjBasedSelector::precalc_shapes(). */ - virtual void precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); + virtual void precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); /// Calculates values of orthogonalized shape function at GIP for all transformations. /** Overriden function. For details, see ProjBasedSelector::precalc_ortho_shapes(). */ - virtual void precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); + virtual void precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode); /// Builds projection matrix using a given set of shapes. /** Overriden function. For details, see ProjBasedSelector::build_projection_matrix(). */ @@ -79,7 +79,7 @@ namespace Hermes /// Evaluates an squared error of a projection of an element of a candidate onto subdomains. /** Overriden function. For details, see ProjBasedSelector::evaluate_error_squared_subdomain(). */ virtual double evaluate_error_squared_subdomain(Element* sub_elem, const typename ProjBasedSelector::ElemGIP& sub_gip, int son, const typename ProjBasedSelector::ElemSubTrf& sub_trf, const typename ProjBasedSelector::ElemProj& elem_proj, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]); - + /// If the shapeset is not from the user, we shall delete it in the destructor. bool user_shapeset; }; diff --git a/hermes2d/include/refinement_selectors/optimum_selector.h b/hermes2d/include/refinement_selectors/optimum_selector.h index c16fbdb295..1338b794bf 100644 --- a/hermes2d/include/refinement_selectors/optimum_selector.h +++ b/hermes2d/include/refinement_selectors/optimum_selector.h @@ -31,7 +31,7 @@ namespace Hermes /** This is a base class for all selectors that chooses an candidate based on some * evaluated criteria. Currently, the criteria is based on an error change per DOF. */ template - class HERMES_API OptimumSelector : public Selector + class HERMES_API OptimumSelector : public Selector < Scalar > { public: /// Destructor. @@ -54,9 +54,12 @@ namespace Hermes /// Information about candidates. struct CandsInfo { - bool uniform_orders; ///< True if all elements of all examined candidates have uniform orders. - int min_quad_order; ///< Minimum quad order of all elements of all examined candidates. - int max_quad_order; ///< Maximum quad order of all elements of all examined candidates. If less than zero, no candidate is generated. + /// True if all elements of all examined candidates have uniform orders. + bool uniform_orders; + /// Minimum quad order of all elements of all examined candidates. + int min_quad_order; + /// Maximum quad order of all elements of all examined candidates. If less than zero, no candidate is generated. + int max_quad_order; /// Default constructor. Creates info that declares no candidates and uniform orders. CandsInfo() : uniform_orders(true), min_quad_order(-1), max_quad_order(-1) {}; @@ -66,13 +69,14 @@ namespace Hermes bool is_empty() const { return (min_quad_order < 0 || max_quad_order < 0); }; }; - CandList cand_list; ///< Allowed candidate types. + /// Allowed candidate types. + CandList cand_list; /// Updates information about candidates. Initial information is provided. /** \param[in,out] info_h Information about all H-candidates. * \param[in,out] info_p Information about all P-candidates. * \param[in,out] info_aniso Information about all ANISO-candidates. */ - void update_cands_info(Hermes::vector& candidates, CandsInfo& info_h, CandsInfo& info_p, CandsInfo& info_aniso) const; + void update_cands_info(std::vector& candidates, CandsInfo& info_h, CandsInfo& info_p, CandsInfo& info_aniso) const; /// Appends cancidates of a given refinement and a given range of orders. /** If either borders or a ranges is invalid (i.e. smaller than zero) @@ -81,7 +85,7 @@ namespace Hermes * \param[in] last_order The upper boundery of a range in a form of an encoded order. * \param[in] split A refinement, see the enum RefinementTypes. * \param[in] iso_p True if both orders (horizontal and vertical) should be modified uniformly. Used in a case of a triangle. */ - void append_candidates_split(Hermes::vector& candidates, const int start_quad_order, const int last_order, const int split, bool iso_p); + void append_candidates_split(std::vector& candidates, const int start_quad_order, const int last_order, const RefinementType split, bool iso_p); /// Fill a list of candidates. /** Override to generate or adjust generated candidates. The method has to initialize the array OptimumSelector::candidates. @@ -92,15 +96,15 @@ namespace Hermes * \param[in] max_ha_quad_order A maximum encoded order of an element of a H-candidate or an ANISO-candidate. In the case of ANIO-candidates, the maximum is applied only to modified orders. * \param[in] max_p_quad_order A maximum encoded order of an element of a P-candidate. * \return A vector of candidates. The first candidate has to be equal to the original element with a refinement ::H2D_REFINEMENT_P. - */ - virtual Hermes::vector create_candidates(Element* e, int quad_order); + */ + virtual std::vector create_candidates(Element* e, int quad_order); /// Calculates error, dofs, and score of candidates. /** \param[in] e An element that is being refined. * \param[in] rsln A reference solution which is used to calculate the error. * \param[out] avg_error An average of \f$\log_{10} e\f$ where \f$e\f$ is an error of a candidate. It cannot be nullptr. * \param[out] dev_error A deviation of \f$\log_{10} e\f$ where \f$e\f$ is an error of a candidate. It cannot be nullptr. */ - void evaluate_candidates(Hermes::vector& candidates, Element* e, MeshFunction* rsln); + void evaluate_candidates(std::vector& candidates, Element* e, MeshFunction* rsln); /// Sorts and selects the best candidate and the best H-candidate according to the score. /** Any two candidates with the same score are skipped since it is not possible to decide between them. @@ -117,21 +121,21 @@ namespace Hermes * 0 - overall * 1 - 4 : indexed by enum RefinementType. */ - virtual void select_best_candidate(Hermes::vector& candidates, Element* e, Cand*& best_candidate, Cand* best_candidates_specific_type[4]); + virtual void select_best_candidate(std::vector& candidates, Element* e, Cand*& best_candidate, Cand* best_candidates_specific_type[4]); /// Calculates error of candidates. /** This method has to be implemented in inherited classes. * \param[in] e An element that is being refined. * \param[in] rsln A reference solution which is used to calculate the error. */ - virtual void evaluate_cands_error(Hermes::vector& candidates, Element* e, MeshFunction* rsln) = 0; + virtual void evaluate_cands_error(std::vector& candidates, Element* e, MeshFunction* rsln) = 0; /// Calculates DOF of candidates. /** It uses a list of shape indices (OptimumSelector::shape_indices) to * count a number of DOFs. No number of DOFs cannot be zero. * \param[in] e An element that is being refined. * \param[in] rsln A reference solution which is used to calculate the error. */ - virtual void evaluate_cands_dof(Hermes::vector& candidates, Element* e, MeshFunction* rsln); + virtual void evaluate_cands_dof(std::vector& candidates, Element* e, MeshFunction* rsln); /// Evalutes score of candidates. /** It calculates score \f$s\f$ of a candidate as \f[s = \frac{\log_{10} e_0 - \log_{10} e}{(d - d_0)^c},\f] @@ -142,7 +146,7 @@ namespace Hermes * * If overridden, the higher score the better candidate. * \param[in] e An element that is being refined. */ - virtual void evaluate_cands_score(Hermes::vector& candidates, Element* e); + virtual void evaluate_cands_score(std::vector& candidates, Element* e); /// Number of shape functions for /// - mode @@ -150,7 +154,7 @@ namespace Hermes /// - vertical order + 1 (any) /// - shape function type int ****num_shapes; - + /// Compares scores. Used to sort scores ascending. /** \param[in] a The first candidate. * \param[in] b The second candidate. @@ -186,10 +190,14 @@ namespace Hermes /// A shape index. /** Any element order higher than both the vertical and the horizontal direction will use a given shape function. */ struct ShapeInx { - int order_h; ///< A minimal horizonal order of an element that can use this shape function. - int order_v; ///< A minimal vertical order of an element that can use this shape function. - int inx; ///< An index of the shape function. - ShapeType type; ///< A type of the shape function. It is used to calculate DOF in Optimum::evaluate_cands_dof(). + /// A minimal horizonal order of an element that can use this shape function. + int order_h; + /// A minimal vertical order of an element that can use this shape function. + int order_v; + /// An index of the shape function. + int inx; + /// A type of the shape function. It is used to calculate DOF in Optimum::evaluate_cands_dof(). + ShapeType type; /// Constructor. /** \param[in] order_h A minimal horizonal order of an element that can use this shape function. @@ -199,14 +207,21 @@ namespace Hermes ShapeInx(int order_h, int order_v, int inx, ShapeType type) : order_h(order_h), order_v(order_v), inx(inx), type(type) {}; }; - Shapeset *shapeset; ///< A shapeset used to calculate error. + /// A shapeset used to calculate error. + Shapeset *shapeset; - Hermes::vector shape_indices[H2D_NUM_MODES]; ///< Shape indices. The first index is a mode (ElementMode2D). - int max_shape_inx[H2D_NUM_MODES]; ///< A maximum index of a shape function. The first index is a mode (ElementMode2D). - int next_order_shape[H2D_NUM_MODES][H2DRS_MAX_ORDER+1]; ///< An index to the array OptimumSelector::shape_indices of a shape function of the next uniform order. The first index is a mode (ElementMode2D), the second index is an order. - bool has_vertex_shape[H2D_NUM_MODES]; ///< True if the shapeset OptimumSelector::shapeset contains vertex functions. The index is a mode (ElementMode2D). - bool has_edge_shape[H2D_NUM_MODES]; ///< True if the shapeset OptimumSelector::shapeset contains edge functions. The index is a mode (ElementMode2D). - bool has_bubble_shape[H2D_NUM_MODES]; ///< True if the shapeset OptimumSelector::shapeset contains bubble functions. The index is a mode (ElementMode2D). + /// Shape indices. The first index is a mode (ElementMode2D). + std::vector shape_indices[H2D_NUM_MODES]; + /// A maximum index of a shape function. The first index is a mode (ElementMode2D). + int max_shape_inx[H2D_NUM_MODES]; + /// An index to the array OptimumSelector::shape_indices of a shape function of the next uniform order. The first index is a mode (ElementMode2D), the second index is an order. + int next_order_shape[H2D_NUM_MODES][H2DRS_MAX_ORDER + 1]; + /// True if the shapeset OptimumSelector::shapeset contains vertex functions. The index is a mode (ElementMode2D). + bool has_vertex_shape[H2D_NUM_MODES]; + /// True if the shapeset OptimumSelector::shapeset contains edge functions. The index is a mode (ElementMode2D). + bool has_edge_shape[H2D_NUM_MODES]; + /// True if the shapeset OptimumSelector::shapeset contains bubble functions. The index is a mode (ElementMode2D). + bool has_bubble_shape[H2D_NUM_MODES]; /// Adds an index (or indices) of a bubble function of a given order if the shape index was not used yet. /** This function adds indices of bubble functions that were not added yet on a quadrilateral. @@ -218,7 +233,7 @@ namespace Hermes * \param[in] order_v A vertical order of an element. * \param[in,out] used_shape_index A vector of used shape indices. If a shape index is present in the map, a shape was already added and it will not be added again. * \param[in,out] indices A vector of shape indices. The vector is updated by the function. */ - void add_bubble_shape_index(int order_h, int order_v, std::map& used_shape_index, Hermes::vector& indices, ElementMode2D mode); + void add_bubble_shape_index(int order_h, int order_v, std::map& used_shape_index, std::vector& indices, ElementMode2D mode); /// Builds shape index table OptimumSelector::shape_indices. /** The method fills the array OptimumSelector::shape_indices for a given mode. @@ -238,7 +253,8 @@ namespace Hermes /// Selects a refinement. /** Overriden function. For details, see Selector::select_refinement(). */ - virtual bool select_refinement(Element* element, int quad_order, MeshFunction* rsln, ElementToRefine& refinement); ///< Selects refinement. + /// Selects refinement. + virtual bool select_refinement(Element* element, int quad_order, MeshFunction* rsln, ElementToRefine& refinement); /// Score DOF exponent. Used in evaluate_cands_score. double dof_score_exponent; diff --git a/hermes2d/include/refinement_selectors/order_permutator.h b/hermes2d/include/refinement_selectors/order_permutator.h index 9179da80de..482b26c5c1 100644 --- a/hermes2d/include/refinement_selectors/order_permutator.h +++ b/hermes2d/include/refinement_selectors/order_permutator.h @@ -37,14 +37,22 @@ namespace Hermes class HERMES_API OrderPermutator { protected: - int order_h; ///< The current horizontal order. - int order_v; ///< The current verical order. - int start_order_h; ///< The starting horizontal order. - int start_order_v; ///< The starting vertical order. - int end_order_h; ///< The ending horizontal order. - int end_order_v; ///< The ending vertical order. - bool iso_p; ///< True if orders is incresed in both the horizontal order and the vertical order are increased simultaneously. - int* tgt_quad_order; ///< A pointer to which a current order is stored in encoded form. Ignored if nullptr. + /// The current horizontal order. + unsigned short order_h; + /// The current verical order. + unsigned short order_v; + /// The starting horizontal order. + unsigned short start_order_h; + /// The starting vertical order. + unsigned short start_order_v; + /// The ending horizontal order. + unsigned short end_order_h; + /// The ending vertical order. + unsigned short end_order_v; + /// True if orders is incresed in both the horizontal order and the vertical order are increased simultaneously. + bool iso_p; + /// A pointer to which a current order is stored in encoded form. Ignored if nullptr. + unsigned short* tgt_quad_order; public: /// Constructor. @@ -52,7 +60,7 @@ namespace Hermes * \param[in] end_quad_order The ending order in an encoded form. * \param[in] iso_p True if both orders (i.e. horizontal and vertical) should be increased simultaneously. * \param[in] tgt_quad_order A point to a location to which a current orders (i.e. horizontal and vertical) are stored in an encoded form. Ignored if nullptr. */ - OrderPermutator (int start_quad_order = 0, int end_quad_order = 0, bool iso_p = false, int* tgt_quad_order = nullptr); + OrderPermutator(unsigned short start_quad_order = 0, unsigned short end_quad_order = 0, bool iso_p = false, unsigned short* tgt_quad_order = nullptr); /// Moves to the next permutation of orders. /** \return True if there is a next permutation of orders. */ @@ -63,23 +71,23 @@ namespace Hermes /// Returns the current horizontal order. /** \return The current horizontal order. */ - int get_order_h() const; + unsigned short get_order_h() const; /// Returns the current vertical order. /** \return The current vertical order. */ - int get_order_v() const; + unsigned short get_order_v() const; /// Returns the current order in an encoded form. /** \return The current order in an encoded form. */ - int get_quad_order() const; + unsigned short get_quad_order() const; /// Returns the starting order in an encoded form. /** \return The starting order in an encoded form. */ - int get_start_quad_order() const; + unsigned short get_start_quad_order() const; /// Returns the ending order in an encoded form. /** \return The ending order in an encoded form. */ - int get_end_quad_order() const; + unsigned short get_end_quad_order() const; }; } } diff --git a/hermes2d/include/refinement_selectors/proj_based_selector.h b/hermes2d/include/refinement_selectors/proj_based_selector.h index e4a9619b10..6ee369c51b 100644 --- a/hermes2d/include/refinement_selectors/proj_based_selector.h +++ b/hermes2d/include/refinement_selectors/proj_based_selector.h @@ -45,7 +45,7 @@ namespace Hermes * - evaluate_error_squared_subdomain() */ template - class HERMES_API ProjBasedSelector : public OptimumSelector { + class HERMES_API ProjBasedSelector : public OptimumSelector < Scalar > { protected: class TrfShapeExp; @@ -67,11 +67,14 @@ namespace Hermes double get_error_weight_aniso() const; /// Evaluated shapes for all possible transformations for all points. The first index is a transformation, the second index is an index of a shape function. - typedef Hermes::vector TrfShape[H2D_TRF_NUM]; + typedef std::vector TrfShape[H2D_TRF_NUM]; - bool* cached_shape_vals_valid; ///< True if shape values were already initialized. - TrfShape* cached_shape_ortho_vals; ///< Precalculated valus of orthogonalized shape functions. - TrfShape* cached_shape_vals; ///< Precalculate values of shape functions. + /// True if shape values were already initialized. + bool* cached_shape_vals_valid; + /// Precalculated valus of orthogonalized shape functions. + TrfShape* cached_shape_ortho_vals; + /// Precalculate values of shape functions. + TrfShape* cached_shape_vals; protected: //evaluated shape basis /// A transform shaped function expansions. @@ -103,9 +106,12 @@ namespace Hermes return *this; } private: - int num_gip; ///< A number of integration points. - int num_expansion; ///< A number of expansions. - double** values; ///< Values. The first index is index of a functions expansion, the second index is an index of a an integration point. + /// A number of integration points. + int num_gip; + /// A number of expansions. + int num_expansion; + /// Values. The first index is index of a functions expansion, the second index is an index of a an integration point. + double** values; /// Allocates a space for function expansions. /** \param[in] num_expansion A number of expansions. @@ -143,7 +149,7 @@ namespace Hermes * used transformation including the identity to the a size defined by \a max_shape_inx. The system will assume that shape functions * are precalculated if the array corresponding to the identity function is not empty. */ - virtual void precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, TrfShape& svals, ElementMode2D mode) {}; + virtual void precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, TrfShape& svals, ElementMode2D mode) {}; /// Calculates values of orthogonalized shape function at GIP for all transformations. /** Override this method to supply a pre-calculated vales of orthonormalized shape function expansions @@ -163,7 +169,7 @@ namespace Hermes * used transformation including the identity to the a size defined by \a max_shape_inx. The system will assume that shape functions * are precalculated if the array corresponding to the identity function is not empty. */ - virtual void precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, TrfShape& ortho_svals, ElementMode2D mode) {}; + virtual void precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, TrfShape& ortho_svals, ElementMode2D mode) {}; protected: /// Constructor. @@ -184,9 +190,12 @@ namespace Hermes bool warn_uniform_orders; protected: //error evaluation - static const int H2DRS_VALCACHE_INVALID = 0; ///< State of value cache: item contains undefined or invalid value. \ingroup g_selectors - static const int H2DRS_VALCACHE_VALID = 1; ///< State of value cache: item contains a valid value. \ingroup g_selectors - static const int H2DRS_VALCACHE_USER = 2; ///< State of value cache: the first state ID which can be used by the user. \ingroup g_selectors + /// State of value cache: item contains undefined or invalid value. \ingroup g_selectors + static const int H2DRS_VALCACHE_INVALID = 0; + /// State of value cache: item contains a valid value. \ingroup g_selectors + static const int H2DRS_VALCACHE_VALID = 1; + /// State of value cache: the first state ID which can be used by the user. \ingroup g_selectors + static const int H2DRS_VALCACHE_USER = 2; /// An item of a value cache. template @@ -211,10 +220,13 @@ namespace Hermes /** By default, the item is set as invalid. * \param value A starting value. * \param state A state of the value. */ - ValueCacheItem(const T& value = 0, const int state = H2DRS_VALCACHE_INVALID) : value(value), state(state) {}; ///< Default constructor. By default, it creates an item that contains invalid value. + /// Default constructor. By default, it creates an item that contains invalid value. + ValueCacheItem(const T& value = 0, const int state = H2DRS_VALCACHE_INVALID) : value(value), state(state) {}; private: - T value; ///< A value stored in the item. - int state; ///< A state of the image: ::H2DRS_VALCACHE_INVALID or ::H2DRS_VALCACHE_VALID or any other user-defined value. The first user defined state has to have number ::H2DRS_VALCACHE_USER. + /// A value stored in the item. + T value; + /// A state of the image: ::H2DRS_VALCACHE_INVALID or ::H2DRS_VALCACHE_VALID or any other user-defined value. The first user defined state has to have number ::H2DRS_VALCACHE_USER. + int state; }; /// A projection matrix cache type. /** Defines a cache of projection matrices for all possible permutations of orders. */ @@ -228,13 +240,16 @@ namespace Hermes * If record is nullptr, the corresponding matrix has to be calculated. */ ProjMatrixCache proj_matrix_cache[H2D_NUM_MODES]; - double error_weight_h; ///< A coefficient that multiplies error of H-candidate. The default value is ::H2DRS_DEFAULT_ERR_WEIGHT_H. - double error_weight_p; ///< A coefficient that multiplies error of P-candidate. The default value is ::H2DRS_DEFAULT_ERR_WEIGHT_P. - double error_weight_aniso; ///< A coefficient that multiplies error of ANISO-candidate. The default value is ::H2DRS_DEFAULT_ERR_WEIGHT_ANISO. + /// A coefficient that multiplies error of H-candidate. The default value is ::H2DRS_DEFAULT_ERR_WEIGHT_H. + double error_weight_h; + /// A coefficient that multiplies error of P-candidate. The default value is ::H2DRS_DEFAULT_ERR_WEIGHT_P. + double error_weight_p; + /// A coefficient that multiplies error of ANISO-candidate. The default value is ::H2DRS_DEFAULT_ERR_WEIGHT_ANISO. + double error_weight_aniso; /// Calculates error of candidates. /** Overriden function. For details, see OptimumSelector::evaluate_cands_error(). */ - virtual void evaluate_cands_error(Hermes::vector& candidates, Element* e, MeshFunction* rsln); + virtual void evaluate_cands_error(std::vector& candidates, Element* e, MeshFunction* rsln); /// Calculates projection errors of an elements of candidates for all permutations of orders. /** Errors are not normalized and they are squared. @@ -267,36 +282,48 @@ namespace Hermes * \param[in] sub_ortho_svals * \param[in] info Information about candidates: range of orders, etc. * \param[out] errors_squared Calculated squared errors for all orders specified through \a info. */ - void calc_error_cand_element(const ElementMode2D mode, double3* gip_points, int num_gip_points, const int num_sub, Element** sub_domains, Trf** sub_trfs, int* sons, Hermes::vector** sub_nonortho_svals, Hermes::vector** sub_ortho_svals, const typename OptimumSelector::CandsInfo& info, CandElemProjError errors_squared, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]); + void calc_error_cand_element(const ElementMode2D mode, double3* gip_points, int num_gip_points, const int num_sub, Element** sub_domains, Trf** sub_trfs, int* sons, std::vector** sub_nonortho_svals, std::vector** sub_ortho_svals, const typename OptimumSelector::CandsInfo& info, CandElemProjError errors_squared, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]); protected: //projection /// Projection of an element of a candidate. struct ElemProj { - int* shape_inxs; ///< Used shape indices - int num_shapes; ///< A number of used shape indices. - Hermes::vector& svals; ///< A precalculated shape-function values. Empty is not defined. - Scalar* shape_coeffs; ///< Coefficients of shape indices of a projection. - int max_quad_order; ///< An encoded maximum order of the projection. If triangle, the vertical order is equal to the horizontal order. + /// Used shape indices + int* shape_inxs; + /// A number of used shape indices. + int num_shapes; + /// A precalculated shape-function values. Empty is not defined. + std::vector& svals; + /// Coefficients of shape indices of a projection. + Scalar* shape_coeffs; + /// An encoded maximum order of the projection. If triangle, the vertical order is equal to the horizontal order. + int max_quad_order; }; /// Integration points in the reference domain of an element of a candidate. /** The structure assumes Gauss Integration Points (GIP). */ struct ElemGIP { - double3* gip_points; ///< Integration points and weights. The first index is an index of an integration point, the second index is defined through the enum GIP2DIndices. - int num_gip_points; ///< A number of integration points. + /// Integration points and weights. The first index is an index of an integration point, the second index is defined through the enum GIP2DIndices. + double3* gip_points; + /// A number of integration points. + int num_gip_points; }; /// A transformation from a reference domain of a subdomain to a reference domain of an element of a candidate. struct ElemSubTrf { - Trf* trf; ///< A transformation. - double coef_mx; ///< A coefficient that scales df/dx for each subdomain. A coefficient represents effects of a transformation \a trf on df/dx. - double coef_my; ///< A coefficient that scales df/dy for each subdomain. A coefficient represents effects of a transformation \a trf on df/dy. + /// A transformation. + Trf* trf; + /// A coefficient that scales df/dx for each subdomain. A coefficient represents effects of a transformation \a trf on df/dx. + double coef_mx; + /// A coefficient that scales df/dy for each subdomain. A coefficient represents effects of a transformation \a trf on df/dy. + double coef_my; }; /// A shape function on subdomain of an element. struct ElemSubShapeFunc { - int inx; ///< An index of a shape function. - TrfShapeExp& svals; ///< Evaluate values of a shape function. If TrfShapeExp::empty(), no precalculated values are available. + /// An index of a shape function. + int inx; + /// Evaluate values of a shape function. If TrfShapeExp::empty(), no precalculated values are available. + TrfShapeExp& svals; }; /// Returns an array of values of the reference solution at integration points. @@ -313,7 +340,7 @@ namespace Hermes * \param[in] intr_gip_order An order of quadrature integration. The number of quadrature points should be retrieved through a quadrature stored in the paremeter \a rsln. * \return A pointer to 2D array. The first index is an index of the function expansion (f, df/dx, ...), the second index is an index of the integration point. */ virtual void precalc_ref_solution(int inx_son, MeshFunction* rsln, Element* element, int intr_gip_order, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]) = 0; - + /// Frees the data allocated in precalc_ref_solution. virtual void free_ref_solution_data(int inx_son, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]) = 0; diff --git a/hermes2d/include/refinement_selectors/selector.h b/hermes2d/include/refinement_selectors/selector.h index 67a6c9b496..d85fe66379 100644 --- a/hermes2d/include/refinement_selectors/selector.h +++ b/hermes2d/include/refinement_selectors/selector.h @@ -49,7 +49,8 @@ namespace Hermes namespace Hermes2D { /// Namespace which encapsulates all refinement selectors. \ingroup g_selectors - namespace RefinementSelectors { + namespace RefinementSelectors + { /// A parent of all refinement selectors. Abstract class. \ingroup g_selectors /** All refinement selectors have to derive from this class or its children. * The interface of the class provides methods for: @@ -60,18 +61,20 @@ namespace Hermes { public: virtual ~Selector() {}; - /// Selects a refinement. - /** This methods has to be implemented. - * \param[in] element An element which is being refined. - * \param[in] quad_order An encoded order of the element. - * \param[in] rsln A reference solution which is used to select a refinement. - * \param[out] refinement A selected refinement. It contains a valid contents if and only if the method returns true. - * \return True if a refinement was proposed. False if the selector is unable to select a refinement or it suggest that the element should not be refined. */ - virtual bool select_refinement(Element* element, int quad_order, MeshFunction* rsln, ElementToRefine& refinement) = 0; - + /// Selects a refinement. + /** This methods has to be implemented. + * \param[in] element An element which is being refined. + * \param[in] quad_order An encoded order of the element. + * \param[in] rsln A reference solution which is used to select a refinement. + * \param[out] refinement A selected refinement. It contains a valid contents if and only if the method returns true. + * \return True if a refinement was proposed. False if the selector is unable to select a refinement or it suggest that the element should not be refined. */ + virtual bool select_refinement(Element* element, int quad_order, MeshFunction* rsln, ElementToRefine& refinement) = 0; + protected: - const int min_order; ///< A minimum allowed order. - const int max_order; ///< A maximum allowed order. + /// A minimum allowed order. + const int min_order; + /// A maximum allowed order. + const int max_order; /// Constructor /** \param[in] max_order A maximum order used by this selector. If it is ::H2DRS_DEFAULT_ORDER, a maximum supported order is used. */ @@ -83,7 +86,7 @@ namespace Hermes /// A selector that selects H-refinements only. \ingroup g_selectors template - class HERMES_API HOnlySelector : public Selector { + class HERMES_API HOnlySelector : public Selector < Scalar > { public: /// Constructor. HOnlySelector() : Selector() {}; @@ -91,22 +94,24 @@ namespace Hermes /// Selects a refinement. /** Selects a H-refienements. For details, see Selector::select_refinement. */ virtual bool select_refinement(Element* element, int quad_order, MeshFunction* rsln, ElementToRefine& refinement); - + template friend class Adapt; template friend class KellyTypeAdapt; }; /// A selector that increases order (i.e., it selects P-refinements only). \ingroup g_selectors template - class HERMES_API POnlySelector : public Selector { - const int order_h_inc; ///< Increase along the horizontal direction in a quadrilateral or increase of an order in a triangle. - const int order_v_inc; ///< Increase along the vertical direction in a quadrilateral. + class HERMES_API POnlySelector : public Selector < Scalar > { + /// Increase along the horizontal direction in a quadrilateral or increase of an order in a triangle. + const int order_h_inc; + /// Increase along the vertical direction in a quadrilateral. + const int order_v_inc; public: /// Constructor. /** \param[in] max_order A maximum order used by this selector. If it is ::H2DRS_DEFAULT_ORDER, a maximum supported order is used. * \param[in] order_h_inc An increase of the horizontal order in a quadrilateral and an order in a triangle. The increase has to be greater or equal to 0. * \param[in] order_v_inc An increase of the vertical order in a quadrilateral. The increase has to be greater or equal to 0. */ - POnlySelector(int max_order, int order_h_inc, int order_v_inc); + POnlySelector(int max_order = H2DRS_DEFAULT_ORDER, int order_h_inc = 1, int order_v_inc = 1); protected: /// Selects a refinement. diff --git a/hermes2d/include/shapeset/precalc.h b/hermes2d/include/shapeset/precalc.h index 5e799fdd66..67f307d546 100644 --- a/hermes2d/include/shapeset/precalc.h +++ b/hermes2d/include/shapeset/precalc.h @@ -24,13 +24,12 @@ namespace Hermes namespace Hermes2D { enum SpaceType; - /// @ingroup meshFunctions /// \brief Caches precalculated shape function values. /// /// PrecalcShapeset is a cache of precalculated shape function values. /// /// - class HERMES_API PrecalcShapeset : public Function + class HERMES_API PrecalcShapeset : public Function < double > { public: /// Returns type of space @@ -47,9 +46,9 @@ namespace Hermes /// can then be obtained by setting the required integration rule order by calling /// set_quad_order() and after that calling get_values(), get_dx_values(), etc. /// \param index[in] Shape index. - void set_active_shape(int index); + virtual void set_active_shape(int index); - private: + protected: virtual void set_quad_2d(Quad2D* quad_2d); /// \brief Frees all precalculated tables. @@ -62,18 +61,18 @@ namespace Hermes Shapeset* get_shapeset() const; /// Returns the polynomial order of the active shape function on given edge. - virtual int get_edge_fn_order(int edge); + virtual unsigned short get_edge_fn_order(int edge); Shapeset* shapeset; int index; - int max_index[H2D_NUM_MODES]; + unsigned short max_index[H2D_NUM_MODES]; /// Transformed points to the reference domain, used by precalculate. double2 ref_points[H2D_MAX_INTEGRATION_POINTS_COUNT]; - virtual void precalculate(int order, int mask); + virtual void precalculate(unsigned short order, unsigned short mask); void update_max_index(); @@ -89,6 +88,88 @@ namespace Hermes template friend class NeighborSearch; friend class CurvMap; }; + + /// \brief PrecalcShapesetAssembling common storage. + class HERMES_API PrecalcShapesetAssemblingStorage + { + public: + PrecalcShapesetAssemblingStorage(Shapeset* shapeset); + ~PrecalcShapesetAssemblingStorage(); + unsigned char shapeset_id; + unsigned short max_index[2]; + unsigned short ref_count; + + private: + double*** PrecalculatedValues[H2D_NUM_MODES][H2D_NUM_FUNCTION_VALUES]; + bool** PrecalculatedInfo[H2D_NUM_MODES]; + friend class PrecalcShapesetAssembling; + }; + + /// \brief PrecalcShapeset variant for fast assembling. + class HERMES_API PrecalcShapesetAssembling : public PrecalcShapeset + { + public: + /// \brief Constructs a standard (master) precalculated shapeset class. + /// \param shapeset[in] Pointer to the shapeset to be precalculated. + PrecalcShapesetAssembling(Shapeset* shapeset); + + /// Copy constructor + PrecalcShapesetAssembling(const PrecalcShapesetAssembling& other); + + /// Destructor. + virtual ~PrecalcShapesetAssembling(); + + /// \brief Returns function values. + /// \param component[in] The component of the function (0 or 1). + /// \return The values of the function at all points of the current integration rule. + const double* get_fn_values(int component = 0) const; + + /// \brief Returns the x partial derivative. + /// \param component[in] The component of the function (0 or 1). + /// \return The x partial derivative of the function at all points of the current integration rule. + const double* get_dx_values(int component = 0) const; + + /// \brief Returns the y partial derivative. + /// \param component[in] The component of the function (0 or 1). + /// \return The y partial derivative of the function at all points of the current integration rule. + const double* get_dy_values(int component = 0) const; + +#ifdef H2D_USE_SECOND_DERIVATIVES + /// \brief Returns the second x partial derivative. + /// \param component[in] The component of the function (0 or 1). + /// \return The x second partial derivative of the function at all points of the current integration rule. + const double* get_dxx_values(int component = 0) const; + + /// \brief Returns the second y partial derivative. + /// \param component[in] The component of the function (0 or 1). + /// \return The y second partial derivative of the function at all points of the current integration rule. + const double* get_dyy_values(int component = 0) const; + + /// \brief Returns the second mixed derivative. + /// \param component[in] The component of the function (0 or 1). + /// \return The second mixed derivative of the function at all points of the current integration rule. + const double* get_dxy_values(int component = 0) const; +#endif + + const double* get_values(int component, unsigned short item) const; + + private: + virtual void precalculate(unsigned short order, unsigned short mask); + + PrecalcShapesetAssemblingStorage* storage; + + bool attempt_to_reuse(unsigned short order) const; + bool reuse_possible() const; + }; + + /// Intentionally not exported - for internal purposes. + /// Do not use, + class PrecalcShapesetAssemblingInternal : public PrecalcShapesetAssembling + { + public: + PrecalcShapesetAssemblingInternal(Shapeset* shapeset); + virtual ~PrecalcShapesetAssemblingInternal(); + }; } } #endif diff --git a/hermes2d/include/shapeset/shapeset.h b/hermes2d/include/shapeset/shapeset.h index e9db906bbb..42d6f32a59 100644 --- a/hermes2d/include/shapeset/shapeset.h +++ b/hermes2d/include/shapeset/shapeset.h @@ -43,9 +43,21 @@ namespace Hermes template class HcurlProjBasedSelector; }; +#ifdef HERMES_FOR_AGROS +#define H2D_MAX_LOCAL_BASIS_SIZE_TRI 78 +#define H2D_MAX_LOCAL_BASIS_SIZE_QUAD 137 +#define H2D_MAX_LOCAL_BASIS_SIZE 137 +#define H2D_NUM_SHAPESETS 2 +#else +#define H2D_MAX_LOCAL_BASIS_SIZE_QUAD 308 +#define H2D_MAX_LOCAL_BASIS_SIZE_TRI 164 #define H2D_MAX_LOCAL_BASIS_SIZE 308 +#define H2D_NUM_SHAPESETS 5 +#endif + + /// Should be exactly the same as is the count of enum ShapesetType + - /// @ingroup spaces /// \brief Defines a set of shape functions. /// /// This class stores mainly the definitions of the polynomials for all shape functions, @@ -86,32 +98,32 @@ namespace Hermes ~Shapeset(); /// Shape-function function type. Internal. - typedef double (*shape_fn_t)(double, double); + typedef double(*shape_fn_t)(double, double); /// Returns the polynomial degree of the specified shape function. /// If on quads, it returns encoded orders. The orders has to be decoded through macros /// H2D_GET_H_ORDER and H2D_GET_V_ORDER. - int get_order(int index, ElementMode2D mode) const; + unsigned short get_order(int index, ElementMode2D mode) const; virtual Shapeset* clone() = 0; /// Returns 2 if this is a vector shapeset, 1 otherwise. - int get_num_components() const; + unsigned char get_num_components() const; /// Returns the maximum poly degree for all shape functions. - int get_max_order() const; - int get_min_order() const; + unsigned short get_max_order() const; + unsigned short get_min_order() const; /// Returns the highest shape function index. - virtual int get_max_index(ElementMode2D mode) const = 0; + virtual unsigned short get_max_index(ElementMode2D mode) const = 0; /// Returns the index of a vertex shape function associated with the specified vertex. - int get_vertex_index(int vertex, ElementMode2D mode) const; + short get_vertex_index(int vertex, ElementMode2D mode) const; /// Returns the index of an edge function associated with the specified edge and of the /// requested order. 'ori' can be 0 or 1 and determines edge orientation (this is for /// shapesets with non-symmetric edge functions). - int get_edge_index(int edge, int ori, int order, ElementMode2D mode) const; + short get_edge_index(unsigned char edge, unsigned short ori, unsigned short order, ElementMode2D mode) const; /// Returns space type. /// Internal. @@ -119,50 +131,66 @@ namespace Hermes /// Returns shapeset identifier. /// Internal. - virtual int get_id() const = 0; + virtual unsigned char get_id() const = 0; /// Obtains the value of the given shape function. (x,y) is a coordinate in the reference /// domain, component is 0 for Scalar shapesets and 0 or 1 for vector shapesets. - double get_value(int n, int index, double x, double y, int component, ElementMode2D mode); + double get_value(int n, int index, double x, double y, unsigned short component, ElementMode2D mode); + + double get_fn_value(int index, double x, double y, unsigned short component, ElementMode2D mode); + double get_dx_value(int index, double x, double y, unsigned short component, ElementMode2D mode); + double get_dy_value(int index, double x, double y, unsigned short component, ElementMode2D mode); + + /// The most used calls are distinguished for optimization. + double get_fn_value_0_tri(int index, double x, double y); + /// The most used calls are distinguished for optimization. + double get_dx_value_0_tri(int index, double x, double y); + /// The most used calls are distinguished for optimization. + double get_dy_value_0_tri(int index, double x, double y); + + /// The most used calls are distinguished for optimization. + double get_fn_value_0_quad(int index, double x, double y); + /// The most used calls are distinguished for optimization. + double get_dx_value_0_quad(int index, double x, double y); + /// The most used calls are distinguished for optimization. + double get_dy_value_0_quad(int index, double x, double y); - double get_fn_value (int index, double x, double y, int component, ElementMode2D mode); - double get_dx_value (int index, double x, double y, int component, ElementMode2D mode); - double get_dy_value (int index, double x, double y, int component, ElementMode2D mode); - double get_dxx_value(int index, double x, double y, int component, ElementMode2D mode); - double get_dyy_value(int index, double x, double y, int component, ElementMode2D mode); - double get_dxy_value(int index, double x, double y, int component, ElementMode2D mode); + double get_dxx_value(int index, double x, double y, unsigned short component, ElementMode2D mode); + double get_dyy_value(int index, double x, double y, unsigned short component, ElementMode2D mode); + double get_dxy_value(int index, double x, double y, unsigned short component, ElementMode2D mode); /// Returns the number of bubble functions for an element of the given order. - virtual int get_num_bubbles(int order, ElementMode2D mode) const; + virtual unsigned short get_num_bubbles(unsigned short order, ElementMode2D mode) const; protected: /// Returns a complete set of indices of bubble functions for an element of the given order. - virtual int* get_bubble_indices(int order, ElementMode2D mode) const; + virtual short* get_bubble_indices(unsigned short order, ElementMode2D mode) const; /// Returns the index of a constrained edge function. 'part' is 0 or 1 for edge /// halves, 2, 3, 4, 5 for edge quarters, etc. See shapeset.cpp. - int get_constrained_edge_index(int edge, int order, int ori, int part, ElementMode2D mode) const; + int get_constrained_edge_index(unsigned char edge, unsigned short order, unsigned short ori, unsigned short part, ElementMode2D mode) const; /// Returns the coordinates of the reference domain vertices. double2* get_ref_vertex(int vertex, ElementMode2D mode); shape_fn_t*** shape_table[6]; - int** vertex_indices; - int*** edge_indices; - int*** bubble_indices; - int** bubble_count; - int** index_to_order; + short** vertex_indices; + short*** edge_indices; + short*** bubble_indices; + unsigned short** bubble_count; + unsigned short** index_to_order; double2 ref_vert[H2D_MAX_SOLUTION_COMPONENTS][H2D_MAX_NUMBER_VERTICES]; - int max_order, min_order; - int num_components; + unsigned char max_order, min_order; + unsigned char num_components; - int ebias; ///< 2 for H1 shapesets, 0 for H(curl) shapesets. It is the order of the + /// 2 for H1 shapesets, 0 for H(curl) shapesets. It is the order of the + unsigned short ebias; ///< first edge function. double** comb_table; - int table_size; + unsigned short table_size; /** numbering of edge intervals: (the variable 'part') -+- -+- -+- | | 13 | @@ -187,22 +215,23 @@ namespace Hermes /// linear combination of standard edge functions. This function determines the coefficients /// of such linear combination by forming and solving a simple linear system. /// - double* calculate_constrained_edge_combination(int order, int part, int ori, ElementMode2D mode); + double* calculate_constrained_edge_combination(unsigned short order, unsigned short part, unsigned short ori, ElementMode2D mode); /// Returns the coefficients for the linear combination forming a constrained edge function. /// This function performs the storage (caching) of these coefficients, so that they can be /// calculated only once. /// - double* get_constrained_edge_combination(int order, int part, int ori, int& nitems, ElementMode2D mode); + double* get_constrained_edge_combination(unsigned short order, unsigned short part, unsigned short ori, unsigned short& nitems, ElementMode2D mode); /// Releases all cached coefficients. void free_constrained_edge_combinations(); /// Constructs the linear combination of edge functions, forming a constrained edge function. /// - double get_constrained_value(int n, int index, double x, double y, int component, ElementMode2D mode); + double get_constrained_value(int n, int index, double x, double y, unsigned short component, ElementMode2D mode); template friend class DiscreteProblem; + template friend class DiscreteProblemIntegrationOrderCalculator; template friend class Solution; friend class CurvMap; friend class CurvMapStatic; @@ -212,8 +241,6 @@ namespace Hermes template friend class RefinementSelectors::HcurlProjBasedSelector; template friend class RefinementSelectors::OptimumSelector; friend class PrecalcShapeset; - friend void check_leg_tri(Shapeset* shapeset); - friend void check_gradleg_tri(Shapeset* shapeset); template friend class Form; template friend class MatrixForm; template friend class VectorForm; @@ -226,4 +253,4 @@ namespace Hermes }; } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/include/shapeset/shapeset_h1_all.h b/hermes2d/include/shapeset/shapeset_h1_all.h index 425d18c2db..04124bbc88 100644 --- a/hermes2d/include/shapeset/shapeset_h1_all.h +++ b/hermes2d/include/shapeset/shapeset_h1_all.h @@ -23,7 +23,6 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup spaces /// Shape functions based on integrated Jacobi polynomials. class HERMES_API H1ShapesetJacobi : public Shapeset { @@ -31,29 +30,28 @@ namespace Hermes H1ShapesetJacobi(); virtual Shapeset* clone() { return new H1ShapesetJacobi(*this); }; virtual SpaceType get_space_type() const { return HERMES_H1_SPACE; } - virtual int get_max_index(ElementMode2D mode) const; - - virtual int get_id() const { return 1; } - - static const int max_index[H2D_NUM_MODES]; + virtual unsigned short get_max_index(ElementMode2D mode) const; + + virtual unsigned char get_id() const { return HERMES_H1_JACOBI; } + + static const unsigned short max_index[H2D_NUM_MODES]; }; - /// @ingroup spaces /// Experimental. /* class HERMES_API H1ShapesetEigen : public Shapeset { public: - H1ShapesetEigen(); - virtual Shapeset* clone() { return new H1ShapesetEigen(*this); }; - virtual int get_max_index(ElementMode2D mode) {}; + H1ShapesetEigen(); + virtual Shapeset* clone() { return new H1ShapesetEigen(*this); }; + virtual unsigned short get_max_index(ElementMode2D mode) {}; private: - virtual int get_id() const { return 2; } - template friend class VectorForm; - template friend class MatrixForm; - virtual SpaceType get_space_type() const { return HERMES_H1_SPACE; } - template friend class DiscreteProblem; template friend class Solution; friend class CurvMap; friend class RefMap; template friend class RefinementSelectors::H1ProjBasedSelector; template friend class RefinementSelectors::L2ProjBasedSelector; template friend class RefinementSelectors::HcurlProjBasedSelector; template friend class RefinementSelectors::OptimumSelector; friend class PrecalcShapeset; - static const int max_index[H2D_NUM_MODES]; + virtual unsigned char get_id() const { return 2; } + template friend class VectorForm; + template friend class MatrixForm; + virtual SpaceType get_space_type() const { return HERMES_H1_SPACE; } + template friend class DiscreteProblem; template friend class Solution; friend class CurvMap; friend class RefMap; template friend class RefinementSelectors::H1ProjBasedSelector; template friend class RefinementSelectors::L2ProjBasedSelector; template friend class RefinementSelectors::HcurlProjBasedSelector; template friend class RefinementSelectors::OptimumSelector; friend class PrecalcShapeset; + static const unsigned short max_index[H2D_NUM_MODES]; }; */ @@ -61,4 +59,4 @@ namespace Hermes typedef H1ShapesetJacobi H1Shapeset; } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/include/shapeset/shapeset_h1_quad.h b/hermes2d/include/shapeset/shapeset_h1_quad.h index 0f63ff0686..998a81cc17 100644 --- a/hermes2d/include/shapeset/shapeset_h1_quad.h +++ b/hermes2d/include/shapeset/shapeset_h1_quad.h @@ -23,10 +23,10 @@ extern Shapeset::shape_fn_t* simple_quad_shape_fn_table_dxx[1]; extern Shapeset::shape_fn_t* simple_quad_shape_fn_table_dxy[1]; extern Shapeset::shape_fn_t* simple_quad_shape_fn_table_dyy[1]; -extern int simple_quad_vertex_indices[H2D_MAX_NUMBER_VERTICES]; -extern int* simple_quad_edge_indices[H2D_MAX_NUMBER_EDGES]; -extern int* simple_quad_bubble_indices[]; -extern int simple_quad_bubble_count[]; -extern int simple_quad_index_to_order[]; +extern short simple_quad_vertex_indices[H2D_MAX_NUMBER_VERTICES]; +extern short* simple_quad_edge_indices[H2D_MAX_NUMBER_EDGES]; +extern short* simple_quad_bubble_indices[]; +extern unsigned short simple_quad_bubble_count[]; +extern unsigned short simple_quad_index_to_order[]; #endif \ No newline at end of file diff --git a/hermes2d/include/shapeset/shapeset_hc_all.h b/hermes2d/include/shapeset/shapeset_hc_all.h index d568b8c2db..9b48797f20 100644 --- a/hermes2d/include/shapeset/shapeset_hc_all.h +++ b/hermes2d/include/shapeset/shapeset_hc_all.h @@ -23,21 +23,20 @@ namespace Hermes namespace Hermes2D { /// H(curl) shapeset with Legendre bubbles and gradients of H1 functions as edges - /// @ingroup spaces class HERMES_API HcurlShapesetGradLeg : public Shapeset { public: HcurlShapesetGradLeg(); virtual Shapeset* clone() { return new HcurlShapesetGradLeg(*this); }; - virtual int get_max_index(ElementMode2D mode) const; - virtual int get_id() const { return 13; } + virtual unsigned short get_max_index(ElementMode2D mode) const; + virtual unsigned char get_id() const { return HERMES_HCURL_GRADLEG; } virtual SpaceType get_space_type() const { return HERMES_HCURL_SPACE; } - - static const int max_index[H2D_NUM_MODES]; + + static const unsigned short max_index[H2D_NUM_MODES]; }; /// This is the default Hcurl shapeset typedef. typedef HcurlShapesetGradLeg HcurlShapeset; } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/include/shapeset/shapeset_hd_all.h b/hermes2d/include/shapeset/shapeset_hd_all.h index a41e561693..00979b99d5 100644 --- a/hermes2d/include/shapeset/shapeset_hd_all.h +++ b/hermes2d/include/shapeset/shapeset_hd_all.h @@ -23,21 +23,20 @@ namespace Hermes namespace Hermes2D { /// H(div) shapeset based on Legendre polynomials. - /// @ingroup spaces class HERMES_API HdivShapesetLegendre : public Shapeset { public: HdivShapesetLegendre(); virtual Shapeset* clone() { return new HdivShapesetLegendre(*this); }; virtual SpaceType get_space_type() const { return HERMES_HDIV_SPACE; } - virtual int get_max_index(ElementMode2D mode) const; - virtual int get_id() const { return 20; } - - static const int max_index[H2D_NUM_MODES]; + virtual unsigned short get_max_index(ElementMode2D mode) const; + virtual unsigned char get_id() const { return HERMES_HDIV_LEGENDRE; } + + static const unsigned short max_index[H2D_NUM_MODES]; }; /// This is the default Hdiv shapeset typedef. typedef HdivShapesetLegendre HdivShapeset; } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/include/shapeset/shapeset_l2_all.h b/hermes2d/include/shapeset/shapeset_l2_all.h index 480006f972..07a94fad16 100644 --- a/hermes2d/include/shapeset/shapeset_l2_all.h +++ b/hermes2d/include/shapeset/shapeset_l2_all.h @@ -25,43 +25,41 @@ namespace Hermes namespace Hermes2D { /// L2 shapeset - products of legendre polynomials - /// @ingroup spaces class HERMES_API L2ShapesetLegendre : public Shapeset { public: L2ShapesetLegendre(); virtual Shapeset* clone() { return new L2ShapesetLegendre(*this); }; virtual SpaceType get_space_type() const { return HERMES_L2_SPACE; } - virtual int get_max_index(ElementMode2D mode) const; - virtual int get_id() const { return 30; } - - static const int max_index[H2D_NUM_MODES]; + virtual unsigned short get_max_index(ElementMode2D mode) const; + virtual unsigned char get_id() const { return HERMES_L2_LEGENDRE; } + + static const unsigned short max_index[H2D_NUM_MODES]; }; /// L2 Taylor shapeset - Taylor basis functions as proposed by Kuzmin, Luo - /// @ingroup spaces class HERMES_API L2ShapesetTaylor : public Shapeset { public: L2ShapesetTaylor(bool contains_means = true); virtual Shapeset* clone() { return new L2ShapesetTaylor(*this); }; virtual SpaceType get_space_type() const { return HERMES_L2_SPACE; } - virtual int get_max_index(ElementMode2D mode) const; - virtual int get_id() const { return 31; } + virtual unsigned short get_max_index(ElementMode2D mode) const; + virtual unsigned char get_id() const { return HERMES_L2_TAYLOR; } /// Returns a complete set of indices of bubble functions for an element of the given order. /// Reimplemented because this shapeset uses linear (not bi-linear), quadratic (not bi-quadratic) etc. polynomials. - int* get_bubble_indices(int order, ElementMode2D mode) const; + short* get_bubble_indices(unsigned short order, ElementMode2D mode) const; /// Returns the number of bubble functions for an element of the given order. /// Reimplemented because this shapeset uses linear (not bi-linear), quadratic (not bi-quadratic) etc. polynomials. - virtual int get_num_bubbles(int order, ElementMode2D mode) const; - - static const int max_index[H2D_NUM_MODES]; + virtual unsigned short get_num_bubbles(unsigned short order, ElementMode2D mode) const; + + static const unsigned short max_index[H2D_NUM_MODES]; }; /// This is the default shapeset typedef typedef L2ShapesetLegendre L2Shapeset; } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/include/solver/linear_solver.h b/hermes2d/include/solver/linear_solver.h index b4a99f84aa..2aa236da28 100644 --- a/hermes2d/include/solver/linear_solver.h +++ b/hermes2d/include/solver/linear_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -28,7 +28,6 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup userSolvingAPI /// Class for solving linear problems.
/// Typical usage:
/// // Initialize linear solver.
@@ -38,13 +37,16 @@ namespace Hermes /// // Solve the linear problem.
/// try
/// {
- /// // Just call solve().
+ // Just call solve().
+ ///  /// linear_solver.solve();
///
- /// // Get the solution vector from the solver.
+ // Get the solution vector from the solver.
+ ///  /// double* sln_vector = linear_solver.get_sln_vector();
///
- /// // Translate the solution vector into the previously initialized Solution using the static method vector_to_solution.
+ // Translate the solution vector into the previously initialized Solution using the static method vector_to_solution.
+ ///  /// Hermes::Hermes2D::Solution::vector_to_solution(sln_vector, &space, &sln);
/// }
/// // All kinds of Exceptions may happen (Linear algebraic solver, some bad parameters, some data not initialized...)
@@ -60,13 +62,13 @@ namespace Hermes /// return -1;
/// }
template - class LinearSolver : public Solver, public Hermes::Solvers::MatrixSolver + class LinearSolver : public Solver, public Hermes::Solvers::MatrixSolver < Scalar > { public: LinearSolver(bool force_use_direct_solver = false); LinearSolver(DiscreteProblem* dp, bool force_use_direct_solver = false); - LinearSolver(WeakForm* wf, SpaceSharedPtr& space, bool force_use_direct_solver = false); - LinearSolver(WeakForm* wf, Hermes::vector >& spaces, bool force_use_direct_solver = false); + LinearSolver(WeakFormSharedPtr wf, SpaceSharedPtr space, bool force_use_direct_solver = false); + LinearSolver(WeakFormSharedPtr wf, std::vector > spaces, bool force_use_direct_solver = false); virtual ~LinearSolver(); // See the base class for details, the following serves only for avoiding C++ name-hiding. @@ -80,17 +82,18 @@ namespace Hermes Scalar* get_sln_vector(); /// DiscreteProblemWeakForm helper. - virtual void set_spaces(Hermes::vector >& spaces); + virtual void set_spaces(std::vector > spaces); /// DiscreteProblemWeakForm helper. - virtual void set_weak_formulation(WeakForm* wf); + virtual void set_weak_formulation(WeakFormSharedPtr wf); + + /// See Hermes::Mixins::Loggable. + virtual void set_verbose_output(bool to_set); protected: /// State querying helpers. virtual bool isOkay() const; inline std::string getClassName() const { return "LinearSolver"; } - - void init_linear(bool force_use_direct_solver); }; } } diff --git a/hermes2d/include/solver/newton_solver.h b/hermes2d/include/solver/newton_solver.h index 8097c30c41..f4b4f77425 100644 --- a/hermes2d/include/solver/newton_solver.h +++ b/hermes2d/include/solver/newton_solver.h @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -29,7 +29,6 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup userSolvingAPI /// Class for Newton's method.
/// Typical usage:
/// // Initialize Newton's solver.
@@ -45,13 +44,16 @@ namespace Hermes /// // Solve the linear problem.
/// try
/// {
- /// // Just call solve().
+ // Just call solve().
+ ///  /// newton_solver.solve();
///
- /// // Get the solution vector from the solver.
+ // Get the solution vector from the solver.
+ ///  /// double* sln_vector = newton_solver.get_sln_vector();
///
- /// // Translate the solution vector into the previously initialized Solution using the static method vector_to_solution.
+ // Translate the solution vector into the previously initialized Solution using the static method vector_to_solution.
+ ///  /// Hermes::Hermes2D::Solution::vector_to_solution(sln_vector, &space, &sln);
/// }
/// // All kinds of Exceptions may happen (Linear algebraic solver, some bad parameters, some data not initialized...)
@@ -69,14 +71,13 @@ namespace Hermes template class HERMES_API NewtonSolver : public Hermes::Hermes2D::Solver, - public Hermes::Solvers::NewtonMatrixSolver + public Hermes::Solvers::NewtonMatrixSolver < Scalar > { public: NewtonSolver(); NewtonSolver(DiscreteProblem* dp); - NewtonSolver(WeakForm* wf, SpaceSharedPtr& space); - NewtonSolver(WeakForm* wf, Hermes::vector >& spaces); - void init(); + NewtonSolver(WeakFormSharedPtr wf, SpaceSharedPtr space); + NewtonSolver(WeakFormSharedPtr wf, std::vector > spaces); virtual ~NewtonSolver(); // See the base class for details, the following serves only for avoiding C++ name-hiding. @@ -90,14 +91,19 @@ namespace Hermes Scalar* get_sln_vector(); /// DiscreteProblemWeakForm helper. - virtual void set_spaces(Hermes::vector >& spaces); + virtual void set_spaces(std::vector > spaces); /// DiscreteProblemWeakForm helper. - virtual void set_weak_formulation(WeakForm* wf); + virtual void set_weak_formulation(WeakFormSharedPtr wf); + + /// See Hermes::Mixins::Loggable. + virtual void set_verbose_output(bool to_set); virtual void assemble_residual(bool store_previous_residual); - virtual void assemble_jacobian(bool store_previous_jacobian); - virtual void assemble(bool store_previous_jacobian, bool store_previous_residual); + /// \return Information if the jacobian structure was reused. + virtual bool assemble_jacobian(bool store_previous_jacobian); + /// \return Information if the jacobian structure was reused. + virtual bool assemble(bool store_previous_jacobian, bool store_previous_residual); /// Initialization - called at the beginning of solving. virtual void init_solving(Scalar* coeff_vec); diff --git a/hermes2d/include/solver/nox_solver.h b/hermes2d/include/solver/nox_solver.h index 23d43cac5d..bd29a81302 100644 --- a/hermes2d/include/solver/nox_solver.h +++ b/hermes2d/include/solver/nox_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -41,6 +41,8 @@ namespace Hermes { namespace Hermes2D { + template class NewtonSolverNOX; + /// \brief discrete problem used in NOX solver /// Implents interfaces needed by NOX Epetra template @@ -52,11 +54,12 @@ namespace Hermes { public: /// Constructor for multiple components / equations. - DiscreteProblemNOX(WeakForm* wf, Hermes::vector >& spaces); + DiscreteProblemNOX(WeakFormSharedPtr wf, std::vector > spaces); /// Constructor for one equation. - DiscreteProblemNOX(WeakForm* wf, SpaceSharedPtr& space); + DiscreteProblemNOX(WeakFormSharedPtr wf, SpaceSharedPtr space); /// Non-parameterized constructor. DiscreteProblemNOX(); + ~DiscreteProblemNOX(); /// \brief Setter for preconditioner. void set_precond(Teuchos::RCP > &pc); @@ -80,14 +83,15 @@ namespace Hermes private: /// \brief Jacobian (optional). - EpetraMatrix jacobian; + EpetraMatrix* jacobian; /// \brief Preconditioner (optional). Teuchos::RCP > precond; + + friend class NewtonSolverNOX < Scalar > ; }; /// \brief Encapsulation of NOX nonlinear solver. /// \note complex numbers is not implemented yet - /// @ingroup solvers template class HERMES_API NewtonSolverNOX : public Hermes::Mixins::Loggable { @@ -96,6 +100,13 @@ namespace Hermes public: /// Constructor. NewtonSolverNOX(DiscreteProblemNOX *problem); + /// Constructor for multiple components / equations. + NewtonSolverNOX(WeakFormSharedPtr wf, std::vector > spaces); + /// Constructor for one equation. + NewtonSolverNOX(WeakFormSharedPtr wf, SpaceSharedPtr space); + + /// Utilities for constructors. + void init(); virtual ~NewtonSolverNOX(); @@ -103,7 +114,9 @@ namespace Hermes virtual void set_time(double time); virtual void set_time_step(double time_step); - virtual void solve(Scalar* coeff_vec); + virtual void solve(Scalar* coeff_vec = nullptr); + virtual void solve(std::vector > initial_guess); + virtual void solve(MeshFunctionSharedPtr initial_guess); Scalar* get_sln_vector(); @@ -199,6 +212,9 @@ namespace Hermes Scalar* sln_vector; DiscreteProblemNOX *dp; + /// This instance owns its DP. + bool own_dp; + protected: int num_iters; double residual; @@ -220,10 +236,10 @@ namespace Hermes struct conv_flag_t { - unsigned absresid:1; - unsigned relresid:1; - unsigned wrms:1; - unsigned update:1; + unsigned absresid : 1; + unsigned relresid : 1; + unsigned wrms : 1; + unsigned update : 1; } conv_flag; }; } diff --git a/hermes2d/include/solver/picard_solver.h b/hermes2d/include/solver/picard_solver.h index e528ebbdf7..48b2957e92 100644 --- a/hermes2d/include/solver/picard_solver.h +++ b/hermes2d/include/solver/picard_solver.h @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -29,10 +29,9 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup userSolvingAPI /// Class for the Picard's method.
/// For details about the optionally applied Anderson acceleration, the following website
- /// http://hpfem.org/hermes/hermes-tutorial/doc/_build/html/src/hermes2d/B-nonlinear/01-picard.html + /// http://www.hpfem.org/hermes/hermes-tutorial/doc/_build/html/src/hermes2d/B-nonlinear/01-picard.html /// will give an overview.
/// Typical usage:
/// // Initialize Picard's solver.
@@ -47,13 +46,16 @@ namespace Hermes /// // Solve the linear problem.
/// try
/// {
- /// // Call solve with the initial guess.
+ // Call solve with the initial guess.
+ ///  /// picard_solver.solve(&prevTimeLevelSolution);
///
- /// // Get the solution vector from the solver.
+ // Get the solution vector from the solver.
+ ///  /// std::complex * sln_vector = picard_solver.get_sln_vector();
///
- /// // Translate the solution vector into the previously initialized Solution > using the static method vector_to_solution.
+ // Translate the solution vector into the previously initialized Solution > using the static method vector_to_solution.
+ ///  /// Hermes::Hermes2D::Solution >::vector_to_solution(sln_vector, &space, &sln);
/// }
/// // All kinds of Exceptions may happen (Linear algebraic solver, some bad parameters, some data not initialized...)
@@ -71,14 +73,13 @@ namespace Hermes template class HERMES_API PicardSolver : public Hermes::Hermes2D::Solver, - public Hermes::Solvers::PicardMatrixSolver + public Hermes::Solvers::PicardMatrixSolver < Scalar > { public: PicardSolver(); PicardSolver(DiscreteProblem* dp); - PicardSolver(WeakForm* wf, SpaceSharedPtr& space); - PicardSolver(WeakForm* wf, Hermes::vector >& spaces); - void init(); + PicardSolver(WeakFormSharedPtr wf, SpaceSharedPtr space); + PicardSolver(WeakFormSharedPtr wf, std::vector > spaces); virtual ~PicardSolver(); // See the base class for details, the following serves only for avoiding C++ name-hiding. @@ -92,14 +93,17 @@ namespace Hermes Scalar* get_sln_vector(); /// DiscreteProblemWeakForm helper. - virtual void set_spaces(Hermes::vector >& spaces); + virtual void set_spaces(std::vector > spaces); + + /// See Hermes::Mixins::Loggable. + virtual void set_verbose_output(bool to_set); /// DiscreteProblemWeakForm helper. - virtual void set_weak_formulation(WeakForm* wf); + virtual void set_weak_formulation(WeakFormSharedPtr wf); virtual void assemble_residual(bool store_previous_residual); - virtual void assemble_jacobian(bool store_previous_jacobian); - virtual void assemble(bool store_previous_jacobian, bool store_previous_residual); + virtual bool assemble_jacobian(bool store_previous_jacobian); + virtual bool assemble(bool store_previous_jacobian, bool store_previous_residual); /// Initialization - called at the beginning of solving. virtual void init_solving(Scalar* coeff_vec); diff --git a/hermes2d/include/solver/runge_kutta.h b/hermes2d/include/solver/runge_kutta.h index cdc3615ae0..2a16e8b525 100644 --- a/hermes2d/include/solver/runge_kutta.h +++ b/hermes2d/include/solver/runge_kutta.h @@ -68,25 +68,24 @@ namespace Hermes // Jordan canonical form (I think) for better performance. This // can be found, I think, in newer Butcher's papers or presentation // (he has them online), and possibly in his book. - /// @ingroup userSolvingAPI /// Runge-Kutta methods implementation for time-dependent problems. template - class HERMES_API RungeKutta : + class HERMES_API RungeKutta : public Hermes::Mixins::Loggable, public Hermes::Mixins::TimeMeasurable, public Hermes::Mixins::IntegrableWithGlobalOrder, public Hermes::Mixins::SettableComputationTime, public Hermes::Hermes2D::Mixins::SettableSpaces, - public Hermes::Algebra::Mixins::MatrixRhsOutput + public Hermes::Algebra::Mixins::MatrixRhsOutput < Scalar > { public: /// Constructor. /// Parameter start_from_zero_K_vector: if set to true, the last K_vector will NOT be used /// as an initial guess for the Newton's method, instead zero vector will be used. - RungeKutta(WeakForm* wf, Hermes::vector > spaces, ButcherTable* bt); + RungeKutta(WeakFormSharedPtr wf, std::vector > spaces, ButcherTable* bt); /// Constructor for one equation. - RungeKutta(WeakForm* wf, SpaceSharedPtr space, ButcherTable* bt); + RungeKutta(WeakFormSharedPtr wf, SpaceSharedPtr space, ButcherTable* bt); void set_start_from_zero_K_vector(); void set_residual_as_solutions(); @@ -106,26 +105,26 @@ namespace Hermes // iteration of the Newton's method. // block_diagonal_jacobian... if true then the tensor product block Jacobian is // reduced to just the diagonal blocks. - void rk_time_step_newton(Hermes::vector > slns_time_prev, Hermes::vector > slns_time_new, Hermes::vector > error_fns); + void rk_time_step_newton(std::vector > slns_time_prev, std::vector > slns_time_new, std::vector > error_fns); void rk_time_step_newton(MeshFunctionSharedPtr slns_time_prev, MeshFunctionSharedPtr slns_time_new, MeshFunctionSharedPtr error_fn); // This is a wrapper for the previous function if error_fn is not provided // (adaptive time stepping is not wanted). - void rk_time_step_newton(Hermes::vector > slns_time_prev, Hermes::vector > slns_time_new); + void rk_time_step_newton(std::vector > slns_time_prev, std::vector > slns_time_new); void rk_time_step_newton(MeshFunctionSharedPtr sln_time_prev, MeshFunctionSharedPtr sln_time_new); void set_freeze_jacobian(); - void set_tolerance(double newton_tol); - void set_max_allowed_iterations (int newton_max_iter); + void set_newton_tolerance(double newton_tol); + void set_newton_max_allowed_iterations(int newton_max_iter); void set_newton_damping_coeff(double newton_damping_coeff); void set_newton_max_allowed_residual_norm(double newton_max_allowed_residual_norm); - virtual void set_spaces(Hermes::vector >& spaces); - virtual void set_space(SpaceSharedPtr& space); - virtual Hermes::vector >& get_spaces(); + virtual void set_spaces(std::vector > spaces); + virtual void set_space(SpaceSharedPtr space); + virtual std::vector > get_spaces(); /** - \fn void RungeKutta::set_filters_to_reinit(Hermes::vector*> filters_to_reinit); + \fn void RungeKutta::set_filters_to_reinit(std::vector*> filters_to_reinit); \brief Sets the filters to reinitialize. @@ -135,7 +134,7 @@ namespace Hermes \param[in] filters_to_reinit the filters to reinitialize. */ - void set_filters_to_reinit(Hermes::vector*> filters_to_reinit); + void set_filters_to_reinit(std::vector*> filters_to_reinit); protected: /// Initialization of DiscreteProblems. @@ -156,9 +155,9 @@ namespace Hermes /// Below, "stage_wf_left" and "stage_wf_right" refer to the left-hand side M\dot{Y} /// and right-hand side F(t, Y) of the above equation, respectively. void create_stage_wf(unsigned int size, bool block_diagonal_jacobian); - + /// Updates the augmented weak formulation. - void update_stage_wf(Hermes::vector > slns_time_prev); + void update_stage_wf(std::vector > slns_time_prev); // Prepare u_ext_vec. void prepare_u_ext_vec(); @@ -174,11 +173,11 @@ namespace Hermes Hermes::Solvers::LinearMatrixSolver* solver; /// Weak formulation. - const WeakForm* wf; + const WeakFormSharedPtr wf; /// Space instances for all equations in the system. - Hermes::vector > spaces; - Hermes::vector spaces_seqs; + std::vector > spaces; + std::vector spaces_seqs; /// ButcherTable. ButcherTable* bt; @@ -189,11 +188,11 @@ namespace Hermes /// Multistage weak formulation. // For the main part equation (written on the right), /// size num_stages*ndof times num_stages*ndof. - WeakForm stage_wf_right; + WeakFormSharedPtr stage_wf_right; DiscreteProblem* stage_dp_right; /// For the matrix M (size ndof times ndof). - WeakForm stage_wf_left; + WeakFormSharedPtr stage_wf_left; DiscreteProblem* stage_dp_left; bool start_from_zero_K_vector; @@ -208,8 +207,8 @@ namespace Hermes int newton_max_iter; double newton_damping_coeff; double newton_max_allowed_residual_norm; - - Hermes::vector > residuals_vector; + + std::vector > residuals_vector; /// Vector K_vector of length num_stages * ndof. will represent /// the 'K_i' vectors in the usual R-K notation. @@ -220,9 +219,9 @@ namespace Hermes /// Vector for the left part of the residual. Scalar* vector_left; - + ///< The filters to reinitialize in every Newton's loop - Hermes::vector*> filters_to_reinit; + std::vector*> filters_to_reinit; }; } } diff --git a/hermes2d/include/solver/solver.h b/hermes2d/include/solver/solver.h index 9117a27edd..55161db610 100644 --- a/hermes2d/include/solver/solver.h +++ b/hermes2d/include/solver/solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -22,7 +22,7 @@ #ifndef __H2D_SOLVER_H_ #define __H2D_SOLVER_H_ -#include "discrete_problem.h" +#include "discrete_problem/discrete_problem.h" #include "global.h" namespace Hermes @@ -31,24 +31,24 @@ namespace Hermes { /** \defgroup userSolvingAPI User solving API * \brief Collection of classes that provide the top-level solving capabilities. - */ + */ template - class Solver: - public virtual Hermes::Mixins::TimeMeasurable, - public Hermes::Mixins::SettableComputationTime, - public Hermes::Hermes2D::Mixins::SettableSpaces, + class Solver : + public virtual Hermes::Mixins::TimeMeasurable, + public Hermes::Mixins::SettableComputationTime, + public Hermes::Hermes2D::Mixins::SettableSpaces, public virtual Hermes::Mixins::OutputAttachable, - public Hermes::Algebra::Mixins::MatrixRhsOutput, - public Hermes::Mixins::IntegrableWithGlobalOrder, - public virtual Hermes::Mixins::StateQueryable, - public Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm + public Hermes::Algebra::Mixins::MatrixRhsOutput, + public Hermes::Mixins::IntegrableWithGlobalOrder, + public virtual Hermes::Mixins::StateQueryable, + public Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm < Scalar > { public: - Solver(bool force_use_direct_solver = false); - Solver(DiscreteProblem* dp, bool force_use_direct_solver = false); - Solver(WeakForm* wf, SpaceSharedPtr& space, bool force_use_direct_solver = false); - Solver(WeakForm* wf, Hermes::vector >& spaces, bool force_use_direct_solver = false); + Solver(bool initialize_discrete_problem = true); + Solver(DiscreteProblem* dp); + Solver(WeakFormSharedPtr wf, SpaceSharedPtr space); + Solver(WeakFormSharedPtr wf, std::vector > spaces); virtual ~Solver(); /// Basic solve method. @@ -63,34 +63,34 @@ namespace Hermes /// Solve. /// \param[in] initial_guess Solution to start from (which is projected to obtain the initial coefficient vector. - virtual void solve(MeshFunctionSharedPtr& initial_guess); + virtual void solve(MeshFunctionSharedPtr initial_guess); /// Solve. /// \param[in] initial_guess Solutions to start from (which is projected to obtain the initial coefficient vector. - virtual void solve(Hermes::vector >& initial_guess); + virtual void solve(std::vector > initial_guess); /// set time information for time-dependent problems. virtual void set_time(double time); virtual void set_time_step(double time_step); /// SettableSpaces helper. - virtual void set_spaces(Hermes::vector >& spaces); - virtual Hermes::vector >& get_spaces(); + virtual void set_spaces(std::vector > spaces); + virtual std::vector > get_spaces(); /// DiscreteProblemWeakForm helper. - virtual void set_weak_formulation(WeakForm* wf); + virtual void set_weak_formulation(WeakFormSharedPtr wf); + protected: virtual bool isOkay() const; - - ///< FE problem being solved. + + /// FE problem being solved. DiscreteProblem* dp; /// This instance owns its DP. - const bool own_dp; - - private: - void init(bool force_use_direct_solver); + bool own_dp; + + template friend class AdaptSolver; }; } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/include/space/space.h b/hermes2d/include/space/space.h index c90627a17d..6e10becbf7 100644 --- a/hermes2d/include/space/space.h +++ b/hermes2d/include/space/space.h @@ -29,8 +29,9 @@ namespace Hermes { namespace Hermes2D { + /// \brief Used to pass the instances of Space around. template - class HERMES_API SpaceSharedPtr : public std::tr1::shared_ptr > + class HERMES_API SpaceSharedPtr : public std::tr1::shared_ptr < Hermes::Hermes2D::Space > { public: SpaceSharedPtr(Hermes::Hermes2D::Space* ptr = nullptr); @@ -49,11 +50,11 @@ namespace Hermes { public: /// Sets new_ spaces for the instance. - virtual void set_spaces(Hermes::vector >& spaces) = 0; - virtual void set_space(SpaceSharedPtr& space); - /// Get all spaces as a Hermes::vector. - virtual Hermes::vector >& get_spaces(); - virtual SpaceSharedPtr& get_space(int n); + virtual void set_spaces(std::vector > spaces) = 0; + virtual void set_space(SpaceSharedPtr space); + /// Get all spaces as a std::vector. + virtual std::vector > get_spaces(); + virtual SpaceSharedPtr get_space(int n); }; } @@ -61,6 +62,7 @@ namespace Hermes template class DiscreteProblem; template class DiscreteProblemDGAssembler; template class DiscreteProblemThreadAssembler; + template class DiscreteProblemIntegrationOrderCalculator; namespace Views { template class BaseView; @@ -75,11 +77,6 @@ namespace Hermes template class HcurlSpace; template class HdivSpace; - /** @defgroup spaces FEM Spaces - * \brief Collection of classes that represent and specify FE spaces. - */ - - /// @ingroup spaces /// \brief Represents a finite element space over a domain. /// /// The Space class represents a finite element space over a domain defined by 'mesh', spanned @@ -162,7 +159,7 @@ namespace Hermes int get_num_dofs() const; /// \brief Returns the number of basis functions contained in the spaces. - static int get_num_dofs(Hermes::vector > spaces); + static int get_num_dofs(std::vector > spaces); /// \brief Returns the number of basis functions contained in the space. static int get_num_dofs(SpaceSharedPtr space); @@ -203,7 +200,7 @@ namespace Hermes #pragma region Setters /// Sets the shapeset. - virtual void set_shapeset(Shapeset* shapeset) = 0; + virtual void set_shapeset(Shapeset* shapeset, bool clone = false) = 0; /// \brief Sets a (new) mesh and calls assign_dofs(). void set_mesh(MeshSharedPtr mesh); @@ -243,20 +240,20 @@ namespace Hermes /// \return The number of basis functions contained in the space. virtual int assign_dofs(int first_dof = 0); - /// \brief Assings the degrees of freedom to all Spaces in the Hermes::vector. - static int assign_dofs(Hermes::vector > spaces); + /// \brief Assings the degrees of freedom to all Spaces in the std::vector. + static int assign_dofs(std::vector > spaces); #pragma endregion #pragma region Mesh handling /// Recursively removes all son elements of the given element and /// makes it active. Also handles element orders. - /// \param[in] keep_initial_refinements Refinements in Mesh can be marked as initial (to prevent taking them back), + /// \param[in] keep_initial_refinements Refinements in Mesh can be marked as initial (to prevent taking them back), /// this parameter serves to prevent taking them back with this method. void unrefine_all_mesh_elements(bool keep_initial_refinements = true); /// Recursively removes all son elements of the given element and /// Version for more spaces sharing the mesh - static void unrefine_all_mesh_elements(Hermes::vector > spaces, bool keep_initial_refinements = true); + static void unrefine_all_mesh_elements(std::vector > spaces, bool keep_initial_refinements = true); #pragma endregion #pragma region Boundary conditions @@ -266,9 +263,9 @@ namespace Hermes /// essential boundary conditions. void update_essential_bc_values(); - static void update_essential_bc_values(Hermes::vector >& spaces, double time); + static void update_essential_bc_values(std::vector > spaces, double time); - static void update_essential_bc_values(SpaceSharedPtr& space, double time); + static void update_essential_bc_values(SpaceSharedPtr space, double time); #pragma endregion #pragma region Save & Load @@ -344,7 +341,7 @@ namespace Hermes /// Returns true if the space is ready for computation, false otherwise. bool is_up_to_date() const; - static Node* get_mid_edge_vertex_node(Element* e, int i, int j); + static Node* get_mid_edge_vertex_node(Element* e, unsigned char i, unsigned char j); /// State querying helpers. virtual bool isOkay() const; @@ -353,11 +350,14 @@ namespace Hermes /// Number of degrees of freedom (dimension of the space). int ndof; - static const int H2D_UNASSIGNED_DOF = -2; ///< DOF which was not assigned yet. - static const int H2D_CONSTRAINED_DOF = -1; ///< DOF which is constrained. + /// DOF which was not assigned yet. + static const int H2D_UNASSIGNED_DOF = -2; + /// DOF which is constrained. + static const int H2D_CONSTRAINED_DOF = -1; Shapeset* shapeset; - bool own_shapeset; ///< true if default shapeset is created in the constructor, false if shapeset is supplied by user. + /// true if default shapeset is created in the constructor, false if shapeset is supplied by user. + bool own_shapeset; /// Boundary conditions. EssentialBCs* essential_bcs; @@ -395,7 +395,7 @@ namespace Hermes }; /// Number of dofs. Temporarily used during assignment /// of DOFs to indicate nodes which were not processed yet. - int n; + short n; }; struct // constrained vertex node { @@ -414,8 +414,9 @@ namespace Hermes { public: ElementData() : changed_in_last_adaptation(true) {}; - int order; - int bdof, n; + short order; + int bdof; + short n; bool changed_in_last_adaptation; }; @@ -433,7 +434,7 @@ namespace Hermes /// Recursively removes all son elements of the given element and /// makes it active. Also handles element orders. - /// \param[in] keep_initial_refinements Refinements in Mesh can be marked as initial (to prevent taking them back), + /// \param[in] keep_initial_refinements Refinements in Mesh can be marked as initial (to prevent taking them back), /// this parameter serves to prevent taking them back with this method. /// \param[in] only_unrefine_space_data Useful when more spaces share the mesh if one wants to unrefine the underlying /// Mesh only once, but wants other spaces know about the change. @@ -450,7 +451,8 @@ namespace Hermes void update_orders_recurrent(Element* e, int order); - virtual void reset_dof_assignment(); ///< Resets assignment of DOF to an unassigned state. + /// Resets assignment of DOF to an unassigned state. + virtual void reset_dof_assignment(); virtual void assign_vertex_dofs() = 0; virtual void assign_edge_dofs() = 0; virtual void assign_bubble_dofs() = 0; @@ -463,8 +465,8 @@ namespace Hermes double* chol_p; /// Used for bc projection. - Hermes::vector bc_data_projections; - Hermes::vector::BaseComponent*> bc_data_base_components; + std::vector bc_data_projections; + std::vector::BaseComponent*> bc_data_base_components; void precalculate_projection_matrix(int nv, double**& mat, double*& p); void update_edge_bc(Element* e, SurfPos* surf_pos); @@ -506,10 +508,11 @@ namespace Hermes friend class Views::Orderizer; friend class Views::OrderView; template friend class Views::VectorBaseView; - friend class Adapt; - friend class DiscreteProblem; - friend class DiscreteProblemDGAssembler; - friend class DiscreteProblemThreadAssembler; + friend class Adapt < Scalar > ; + friend class DiscreteProblem < Scalar > ; + friend class DiscreteProblemDGAssembler < Scalar > ; + friend class DiscreteProblemThreadAssembler < Scalar > ; + friend class DiscreteProblemIntegrationOrderCalculator < Scalar > ; }; } } diff --git a/hermes2d/include/space/space_h1.h b/hermes2d/include/space/space_h1.h index b8f43ceeac..7afff68b4a 100644 --- a/hermes2d/include/space/space_h1.h +++ b/hermes2d/include/space/space_h1.h @@ -23,7 +23,6 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup spaces /// H1Space represents a space of continuous Scalar functions over a domain (mesh).
/// Typical usage:
/// ...
@@ -33,7 +32,7 @@ namespace Hermes /// int globalPolynomialOrder = 4;
/// SpaceSharedPtr space(&mesh, &bcs, globalPolynomialOrder);
template - class HERMES_API H1Space : public Space + class HERMES_API H1Space : public Space < Scalar > { public: H1Space(); @@ -45,7 +44,7 @@ namespace Hermes virtual ~H1Space(); - virtual void set_shapeset(Shapeset* shapeset); + virtual void set_shapeset(Shapeset* shapeset, bool clone = false); virtual Scalar* get_bc_projection(SurfPos* surf_pos, int order, EssentialBoundaryCondition *bc); diff --git a/hermes2d/include/space/space_hcurl.h b/hermes2d/include/space/space_hcurl.h index 6aa348f76e..6f015bf471 100644 --- a/hermes2d/include/space/space_hcurl.h +++ b/hermes2d/include/space/space_hcurl.h @@ -19,11 +19,10 @@ #include "space.h" namespace Hermes { - namespace Hermes2D - { - /// @ingroup spaces - /// HcurlSpace represents a space of vector functions with continuous tangent
- /// components over a domain (mesh).
+ namespace Hermes2D + { + /// HcurlSpace represents a space of vector functions with continuous tangent
+ /// components over a domain (mesh).
/// Typical usage:
/// ...
/// Hermes::Hermes2D::EssentialBCs > bcs(&bc_essential1, &bc_essential2, ...);
@@ -31,42 +30,42 @@ namespace Hermes /// // Initialize space.
/// int globalPolynomialOrder = 4;
/// Hermes::Hermes2D::HcurlSpace > space(&mesh, &bcs, globalPolynomialOrder);
- template - class HERMES_API HcurlSpace : public Space - { - public: - HcurlSpace(); - HcurlSpace(MeshSharedPtr mesh, EssentialBCs* boundary_conditions, int p_init = 1, - Shapeset* shapeset = nullptr); + template + class HERMES_API HcurlSpace : public Space < Scalar > + { + public: + HcurlSpace(); + HcurlSpace(MeshSharedPtr mesh, EssentialBCs* boundary_conditions, int p_init = 1, + Shapeset* shapeset = nullptr); - HcurlSpace(MeshSharedPtr mesh, int p_init = 1, - Shapeset* shapeset = nullptr); + HcurlSpace(MeshSharedPtr mesh, int p_init = 1, + Shapeset* shapeset = nullptr); - virtual ~HcurlSpace(); + virtual ~HcurlSpace(); - virtual void set_shapeset(Shapeset* shapeset); + virtual void set_shapeset(Shapeset* shapeset, bool clone = false); - virtual Scalar* get_bc_projection(SurfPos* surf_pos, int order, EssentialBoundaryCondition *bc); + virtual Scalar* get_bc_projection(SurfPos* surf_pos, int order, EssentialBoundaryCondition *bc); - /// Copy from Space instance 'space' - virtual void copy(SpaceSharedPtr space, MeshSharedPtr new_mesh); - protected: + /// Copy from Space instance 'space' + virtual void copy(SpaceSharedPtr space, MeshSharedPtr new_mesh); + protected: - virtual SpaceType get_type() const { return HERMES_HCURL_SPACE; } + virtual SpaceType get_type() const { return HERMES_HCURL_SPACE; } - /// Common code for the constructors. + /// Common code for the constructors. void init(Shapeset* shapeset, int p_init, bool assign_dofs_init = true); - virtual void assign_vertex_dofs() {} - virtual void assign_edge_dofs(); - virtual void assign_bubble_dofs(); + virtual void assign_vertex_dofs() {} + virtual void assign_edge_dofs(); + virtual void assign_bubble_dofs(); - virtual void get_vertex_assembly_list(Element* e, int iv, AsmList* al) const {} - virtual void get_boundary_assembly_list_internal(Element* e, int surf_num, AsmList* al) const; + virtual void get_vertex_assembly_list(Element* e, int iv, AsmList* al) const {} + virtual void get_boundary_assembly_list_internal(Element* e, int surf_num, AsmList* al) const; void update_constrained_nodes(Element* e, typename Space::EdgeInfo* ei0, typename Space::EdgeInfo* ei1, typename Space::EdgeInfo* ei2, typename Space::EdgeInfo* ei3); - virtual void update_constraints(); - }; - } + virtual void update_constraints(); + }; + } } #endif diff --git a/hermes2d/include/space/space_hdiv.h b/hermes2d/include/space/space_hdiv.h index 0fbe37fbb5..6a882024ff 100644 --- a/hermes2d/include/space/space_hdiv.h +++ b/hermes2d/include/space/space_hdiv.h @@ -20,11 +20,10 @@ namespace Hermes { - namespace Hermes2D - { - /// @ingroup spaces - /// HdivSpace represents a space of vector functions with continuous normal
- /// components over a domain (mesh).
+ namespace Hermes2D + { + /// HdivSpace represents a space of vector functions with continuous normal
+ /// components over a domain (mesh).
/// Typical usage:
/// ...
/// Hermes::Hermes2D::EssentialBCs > bcs(&bc_essential1, &bc_essential2, ...);
@@ -32,42 +31,42 @@ namespace Hermes /// // Initialize space.
/// int globalPolynomialOrder = 4;
/// Hermes::Hermes2D::HdivSpace > space(&mesh, &bcs, globalPolynomialOrder);
- template - class HERMES_API HdivSpace : public Space - { - public: - HdivSpace(); - HdivSpace(MeshSharedPtr mesh, EssentialBCs* boundary_conditions, int p_init = 1, - Shapeset* shapeset = nullptr); + template + class HERMES_API HdivSpace : public Space < Scalar > + { + public: + HdivSpace(); + HdivSpace(MeshSharedPtr mesh, EssentialBCs* boundary_conditions, int p_init = 1, + Shapeset* shapeset = nullptr); - HdivSpace(MeshSharedPtr mesh, int p_init = 1, - Shapeset* shapeset = nullptr); + HdivSpace(MeshSharedPtr mesh, int p_init = 1, + Shapeset* shapeset = nullptr); - virtual ~HdivSpace(); + virtual ~HdivSpace(); - virtual void set_shapeset(Shapeset* shapeset); + virtual void set_shapeset(Shapeset* shapeset, bool clone = false); - virtual Scalar* get_bc_projection(SurfPos* surf_pos, int order, EssentialBoundaryCondition *bc); + virtual Scalar* get_bc_projection(SurfPos* surf_pos, int order, EssentialBoundaryCondition *bc); - /// Copy from Space instance 'space' - virtual void copy(SpaceSharedPtr space, MeshSharedPtr new_mesh); - protected: - /// Common code for the constructors. + /// Copy from Space instance 'space' + virtual void copy(SpaceSharedPtr space, MeshSharedPtr new_mesh); + protected: + /// Common code for the constructors. void init(Shapeset* shapeset, int p_init, bool assign_dofs_init = true); - virtual SpaceType get_type() const { return HERMES_HDIV_SPACE; } + virtual SpaceType get_type() const { return HERMES_HDIV_SPACE; } - virtual void assign_vertex_dofs() {} - virtual void assign_edge_dofs(); - virtual void assign_bubble_dofs(); + virtual void assign_vertex_dofs() {} + virtual void assign_edge_dofs(); + virtual void assign_bubble_dofs(); - virtual void get_vertex_assembly_list(Element* e, int iv, AsmList* al) const {} - virtual void get_boundary_assembly_list_internal(Element* e, int surf_num, AsmList* al) const; - virtual void get_bubble_assembly_list(Element* e, AsmList* al) const; + virtual void get_vertex_assembly_list(Element* e, int iv, AsmList* al) const {} + virtual void get_boundary_assembly_list_internal(Element* e, int surf_num, AsmList* al) const; + virtual void get_bubble_assembly_list(Element* e, AsmList* al) const; void update_constrained_nodes(Element* e, typename Space::EdgeInfo* ei0, typename Space::EdgeInfo* ei1, typename Space::EdgeInfo* ei2, typename Space::EdgeInfo* ei3); virtual void update_constraints(); - }; - } + }; + } } #endif diff --git a/hermes2d/include/space/space_l2.h b/hermes2d/include/space/space_l2.h index 7caf3b0c15..093498540b 100644 --- a/hermes2d/include/space/space_l2.h +++ b/hermes2d/include/space/space_l2.h @@ -21,7 +21,6 @@ namespace Hermes { namespace Hermes2D { - /// @ingroup spaces /// L2Space represents a space of Scalar functions with discontinuities along /// mesh edges.
/// Typical usage:
@@ -31,7 +30,7 @@ namespace Hermes /// int globalPolynomialOrder = 4;
/// Hermes::Hermes2D::L2Space space(&mesh, &bcs, globalPolynomialOrder);
template - class HERMES_API L2Space : public Space + class HERMES_API L2Space : public Space < Scalar > { public: L2Space(); @@ -51,7 +50,7 @@ namespace Hermes return H2D_MAKE_EDGE_ORDER(e->get_mode(), edge, this->edata[e->id].order); } - virtual void set_shapeset(Shapeset* shapeset); + virtual void set_shapeset(Shapeset* shapeset, bool clone = false); virtual SpaceType get_type() const { return HERMES_L2_SPACE; } @@ -68,11 +67,10 @@ namespace Hermes template friend class Space::ReferenceSpaceCreator; }; - /// @ingroup spaces /// L2MarkerWiseConstSpace represents a space of material-wise constant functions. /// It is, of course, discontinuous, therefore it uses L2Space as a basis. template - class HERMES_API L2MarkerWiseConstSpace : public L2Space + class HERMES_API L2MarkerWiseConstSpace : public L2Space < Scalar > { public: L2MarkerWiseConstSpace(MeshSharedPtr mesh); diff --git a/hermes2d/include/spline.h b/hermes2d/include/spline.h index 1e795338d2..bdbabd590d 100644 --- a/hermes2d/include/spline.h +++ b/hermes2d/include/spline.h @@ -22,11 +22,11 @@ namespace Hermes { namespace Hermes2D { - class HERMES_API CubicSpline : public Hermes::Hermes1DFunction + class HERMES_API CubicSpline : public Hermes::Hermes1DFunction < double > { public: /// Constructor (general case). - CubicSpline(Hermes::vector points, Hermes::vector values, + CubicSpline(std::vector points, std::vector values, double bc_left, double bc_right, bool first_der_left = true, bool first_der_right = true, bool extend_der_left = true, bool extend_der_right = true); @@ -69,10 +69,10 @@ namespace Hermes /// Extrapolate the value of the spline outside of its interval of definition. double extrapolate_value(double point_end, double value_end, double derivative_end, double x_in) const; /// Grid points, ordered. - Hermes::vector points; + std::vector points; /// Values at the grid points. - Hermes::vector values; + std::vector values; /// Boundary conditions. double bc_left, bc_right; @@ -94,7 +94,7 @@ namespace Hermes double point_right, value_right, derivative_right; /// A set of four coefficients a, b, c, d for an elementary cubic spline. - Hermes::vector coeffs; + std::vector coeffs; /// Gets derivative at a point that lies in interval 'm'. double get_derivative_from_interval(double x_in, int m) const; diff --git a/hermes2d/include/sub_element_map.h b/hermes2d/include/sub_element_map.h deleted file mode 100644 index a72cc7ca92..0000000000 --- a/hermes2d/include/sub_element_map.h +++ /dev/null @@ -1,138 +0,0 @@ -// This file is part of Hermes2D. -// -// Hermes2D is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// Hermes2D 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 Hermes2D. If not, see . -#ifndef __H2D_SUB_ELEMENT_MAP_H -#define __H2D_SUB_ELEMENT_MAP_H - -#include "exceptions.h" -#include "function/transformable.h" - -namespace Hermes -{ - namespace Hermes2D - { - /// Sub-Element maps - used for replacing std::map. - template - class SubElementMap - { - template friend class Function; - friend class RefMap; - typedef void (*ProcessingFunction)(T* data); - public: - SubElementMap() - { - } - ~SubElementMap() - { - this->clear(); - } - void clear() - { - this->root.clear_subtree(); - memset(this->root.children, 0, 8 * sizeof(Node*)); - this->root.data = nullptr; - } - - void run_for_all(ProcessingFunction f) - { - run_for_node(&this->root, f); - this->root.data = nullptr; - } - - private: - class Node - { - public: - Node() : data(nullptr) - { - init(); - } - Node(T* data) : data(data) - { - init(); - } - T* data; - Node* children[8]; - void clear_subtree() - { - for(int i = 0; i < 8; i++) - { - if(this->children[i] != nullptr) - { - this->children[i]->clear_subtree(); - delete this->children[i]; - } - } - } - private: - void init() - { - memset(this->children, 0, 8 * sizeof(Node*)); - } - }; - - public: - void run_for_node(Node* node, ProcessingFunction f) - { - for(int i = 0; i < 8; i++) - { - if(node->children[i] != nullptr) - run_for_node(node->children[i], f); - } - if(node->data != nullptr) - f(node->data); - } - - Node* get(uint64_t sub_idx, bool& to_add) - { - if(sub_idx == 0) - { - if(root.data != nullptr) - to_add = false; - return &root; - } - Node* node = &root; - bool added = false; - int sons[Transformable::H2D_MAX_TRN_LEVEL]; - int sons_count = 0; - while (sub_idx > 0) - { - sons[sons_count++] = (sub_idx - 1) & 7; - sub_idx = (sub_idx - 1) >> 3; - } - - for(int i = sons_count - 1; i >= 0 ; i--) - { - Node* child_node = node->children[sons[i]]; - if(child_node == nullptr) - if(to_add) - { - added = true; - child_node = node->children[sons[i]] = new Node(nullptr); - } - else - return nullptr; - node = child_node; - } - if(!added && node->data != nullptr) - to_add = false; - return node; - } - - Node root; - }; - } -} - -#endif diff --git a/hermes2d/include/views/base_view.h b/hermes2d/include/views/base_view.h index a4deb7fad9..033912027c 100644 --- a/hermes2d/include/views/base_view.h +++ b/hermes2d/include/views/base_view.h @@ -50,7 +50,6 @@ namespace Hermes protected: SpaceSharedPtr space; - PrecalcShapeset* pss; MeshFunctionSharedPtr sln; MeshFunctionSharedPtr complex_filter; diff --git a/hermes2d/include/views/linearizer.h b/hermes2d/include/views/linearizer.h index a491b69e95..4c35635317 100644 --- a/hermes2d/include/views/linearizer.h +++ b/hermes2d/include/views/linearizer.h @@ -12,13 +12,18 @@ // // You should have received a copy of the GNU General Public License // along with Hermes2D. If not, see . +/*! \file linearizer.h +\brief File containing LinearizerMultidimensional class. +*/ #ifndef __H2D_LINEARIZER_H #define __H2D_LINEARIZER_H #include "thread_linearizer.h" #include "linearizer_utils.h" +#ifndef NOGLUT #include +#endif #include "../function/solution.h" namespace Hermes @@ -34,6 +39,7 @@ namespace Hermes /// exported to standard formats. The class correctly handles discontinuities in the /// solution (e.g., gradients or in Hcurl) by inserting double vertices where necessary. /// LinearizerMultidimensional also serves as a container for the resulting linearized mesh. + /// LinearizerMultidimensional serves the purpose of both scalar and vector data. template class HERMES_API LinearizerMultidimensional : public Hermes::Mixins::TimeMeasurable, @@ -41,7 +47,9 @@ namespace Hermes public Hermes::Hermes2D::Mixins::Parallel { public: - LinearizerMultidimensional(LinearizerOutputType linearizerOutputType, bool auto_max = true); + /// Constructor. + /// \param[in] linearizerOutputType Sets this instance to be either for OpenGL visualization (Hermes Views, Agros display), or saving the output to a file (VTK, Tecplot) + LinearizerMultidimensional(LinearizerOutputType linearizerOutputType); ~LinearizerMultidimensional(); /// Main method - processes the solution and stores the data obtained by the process. @@ -52,46 +60,64 @@ namespace Hermes /// Save a MeshFunction (Solution, Filter) in VTK format. void save_solution_vtk(MeshFunctionSharedPtr sln, const char* filename, const char* quantity_name, bool mode_3D = true, int item = H2D_FN_VAL_0); - void save_solution_vtk(Hermes::vector > slns, Hermes::vector items, const char* filename, const char* quantity_name, bool mode_3D = true); + /// Save multiple MeshFunctions (Solutions, Filters) in VTK format. + void save_solution_vtk(std::vector > slns, std::vector items, const char* filename, const char* quantity_name, bool mode_3D = true); + /// Save a MeshFunction (Solution, Filter) in Tecplot format. void save_solution_tecplot(MeshFunctionSharedPtr sln, const char* filename, const char* quantity_name, int item = H2D_FN_VAL_0); - void save_solution_tecplot(Hermes::vector > slns, Hermes::vector items, const char* filename, Hermes::vector quantity_names); + /// Save multiple MeshFunctions (Solutions, Filters) in Tecplot format. + void save_solution_tecplot(std::vector > slns, std::vector items, const char* filename, std::vector quantity_names); + /// Sets the criterion to use for the linearization process. + /// This criterion is used in ThreadLinearizerMultidimensional class instances (see threadLinearizerMultidimensional array). + /// \param[in] criterion The instance of the criterion - see the class LinearizerCriterion for details (method split_decision() for the adaptive criterion, process_[triangle|quad] for the fixed one). void set_criterion(LinearizerCriterion criterion); /// Set the displacement, i.e. set two functions that will deform the domain for visualization, in the x-direction, and the y-direction. void set_displacement(MeshFunctionSharedPtr xdisp, MeshFunctionSharedPtr ydisp, double dmult = 1.0); /// Iterator class. + /// Use for iterating through the data structures distributed over threads template - class Iterator + class HERMES_API Iterator { public: + /// Constructor + /// \param[in] linearizer - the linearizer to whose data to iterate through Iterator(const LinearizerMultidimensional* linearizer); + /// Move the iterator forward void operator++(); + /// Get the data the iterator points to now. T& get() const; /// For triangle- and edge- markers. int& get_marker() const; + /// The iterator has reached the end of the data. bool end; private: int current_thread_index; int current_thread; int current_thread_size; - Hermes::vector thread_sizes; + std::vector thread_sizes; const LinearizerMultidimensional* linearizer; void check_zero_lengths(); friend class LinearizerMultidimensional; }; - /// Begin - iterators. + /// Return the appropriate iterator pointing to the beginning. Iterator vertices_begin() const; + /// Return the appropriate iterator pointing to the beginning. Iterator triangles_begin() const; + /// Return the appropriate iterator pointing to the beginning. Iterator edges_begin() const; + /// Return the appropriate iterator pointing to the beginning. Iterator triangle_indices_begin() const; - /// Counts + /// Vertex count per all threads. int get_vertex_count() const; + /// Triangle per all threads. int get_triangle_count() const; + /// Edge count per all threads. int get_edge_count() const; + /// Triangle index count per all threads. int get_triangle_index_count() const; void set_max_absolute_value(double max_abs); @@ -125,6 +151,8 @@ namespace Hermes protected: Quad2D *old_quad[LinearizerDataDimensions::dimension], *old_quad_x, *old_quad_y; + /// Output type setting either the OpenGL or File output. + /// This attribute influences the data that are produced - not all data are needed for both cases. LinearizerOutputType linearizerOutputType; /// Before assembling. @@ -135,7 +163,7 @@ namespace Hermes void init(MeshFunctionSharedPtr* sln, int* item); - Hermes::vector meshes; + std::vector meshes; /// Standard and curvature epsilon. double curvature_epsilon; @@ -160,17 +188,18 @@ namespace Hermes void finish(MeshFunctionSharedPtr* sln); Traverse::State** states; - - int num_states; + unsigned int num_states; double min_val, max_val; void find_min_max(); - friend class ThreadLinearizerMultidimensional; + friend class ThreadLinearizerMultidimensional < LinearizerDataDimensions > ; }; + /// Linearizer for scalar cases - historically called Linearizer. typedef LinearizerMultidimensional > Linearizer; + /// Linearizer for vector cases - historically called Vectorizer. typedef LinearizerMultidimensional > Vectorizer; } } diff --git a/hermes2d/include/views/linearizer_utils.h b/hermes2d/include/views/linearizer_utils.h index 444a3b38c5..070468e6ad 100644 --- a/hermes2d/include/views/linearizer_utils.h +++ b/hermes2d/include/views/linearizer_utils.h @@ -12,7 +12,9 @@ // // You should have received a copy of the GNU General Public License // along with Hermes2D. If not, see . - +/*! \file linearizer_utils.h +\brief File containing utilities for class. +*/ #ifndef __H2D_LINEARIZER_UTILS_H #define __H2D_LINEARIZER_UTILS_H @@ -26,23 +28,36 @@ namespace Hermes { /// Standard "quality" defining constants. const double HERMES_EPS_VERYLOW = 0.25; + /// Standard "quality" defining constants. const double HERMES_EPS_LOW = 0.05; + /// Standard "quality" defining constants. const double HERMES_EPS_NORMAL = 0.01; + /// Standard "quality" defining constants. const double HERMES_EPS_HIGH = 0.005; + /// Standard "quality" defining constants. const double HERMES_EPS_VERYHIGH = 0.001; #ifndef LINEARIZER_DATA_TYPE #define LINEARIZER_DATA_TYPE double #endif + /// We refine a quad directionally (horizontally, vertically) only if the error in one direction is this much larger than in the other. +#ifndef LINEARIZER_DIRECTIONAL_QUAD_REFINEMENT_REQUIREMENT +#define LINEARIZER_DIRECTIONAL_QUAD_REFINEMENT_REQUIREMENT 5.0 +#endif + + /// Very important constant putting an upper bound on the maximum number of successive element division (when dealing with a higher-order FEM solution). +#define MAX_LINEARIZER_DIVISION_LEVEL 6 + /// Typedefs used throughout the Linearizer functionality. template struct ScalarLinearizerDataDimensions { }; + /// Typedefs used throughout the Linearizer functionality. template<> - struct ScalarLinearizerDataDimensions + struct ScalarLinearizerDataDimensions < float > { static const int dimension = 1; @@ -51,8 +66,9 @@ namespace Hermes typedef float3 vertex_t; }; + /// Typedefs used throughout the Linearizer functionality. template<> - struct ScalarLinearizerDataDimensions + struct ScalarLinearizerDataDimensions < double > { static const int dimension = 1; @@ -61,13 +77,15 @@ namespace Hermes typedef double3 vertex_t; }; + /// Typedefs used throughout the Linearizer functionality. template struct VectorLinearizerDataDimensions { }; + /// Typedefs used throughout the Linearizer functionality. template<> - struct VectorLinearizerDataDimensions + struct VectorLinearizerDataDimensions < float > { static const int dimension = 2; @@ -76,8 +94,9 @@ namespace Hermes typedef float4 vertex_t; }; + /// Typedefs used throughout the Linearizer functionality. template<> - struct VectorLinearizerDataDimensions + struct VectorLinearizerDataDimensions < double > { static const int dimension = 2; @@ -86,14 +105,16 @@ namespace Hermes typedef double4 vertex_t; }; + /// Typedefs used throughout the Linearizer functionality. typedef int3 internal_vertex_info_t; + /// Typedefs used throughout the Linearizer functionality. typedef int3 triangle_indices_t; template class HERMES_API ThreadLinearizerMultidimensional; -#define MAX_LINEARIZER_DIVISION_LEVEL 6 - + /// \brief Abstract class for criterion according to which the linearizer stops dividing elements at some point + /// Class is not abstract per say, but works as a base class for the following classes. class HERMES_API LinearizerCriterion { public: @@ -103,12 +124,17 @@ namespace Hermes bool adaptive; }; + /// \brief Adaptive Linearizer criterion - error tolerance (see further) where the element division stops + /// Error tolerance here is the relative improvement of quality that the currently proposed element division would bring. + /// If this quantity is below the specified tolerance, the currently proposed division is not made and the division algorithm for the current element stops. class HERMES_API LinearizerCriterionAdaptive : public LinearizerCriterion { public: LinearizerCriterionAdaptive(double error_tolerance); }; + /// \brief Simple Linearizer criterion - every element is refined exactly the same number of times. + /// This number is specified in the constructor. class HERMES_API LinearizerCriterionFixed : public LinearizerCriterion { public: diff --git a/hermes2d/include/views/mesh_view.h b/hermes2d/include/views/mesh_view.h index c37f354e3b..1ff86f078e 100644 --- a/hermes2d/include/views/mesh_view.h +++ b/hermes2d/include/views/mesh_view.h @@ -41,10 +41,13 @@ namespace Hermes MeshView(char* title, WinGeom* wg = nullptr); ~MeshView(); - void show (MeshSharedPtr mesh); + void show(MeshSharedPtr mesh); /// Displays element markers. void set_b_elem_mrk(bool set); + /// Returns the internal linearizer for the purpose of parameter settings. + Linearizer* get_linearizer(); + protected: Linearizer* lin; @@ -81,7 +84,7 @@ namespace Hermes void show(MeshSharedPtr mesh) { throw Hermes::Exceptions::Exception("GLUT disabled."); } void set_b_elem_mrk(bool set) { throw Hermes::Exceptions::Exception("GLUT disabled."); } }; -#pragma optimize( "g", on ) +#pragma optimize( "g", on ) #endif } } diff --git a/hermes2d/include/views/order_view.h b/hermes2d/include/views/order_view.h index 546a9eb926..451ba75c0c 100644 --- a/hermes2d/include/views/order_view.h +++ b/hermes2d/include/views/order_view.h @@ -26,7 +26,8 @@ namespace Hermes { // you can define NOGLUT to turn off all OpenGL stuff in Hermes2D #ifndef NOGLUT - static const int H2DV_MAX_VIEWABLE_ORDER = 10; ///< Maximum viewable order. + /// Maximum viewable order. + static const int H2DV_MAX_VIEWABLE_ORDER = 10; /// \brief Displays the polynomial degrees of elements. /// @@ -37,9 +38,9 @@ namespace Hermes public: OrderView(const char* title = "OrderView", WinGeom* wg = nullptr); - //#ifndef _MSC_VER + // #ifndef _MSC_VER // OrderView(const char* title = "OrderView", WinGeom* wg = nullptr); - //#endif + // #endif OrderView(char* title, WinGeom* wg = nullptr); template @@ -51,11 +52,15 @@ namespace Hermes bool b_orders; int num_boxes, order_min; - const char* box_names[H2DV_MAX_VIEWABLE_ORDER + 1]; ///< Pointers to order names. Pointers point inside OrderView::text_buffer. - char text_buffer[H2DV_MAX_VIEWABLE_ORDER*4]; ///< Text buffer which contains all order names. - float order_colors[H2DV_MAX_VIEWABLE_ORDER + 1][3]; ///< Order colors. Maximum order has to be accessible. + /// Pointers to order names. Pointers point inside OrderView::text_buffer. + const char* box_names[H2DV_MAX_VIEWABLE_ORDER + 1]; + /// Text buffer which contains all order names. + char text_buffer[H2DV_MAX_VIEWABLE_ORDER * 4]; + /// Order colors. Maximum order has to be accessible. + float order_colors[H2DV_MAX_VIEWABLE_ORDER + 1][3]; - void init_order_palette(double3* vert); ///< Initializes the palette from supplied vertices. + /// Initializes the palette from supplied vertices. + void init_order_palette(double3* vert); virtual void on_display(); virtual void on_key_down(unsigned char key, int x, int y); diff --git a/hermes2d/include/views/orderizer.h b/hermes2d/include/views/orderizer.h index 85fbe67333..4fc13d9172 100644 --- a/hermes2d/include/views/orderizer.h +++ b/hermes2d/include/views/orderizer.h @@ -18,7 +18,9 @@ #include "../space/space.h" #include "global.h" +#ifndef NOGLUT #include +#endif #include "../quadrature/quad_all.h" #include "../mesh/traverse.h" @@ -79,8 +81,10 @@ namespace Hermes #ifndef NOGLUT mutable pthread_mutex_t data_mutex; #endif - int2* edges; ///< edges: pairs of vertex indices - int* edge_markers; ///< edge_markers: edge markers, ordering equal to edges + /// edges: pairs of vertex indices + int2* edges; + /// edge_markers: edge markers, ordering equal to edges + int* edge_markers; void add_edge(int iv1, int iv2, int marker); /// Reallocation at the beginning of process_*. @@ -90,22 +94,27 @@ namespace Hermes char buffer[1000]; char* labels[11][11]; - double3* verts; ///< vertices: (x, y, value) triplets + /// vertices: (x, y, value) triplets + double3* verts; int label_size, label_count; int* lvert; char** ltext; double2* lbox; - int3* tris; ///< triangles: vertex index triplets - int* tri_markers;///< triangle_markers: triangle markers, ordering equal to tris + /// triangles: vertex index triplets + int3* tris; + /// triangle_markers: triangle markers, ordering equal to tris + int* tri_markers; - int vertex_count, triangle_count, edges_count; ///< Real numbers of vertices, triangles and edges - int vertex_size, triangle_size, edges_size; ///< Size of arrays of vertices, triangles and edges + /// Real numbers of vertices, triangles and edges + int vertex_count, triangle_count, edges_count; + /// Size of arrays of vertices, triangles and edges + int vertex_size, triangle_size, edges_size; void add_triangle(int iv0, int iv1, int iv2, int marker); static void calc_aabb(double* x, double* y, int stride, int num, double* min_x, double* max_x, double* min_y, double* max_y); - + int add_vertex(); void make_vert(int & index, double x, double y, double val); diff --git a/hermes2d/include/views/scalar_view.h b/hermes2d/include/views/scalar_view.h index 4212f1602f..7141db0c5c 100644 --- a/hermes2d/include/views/scalar_view.h +++ b/hermes2d/include/views/scalar_view.h @@ -12,9 +12,9 @@ // // You should have received a copy of the GNU General Public License // along with Hermes2D. If not, see . - -// $Id: scalar_view.h 1086 2008-10-21 09:05:44Z jakub $ - +/*! \file scalar_view.h +\brief File containing ScalarView class. +*/ #ifndef __H2D_SCALAR_VIEW_H #define __H2D_SCALAR_VIEW_H @@ -50,6 +50,12 @@ namespace Hermes void show(MeshFunctionSharedPtr sln, int item = H2D_FN_VAL_0, MeshFunctionSharedPtr xdisp = nullptr, MeshFunctionSharedPtr ydisp = nullptr, double dmult = 1.0); + void show(MeshFunctionSharedPtr > sln, int item = H2D_FN_VAL_0, + MeshFunctionSharedPtr xdisp = nullptr, MeshFunctionSharedPtr ydisp = nullptr, double dmult = 1.0) + { + throw Exceptions::Exception("Visualization of complex 2D solution is not possible, please use a filter that converts the solution into a real function, then display that one."); + } + void show_linearizer_data(double eps, int item = H2D_FN_VAL_0); inline void show_mesh(bool show = true) { show_edges = show; refresh(); } @@ -57,14 +63,22 @@ namespace Hermes void show_contours(double step, double orig = 0.0); inline void hide_contours() { contours = false; refresh(); } void set_3d_mode(bool enable = true); - void set_vertical_scaling(double sc); ///< Sets the scaling on the vertical axis programmatically. - void set_min_max_range(double min, double max); ///< Sets the limits on displayed values. + /// Sets the scaling on the vertical axis programmatically. + void set_vertical_scaling(double sc); + /// Sets the limits on displayed values. + void set_min_max_range(double min, double max); - virtual void reset_view(bool force_reset); ///< Resets 2d and 3d view. + /// Resets 2d and 3d view. + virtual void reset_view(bool force_reset); /// Returns the internal linearizer for the purpose of parameter settings. Linearizer* get_linearizer(); + /// Sets the criterion to use for the linearization process. + /// This criterion is used in ThreadLinearizerMultidimensional class instances (see threadLinearizerMultidimensional array). + /// \param[in] criterion The instance of the criterion - see the class LinearizerCriterion for details (method split_decision() for the adaptive criterion, process_[triangle|quad] for the fixed one). + void set_linearizer_criterion(LinearizerCriterion criterion); + protected: /// LinearizerMultidimensional class responsible for obtaining linearized data. Linearizer* lin; @@ -72,21 +86,30 @@ namespace Hermes protected: struct ElementInfo ///< element info structure { - float x, y; ///< location of center[in physical coordinates] - float width, height; ///< width, height of AABB[in physical coordinates] - int id; ///< element ID + /// location of center[in physical coordinates] + float x, y; + /// width, height of AABB[in physical coordinates] + float width, height; + /// element ID + int id; ElementInfo() : x(0), y(0), width(0), height(0), id(-1) {}; ElementInfo(int id, float x, float y, float width, float height) : x(x), y(y), width(width), height(height), id(id) {}; }; - Hermes::vector element_infos; ///< Element info. + /// Element info. + std::vector element_infos; - unsigned int element_id_widget; ///< A GL display-list denoting a element ID widget. The geometry assumes the size of a pixel is 1x1. + /// A GL display-list denoting a element ID widget. The geometry assumes the size of a pixel is 1x1. + unsigned int element_id_widget; - bool show_element_info; ///< true, to draw element info (currently ID) in 2D mode + /// true, to draw element info (currently ID) in 2D mode + bool show_element_info; - void init_element_info(MeshSharedPtr mesh); ///< Creates element info from mesh. - void create_element_info_widgets(); ///< Creates element ID widgets if not created already. - void draw_element_infos_2d(); ///< Draws elements infos in 2D mode. + /// Creates element info from mesh. + void init_element_info(MeshSharedPtr mesh); + /// Creates element ID widgets if not created already. + void create_element_info_widgets(); + /// Draws elements infos in 2D mode. + void draw_element_infos_2d(); protected: //values #define H2DV_GL_MAX_EDGE_BUFFER 128 ///< A maximum number of pairs per a buffer. @@ -98,44 +121,67 @@ namespace Hermes float coord; GLVertex2() {}; GLVertex2(float x, float y, float coord) : x(x), y(y), coord(coord) {}; - static const size_t H2D_OFFSETOF_COORD = 2*sizeof(float); ///< Offset of coordinate + /// Offset of coordinate + static const size_t H2D_OFFSETOF_COORD = 2 * sizeof(float); }; #pragma pack(pop) - bool lin_updated; ///< true, if lin now contains new_ values + /// true, if lin now contains new_ values + bool lin_updated; - int max_gl_verts; ///< A maximum allocated number of vertices - int max_gl_tris; ///< A maximum allocated number of triangles - int gl_tri_cnt; ///< A number of OpenGL triangles + /// A maximum allocated number of vertices + int max_gl_verts; + /// A maximum allocated number of triangles + int max_gl_tris; + /// A number of OpenGL triangles + int gl_tri_cnt; - bool show_values; ///< true to show values + /// true to show values + bool show_values; - void prepare_gl_geometry(); ///< prepares geometry in a form compatible with GL arrays; Data are updated if lin is updated. In a case of a failure (out of memory), gl_verts is nullptr and an old OpenGL rendering method has to be used. - void draw_values_2d(); ///< draws values - void draw_edges_2d(); ///< draws edges + /// prepares geometry in a form compatible with GL arrays; Data are updated if lin is updated. In a case of a failure (out of memory), gl_verts is nullptr and an old OpenGL rendering method has to be used. + void prepare_gl_geometry(); + /// draws values + void draw_values_2d(); + /// draws edges + void draw_edges_2d(); protected: //edges - bool show_edges; ///< true to show edges of mesh - bool show_aabb; ///< true to show the bounding box - float edges_color[3]; ///< color of edges + /// true to show edges of mesh + bool show_edges; + /// true to show the bounding box + bool show_aabb; + /// color of edges + float edges_color[3]; - typedef void (*DrawSingleEdgeCallback)(int inx_vert_a, int inx_vert_b, ScalarView* viewer, void* param); ///< A callback function that draws edge using specified vertex indices. Param is user supplied parameter. + /// A callback function that draws edge using specified vertex indices. Param is user supplied parameter. + typedef void(*DrawSingleEdgeCallback)(int inx_vert_a, int inx_vert_b, ScalarView* viewer, void* param); - void calculate_mesh_aabb(double* x_min, double* x_max, double* y_min, double* y_max); ///< Calculates AABB from edges. + /// Calculates AABB from edges. + void calculate_mesh_aabb(double* x_min, double* x_max, double* y_min, double* y_max); - void draw_aabb(); ///< Draws the axes-aligned bounding box of the model. Assumes a model/view matrix to be the current matrix on the OpenGL stack. + /// Draws the axes-aligned bounding box of the model. Assumes a model/view matrix to be the current matrix on the OpenGL stack. + void draw_aabb(); protected: - bool contours; ///< true to enable drawing of contours - double cont_orig, cont_step; ///< contour settings. - float cont_color[3]; ///< color of contours (RGB) - bool do_zoom_to_fit; ///< true to automatically translate the view so that the whole model si displayed - bool is_constant; ///< true if the function to be displayed is constant + /// true to enable drawing of contours + bool contours; + /// contour settings. + double cont_orig, cont_step; + /// color of contours (RGB) + float cont_color[3]; + /// true to automatically translate the view so that the whole model si displayed + bool do_zoom_to_fit; + /// true if the function to be displayed is constant + bool is_constant; // Perspective projection parameters. - static const int fovy; ///< Field of view in the vertical direction (in degrees). - static const double znear; ///< Distance of the near clipping plane of the viewing frustum from the camera. - static const double zfar; ///< Distance of the Far clipping plane of the viewing frustum from the camera. + /// Field of view in the vertical direction (in degrees). + static const int fovy; + /// Distance of the near clipping plane of the viewing frustum from the camera. + static const double znear; + /// Distance of the Far clipping plane of the viewing frustum from the camera. + static const double zfar; bool pmode, mode3d, panning; double xrot, yrot, xtrans, ytrans, ztrans; @@ -156,12 +202,15 @@ namespace Hermes /// 3. Compute the distance (along z-axis) from the origin to the center of perspective projection of the point with the /// biggest horizontal (x-axis) distance from the origin. /// 4. Take the bigger of the two distances and reverse sign (since we will translate the model, not the camera) - double calculate_ztrans_to_fit_view(); ///< Calculates the z-coordinate (in eye coordinates) of the closest viewpoint from which we can still see the whole model. Assumes a model/view matrix to be the current matrix on the OpenGL stack. - virtual void update_layout(); ///< Updates layout, i.e., centers 2d and 3d mesh. + /// Calculates the z-coordinate (in eye coordinates) of the closest viewpoint from which we can still see the whole model. Assumes a model/view matrix to be the current matrix on the OpenGL stack. + double calculate_ztrans_to_fit_view(); + /// Updates layout, i.e., centers 2d and 3d mesh. + virtual void update_layout(); void draw_tri_contours(ScalarLinearizerDataDimensions::triangle_t&); void init_lighting(); - void update_mesh_info(); ///< Updates mesh info. Assumes that data lock is locked. + /// Updates mesh info. Assumes that data lock is locked. + void update_mesh_info(); virtual void on_display(); void on_display_2d(); @@ -169,22 +218,31 @@ namespace Hermes virtual void on_key_down(unsigned char key, int x, int y); virtual void on_mouse_move(int x, int y); - virtual void on_right_mouse_down(int x, int y); ///< Handles selecting/deselecting of nodes. + /// Handles selecting/deselecting of nodes. + virtual void on_right_mouse_down(int x, int y); virtual void on_middle_mouse_down(int x, int y); virtual void on_middle_mouse_up(int x, int y); virtual const char* get_help_text() const; virtual void on_close(); }; #else -class HERMES_API ScalarView : public View + class HERMES_API ScalarView : public View { public: - void init() { throw Hermes::Exceptions::Exception("GLUT disabled."); } + void init() { throw Hermes::Exceptions::Exception("GLUT disabled."); } ScalarView(const char* title = "ScalarView", WinGeom* wg = nullptr) {} ScalarView(char* title, WinGeom* wg = nullptr) {} void show(MeshFunctionSharedPtr sln, int item = H2D_FN_VAL_0, - MeshFunctionSharedPtr xdisp = nullptr, MeshFunctionSharedPtr ydisp = nullptr, double dmult = 1.0) { throw Hermes::Exceptions::Exception("GLUT disabled."); } + MeshFunctionSharedPtr xdisp = nullptr, MeshFunctionSharedPtr ydisp = nullptr, double dmult = 1.0) { + throw Hermes::Exceptions::Exception("GLUT disabled."); + } + + void show(MeshFunctionSharedPtr > sln, int item = H2D_FN_VAL_0, + MeshFunctionSharedPtr xdisp = nullptr, MeshFunctionSharedPtr ydisp = nullptr, double dmult = 1.0) + { + throw Exceptions::Exception("Visualization of complex 2D solution is not possible, please use a filter that converts the solution into a real function, then display that one."); + } void show_linearizer_data(double eps, int item = H2D_FN_VAL_0) { throw Hermes::Exceptions::Exception("GLUT disabled."); } @@ -195,9 +253,11 @@ class HERMES_API ScalarView : public View inline void set_3d_mode(bool enable = true) { throw Hermes::Exceptions::Exception("GLUT disabled."); } void set_vertical_scaling(double sc) { throw Hermes::Exceptions::Exception("GLUT disabled."); } void set_min_max_range(double min, double max) { throw Hermes::Exceptions::Exception("GLUT disabled."); } + Linearizer* get_linearizer() { throw Hermes::Exceptions::Exception("GLUT disabled."); return nullptr; } + void set_linearizer_criterion(LinearizerCriterion criterion) { throw Hermes::Exceptions::Exception("GLUT disabled."); } }; #endif } } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/include/views/stream_view.h b/hermes2d/include/views/stream_view.h deleted file mode 100644 index fccd3e6446..0000000000 --- a/hermes2d/include/views/stream_view.h +++ /dev/null @@ -1,136 +0,0 @@ -// This file is part of Hermes2D. -// Hermes2D is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// Hermes2D 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 Hermes2D. If not, see . - -// $Id: view.h 1086 2008-10-21 09:05:44Z jakub $ - -#ifndef __H2D_STREAM_VIEW_H -#define __H2D_STREAM_VIEW_H -#include "view.h" - -namespace Hermes -{ - namespace Hermes2D - { - namespace Views - { - // you can define NOGLUT to turn off all OpenGL stuff in Hermes2D -#ifndef NOGLUT - - /// \brief Visualizes streamlines of a vector PDE solution. - /// - /// StreamView is a visualization window for all vector-valued PDE solutions (especially for flow problems). - /// - class HERMES_API StreamView : public View - { - public: - - StreamView(const char* title = "StreamView", WinGeom* wg = nullptr); - StreamView(char* title, WinGeom* wg = nullptr); - ~StreamView(); - - /// Using velocity components (xsln, ysln) it creates streamlines that begin at the boundary with "marker" - /// and the distance between starting points is "step" - void show(MeshFunctionSharedPtr xsln, MeshFunctionSharedPtr ysln, int marker, double step); - void show(MeshFunctionSharedPtr xsln, MeshFunctionSharedPtr ysln, int marker, double step, int xitem, int yitem); - - /// Creates additional streamline with strarting point (x, y) - /// Note: Can be called only after StreamView::show - void add_streamline(double x, double y); - - protected: - - struct Node - { - bool leaf; - int level; - Node* sons[2]; - int elements[100]; - int num_elem; - }; - - Vectorizer* vec; - double max_mag; - bool lines, pmode; - - double initial_tau; - double min_tau; - double max_tau; - int num_stream; - double2** streamlines; - int* streamlength; - Node* root; - double root_x_min; - double root_x_max; - double root_y_min; - double root_y_max; - - /// Recurent function that finds linearized triangle which contain point (x, y). - /// As side effect it returns bacycentric coordinates of point (x, y) in that triangle. - int find_triangle_in_tree(double x, double y, Node* father, double x_min, double x_max, double y_min, double y_max, double3& bar); - - /// Adds triangle to the kD-tree. - /// If father Node has more than 100 elements - /// it splits computation domain into 2 parts (vertically or horizontally). - void add_element_to_tree(Node* father, int e_idx, double x_min, double x_max, double y_min, double y_max); - - /// Builds kD-tree. - void build_tree(); - void delete_tree(Node* father); - - /// Tests whether given point (x, y) lies in given triangle - /// using barycentric coordinates (returned as side efect). - bool is_in_triangle(int idx, double x, double y, double3& bar); - - /// Gets values of velocities at given point using built kD-tree. - bool get_solution_values(double x, double y, double& xval, double& yval); - - /// Starts from initial point (x_start, y_start) - /// and using adaptive RK method finds streamline with "idx". - int create_streamline(double x_start, double y_start, int idx); - - /// Finds initial points for all steamlines along boundary with given marker - /// with "step" distance between each other. - void find_initial_points(int marker, double step, double2*& initial_points); - - /// Finds initial boundary edge - /// (one whose first vertex is not second vertex for any other edge). - int find_initial_edge(int num_edges, int3* edges); - - virtual void on_display(); - virtual void on_mouse_move(int x, int y); - virtual void on_key_down(unsigned char key, int x, int y); - virtual void on_left_mouse_down(int x, int y); - virtual const char* get_help_text() const; - }; -#else - class HERMES_API StreamView : public View - { - public: - StreamView(const char* title = "StreamView", WinGeom* wg = nullptr) { throw Hermes::Exceptions::Exception("GLUT disabled."); } - StreamView(char* title, WinGeom* wg = nullptr) { throw Hermes::Exceptions::Exception("GLUT disabled."); } - - /// Using velocity components (xsln, ysln) it creates streamlines that begin at the boundary with "marker" - /// and the distance between starting points is "step" - void show(MeshFunctionSharedPtr xsln, MeshFunctionSharedPtr ysln, int marker, double step) { throw Hermes::Exceptions::Exception("GLUT disabled."); } - void show(MeshFunctionSharedPtr xsln, MeshFunctionSharedPtr ysln, int marker, double step, int xitem, int yitem) { throw Hermes::Exceptions::Exception("GLUT disabled."); } - - /// Creates additional streamline with strarting point (x, y) - /// Note: Can be called only after StreamView::show - void add_streamline(double x, double y) { throw Hermes::Exceptions::Exception("GLUT disabled."); } - }; -#endif - } - } -} -#endif \ No newline at end of file diff --git a/hermes2d/include/views/thread_linearizer.h b/hermes2d/include/views/thread_linearizer.h index 3cdb331bd1..beaba0d994 100644 --- a/hermes2d/include/views/thread_linearizer.h +++ b/hermes2d/include/views/thread_linearizer.h @@ -12,6 +12,9 @@ // // You should have received a copy of the GNU General Public License // along with Hermes2D. If not, see . +/*! \file thread_linearizer.h +\brief File containing ThreadLinearizerMultidimensional class. +*/ #ifndef __H2D_THREAD_LINEARIZER_H #define __H2D_THREAD_LINEARIZER_H @@ -29,79 +32,106 @@ namespace Hermes { template class HERMES_API LinearizerMultidimensional; - + /// ThreadLinearizerMultidimensional is a utility class for linearizing a mesh function on a single thread + /// The main refinement (splitting) decision is contained in split_decision(). + /// Important - the instance of LinearizerCriterion (from LinearizerMultidimensional instance) - see the method split_decision() for the adaptive criterion, process_[triangle|quad] for the fixed one. template class HERMES_API ThreadLinearizerMultidimensional { public: /// Free the instance. void free(); - + private: + /// Constructor + /// \param[in] The linearizer this instance is being created for. ThreadLinearizerMultidimensional(LinearizerMultidimensional* linearizer); ~ThreadLinearizerMultidimensional(); + /// Get the data from the "parent" LinearizerMultidimensional class. void init_linearizer_data(LinearizerMultidimensional* linearizer); + /// Initialize arrays, clone functions etc for this run of processing. void init_processing(MeshFunctionSharedPtr* sln, LinearizerMultidimensional* linearizer); + /// Deinitialize the temporary data for this run of processing. void deinit_processing(); - - void process_state(Traverse::State* current_state); - - void set_min_value(double min); - void set_max_value(double max); + /// Completely process the state current_state + void process_state(Traverse::State* current_state); + /// Return the hash value of the couple of vertices with indices p1, p2. int hash(int p1, int p2); + /// Return the index of the vertex between vertices with indices p1, p2. int peek_vertex(int p1, int p2); + /// Process the edge between vertices with indices iv1, iv2. void process_edge(int iv1, int iv2, int marker); + /// Add the edge to the resulting data. void add_edge(int iv1, int iv2, int marker); + /// Add the triangle to the resulting data. void add_triangle(int iv0, int iv1, int iv2, int marker); + /// Add a blank new vertex. int add_vertex(); + /// Return the [existing|new] vertex between p1 and p2, uses add_vertex() for new vertex creation. int get_vertex(int p1, int p2, double x, double y, double* value); + /// Process a triangle with vertices iv0, iv1, iv2. + /// Recursive. + /// \param[in] level The current level of refinement void process_triangle(int iv0, int iv1, int iv2, int level); - + /// Process a quad with vertices iv0, iv1, iv2, iv3. + /// Recursive. + /// \param[in] level The current level of refinement void process_quad(int iv0, int iv1, int iv2, int iv3, int level); - void split_decision(int& split, int iv0, int iv1, int iv2, int iv3, ElementMode2D mode, const double** val, double* phx, double* phy, int* indices) const; + /// Main method for deciding whether or not to split the currently evaluated element. + /// \param[in/out] split Integer filled with the resulting split of the element: + /// triangle:: split > 0 ? split to four triangles : no split. + /// quad:: split == 0 -> no split. + /// quad:: split == 1 -> horizontal split. + /// quad:: split == 2 -> vertical split. + /// quad:: split == 3 -> split to four quads. + void split_decision(int& split, int iv0, int iv1, int iv2, int iv3, ElementMode2D mode, const double** val, double* phx, double* phy, unsigned short* indices) const; + /// Utility - check of the orientation of tthe two triangles outputted for a quad. bool quad_flip(int iv0, int iv1, int iv2, int iv3) const; /// Internal. double get_max_value(Traverse::State* current_state); double max_value_approx; - - /// Internal. + + /// Push transforms to all necessary functions (including displacement). void push_transforms(int transform); - /// Internal. + /// Pop transforms from all necessary functions (including displacement). void pop_transforms(); + /// Reallocation of the data fields. + /// Done in the initialization of a processing run. void reallocate(MeshSharedPtr mesh); /// Thread-owned clones. MeshFunction* fns[LinearizerDataDimensions::dimension + 2]; /// Assigned criterion. - /// Defaults to a fixed criterion with one level of refinement. + /// See the class LinearizerCriterion. + /// Used by split_decision(). LinearizerCriterion criterion; - // OpenGL part. + /// Data - OpenGL part. typename LinearizerDataDimensions::triangle_t* triangles; typename LinearizerDataDimensions::edge_t* edges; /// - edge_markers: edge markers, ordering equal to edges int* edge_markers; - // FileExport part. + /// Data - FileExport part. /// Vertices: (x, y, value) triplets /// - triangles: vertex index triplets triangle_indices_t* triangle_indices; - // Common part. + /// Data - Common part. typename LinearizerDataDimensions::vertex_t* vertices; /// - triangle_markers: triangle markers, ordering equal to triangles, triangle_indices int* triangle_markers; @@ -115,29 +145,28 @@ namespace Hermes /// Size of arrays of vertices, triangles and edges int vertex_size, triangle_size, edges_size; - /// Temporary storage - per state processing. double midval[LinearizerDataDimensions::dimension + 2][5]; + /// Temporary storage - per state processing. + const double* val[LinearizerDataDimensions::dimension]; + /// Representing element of the currently processed state. Element* rep_element; + /// The current state is curved. bool curved; - const double* val[LinearizerDataDimensions::dimension]; - + /// From LinearizerMultidimensional - for convenience & speed. LinearizerOutputType linearizerOutputType; /// The information do we want to get out of the solution. int item[LinearizerDataDimensions::dimension], component[LinearizerDataDimensions::dimension], value_type[LinearizerDataDimensions::dimension]; + /// User displacement is present. bool user_xdisp, user_ydisp; + /// Multiplication factor of the displacement function. double dmult; /// Standard and curvature epsilon. double curvature_epsilon; - - /// Keep? - bool user_specified_max, user_specified_min; - double user_specified_max_value, user_specified_min_value; - - friend class LinearizerMultidimensional; + friend class LinearizerMultidimensional < LinearizerDataDimensions > ; }; } } diff --git a/hermes2d/include/views/vector_view.h b/hermes2d/include/views/vector_view.h index 9c1636f227..439e9e55a9 100644 --- a/hermes2d/include/views/vector_view.h +++ b/hermes2d/include/views/vector_view.h @@ -45,20 +45,28 @@ namespace Hermes inline void set_grid_type(bool hexa) { this->hexa = hexa; refresh(); }; void set_mode(int mode); - + /// Returns the internal Linearizer for the purpose of parameter settings. Vectorizer* get_vectorizer(); + /// Sets the criterion to use for the linearization process. + /// This criterion is used in ThreadLinearizerMultidimensional class instances (see threadLinearizerMultidimensional array). + /// \param[in] criterion The instance of the criterion - see the class LinearizerCriterion for details (method split_decision() for the adaptive criterion, process_[triangle|quad] for the fixed one). + void set_vectorizer_criterion(LinearizerCriterion criterion); protected: /// Linearizer class responsible for obtaining linearized data. Vectorizer* vec; double gx, gy, gs; - bool hexa; ///< false - quad grid, true - hexa grid - int mode; ///< 0 - magnitude is on the background, 1 - arrows are colored, 2 - no arrows, just magnitude on the background + /// false - quad grid, true - hexa grid + bool hexa; + /// 0 - magnitude is on the background, 1 - arrows are colored, 2 - no arrows, just magnitude on the background + int mode; bool lines, pmode; - double length_coef; ///< for extending or shortening arrows - void draw_edges_2d(); ///< draws edges + /// for extending or shortening arrows + double length_coef; + /// draws edges + void draw_edges_2d(); void plot_arrow(double x, double y, double xval, double yval, double max, double min, double gs); @@ -79,12 +87,16 @@ namespace Hermes inline void set_grid_type(bool hexa) { throw Hermes::Exceptions::Exception("GLUT disabled."); } void set_mode(int mode) { throw Hermes::Exceptions::Exception("GLUT disabled."); } - + /// Returns the internal Linearizer for the purpose of parameter settings. - Linearizer* get_Linearizer() { throw Hermes::Exceptions::Exception("GLUT disabled."); return nullptr; } + Vectorizer* get_vectorizer() { throw Hermes::Exceptions::Exception("GLUT disabled."); return nullptr; } + /// Sets the criterion to use for the linearization process. + /// This criterion is used in ThreadLinearizerMultidimensional class instances (see threadLinearizerMultidimensional array). + /// \param[in] criterion The instance of the criterion - see the class LinearizerCriterion for details (method split_decision() for the adaptive criterion, process_[triangle|quad] for the fixed one). + void set_vectorizer_criterion(LinearizerCriterion criterion) { throw Hermes::Exceptions::Exception("GLUT disabled."); } }; #endif } } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/include/views/view.h b/hermes2d/include/views/view.h index d8ae32510f..38a7a68802 100644 --- a/hermes2d/include/views/view.h +++ b/hermes2d/include/views/view.h @@ -11,9 +11,9 @@ // // You should have received a copy of the GNU General Public License // along with Hermes2D. If not, see . - -// $Id: view.h 1086 2008-10-21 09:05:44Z jakub $ - +/*! \file view.h +\brief File containing View abstract class. +*/ #ifndef __H2D_VIEW_H #define __H2D_VIEW_H @@ -34,6 +34,9 @@ namespace Hermes #define H2D_DEFAULT_HEIGHT 400 #define H2DV_SCALE_LOG_BASE 1.005 ///< Base of the scale coefficient. Scale = base^{mouse move}. +#define transform_x(x) ((x * scale + trans_x) + center_x) +#define transform_y(y) (center_y - (y * scale + trans_y)) + /// Wait events. enum ViewWaitEvent { HERMES_WAIT_CLOSE, ///< Wait for all windows to close. @@ -85,7 +88,8 @@ namespace Hermes int create(); void close(); - void refresh(); ///< Refreshes views + /// Refreshes views + void refresh(); /// Returns the title. const char* get_title() const; @@ -113,25 +117,35 @@ namespace Hermes void set_num_palette_steps(int num); void set_palette_filter(bool linear); - static void wait_for_keypress(const char* text = nullptr); ///< Waits for keypress. Deprecated. + /// Waits for keypress. Deprecated. + static void wait_for_keypress(const char* text = nullptr); void wait_for_close(); void wait_for_draw(); - static void wait(const char* text); ///< Closes all views at once. - static void wait(ViewWaitEvent wait_event = HERMES_WAIT_CLOSE, const char* text = nullptr); ///< Waits for an event. + /// Closes all views at once. + static void wait(const char* text); + /// Waits for an event. + static void wait(ViewWaitEvent wait_event = HERMES_WAIT_CLOSE, const char* text = nullptr); void draw_help(); - virtual void reset_view(bool force_reset); ///< Resets view based on the axis-aligned bounding box of the mesh. Assumes that the bounding box is set up. Does not reset if view_not_reset is false. + /// Resets view based on the axis-aligned bounding box of the mesh. Assumes that the bounding box is set up. Does not reset if view_not_reset is false. + virtual void reset_view(bool force_reset); protected: //FPS measurement #define FPS_FRAME_SIZE 5 - double rendering_frames[FPS_FRAME_SIZE]; ///< time spend in rendering of frames[in ms] - int rendering_frames_top; ///< the new_ location of the next FPS - void draw_fps(); ///< draws current FPS - static double get_tick_count(); ///< returns a current time[in ms] + /// time spend in rendering of frames[in ms] + double rendering_frames[FPS_FRAME_SIZE]; + /// the new_ location of the next FPS + int rendering_frames_top; + /// draws current FPS + void draw_fps(); + /// returns a current time[in ms] + static double get_tick_count(); protected: //view - bool view_not_reset; ///< True if the view was not reset and therefore it has to be. - double vertices_min_x, vertices_max_x, vertices_min_y, vertices_max_y; ///< AABB of shown mesh + /// True if the view was not reset and therefore it has to be. + bool view_not_reset; + /// AABB of shown mesh + double vertices_min_x, vertices_max_x, vertices_min_y, vertices_max_y; double scale, log_scale, trans_x, trans_y; double center_x, center_y; int margin, lspace, rspace; @@ -158,7 +172,8 @@ namespace Hermes virtual void on_entry(int state) {} virtual void on_close(); - virtual void update_layout(); ///< Updates layout, i.e., centers mesh. + /// Updates layout, i.e., centers mesh. + virtual void update_layout(); protected: std::string title; @@ -187,18 +202,20 @@ namespace Hermes std::string screenshot_filename; protected: //palette - unsigned int gl_pallete_tex_id; ///< OpenGL texture object ID + /// OpenGL texture object ID + unsigned int gl_pallete_tex_id; - void create_gl_palette(); ///< Creates pallete texture in OpenGL. Assumes that view_sync is locked. - virtual void get_palette_color(double x, float* gl_color); ///< Fills gl_color with palette color. Assumes that gl_color points to a vector of three components (RGB). + /// Creates pallete texture in OpenGL. Assumes that view_sync is locked. + void create_gl_palette(); + /// Fills gl_color with palette color. Assumes that gl_color points to a vector of three components (RGB). + virtual void get_palette_color(double x, float* gl_color); protected: //internal functions -#define transform_x(x) ((x * scale + trans_x) + center_x) -#define transform_y(y) (center_y - (y * scale + trans_y)) inline double untransform_x(double x) { return (x - center_x - trans_x) / scale; } inline double untransform_y(double y) { return (center_y - y - trans_y) / scale; } - virtual void clear_background(); ///< Clears background. + /// Clears background. + virtual void clear_background(); void pre_display(); void display_antialiased(); diff --git a/hermes2d/include/views/view_support.h b/hermes2d/include/views/view_support.h index 4538ce1a81..7a75e79bbb 100644 --- a/hermes2d/include/views/view_support.h +++ b/hermes2d/include/views/view_support.h @@ -18,7 +18,7 @@ #ifndef __H2D_VIEW_SUPPORT_H #define __H2D_VIEW_SUPPORT_H #ifndef NOGLUT - #include +#include #endif namespace Hermes { @@ -30,48 +30,75 @@ namespace Hermes #ifndef NOGLUT /* types */ - class HERMES_API ViewMonitor ///< A monitor used to synchronize thread in views. + ///< A monitor used to synchronize thread in views. + class HERMES_API ViewMonitor { protected: - pthread_mutexattr_t mutex_attr; ///< Mutext attributes. - pthread_mutex_t mutex; ///< Mutex that protects monitor. - pthread_cond_t cond_cross_thread_call; ///< Condition used to signal a cross-thread call - pthread_cond_t cond_keypress; ///< Condition used to signal a keypress. - pthread_cond_t cond_close; ///< Condition used to signal close of a window. - pthread_cond_t cond_drawing_finished; ///< Condition used to signal that drawing has finished + /// Mutext attributes. + pthread_mutexattr_t mutex_attr; + /// Mutex that protects monitor. + pthread_mutex_t mutex; + /// Condition used to signal a cross-thread call + pthread_cond_t cond_cross_thread_call; + /// Condition used to signal a keypress. + pthread_cond_t cond_keypress; + /// Condition used to signal close of a window. + pthread_cond_t cond_close; + /// Condition used to signal that drawing has finished + pthread_cond_t cond_drawing_finished; public: ViewMonitor(); ~ViewMonitor(); - inline void enter() { pthread_mutex_lock(&mutex); }; ///< enters protected section - inline void leave() { pthread_mutex_unlock(&mutex); }; ///< leaves protected section - inline void signal_keypress() { pthread_cond_broadcast(&cond_keypress); }; ///< signals keypress inside a protected section - inline void wait_keypress() { pthread_cond_wait(&cond_keypress, &mutex); }; ///< waits for keypress inside a protected section - inline void signal_close() { pthread_cond_broadcast(&cond_close); }; ///< signals close inside a protected section - inline void wait_close() { pthread_cond_wait(&cond_close, &mutex); }; ///< waits for close inside a protected section - inline void signal_drawing_finished() { pthread_cond_broadcast(&cond_drawing_finished); }; ///< signals drawing finished inside a protected section - inline void wait_drawing_fisnihed() { pthread_cond_wait(&cond_drawing_finished, &mutex); }; ///< waits for drawing finished inside a protected section - inline void signal_cross_thread_call() { pthread_cond_broadcast(&cond_cross_thread_call); }; ///< signals that cross-thread-call finished - inline void wait_cross_thread_call() { pthread_cond_wait(&cond_cross_thread_call, &mutex); }; ///< waits for finishing of a cross-thread call + /// enters protected section + inline void enter() { pthread_mutex_lock(&mutex); }; + /// leaves protected section + inline void leave() { pthread_mutex_unlock(&mutex); }; + /// signals keypress inside a protected section + inline void signal_keypress() { pthread_cond_broadcast(&cond_keypress); }; + /// waits for keypress inside a protected section + inline void wait_keypress() { pthread_cond_wait(&cond_keypress, &mutex); }; + /// signals close inside a protected section + inline void signal_close() { pthread_cond_broadcast(&cond_close); }; + /// waits for close inside a protected section + inline void wait_close() { pthread_cond_wait(&cond_close, &mutex); }; + /// signals drawing finished inside a protected section + inline void signal_drawing_finished() { pthread_cond_broadcast(&cond_drawing_finished); }; + /// waits for drawing finished inside a protected section + inline void wait_drawing_fisnihed() { pthread_cond_wait(&cond_drawing_finished, &mutex); }; + /// signals that cross-thread-call finished + inline void signal_cross_thread_call() { pthread_cond_broadcast(&cond_cross_thread_call); }; + /// waits for finishing of a cross-thread call + inline void wait_cross_thread_call() { pthread_cond_wait(&cond_cross_thread_call, &mutex); }; }; /* exported types */ - extern ViewMonitor view_sync; ///< synchronization between all views. Used to access OpenGL and signal a window close event and a keypress event. + /// synchronization between all views. Used to access OpenGL and signal a window close event and a keypress event. + extern ViewMonitor view_sync; /* exported functions */ class View; - HERMES_API bool init_glut(); ///< Initialize GLUT. - HERMES_API bool shutdown_glut(); ///< Shutdown GLUT. + /// Initialize GLUT. + HERMES_API bool init_glut(); + /// Shutdown GLUT. + HERMES_API bool shutdown_glut(); extern "C" { - int add_view(View* view, int x, int y, int width, int height, const char* title); ///< Adds a view. + /// Adds a view. + int add_view(View* view, int x, int y, int width, int height, const char* title); } - extern void set_view_title(int view_id, const char* title); ///< Sets title of a view. - extern void refresh_view(int view_id); ///< Forces redisplay of a view. - extern void remove_view(int view_id); ///< Removes a view. - //extern void force_view_thread_shutdown(); ///< Forces view thread to shutdown. - extern void wait_for_all_views_close(const char* text); ///< Waits for all views to close. - extern void wait_for_any_key(const char* text); ///< Waits for a keypress which is not processed. + /// Sets title of a view. + extern void set_view_title(int view_id, const char* title); + /// Forces redisplay of a view. + extern void refresh_view(int view_id); + /// Removes a view. + extern void remove_view(int view_id); + /// Forces view thread to shutdown. + //extern void force_view_thread_shutdown(); + /// Waits for all views to close. + extern void wait_for_all_views_close(const char* text); + /// Waits for a keypress which is not processed. + extern void wait_for_any_key(const char* text); extern void on_display_stub(void); extern void on_reshape_stub(int width, int height); diff --git a/hermes2d/include/weakform/weakform.h b/hermes2d/include/weakform/weakform.h index 33de2d72dd..d5df6a86f9 100644 --- a/hermes2d/include/weakform/weakform.h +++ b/hermes2d/include/weakform/weakform.h @@ -36,7 +36,9 @@ namespace Hermes class Shapeset; template class Func; template class DiscontinuousFunc; - template class Geom; + template class InterfaceGeom; + template class GeomVol; + template class GeomSurf; template class Form; template class OGProjection; @@ -48,6 +50,18 @@ namespace Hermes template class VectorFormDG; #pragma endregion + /// \brief Used to pass the instances of WeakForm around. + template + class HERMES_API WeakFormSharedPtr : public std::tr1::shared_ptr < Hermes::Hermes2D::WeakForm > + { + public: + WeakFormSharedPtr(Hermes::Hermes2D::WeakForm* ptr = nullptr); + + WeakFormSharedPtr(const WeakFormSharedPtr& other); + + void operator=(const WeakFormSharedPtr& other); + }; + /// \brief Represents the weak formulation of a PDE problem. /// /// The WeakForm class represents the weak formulation of a system of linear PDEs.
@@ -112,16 +126,16 @@ namespace Hermes /// For parameters that only depend on element and edge and that do /// not have to be calculated for every form. /// This is rarely used and typically only for multi-physical tasks where there is a multitude of forms. - virtual void set_active_edge_state(Element** e, int isurf); + virtual void set_active_edge_state(Element** e, unsigned char isurf); /// Provides possibility of setup edge-wise parameters. /// For parameters that only depend on element and inner edge and that do /// not have to be calculated for every form. /// This is rarely used and typically only for multi-physical tasks where there is a multitude of forms. - virtual void set_active_DG_state(Element** e, int isurf); + virtual void set_active_DG_state(Element** e, unsigned char isurf); /// Returns the number of equations. - inline unsigned int get_neq() const { return neq; } + inline unsigned char get_neq() const { return neq; } /// This weakform is matrix-free. bool is_matrix_free() const { return is_matfree; } @@ -146,7 +160,7 @@ namespace Hermes /// Set one function acting on the u_ext functions in assembling (for fast assembling of nonlinear problems). /// IMPORTANT: This function will appear at the beginning of the Func** ext array in the value(), and ord() methods of individual forms. void set_u_ext_fn(UExtFunctionSharedPtr ext); - + /// External functions. /// Set one external function. /// IMPORTANT: This function will appear at the END (after those functions coming via set_u_ext_fn) of the Func** ext array in the value(), and ord() methods of individual forms. @@ -155,16 +169,16 @@ namespace Hermes /// External functions. /// Set functions acting on the u_ext functions in assembling (for fast assembling of nonlinear problems). /// IMPORTANT: These functions will appear at the beginning of the Func** ext array in the value(), and ord() methods of individual forms. - void set_u_ext_fn(Hermes::vector > ext); + void set_u_ext_fn(std::vector > ext); /// External functions. /// Set external functions. /// IMPORTANT: These functions will appear at the END (after those functions coming via set_u_ext_fn) of the Func** ext array in the value(), and ord() methods of individual forms. - void set_ext(Hermes::vector > ext); + void set_ext(std::vector > ext); /// External functions. /// Get external functions. - Hermes::vector > get_ext() const; + std::vector > get_ext() const; /// Cloning. virtual WeakForm* clone() const; @@ -173,70 +187,75 @@ namespace Hermes bool is_DG() const; /// Internal. - Hermes::vector *> get_forms() const; - Hermes::vector *> get_mfvol() const; - Hermes::vector *> get_mfsurf() const; - Hermes::vector *> get_mfDG() const; - Hermes::vector *> get_vfvol() const; - Hermes::vector *> get_vfsurf() const; - Hermes::vector *> get_vfDG() const; + std::vector *> get_forms() const; + std::vector *> get_mfvol() const; + std::vector *> get_mfsurf() const; + std::vector *> get_mfDG() const; + std::vector *> get_vfvol() const; + std::vector *> get_vfsurf() const; + std::vector *> get_vfDG() const; /// Deletes all volumetric and surface forms. void delete_all(); protected: /// External solutions. - Hermes::vector > ext; - Hermes::vector > u_ext_fn; + std::vector > ext; + std::vector > u_ext_fn; double current_time; double current_time_step; + /// Number of equations. unsigned int neq; + /// Original number of equations in case this is a Runge-Kutta enlarged system. + unsigned int original_neq; + bool is_matfree; /// Holds all forms. - Hermes::vector *> forms; + std::vector *> forms; /// Holds volumetric matrix forms. - Hermes::vector *> mfvol; + std::vector *> mfvol; /// Holds surface matrix forms. - Hermes::vector *> mfsurf; + std::vector *> mfsurf; /// Holds DG matrix forms. - Hermes::vector *> mfDG; + std::vector *> mfDG; /// Holds volumetric vector forms. - Hermes::vector *> vfvol; + std::vector *> vfvol; /// Holds surface vector forms. - Hermes::vector *> vfsurf; + std::vector *> vfsurf; /// Holds DG vector forms. - Hermes::vector *> vfDG; + std::vector *> vfDG; bool** get_blocks(bool force_diagonal_blocks) const; - friend class DiscreteProblem; - friend class DiscreteProblemDGAssembler; - friend class DiscreteProblemThreadAssembler; - friend class DiscreteProblemIntegrationOrderCalculator; - friend class DiscreteProblemSelectiveAssembler; - friend class RungeKutta; - friend class OGProjection; - friend class Hermes::Preconditioners::Precond; + friend class DiscreteProblem < Scalar > ; + friend class Form < Scalar > ; + friend class DiscreteProblemDGAssembler < Scalar > ; + friend class DiscreteProblemThreadAssembler < Scalar > ; + friend class DiscreteProblemIntegrationOrderCalculator < Scalar > ; + friend class DiscreteProblemSelectiveAssembler < Scalar > ; + friend class RungeKutta < Scalar > ; + friend class OGProjection < Scalar > ; + friend class Hermes::Preconditioners::Precond < Scalar > ; // Internal. - virtual void cloneMembers(const WeakForm* other_wf); + virtual void cloneMembers(const WeakFormSharedPtr& other_wf); // Internal. - void cloneMemberExtFunctions(Hermes::vector > source_ext, Hermes::vector >& cloned_ext); + void cloneMemberExtFunctions(std::vector > source_ext, std::vector >& cloned_ext); // Internal - processes markers, translates from strings to ints. template - void processFormMarkers(const Hermes::vector >& spaces, bool surface, Hermes::vector forms_to_process); - void processFormMarkers(const Hermes::vector >& spaces); + void processFormMarkers(const std::vector > spaces, bool surface, std::vector forms_to_process); + void processFormMarkers(const std::vector > spaces); private: void free_ext(); @@ -258,8 +277,8 @@ namespace Hermes /// get-set methods /// areas void set_area(std::string area); - void set_areas(Hermes::vector areas); - Hermes::vector getAreas() const; + void set_areas(std::vector areas); + std::vector getAreas() const; /// external functions - dual functionality with the overall WeakForm. /// For Agros, this approach is better in some way, for e.g. Euler equations, @@ -271,9 +290,9 @@ namespace Hermes /// External functions. /// Set more external functions. - void set_ext(Hermes::vector > ext); - void set_u_ext_fn(Hermes::vector > ext); - Hermes::vector > get_ext() const; + void set_ext(std::vector > ext); + void set_u_ext_fn(std::vector > ext); + std::vector > get_ext() const; /// scaling factor void setScalingFactor(double scalingFactor); @@ -281,15 +300,15 @@ namespace Hermes unsigned int i; protected: - /// Set pointer to a WeakForm. - inline void set_weakform(WeakForm* wf) { this->wf = wf; } + /// Set pointer to a WeakForm + handling of internal data. + void set_weakform(WeakForm* wf); /// Markers of the areas where this form will be assembled. - Hermes::vector areas; + std::vector areas; /// Internal - this structure is being filled anew with every assembling. - Hermes::vector areas_internal; - + std::vector areas_internal; + /// Internal - this structure is being filled anew with every assembling. /// True iff areas contain HERMES_ANY - meaning that this form represents an integral over the whole domain (whole boundary in case of surface forms). bool assembleEverywhere; @@ -300,9 +319,14 @@ namespace Hermes /// external coefficient vector. int u_ext_offset; + /// When dealing with nonlinear problems of multiple equations, sometimes the nonlinearity has to access different quantity previous iterations. This selector + /// servers for that purpose - according to this, the correct one will be selected - see e.g.DefaultJacobianDiffusion class. + /// Defaults to 'i' for VectorForm and 'j' for MatrixForm. This can be changed in derived forms. + unsigned int previous_iteration_space_index; + /// External solutions. - Hermes::vector > ext; - Hermes::vector > u_ext_fn; + std::vector > ext; + std::vector > u_ext_fn; double get_current_stage_time() const; @@ -317,20 +341,20 @@ namespace Hermes void set_current_stage_time(double time); /// Copy the basic data from other_form - used in cloning. void copy_base(Form* other_form); - friend class WeakForm; - friend class RungeKutta; - friend class DiscreteProblem; - friend class DiscreteProblemDGAssembler; - friend class DiscreteProblemIntegrationOrderCalculator; - friend class DiscreteProblemSelectiveAssembler; - friend class DiscreteProblemThreadAssembler; + friend class WeakForm < Scalar > ; + friend class RungeKutta < Scalar > ; + friend class DiscreteProblem < Scalar > ; + friend class DiscreteProblemDGAssembler < Scalar > ; + friend class DiscreteProblemIntegrationOrderCalculator < Scalar > ; + friend class DiscreteProblemSelectiveAssembler < Scalar > ; + friend class DiscreteProblemThreadAssembler < Scalar > ; }; /// \brief Abstract, base class for matrix form - i.e. a single integral in the bilinear form on the left hand side of the variational formulation of a (system of) PDE.
/// By default, the matrix form is initialized with the following natural attribute:
/// - nonsymmetrical (if the user omits the HERMES_SYM / HERMES_ANTISYM parameters, nothing worse than a non-necessary calculations happen). template - class HERMES_API MatrixForm : public Form + class HERMES_API MatrixForm : public Form < Scalar > { public: /// Constructor with coordinates. @@ -339,23 +363,16 @@ namespace Hermes virtual ~MatrixForm(); unsigned int j; - unsigned int previous_iteration_space_index; SymFlag sym; - virtual Scalar value(int n, double *wt, Func **u_ext, Func *u, Func *v, - Geom *e, Func **ext) const; - - virtual Hermes::Ord ord(int n, double *wt, Func **u_ext, Func *u, Func *v, - Geom *e, Func **ext) const; - protected: - friend class DiscreteProblem; + friend class DiscreteProblem < Scalar > ; }; /// \brief Abstract, base class for matrix Volumetric form - i.e. MatrixForm, where the integration is with respect to 2D-Lebesgue measure (elements). template - class HERMES_API MatrixFormVol : public MatrixForm + class HERMES_API MatrixFormVol : public MatrixForm < Scalar > { public: /// Constructor with coordinates. @@ -366,12 +383,18 @@ namespace Hermes virtual ~MatrixFormVol(); + virtual Scalar value(int n, double *wt, Func **u_ext, Func *u, Func *v, + GeomVol *e, Func **ext) const; + + virtual Hermes::Ord ord(int n, double *wt, Func **u_ext, Func *u, Func *v, + GeomVol *e, Func **ext) const; + virtual MatrixFormVol* clone() const; }; /// \brief Abstract, base class for matrix Surface form - i.e. MatrixForm, where the integration is with respect to 1D-Lebesgue measure (element domain-boundary edges). template - class HERMES_API MatrixFormSurf : public MatrixForm + class HERMES_API MatrixFormSurf : public MatrixForm < Scalar > { public: /// Constructor with coordinates. @@ -379,12 +402,18 @@ namespace Hermes virtual ~MatrixFormSurf(); + virtual Scalar value(int n, double *wt, Func **u_ext, Func *u, Func *v, + GeomSurf *e, Func **ext) const; + + virtual Hermes::Ord ord(int n, double *wt, Func **u_ext, Func *u, Func *v, + GeomSurf *e, Func **ext) const; + virtual MatrixFormSurf* clone() const; }; /// \brief Abstract, base class for matrix DG form - i.e. bilinear form, where the integration is with respect to 1D-Lebesgue measure (element inner-domain edges). template - class HERMES_API MatrixFormDG : public Form + class HERMES_API MatrixFormDG : public Form < Scalar > { public: /// Constructor with coordinates. @@ -393,23 +422,21 @@ namespace Hermes virtual ~MatrixFormDG(); unsigned int j; - unsigned int previous_iteration_space_index; virtual Scalar value(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, - Geom *e, DiscontinuousFunc **ext) const; + InterfaceGeom *e, DiscontinuousFunc **ext) const; virtual Hermes::Ord ord(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, - Geom *e, DiscontinuousFunc **ext) const; + InterfaceGeom *e, DiscontinuousFunc **ext) const; virtual MatrixFormDG* clone() const; protected: - friend class DiscreteProblem; + friend class DiscreteProblem < Scalar > ; }; - /// \brief Abstract, base class for vector form - i.e. a single integral in the linear form on the right hand side of the variational formulation of a (system of) PDE. template - class VectorForm : public Form + class VectorForm : public Form < Scalar > { public: /// Constructor with coordinates. @@ -417,19 +444,13 @@ namespace Hermes virtual ~VectorForm(); - virtual Scalar value(int n, double *wt, Func **u_ext, Func *v, - Geom *e, Func **ext) const; - - virtual Hermes::Ord ord(int n, double *wt, Func **u_ext, Func *v, Geom *e, - Func **ext) const; - protected: - friend class DiscreteProblem; + friend class DiscreteProblem < Scalar > ; }; /// \brief Abstract, base class for vector Volumetric form - i.e. VectorForm, where the integration is with respect to 2D-Lebesgue measure (elements). template - class VectorFormVol : public VectorForm + class VectorFormVol : public VectorForm < Scalar > { public: /// Constructor with coordinates. @@ -437,12 +458,18 @@ namespace Hermes virtual ~VectorFormVol(); + virtual Scalar value(int n, double *wt, Func **u_ext, Func *v, + GeomVol *e, Func **ext) const; + + virtual Hermes::Ord ord(int n, double *wt, Func **u_ext, Func *v, GeomVol *e, + Func **ext) const; + virtual VectorFormVol* clone() const; }; /// \brief Abstract, base class for vector Surface form - i.e. VectorForm, where the integration is with respect to 1D-Lebesgue measure (element domain-boundary edges). template - class VectorFormSurf : public VectorForm + class VectorFormSurf : public VectorForm < Scalar > { public: /// Constructor with coordinates. @@ -450,12 +477,18 @@ namespace Hermes virtual ~VectorFormSurf(); + virtual Scalar value(int n, double *wt, Func **u_ext, Func *v, + GeomSurf *e, Func **ext) const; + + virtual Hermes::Ord ord(int n, double *wt, Func **u_ext, Func *v, GeomSurf *e, + Func **ext) const; + virtual VectorFormSurf* clone() const; }; /// \brief Abstract, base class for vector DG form - i.e. linear Form, where the integration is with respect to 1D-Lebesgue measure (element inner-domain edges). template - class VectorFormDG : public Form + class VectorFormDG : public Form < Scalar > { public: /// Constructor with coordinates. @@ -464,14 +497,14 @@ namespace Hermes virtual ~VectorFormDG(); virtual Scalar value(int n, double *wt, DiscontinuousFunc **u_ext, Func *v, - Geom *e, DiscontinuousFunc **ext) const; + InterfaceGeom *e, DiscontinuousFunc **ext) const; - virtual Hermes::Ord ord(int n, double *wt, DiscontinuousFunc **u_ext, Func *v, Geom *e, + virtual Hermes::Ord ord(int n, double *wt, DiscontinuousFunc **u_ext, Func *v, InterfaceGeom *e, DiscontinuousFunc **ext) const; virtual VectorFormDG* clone() const; protected: - friend class DiscreteProblem; + friend class DiscreteProblem < Scalar > ; }; } } diff --git a/hermes2d/include/weakform_library/integrals_h1.h b/hermes2d/include/weakform_library/integrals_h1.h index d8e001619e..3cfb913354 100644 --- a/hermes2d/include/weakform_library/integrals_h1.h +++ b/hermes2d/include/weakform_library/integrals_h1.h @@ -33,8 +33,8 @@ namespace Hermes return result; } - template - Real int_x_v(int n, double *wt, Func *v, Geom *e) + template + Real int_x_v(int n, double *wt, Func *v, Geom *e) { Real result = Real(0); for (int i = 0; i < n; i++) @@ -42,8 +42,8 @@ namespace Hermes return result; } - template - Real int_y_v(int n, double *wt, Func *v, Geom *e) + template + Real int_y_v(int n, double *wt, Func *v, Geom *e) { Real result = Real(0); for (int i = 0; i < n; i++) @@ -70,8 +70,8 @@ namespace Hermes return result; } - template - Scalar int_x_u_v(int n, double *wt, Func *u, Func *v, Geom *e) + template + Scalar int_x_u_v(int n, double *wt, Func *u, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -80,8 +80,8 @@ namespace Hermes } // For residual forms. - template - Scalar int_x_u_ext_v(int n, double *wt, Func *u_ext, Func *v, Geom *e) + template + Scalar int_x_u_ext_v(int n, double *wt, Func *u_ext, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -89,8 +89,8 @@ namespace Hermes return result; } - template - Scalar int_y_u_v(int n, double *wt, Func *u, Func *v, Geom *e) + template + Scalar int_y_u_v(int n, double *wt, Func *u, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -99,8 +99,8 @@ namespace Hermes } // For residual forms. - template - Scalar int_y_u_ext_v(int n, double *wt, Func *u_ext, Func *v, Geom *e) + template + Scalar int_y_u_ext_v(int n, double *wt, Func *u_ext, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -108,8 +108,8 @@ namespace Hermes return result; } - template - Scalar int_F_v(int n, double *wt, Real (*F)(Real x, Real y), Func *v, Geom *e) + template + Scalar int_F_v(int n, double *wt, Real(*F)(Real x, Real y), Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -136,8 +136,8 @@ namespace Hermes return result; } - template - Scalar int_x_grad_u_grad_v(int n, double *wt, Func *u, Func *v, Geom *e) + template + Scalar int_x_grad_u_grad_v(int n, double *wt, Func *u, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -146,8 +146,8 @@ namespace Hermes } // For residual forms. - template - Scalar int_x_grad_u_ext_grad_v(int n, double *wt, Func *u_ext, Func *v, Geom *e) + template + Scalar int_x_grad_u_ext_grad_v(int n, double *wt, Func *u_ext, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -155,8 +155,8 @@ namespace Hermes return result; } - template - Scalar int_y_grad_u_grad_v(int n, double *wt, Func *u, Func *v, Geom *e) + template + Scalar int_y_grad_u_grad_v(int n, double *wt, Func *u, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -165,8 +165,8 @@ namespace Hermes } // For residual forms. - template - Scalar int_y_grad_u_ext_grad_v(int n, double *wt, Func *u_ext, Func *v, Geom *e) + template + Scalar int_y_grad_u_ext_grad_v(int n, double *wt, Func *u_ext, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -201,8 +201,8 @@ namespace Hermes return result; } - template - Scalar int_u_dvdx_over_x(int n, double *wt, Func *u, Func *v, Geom *e) + template + Scalar int_u_dvdx_over_x(int n, double *wt, Func *u, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -211,8 +211,8 @@ namespace Hermes } // For residual forms. - template - Scalar int_u_ext_dvdx_over_x(int n, double *wt, Func *u_ext, Func *v, Geom *e) + template + Scalar int_u_ext_dvdx_over_x(int n, double *wt, Func *u_ext, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -229,8 +229,8 @@ namespace Hermes return result; } - template - Scalar int_u_dvdy_over_y(int n, double *wt, Func *u, Func *v, Geom *e) + template + Scalar int_u_dvdy_over_y(int n, double *wt, Func *u, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -239,8 +239,8 @@ namespace Hermes } // For residual forms. - template - Scalar int_u_ext_dvdy_over_y(int n, double *wt, Func *u_ext, Func *v, Geom *e) + template + Scalar int_u_ext_dvdy_over_y(int n, double *wt, Func *u_ext, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -300,18 +300,18 @@ namespace Hermes // for expression without partial derivatives - the variables e, quad, o must be already // defined and initialized #define h1_integrate_expression(exp) \ - {double3* pt = quad->get_points(o, ru->get_active_element()->get_mode()); \ - int np = quad->get_num_points(o, ru->get_active_element()->get_mode()); \ - if(ru->is_jacobian_const()){ \ + {double3* pt = quad->get_points(o, ru->get_active_element()->get_mode()); \ + unsigned char np = quad->get_num_points(o, ru->get_active_element()->get_mode()); \ + if (ru->is_jacobian_const()){ \ for (int i = 0; i < np; i++) \ - result += pt[i][2] * (exp); \ - result *= ru->get_const_jacobian(); \ - } \ - else { \ - double* jac = ru->get_jacobian(o); \ - for (int i = 0; i < np; i++) \ - result += pt[i][2] * jac[i] * (exp); \ - }} + result += pt[i][2] * (exp); \ + result *= ru->get_const_jacobian(); \ + } \ + else { \ + double* jac = ru->get_jacobian(o); \ + for (int i = 0; i < np; i++) \ + result += pt[i][2] * jac[i] * (exp); \ + }} //////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -321,7 +321,7 @@ namespace Hermes Quad2D* quad = fu->get_quad_2d(); assert(quad == fv->get_quad_2d()); - int o = std::max(2*fu->get_fn_order(), 2*fv->get_fn_order()) + ru->get_inv_ref_order(); + int o = std::max(2 * fu->get_fn_order(), 2 * fv->get_fn_order()) + ru->get_inv_ref_order(); limit_order(o, ru->get_active_element()->get_mode()); fu->set_quad_order(o); fv->set_quad_order(o); @@ -344,7 +344,7 @@ namespace Hermes Quad2D* quad = fu->get_quad_2d(); assert(quad == fv->get_quad_2d()); - int o = std::max(2*fu->get_fn_order(), 2*fv->get_fn_order()) + ru->get_inv_ref_order(); + int o = std::max(2 * fu->get_fn_order(), 2 * fv->get_fn_order()) + ru->get_inv_ref_order(); limit_order(o, ru->get_active_element()->get_mode()); fu->set_quad_order(o); fv->set_quad_order(o); @@ -367,7 +367,7 @@ namespace Hermes Quad2D* quad = fu->get_quad_2d(); assert(quad == fv->get_quad_2d()); - int o = std::max(2*fu->get_fn_order(), 2*fv->get_fn_order()) + ru->get_inv_ref_order(); + int o = std::max(2 * fu->get_fn_order(), 2 * fv->get_fn_order()) + ru->get_inv_ref_order(); limit_order(o, ru->get_active_element()->get_mode()); fu->set_quad_order(o, H2D_FN_VAL); fv->set_quad_order(o, H2D_FN_VAL); @@ -386,7 +386,7 @@ namespace Hermes Quad2D* quad = fu->get_quad_2d(); assert(quad == fv->get_quad_2d()); - int o = std::max(2*fu->get_fn_order(), 2*fv->get_fn_order()) + ru->get_inv_ref_order(); + int o = std::max(2 * fu->get_fn_order(), 2 * fv->get_fn_order()) + ru->get_inv_ref_order(); limit_order(o, ru->get_active_element()->get_mode()); fu->set_quad_order(o); fv->set_quad_order(o); @@ -406,7 +406,7 @@ namespace Hermes Quad2D* quad = fu->get_quad_2d(); assert(quad == fv->get_quad_2d()); - int o = std::max(2*fu->get_fn_order(), 2*fv->get_fn_order()) + ru->get_inv_ref_order(); + int o = std::max(2 * fu->get_fn_order(), 2 * fv->get_fn_order()) + ru->get_inv_ref_order(); limit_order(o, ru->get_active_element()->get_mode()); fu->set_quad_order(o); fv->set_quad_order(o); @@ -425,7 +425,7 @@ namespace Hermes { Quad2D* quad = fu->get_quad_2d(); - int o = 2*fu->get_fn_order() + ru->get_inv_ref_order(); + int o = 2 * fu->get_fn_order() + ru->get_inv_ref_order(); limit_order(o, ru->get_active_element()->get_mode()); fu->set_quad_order(o); @@ -443,7 +443,7 @@ namespace Hermes { Quad2D* quad = fu->get_quad_2d(); - int o = 2*fu->get_fn_order() + ru->get_inv_ref_order(); + int o = 2 * fu->get_fn_order() + ru->get_inv_ref_order(); limit_order(o, ru->get_active_element()->get_mode()); fu->set_quad_order(o); @@ -461,7 +461,7 @@ namespace Hermes { Quad2D* quad = fu->get_quad_2d(); - int o = 2*fu->get_fn_order() + ru->get_inv_ref_order(); + int o = 2 * fu->get_fn_order() + ru->get_inv_ref_order(); limit_order(o, ru->get_active_element()->get_mode()); fu->set_quad_order(o, H2D_FN_VAL); diff --git a/hermes2d/include/weakform_library/weakforms_elasticity.h b/hermes2d/include/weakform_library/weakforms_elasticity.h index 30e309308b..7871713c0a 100644 --- a/hermes2d/include/weakform_library/weakforms_elasticity.h +++ b/hermes2d/include/weakform_library/weakforms_elasticity.h @@ -33,17 +33,17 @@ namespace Hermes /* Single-component version -- to be used for multimesh assembling */ template - class HERMES_API DefaultJacobianElasticity_0_0 : public MatrixFormVol + class HERMES_API DefaultJacobianElasticity_0_0 : public MatrixFormVol < Scalar > { public: DefaultJacobianElasticity_0_0(unsigned int i, unsigned int j, double lambda, double mu); DefaultJacobianElasticity_0_0(unsigned int i, unsigned int j, std::string area, double lambda, double mu); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; private: @@ -51,17 +51,17 @@ namespace Hermes }; template - class HERMES_API DefaultJacobianElasticity_0_1 : public MatrixFormVol + class HERMES_API DefaultJacobianElasticity_0_1 : public MatrixFormVol < Scalar > { public: DefaultJacobianElasticity_0_1(unsigned int i, unsigned int j, double lambda, double mu); DefaultJacobianElasticity_0_1(unsigned int i, unsigned int j, std::string area, double lambda, double mu); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; private: @@ -69,17 +69,17 @@ namespace Hermes }; template - class HERMES_API DefaultResidualElasticity_0_0 : public VectorFormVol + class HERMES_API DefaultResidualElasticity_0_0 : public VectorFormVol < Scalar > { public: DefaultResidualElasticity_0_0(unsigned int i, double lambda, double mu); DefaultResidualElasticity_0_0(unsigned int i, std::string area, double lambda, double mu); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; private: @@ -87,17 +87,17 @@ namespace Hermes }; template - class HERMES_API DefaultResidualElasticity_0_1 : public VectorFormVol + class HERMES_API DefaultResidualElasticity_0_1 : public VectorFormVol < Scalar > { public: DefaultResidualElasticity_0_1(unsigned int i, double lambda, double mu); DefaultResidualElasticity_0_1(unsigned int i, std::string area, double lambda, double mu); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; private: @@ -105,17 +105,17 @@ namespace Hermes }; template - class HERMES_API DefaultResidualElasticity_1_0 : public VectorFormVol + class HERMES_API DefaultResidualElasticity_1_0 : public VectorFormVol < Scalar > { public: DefaultResidualElasticity_1_0(unsigned int i, double lambda, double mu); DefaultResidualElasticity_1_0(unsigned int i, std::string area, double lambda, double mu); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; private: @@ -123,17 +123,17 @@ namespace Hermes }; template - class HERMES_API DefaultResidualElasticity_1_1 : public VectorFormVol + class HERMES_API DefaultResidualElasticity_1_1 : public VectorFormVol < Scalar > { public: DefaultResidualElasticity_1_1(unsigned int i, double lambda, double mu); DefaultResidualElasticity_1_1(unsigned int i, std::string area, double lambda, double mu); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; private: @@ -141,17 +141,17 @@ namespace Hermes }; template - class HERMES_API DefaultJacobianElasticity_1_1 : public MatrixFormVol + class HERMES_API DefaultJacobianElasticity_1_1 : public MatrixFormVol < Scalar > { public: DefaultJacobianElasticity_1_1(unsigned int i, unsigned int j, double lambda, double mu); DefaultJacobianElasticity_1_1(unsigned int i, unsigned int j, std::string area, double lambda, double mu); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; private: diff --git a/hermes2d/include/weakform_library/weakforms_h1.h b/hermes2d/include/weakform_library/weakforms_h1.h index 9c2f7db961..fc8cdbd658 100644 --- a/hermes2d/include/weakform_library/weakforms_h1.h +++ b/hermes2d/include/weakform_library/weakforms_h1.h @@ -31,24 +31,24 @@ namespace Hermes */ template - class HERMES_API DefaultMatrixFormVol : public MatrixFormVol + class HERMES_API DefaultMatrixFormVol : public MatrixFormVol < Scalar > { public: DefaultMatrixFormVol(int i, int j, std::string area = HERMES_ANY, Hermes2DFunction* coeff = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); - DefaultMatrixFormVol(int i, int j, Hermes::vector areas, + DefaultMatrixFormVol(int i, int j, std::vector areas, Hermes2DFunction* coeff = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); virtual ~DefaultMatrixFormVol(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; @@ -66,56 +66,52 @@ namespace Hermes */ template - class HERMES_API DefaultJacobianDiffusion : public MatrixFormVol + class HERMES_API DefaultJacobianDiffusion : public MatrixFormVol < Scalar > { public: DefaultJacobianDiffusion(int i, int j, std::string area = HERMES_ANY, Hermes1DFunction* coeff = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); - DefaultJacobianDiffusion(int i, int j, Hermes::vector areas, Hermes1DFunction* coeff = nullptr, + DefaultJacobianDiffusion(int i, int j, std::vector areas, Hermes1DFunction* coeff = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); ~DefaultJacobianDiffusion(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; private: - int idx_j; - Hermes1DFunction* coeff; bool own_coeff; GeomType gt; }; - template - class HERMES_API DefaultMatrixFormDiffusion : public MatrixFormVol + template + class HERMES_API DefaultMatrixFormDiffusion : public MatrixFormVol < Scalar > { public: DefaultMatrixFormDiffusion(int i, int j, std::string area = HERMES_ANY, Hermes1DFunction* coeff = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); - DefaultMatrixFormDiffusion(int i, int j, Hermes::vector areas, Hermes1DFunction* coeff = nullptr, + DefaultMatrixFormDiffusion(int i, int j, std::vector areas, Hermes1DFunction* coeff = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); ~DefaultMatrixFormDiffusion(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; private: - int idx_j; - Hermes1DFunction* coeff; bool own_coeff; GeomType gt; @@ -130,28 +126,27 @@ namespace Hermes */ template - class HERMES_API DefaultJacobianAdvection : public MatrixFormVol + class HERMES_API DefaultJacobianAdvection : public MatrixFormVol < Scalar > { public: DefaultJacobianAdvection(int i, int j, std::string area = HERMES_ANY, Hermes1DFunction* coeff_1 = nullptr, Hermes1DFunction* coeff_2 = nullptr, GeomType gt = HERMES_PLANAR); - DefaultJacobianAdvection(int i, int j, Hermes::vector areas, + DefaultJacobianAdvection(int i, int j, std::vector areas, Hermes1DFunction* coeff_1 = nullptr, Hermes1DFunction* coeff_2 = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultJacobianAdvection(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; private: - int idx_j; Hermes1DFunction* coeff1, *coeff2; bool own_coeff1; bool own_coeff2; @@ -164,21 +159,21 @@ namespace Hermes */ template - class HERMES_API DefaultVectorFormVol : public VectorFormVol + class HERMES_API DefaultVectorFormVol : public VectorFormVol < Scalar > { public: DefaultVectorFormVol(int i, std::string area = HERMES_ANY, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultVectorFormVol(int i, Hermes::vector areas, Hermes2DFunction* coeff = nullptr, + DefaultVectorFormVol(int i, std::vector areas, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultVectorFormVol(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; @@ -195,26 +190,25 @@ namespace Hermes */ template - class HERMES_API DefaultResidualVol : public VectorFormVol + class HERMES_API DefaultResidualVol : public VectorFormVol < Scalar > { public: DefaultResidualVol(int i, std::string area = HERMES_ANY, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultResidualVol(int i, Hermes::vector areas, Hermes2DFunction* coeff = nullptr, + DefaultResidualVol(int i, std::vector areas, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultResidualVol(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; private: - int idx_i; Hermes2DFunction* coeff; bool own_coeff; @@ -228,28 +222,26 @@ namespace Hermes */ template - class HERMES_API DefaultResidualDiffusion : public VectorFormVol + class HERMES_API DefaultResidualDiffusion : public VectorFormVol < Scalar > { public: DefaultResidualDiffusion(int i, std::string area = HERMES_ANY, Hermes1DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultResidualDiffusion(int i, Hermes::vector areas, Hermes1DFunction* coeff = nullptr, + DefaultResidualDiffusion(int i, std::vector areas, Hermes1DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultResidualDiffusion(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; private: - int idx_i; - Hermes1DFunction* coeff; bool own_coeff; GeomType gt; @@ -261,27 +253,26 @@ namespace Hermes */ template - class HERMES_API DefaultResidualAdvection : public VectorFormVol + class HERMES_API DefaultResidualAdvection : public VectorFormVol < Scalar > { public: DefaultResidualAdvection(int i, std::string area = HERMES_ANY, Hermes1DFunction* coeff_1 = nullptr, Hermes1DFunction* coeff_2 = nullptr, GeomType gt = HERMES_PLANAR); - DefaultResidualAdvection(int i, Hermes::vector areas, + DefaultResidualAdvection(int i, std::vector areas, Hermes1DFunction* coeff_1 = nullptr, Hermes1DFunction* coeff_2 = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultResidualAdvection(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; private: - int idx_i; Hermes1DFunction* coeff1, *coeff2; bool own_coeff1; bool own_coeff2; @@ -294,24 +285,24 @@ namespace Hermes */ template - class HERMES_API DefaultMatrixFormSurf : public MatrixFormSurf + class HERMES_API DefaultMatrixFormSurf : public MatrixFormSurf < Scalar > { public: DefaultMatrixFormSurf(int i, int j, std::string area = HERMES_ANY, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultMatrixFormSurf(int i, int j, Hermes::vector areas, + DefaultMatrixFormSurf(int i, int j, std::vector areas, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultMatrixFormSurf(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomSurf *e, Func **ext) const; virtual MatrixFormSurf* clone() const; @@ -328,27 +319,25 @@ namespace Hermes */ template - class HERMES_API DefaultJacobianFormSurf : public MatrixFormSurf + class HERMES_API DefaultJacobianFormSurf : public MatrixFormSurf < Scalar > { public: DefaultJacobianFormSurf(int i, int j, std::string area = HERMES_ANY, Hermes1DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultJacobianFormSurf(int i, int j, Hermes::vector areas, Hermes1DFunction* coeff = nullptr, + DefaultJacobianFormSurf(int i, int j, std::vector areas, Hermes1DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultJacobianFormSurf(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomSurf *e, Func **ext) const; virtual MatrixFormSurf* clone() const; private: - int idx_j; - Hermes1DFunction* coeff; bool own_coeff; GeomType gt; @@ -360,21 +349,21 @@ namespace Hermes */ template - class HERMES_API DefaultVectorFormSurf : public VectorFormSurf + class HERMES_API DefaultVectorFormSurf : public VectorFormSurf < Scalar > { public: DefaultVectorFormSurf(int i, std::string area = HERMES_ANY, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultVectorFormSurf(int i, Hermes::vector areas, Hermes2DFunction* coeff = nullptr, + DefaultVectorFormSurf(int i, std::vector areas, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultVectorFormSurf(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual VectorFormSurf* clone() const; @@ -391,27 +380,25 @@ namespace Hermes */ template - class HERMES_API DefaultResidualSurf : public VectorFormSurf + class HERMES_API DefaultResidualSurf : public VectorFormSurf < Scalar > { public: DefaultResidualSurf(int i, std::string area = HERMES_ANY, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultResidualSurf(int i, Hermes::vector areas, Hermes2DFunction* coeff = nullptr, + DefaultResidualSurf(int i, std::vector areas, Hermes2DFunction* coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultResidualSurf(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual VectorFormSurf* clone() const; private: - int idx_i; - Hermes2DFunction* coeff; bool own_coeff; GeomType gt; @@ -420,7 +407,7 @@ namespace Hermes /* Default weak form for the Laplace equation -div(const_coeff spline_coeff(u) grad u) = 0. */ template - class HERMES_API DefaultWeakFormLaplace : public WeakForm + class HERMES_API DefaultWeakFormLaplace : public WeakForm < Scalar > { public: DefaultWeakFormLaplace(std::string area = HERMES_ANY, Hermes1DFunction* coeff = nullptr, @@ -428,7 +415,7 @@ namespace Hermes }; template - class HERMES_API DefaultWeakFormLaplaceLinear : public WeakForm + class HERMES_API DefaultWeakFormLaplaceLinear : public WeakForm < Scalar > { public: DefaultWeakFormLaplaceLinear(std::string area = HERMES_ANY, GeomType gt = HERMES_PLANAR); @@ -437,7 +424,7 @@ namespace Hermes /* Default weak form for the Poisson equation -div(const_coeff spline_coeff(u) grad u) - rhs = 0. */ template - class HERMES_API DefaultWeakFormPoisson : public WeakForm + class HERMES_API DefaultWeakFormPoisson : public WeakForm < Scalar > { public: DefaultWeakFormPoisson(); @@ -445,7 +432,7 @@ namespace Hermes }; template - class HERMES_API DefaultWeakFormPoissonLinear : public WeakForm + class HERMES_API DefaultWeakFormPoissonLinear : public WeakForm < Scalar > { public: DefaultWeakFormPoissonLinear(std::string area = HERMES_ANY, Hermes2DFunction* f = nullptr, GeomType gt = HERMES_PLANAR); diff --git a/hermes2d/include/weakform_library/weakforms_hcurl.h b/hermes2d/include/weakform_library/weakforms_hcurl.h index 34861f188c..ffdf27f971 100644 --- a/hermes2d/include/weakform_library/weakforms_hcurl.h +++ b/hermes2d/include/weakform_library/weakforms_hcurl.h @@ -31,24 +31,24 @@ namespace Hermes */ template - class HERMES_API DefaultMatrixFormVol : public MatrixFormVol + class HERMES_API DefaultMatrixFormVol : public MatrixFormVol < Scalar > { public: DefaultMatrixFormVol(int i, int j, std::string area = HERMES_ANY, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); - DefaultMatrixFormVol(int i, int j, Hermes::vector areas, + DefaultMatrixFormVol(int i, int j, std::vector areas, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); ~DefaultMatrixFormVol(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; @@ -64,24 +64,24 @@ namespace Hermes */ template - class HERMES_API DefaultJacobianCurlCurl : public MatrixFormVol + class HERMES_API DefaultJacobianCurlCurl : public MatrixFormVol < Scalar > { public: DefaultJacobianCurlCurl(int i, int j, std::string area = HERMES_ANY, Scalar const_coeff = 1.0, CubicSpline* c_spline = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); - DefaultJacobianCurlCurl(int i, int j, Hermes::vector areas, Scalar const_coeff = 1.0, + DefaultJacobianCurlCurl(int i, int j, std::vector areas, Scalar const_coeff = 1.0, CubicSpline* c_spline = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR); ~DefaultJacobianCurlCurl(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; @@ -98,7 +98,7 @@ namespace Hermes */ template - class HERMES_API DefaultVectorFormVol : public VectorFormVol + class HERMES_API DefaultVectorFormVol : public VectorFormVol < Scalar > { public: DefaultVectorFormVol(int i, std::string area = HERMES_ANY, @@ -107,7 +107,7 @@ namespace Hermes Hermes2DFunction* f_coeff1 = nullptr, GeomType gt = HERMES_PLANAR); - DefaultVectorFormVol(int i, Hermes::vector areas, + DefaultVectorFormVol(int i, std::vector areas, Scalar const_coeff0 = 1.0, Scalar const_coeff1 = 1.0, Hermes2DFunction* f_coeff0 = nullptr, Hermes2DFunction* f_coeff1 = nullptr, @@ -116,10 +116,10 @@ namespace Hermes ~DefaultVectorFormVol(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; @@ -135,24 +135,24 @@ namespace Hermes */ template - class HERMES_API DefaultResidualVol : public VectorFormVol + class HERMES_API DefaultResidualVol : public VectorFormVol < Scalar > { public: DefaultResidualVol(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultResidualVol(int i, Hermes::vector areas, Scalar const_coeff = 1.0, + DefaultResidualVol(int i, std::vector areas, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultResidualVol(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; @@ -171,24 +171,24 @@ namespace Hermes */ template - class HERMES_API DefaultResidualCurlCurl : public VectorFormVol + class HERMES_API DefaultResidualCurlCurl : public VectorFormVol < Scalar > { public: DefaultResidualCurlCurl(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0, CubicSpline* c_spline = nullptr, GeomType gt = HERMES_PLANAR); - DefaultResidualCurlCurl(int i, Hermes::vector areas, Scalar const_coeff = 1.0, + DefaultResidualCurlCurl(int i, std::vector areas, Scalar const_coeff = 1.0, CubicSpline* c_spline = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultResidualCurlCurl(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; @@ -205,24 +205,24 @@ namespace Hermes */ template - class HERMES_API DefaultMatrixFormSurf : public MatrixFormSurf + class HERMES_API DefaultMatrixFormSurf : public MatrixFormSurf < Scalar > { public: DefaultMatrixFormSurf(int i, int j, std::string area = HERMES_ANY, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultMatrixFormSurf(int i, int j, Hermes::vector areas, + DefaultMatrixFormSurf(int i, int j, std::vector areas, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultMatrixFormSurf(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomSurf *e, Func **ext) const; virtual MatrixFormSurf* clone() const; @@ -239,24 +239,24 @@ namespace Hermes */ template - class HERMES_API DefaultVectorFormSurf : public VectorFormSurf + class HERMES_API DefaultVectorFormSurf : public VectorFormSurf < Scalar > { public: DefaultVectorFormSurf(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultVectorFormSurf(int i, Hermes::vector areas, Scalar const_coeff = 1.0, + DefaultVectorFormSurf(int i, std::vector areas, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultVectorFormSurf(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual VectorFormSurf* clone() const; @@ -272,24 +272,24 @@ namespace Hermes */ template - class HERMES_API DefaultResidualSurf : public VectorFormSurf + class HERMES_API DefaultResidualSurf : public VectorFormSurf < Scalar > { public: DefaultResidualSurf(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, GeomType gt = HERMES_PLANAR); - DefaultResidualSurf(int i, Hermes::vector areas, + DefaultResidualSurf(int i, std::vector areas, Scalar const_coeff = 1.0, Hermes2DFunction* f_coeff = nullptr, GeomType gt = HERMES_PLANAR); ~DefaultResidualSurf(); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomSurf *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomSurf *e, Func **ext) const; virtual VectorFormSurf* clone() const; diff --git a/hermes2d/include/weakform_library/weakforms_maxwell.h b/hermes2d/include/weakform_library/weakforms_maxwell.h index 73619570af..4815768320 100644 --- a/hermes2d/include/weakform_library/weakforms_maxwell.h +++ b/hermes2d/include/weakform_library/weakforms_maxwell.h @@ -28,21 +28,21 @@ namespace Hermes */ template - class HERMES_API DefaultJacobianMagnetostatics : public MatrixFormVol + class HERMES_API DefaultJacobianMagnetostatics : public MatrixFormVol < Scalar > { public: DefaultJacobianMagnetostatics(int i, int j, std::string area = HERMES_ANY, Scalar const_coeff = 1.0, CubicSpline* c_spline = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR, int order_increase = 3); - DefaultJacobianMagnetostatics(int i, int j, Hermes::vector areas, + DefaultJacobianMagnetostatics(int i, int j, std::vector areas, Scalar const_coeff, CubicSpline* c_spline = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR, int order_increase = 3); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; // This is to make the form usable in rk_time_step_newton(). virtual MatrixFormVol* clone() const; @@ -56,22 +56,22 @@ namespace Hermes }; template - class HERMES_API DefaultResidualMagnetostatics : public VectorFormVol + class HERMES_API DefaultResidualMagnetostatics : public VectorFormVol < Scalar > { public: DefaultResidualMagnetostatics(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0, CubicSpline* c_spline = nullptr, GeomType gt = HERMES_PLANAR, int order_increase = 3); - DefaultResidualMagnetostatics(int i, Hermes::vector areas, Scalar const_coeff = 1.0, + DefaultResidualMagnetostatics(int i, std::vector areas, Scalar const_coeff = 1.0, CubicSpline* c_spline = nullptr, GeomType gt = HERMES_PLANAR, int order_increase = 3); virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; // This is to make the form usable in rk_time_step_newton(). virtual VectorFormVol* clone() const; diff --git a/hermes2d/include/weakform_library/weakforms_neutronics.h b/hermes2d/include/weakform_library/weakforms_neutronics.h index e15cfa97a2..0d857b3277 100644 --- a/hermes2d/include/weakform_library/weakforms_neutronics.h +++ b/hermes2d/include/weakform_library/weakforms_neutronics.h @@ -37,13 +37,13 @@ namespace Hermes be enabled by creating a descendant and adding surface forms to it. */ template - class HERMES_API DefaultWeakFormFixedSource : public WeakForm + class HERMES_API DefaultWeakFormFixedSource : public WeakForm < Scalar > { public: - DefaultWeakFormFixedSource( Hermes::vector regions, - Hermes::vector D_map, - Hermes::vector Sigma_a_map, - Hermes::vector Q_map ); + DefaultWeakFormFixedSource(std::vector regions, + std::vector D_map, + std::vector Sigma_a_map, + std::vector Q_map); }; } } @@ -112,7 +112,7 @@ namespace Hermes void operator() (MaterialPropertyMap1::value_type x) { MaterialPropertyMap1::mapped_type::iterator it; for (it = x.second.begin(); it != x.second.end(); ++it) - if(fabs(*it) > 1e-14) + if (fabs(*it) > 1e-14) throw Hermes::Exceptions::Exception(E_INVALID_COMBINATION); } }; @@ -122,17 +122,17 @@ namespace Hermes : nrows(nrows), ncols(ncols) {}; void operator() (MaterialPropertyMap1::value_type x) { - if(x.second.size() != nrows) + if (x.second.size() != nrows) throw Hermes::Exceptions::Exception(E_INVALID_SIZE); } void operator() (MaterialPropertyMap2::value_type x) { - if(x.second.size() != nrows) + if (x.second.size() != nrows) throw Hermes::Exceptions::Exception(E_INVALID_SIZE); MaterialPropertyMap2::mapped_type::iterator it; for (it = x.second.begin(); it != x.second.end(); ++it) - if(it->size() != ncols) + if (it->size() != ncols) throw Hermes::Exceptions::Exception(E_INVALID_SIZE); } @@ -155,15 +155,15 @@ namespace Hermes template static rank0 divide(rank0 x, rank0 y) { - if(x == 0 && y == 0) + if (x == 0 && y == 0) return 0.0; - else if(y == 0) + else if (y == 0) { throw Hermes::Exceptions::Exception(E_INF_VALUE); return -1.0; } else - return x/y; + return x / y; } template @@ -188,7 +188,7 @@ namespace Hermes typedef typename NDArrayType::value_type dim_type; \ typename NDArrayType::const_iterator dim_iterator_x = x.begin(); \ typename NDArrayType::const_iterator dim_iterator_y = y.begin(); \ - for ( ; dim_iterator_x != x.end(); ++dim_iterator_x, ++dim_iterator_y ) + for (; dim_iterator_x != x.end(); ++dim_iterator_x, ++dim_iterator_y) template static NDArrayType divide(const NDArrayType& x, const NDArrayType& y) @@ -196,7 +196,7 @@ namespace Hermes NDArrayType res; res.reserve(x.size()); for_each_element_in_dimension - res.push_back( divide(*dim_iterator_x, *dim_iterator_y) ); + res.push_back(divide(*dim_iterator_x, *dim_iterator_y)); return res; } @@ -207,7 +207,7 @@ namespace Hermes NDArrayType res; res.reserve(x.size()); for_each_element_in_dimension - res.push_back( multiply(*dim_iterator_x, *dim_iterator_y) ); + res.push_back(multiply(*dim_iterator_x, *dim_iterator_y)); return res; } @@ -218,7 +218,7 @@ namespace Hermes NDArrayType res; res.reserve(x.size()); for_each_element_in_dimension - res.push_back( add(*dim_iterator_x, *dim_iterator_y) ); + res.push_back(add(*dim_iterator_x, *dim_iterator_y)); return res; } @@ -229,7 +229,7 @@ namespace Hermes NDArrayType res; res.reserve(x.size()); for_each_element_in_dimension - res.push_back( subtract(*dim_iterator_x, *dim_iterator_y) ); + res.push_back(subtract(*dim_iterator_x, *dim_iterator_y)); return res; } @@ -240,7 +240,7 @@ namespace Hermes typename std::map::iterator iterator_ret = ret.begin(); \ typename std::map::const_iterator iterator_x = x.begin(); \ typename std::map::const_iterator iterator_y = y.begin(); \ - for ( ; iterator_x != x.end(); ++iterator_x, ++iterator_y, ++iterator_ret ) + for (; iterator_x != x.end(); ++iterator_x, ++iterator_y, ++iterator_ret) template static std::map divide(const std::map& x, @@ -512,7 +512,7 @@ namespace Hermes class MultiArray { private: - Hermes::vector m_data; + std::vector m_data; public: MultiArray(const NDArrayType& val) { m_data.push_back(val); @@ -523,7 +523,7 @@ namespace Hermes return *this; } - operator Hermes::vector() { + operator std::vector() { return m_data; } }; @@ -533,7 +533,7 @@ namespace Hermes typedef MultiArray row; typedef MultiArray mat; typedef MultiArray bool_row; - typedef MultiArray< Hermes::vector > bool_mat; + typedef MultiArray< std::vector > bool_mat; } } @@ -566,7 +566,7 @@ namespace Hermes { // TODO: General albedo boundary condition. template - class HERMES_API Jacobian : public MatrixFormSurf + class HERMES_API Jacobian : public MatrixFormSurf < Scalar > { public: Jacobian(unsigned int g, GeomType geom_type = HERMES_PLANAR) @@ -583,20 +583,20 @@ namespace Hermes template ScalarTestFns matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomSurf *e, Func **ext) const; virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const { - return matrix_form(n, wt, u_ext, u, v, e, ext); + Func *v, GeomSurf *e, Func **ext) const { + return matrix_form(n, wt, u_ext, u, v, e, ext); } virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const { - return matrix_form(n, wt, u_ext, u, v, e, ext); + Func *v, GeomSurf *e, Func **ext) const { + return matrix_form(n, wt, u_ext, u, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual MatrixFormSurf* clone() { + virtual MatrixFormSurf* clone() const { return new Jacobian(*this); } @@ -606,7 +606,7 @@ namespace Hermes }; template - class HERMES_API Residual : public VectorFormSurf + class HERMES_API Residual : public VectorFormSurf < Scalar > { public: Residual(unsigned int g, GeomType geom_type = HERMES_PLANAR) @@ -623,20 +623,20 @@ namespace Hermes template ScalarTestFns vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomSurf *e, Func **ext) const; virtual Scalar value(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const { - return vector_form(n, wt, u_ext, v, e, ext); + Func *v, GeomSurf *e, Func **ext) const { + return vector_form(n, wt, u_ext, v, e, ext); } virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const { - return vector_form(n, wt, u_ext, v, e, ext); + Func *v, GeomSurf *e, Func **ext) const { + return vector_form(n, wt, u_ext, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual VectorFormSurf* clone() { + virtual VectorFormSurf* clone() const { return new Residual(*this); } @@ -685,21 +685,21 @@ namespace Hermes }; template - ScalarTestFns matrix_form( int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext ) const; + ScalarTestFns matrix_form(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const; - virtual Scalar value( int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext ) const { - return matrix_form (n, wt, u_ext, u, v, e, ext); + virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { + return matrix_form(n, wt, u_ext, u, v, e, ext); } - virtual Hermes::Ord ord( int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext ) const { - return matrix_form (n, wt, u_ext, u, v, e, ext); + virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { + return matrix_form(n, wt, u_ext, u, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual MatrixFormVol* clone() { + virtual MatrixFormVol* clone() const { return new Jacobian(*this); } @@ -747,20 +747,20 @@ namespace Hermes template ScalarTestFns vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return vector_form(n, wt, u_ext, v, e, ext); } virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return vector_form(n, wt, u_ext, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual VectorFormVol* clone() { + virtual VectorFormVol* clone() const { return new Residual(*this); } @@ -777,15 +777,15 @@ namespace Hermes { public: - Jacobian( unsigned int gto, unsigned int gfrom, - const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR ) + Jacobian(unsigned int gto, unsigned int gfrom, + const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR) : MatrixFormVol(gto, gfrom), GenericForm(matprop, geom_type), gto(gto), gfrom(gfrom) {}; - Jacobian( unsigned int gto, unsigned int gfrom, std::string area, - const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR ) + Jacobian(unsigned int gto, unsigned int gfrom, std::string area, + const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR) : MatrixFormVol(gto, gfrom), GenericForm(matprop, geom_type), gto(gto), gfrom(gfrom) @@ -793,14 +793,14 @@ namespace Hermes this->set_area(area); }; - Jacobian( unsigned int gto, unsigned int gfrom, + Jacobian(unsigned int gto, unsigned int gfrom, const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR) : MatrixFormVol(gto, gfrom), GenericForm(matprop, mesh, geom_type), gto(gto), gfrom(gfrom) {}; - Jacobian( unsigned int gto, unsigned int gfrom, std::string area, + Jacobian(unsigned int gto, unsigned int gfrom, std::string area, const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR) : MatrixFormVol(gto, gfrom), GenericForm(matprop, mesh, geom_type), @@ -810,21 +810,21 @@ namespace Hermes }; template - ScalarTestFns matrix_form( int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext ) const; + ScalarTestFns matrix_form(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const; - virtual Scalar value( int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext ) const { - return -1.0 * matrix_form (n, wt, u_ext, u, v, e, ext); + virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { + return -1.0 * matrix_form(n, wt, u_ext, u, v, e, ext); } - virtual Hermes::Ord ord( int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext ) const { - return matrix_form (n, wt, u_ext, u, v, e, ext); + virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { + return matrix_form(n, wt, u_ext, u, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual MatrixFormVol* clone() { + virtual MatrixFormVol* clone() const { return new Jacobian(*this); } @@ -838,80 +838,80 @@ namespace Hermes { public: - OuterIterationForm( unsigned int g, + OuterIterationForm(unsigned int g, const MaterialPropertyMaps& matprop, - Hermes::vector >& iterates, + std::vector >& iterates, double keff = 1.0, - GeomType geom_type = HERMES_PLANAR ) + GeomType geom_type = HERMES_PLANAR) : VectorFormVol(g), GenericForm(matprop, geom_type), g(g), keff(keff) { - this->wf->set_ext(iterates); - if(g >= iterates.size()) + //this->wf->set_ext(iterates); + if (g >= iterates.size()) throw Hermes::Exceptions::Exception(E_INVALID_GROUP_INDEX); } - OuterIterationForm( unsigned int g, std::string area, + OuterIterationForm(unsigned int g, std::string area, const MaterialPropertyMaps& matprop, - Hermes::vector >& iterates, + std::vector >& iterates, double keff = 1.0, - GeomType geom_type = HERMES_PLANAR ) + GeomType geom_type = HERMES_PLANAR) : VectorFormVol(g), GenericForm(matprop, geom_type), g(g), keff(keff) { this->set_area(area); - this->wf->set_ext(iterates); - if(g >= iterates.size()) + //this->wf->set_ext(iterates); + if (g >= iterates.size()) throw Hermes::Exceptions::Exception(E_INVALID_GROUP_INDEX); } - OuterIterationForm( unsigned int g, + OuterIterationForm(unsigned int g, const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - Hermes::vector >& iterates, + std::vector >& iterates, double keff = 1.0, - GeomType geom_type = HERMES_PLANAR ) + GeomType geom_type = HERMES_PLANAR) : VectorFormVol(g), GenericForm(matprop, mesh, geom_type), g(g), keff(keff) { - this->wf->set_ext(iterates); - if(g >= iterates.size()) + //this->wf->set_ext(iterates); + if (g >= iterates.size()) throw Hermes::Exceptions::Exception(E_INVALID_GROUP_INDEX); } - OuterIterationForm( unsigned int g, std::string area, + OuterIterationForm(unsigned int g, std::string area, const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - Hermes::vector >& iterates, + std::vector >& iterates, double keff = 1.0, - GeomType geom_type = HERMES_PLANAR ) + GeomType geom_type = HERMES_PLANAR) : VectorFormVol(g), GenericForm(matprop, mesh, geom_type), g(g), keff(keff) { this->set_area(area); - this->wf->set_ext(iterates); - if(g >= iterates.size()) + //this->wf->set_ext(iterates); + if (g >= iterates.size()) throw Hermes::Exceptions::Exception(E_INVALID_GROUP_INDEX); } template ScalarTestFns vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return -1.0 * vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return -1.0 * vector_form(n, wt, u_ext, v, e, ext); } virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return vector_form(n, wt, u_ext, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual VectorFormVol* clone() { + virtual VectorFormVol* clone() const { return new OuterIterationForm(*this); } @@ -927,15 +927,15 @@ namespace Hermes class HERMES_API Residual : public VectorFormVol, protected GenericForm { public: - Residual( unsigned int gto, unsigned int gfrom, - const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR ) + Residual(unsigned int gto, unsigned int gfrom, + const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR) : VectorFormVol(gto), GenericForm(matprop, geom_type), gto(gto), gfrom(gfrom) {}; - Residual( unsigned int gto, unsigned int gfrom, std::string area, - const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR ) + Residual(unsigned int gto, unsigned int gfrom, std::string area, + const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR) : VectorFormVol(gto), GenericForm(matprop, geom_type), gto(gto), gfrom(gfrom) @@ -943,15 +943,15 @@ namespace Hermes this->set_area(area); }; - Residual( unsigned int gto, unsigned int gfrom, - const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR ) + Residual(unsigned int gto, unsigned int gfrom, + const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR) : VectorFormVol(gto), GenericForm(matprop, mesh, geom_type), gto(gto), gfrom(gfrom) {}; - Residual( unsigned int gto, unsigned int gfrom, std::string area, - const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR ) + Residual(unsigned int gto, unsigned int gfrom, std::string area, + const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR) : VectorFormVol(gto), GenericForm(matprop, mesh, geom_type), gto(gto), gfrom(gfrom) @@ -961,20 +961,20 @@ namespace Hermes template ScalarTestFns vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return -1.0 * vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return -1.0 * vector_form(n, wt, u_ext, v, e, ext); } virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return vector_form(n, wt, u_ext, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual VectorFormVol* clone() { + virtual VectorFormVol* clone() const { return new Residual(*this); } @@ -991,50 +991,50 @@ namespace Hermes { public: - Jacobian( unsigned int gto, unsigned int gfrom, - const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR ) + Jacobian(unsigned int gto, unsigned int gfrom, + const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR) : MatrixFormVol(gto, gfrom), GenericForm(matprop, geom_type), gto(gto), gfrom(gfrom) {}; - Jacobian( unsigned int gto, unsigned int gfrom, std::string area, - const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR ) + Jacobian(unsigned int gto, unsigned int gfrom, std::string area, + const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR) : MatrixFormVol(gto, gfrom, area), GenericForm(matprop, geom_type), gto(gto), gfrom(gfrom) {}; - Jacobian( unsigned int gto, unsigned int gfrom, - const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR ) + Jacobian(unsigned int gto, unsigned int gfrom, + const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR) : MatrixFormVol(gto, gfrom), GenericForm(matprop, mesh, geom_type), gto(gto), gfrom(gfrom) {}; - Jacobian( unsigned int gto, unsigned int gfrom, std::string area, - const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR ) + Jacobian(unsigned int gto, unsigned int gfrom, std::string area, + const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR) : MatrixFormVol(gto, gfrom, area), GenericForm(matprop, mesh, geom_type), gto(gto), gfrom(gfrom) {}; template - ScalarTestFns matrix_form( int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext ) const; + ScalarTestFns matrix_form(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const; - virtual Scalar value( int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext ) const { - return -1.0 * matrix_form (n, wt, u_ext, u, v, e, ext); + virtual Scalar value(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { + return -1.0 * matrix_form(n, wt, u_ext, u, v, e, ext); } - virtual Hermes::Ord ord( int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext ) const { - return matrix_form (n, wt, u_ext, u, v, e, ext); + virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { + return matrix_form(n, wt, u_ext, u, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual MatrixFormVol* clone() { + virtual MatrixFormVol* clone() const { return new Jacobian(*this); } @@ -1047,33 +1047,33 @@ namespace Hermes class Residual : public VectorFormVol, protected GenericForm { public: - Residual( unsigned int gto, unsigned int gfrom, + Residual(unsigned int gto, unsigned int gfrom, const MaterialPropertyMaps& matprop, - GeomType geom_type = HERMES_PLANAR ) + GeomType geom_type = HERMES_PLANAR) : VectorFormVol(gto), GenericForm(matprop, geom_type), gto(gto), gfrom(gfrom) {}; - Residual( unsigned int gto, unsigned int gfrom, std::string area, + Residual(unsigned int gto, unsigned int gfrom, std::string area, const MaterialPropertyMaps& matprop, - GeomType geom_type = HERMES_PLANAR ) + GeomType geom_type = HERMES_PLANAR) : VectorFormVol(gto, area), GenericForm(matprop, geom_type), gto(gto), gfrom(gfrom) {}; - Residual( unsigned int gto, unsigned int gfrom, + Residual(unsigned int gto, unsigned int gfrom, const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - GeomType geom_type = HERMES_PLANAR ) + GeomType geom_type = HERMES_PLANAR) : VectorFormVol(gto), GenericForm(matprop, mesh, geom_type), gto(gto), gfrom(gfrom) {}; - Residual( unsigned int gto, unsigned int gfrom, std::string area, + Residual(unsigned int gto, unsigned int gfrom, std::string area, const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - GeomType geom_type = HERMES_PLANAR ) + GeomType geom_type = HERMES_PLANAR) : VectorFormVol(gto, area), GenericForm(matprop, mesh, geom_type), gto(gto), gfrom(gfrom) @@ -1081,20 +1081,20 @@ namespace Hermes template ScalarTestFns vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return -1.0 * vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return -1.0 * vector_form(n, wt, u_ext, v, e, ext); } virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return vector_form(n, wt, u_ext, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual VectorFormVol* clone() { + virtual VectorFormVol* clone() const { return new Residual(*this); } @@ -1111,28 +1111,28 @@ namespace Hermes { public: - LinearForm( unsigned int g, + LinearForm(unsigned int g, const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR) : VectorFormVol(g), GenericForm(matprop, geom_type), g(g) {}; - LinearForm( unsigned int g, std::string area, + LinearForm(unsigned int g, std::string area, const MaterialPropertyMaps& matprop, GeomType geom_type = HERMES_PLANAR) : VectorFormVol(g, area), GenericForm(matprop, geom_type), g(g) {}; - LinearForm( unsigned int g, + LinearForm(unsigned int g, const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR) : VectorFormVol(g), GenericForm(matprop, mesh, geom_type), g(g) {}; - LinearForm( unsigned int g, std::string area, + LinearForm(unsigned int g, std::string area, const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type = HERMES_PLANAR) : VectorFormVol(g, area), GenericForm(matprop, mesh, geom_type), @@ -1141,20 +1141,20 @@ namespace Hermes template ScalarTestFns vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Scalar value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return -1.0 * vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return -1.0 * vector_form(n, wt, u_ext, v, e, ext); } virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const { - return vector_form(n, wt, u_ext, v, e, ext); + GeomVol *e, Func **ext) const { + return vector_form(n, wt, u_ext, v, e, ext); } // This is to make the form usable in rk_time_step_newton(). - virtual VectorFormVol* clone() { + virtual VectorFormVol* clone() const { return new LinearForm(*this); } @@ -1174,7 +1174,7 @@ namespace Hermes using namespace ElementaryForms::Diffusion; template - class HERMES_API DefaultWeakFormFixedSource : public WeakForm + class HERMES_API DefaultWeakFormFixedSource : public WeakForm < Scalar > { protected: void lhs_init(unsigned int G, const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type); @@ -1190,31 +1190,31 @@ namespace Hermes DefaultWeakFormFixedSource(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, Hermes2DFunction*f_src, - Hermes::vector src_areas, + std::vector src_areas, GeomType geom_type = HERMES_PLANAR); DefaultWeakFormFixedSource(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - const Hermes::vector*>& f_src, + const std::vector*>& f_src, std::string src_area = HERMES_ANY, GeomType geom_type = HERMES_PLANAR); DefaultWeakFormFixedSource(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - const Hermes::vector*>& f_src, - Hermes::vector src_areas, + const std::vector*>& f_src, + std::vector src_areas, GeomType geom_type = HERMES_PLANAR); }; template - class HERMES_API DefaultWeakFormSourceIteration : public WeakForm + class HERMES_API DefaultWeakFormSourceIteration : public WeakForm < Scalar > { protected: - Hermes::vector*> keff_iteration_forms; + std::vector*> keff_iteration_forms; public: - DefaultWeakFormSourceIteration( const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - Hermes::vector >& iterates, + DefaultWeakFormSourceIteration(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, + std::vector >& iterates, double initial_keff_guess, - GeomType geom_type = HERMES_PLANAR ); + GeomType geom_type = HERMES_PLANAR); void update_keff(double new_keff); /// \todo This is needed by 4-group adapt, however it must have been removed, so I provided this dummy method to @@ -1229,12 +1229,12 @@ namespace Hermes using MaterialProperties::Common::MaterialPropertyMaps; using namespace MaterialProperties::Definitions; - class HERMES_API SourceFilter : public SimpleFilter + class HERMES_API SourceFilter : public SimpleFilter < double > { - public: - SourceFilter(Hermes::vector > solutions, const MaterialPropertyMaps* matprop, - const std::string& source_area) - : SimpleFilter(solutions, Hermes::vector()) + public: + SourceFilter(std::vector > solutions, const MaterialPropertyMaps* matprop, + const std::string& source_area) + : SimpleFilter(solutions, std::vector()), matprop(matprop), source_area(source_area) { nu = matprop->get_nu().at(source_area); Sigma_f = matprop->get_Sigma_f().at(source_area); @@ -1242,8 +1242,12 @@ namespace Hermes private: rank1 nu; rank1 Sigma_f; + const MaterialPropertyMaps* matprop; + const std::string& source_area; + + void filter_fn(int n, const std::vector& values, double* result); - void filter_fn(int n, Hermes::vector values, double* result); + MeshFunction* clone() const { return new SourceFilter(this->solutions, matprop, source_area); } }; } } diff --git a/hermes2d/src/adapt/adapt.cpp b/hermes2d/src/adapt/adapt.cpp index 6d2787b673..132e790b7f 100644 --- a/hermes2d/src/adapt/adapt.cpp +++ b/hermes2d/src/adapt/adapt.cpp @@ -80,7 +80,7 @@ namespace Hermes } template - Adapt::Adapt(Hermes::vector > spaces_, ErrorCalculator* errorCalculator, AdaptivityStoppingCriterion* strategy) : errorCalculator(errorCalculator), strategy(strategy) + Adapt::Adapt(std::vector > spaces_, ErrorCalculator* errorCalculator, AdaptivityStoppingCriterion* strategy) : errorCalculator(errorCalculator), strategy(strategy) { this->set_spaces(spaces_); this->init(); @@ -129,7 +129,7 @@ namespace Hermes } template - void Adapt::set_spaces(Hermes::vector > spaces) + void Adapt::set_spaces(std::vector > spaces) { this->spaces = spaces; this->num = spaces.size(); @@ -187,7 +187,7 @@ namespace Hermes } template - void Adapt::init_adapt(Hermes::vector*>& refinement_selectors, ElementToRefine*** element_refinement_location, MeshSharedPtr* meshes) + void Adapt::init_adapt(std::vector*>& refinement_selectors, ElementToRefine*** element_refinement_location, MeshSharedPtr* meshes) { // Start time measurement. this->tick(); @@ -200,14 +200,13 @@ namespace Hermes throw Exceptions::Exception("element errors have to be calculated first, call ErrorCalculator::calculate_errors()."); if (refinement_selectors.empty()) throw Exceptions::NullException(1); - if (spaces.size() != refinement_selectors.size()) - throw Exceptions::LengthException(1, refinement_selectors.size(), spaces.size()); + Helpers::check_length(refinement_selectors, this->spaces); // Get meshes for (int j = 0; j < this->num; j++) { meshes[j] = this->meshes[j]; - element_refinement_location[j] = calloc_with_check, ElementToRefine*> (meshes[j]->get_max_element_id() + 1, this); + element_refinement_location[j] = calloc_with_check, ElementToRefine*>(meshes[j]->get_max_element_id() + 1, this); } // Clearing. @@ -218,8 +217,8 @@ namespace Hermes if (this->refinementInfoMeshFunctionGlobal) this->refinementInfoMeshFunctionGlobal.reset(); for (int i = 0; i < this->num; i++) - if (this->refinementInfoMeshFunction[i]) - this->refinementInfoMeshFunction[i].reset(); + if (this->refinementInfoMeshFunction[i]) + this->refinementInfoMeshFunction[i].reset(); // Init the caught parallel exception message. this->exceptionMessageCaughtInParallelBlock.clear(); @@ -255,7 +254,7 @@ namespace Hermes } template - bool Adapt::adapt(Hermes::vector *> refinement_selectors) + bool Adapt::adapt(std::vector *> refinement_selectors) { // Initialize. MeshSharedPtr meshes[H2D_MAX_COMPONENTS]; @@ -274,19 +273,23 @@ namespace Hermes this->elements_to_refine = malloc_with_check, ElementToRefine>(elements_to_refine_count, this); // Projected solutions obtaining. - Hermes::vector > rslns; - OGProjection ogProjection; + std::vector > rslns; for (unsigned int i = 0; i < this->num; i++) { - rslns.push_back(MeshFunctionSharedPtr(new Solution())); + if (dynamic_cast*>(this->errorCalculator->fine_solutions[i].get())) + { + rslns.push_back(MeshFunctionSharedPtr(new Solution())); - typename Mesh::ReferenceMeshCreator ref_mesh_creator(this->meshes[i]); - MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh(); - typename Space::ReferenceSpaceCreator ref_space_creator(this->spaces[i], ref_mesh); - SpaceSharedPtr ref_space = ref_space_creator.create_ref_space(); + typename Mesh::ReferenceMeshCreator ref_mesh_creator(this->meshes[i]); + MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh(); + typename Space::ReferenceSpaceCreator ref_space_creator(this->spaces[i], ref_mesh); + SpaceSharedPtr ref_space = ref_space_creator.create_ref_space(); - ogProjection.project_global(ref_space, this->errorCalculator->fine_solutions[i], rslns[i]); + OGProjection::project_global(ref_space, this->errorCalculator->fine_solutions[i], rslns[i]); + } + else + rslns.push_back(this->errorCalculator->fine_solutions[i]); } // Parallel section @@ -299,7 +302,7 @@ namespace Hermes end = attempted_element_refinements_count; // rslns cloning. - Hermes::vector > current_rslns; + std::vector > current_rslns; for (unsigned int i = 0; i < this->num; i++) current_rslns.push_back(rslns[i]->clone()); @@ -320,11 +323,12 @@ namespace Hermes if (refinement_selectors[component]->select_refinement(meshes[component]->get_element(element_id), current_order, current_rslns[component].get(), elem_ref)) { // Put this refinement to the storage. + elem_ref.valid = true; elements_to_refine[id_to_refine] = elem_ref; element_refinement_location[component][element_id] = &elements_to_refine[id_to_refine]; } else - elements_to_refine[id_to_refine] = ElementToRefine(-1, -1); + elements_to_refine[id_to_refine] = ElementToRefine(); } catch (Hermes::Exceptions::Exception& e) { @@ -390,8 +394,8 @@ namespace Hermes int* parents; parents = meshes[i]->regularize(this->regularization); for (int j = 0; j < this->num; j++) - if (this->meshes[i]->get_seq() == this->meshes[j]->get_seq()) - this->spaces[j]->distribute_orders(meshes[i], parents); + if (this->meshes[i]->get_seq() == this->meshes[j]->get_seq()) + this->spaces[j]->distribute_orders(meshes[i], parents); free_with_check(parents); } } @@ -434,7 +438,7 @@ namespace Hermes // Traverse this->meshes.push_back(union_mesh); Traverse trav(this->meshes.size()); - int num_states; + unsigned int num_states; Traverse::State** states = trav.get_states(meshes, num_states); #pragma omp parallel num_threads(this->num_threads_used) { @@ -481,8 +485,8 @@ namespace Hermes else { for (int sons_i = 0; sons_i < H2D_MAX_ELEMENT_SONS; sons_i++) - if (this->spaces[component]->get_mesh()->get_element(this->elements_to_refine[i].id)->sons[sons_i]) - info_array[this->spaces[component]->get_mesh()->get_element(this->elements_to_refine[i].id)->sons[sons_i]->id] = this->elements_to_refine[i].split == H2D_REFINEMENT_H ? 1 : 2; + if (this->spaces[component]->get_mesh()->get_element(this->elements_to_refine[i].id)->sons[sons_i]) + info_array[this->spaces[component]->get_mesh()->get_element(this->elements_to_refine[i].id)->sons[sons_i]->id] = this->elements_to_refine[i].split == H2D_REFINEMENT_H ? 1 : 2; } } } @@ -497,7 +501,7 @@ namespace Hermes { if (!refinement_selector) throw Exceptions::NullException(1); - Hermes::vector *> refinement_selectors; + std::vector *> refinement_selectors; refinement_selectors.push_back(refinement_selector); return adapt(refinement_selectors); } @@ -515,15 +519,16 @@ namespace Hermes for (int inx = 0; inx < num_elem_to_proc; inx++) { ElementToRefine& elem_ref = elems_to_refine[inx]; - if (elem_ref.id == -1) + if (!elem_ref.valid) continue; //select a refinement used by all components that share a mesh which is about to be refined - int selected_refinement = elem_ref.split; + RefinementType selected_refinement = elem_ref.split; for (int j = 0; j < this->num; j++) { if (selected_refinement == H2D_REFINEMENT_H) - break; // iso refinement is max what can be recieved + // iso refinement is max what can be recieved + break; // if a mesh is shared if (j != elem_ref.comp && meshes[j]->get_seq() == meshes[elem_ref.comp]->get_seq()) @@ -535,7 +540,7 @@ namespace Hermes //select more complicated refinement if ((elem_ref_ii->split != selected_refinement) && (elem_ref_ii->split != H2D_REFINEMENT_P)) { - if ((elem_ref_ii->split == H2D_REFINEMENT_ANISO_H || elem_ref_ii->split == H2D_REFINEMENT_ANISO_V) && selected_refinement == H2D_REFINEMENT_P) + if ((elem_ref_ii->split == H2D_REFINEMENT_H_ANISO_H || elem_ref_ii->split == H2D_REFINEMENT_H_ANISO_V) && selected_refinement == H2D_REFINEMENT_P) selected_refinement = elem_ref_ii->split; else selected_refinement = H2D_REFINEMENT_H; @@ -574,7 +579,7 @@ namespace Hermes // This should occur only if the original refinement was a p-refinement. #ifdef _DEBUG this->warn("The best refinement poly degree is missing in fix_shared_mesh_refinements."); -#endif +#endif elem_ref_ii->refinement_polynomial_order[3] = elem_ref_ii->refinement_polynomial_order[2] = elem_ref_ii->refinement_polynomial_order[1] = elem_ref_ii->refinement_polynomial_order[0]; } } @@ -600,7 +605,7 @@ namespace Hermes free_with_check(elems_to_refine); elems_to_refine = new_elems_to_refine_array; - for (int inx = 0; inx < new_elems_to_refine.size(); inx++) + for (unsigned short inx = 0; inx < new_elems_to_refine.size(); inx++) elems_to_refine[num_elem_to_proc + inx] = new_elems_to_refine[inx]; num_elem_to_proc += new_elems_to_refine.size(); } @@ -642,10 +647,10 @@ namespace Hermes template void Adapt::apply_refinement(const ElementToRefine& elem_ref) { - if (elem_ref.id == -1) + if (!elem_ref.valid) return; - SpaceSharedPtr& space = this->spaces[elem_ref.comp]; + SpaceSharedPtr space = this->spaces[elem_ref.comp]; Element* e = space->get_mesh()->get_element(elem_ref.id); @@ -668,24 +673,24 @@ namespace Hermes { if (e->active) { - space->get_mesh()->refine_element_id(elem_ref.id, (elem_ref.split == H2D_REFINEMENT_ANISO_H ? 1 : 2)); + space->get_mesh()->refine_element_id(elem_ref.id, (elem_ref.split == H2D_REFINEMENT_H_ANISO_H ? 1 : 2)); } for (int j = 0; j < 2; j++) { - space->set_element_order_internal(e->sons[(elem_ref.split == H2D_REFINEMENT_ANISO_H) ? j : j + 2]->id, elem_ref.refinement_polynomial_order[j]); - space->edata[e->sons[(elem_ref.split == H2D_REFINEMENT_ANISO_H) ? j : j + 2]->id].changed_in_last_adaptation = true; + space->set_element_order_internal(e->sons[(elem_ref.split == H2D_REFINEMENT_H_ANISO_H) ? j : j + 2]->id, elem_ref.refinement_polynomial_order[j]); + space->edata[e->sons[(elem_ref.split == H2D_REFINEMENT_H_ANISO_H) ? j : j + 2]->id].changed_in_last_adaptation = true; } } } - template HERMES_API class AdaptStoppingCriterionCumulative; - template HERMES_API class AdaptStoppingCriterionCumulative >; - template HERMES_API class AdaptStoppingCriterionSingleElement; - template HERMES_API class AdaptStoppingCriterionSingleElement >; - template HERMES_API class AdaptStoppingCriterionLevels; - template HERMES_API class AdaptStoppingCriterionLevels >; + template HERMES_API class AdaptStoppingCriterionCumulative < double > ; + template HERMES_API class AdaptStoppingCriterionCumulative < std::complex > ; + template HERMES_API class AdaptStoppingCriterionSingleElement < double > ; + template HERMES_API class AdaptStoppingCriterionSingleElement < std::complex > ; + template HERMES_API class AdaptStoppingCriterionLevels < double > ; + template HERMES_API class AdaptStoppingCriterionLevels < std::complex > ; - template HERMES_API class Adapt; - template HERMES_API class Adapt >; + template HERMES_API class Adapt < double > ; + template HERMES_API class Adapt < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/adapt/adapt_solver.cpp b/hermes2d/src/adapt/adapt_solver.cpp new file mode 100644 index 0000000000..a289b49a83 --- /dev/null +++ b/hermes2d/src/adapt/adapt_solver.cpp @@ -0,0 +1,939 @@ +// This file is part of Hermes2D. +// +// Hermes2D is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// Hermes2D 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 Hermes2D. If not, see . + +#include "adapt_solver.h" +#include "solver/linear_solver.h" +#include "solver/newton_solver.h" +#include "solver/picard_solver.h" +#include "ogprojection.h" +#include "views/scalar_view.h" +#include "views/base_view.h" +#include "views/order_view.h" +#include "views/mesh_view.h" + +namespace Hermes +{ + namespace Hermes2D + { + AdaptSolverCriterion::AdaptSolverCriterion() + { + } + + AdaptSolverCriterionErrorThreshold::AdaptSolverCriterionErrorThreshold(double error_tolerance) : AdaptSolverCriterion(), error_threshold(error_threshold) + { + } + + bool AdaptSolverCriterionErrorThreshold::done(double error, unsigned short iteration) + { + return error < this->error_threshold; + } + + AdaptSolverCriterionFixed::AdaptSolverCriterionFixed(unsigned short refinement_levels) : AdaptSolverCriterion(), refinement_levels(refinement_levels) + { + } + + bool AdaptSolverCriterionFixed::done(double error, unsigned short iteration) + { + return iteration >= this->refinement_levels; + } + + template + AdaptSolver::AdaptSolver(std::vector > initial_spaces, WeakFormSharedPtr wf, ErrorCalculator* error_calculator, AdaptivityStoppingCriterion* stopping_criterion_single_step, std::vector*> selectors, AdaptSolverCriterion* stopping_criterion_global) + : spaces(initial_spaces), wf(wf), error_calculator(error_calculator), stopping_criterion_single_step(stopping_criterion_single_step), selectors(selectors), stopping_criterion_global(stopping_criterion_global) + { + this->init(); + } + + template + AdaptSolver::AdaptSolver(SpaceSharedPtr initial_space, WeakFormSharedPtr wf, ErrorCalculator* error_calculator, AdaptivityStoppingCriterion* stopping_criterion_single_step, RefinementSelectors::Selector* selector, AdaptSolverCriterion* stopping_criterion_global) + : wf(wf), stopping_criterion_single_step(stopping_criterion_single_step), error_calculator(error_calculator), stopping_criterion_global(stopping_criterion_global) + { + this->spaces.push_back(initial_space); + this->selectors.push_back(selector); + + this->init(); + } + + template + void AdaptSolver::init() + { + this->number_of_equations = this->spaces.size(); + Helpers::check_length(this->selectors, this->number_of_equations); + this->solve_method_running = false; + this->visualization = false; + this->wait_for_keypress = false; + this->prev_mat = nullptr; + this->prev_rhs = nullptr; + this->prev_dirichlet_lift_rhs = nullptr; + this->solver = new SolverType(wf, spaces); + } + + template + AdaptSolver::~AdaptSolver() + { + if (this->prev_mat) + delete this->prev_mat; + + if (this->prev_rhs) + delete this->prev_rhs; + + if (this->prev_dirichlet_lift_rhs) + delete this->prev_dirichlet_lift_rhs; + + delete this->solver; + } + + template + void AdaptSolver::set_verbose_output(bool to_set) + { + Loggable::set_verbose_output(to_set); + if (this->error_calculator) + this->error_calculator->set_verbose_output(to_set); + } + + template + void AdaptSolver::switch_visualization(bool on_off, bool wait_for_keypress_on_off) + { + this->visualization = on_off; + this->wait_for_keypress = wait_for_keypress_on_off; + } + + template + class StateReassemblyHelper + { + public: + static int current_iteration; + static std::unordered_set* current_elements_to_reassemble[H2D_MAX_COMPONENTS]; + static std::unordered_set* current_DOFs_to_reassemble[H2D_MAX_COMPONENTS]; + static std::vector >* current_ref_spaces; + static std::vector >* current_prev_ref_spaces; + static unsigned char current_number_of_equations; + static CSCMatrix* current_prev_mat; + static Vector* current_prev_rhs; + static Vector* current_prev_dirichlet_lift_rhs; + + static bool use_Dirichlet; + static bool** reusable_DOFs; + static bool** reusable_Dirichlet; + }; + + template + int StateReassemblyHelper::current_iteration; + + template + std::unordered_set* StateReassemblyHelper::current_elements_to_reassemble[H2D_MAX_COMPONENTS]; + + template + std::unordered_set* StateReassemblyHelper::current_DOFs_to_reassemble[H2D_MAX_COMPONENTS]; + + template + std::vector >* StateReassemblyHelper::current_ref_spaces; + + template + std::vector >* StateReassemblyHelper::current_prev_ref_spaces; + + template + CSCMatrix* StateReassemblyHelper::current_prev_mat; + + template + Vector* StateReassemblyHelper::current_prev_rhs; + + template + Vector* StateReassemblyHelper::current_prev_dirichlet_lift_rhs; + + template + unsigned char StateReassemblyHelper::current_number_of_equations; + + template + bool** StateReassemblyHelper::reusable_DOFs; + + template + bool** StateReassemblyHelper::reusable_Dirichlet; + + template + bool StateReassemblyHelper::use_Dirichlet; + + //#define DEBUG_VIEWS + + template + static bool compare(Scalar a, Scalar b); + + template<> + bool compare(std::complex a, std::complex b) + { + if (a.real() < b.real() && a.imag() < b.imag()) + return true; + else + return false; + } + + template<> + bool compare(double a, double b) + { + return a < b; + } + + template + void get_states_to_reassemble(Traverse::State**& states, unsigned int& num_states, SparseMatrix* mat, Vector* rhs, Vector* dirichlet_lift_rhs, Scalar*& coeff_vec) + { + int current_iteration = StateReassemblyHelper::current_iteration; + if (StateReassemblyHelper::current_iteration == 1) + { + (*StateReassemblyHelper::reusable_DOFs) = nullptr; + (*StateReassemblyHelper::reusable_Dirichlet) = nullptr; + return; + } + + // Create utility data + // - time measurement + Hermes::Mixins::TimeMeasurable cpu_time; + // - size of spaces + // - shortcuts for spaces, to speed up indirect accesses + Space** prev_ref_spaces = new Space*[StateReassemblyHelper::current_number_of_equations]; + Space** ref_spaces = new Space*[StateReassemblyHelper::current_number_of_equations]; + // - number of elements of all new reference spaces combined + int total_elements_new_spaces = 0; + // - fill the above structures + for (unsigned short i = 0; i < StateReassemblyHelper::current_number_of_equations; i++) + { + prev_ref_spaces[i] = StateReassemblyHelper::current_prev_ref_spaces->at(i).get(); + ref_spaces[i] = StateReassemblyHelper::current_ref_spaces->at(i).get(); + total_elements_new_spaces += ref_spaces[i]->get_mesh()->get_num_active_elements(); + } + // - elements to reassemble on the new space + // -- we could maybe directly used the resulting states (in which we are interested), but it would be complicated. + std::unordered_set newSpace_elements_to_reassemble[H2D_MAX_COMPONENTS]; + // - number of DOFs of the previous spaces. + unsigned int prev_ref_system_size = StateReassemblyHelper::current_prev_mat->get_size(); + unsigned int ref_system_size = Space::get_num_dofs(*StateReassemblyHelper::current_ref_spaces); + // - DOF to DOF map of those DOFs we can reuse. -1s are there to distinguish those we cannot. + int* DOF_to_DOF_map = malloc_with_check(prev_ref_system_size); + for (unsigned int i = 0; i < prev_ref_system_size; i++) + DOF_to_DOF_map[i] = -1; + // - DOF to reassemble. + (*StateReassemblyHelper::reusable_DOFs) = calloc_with_check(ref_system_size); + (*StateReassemblyHelper::reusable_Dirichlet) = calloc_with_check(StateReassemblyHelper::current_number_of_equations); + // - utility assembly lists. + AsmList al, al_prev; + // - dummy functions for traversing the previous and current reference spaces together + std::vector > dummy_fns; + for (unsigned short i = 0; i < StateReassemblyHelper::current_number_of_equations; i++) + dummy_fns.push_back(new ZeroSolution(StateReassemblyHelper::current_prev_ref_spaces->at(i)->get_mesh())); + for (unsigned short i = 0; i < StateReassemblyHelper::current_number_of_equations; i++) + dummy_fns.push_back(new ZeroSolution(StateReassemblyHelper::current_ref_spaces->at(i)->get_mesh())); + // - (for reporting) count of DOFs needed to be reassembled + int reusable_DOFs_count = 0; + + // Start. + Hermes::Mixins::Loggable::Static::info("\t Handling Reusing matrix entries on the new Ref. Space:"); + cpu_time.tick(); + + // Find out if Dirichlet is not directly changed. + for (unsigned char space_i = 0; space_i < StateReassemblyHelper::current_number_of_equations; space_i++) + { + if (StateReassemblyHelper::current_DOFs_to_reassemble[space_i]->find(-1) == StateReassemblyHelper::current_DOFs_to_reassemble[space_i]->end()) + (*StateReassemblyHelper::reusable_Dirichlet)[space_i] = true; + } + + // Traverse the previous and current reference Spaces at once. + Traverse trav(StateReassemblyHelper::current_number_of_equations * 2); + unsigned int num_states_local; + Traverse::State** states_local = trav.get_states(dummy_fns, num_states_local); + for (unsigned int local_state_i = 0; local_state_i < num_states_local; local_state_i++) + { + Traverse::State* current_local_state = states_local[local_state_i]; + for (unsigned char space_i = 0; space_i < StateReassemblyHelper::current_number_of_equations; space_i++) + { + // Mark the appropriate elements + Element* prev_ref_element = current_local_state->e[space_i]; + Element* ref_element = current_local_state->e[space_i + StateReassemblyHelper::current_number_of_equations]; + // If the element is changed on the previous ref space, mark the appropriate element on the new ref space as to-reassemble. + bool element_added = false; + if (StateReassemblyHelper::current_elements_to_reassemble[space_i]->find(prev_ref_element->id) != StateReassemblyHelper::current_elements_to_reassemble[space_i]->end()) + { + newSpace_elements_to_reassemble[space_i].insert(ref_element->id); + element_added = true; + } + // Get assembly lists. + prev_ref_spaces[space_i]->get_element_assembly_list(prev_ref_element, &al_prev); + ref_spaces[space_i]->get_element_assembly_list(ref_element, &al); + // Different assembly lists => reassemble element. + if (!element_added && al_prev.cnt != al.cnt) + { + newSpace_elements_to_reassemble[space_i].insert(ref_element->id); + element_added = true; + } + + // Fun begins here - we need to figure out which DOFs on the new reference spaces can be reused and which cannot. + unsigned short last_matched_index = 0; + bool contains_Dirichlet = false, anything_changed = al_prev.cnt != al.cnt; + for (unsigned short i_al_prev = 0; i_al_prev < al_prev.cnt; i_al_prev++) + { + bool reused = false; + if (!element_added && al_prev.idx[i_al_prev] != al.idx[i_al_prev]) + { + newSpace_elements_to_reassemble[space_i].insert(ref_element->id); + element_added = true; + } + if (al_prev.dof[i_al_prev] < 0) + { + contains_Dirichlet = true; + continue; + } + for (unsigned short j_al = last_matched_index; j_al < al.cnt; j_al++) + { + if (al.dof[j_al] < 0) + { + contains_Dirichlet = true; + continue; + } + if (al_prev.idx[i_al_prev] == al.idx[j_al] && compare(-HermesEpsilon, al_prev.coef[i_al_prev] - al.coef[j_al]) && compare(al_prev.coef[i_al_prev] - al.coef[j_al], HermesEpsilon)) + { + last_matched_index = j_al + 1; + if (StateReassemblyHelper::current_DOFs_to_reassemble[space_i]->find(al_prev.dof[i_al_prev]) == StateReassemblyHelper::current_DOFs_to_reassemble[space_i]->end()) + { + if (!(*StateReassemblyHelper::reusable_DOFs)[al.dof[j_al]]) + reusable_DOFs_count++; + (*StateReassemblyHelper::reusable_DOFs)[al.dof[j_al]] = true; + DOF_to_DOF_map[al_prev.dof[i_al_prev]] = al.dof[j_al]; + reused = true; + } + break; + } + } + if (!reused) + { + assert(DOF_to_DOF_map[al_prev.dof[i_al_prev]] == -1); + anything_changed = true; + } + } + // Dirichlet - indirectly changed. + if (anything_changed && contains_Dirichlet) + (*StateReassemblyHelper::reusable_Dirichlet)[space_i] = false; + } + } + + // Now we have to add all elements containing Dirichlet DOF (changed or not) + if (StateReassemblyHelper::use_Dirichlet) + { + for (unsigned int local_state_i = 0; local_state_i < num_states_local; local_state_i++) + { + Traverse::State* current_local_state = states_local[local_state_i]; + for (unsigned char space_i = 0; space_i < StateReassemblyHelper::current_number_of_equations; space_i++) + { + // If Dirichlet is not necessary to be recalculated, go on. + if ((*StateReassemblyHelper::reusable_Dirichlet)[space_i]) + continue; + // Get current element. + Element* ref_element = current_local_state->e[space_i + StateReassemblyHelper::current_number_of_equations]; + // If element is already being recalculated, continue. + if (newSpace_elements_to_reassemble[space_i].find(ref_element->id) != newSpace_elements_to_reassemble[space_i].end()) + continue; + + // Mark the previous element. + Element* prev_ref_element = current_local_state->e[space_i]; + + // Get assembly lists. + prev_ref_spaces[space_i]->get_element_assembly_list(prev_ref_element, &al_prev); + ref_spaces[space_i]->get_element_assembly_list(ref_element, &al); + + // Since the element has not been added before we know the length of the prev and current assembly lists is the same. + for (unsigned short al_i = 0; al_i < al_prev.cnt; al_i++) + { + if (al_prev.dof[al_i] < 0 || al.dof[al_i] < 0) + { + newSpace_elements_to_reassemble[space_i].insert(ref_element->id); + break; + } + } + } + } + } + + cpu_time.tick(); + Hermes::Mixins::Loggable::Static::info("\t No. of DOFs to reassemble: %i / %i total - %2.0f%%.", ref_system_size - reusable_DOFs_count, ref_system_size, ((float)(ref_system_size - reusable_DOFs_count) / (float)ref_system_size) * 100.); + Hermes::Mixins::Loggable::Static::info("\t Search for elements to reassemble: %4.3f s", cpu_time.last()); + cpu_time.tick(); + + // Using the changed element on the new reference space, select the states from the original states that need to be recalculated. +#ifdef DEBUG_VIEWS + bool* reassembled_0 = (bool*)calloc(ref_spaces[0]->get_mesh()->get_max_element_id() + 1, sizeof(bool)); + bool* reassembled_1 = (bool*)calloc(ref_spaces[1]->get_mesh()->get_max_element_id() + 1, sizeof(bool)); +#endif + Traverse::State** new_states = malloc_with_check(num_states, true); + int new_num_states = 0; + for (unsigned int state_i = 0; state_i < num_states; state_i++) + { + for (unsigned char space_i = 0; space_i < StateReassemblyHelper::current_number_of_equations; space_i++) + { + if (newSpace_elements_to_reassemble[space_i].find(states[state_i]->e[space_i]->id) != newSpace_elements_to_reassemble[space_i].end()) + { + new_states[new_num_states++] = Traverse::State::clone(states[state_i]); +#ifdef DEBUG_VIEWS + reassembled_0[states[state_i]->e[0]->id] = true; + reassembled_1[states[state_i]->e[1]->id] = true; +#endif + break; + } + } + } + +#ifdef DEBUG_VIEWS + Views::ScalarView sc_temp_0("Reassembled states", new Views::WinGeom(600, 10, 600, 600)); + Views::ScalarView sc_temp_1("Reassembled states", new Views::WinGeom(1230, 10, 600, 600)); + MeshFunctionSharedPtr reassembled_states_function_0(new ExactSolutionConstantArray(ref_spaces[0]->get_mesh(), reassembled_0)); + MeshFunctionSharedPtr reassembled_states_function_1(new ExactSolutionConstantArray(ref_spaces[1]->get_mesh(), reassembled_1)); + sc_temp_0.show(reassembled_states_function_0); + sc_temp_1.show(reassembled_states_function_1); + Views::View::wait_for_keypress(); + ::free(reassembled_0); + ::free(reassembled_1); +#endif + + for (unsigned int i = 0; i < num_states; i++) + delete states[i]; + free_with_check(states); + new_states = realloc_with_check(new_states, new_num_states); + states = new_states; + + cpu_time.tick(); + Hermes::Mixins::Loggable::Static::info("\t No. of states to reassemble: %i / %i total - %2.0f%%.", new_num_states, num_states, ((float)new_num_states / (float)num_states) * 100.); + num_states = new_num_states; + Hermes::Mixins::Loggable::Static::info("\t Picking the new states: %4.3f s", cpu_time.last()); + cpu_time.tick(); + + // Now we have to use the DOF to DOF map to fill in the necessary entries in the new matrix and rhs from the old ones. + Scalar* Ax = StateReassemblyHelper::current_prev_mat->get_Ax(); + int* Ai = StateReassemblyHelper::current_prev_mat->get_Ai(); + int* Ap = StateReassemblyHelper::current_prev_mat->get_Ap(); + Scalar* new_coeff_vec = nullptr; + if (coeff_vec) + new_coeff_vec = calloc_with_check(ref_system_size, true); + int total_entries = 0; + int used_entries = 0; + unsigned short current_row_entries; + for (unsigned int i = 0; i < prev_ref_system_size; i++) + { + current_row_entries = Ap[i + 1] - Ap[i]; + total_entries += current_row_entries; + if (DOF_to_DOF_map[i] != -1) + { + for (int j = 0; j < current_row_entries; j++) + { + if (DOF_to_DOF_map[Ai[Ap[i] + j]] != -1) + { + mat->add(DOF_to_DOF_map[i], DOF_to_DOF_map[Ai[Ap[i] + j]], Ax[Ap[i] + j]); + used_entries++; + } + } + if (rhs) + rhs->add(DOF_to_DOF_map[i], StateReassemblyHelper::current_prev_rhs->get(i)); + if (coeff_vec) + new_coeff_vec[DOF_to_DOF_map[i]] = coeff_vec[i]; + } + } + if (dirichlet_lift_rhs && StateReassemblyHelper::use_Dirichlet) + { + unsigned int running_count = 0; + for (unsigned short space_i = 0; space_i < StateReassemblyHelper::current_number_of_equations; space_i++) + { + if ((*StateReassemblyHelper::reusable_Dirichlet)[space_i]) + { + for (unsigned int dof_i = running_count; dof_i < running_count + prev_ref_spaces[space_i]->get_num_dofs(); dof_i++) + { + if (DOF_to_DOF_map[dof_i] != -1) + dirichlet_lift_rhs->add(DOF_to_DOF_map[dof_i], StateReassemblyHelper::current_prev_dirichlet_lift_rhs->get(dof_i)); + } + } + running_count += prev_ref_spaces[space_i]->get_num_dofs(); + } + } + + if (coeff_vec) + { + free_with_check(coeff_vec, true); + coeff_vec = new_coeff_vec; + } + cpu_time.tick(); + Hermes::Mixins::Loggable::Static::info("\t Reused matrix entries: %i / %i total - %2.0f%%.", used_entries, total_entries, ((float)used_entries / (float)total_entries) * 100.); + Hermes::Mixins::Loggable::Static::info("\t Copying the linear system: %4.3f s", cpu_time.last()); + free_with_check(DOF_to_DOF_map); + } + + template + void AdaptSolver::init_solving(AdaptivityType adaptivityType) + { + this->adaptivity_step = 1; + this->solve_method_running = true; + ref_slns.clear(); + slns.clear(); + for (unsigned char i = 0; i < this->spaces.size(); i++) + { + ref_slns.push_back(MeshFunctionSharedPtr(new Solution)); + slns.push_back(MeshFunctionSharedPtr(new Solution)); + if (this->visualization) + { + this->scalar_views.push_back(new Views::ScalarView("", new Views::WinGeom(i * 410, 0, 300, 300))); + this->scalar_views.back()->get_linearizer()->set_criterion(Views::LinearizerCriterionFixed(4)); + this->scalar_views.back()->set_title("Reference solution #%i", i); + + this->order_views.push_back(new Views::OrderView("", new Views::WinGeom(i * 410, 320, 300, 300))); + this->order_views.back()->set_title("Reference space #%i - orders", i); + + this->base_views.push_back(new Views::BaseView("", new Views::WinGeom(i * 410, 640, 300, 300))); + this->base_views.back()->get_linearizer()->set_criterion(Views::LinearizerCriterionFixed(4)); + } + } + + this->solver->set_verbose_output(this->get_verbose_output()); + //this->solver->output_matrix(); + this->solver->set_matrix_export_format(EXPORT_FORMAT_MATLAB_SIMPLE); + + //this->solver->output_rhs(); + this->solver->set_rhs_export_format(EXPORT_FORMAT_MATLAB_SIMPLE); + + this->adaptivity_internal = new Adapt(spaces, error_calculator, stopping_criterion_single_step); + this->adaptivity_internal->set_verbose_output(this->get_verbose_output()); + + StateReassemblyHelper::reusable_DOFs = new bool*; + StateReassemblyHelper::reusable_Dirichlet = new bool*; + this->solver->dp->set_reusable_DOFs(StateReassemblyHelper::reusable_DOFs, StateReassemblyHelper::reusable_Dirichlet); + StateReassemblyHelper::use_Dirichlet = this->solver->dp->add_dirichlet_lift; + StateReassemblyHelper::current_number_of_equations = this->number_of_equations; + + this->ref_spaces.clear(); + + if (adaptivityType == hAdaptivity) + { + for (unsigned char selector_i = 0; selector_i < this->spaces.size(); selector_i++) + hOnlySelectors.push_back(new RefinementSelectors::HOnlySelector()); + } + if (adaptivityType == pAdaptivity) + { + for (unsigned char selector_i = 0; selector_i < this->spaces.size(); selector_i++) + pOnlySelectors.push_back(new RefinementSelectors::POnlySelector()); + } + } + + template + void AdaptSolver::deinit_solving() + { + this->solve_method_running = false; + + if (this->visualization) + for (unsigned short i = 0; i < this->number_of_equations; i++) + { + delete this->scalar_views[i]; + delete this->order_views[i]; + delete this->base_views[i]; + } + + delete this->adaptivity_internal; + delete StateReassemblyHelper::reusable_DOFs; + delete StateReassemblyHelper::reusable_Dirichlet; + + for (unsigned char selector_i = 0; selector_i < this->hOnlySelectors.size(); selector_i++) + delete hOnlySelectors[selector_i]; + hOnlySelectors.clear(); + for (unsigned char selector_i = 0; selector_i < this->pOnlySelectors.size(); selector_i++) + delete pOnlySelectors[selector_i]; + pOnlySelectors.clear(); + } + + template + void AdaptSolver::solve(AdaptivityType adaptivityType) + { + // Initialization - allocations etc. + this->init_solving(adaptivityType); + + do + { + this->info("\tAdaptSolver step %d:", this->adaptivity_step); + + // Construct globally refined reference meshes and setup reference spaces. + prev_ref_spaces = ref_spaces; + ref_spaces.clear(); + for (unsigned char i = 0; i < number_of_equations; i++) + { + Mesh::ReferenceMeshCreator ref_mesh_creator(spaces[i]->get_mesh()); + MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh(); + typename Space::ReferenceSpaceCreator u_ref_space_creator(spaces[i], adaptivityType == pAdaptivity ? spaces[i]->get_mesh() : ref_mesh, adaptivityType == hAdaptivity ? 0 : 1); + ref_spaces.push_back(u_ref_space_creator.create_ref_space()); + } + + // Set these to the solver. + this->solver->set_spaces(ref_spaces); + + // Initialize the states handler. + StateReassemblyHelper::current_iteration = this->adaptivity_step; + StateReassemblyHelper::current_ref_spaces = &ref_spaces; + StateReassemblyHelper::current_prev_ref_spaces = &prev_ref_spaces; + for (unsigned char i = 0; i < number_of_equations; i++) + { + StateReassemblyHelper::current_elements_to_reassemble[i] = &this->elements_to_reassemble[i]; + StateReassemblyHelper::current_DOFs_to_reassemble[i] = &this->DOFs_to_reassemble[i]; + } + + // Perform solution. + this->info("\tSolving on reference mesh, %i DOFs.", Space::get_num_dofs(ref_spaces)); + this->solver->dp->set_reassembled_states_reuse_linear_system_fn(&get_states_to_reassemble); + if (adaptivity_step > 1 && dynamic_cast*>(this->solver)) + { + Scalar* new_sln_vector = realloc_with_check(this->solver->sln_vector, Space::get_num_dofs(ref_spaces)); + this->solver->sln_vector = nullptr; + memset(new_sln_vector + Space::get_num_dofs(prev_ref_spaces), 0, (Space::get_num_dofs(ref_spaces) - Space::get_num_dofs(prev_ref_spaces)) * sizeof(Scalar)); + this->solver->solve(new_sln_vector); + free_with_check(new_sln_vector, true); + } + else + this->solver->solve(); + + this->solver->get_linear_matrix_solver()->free(); + + // Free reusable DOFs data structures for this run. + free_with_check(*StateReassemblyHelper::reusable_DOFs); + free_with_check(*StateReassemblyHelper::reusable_Dirichlet); + + // Update the stored (previous) linear system. + if (this->prev_mat) + delete this->prev_mat; + this->prev_mat = (Hermes::Algebra::CSCMatrix*)(this->solver->get_jacobian()->duplicate()); + StateReassemblyHelper::current_prev_mat = this->prev_mat; + + if (this->prev_rhs) + delete this->prev_rhs; + this->prev_rhs = this->solver->get_residual()->duplicate(); + if (this->solver->dp->add_dirichlet_lift) + this->prev_rhs->subtract_vector(this->solver->dp->dirichlet_lift_rhs); + StateReassemblyHelper::current_prev_rhs = this->prev_rhs; + + if (this->solver->dp->add_dirichlet_lift) + { + if (this->prev_dirichlet_lift_rhs) + delete this->prev_dirichlet_lift_rhs; + this->prev_dirichlet_lift_rhs = this->solver->dp->dirichlet_lift_rhs->duplicate(); + StateReassemblyHelper::current_prev_dirichlet_lift_rhs = this->prev_dirichlet_lift_rhs; + } + + // Translate the resulting coefficient vector into the instance of Solution. + Solution::vector_to_solutions(solver->get_sln_vector(), ref_spaces, ref_slns); + + if (this->visualization) + this->visualize(ref_spaces); + + // Project the fine mesh solution onto the coarse mesh. + this->info("\tProjecting reference solution on coarse mesh."); + OGProjection::project_global(spaces, ref_slns, slns); + + // Calculate element errors. + if (!this->exact_slns.empty()) + { + this->info("\tCalculating exact error."); + this->error_calculator->calculate_errors(slns, exact_slns, false); + double error = this->error_calculator->get_total_error_squared() * 100; + this->info("\tExact error: %f.", error); + } + + this->info("\tCalculating error estimate."); + this->error_calculator->calculate_errors(slns, ref_slns, true); + double error = this->error_calculator->get_total_error_squared() * 100; + this->info("\tThe error estimate: %f.", error); + + // If err_est too large, adapt the mesh. + if (this->stopping_criterion_global->done(error, this->adaptivity_step)) + { + this->deinit_solving(); + return; + } + else + { + this->info("\tAdapting coarse mesh."); + total_elements_prev_spaces = 0; + for (unsigned short i = 0; i < number_of_equations; i++) + total_elements_prev_spaces += this->spaces[i]->get_mesh()->get_num_active_elements(); + // For hp-adaptivity, we use the provided selectors. + if (adaptivityType == hpAdaptivity) + this->adaptivity_internal->adapt(this->selectors); + else if (adaptivityType == hAdaptivity) + this->adaptivity_internal->adapt(hOnlySelectors); + else + this->adaptivity_internal->adapt(pOnlySelectors); + + this->mark_elements_to_reassemble(); + } + + this->adaptivity_step++; + this->info("\n"); + } while (true); + + this->deinit_solving(); + } + + template + void AdaptSolver::mark_elements_to_reassemble() + { + Hermes::Mixins::Loggable::Static::info("\t Marking elements to reassemble on the already used Ref. Space:"); + this->tick(); + + // Clear the arrays. + for (unsigned char i = 0; i < this->spaces.size(); i++) + { + this->elements_to_reassemble[i].clear(); + this->DOFs_to_reassemble[i].clear(); + } + + int total_elements_prev_ref_spaces = 0; + for (unsigned short i = 0; i < number_of_equations; i++) + total_elements_prev_ref_spaces += this->ref_spaces[i]->get_mesh()->get_num_active_elements(); + + // Identify elements that changed. + int valid_elements_to_refine_count = 0; + int ref_elements_changed_count = 0; + for (int i = 0; i < this->adaptivity_internal->elements_to_refine_count; i++) + { + ElementToRefine* element_to_refine = &this->adaptivity_internal->elements_to_refine[i]; + if (!element_to_refine->valid) + continue; + valid_elements_to_refine_count++; + RefinementType refinement_type = element_to_refine->split; + int component = element_to_refine->comp; + Element* e = this->ref_spaces[component]->get_mesh()->get_element_fast(element_to_refine->id); + if (e->active) + { + this->elements_to_reassemble[component].insert(e->id); + ref_elements_changed_count++; + } + else + { + for (int son_i = 0; son_i < H2D_MAX_ELEMENT_SONS; son_i++) + { + this->elements_to_reassemble[component].insert(e->sons[son_i]->id); + ref_elements_changed_count++; + } + } + } + Hermes::Mixins::Loggable::Static::info("\t No. of coarse mesh elements refined: %i / %i total - %2.0f%%.", valid_elements_to_refine_count, total_elements_prev_spaces, ((float)valid_elements_to_refine_count / (float)total_elements_prev_spaces) * 100.); + Hermes::Mixins::Loggable::Static::info("\t No. of fine mesh elements directly changed: %i / %i total - %2.0f%%.", ref_elements_changed_count, total_elements_prev_ref_spaces, ((float)ref_elements_changed_count / (float)total_elements_prev_ref_spaces) * 100.); + this->tick(); + Hermes::Mixins::Loggable::Static::info("\t Identify elements that changed: %4.3f s", this->last()); + this->tick(); + + // Identify DOFs of the changed elements. + AsmList al; + for (unsigned char space_i = 0; space_i < this->number_of_equations; space_i++) + { + for (std::unordered_set::iterator it = elements_to_reassemble[space_i].begin(); it != elements_to_reassemble[space_i].end(); ++it) + { + Element* e = this->ref_spaces[space_i]->get_mesh()->get_element_fast(*it); + this->ref_spaces[space_i]->get_element_assembly_list(e, &al); + for (int j = 0; j < al.cnt; j++) + this->DOFs_to_reassemble[space_i].insert(al.dof[j]); + } + } + + this->tick(); + Hermes::Mixins::Loggable::Static::info("\t Identify DOFs that changed: %4.3f s", this->last()); + this->tick(); + + // Take a look at other elements if they share a DOF that changed. + /// \todo This is ineffective, a more effective way is to employ an improved neighbor searching. + ref_elements_changed_count = 0; + for (unsigned char space_i = 0; space_i < this->number_of_equations; space_i++) + { + for_all_active_elements_fast(this->ref_spaces[space_i]->get_mesh()) + { + this->ref_spaces[space_i]->get_element_assembly_list(e, &al); + for (int j = 0; j < al.cnt; j++) + { + if (this->DOFs_to_reassemble[space_i].find(al.dof[j]) != this->DOFs_to_reassemble[space_i].end()) + { + this->elements_to_reassemble[space_i].insert(e->id); + ref_elements_changed_count++; + break; + } + } + } + } + + Hermes::Mixins::Loggable::Static::info("\t No. of all fine mesh elements that need to be reassembled: %i / %i total - %2.0f%%.", ref_elements_changed_count, total_elements_prev_ref_spaces, ((float)ref_elements_changed_count / (float)total_elements_prev_ref_spaces) * 100.); + this->tick(); + Hermes::Mixins::Loggable::Static::info("\t Looking for elements containing a changed DOF: %4.3f s", this->last()); + } + + template + void AdaptSolver::visualize(std::vector >& ref_spaces) + { + for (unsigned short i = 0; i < this->number_of_equations; i++) + { + this->scalar_views[i]->show(this->ref_slns[i]); + this->order_views[i]->show(ref_spaces[i]); + this->base_views[i]->show(ref_spaces[i]); + } + + if (this->wait_for_keypress) + Views::View::wait_for_keypress(); + } + + template + std::vector > AdaptSolver::get_slns() + { + if (this->solve_method_running) + throw Exceptions::Exception("AdaptSolver asked for solutions while it was running."); + return this->slns; + } + + template + MeshFunctionSharedPtr AdaptSolver::get_sln(int index) + { + if (this->solve_method_running) + throw Exceptions::Exception("AdaptSolver asked for a solution while it was running."); + return this->slns[index]; + } + + template + std::vector > AdaptSolver::get_ref_slns() + { + if (this->solve_method_running) + throw Exceptions::Exception("AdaptSolver asked for solutions while it was running."); + return this->ref_slns; + } + + template + MeshFunctionSharedPtr AdaptSolver::get_ref_sln(int index) + { + if (this->solve_method_running) + throw Exceptions::Exception("AdaptSolver asked for a solution while it was running."); + return this->ref_slns[index]; + } + + template + AdaptSolverCriterion* AdaptSolver::get_stopping_criterion_global() + { + return this->stopping_criterion_global; + } + + template + void AdaptSolver::set_stopping_criterion_global(AdaptSolverCriterion* stopping_criterion_global) + { + this->stopping_criterion_global = stopping_criterion_global; + } + + template + void AdaptSolver::set_exact_solutions(std::vector > exact_slns) + { + if (this->solve_method_running) + throw Exceptions::Exception("AdaptSolver asked to change the exact_slns while it was running."); + this->exact_slns = exact_slns; + } + + template + void AdaptSolver::set_initial_spaces(std::vector > spaces) + { + if (this->solve_method_running) + throw Exceptions::Exception("AdaptSolver asked to change the initial spaces while it was running."); + Helpers::check_length(this->spaces, spaces); + this->spaces = spaces; + + this->adaptivity_internal->set_spaces(this->spaces); + this->solver->set_spaces(this->spaces); + } + + template + void AdaptSolver::set_wf(WeakFormSharedPtr wf) + { + if (this->solve_method_running) + throw Exceptions::Exception("AdaptSolver asked to change the weak formulation while it was running."); + this->wf = wf; + this->solver->set_weak_formulation(wf); + } + + template + void AdaptSolver::set_error_calculator(ErrorCalculator* error_calculator) + { + this->error_calculator = error_calculator; + } + + template + void AdaptSolver::set_stopping_criterion_single_step(AdaptivityStoppingCriterion* stopping_criterion_single_step) + { + this->stopping_criterion_single_step = stopping_criterion_single_step; + this->adaptivity_internal->set_strategy(stopping_criterion_single_step); + } + + template + void AdaptSolver::set_selectors(std::vector*> selectors) + { + Helpers::check_length(this->selectors, selectors); + this->selectors = selectors; + } + + template + std::vector > AdaptSolver::get_initial_spaces() + { + return this->spaces; + } + + template + WeakFormSharedPtr AdaptSolver::get_wf() + { + return this->wf; + } + + template + SolverType* AdaptSolver::get_solver() + { + return this->solver; + } + + template + ErrorCalculator* AdaptSolver::get_error_calculator() + { + return this->error_calculator; + } + + template + AdaptivityStoppingCriterion* AdaptSolver::get_stopping_criterion_single_step() + { + return this->stopping_criterion_single_step; + } + + template + std::vector*> AdaptSolver::get_selectors() + { + return this->selectors; + } + + template + bool AdaptSolver::isOkay() const + { + this->adaptivity_internal->check(); + for (unsigned short i = 0; i < this->number_of_equations; i++) + this->spaces[i]->check(); + + return true; + } + + template HERMES_API class AdaptSolver < double, LinearSolver > ; + template HERMES_API class AdaptSolver < std::complex, LinearSolver > > ; + + /** \todo Uncomment this once we figure out how to do it + template HERMES_API class AdaptSolver >; + template HERMES_API class AdaptSolver, NewtonSolver > >; + + template HERMES_API class AdaptSolver >; + template HERMES_API class AdaptSolver, PicardSolver > >; + **/ + } +} diff --git a/hermes2d/src/adapt/error_calculator.cpp b/hermes2d/src/adapt/error_calculator.cpp index 552c77a4f8..6d2747fb25 100644 --- a/hermes2d/src/adapt/error_calculator.cpp +++ b/hermes2d/src/adapt/error_calculator.cpp @@ -100,8 +100,8 @@ namespace Hermes // Also handle the errorMeshFunction. for (int i = 0; i < this->component_count; i++) - if (this->errorMeshFunction[i]) - this->errorMeshFunction[i].reset(); + if (this->errorMeshFunction[i]) + this->errorMeshFunction[i].reset(); } template @@ -117,11 +117,11 @@ namespace Hermes } template - void ErrorCalculator::calculate_errors(MeshFunctionSharedPtr& coarse_solution, MeshFunctionSharedPtr& fine_solution, bool sort_and_store) + void ErrorCalculator::calculate_errors(MeshFunctionSharedPtr coarse_solution, MeshFunctionSharedPtr fine_solution, bool sort_and_store) { - Hermes::vector > coarse_solutions; + std::vector > coarse_solutions; coarse_solutions.push_back(coarse_solution); - Hermes::vector > fine_solutions; + std::vector > fine_solutions; fine_solutions.push_back(fine_solution); this->calculate_errors(coarse_solutions, fine_solutions, sort_and_store); } @@ -131,10 +131,14 @@ namespace Hermes { bool okay = true; - if (fine_solutions.size() != this->component_count) + try + { + Helpers::check_length(this->fine_solutions, this->component_count); + } + catch (...) { okay = false; - throw Exceptions::LengthException(0, fine_solutions.size(), this->component_count); + throw; } if (this->mfvol.empty() && this->mfsurf.empty() && this->mfDG.empty()) @@ -147,7 +151,7 @@ namespace Hermes } template - void ErrorCalculator::calculate_errors(Hermes::vector > coarse_solutions_, Hermes::vector > fine_solutions_, bool sort_and_store) + void ErrorCalculator::calculate_errors(std::vector > coarse_solutions_, std::vector > fine_solutions_, bool sort_and_store) { this->coarse_solutions = coarse_solutions_; this->fine_solutions = fine_solutions_; @@ -158,14 +162,14 @@ namespace Hermes this->init_data_storage(); // Prepare multi-mesh traversal and error arrays. - Hermes::vector meshes; + std::vector meshes; for (int i = 0; i < this->component_count; i++) meshes.push_back(coarse_solutions[i]->get_mesh()); for (int i = 0; i < this->component_count; i++) meshes.push_back(fine_solutions[i]->get_mesh()); - int num_states; + unsigned int num_states; Traverse trav(this->component_count); Traverse::State** states = trav.get_states(meshes, num_states); @@ -244,13 +248,13 @@ namespace Hermes } if (this->errorType == RelativeErrorToGlobalNorm) - for (int j = 0; j < this->element_count[i]; j++) - { + for (int j = 0; j < this->element_count[i]; j++) + { if (component_norms[i] < Hermes::HermesEpsilon) *(this->element_references[running_indexer + j].error) = 0.; else *(this->element_references[running_indexer + j].error) /= component_norms[i]; - } + } norms_squared_sum += component_norms[i]; errors_squared_sum += component_errors[i]; @@ -377,7 +381,7 @@ namespace Hermes { for (int i = 0; i < component_count; i++) { - this->add_error_form(new DefaultNormFormVol(i, i, normType)); + this->add_error_form(new DefaultNormFormVol(i, i, normType, SolutionsDifference)); } } @@ -386,26 +390,22 @@ namespace Hermes { for (int i = 0; i < component_count; i++) { - this->add_error_form(new DefaultNormFormVol(i, i, normType)); + this->add_error_form(new DefaultNormFormVol(i, i, normType, CoarseSolutions)); } } template - double DefaultNormCalculator::calculate_norms(Hermes::vector >& solutions) + double DefaultNormCalculator::calculate_norms(std::vector >& solutions) { - Hermes::vector > zero_fine_solutions; - for (int i = 0; i < solutions.size(); i++) - zero_fine_solutions.push_back(MeshFunctionSharedPtr(new ZeroSolution(solutions[i]->get_mesh()))); - this->calculate_errors(solutions, zero_fine_solutions, false); + this->calculate_errors(solutions, solutions, false); return this->get_total_error_squared(); } template - double DefaultNormCalculator::calculate_norm(MeshFunctionSharedPtr & solution) + double DefaultNormCalculator::calculate_norm(MeshFunctionSharedPtr solution) { - MeshFunctionSharedPtr zero_fine_solution(new ZeroSolution(solution->get_mesh())); - this->calculate_errors(solution, zero_fine_solution, false); + this->calculate_errors(solution, solution, false); return this->get_total_error_squared(); } @@ -413,40 +413,40 @@ namespace Hermes template DefaultErrorCalculator::~DefaultErrorCalculator() { - for (int i = 0; i < this->mfvol.size(); i++) + for (unsigned short i = 0; i < this->mfvol.size(); i++) delete this->mfvol[i]; } template DefaultNormCalculator::~DefaultNormCalculator() { - for (int i = 0; i < this->mfvol.size(); i++) + for (unsigned short i = 0; i < this->mfvol.size(); i++) delete this->mfvol[i]; } - template HERMES_API class DefaultErrorCalculator; - template HERMES_API class DefaultErrorCalculator, HERMES_H1_NORM>; - template HERMES_API class DefaultErrorCalculator; - template HERMES_API class DefaultErrorCalculator, HERMES_L2_NORM>; - template HERMES_API class DefaultErrorCalculator; - template HERMES_API class DefaultErrorCalculator, HERMES_H1_SEMINORM>; - template HERMES_API class DefaultErrorCalculator; - template HERMES_API class DefaultErrorCalculator, HERMES_HCURL_NORM>; - template HERMES_API class DefaultErrorCalculator; - template HERMES_API class DefaultErrorCalculator, HERMES_HDIV_NORM>; - - template HERMES_API class DefaultNormCalculator; - template HERMES_API class DefaultNormCalculator, HERMES_H1_NORM>; - template HERMES_API class DefaultNormCalculator; - template HERMES_API class DefaultNormCalculator, HERMES_L2_NORM>; - template HERMES_API class DefaultNormCalculator; - template HERMES_API class DefaultNormCalculator, HERMES_H1_SEMINORM>; - template HERMES_API class DefaultNormCalculator; - template HERMES_API class DefaultNormCalculator, HERMES_HCURL_NORM>; - template HERMES_API class DefaultNormCalculator; - template HERMES_API class DefaultNormCalculator, HERMES_HDIV_NORM>; - - template HERMES_API class ErrorCalculator; - template HERMES_API class ErrorCalculator >; + template HERMES_API class DefaultErrorCalculator < double, HERMES_H1_NORM > ; + template HERMES_API class DefaultErrorCalculator < std::complex, HERMES_H1_NORM > ; + template HERMES_API class DefaultErrorCalculator < double, HERMES_L2_NORM > ; + template HERMES_API class DefaultErrorCalculator < std::complex, HERMES_L2_NORM > ; + template HERMES_API class DefaultErrorCalculator < double, HERMES_H1_SEMINORM > ; + template HERMES_API class DefaultErrorCalculator < std::complex, HERMES_H1_SEMINORM > ; + template HERMES_API class DefaultErrorCalculator < double, HERMES_HCURL_NORM > ; + template HERMES_API class DefaultErrorCalculator < std::complex, HERMES_HCURL_NORM > ; + template HERMES_API class DefaultErrorCalculator < double, HERMES_HDIV_NORM > ; + template HERMES_API class DefaultErrorCalculator < std::complex, HERMES_HDIV_NORM > ; + + template HERMES_API class DefaultNormCalculator < double, HERMES_H1_NORM > ; + template HERMES_API class DefaultNormCalculator < std::complex, HERMES_H1_NORM > ; + template HERMES_API class DefaultNormCalculator < double, HERMES_L2_NORM > ; + template HERMES_API class DefaultNormCalculator < std::complex, HERMES_L2_NORM > ; + template HERMES_API class DefaultNormCalculator < double, HERMES_H1_SEMINORM > ; + template HERMES_API class DefaultNormCalculator < std::complex, HERMES_H1_SEMINORM > ; + template HERMES_API class DefaultNormCalculator < double, HERMES_HCURL_NORM > ; + template HERMES_API class DefaultNormCalculator < std::complex, HERMES_HCURL_NORM > ; + template HERMES_API class DefaultNormCalculator < double, HERMES_HDIV_NORM > ; + template HERMES_API class DefaultNormCalculator < std::complex, HERMES_HDIV_NORM > ; + + template HERMES_API class ErrorCalculator < double > ; + template HERMES_API class ErrorCalculator < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/adapt/error_thread_calculator.cpp b/hermes2d/src/adapt/error_thread_calculator.cpp index ad4dc582c3..fa52902ea3 100644 --- a/hermes2d/src/adapt/error_thread_calculator.cpp +++ b/hermes2d/src/adapt/error_thread_calculator.cpp @@ -142,12 +142,12 @@ namespace Hermes { bool existing_ns = false; for (int j = i - 1; j >= 0; j--) - if (current_state->e[i] == current_state->e[j]) - { + if (current_state->e[i] == current_state->e[j]) + { neighbor_searches[i] = neighbor_searches[j]; existing_ns = true; break; - } + } if (!existing_ns) { NeighborSearch* ns; @@ -175,11 +175,11 @@ namespace Hermes { bool existing_ns = false; for (int j = i - 1; j >= 0; j--) - if (current_state->e[i] == current_state->e[j]) - { + if (current_state->e[i] == current_state->e[j]) + { existing_ns = true; break; - } + } if (!existing_ns) delete this->neighbor_searches[i]; } @@ -269,10 +269,10 @@ namespace Hermes RefMap** refmaps = malloc_with_check::DGErrorCalculator, RefMap*>(this->errorThreadCalculator->errorCalculator->component_count, this); for (int i = 0; i < this->errorThreadCalculator->errorCalculator->component_count; i++) refmaps[i] = this->errorThreadCalculator->slns[i]->get_refmap(); - this->errorThreadCalculator->n_quadrature_points = init_surface_geometry_points(refmaps, this->errorThreadCalculator->errorCalculator->component_count, order_base, current_state->isurf, current_state->rep->marker, this->errorThreadCalculator->geometry, this->errorThreadCalculator->jacobian_x_weights); + this->errorThreadCalculator->n_quadrature_points = init_surface_geometry_points_allocated(refmaps, this->errorThreadCalculator->errorCalculator->component_count, order_base, current_state->isurf, current_state->rep->marker, this->errorThreadCalculator->geometry_surf, this->errorThreadCalculator->jacobian_x_weights); free_with_check(refmaps); - for (int current_mfDG_i = 0; current_mfDG_i < this->errorThreadCalculator->errorCalculator->mfDG.size(); current_mfDG_i++) + for (unsigned short current_mfDG_i = 0; current_mfDG_i < this->errorThreadCalculator->errorCalculator->mfDG.size(); current_mfDG_i++) { NormFormDG* mfs = this->errorThreadCalculator->errorCalculator->mfDG[current_mfDG_i]; @@ -290,10 +290,6 @@ namespace Hermes this->errorThreadCalculator->deinitialize_error_and_norm_functions(mfs, error_func, norm_func); } - free_with_check(this->errorThreadCalculator->jacobian_x_weights); - this->errorThreadCalculator->geometry->free(); - delete this->errorThreadCalculator->geometry; - // This is just cleaning after ourselves. // Clear the transformations from the RefMaps and all functions. for (unsigned int fns_i = 0; fns_i < this->errorThreadCalculator->errorCalculator->component_count; fns_i++) @@ -379,11 +375,11 @@ namespace Hermes RefMap** refmaps = malloc_with_check, RefMap*>(this->errorCalculator->component_count, this); for (int i = 0; i < this->errorCalculator->component_count; i++) refmaps[i] = slns[i]->get_refmap(); - this->n_quadrature_points = init_geometry_points(refmaps, this->errorCalculator->component_count, order, this->geometry, this->jacobian_x_weights); + this->n_quadrature_points = init_geometry_points_allocated(refmaps, this->errorCalculator->component_count, order, this->geometry_vol, this->jacobian_x_weights); free_with_check(refmaps); - for (int i = 0; i < this->errorCalculator->mfvol.size(); i++) + for (unsigned short i = 0; i < this->errorCalculator->mfvol.size(); i++) { NormFormVol* form = this->errorCalculator->mfvol[i]; double* error = &this->errorCalculator->errors[form->i][current_state->e[form->i]->id]; @@ -396,11 +392,6 @@ namespace Hermes this->evaluate_volumetric_form(form, error_func[0], error_func[1], norm_func[0], norm_func[1], error, norm); this->deinitialize_error_and_norm_functions(form, error_func, norm_func); } - - // deinitialize points & geometry & jacobian times weights - geometry->free(); - delete geometry; - free_with_check(this->jacobian_x_weights); } template @@ -409,10 +400,10 @@ namespace Hermes RefMap** refmaps = malloc_with_check, RefMap*>(this->errorCalculator->component_count, this); for (int i = 0; i < this->errorCalculator->component_count; i++) refmaps[i] = slns[i]->get_refmap(); - this->n_quadrature_points = init_surface_geometry_points(refmaps, this->errorCalculator->component_count, order, current_state->isurf, current_state->rep->marker, this->geometry, this->jacobian_x_weights); + this->n_quadrature_points = init_surface_geometry_points_allocated(refmaps, this->errorCalculator->component_count, order, current_state->isurf, current_state->rep->marker, this->geometry_surf, this->jacobian_x_weights); free_with_check(refmaps); - for (int i = 0; i < this->errorCalculator->mfsurf.size(); i++) + for (unsigned short i = 0; i < this->errorCalculator->mfsurf.size(); i++) { NormFormSurf* form = this->errorCalculator->mfsurf[i]; @@ -456,21 +447,16 @@ namespace Hermes this->evaluate_surface_form(form, error_func[0], error_func[0], norm_func[1], norm_func[1], error, norm); this->deinitialize_error_and_norm_functions(form, error_func, norm_func); } - - // deinitialize points & geometry & jacobian times weights - geometry->free(); - delete geometry; - free_with_check(this->jacobian_x_weights); } template void ErrorThreadCalculator::evaluate_volumetric_form(NormFormVol* form, Func* difference_func_i, Func* difference_func_j, Func* rsln_i, Func* rsln_j, double* error, double* norm) { - double error_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, difference_func_i, difference_func_j, this->geometry)); + double error_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, difference_func_i, difference_func_j, &this->geometry_vol)); #pragma omp atomic (*error) += error_value; - double norm_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, rsln_i, rsln_j, this->geometry)); + double norm_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, rsln_i, rsln_j, &this->geometry_vol)); #pragma omp atomic (*norm) += norm_value; @@ -479,7 +465,7 @@ namespace Hermes template void ErrorThreadCalculator::evaluate_surface_form(NormFormSurf* form, Func* difference_func_i, Func* difference_func_j, Func* rsln_i, Func* rsln_j, double* error, double* norm) { - double error_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, difference_func_i, difference_func_j, this->geometry)); + double error_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, difference_func_i, difference_func_j, &this->geometry_surf)); // 1D quadrature has the weights summed to 2. error_value *= 0.5; @@ -487,7 +473,7 @@ namespace Hermes #pragma omp atomic (*error) += error_value; - double norm_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, rsln_i, rsln_j, this->geometry)); + double norm_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, rsln_i, rsln_j, &this->geometry_surf)); // 1D quadrature has the weights summed to 2. norm_value *= 0.5; @@ -499,7 +485,7 @@ namespace Hermes template void ErrorThreadCalculator::evaluate_DG_form(NormFormDG* form, DiscontinuousFunc* difference_func_i, DiscontinuousFunc* difference_func_j, DiscontinuousFunc* rsln_i, DiscontinuousFunc* rsln_j, double* error, double* norm) { - double error_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, difference_func_i, difference_func_j, this->geometry)); + double error_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, difference_func_i, difference_func_j, &this->geometry_surf)); // 1D quadrature has the weights summed to 2. error_value *= 0.5; @@ -507,13 +493,13 @@ namespace Hermes #pragma omp atomic (*error) += error_value; - double norm_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, rsln_i, rsln_j, this->geometry)); + double norm_value = std::abs(form->value(this->n_quadrature_points, this->jacobian_x_weights, rsln_i, rsln_j, &this->geometry_surf)); #pragma omp atomic (*norm) += norm_value; } - template HERMES_API class ErrorThreadCalculator; - template HERMES_API class ErrorThreadCalculator >; + template HERMES_API class ErrorThreadCalculator < double > ; + template HERMES_API class ErrorThreadCalculator < std::complex > ; } } \ No newline at end of file diff --git a/hermes2d/src/adapt/kelly_type_adapt.cpp b/hermes2d/src/adapt/kelly_type_adapt.cpp index ef1322931f..e55e6482f2 100644 --- a/hermes2d/src/adapt/kelly_type_adapt.cpp +++ b/hermes2d/src/adapt/kelly_type_adapt.cpp @@ -18,792 +18,795 @@ namespace Hermes { - namespace Hermes2D - { - static const int H2D_DG_INNER_EDGE_INT = -1234567; - static const std::string H2D_DG_INNER_EDGE = "-1234567"; - - template - BasicKellyAdapt::ErrorEstimatorFormKelly::ErrorEstimatorFormKelly(int i, double const_by_laplacian) : KellyTypeAdapt::ErrorEstimatorForm(i, H2D_DG_INNER_EDGE), const_by_laplacian(const_by_laplacian) - {} - - template - void KellyTypeAdapt::ErrorEstimatorForm::setAsInterface() - { - this->set_area(H2D_DG_INNER_EDGE); - } - - template - KellyTypeAdapt::KellyTypeAdapt(Hermes::vector< SpaceSharedPtr >& spaces_, - bool ignore_visited_segments_, - Hermes::vector interface_scaling_fns_, - Hermes::vector norms_) - : Adapt(spaces_, norms_) - { - error_estimators_surf.reserve(this->num); - error_estimators_vol.reserve(this->num); - - if(interface_scaling_fns_.size() == 0) - { - interface_scaling_fns_.reserve(this->num); - for (int i = 0; i < this->num; i++) - interface_scaling_fns_.push_back(new ScaleByElementDiameter); - } - use_aposteriori_interface_scaling = true; - interface_scaling_fns = interface_scaling_fns_; - interface_scaling_const = boundary_scaling_const = volumetric_scaling_const = 1.0; - ignore_visited_segments = ignore_visited_segments_; - - element_markers_conversion = spaces_[0]->get_mesh()->element_markers_conversion; - boundary_markers_conversion = spaces_[0]->get_mesh()->boundary_markers_conversion; - } - - template - KellyTypeAdapt::KellyTypeAdapt(SpaceSharedPtr space_, - bool ignore_visited_segments_, - const InterfaceEstimatorScalingFunction* interface_scaling_fn_, - NormType norm_) - : Adapt(space_, norm_) - { - if(interface_scaling_fn_ == nullptr) - interface_scaling_fns.push_back(new ScaleByElementDiameter); - else - interface_scaling_fns.push_back(interface_scaling_fn_); - - use_aposteriori_interface_scaling = true; - - interface_scaling_const = boundary_scaling_const = volumetric_scaling_const = 1.0; - ignore_visited_segments = ignore_visited_segments_; - - element_markers_conversion = space_->get_mesh()->element_markers_conversion; - boundary_markers_conversion = space_->get_mesh()->boundary_markers_conversion; - } - - template - bool KellyTypeAdapt::adapt(double thr, int strat, int regularize, double to_be_processed) - { - Hermes::vector *> refinement_selectors; - RefinementSelectors::HOnlySelector selector; - for (int i = 0; i < this->num; i++) - refinement_selectors.push_back(&selector); - - return Adapt::adapt(refinement_selectors, thr, strat, regularize, to_be_processed); - } - - template - void KellyTypeAdapt::add_error_estimator_vol(typename KellyTypeAdapt::ErrorEstimatorForm* form) - { - if(form->i < 0 || form->i >= this->num) - throw Exceptions::ValueException("component number", form->i, 0, this->num); - - form->adapt = this; - this->error_estimators_vol.push_back(form); - } - - template - void KellyTypeAdapt::add_error_estimator_surf(typename KellyTypeAdapt::ErrorEstimatorForm* form) - { - if(form->i < 0 || form->i >= this->num) - throw Exceptions::ValueException("component number", form->i, 0, this->num); - - form->adapt = this; - this->error_estimators_surf.push_back(form); - } - - template - double KellyTypeAdapt::calc_err_internal(Hermes::vector > slns, - Hermes::vector* component_errors, - unsigned int error_flags) - { - if(slns.size() != this->num) - throw Hermes::Exceptions::LengthException(0, slns.size(), this->num); - - this->tick(); - - for (int i = 0; i < this->num; i++) - { - Solution* solution = dynamic_cast*>(slns[i].get()); - if(solution == nullptr) - throw Exceptions::Exception("Passed solution is in fact not a Solution instance in KellyTypeAdapt::calc_err_*()."); - - this->sln[i] = solution; - this->sln[i]->set_quad_2d(&g_quad_2d_std); - } - - this->have_coarse_solutions = true; - - MeshSharedPtr* meshes = malloc_with_check(this->num, this); - Transformable** fns = malloc_with_check(this->num, this); - - this->num_act_elems = 0; - for (int i = 0; i < this->num; i++) - { - meshes[i] = (this->sln[i]->get_mesh()); - fns[i] = (this->sln[i]); - - this->num_act_elems += meshes[i]->get_num_active_elements(); - int max = meshes[i]->get_max_element_id(); - - if(this->errors[i] != nullptr) free_with_check(this->errors[i]); - this->errors[i] = malloc_with_check(max, this); - memset(this->errors[i], 0, sizeof(double) * max); - } - - double total_norm = 0.0; - - bool calc_norm = false; - if((error_flags & this->HERMES_ELEMENT_ERROR_MASK) == HERMES_ELEMENT_ERROR_REL || - (error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_REL) calc_norm = true; - - double *norms = nullptr; - if(calc_norm) - { - norms = malloc_with_check(this->num, this); - memset(norms, 0, this->num * sizeof(double)); - } - - double *errors_components = malloc_with_check(this->num, this); - memset(errors_components, 0, this->num * sizeof(double)); - this->errors_squared_sum = 0.0; - double total_error = 0.0; - - bool bnd[H2D_MAX_NUMBER_EDGES]; - SurfPos surf_pos[H2D_MAX_NUMBER_EDGES]; - Traverse::State *ee; - Traverse trav(this->num); - - // Reset the e->visited status of each element of each mesh (most likely it will be set to true from - // the latest assembling procedure). - if(ignore_visited_segments) - { - for (int i = 0; i < this->num; i++) - { - Element* e; - for_all_active_elements(e, meshes[i]) - e->visited = false; - } - } - - // Begin the multimesh traversal. - trav.begin(this->num, meshes, fns); - while ((ee = trav.get_next_state()) != nullptr) - { - bnd[0] = ee->bnd[0]; - bnd[1] = ee->bnd[1]; - bnd[2] = ee->bnd[2]; - bnd[3] = ee->bnd[3]; - - surf_pos[0].marker = ee->rep->en[0]->marker; - surf_pos[1].marker = ee->rep->en[1]->marker; - surf_pos[2].marker = ee->rep->en[2]->marker; - surf_pos[3].marker = ee->rep->en[3]->marker; - - surf_pos[0].surf_num = 0; - surf_pos[1].surf_num = 1; - surf_pos[2].surf_num = 2; - surf_pos[3].surf_num = 3; - - // Go through all solution components. - for (int i = 0; i < this->num; i++) - { - if(ee->e[i] == nullptr) - continue; - - // Set maximum integration order for use in integrals, see limit_order() - update_limit_table(ee->e[i]->get_mode()); - - RefMap *rm = this->sln[i]->get_refmap(); - - double err = 0.0; - - // Go through all volumetric error estimators. - for (unsigned int iest = 0; iest < error_estimators_vol.size(); iest++) - { - // Skip current error estimator if it is assigned to a different component or geometric area - // different from that of the current active element. - - if(error_estimators_vol[iest]->i != i) - continue; - - if(error_estimators_vol[iest]->area != HERMES_ANY) - if(!element_markers_conversion.get_internal_marker(error_estimators_vol[iest]->area).valid || element_markers_conversion.get_internal_marker(error_estimators_vol[iest]->area).marker != ee->e[i]->marker) - continue; - - err += eval_volumetric_estimator(error_estimators_vol[iest], rm); - } - - // Go through all surface error estimators (includes both interface and boundary est's). - for (unsigned int iest = 0; iest < error_estimators_surf.size(); iest++) - { - if(error_estimators_surf[iest]->i != i) - continue; - - for (int isurf = 0; isurf < ee->e[i]->get_nvert(); isurf++) - { - if(bnd[isurf]) // Boundary - { - if(error_estimators_surf[iest]->area != HERMES_ANY) - { - if(!boundary_markers_conversion.get_internal_marker(error_estimators_surf[iest]->area).valid) - continue; - int imarker = boundary_markers_conversion.get_internal_marker(error_estimators_surf[iest]->area).marker; - - if(imarker == H2D_DG_INNER_EDGE_INT) - continue; - if(imarker != surf_pos[isurf].marker) - continue; - } - - err += eval_boundary_estimator(error_estimators_surf[iest], rm, &surf_pos[isurf]); - } - else // Interface - { - if(error_estimators_surf[iest]->area != H2D_DG_INNER_EDGE) - continue; - - // BEGIN COPY FROM DISCRETE_PROBLEM.CPP - - // 5 is for bits per page in the array. - LightArray*> neighbor_searches(5); - unsigned int num_neighbors = 0; - NeighborNode* root; - int ns_index; - - // Determine the minimum mesh seq in this stage. - unsigned int min_dg_mesh_seq = 0; - for(unsigned int j = 0; j < this->spaces.size(); j++) - if(this->spaces[j]->get_mesh()->get_seq() < min_dg_mesh_seq || j == 0) - min_dg_mesh_seq = this->spaces[j]->get_mesh()->get_seq(); - - ns_index = meshes[i]->get_seq() - min_dg_mesh_seq; // = 0 for single mesh - - // Initialize the NeighborSearches. - this->dp.init_neighbors(neighbor_searches, ee, min_dg_mesh_seq); - - // Create a multimesh tree; - root = new NeighborNode(nullptr, 0); - this->dp.build_multimesh_tree(root, neighbor_searches); - - // Update all NeighborSearches according to the multimesh tree. - // After this, all NeighborSearches in neighbor_searches should have the same count - // of neighbors and proper set of transformations - // for the central and the neighbor element(s) alike. - // Also check that every NeighborSearch has the same number of neighbor elements. - for(unsigned int j = 0; j < neighbor_searches.get_size(); j++) - { - if(neighbor_searches.present(j)) - { - NeighborSearch* ns = neighbor_searches.get(j); - this->dp.update_neighbor_search(ns, root); - if(num_neighbors == 0) - num_neighbors = ns->n_neighbors; - if(ns->n_neighbors != num_neighbors) - throw Hermes::Exceptions::Exception("Num_neighbors of different NeighborSearches not matching in KellyTypeAdapt::calc_err_internal."); - } - } - - // Go through all segments of the currently processed interface (segmentation is caused - // by hanging nodes on the other side of the interface). - for (unsigned int neighbor = 0; neighbor < num_neighbors; neighbor++) - { - if(ignore_visited_segments) - { - bool processed = true; - for(unsigned int j = 0; j < neighbor_searches.get_size(); j++) - if(neighbor_searches.present(j)) - if(!neighbor_searches.get(j)->neighbors.at(neighbor)->visited) - { - processed = false; - break; - } - - if(processed) continue; - } - - // We do not use cache_e and cache_jwt here. - - // Set the active segment in all NeighborSearches - for(unsigned int j = 0; j < neighbor_searches.get_size(); j++) - { - if(neighbor_searches.present(j)) - { - neighbor_searches.get(j)->active_segment = neighbor; - neighbor_searches.get(j)->neighb_el = neighbor_searches.get(j)->neighbors[neighbor]; - neighbor_searches.get(j)->neighbor_edge = neighbor_searches.get(j)->neighbor_edges[neighbor]; - } - } - - // Push all the necessary transformations to all functions of this stage. - // The important thing is that the transformations to the current subelement are already there. - // Also store the current neighbor element and neighbor edge in neighb_el, neighbor_edge. - for(unsigned int fns_i = 0; fns_i < this->num; fns_i++) - { - NeighborSearch *ns = neighbor_searches.get(meshes[fns_i]->get_seq() - min_dg_mesh_seq); - if(ns->central_transformations[neighbor]) - ns->central_transformations[neighbor]->apply_on(fns[fns_i]); - } - - // END COPY FROM DISCRETE_PROBLEM.CPP - rm->force_transform(this->sln[i]->get_transform(), this->sln[i]->get_ctm()); - - // The estimate is multiplied by 0.5 in order to distribute the error equally onto - // the two neighboring elements. - double central_err = 0.5 * eval_interface_estimator(error_estimators_surf[iest], - rm, &surf_pos[isurf], neighbor_searches, - ns_index); - double neighb_err = central_err; - - // Scale the error estimate by the scaling function dependent on the element diameter - // (use the central element's diameter). - if(use_aposteriori_interface_scaling && interface_scaling_fns[i]) - if(!element_markers_conversion.get_user_marker(ee->e[i]->marker).valid) - throw Hermes::Exceptions::Exception("Marker not valid."); - else - central_err *= interface_scaling_fns[i]->value(ee->e[i]->get_diameter(), element_markers_conversion.get_user_marker(ee->e[i]->marker).marker); - - // In the case this edge will be ignored when calculating the error for the element on - // the other side, add the now computed error to that element as well. - if(ignore_visited_segments) - { - Element *neighb = neighbor_searches.get(ns_index)->neighb_el; - - // Scale the error estimate by the scaling function dependent on the element diameter - // (use the diameter of the element on the other side). - if(use_aposteriori_interface_scaling && interface_scaling_fns[i]) - if(!element_markers_conversion.get_user_marker(neighb->marker).valid) - throw Hermes::Exceptions::Exception("Marker not valid."); - else - neighb_err *= interface_scaling_fns[i]->value(neighb->get_diameter(), element_markers_conversion.get_user_marker(neighb->marker).marker); - - errors_components[i] += central_err + neighb_err; - total_error += central_err + neighb_err; - this->errors[i][ee->e[i]->id] += central_err; - this->errors[i][neighb->id] += neighb_err; - } - else - err += central_err; - - // BEGIN COPY FROM DISCRETE_PROBLEM.CPP - - // Clear the transformations from the RefMaps and all functions. - for(unsigned int fns_i = 0; fns_i < this->num; fns_i++) - fns[fns_i]->set_transform(neighbor_searches.get(meshes[fns_i]->get_seq() - min_dg_mesh_seq)->original_central_el_transform); - - rm->set_transform(neighbor_searches.get(ns_index)->original_central_el_transform); - - // END COPY FROM DISCRETE_PROBLEM.CPP - } - - // BEGIN COPY FROM DISCRETE_PROBLEM.CPP - - // Delete the multimesh tree; - delete root; - - // Delete the neighbor_searches array. - for(unsigned int j = 0; j < neighbor_searches.get_size(); j++) - if(neighbor_searches.present(j)) - delete neighbor_searches.get(j); - - // END COPY FROM DISCRETE_PROBLEM.CPP - } - } - } - - if(calc_norm) - { - double nrm = eval_solution_norm(this->norm_form[i][i], rm, this->sln[i]); - norms[i] += nrm; - total_norm += nrm; - } - - errors_components[i] += err; - total_error += err; - this->errors[i][ee->e[i]->id] += err; - - ee->e[i]->visited = true; - } - } - trav.finish(); - - // Store the calculation for each solution component separately. - if(component_errors != nullptr) - { - component_errors->clear(); - for (int i = 0; i < this->num; i++) - { - if((error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_ABS) - component_errors->push_back(sqrt(errors_components[i])); - else if((error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_REL) - component_errors->push_back(sqrt(errors_components[i]/norms[i])); - else - { - throw Hermes::Exceptions::Exception("Unknown total error type (0x%x).", error_flags & this->HERMES_TOTAL_ERROR_MASK); - return -1.0; - } - } - } - - this->tick(); - this->error_time = this->accumulated(); - - // Make the error relative if needed. - if((error_flags & this->HERMES_ELEMENT_ERROR_MASK) == HERMES_ELEMENT_ERROR_REL) - { - for (int i = 0; i < this->num; i++) - { - Element* e; - for_all_active_elements(e, meshes[i]) - this->errors[i][e->id] /= norms[i]; - } - } - - this->errors_squared_sum = total_error; - - // Element error mask is used here, because this variable is used in the adapt() - // function, where the processed error (sum of errors of processed element errors) - // is matched to this variable. - if((error_flags & this->HERMES_ELEMENT_ERROR_MASK) == HERMES_ELEMENT_ERROR_REL) - this->errors_squared_sum /= total_norm; - - // Prepare an ordered list of elements according to an error. - this->fill_regular_queue(meshes); - this->have_errors = true; - - if(calc_norm) - free_with_check(norms); - free_with_check(errors_components); - - // Return error value. - if((error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_ABS) - return sqrt(total_error); - else if((error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_REL) - return sqrt(total_error / total_norm); - else - { - throw Hermes::Exceptions::Exception("Unknown total error type (0x%x).", error_flags & this->HERMES_TOTAL_ERROR_MASK); - return -1.0; - } - } - - template - double KellyTypeAdapt::eval_solution_norm(typename Adapt::MatrixFormVolError* form, - RefMap *rm, MeshFunctionSharedPtr sln) - { - // Determine the integration order. - int inc = (sln->get_num_components() == 2) ? 1 : 0; - Func* ou = init_fn_ord(sln->get_fn_order() + inc); - - double fake_wt = 1.0; - Geom* fake_e = init_geom_ord(); - Hermes::Ord o = form->ord(1, &fake_wt, nullptr, ou, ou, fake_e, nullptr); - int order = rm->get_inv_ref_order(); - order += o.get_order(); - - limit_order(order, rm->get_active_element()->get_mode()); - - ou->free_ord(); delete ou; - delete fake_e; - - // Evaluate the form. - Quad2D* quad = sln->get_quad_2d(); - double3* pt = quad->get_points(order, sln->get_active_element()->get_mode()); - int np = quad->get_num_points(order, sln->get_active_element()->get_mode()); - - // Initialize geometry and jacobian*weights. - Geom* e = init_geom_vol(rm, order); - double* jac = rm->get_jacobian(order); - double* jwt = malloc_with_check(np, this); - for(int i = 0; i < np; i++) - jwt[i] = pt[i][2] * jac[i]; - - // Function values. - Func* u = init_fn(sln.get(), order); - Scalar res = form->value(np, jwt, nullptr, u, u, e, nullptr); - - e->free(); delete e; - free_with_check(jwt); - u->free_fn(); delete u; - - return std::abs(res); - } - - template - double KellyTypeAdapt::eval_volumetric_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, - RefMap *rm) - { - // Determine the integration order. - int inc = (this->sln[err_est_form->i]->get_num_components() == 2) ? 1 : 0; - - Func** oi = malloc_with_check(this->num, this); - for (int i = 0; i < this->num; i++) - oi[i] = init_fn_ord(this->sln[i]->get_fn_order() + inc); - - // Polynomial order of additional external functions. - Func** fake_ext_fn = malloc_with_check(err_est_form->ext.size(), this); - for (int i = 0; i < err_est_form->ext.size(); i++) - fake_ext_fn[i] = init_fn_ord(err_est_form->ext[i]->get_fn_order()); - - double fake_wt = 1.0; - Geom* fake_e = init_geom_ord(); - - DiscontinuousFunc oi_i(oi[err_est_form->i], false, false); - - Hermes::Ord o = err_est_form->ord(1, &fake_wt, oi, &oi_i, fake_e, fake_ext_fn); - int order = rm->get_inv_ref_order(); - order += o.get_order(); - - limit_order(order, rm->get_active_element()->get_mode()); - - // Clean up. - for (int i = 0; i < this->num; i++) - { - if(oi[i] != nullptr) - { - oi[i]->free_ord(); - delete oi[i]; - } - } - free_with_check(oi); - delete fake_e; - for(int i = 0; i < err_est_form->ext.size(); i++) - fake_ext_fn[i]->free_ord(); - free_with_check(fake_ext_fn); - - // eval the form - Quad2D* quad = this->sln[err_est_form->i]->get_quad_2d(); - double3* pt = quad->get_points(order, rm->get_active_element()->get_mode()); - int np = quad->get_num_points(order, rm->get_active_element()->get_mode()); - - // Initialize geometry and jacobian*weights - Geom* e = init_geom_vol(rm, order); - double* jac = rm->get_jacobian(order); - double* jwt = malloc_with_check(np, this); - for(int i = 0; i < np; i++) - jwt[i] = pt[i][2] * jac[i]; - - // Function values. - Func** ui = malloc_with_check(this->num, this); - - for (int i = 0; i < this->num; i++) - ui[i] = init_fn(this->sln[i], order); - - Func** ext_fn = malloc_with_check(err_est_form->ext.size(), this); - for (unsigned i = 0; i < err_est_form->ext.size(); i++) - { - if(err_est_form->ext[i] != nullptr) - ext_fn[i] = init_fn(err_est_form->ext[i].get(), order); - else - ext_fn[i] = nullptr; - } - - DiscontinuousFunc ui_i(ui[err_est_form->i], false, false); - - Scalar res = volumetric_scaling_const * err_est_form->value(np, jwt, ui, &ui_i, e, ext_fn); - - for (int i = 0; i < this->num; i++) - { - if(ui[i] != nullptr) - { - ui[i]->free_fn(); - delete ui[i]; - } - } - free_with_check(ui); - - for(int i = 0; i < err_est_form->ext.size(); i++) - fake_ext_fn[i]->free_fn(); - free_with_check(fake_ext_fn); - - e->free(); - delete e; - - free_with_check(jwt); - - return std::abs(res); - } - - template - double KellyTypeAdapt::eval_boundary_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, - RefMap *rm, SurfPos* surf_pos) - { - // Determine the integration order. - int inc = (this->sln[err_est_form->i]->get_num_components() == 2) ? 1 : 0; - Func** oi = malloc_with_check(this->num, this); - for (int i = 0; i < this->num; i++) - oi[i] = init_fn_ord(this->sln[i]->get_edge_fn_order(surf_pos->surf_num) + inc); - - // Polynomial order of additional external functions. - Func** fake_ext_fn = malloc_with_check(err_est_form->ext.size(), this); - for (int i = 0; i < err_est_form->ext.size(); i++) - fake_ext_fn[i] = init_fn_ord(err_est_form->ext[i]->get_fn_order()); - - double fake_wt = 1.0; - Geom* fake_e = init_geom_ord(); - DiscontinuousFunc oi_i(oi[err_est_form->i], false, false); - Hermes::Ord o = err_est_form->ord(1, &fake_wt, oi, &oi_i, fake_e, fake_ext_fn); - int order = rm->get_inv_ref_order(); - order += o.get_order(); - - limit_order(order, rm->get_active_element()->get_mode()); - - // Clean up. - for (int i = 0; i < this->num; i++) - if(oi[i] != nullptr) - { - oi[i]->free_ord(); - delete oi[i]; - } - - free_with_check(oi); - delete fake_e; - for(int i = 0; i < err_est_form->ext.size(); i++) - fake_ext_fn[i]->free_ord(); - free_with_check(fake_ext_fn); - - // Evaluate the form. - Quad2D* quad = this->sln[err_est_form->i]->get_quad_2d(); - int eo = quad->get_edge_points(surf_pos->surf_num, order, rm->get_active_element()->get_mode()); - double3* pt = quad->get_points(eo, rm->get_active_element()->get_mode()); - int np = quad->get_num_points(eo, rm->get_active_element()->get_mode()); - - // Initialize geometry and jacobian*weights. - double3* tan; - Geom* e = init_geom_surf(rm, surf_pos->surf_num, surf_pos->marker, eo, tan); - double* jwt = malloc_with_check(np, this); - for(int i = 0; i < np; i++) - jwt[i] = pt[i][2] * tan[i][2]; - - // Function values - Func** ui = malloc_with_check(this->num, this); - for (int i = 0; i < this->num; i++) - ui[i] = init_fn(this->sln[i], eo); - - Func** ext_fn = malloc_with_check(err_est_form->ext.size(), this); - for (unsigned i = 0; i < err_est_form->ext.size(); i++) - { - if(err_est_form->ext[i] != nullptr) - ext_fn[i] = init_fn(err_est_form->ext[i].get(), order); - else - ext_fn[i] = nullptr; - } - - DiscontinuousFunc ui_i(ui[err_est_form->i], false, false); - - Scalar res = boundary_scaling_const * - err_est_form->value(np, jwt, ui, &ui_i, e, ext_fn); - - for (int i = 0; i < this->num; i++) - if(ui[i] != nullptr) - { - ui[i]->free_fn(); - delete ui[i]; - } - - free_with_check(ui); - for(int i = 0; i < err_est_form->ext.size(); i++) - fake_ext_fn[i]->free_fn(); - free_with_check(fake_ext_fn); - - e->free(); - delete e; - - free_with_check(jwt); - - return std::abs(0.5*res); // Edges are parameterized from 0 to 1 while integration weights - // are defined in (-1, 1). Thus multiplying with 0.5 to correct - // the weights. - } - - template - double KellyTypeAdapt::eval_interface_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, - RefMap *rm, SurfPos* surf_pos, - LightArray*>& neighbor_searches, - int neighbor_index) - { - NeighborSearch* nbs = neighbor_searches.get(neighbor_index); - Hermes::vector > slns; - for (int i = 0; i < this->num; i++) - slns.push_back(this->sln[i]); - - // Determine integration order. - Func** fake_ext_fns = malloc_with_check(err_est_form->ext.size(), this); - for (unsigned int j = 0; j < err_est_form->ext.size(); j++) - { - int inc = (err_est_form->ext[j]->get_num_components() == 2) ? 1 : 0; - int central_order = err_est_form->ext[j]->get_edge_fn_order(neighbor_searches.get(err_est_form->ext[j]->get_mesh()->get_seq())->active_edge) + inc; - int neighbor_order = err_est_form->ext[j]->get_edge_fn_order(neighbor_searches.get(err_est_form->ext[j]->get_mesh()->get_seq())->neighbor_edge.local_num_of_edge) + inc; - fake_ext_fns[j] = new DiscontinuousFunc(init_fn_ord(central_order), init_fn_ord(neighbor_order)); - } - - // Polynomial order of geometric attributes (eg. for multiplication of a solution with coordinates, normals, etc.). - Geom* fake_e = new InterfaceGeom(init_geom_ord(), nbs->neighb_el->marker, nbs->neighb_el->id, Hermes::Ord(nbs->neighb_el->get_diameter())); - double fake_wt = 1.0; - DiscontinuousFunc fake_ext_fns_i(fake_ext_fns[err_est_form->i], false, false); - - Hermes::Ord o = err_est_form->ord(1, &fake_wt, fake_ext_fns, &fake_ext_fns_i, fake_e, nullptr); - - int order = rm->get_inv_ref_order(); - order += o.get_order(); - - limit_order(order, rm->get_active_element()->get_mode()); - - // Clean up. - for (int i = 0; i < this->num; i++) - { - fake_ext_fns[i]->free_ord(); - delete fake_ext_fns[i]; - } - free_with_check(fake_ext_fns); - - fake_e->free_ord(); - delete fake_e; - - //delete fake_ext; - - Quad2D* quad = this->sln[err_est_form->i]->get_quad_2d(); - int eo = quad->get_edge_points(surf_pos->surf_num, order, rm->get_active_element()->get_mode()); - int np = quad->get_num_points(eo, rm->get_active_element()->get_mode()); - double3* pt = quad->get_points(eo, rm->get_active_element()->get_mode()); - - // Initialize geometry and jacobian*weights (do not use the NeighborSearch caching mechanism). - double3* tan; - Geom* e = new InterfaceGeom(init_geom_surf(rm, surf_pos->surf_num, surf_pos->marker, eo, tan), - nbs->neighb_el->marker, - nbs->neighb_el->id, - nbs->neighb_el->get_diameter()); - - double* jwt = malloc_with_check(np, this); - for(int i = 0; i < np; i++) - jwt[i] = pt[i][2] * tan[i][2]; - - // Function values. - DiscontinuousFunc** ui = this->dp.init_ext_fns(slns, neighbor_searches, order, 0); - - Scalar res = interface_scaling_const * - err_est_form->value(np, jwt, nullptr, ui[err_est_form->i], e, nullptr); - - if(ui != nullptr) - { - for(unsigned int i = 0; i < slns.size(); i++) - ui[i]->free_fn(); - free_with_check(ui); - } - - e->free(); - delete e; - - free_with_check(jwt); - - return std::abs(0.5*res); // Edges are parameterized from 0 to 1 while integration weights - // are defined in (-1, 1). Thus multiplying with 0.5 to correct - // the weights. - } - - // #endif - template HERMES_API class KellyTypeAdapt; - template HERMES_API class KellyTypeAdapt >; - template HERMES_API class BasicKellyAdapt; - template HERMES_API class BasicKellyAdapt >; - } +namespace Hermes2D +{ +static const int H2D_DG_INNER_EDGE_INT = -1234567; +static const std::string H2D_DG_INNER_EDGE = "-1234567"; + +template +BasicKellyAdapt::ErrorEstimatorFormKelly::ErrorEstimatorFormKelly(int i, double const_by_laplacian) : KellyTypeAdapt::ErrorEstimatorForm(i, H2D_DG_INNER_EDGE), const_by_laplacian(const_by_laplacian) +{} + +template +void KellyTypeAdapt::ErrorEstimatorForm::setAsInterface() +{ +this->set_area(H2D_DG_INNER_EDGE); +} + +template +KellyTypeAdapt::KellyTypeAdapt(std::vector< SpaceSharedPtr >& spaces_, +bool ignore_visited_segments_, +std::vector interface_scaling_fns_, +std::vector norms_) +: Adapt(spaces_, norms_) +{ +error_estimators_surf.reserve(this->num); +error_estimators_vol.reserve(this->num); + +if(interface_scaling_fns_.size() == 0) +{ +interface_scaling_fns_.reserve(this->num); +for (int i = 0; i < this->num; i++) +interface_scaling_fns_.push_back(new ScaleByElementDiameter); +} +use_aposteriori_interface_scaling = true; +interface_scaling_fns = interface_scaling_fns_; +interface_scaling_const = boundary_scaling_const = volumetric_scaling_const = 1.0; +ignore_visited_segments = ignore_visited_segments_; + +element_markers_conversion = spaces_[0]->get_mesh()->element_markers_conversion; +boundary_markers_conversion = spaces_[0]->get_mesh()->boundary_markers_conversion; +} + +template +KellyTypeAdapt::KellyTypeAdapt(SpaceSharedPtr space_, +bool ignore_visited_segments_, +const InterfaceEstimatorScalingFunction* interface_scaling_fn_, +NormType norm_) +: Adapt(space_, norm_) +{ +if(interface_scaling_fn_ == nullptr) +interface_scaling_fns.push_back(new ScaleByElementDiameter); +else +interface_scaling_fns.push_back(interface_scaling_fn_); + +use_aposteriori_interface_scaling = true; + +interface_scaling_const = boundary_scaling_const = volumetric_scaling_const = 1.0; +ignore_visited_segments = ignore_visited_segments_; + +element_markers_conversion = space_->get_mesh()->element_markers_conversion; +boundary_markers_conversion = space_->get_mesh()->boundary_markers_conversion; +} + +template +bool KellyTypeAdapt::adapt(double thr, int strat, int regularize, double to_be_processed) +{ +std::vector *> refinement_selectors; +RefinementSelectors::HOnlySelector selector; +for (int i = 0; i < this->num; i++) +refinement_selectors.push_back(&selector); + +return Adapt::adapt(refinement_selectors, thr, strat, regularize, to_be_processed); +} + +template +void KellyTypeAdapt::add_error_estimator_vol(typename KellyTypeAdapt::ErrorEstimatorForm* form) +{ +if(form->i < 0 || form->i >= this->num) +throw Exceptions::ValueException("component number", form->i, 0, this->num); + +form->adapt = this; +this->error_estimators_vol.push_back(form); +} + +template +void KellyTypeAdapt::add_error_estimator_surf(typename KellyTypeAdapt::ErrorEstimatorForm* form) +{ +if(form->i < 0 || form->i >= this->num) +throw Exceptions::ValueException("component number", form->i, 0, this->num); + +form->adapt = this; +this->error_estimators_surf.push_back(form); +} + +template +double KellyTypeAdapt::calc_err_internal(std::vector > slns, +std::vector* component_errors, +unsigned int error_flags) +{ +if(slns.size() != this->num) +throw Hermes::Exceptions::LengthException(0, slns.size(), this->num); + +this->tick(); + +for (int i = 0; i < this->num; i++) +{ +Solution* solution = dynamic_cast*>(slns[i].get()); +if(solution == nullptr) +throw Exceptions::Exception("Passed solution is in fact not a Solution instance in KellyTypeAdapt::calc_err_*()."); + +this->sln[i] = solution; +this->sln[i]->set_quad_2d(&g_quad_2d_std); +} + +this->have_coarse_solutions = true; + +MeshSharedPtr* meshes = malloc_with_check(this->num, this); +Transformable** fns = malloc_with_check(this->num, this); + +this->num_act_elems = 0; +for (int i = 0; i < this->num; i++) +{ +meshes[i] = (this->sln[i]->get_mesh()); +fns[i] = (this->sln[i]); + +this->num_act_elems += meshes[i]->get_num_active_elements(); +int max = meshes[i]->get_max_element_id(); + +if(this->errors[i] != nullptr) free_with_check(this->errors[i]); +this->errors[i] = malloc_with_check(max, this); +memset(this->errors[i], 0, sizeof(double) * max); +} + +double total_norm = 0.0; + +bool calc_norm = false; +if((error_flags & this->HERMES_ELEMENT_ERROR_MASK) == HERMES_ELEMENT_ERROR_REL || +(error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_REL) calc_norm = true; + +double *norms = nullptr; +if(calc_norm) +{ +norms = malloc_with_check(this->num, this); +memset(norms, 0, this->num * sizeof(double)); +} + +double *errors_components = malloc_with_check(this->num, this); +memset(errors_components, 0, this->num * sizeof(double)); +this->errors_squared_sum = 0.0; +double total_error = 0.0; + +bool bnd[H2D_MAX_NUMBER_EDGES]; +SurfPos surf_pos[H2D_MAX_NUMBER_EDGES]; +Traverse::State *ee; +Traverse trav(this->num); + +// Reset the e->visited status of each element of each mesh (most likely it will be set to true from +// the latest assembling procedure). +if(ignore_visited_segments) +{ +for (int i = 0; i < this->num; i++) +{ +Element* e; +for_all_active_elements(e, meshes[i]) +e->visited = false; +} +} + +// Begin the multimesh traversal. +trav.begin(this->num, meshes, fns); +while ((ee = trav.get_next_state()) != nullptr) +{ +bnd[0] = ee->bnd[0]; +bnd[1] = ee->bnd[1]; +bnd[2] = ee->bnd[2]; +bnd[3] = ee->bnd[3]; + +surf_pos[0].marker = ee->rep->en[0]->marker; +surf_pos[1].marker = ee->rep->en[1]->marker; +surf_pos[2].marker = ee->rep->en[2]->marker; +surf_pos[3].marker = ee->rep->en[3]->marker; + +surf_pos[0].surf_num = 0; +surf_pos[1].surf_num = 1; +surf_pos[2].surf_num = 2; +surf_pos[3].surf_num = 3; + +// Go through all solution components. +for (int i = 0; i < this->num; i++) +{ +if(ee->e[i] == nullptr) +continue; + +// Set maximum integration order for use in integrals, see limit_order() +update_limit_table(ee->e[i]->get_mode()); + +RefMap *rm = this->sln[i]->get_refmap(); + +double err = 0.0; + +// Go through all volumetric error estimators. +for (unsigned int iest = 0; iest < error_estimators_vol.size(); iest++) +{ +// Skip current error estimator if it is assigned to a different component or geometric area +// different from that of the current active element. + +if(error_estimators_vol[iest]->i != i) +continue; + +if(error_estimators_vol[iest]->area != HERMES_ANY) +if(!element_markers_conversion.get_internal_marker(error_estimators_vol[iest]->area).valid || element_markers_conversion.get_internal_marker(error_estimators_vol[iest]->area).marker != ee->e[i]->marker) +continue; + +err += eval_volumetric_estimator(error_estimators_vol[iest], rm); +} + +// Go through all surface error estimators (includes both interface and boundary est's). +for (unsigned int iest = 0; iest < error_estimators_surf.size(); iest++) +{ +if(error_estimators_surf[iest]->i != i) +continue; + +for (unsigned char isurf = 0; isurf < ee->e[i]->get_nvert(); isurf++) +{ +if(bnd[isurf]) // Boundary +{ +if(error_estimators_surf[iest]->area != HERMES_ANY) +{ +if(!boundary_markers_conversion.get_internal_marker(error_estimators_surf[iest]->area).valid) +continue; +int imarker = boundary_markers_conversion.get_internal_marker(error_estimators_surf[iest]->area).marker; + +if(imarker == H2D_DG_INNER_EDGE_INT) +continue; +if(imarker != surf_pos[isurf].marker) +continue; +} + +err += eval_boundary_estimator(error_estimators_surf[iest], rm, &surf_pos[isurf]); +} +else // Interface +{ +if(error_estimators_surf[iest]->area != H2D_DG_INNER_EDGE) +continue; + +// BEGIN COPY FROM DISCRETE_PROBLEM.CPP + +// 5 is for bits per page in the array. +LightArray*> neighbor_searches(5); +unsigned int num_neighbors = 0; +NeighborNode* root; +int ns_index; + +// Determine the minimum mesh seq in this stage. +unsigned int min_dg_mesh_seq = 0; +for(unsigned int j = 0; j < this->spaces.size(); j++) +if(this->spaces[j]->get_mesh()->get_seq() < min_dg_mesh_seq || j == 0) +min_dg_mesh_seq = this->spaces[j]->get_mesh()->get_seq(); + +// = 0 for single mesh +ns_index = meshes[i]->get_seq() - min_dg_mesh_seq; + +// Initialize the NeighborSearches. +this->dp.init_neighbors(neighbor_searches, ee, min_dg_mesh_seq); + +// Create a multimesh tree; +root = new NeighborNode(nullptr, 0); +this->dp.build_multimesh_tree(root, neighbor_searches); + +// Update all NeighborSearches according to the multimesh tree. +// After this, all NeighborSearches in neighbor_searches should have the same count +// of neighbors and proper set of transformations +// for the central and the neighbor element(s) alike. +// Also check that every NeighborSearch has the same number of neighbor elements. +for(unsigned int j = 0; j < neighbor_searches.get_size(); j++) +{ +if(neighbor_searches.present(j)) +{ +NeighborSearch* ns = neighbor_searches.get(j); +this->dp.update_neighbor_search(ns, root); +if(num_neighbors == 0) +num_neighbors = ns->n_neighbors; +if(ns->n_neighbors != num_neighbors) +throw Hermes::Exceptions::Exception("Num_neighbors of different NeighborSearches not matching in KellyTypeAdapt::calc_err_internal."); +} +} + +// Go through all segments of the currently processed interface (segmentation is caused +// by hanging nodes on the other side of the interface). +for (unsigned int neighbor = 0; neighbor < num_neighbors; neighbor++) +{ +if(ignore_visited_segments) +{ +bool processed = true; +for(unsigned int j = 0; j < neighbor_searches.get_size(); j++) +if(neighbor_searches.present(j)) +if(!neighbor_searches.get(j)->neighbors.at(neighbor)->visited) +{ +processed = false; +break; +} + +if(processed) continue; +} + +// We do not use cache_e and cache_jwt here. + +// Set the active segment in all NeighborSearches +for(unsigned int j = 0; j < neighbor_searches.get_size(); j++) +{ +if(neighbor_searches.present(j)) +{ +neighbor_searches.get(j)->active_segment = neighbor; +neighbor_searches.get(j)->neighb_el = neighbor_searches.get(j)->neighbors[neighbor]; +neighbor_searches.get(j)->neighbor_edge = neighbor_searches.get(j)->neighbor_edges[neighbor]; +} +} + +// Push all the necessary transformations to all functions of this stage. +// The important thing is that the transformations to the current subelement are already there. +// Also store the current neighbor element and neighbor edge in neighb_el, neighbor_edge. +for(unsigned int fns_i = 0; fns_i < this->num; fns_i++) +{ +NeighborSearch *ns = neighbor_searches.get(meshes[fns_i]->get_seq() - min_dg_mesh_seq); +if(ns->central_transformations[neighbor]) +ns->central_transformations[neighbor]->apply_on(fns[fns_i]); +} + +// END COPY FROM DISCRETE_PROBLEM.CPP +rm->force_transform(this->sln[i]->get_transform(), this->sln[i]->get_ctm()); + +// The estimate is multiplied by 0.5 in order to distribute the error equally onto +// the two neighboring elements. +double central_err = 0.5 * eval_interface_estimator(error_estimators_surf[iest], +rm, &surf_pos[isurf], neighbor_searches, +ns_index); +double neighb_err = central_err; + +// Scale the error estimate by the scaling function dependent on the element diameter +// (use the central element's diameter). +if(use_aposteriori_interface_scaling && interface_scaling_fns[i]) +if(!element_markers_conversion.get_user_marker(ee->e[i]->marker).valid) +throw Hermes::Exceptions::Exception("Marker not valid."); +else +central_err *= interface_scaling_fns[i]->value(ee->e[i]->get_diameter(), element_markers_conversion.get_user_marker(ee->e[i]->marker).marker); + +// In the case this edge will be ignored when calculating the error for the element on +// the other side, add the now computed error to that element as well. +if(ignore_visited_segments) +{ +Element *neighb = neighbor_searches.get(ns_index)->neighb_el; + +// Scale the error estimate by the scaling function dependent on the element diameter +// (use the diameter of the element on the other side). +if(use_aposteriori_interface_scaling && interface_scaling_fns[i]) +if(!element_markers_conversion.get_user_marker(neighb->marker).valid) +throw Hermes::Exceptions::Exception("Marker not valid."); +else +neighb_err *= interface_scaling_fns[i]->value(neighb->get_diameter(), element_markers_conversion.get_user_marker(neighb->marker).marker); + +errors_components[i] += central_err + neighb_err; +total_error += central_err + neighb_err; +this->errors[i][ee->e[i]->id] += central_err; +this->errors[i][neighb->id] += neighb_err; +} +else +err += central_err; + +// BEGIN COPY FROM DISCRETE_PROBLEM.CPP + +// Clear the transformations from the RefMaps and all functions. +for(unsigned int fns_i = 0; fns_i < this->num; fns_i++) +fns[fns_i]->set_transform(neighbor_searches.get(meshes[fns_i]->get_seq() - min_dg_mesh_seq)->original_central_el_transform); + +rm->set_transform(neighbor_searches.get(ns_index)->original_central_el_transform); + +// END COPY FROM DISCRETE_PROBLEM.CPP +} + +// BEGIN COPY FROM DISCRETE_PROBLEM.CPP + +// Delete the multimesh tree; +delete root; + +// Delete the neighbor_searches array. +for(unsigned int j = 0; j < neighbor_searches.get_size(); j++) +if(neighbor_searches.present(j)) +delete neighbor_searches.get(j); + +// END COPY FROM DISCRETE_PROBLEM.CPP +} +} +} + +if(calc_norm) +{ +double nrm = eval_solution_norm(this->norm_form[i][i], rm, this->sln[i]); +norms[i] += nrm; +total_norm += nrm; +} + +errors_components[i] += err; +total_error += err; +this->errors[i][ee->e[i]->id] += err; + +ee->e[i]->visited = true; +} +} +trav.finish(); + +// Store the calculation for each solution component separately. +if(component_errors != nullptr) +{ +component_errors->clear(); +for (int i = 0; i < this->num; i++) +{ +if((error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_ABS) +component_errors->push_back(sqrt(errors_components[i])); +else if((error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_REL) +component_errors->push_back(sqrt(errors_components[i]/norms[i])); +else +{ +throw Hermes::Exceptions::Exception("Unknown total error type (0x%x).", error_flags & this->HERMES_TOTAL_ERROR_MASK); +return -1.0; +} +} +} + +this->tick(); +this->error_time = this->accumulated(); + +// Make the error relative if needed. +if((error_flags & this->HERMES_ELEMENT_ERROR_MASK) == HERMES_ELEMENT_ERROR_REL) +{ +for (int i = 0; i < this->num; i++) +{ +Element* e; +for_all_active_elements(e, meshes[i]) +this->errors[i][e->id] /= norms[i]; +} +} + +this->errors_squared_sum = total_error; + +// Element error mask is used here, because this variable is used in the adapt() +// function, where the processed error (sum of errors of processed element errors) +// is matched to this variable. +if((error_flags & this->HERMES_ELEMENT_ERROR_MASK) == HERMES_ELEMENT_ERROR_REL) +this->errors_squared_sum /= total_norm; + +// Prepare an ordered list of elements according to an error. +this->fill_regular_queue(meshes); +this->have_errors = true; + +if(calc_norm) +free_with_check(norms); +free_with_check(errors_components); + +// Return error value. +if((error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_ABS) +return sqrt(total_error); +else if((error_flags & this->HERMES_TOTAL_ERROR_MASK) == HERMES_TOTAL_ERROR_REL) +return sqrt(total_error / total_norm); +else +{ +throw Hermes::Exceptions::Exception("Unknown total error type (0x%x).", error_flags & this->HERMES_TOTAL_ERROR_MASK); +return -1.0; +} +} + +template +double KellyTypeAdapt::eval_solution_norm(typename Adapt::MatrixFormVolError* form, +RefMap *rm, MeshFunctionSharedPtr sln) +{ +// Determine the integration order. +int inc = (sln->get_num_components() == 2) ? 1 : 0; +Func* ou = init_fn_ord(sln->get_fn_order() + inc); + +double fake_wt = 1.0; +Geom* fake_e = init_geom_ord(); +Hermes::Ord o = form->ord(1, &fake_wt, nullptr, ou, ou, fake_e, nullptr); +int order = rm->get_inv_ref_order(); +order += o.get_order(); + +limit_order(order, rm->get_active_element()->get_mode()); + +ou->free_ord(); delete ou; +delete fake_e; + +// Evaluate the form. +Quad2D* quad = sln->get_quad_2d(); +double3* pt = quad->get_points(order, sln->get_active_element()->get_mode()); +unsigned char np = quad->get_num_points(order, sln->get_active_element()->get_mode()); + +// Initialize geometry and jacobian*weights. +Geom* e = init_geom_vol(rm, order); +double* jac = rm->get_jacobian(order); +double* jwt = malloc_with_check(np, this); +for(int i = 0; i < np; i++) +jwt[i] = pt[i][2] * jac[i]; + +// Function values. +Func* u = init_fn(sln.get(), order); +Scalar res = form->value(np, jwt, nullptr, u, u, e, nullptr); + +e->free(); delete e; +free_with_check(jwt); +u->free_fn(); delete u; + +return std::abs(res); +} + +template +double KellyTypeAdapt::eval_volumetric_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, +RefMap *rm) +{ +// Determine the integration order. +int inc = (this->sln[err_est_form->i]->get_num_components() == 2) ? 1 : 0; + +Func** oi = malloc_with_check(this->num, this); +for (int i = 0; i < this->num; i++) +oi[i] = init_fn_ord(this->sln[i]->get_fn_order() + inc); + +// Polynomial order of additional external functions. +Func** fake_ext_fn = malloc_with_check(err_est_form->ext.size(), this); +for (int i = 0; i < err_est_form->ext.size(); i++) +fake_ext_fn[i] = init_fn_ord(err_est_form->ext[i]->get_fn_order()); + +double fake_wt = 1.0; +Geom* fake_e = init_geom_ord(); + +DiscontinuousFunc oi_i(oi[err_est_form->i], false, false); + +Hermes::Ord o = err_est_form->ord(1, &fake_wt, oi, &oi_i, fake_e, fake_ext_fn); +int order = rm->get_inv_ref_order(); +order += o.get_order(); + +limit_order(order, rm->get_active_element()->get_mode()); + +// Clean up. +for (int i = 0; i < this->num; i++) +{ +if(oi[i] != nullptr) +{ +oi[i]->free_ord(); +delete oi[i]; +} +} +free_with_check(oi); +delete fake_e; +for(int i = 0; i < err_est_form->ext.size(); i++) +fake_ext_fn[i]->free_ord(); +free_with_check(fake_ext_fn); + +// eval the form +Quad2D* quad = this->sln[err_est_form->i]->get_quad_2d(); +double3* pt = quad->get_points(order, rm->get_active_element()->get_mode()); +unsigned char np = quad->get_num_points(order, rm->get_active_element()->get_mode()); + +// Initialize geometry and jacobian*weights +Geom* e = init_geom_vol(rm, order); +double* jac = rm->get_jacobian(order); +double* jwt = malloc_with_check(np, this); +for(int i = 0; i < np; i++) +jwt[i] = pt[i][2] * jac[i]; + +// Function values. +Func** ui = malloc_with_check(this->num, this); + +for (int i = 0; i < this->num; i++) +ui[i] = init_fn(this->sln[i], order); + +Func** ext_fn = malloc_with_check(err_est_form->ext.size(), this); +for (unsigned i = 0; i < err_est_form->ext.size(); i++) +{ +if(err_est_form->ext[i] != nullptr) +ext_fn[i] = init_fn(err_est_form->ext[i].get(), order); +else +ext_fn[i] = nullptr; +} + +DiscontinuousFunc ui_i(ui[err_est_form->i], false, false); + +Scalar res = volumetric_scaling_const * err_est_form->value(np, jwt, ui, &ui_i, e, ext_fn); + +for (int i = 0; i < this->num; i++) +{ +if(ui[i] != nullptr) +{ +ui[i]->free_fn(); +delete ui[i]; +} +} +free_with_check(ui); + +for(int i = 0; i < err_est_form->ext.size(); i++) +fake_ext_fn[i]->free_fn(); +free_with_check(fake_ext_fn); + +e->free(); +delete e; + +free_with_check(jwt); + +return std::abs(res); +} + +template +double KellyTypeAdapt::eval_boundary_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, +RefMap *rm, SurfPos* surf_pos) +{ +// Determine the integration order. +int inc = (this->sln[err_est_form->i]->get_num_components() == 2) ? 1 : 0; +Func** oi = malloc_with_check(this->num, this); +for (int i = 0; i < this->num; i++) +oi[i] = init_fn_ord(this->sln[i]->get_edge_fn_order(surf_pos->surf_num) + inc); + +// Polynomial order of additional external functions. +Func** fake_ext_fn = malloc_with_check(err_est_form->ext.size(), this); +for (int i = 0; i < err_est_form->ext.size(); i++) +fake_ext_fn[i] = init_fn_ord(err_est_form->ext[i]->get_fn_order()); + +double fake_wt = 1.0; +Geom* fake_e = init_geom_ord(); +DiscontinuousFunc oi_i(oi[err_est_form->i], false, false); +Hermes::Ord o = err_est_form->ord(1, &fake_wt, oi, &oi_i, fake_e, fake_ext_fn); +int order = rm->get_inv_ref_order(); +order += o.get_order(); + +limit_order(order, rm->get_active_element()->get_mode()); + +// Clean up. +for (int i = 0; i < this->num; i++) +if(oi[i] != nullptr) +{ +oi[i]->free_ord(); +delete oi[i]; +} + +free_with_check(oi); +delete fake_e; +for(int i = 0; i < err_est_form->ext.size(); i++) +fake_ext_fn[i]->free_ord(); +free_with_check(fake_ext_fn); + +// Evaluate the form. +Quad2D* quad = this->sln[err_est_form->i]->get_quad_2d(); +int eo = quad->get_edge_points(surf_pos->surf_num, order, rm->get_active_element()->get_mode()); +double3* pt = quad->get_points(eo, rm->get_active_element()->get_mode()); +unsigned char np = quad->get_num_points(eo, rm->get_active_element()->get_mode()); + +// Initialize geometry and jacobian*weights. +double3* tan; +Geom* e = init_geom_surf(rm, surf_pos->surf_num, surf_pos->marker, eo, tan); +double* jwt = malloc_with_check(np, this); +for(int i = 0; i < np; i++) +jwt[i] = pt[i][2] * tan[i][2]; + +// Function values +Func** ui = malloc_with_check(this->num, this); +for (int i = 0; i < this->num; i++) +ui[i] = init_fn(this->sln[i], eo); + +Func** ext_fn = malloc_with_check(err_est_form->ext.size(), this); +for (unsigned i = 0; i < err_est_form->ext.size(); i++) +{ +if(err_est_form->ext[i] != nullptr) +ext_fn[i] = init_fn(err_est_form->ext[i].get(), order); +else +ext_fn[i] = nullptr; +} + +DiscontinuousFunc ui_i(ui[err_est_form->i], false, false); + +Scalar res = boundary_scaling_const * +err_est_form->value(np, jwt, ui, &ui_i, e, ext_fn); + +for (int i = 0; i < this->num; i++) +if(ui[i] != nullptr) +{ +ui[i]->free_fn(); +delete ui[i]; +} + +free_with_check(ui); +for(int i = 0; i < err_est_form->ext.size(); i++) +fake_ext_fn[i]->free_fn(); +free_with_check(fake_ext_fn); + +e->free(); +delete e; + +free_with_check(jwt); + +// Edges are parameterized from 0 to 1 while integration weights +return std::abs(0.5*res); +// are defined in (-1, 1). Thus multiplying with 0.5 to correct +// the weights. +} + +template +double KellyTypeAdapt::eval_interface_estimator(typename KellyTypeAdapt::ErrorEstimatorForm* err_est_form, +RefMap *rm, SurfPos* surf_pos, +LightArray*>& neighbor_searches, +int neighbor_index) +{ +NeighborSearch* nbs = neighbor_searches.get(neighbor_index); +std::vector > slns; +for (int i = 0; i < this->num; i++) +slns.push_back(this->sln[i]); + +// Determine integration order. +Func** fake_ext_fns = malloc_with_check(err_est_form->ext.size(), this); +for (unsigned int j = 0; j < err_est_form->ext.size(); j++) +{ +int inc = (err_est_form->ext[j]->get_num_components() == 2) ? 1 : 0; +int central_order = err_est_form->ext[j]->get_edge_fn_order(neighbor_searches.get(err_est_form->ext[j]->get_mesh()->get_seq())->active_edge) + inc; +int neighbor_order = err_est_form->ext[j]->get_edge_fn_order(neighbor_searches.get(err_est_form->ext[j]->get_mesh()->get_seq())->neighbor_edge.local_num_of_edge) + inc; +fake_ext_fns[j] = new DiscontinuousFunc(init_fn_ord(central_order), init_fn_ord(neighbor_order)); +} + +// Polynomial order of geometric attributes (eg. for multiplication of a solution with coordinates, normals, etc.). +Geom* fake_e = new InterfaceGeom(init_geom_ord(), nbs->neighb_el->marker, nbs->neighb_el->id, Hermes::Ord(nbs->neighb_el->get_diameter())); +double fake_wt = 1.0; +DiscontinuousFunc fake_ext_fns_i(fake_ext_fns[err_est_form->i], false, false); + +Hermes::Ord o = err_est_form->ord(1, &fake_wt, fake_ext_fns, &fake_ext_fns_i, fake_e, nullptr); + +int order = rm->get_inv_ref_order(); +order += o.get_order(); + +limit_order(order, rm->get_active_element()->get_mode()); + +// Clean up. +for (int i = 0; i < this->num; i++) +{ +fake_ext_fns[i]->free_ord(); +delete fake_ext_fns[i]; +} +free_with_check(fake_ext_fns); + +fake_e->free_ord(); +delete fake_e; + +//delete fake_ext; + +Quad2D* quad = this->sln[err_est_form->i]->get_quad_2d(); +int eo = quad->get_edge_points(surf_pos->surf_num, order, rm->get_active_element()->get_mode()); +unsigned char np = quad->get_num_points(eo, rm->get_active_element()->get_mode()); +double3* pt = quad->get_points(eo, rm->get_active_element()->get_mode()); + +// Initialize geometry and jacobian*weights (do not use the NeighborSearch caching mechanism). +double3* tan; +Geom* e = new InterfaceGeom(init_geom_surf(rm, surf_pos->surf_num, surf_pos->marker, eo, tan), +nbs->neighb_el->marker, +nbs->neighb_el->id, +nbs->neighb_el->get_diameter()); + +double* jwt = malloc_with_check(np, this); +for(int i = 0; i < np; i++) +jwt[i] = pt[i][2] * tan[i][2]; + +// Function values. +DiscontinuousFunc** ui = this->dp.init_ext_fns(slns, neighbor_searches, order, 0); + +Scalar res = interface_scaling_const * +err_est_form->value(np, jwt, nullptr, ui[err_est_form->i], e, nullptr); + +if(ui != nullptr) +{ +for(unsigned int i = 0; i < slns.size(); i++) +ui[i]->free_fn(); +free_with_check(ui); +} + +e->free(); +delete e; + +free_with_check(jwt); + +// Edges are parameterized from 0 to 1 while integration weights +return std::abs(0.5*res); +// are defined in (-1, 1). Thus multiplying with 0.5 to correct +// the weights. +} + +// #endif +template HERMES_API class KellyTypeAdapt; +template HERMES_API class KellyTypeAdapt >; +template HERMES_API class BasicKellyAdapt; +template HERMES_API class BasicKellyAdapt >; +} } */ \ No newline at end of file diff --git a/hermes2d/src/api2d.cpp b/hermes2d/src/api2d.cpp index ac13070ac7..e4e04337a0 100644 --- a/hermes2d/src/api2d.cpp +++ b/hermes2d/src/api2d.cpp @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published diff --git a/hermes2d/src/asmlist.cpp b/hermes2d/src/asmlist.cpp index 461f7878d7..843c5a194a 100644 --- a/hermes2d/src/asmlist.cpp +++ b/hermes2d/src/asmlist.cpp @@ -61,14 +61,15 @@ namespace Hermes template void AsmList::add_triplet(int i, int d, Scalar c) { - assert(cnt < H2D_MAX_LOCAL_BASIS_SIZE - 1); + if (!(cnt < H2D_MAX_LOCAL_BASIS_SIZE - 1)) + assert(cnt < H2D_MAX_LOCAL_BASIS_SIZE - 1); idx[cnt] = i; dof[cnt] = d; coef[cnt++] = c; } - template HERMES_API class AsmList; - template HERMES_API class AsmList >; + template HERMES_API class AsmList < double > ; + template HERMES_API class AsmList < std::complex > ; } } \ No newline at end of file diff --git a/hermes2d/src/boundary_conditions/essential_boundary_conditions.cpp b/hermes2d/src/boundary_conditions/essential_boundary_conditions.cpp index c274d1487a..713a90329b 100644 --- a/hermes2d/src/boundary_conditions/essential_boundary_conditions.cpp +++ b/hermes2d/src/boundary_conditions/essential_boundary_conditions.cpp @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -24,7 +24,14 @@ namespace Hermes namespace Hermes2D { template - EssentialBoundaryCondition::EssentialBoundaryCondition(Hermes::vector markers) : markers(markers) + EssentialBoundaryCondition::EssentialBoundaryCondition() + { + current_time = 0.0; + value_const = 0.0; + } + + template + EssentialBoundaryCondition::EssentialBoundaryCondition(std::vector markers) : markers(markers) { current_time = 0.0; value_const = 0.0; @@ -56,46 +63,46 @@ namespace Hermes } template - DefaultEssentialBCConst::DefaultEssentialBCConst(Hermes::vector markers, Scalar value_const) : EssentialBoundaryCondition(markers) + DefaultEssentialBCConst::DefaultEssentialBCConst(std::vector markers, Scalar value_const) : EssentialBoundaryCondition(markers) { this->value_const = value_const; } template - DefaultEssentialBCConst::DefaultEssentialBCConst(std::string marker, Scalar value_const) : EssentialBoundaryCondition(Hermes::vector()) + DefaultEssentialBCConst::DefaultEssentialBCConst(std::string marker, Scalar value_const) : EssentialBoundaryCondition() { this->value_const = value_const; this->markers.push_back(marker); } template - Scalar DefaultEssentialBCConst::value(double x, double y, double n_x, double n_y, double t_x, double t_y) const + Scalar DefaultEssentialBCConst::value(double x, double y) const { this->warn("EssentialBoundaryCondition::Function used either for a constant condition, or not redefined for nonconstant condition."); return 0.0; } template - DefaultEssentialBCNonConst::DefaultEssentialBCNonConst(Hermes::vector markers_, + DefaultEssentialBCNonConst::DefaultEssentialBCNonConst(std::vector markers_, MeshFunctionSharedPtr exact_solution_) - : EssentialBoundaryCondition(Hermes::vector()) + : EssentialBoundaryCondition(std::vector()) { ExactSolutionScalar* exact = dynamic_cast*>(exact_solution_.get()); - if(exact) + if (exact) this->exact_solution = exact; else throw Exceptions::Exception("Wrong mesh function type passed to DefaultEssentialBCNonConst."); - + for (unsigned int i = 0; i < markers_.size(); i++) this->markers.push_back(markers_[i]); } template DefaultEssentialBCNonConst::DefaultEssentialBCNonConst(std::string marker, MeshFunctionSharedPtr exact_solution_) - : EssentialBoundaryCondition(Hermes::vector()) + : EssentialBoundaryCondition(std::vector()) { ExactSolutionScalar* exact = dynamic_cast*>(exact_solution_.get()); - if(exact) + if (exact) this->exact_solution = exact; else throw Exceptions::Exception("Wrong mesh function type passed to DefaultEssentialBCNonConst."); @@ -103,52 +110,18 @@ namespace Hermes } template - Scalar DefaultEssentialBCNonConst::value(double x, double y, double n_x, double n_y, double t_x, double t_y) const + Scalar DefaultEssentialBCNonConst::value(double x, double y) const { return exact_solution->value(x, y); } - template - DefaultEssentialBCNonConstHcurl::DefaultEssentialBCNonConstHcurl(Hermes::vector markers_, - MeshFunctionSharedPtr exact_solution2_) - : EssentialBoundaryCondition(Hermes::vector()) - { - ExactSolutionVector* exact = dynamic_cast*>(exact_solution2_.get()); - if(exact) - this->exact_solution2 = exact; - else - throw Exceptions::Exception("Wrong mesh function type passed to DefaultEssentialBCNonConstHcurl."); - - for (unsigned int i = 0; i < markers_.size(); i++) - this->markers.push_back(markers_[i]); - } - - template - DefaultEssentialBCNonConstHcurl::DefaultEssentialBCNonConstHcurl(std::string marker, MeshFunctionSharedPtr exact_solution2_) - : EssentialBoundaryCondition(Hermes::vector()) - { - ExactSolutionVector* exact = dynamic_cast*>(exact_solution2_.get()); - if(exact) - this->exact_solution2 = exact; - else - throw Exceptions::Exception("Wrong mesh function type passed to DefaultEssentialBCNonConstHcurl."); - this->markers.push_back(marker); - } - - template - Scalar DefaultEssentialBCNonConstHcurl::value(double x, double y, double n_x, double n_y, double t_x, double t_y) const - { - Scalar2 val = exact_solution2->value(x, y); - return val.val[0] * t_x + val.val[1] * t_y; - } - template EssentialBCs::EssentialBCs() : HermesAnyBC(nullptr) { } template - EssentialBCs::EssentialBCs(Hermes::vector *> essential_bcs) : HermesAnyBC(nullptr) + EssentialBCs::EssentialBCs(std::vector *> essential_bcs) : HermesAnyBC(nullptr) { add_boundary_conditions(essential_bcs); } @@ -156,15 +129,15 @@ namespace Hermes template EssentialBCs::EssentialBCs(EssentialBoundaryCondition * boundary_condition) : HermesAnyBC(nullptr) { - Hermes::vector *> boundary_conditions; + std::vector *> boundary_conditions; boundary_conditions.push_back(boundary_condition); add_boundary_conditions(boundary_conditions); } template - void EssentialBCs::add_boundary_conditions(Hermes::vector *> boundary_conditions) + void EssentialBCs::add_boundary_conditions(std::vector *> boundary_conditions) { - for(typename Hermes::vector *>::iterator it = boundary_conditions.begin(); it != boundary_conditions.end(); it++) + for (typename std::vector *>::iterator it = boundary_conditions.begin(); it != boundary_conditions.end(); it++) all.push_back(*it); this->markers.clear(); @@ -174,19 +147,19 @@ namespace Hermes template void EssentialBCs::add_boundary_condition(EssentialBoundaryCondition * boundary_condition) { - Hermes::vector *> boundary_conditions; + std::vector *> boundary_conditions; boundary_conditions.push_back(boundary_condition); add_boundary_conditions(boundary_conditions); } template - typename Hermes::vector *>::const_iterator EssentialBCs::begin() const + typename std::vector *>::const_iterator EssentialBCs::begin() const { return all.begin(); } template - typename Hermes::vector *>::const_iterator EssentialBCs::end() const + typename std::vector *>::const_iterator EssentialBCs::end() const { return all.end(); } @@ -203,37 +176,43 @@ namespace Hermes this->markers.clear(); this->BCs.clear(); EssentialBoundaryCondition* any_set = nullptr; - for(this->iterator = begin(); iterator != end(); ++iterator) - for(Hermes::vector::const_iterator it = (*iterator)->markers.begin(); it != (*iterator)->markers.end(); ++it) + for (this->iterator = begin(); iterator != end(); ++iterator) + for (std::vector::const_iterator it = (*iterator)->markers.begin(); it != (*iterator)->markers.end(); ++it) { - if(hermes_any_set) - throw Hermes::Exceptions::Exception("Attempt to define a BC on HERMES_ANY together with a BC on a specific part: '%s'.", it->c_str()); - if((*it) == HERMES_ANY) - { - if(any_set != nullptr) - throw Hermes::Exceptions::Exception("Attempt to define a BC on HERMES_ANY together with a BC on a specific part: '%s'.", any_set->markers.begin()->c_str()); - hermes_any_set = true; - this->HermesAnyBC = *iterator; - } - else - { - any_set = *iterator; - for(int i = 0; i < this->markers.size(); i++) - if(this->markers[i] == *it) - throw Hermes::Exceptions::Exception("Attempt to define more than one description of the BC on the same part of the boundary with marker '%s'.", it->c_str()); - this->markers.push_back(*it); - this->BCs.push_back(*iterator); - } + if (hermes_any_set) + throw Hermes::Exceptions::Exception("Attempt to define a BC on HERMES_ANY together with a BC on a specific part: '%s'.", it->c_str()); + if ((*it) == HERMES_ANY) + { + if (any_set != nullptr) + throw Hermes::Exceptions::Exception("Attempt to define a BC on HERMES_ANY together with a BC on a specific part: '%s'.", any_set->markers.begin()->c_str()); + hermes_any_set = true; + this->HermesAnyBC = *iterator; + } + else + { + any_set = *iterator; + for (unsigned short i = 0; i < this->markers.size(); i++) + if (this->markers[i] == *it) + throw Hermes::Exceptions::Exception("Attempt to define more than one description of the BC on the same part of the boundary with marker '%s'.", it->c_str()); + this->markers.push_back(*it); + this->BCs.push_back(*iterator); + } } } + template + const std::vector& EssentialBCs::get_markers() const + { + return this->markers; + } + template EssentialBoundaryCondition* EssentialBCs::get_boundary_condition(std::string marker) { - if(this->HermesAnyBC != nullptr) + if (this->HermesAnyBC != nullptr) return this->HermesAnyBC; - for(int i = 0; i < this->markers.size(); i++) - if(this->markers[i] == marker) + for (unsigned short i = 0; i < this->markers.size(); i++) + if (this->markers[i] == marker) return this->BCs[i]; return nullptr; } @@ -241,17 +220,17 @@ namespace Hermes template void EssentialBCs::set_current_time(double time) { - for(iterator = begin(); iterator != end(); iterator++) + for (iterator = begin(); iterator != end(); iterator++) (*iterator)->set_current_time(time); } - template HERMES_API class EssentialBoundaryCondition; - template HERMES_API class EssentialBoundaryCondition >; - template HERMES_API class DefaultEssentialBCConst; - template HERMES_API class DefaultEssentialBCConst >; - template HERMES_API class DefaultEssentialBCNonConst; - template HERMES_API class DefaultEssentialBCNonConst >; - template HERMES_API class EssentialBCs; - template HERMES_API class EssentialBCs >; + template HERMES_API class EssentialBoundaryCondition < double > ; + template HERMES_API class EssentialBoundaryCondition < std::complex > ; + template HERMES_API class DefaultEssentialBCConst < double > ; + template HERMES_API class DefaultEssentialBCConst < std::complex > ; + template HERMES_API class DefaultEssentialBCNonConst < double > ; + template HERMES_API class DefaultEssentialBCNonConst < std::complex > ; + template HERMES_API class EssentialBCs < double > ; + template HERMES_API class EssentialBCs < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/discrete_problem/dg/discrete_problem_dg_assembler.cpp b/hermes2d/src/discrete_problem/dg/discrete_problem_dg_assembler.cpp index f8e62f58b7..643c7bdcca 100644 --- a/hermes2d/src/discrete_problem/dg/discrete_problem_dg_assembler.cpp +++ b/hermes2d/src/discrete_problem/dg/discrete_problem_dg_assembler.cpp @@ -31,7 +31,7 @@ namespace Hermes unsigned int DiscreteProblemDGAssembler::dg_order = 20; template - DiscreteProblemDGAssembler::DiscreteProblemDGAssembler(DiscreteProblemThreadAssembler* threadAssembler, const Hermes::vector >& spaces, Hermes::vector& meshes) + DiscreteProblemDGAssembler::DiscreteProblemDGAssembler(DiscreteProblemThreadAssembler* threadAssembler, const std::vector > spaces, std::vector& meshes) : pss(threadAssembler->pss), refmaps(threadAssembler->refmaps), u_ext(threadAssembler->u_ext), @@ -59,21 +59,20 @@ namespace Hermes if (DG_matrix_forms_present) { - npss = malloc_with_check(spaces_size); + npss = malloc_with_check(spaces_size); nrefmaps = malloc_with_check(spaces_size); for (unsigned int j = 0; j < spaces_size; j++) { - npss[j] = new PrecalcShapeset(spaces[j]->shapeset); + npss[j] = new PrecalcShapesetAssembling(spaces[j]->shapeset); nrefmaps[j] = new RefMap(); } } this->als = threadAssembler->als; } - template - NeighborSearch* DiscreteProblemDGAssembler::get_neighbor_search_ext(WeakForm* wf, NeighborSearch** neighbor_searches, int index) + NeighborSearch* DiscreteProblemDGAssembler::get_neighbor_search_ext(WeakFormSharedPtr wf, NeighborSearch** neighbor_searches, int index) { return neighbor_searches[index + wf->get_neq()]; } @@ -101,7 +100,7 @@ namespace Hermes this->neighbor_searches = new NeighborSearch**[this->current_state->rep->nvert]; for (int i = 0; i < this->current_state->rep->nvert; i++) this->neighbor_searches[i] = new NeighborSearch*[this->current_state->num]; - this->num_neighbors = new int[this->current_state->rep->nvert]; + this->num_neighbors = new unsigned int[this->current_state->rep->nvert]; processed = new bool*[current_state->rep->nvert]; if (DG_matrix_forms_present) @@ -120,7 +119,7 @@ namespace Hermes #pragma omp critical (DG) { for (unsigned int i = 0; i < current_state->num; i++) - current_state->e[i]->visited = true; + current_state->e[i]->visited = true; for (current_state->isurf = 0; current_state->isurf < current_state->rep->nvert; current_state->isurf++) { @@ -228,9 +227,9 @@ namespace Hermes // The computation takes place here. typename NeighborSearch::ExtendedShapeset** ext_asmlist = new typename NeighborSearch::ExtendedShapeset*[this->spaces_size]; int n_quadrature_points; - Geom** geometry = malloc_with_check*>(this->spaces_size); + GeomSurf* geometry = malloc_with_check>(this->spaces_size); double** jacobian_x_weights = malloc_with_check(this->spaces_size); - Geom** e = malloc_with_check*>(this->spaces_size); + InterfaceGeom** e = malloc_with_check*>(this->spaces_size); DiscontinuousFunc*** testFunctions = malloc_with_check**>(this->spaces_size); // Create the extended shapeset on the union of the central element and its current neighbor. @@ -238,10 +237,13 @@ namespace Hermes int order_base = DiscreteProblemDGAssembler::dg_order; for (unsigned int i = 0; i < this->spaces_size; i++) { + if (!current_state->e[i]) + continue; current_neighbor_searches[i]->set_quad_order(order); order_base = order; - n_quadrature_points = init_surface_geometry_points(refmaps, this->spaces_size, order_base, current_state->isurf, current_state->rep->marker, geometry[i], jacobian_x_weights[i]); - e[i] = new InterfaceGeom(geometry[i], current_neighbor_searches[i]->neighb_el->marker, current_neighbor_searches[i]->neighb_el->id, current_neighbor_searches[i]->neighb_el->diameter); + jacobian_x_weights[i] = new double[refmaps[i]->get_quad_2d()->get_num_points(order_base, current_state->e[i]->get_mode())]; + n_quadrature_points = init_surface_geometry_points_allocated(refmaps, this->spaces_size, order_base, current_state->isurf, current_state->rep->marker, geometry[i], jacobian_x_weights[i]); + e[i] = new InterfaceGeom(&geometry[i], current_neighbor_searches[i]->central_el, current_neighbor_searches[i]->neighb_el); if (current_mat && DG_matrix_forms_present && !edge_processed) { @@ -275,22 +277,22 @@ namespace Hermes if (u_ext) { for (int u_ext_func_i = 0; u_ext_func_i < this->spaces_size; u_ext_func_i++) - if (u_ext[u_ext_func_i]) - { + if (u_ext[u_ext_func_i]) + { current_neighbor_searches[u_ext_func_i]->set_quad_order(order); u_ext_func[u_ext_func_i] = current_neighbor_searches[u_ext_func_i]->init_ext_fn(u_ext[u_ext_func_i]); - } - else - u_ext_func[u_ext_func_i] = nullptr; + } + else + u_ext_func[u_ext_func_i] = nullptr; } else - for (int u_ext_func_i = 0; u_ext_func_i < this->spaces_size; u_ext_func_i++) - u_ext_func[u_ext_func_i] = nullptr; + for (int u_ext_func_i = 0; u_ext_func_i < this->spaces_size; u_ext_func_i++) + u_ext_func[u_ext_func_i] = nullptr; } if (current_mat && DG_matrix_forms_present && !edge_processed) { - for (int current_mfsurf_i = 0; current_mfsurf_i < wf->mfDG.size(); current_mfsurf_i++) + for (unsigned short current_mfsurf_i = 0; current_mfsurf_i < wf->mfDG.size(); current_mfsurf_i++) { if (!this->selectiveAssembler->form_to_be_assembled((MatrixForm*)wf->mfDG[current_mfsurf_i], current_state)) continue; @@ -334,10 +336,7 @@ namespace Hermes current_mat->add(ext_asmlist_v->cnt, ext_asmlist_u->cnt, this->local_stiffness_matrix, ext_asmlist_v->dof, ext_asmlist_u->dof, H2D_MAX_LOCAL_BASIS_SIZE * 2); } - } - if (current_mat && DG_matrix_forms_present && !edge_processed) - { for (int i = 0; i < this->spaces_size; i++) { for (int func_i = 0; func_i < ext_asmlist[i]->cnt; func_i++) @@ -350,9 +349,10 @@ namespace Hermes free_with_check(testFunctions[i]); } } + free_with_check(testFunctions); free_with_check(ext_asmlist); - + if (current_rhs && DG_vector_forms_present) { for (unsigned int ww = 0; ww < wf->vfDG.size(); ww++) @@ -397,22 +397,20 @@ namespace Hermes if (u_ext) { for (int u_ext_i = 0; u_ext_i < this->spaces_size; u_ext_i++) - if (u_ext[u_ext_i]) - { + if (u_ext[u_ext_i]) + { delete u_ext_func[u_ext_i]; - } + } } } delete[] u_ext_func; - for (int i = 0; i < this->spaces_size; i++) { if (this->spaces[i]->get_type() != HERMES_L2_SPACE) continue; delete[] jacobian_x_weights[i]; - e[i]->free(); delete e[i]; } @@ -438,7 +436,7 @@ namespace Hermes } template - DiscontinuousFunc** DiscreteProblemDGAssembler::init_ext_fns(Hermes::vector > ext, + DiscontinuousFunc** DiscreteProblemDGAssembler::init_ext_fns(std::vector > ext, NeighborSearch** current_neighbor_searches, int order) { DiscontinuousFunc** ext_fns = new DiscontinuousFunc*[ext.size()]; @@ -461,12 +459,12 @@ namespace Hermes { bool existing_ns = false; for (int j = i - 1; j >= 0; j--) - if (current_state->e[i] == current_state->e[j]) - { + if (current_state->e[i] == current_state->e[j]) + { current_neighbor_searches[i] = current_neighbor_searches[j]; existing_ns = true; break; - } + } if (!existing_ns) { NeighborSearch* ns = new NeighborSearch(current_state->e[i], this->meshes[i]); @@ -488,11 +486,11 @@ namespace Hermes { bool existing_ns = false; for (int j = i - 1; j >= 0; j--) - if (current_state->e[i] == current_state->e[j]) - { + if (current_state->e[i] == current_state->e[j]) + { existing_ns = true; break; - } + } if (!existing_ns) delete current_neighbor_searches[i]; } @@ -508,16 +506,16 @@ namespace Hermes if (DEBUG_DG_ASSEMBLING_ELEMENT != -1) { for (unsigned int i = 0; i < this->current_state->num; i++) - if (neighbor_searches[current_state->isurf][i]->central_el->id == DEBUG_DG_ASSEMBLING_ELEMENT) - pass = false; + if (neighbor_searches[current_state->isurf][i]->central_el->id == DEBUG_DG_ASSEMBLING_ELEMENT) + pass = false; } else pass = false; if (!pass) - if (DEBUG_DG_ASSEMBLING_ISURF != -1) - if (current_state->isurf != DEBUG_DG_ASSEMBLING_ISURF) - pass = true; + if (DEBUG_DG_ASSEMBLING_ISURF != -1) + if (current_state->isurf != DEBUG_DG_ASSEMBLING_ISURF) + pass = true; if (!pass) { @@ -549,7 +547,7 @@ namespace Hermes } #endif - template class HERMES_API DiscreteProblemDGAssembler; - template class HERMES_API DiscreteProblemDGAssembler >; + template class HERMES_API DiscreteProblemDGAssembler < double > ; + template class HERMES_API DiscreteProblemDGAssembler < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/discrete_problem/dg/multimesh_dg_neighbor_tree.cpp b/hermes2d/src/discrete_problem/dg/multimesh_dg_neighbor_tree.cpp index 33e8c10bd2..8dc8c470f5 100644 --- a/hermes2d/src/discrete_problem/dg/multimesh_dg_neighbor_tree.cpp +++ b/hermes2d/src/discrete_problem/dg/multimesh_dg_neighbor_tree.cpp @@ -20,7 +20,7 @@ namespace Hermes namespace Hermes2D { template - void MultimeshDGNeighborTree::process_edge(NeighborSearch** neighbor_searches, int num_neighbor_searches, int& num_neighbors, bool*& processed) + void MultimeshDGNeighborTree::process_edge(NeighborSearch** neighbor_searches, unsigned char num_neighbor_searches, unsigned int& num_neighbors, bool*& processed) { MultimeshDGNeighborTreeNode root(nullptr, 0); @@ -30,31 +30,31 @@ namespace Hermes // After this, all NeighborSearches in neighbor_searches should have the same count // of neighbors and proper set of transformations // for the central and the neighbor element(s) alike. - // Also check that every NeighborSearch has the same number of neighbor elements. + // Also check that every NeighborSearch has the same number o f neighbor elements. num_neighbors = 0; - for(unsigned int i = 0; i < num_neighbor_searches; i++) + for (unsigned int i = 0; i < num_neighbor_searches; i++) { NeighborSearch* ns = neighbor_searches[i]; update_neighbor_search(ns, &root); - - if(num_neighbors == 0) + + if (num_neighbors == 0) num_neighbors = ns->n_neighbors; - - if(ns->n_neighbors != num_neighbors) + + if (ns->n_neighbors != num_neighbors) throw Hermes::Exceptions::Exception("Num_neighbors of different NeighborSearches not matching in assemble_one_state()."); } processed = new bool[num_neighbors]; - for(unsigned int neighbor_i = 0; neighbor_i < num_neighbors; neighbor_i++) + for (unsigned int neighbor_i = 0; neighbor_i < num_neighbors; neighbor_i++) { // If the active segment has already been processed (when the neighbor element was assembled), it is skipped. // We test all neighbor searches, because in the case of intra-element edge, the neighboring (the same as central) element // will be marked as visited, even though the edge was not calculated. processed[neighbor_i] = true; - for(unsigned int i = 0; i < num_neighbor_searches; i++) + for (unsigned int i = 0; i < num_neighbor_searches; i++) { - if(!neighbor_searches[i]->neighbors.at(neighbor_i)->visited) + if (!neighbor_searches[i]->neighbors.at(neighbor_i)->visited) { processed[neighbor_i] = false; break; @@ -66,13 +66,13 @@ namespace Hermes template void MultimeshDGNeighborTree::build_multimesh_tree(MultimeshDGNeighborTreeNode* root, NeighborSearch** neighbor_searches, int number) { - for(unsigned int i = 0; i < number; i++) + for (unsigned int i = 0; i < number; i++) { NeighborSearch* ns = neighbor_searches[i]; - if(ns->n_neighbors == 1 && (ns->central_transformations_size == 0 || ns->central_transformations[0]->num_levels == 0)) + if (ns->n_neighbors == 1 && (ns->central_transformations_size == 0 || ns->central_transformations[0]->num_levels == 0)) continue; - for(unsigned int j = 0; j < ns->n_neighbors; j++) - if(j < ns->central_transformations_alloc_size && ns->central_transformations[j]) + for (unsigned int j = 0; j < ns->n_neighbors; j++) + if (j < ns->central_transformations_alloc_size && ns->central_transformations[j]) insert_into_multimesh_tree(root, ns->central_transformations[j]->transf, ns->central_transformations[j]->num_levels); } } @@ -81,10 +81,10 @@ namespace Hermes void MultimeshDGNeighborTree::insert_into_multimesh_tree(MultimeshDGNeighborTreeNode* node, unsigned int* transformations, unsigned int transformation_count) { // If we are already in the leaf. - if(transformation_count == 0) + if (transformation_count == 0) return; // Both sons are null. We have to add a new_ Node. Let us do it for the left sone of node. - if(node->get_left_son() == nullptr && node->get_right_son() == nullptr) + if (node->get_left_son() == nullptr && node->get_right_son() == nullptr) { node->set_left_son(new MultimeshDGNeighborTreeNode(node, transformations[0])); insert_into_multimesh_tree(node->get_left_son(), transformations + 1, transformation_count - 1); @@ -94,12 +94,12 @@ namespace Hermes else { // The existing left son is the right one to continue through. - if(node->get_left_son()->get_transformation() == transformations[0]) + if (node->get_left_son()->get_transformation() == transformations[0]) insert_into_multimesh_tree(node->get_left_son(), transformations + 1, transformation_count - 1); // The right one also exists, check that it is the right one, or return an error. - else if(node->get_right_son()) + else if (node->get_right_son()) { - if(node->get_right_son()->get_transformation() == transformations[0]) + if (node->get_right_son()->get_transformation() == transformations[0]) insert_into_multimesh_tree(node->get_right_son(), transformations + 1, transformation_count - 1); else throw Hermes::Exceptions::Exception("More than two possible sons in insert_into_multimesh_tree()."); @@ -114,12 +114,12 @@ namespace Hermes } template - Hermes::vector*> MultimeshDGNeighborTree::get_multimesh_neighbors_transformations(MultimeshDGNeighborTreeNode* multimesh_tree) + std::vector*> MultimeshDGNeighborTree::get_multimesh_neighbors_transformations(MultimeshDGNeighborTreeNode* multimesh_tree) { // Initialize the vector. - Hermes::vector*> running_transformations; + std::vector*> running_transformations; // Prepare the first neighbor's vector. - running_transformations.push_back(new Hermes::vector); + running_transformations.push_back(new std::vector); // Fill the vector. traverse_multimesh_tree(multimesh_tree, running_transformations); return running_transformations; @@ -127,14 +127,14 @@ namespace Hermes template void MultimeshDGNeighborTree::traverse_multimesh_tree(MultimeshDGNeighborTreeNode* node, - Hermes::vector*>& running_transformations) + std::vector*>& running_transformations) { // If we are in the root. - if(node->get_transformation() == 0) + if (node->get_transformation() == 0) { - if(node->get_left_son()) + if (node->get_left_son()) traverse_multimesh_tree(node->get_left_son(), running_transformations); - if(node->get_right_son()) + if (node->get_right_son()) traverse_multimesh_tree(node->get_right_son(), running_transformations); // Delete the vector prepared by the last accessed leaf. delete running_transformations.back(); @@ -142,12 +142,12 @@ namespace Hermes return; } // If we are in a leaf. - if(node->get_left_son() == nullptr && node->get_right_son() == nullptr) + if (node->get_left_son() == nullptr && node->get_right_son() == nullptr) { // Create a vector for the new_ neighbor. - Hermes::vector* new_neighbor_transformations = new Hermes::vector; + std::vector* new_neighbor_transformations = new std::vector < unsigned int > ; // Copy there the whole path except for this leaf. - for(unsigned int i = 0; i < running_transformations.back()->size(); i++) + for (unsigned int i = 0; i < running_transformations.back()->size(); i++) new_neighbor_transformations->push_back((*running_transformations.back())[i]); // Insert this leaf into the current running transformation, thus complete it. running_transformations.back()->push_back(node->get_transformation()); @@ -158,9 +158,9 @@ namespace Hermes else { running_transformations.back()->push_back(node->get_transformation()); - if(node->get_left_son()) + if (node->get_left_son()) traverse_multimesh_tree(node->get_left_son(), running_transformations); - if(node->get_right_son()) + if (node->get_right_son()) traverse_multimesh_tree(node->get_right_son(), running_transformations); running_transformations.back()->pop_back(); return; @@ -174,18 +174,18 @@ namespace Hermes // This has to be done, because we pass ns by reference and the number of neighbors is changing. unsigned int num_neighbors = ns->get_num_neighbors(); - for(int i = 0; i < num_neighbors; i++) + for (int i = 0; i < num_neighbors; i++) { // Find the node corresponding to this neighbor in the tree. MultimeshDGNeighborTreeNode* node; - if(i < ns->central_transformations_alloc_size && ns->central_transformations[i]) + if (i < ns->central_transformations_alloc_size && ns->central_transformations[i]) node = find_node(ns->central_transformations[i]->transf, ns->central_transformations[i]->num_levels, multimesh_tree); else node = multimesh_tree; // Update the NeighborSearch. int added = update_ns_subtree(ns, node, i); - if(added >= 0) + if (added >= 0) { i--; num_neighbors--; @@ -199,18 +199,18 @@ namespace Hermes MultimeshDGNeighborTreeNode* node) { // If there are no transformations left. - if(transformation_count == 0) + if (transformation_count == 0) return node; else { - if(node->get_left_son()) + if (node->get_left_son()) { - if(node->get_left_son()->get_transformation() == transformations[0]) + if (node->get_left_son()->get_transformation() == transformations[0]) return find_node(transformations + 1, transformation_count - 1, node->get_left_son()); } - if(node->get_right_son()) + if (node->get_right_son()) { - if(node->get_right_son()->get_transformation() == transformations[0]) + if (node->get_right_son()->get_transformation() == transformations[0]) return find_node(transformations + 1, transformation_count - 1, node->get_right_son()); } } @@ -228,9 +228,9 @@ namespace Hermes // No subtree => no work. // Also check the assertion that if one son is null, then the other too. - if(node->get_left_son() == nullptr) + if (node->get_left_son() == nullptr) { - if(node->get_right_son()) + if (node->get_right_son()) throw Hermes::Exceptions::Exception("Only one son (right) not null in MultimeshDGNeighborTree::update_ns_subtree."); return -1; } @@ -241,28 +241,28 @@ namespace Hermes typename NeighborSearch::NeighborEdgeInfo edge_info = ns->neighbor_edges[ith_neighbor]; // Initialize the vector for central transformations-> - Hermes::vector*> running_central_transformations; + std::vector*> running_central_transformations; // Prepare the first new_ neighbor's vector. Push back the current transformations (in case of GO_DOWN neighborhood). - running_central_transformations.push_back(new Hermes::vector); - if(ith_neighbor < ns->central_transformations_alloc_size && ns->central_transformations[ith_neighbor]) + running_central_transformations.push_back(new std::vector); + if (ith_neighbor < ns->central_transformations_alloc_size && ns->central_transformations[ith_neighbor]) ns->central_transformations[ith_neighbor]->copy_to(running_central_transformations.back()); // Initialize the vector for neighbor transformations-> - Hermes::vector*> running_neighbor_transformations; + std::vector*> running_neighbor_transformations; // Prepare the first new_ neighbor's vector. Push back the current transformations (in case of GO_UP/NO_TRF neighborhood). - running_neighbor_transformations.push_back(new Hermes::vector); - if(ith_neighbor < ns->neighbor_transformations_alloc_size && ns->neighbor_transformations[ith_neighbor]) + running_neighbor_transformations.push_back(new std::vector); + if (ith_neighbor < ns->neighbor_transformations_alloc_size && ns->neighbor_transformations[ith_neighbor]) ns->neighbor_transformations[ith_neighbor]->copy_to(running_neighbor_transformations.back()); // Delete the current neighbor. ns->delete_neighbor(ith_neighbor); // Move down the subtree. - if(node->get_left_son()) + if (node->get_left_son()) traverse_multimesh_subtree(node->get_left_son(), running_central_transformations, running_neighbor_transformations, edge_info, ns->active_edge, ns->central_el->get_mode()); - if(node->get_right_son()) + if (node->get_right_son()) traverse_multimesh_subtree(node->get_right_son(), running_central_transformations, running_neighbor_transformations, edge_info, ns->active_edge, ns->central_el->get_mode()); @@ -274,15 +274,15 @@ namespace Hermes running_neighbor_transformations.pop_back(); // Insert new_ neighbors. - for(unsigned int i = 0; i < running_central_transformations.size(); i++) + for (unsigned int i = 0; i < running_central_transformations.size(); i++) { ns->neighbors.push_back(neighbor); ns->neighbor_edges.push_back(edge_info); - if((ns->n_neighbors >= ns->central_transformations_alloc_size) || !ns->central_transformations[ns->n_neighbors]) + if ((ns->n_neighbors >= ns->central_transformations_alloc_size) || !ns->central_transformations[ns->n_neighbors]) ns->add_central_transformations(new typename NeighborSearch::Transformations, ns->n_neighbors); - if((ns->n_neighbors >= ns->neighbor_transformations_alloc_size) || !ns->neighbor_transformations[ns->n_neighbors]) + if ((ns->n_neighbors >= ns->neighbor_transformations_alloc_size) || !ns->neighbor_transformations[ns->n_neighbors]) ns->add_neighbor_transformations(new typename NeighborSearch::Transformations, ns->n_neighbors); ns->central_transformations[ns->n_neighbors]->copy_from(*running_central_transformations[i]); @@ -291,9 +291,9 @@ namespace Hermes ns->n_neighbors++; } - for(unsigned int i = 0; i < running_central_transformations.size(); i++) + for (unsigned int i = 0; i < running_central_transformations.size(); i++) delete running_central_transformations[i]; - for(unsigned int i = 0; i < running_neighbor_transformations.size(); i++) + for (unsigned int i = 0; i < running_neighbor_transformations.size(); i++) delete running_neighbor_transformations[i]; // Return the number of neighbors added/deleted. @@ -302,21 +302,21 @@ namespace Hermes template void MultimeshDGNeighborTree::traverse_multimesh_subtree(MultimeshDGNeighborTreeNode* node, - Hermes::vector*>& running_central_transformations, - Hermes::vector*>& running_neighbor_transformations, + std::vector*>& running_central_transformations, + std::vector*>& running_neighbor_transformations, const typename NeighborSearch::NeighborEdgeInfo& edge_info, const int& active_edge, const int& mode) { // If we are in a leaf. - if(node->get_left_son() == nullptr && node->get_right_son() == nullptr) + if (node->get_left_son() == nullptr && node->get_right_son() == nullptr) { // Create vectors for the new_ neighbor. - Hermes::vector* new_neighbor_central_transformations = new Hermes::vector; - Hermes::vector* new_neighbor_neighbor_transformations = new Hermes::vector; + std::vector* new_neighbor_central_transformations = new std::vector < unsigned int > ; + std::vector* new_neighbor_neighbor_transformations = new std::vector < unsigned int > ; // Copy there the whole path except for this leaf. - for(unsigned int i = 0; i < running_central_transformations.back()->size(); i++) + for (unsigned int i = 0; i < running_central_transformations.back()->size(); i++) new_neighbor_central_transformations->push_back((*running_central_transformations.back())[i]); - for(unsigned int i = 0; i < running_neighbor_transformations.back()->size(); i++) + for (unsigned int i = 0; i < running_neighbor_transformations.back()->size(); i++) new_neighbor_neighbor_transformations->push_back((*running_neighbor_transformations.back())[i]); // Insert this leaf into the current running central transformation, thus complete it. @@ -327,8 +327,8 @@ namespace Hermes // Take care of the neighbor transformation. // Insert appropriate info from this leaf into the current running neighbor transformation, thus complete it. - if(mode == HERMES_MODE_TRIANGLE) - if((active_edge == 0 && node->get_transformation() == 0) || + if (mode == HERMES_MODE_TRIANGLE) + if ((active_edge == 0 && node->get_transformation() == 0) || (active_edge == 1 && node->get_transformation() == 1) || (active_edge == 2 && node->get_transformation() == 2)) running_neighbor_transformations.back()->push_back((!edge_info.orientation ? edge_info.local_num_of_edge : (edge_info.local_num_of_edge + 1) % 3)); @@ -336,7 +336,7 @@ namespace Hermes running_neighbor_transformations.back()->push_back((edge_info.orientation ? edge_info.local_num_of_edge : (edge_info.local_num_of_edge + 1) % 3)); // Quads. else - if((active_edge == 0 && (node->get_transformation() == 0 || node->get_transformation() == 6)) || + if ((active_edge == 0 && (node->get_transformation() == 0 || node->get_transformation() == 6)) || (active_edge == 1 && (node->get_transformation() == 1 || node->get_transformation() == 4)) || (active_edge == 2 && (node->get_transformation() == 2 || node->get_transformation() == 7)) || (active_edge == 3 && (node->get_transformation() == 3 || node->get_transformation() == 5))) @@ -356,8 +356,8 @@ namespace Hermes // Insert appropriate info from this leaf into the current running neighbor transformation, thus complete it. // Triangles. - if(mode == HERMES_MODE_TRIANGLE) - if((active_edge == 0 && node->get_transformation() == 0) || + if (mode == HERMES_MODE_TRIANGLE) + if ((active_edge == 0 && node->get_transformation() == 0) || (active_edge == 1 && node->get_transformation() == 1) || (active_edge == 2 && node->get_transformation() == 2)) running_neighbor_transformations.back()->push_back((!edge_info.orientation ? edge_info.local_num_of_edge : (edge_info.local_num_of_edge + 1) % 3)); @@ -365,7 +365,7 @@ namespace Hermes running_neighbor_transformations.back()->push_back((edge_info.orientation ? edge_info.local_num_of_edge : (edge_info.local_num_of_edge + 1) % 3)); // Quads. else - if((active_edge == 0 && (node->get_transformation() == 0 || node->get_transformation() == 6)) || + if ((active_edge == 0 && (node->get_transformation() == 0 || node->get_transformation() == 6)) || (active_edge == 1 && (node->get_transformation() == 1 || node->get_transformation() == 4)) || (active_edge == 2 && (node->get_transformation() == 2 || node->get_transformation() == 7)) || (active_edge == 3 && (node->get_transformation() == 3 || node->get_transformation() == 5))) @@ -374,10 +374,10 @@ namespace Hermes running_neighbor_transformations.back()->push_back((edge_info.orientation ? edge_info.local_num_of_edge : (edge_info.local_num_of_edge + 1) % H2D_MAX_NUMBER_EDGES)); // Move down. - if(node->get_left_son()) + if (node->get_left_son()) traverse_multimesh_subtree(node->get_left_son(), running_central_transformations, running_neighbor_transformations, edge_info, active_edge, mode); - if(node->get_right_son()) + if (node->get_right_son()) traverse_multimesh_subtree(node->get_right_son(), running_central_transformations, running_neighbor_transformations, edge_info, active_edge, mode); @@ -389,7 +389,7 @@ namespace Hermes return; } - template class HERMES_API MultimeshDGNeighborTree; - template class HERMES_API MultimeshDGNeighborTree >; + template class HERMES_API MultimeshDGNeighborTree < double > ; + template class HERMES_API MultimeshDGNeighborTree < std::complex > ; } } \ No newline at end of file diff --git a/hermes2d/src/discrete_problem/dg/multimesh_dg_neighbor_tree_node.cpp b/hermes2d/src/discrete_problem/dg/multimesh_dg_neighbor_tree_node.cpp index b77c2c3bb9..32bc8706a6 100644 --- a/hermes2d/src/discrete_problem/dg/multimesh_dg_neighbor_tree_node.cpp +++ b/hermes2d/src/discrete_problem/dg/multimesh_dg_neighbor_tree_node.cpp @@ -26,12 +26,12 @@ namespace Hermes } MultimeshDGNeighborTreeNode::~MultimeshDGNeighborTreeNode() { - if(left_son) + if (left_son) { delete left_son; left_son = nullptr; } - if(right_son) + if (right_son) { delete right_son; right_son = nullptr; diff --git a/hermes2d/src/discrete_problem.cpp b/hermes2d/src/discrete_problem/discrete_problem.cpp similarity index 51% rename from hermes2d/src/discrete_problem.cpp rename to hermes2d/src/discrete_problem/discrete_problem.cpp index e891b1d285..2999831b18 100644 --- a/hermes2d/src/discrete_problem.cpp +++ b/hermes2d/src/discrete_problem/discrete_problem.cpp @@ -15,7 +15,7 @@ #include "discrete_problem/dg/discrete_problem_dg_assembler.h" #include "discrete_problem/discrete_problem_helpers.h" -#include "discrete_problem.h" +#include "discrete_problem/discrete_problem.h" #include "function/exact_solution.h" #include "mesh/traverse.h" #include "space/space.h" @@ -29,59 +29,61 @@ namespace Hermes namespace Hermes2D { template - DiscreteProblem::DiscreteProblem(WeakForm* wf_, Hermes::vector >& spaces) + DiscreteProblem::DiscreteProblem(WeakFormSharedPtr wf_, std::vector > spaces, bool to_set, bool dirichlet_lift_accordingly, bool use_direct_for_Dirichlet_lift) { - init(); + this->init(to_set, dirichlet_lift_accordingly, use_direct_for_Dirichlet_lift); this->set_spaces(spaces); this->set_weak_formulation(wf_); } template - DiscreteProblem::DiscreteProblem(WeakForm* wf_, SpaceSharedPtr& space) + DiscreteProblem::DiscreteProblem(WeakFormSharedPtr wf_, SpaceSharedPtr space, bool to_set, bool dirichlet_lift_accordingly, bool use_direct_for_Dirichlet_lift) { - init(); + this->init(to_set, dirichlet_lift_accordingly, use_direct_for_Dirichlet_lift); this->set_space(space); this->set_weak_formulation(wf_); } template - DiscreteProblem::DiscreteProblem() + DiscreteProblem::DiscreteProblem(bool to_set, bool dirichlet_lift_accordingly, bool use_direct_for_Dirichlet_lift) { - init(); + init(to_set, dirichlet_lift_accordingly, use_direct_for_Dirichlet_lift); } template - void DiscreteProblem::init() + void DiscreteProblem::init(bool to_set, bool dirichlet_lift_accordingly, bool use_direct_for_Dirichlet_lift) { - this->spaces_size = this->spaces.size(); - - this->nonlinear = true; - this->add_dirichlet_lift = false; + this->reassembled_states_reuse_linear_system = nullptr; - // Local number of threads - to avoid calling it over and over again, and against faults caused by the - // value being changed while assembling. - this->threadAssembler = new DiscreteProblemThreadAssembler*[this->num_threads_used]; - for (int i = 0; i < this->num_threads_used; i++) - this->threadAssembler[i] = new DiscreteProblemThreadAssembler(&this->selectiveAssembler); - } + this->spaces_size = this->spaces.size(); - template - void DiscreteProblem::set_linear(bool to_set, bool dirichlet_lift_accordingly) - { this->nonlinear = !to_set; if (dirichlet_lift_accordingly) this->add_dirichlet_lift = !this->nonlinear; else this->add_dirichlet_lift = this->nonlinear; + + if (this->add_dirichlet_lift) + this->dirichlet_lift_rhs = create_vector(use_direct_for_Dirichlet_lift); + else + this->dirichlet_lift_rhs = nullptr; + + // Local number of threads - to avoid calling it over and over again, and against faults caused by the + // value being changed while assembling. + this->threadAssembler = new DiscreteProblemThreadAssembler*[this->num_threads_used]; + for (int i = 0; i < this->num_threads_used; i++) + this->threadAssembler[i] = new DiscreteProblemThreadAssembler(&this->selectiveAssembler, this->nonlinear); } template DiscreteProblem::~DiscreteProblem() { - for (int i = 0; i < this->num_threads_used; i++) delete this->threadAssembler[i]; delete[] this->threadAssembler; + + if (this->dirichlet_lift_rhs) + delete this->dirichlet_lift_rhs; } template @@ -94,16 +96,23 @@ namespace Hermes return false; // Initial check of meshes and spaces. - for (unsigned int space_i = 0; space_i < this->spaces_size; space_i++) + for (unsigned short space_i = 0; space_i < this->spaces_size; space_i++) this->spaces[space_i]->check(); - for (unsigned int space_i = 0; space_i < this->spaces_size; space_i++) - if (!this->spaces[space_i]->is_up_to_date()) - throw Exceptions::Exception("Space is out of date, if you manually refine it, you have to call assign_dofs()."); + for (unsigned short space_i = 0; space_i < this->spaces_size; space_i++) + if (!this->spaces[space_i]->is_up_to_date()) + throw Exceptions::Exception("Space is out of date, if you manually refine it, you have to call assign_dofs()."); return true; } + template + void DiscreteProblem::set_verbose_output(bool to_set) + { + Loggable::set_verbose_output(to_set); + this->selectiveAssembler.set_verbose_output(to_set); + } + template void DiscreteProblem::set_time(double time) { @@ -118,7 +127,7 @@ namespace Hermes } template - Hermes::vector >& DiscreteProblem::get_spaces() + std::vector > DiscreteProblem::get_spaces() { return this->spaces; } @@ -141,35 +150,56 @@ namespace Hermes } template - void DiscreteProblem::set_weak_formulation(WeakForm* wf_) + void DiscreteProblem::set_weak_formulation(WeakFormSharedPtr wf) { - Mixins::DiscreteProblemWeakForm::set_weak_formulation(wf_); + Mixins::DiscreteProblemWeakForm::set_weak_formulation(wf); - this->selectiveAssembler.set_weak_formulation(wf_); + this->selectiveAssembler.set_weak_formulation(wf); this->selectiveAssembler.matrix_structure_reusable = false; } template - void DiscreteProblem::set_matrix(SparseMatrix* mat) + bool DiscreteProblem::set_matrix(SparseMatrix* mat) { Mixins::DiscreteProblemMatrixVector::set_matrix(mat); + for (int i = 0; i < this->num_threads_used; i++) this->threadAssembler[i]->set_matrix(mat); + + if (mat && this->current_mat != mat) + { + this->invalidate_matrix(); + return false; + } + else + return true; } template - void DiscreteProblem::set_rhs(Vector* rhs) + bool DiscreteProblem::set_rhs(Vector* rhs) { Mixins::DiscreteProblemMatrixVector::set_rhs(rhs); + for (int i = 0; i < this->num_threads_used; i++) + { this->threadAssembler[i]->set_rhs(rhs); + this->threadAssembler[i]->dirichlet_lift_rhs = this->dirichlet_lift_rhs; + } + + if (rhs && this->current_rhs != rhs) + { + this->invalidate_matrix(); + return false; + } + else + return true; } template - void DiscreteProblem::set_spaces(Hermes::vector >& spacesToSet) + void DiscreteProblem::set_spaces(std::vector > spacesToSet) { - if (this->spaces_size != spacesToSet.size() && this->spaces_size > 0) - throw Hermes::Exceptions::LengthException(0, spacesToSet.size(), this->spaces_size); + if (this->spaces_size > 0) + Helpers::check_length(spacesToSet, this->spaces_size); for (unsigned int i = 0; i < spacesToSet.size(); i++) { @@ -188,60 +218,35 @@ namespace Hermes } template - void DiscreteProblem::set_space(SpaceSharedPtr& space) + void DiscreteProblem::set_space(SpaceSharedPtr space) { - Hermes::vector > spaces; + std::vector > spaces; spaces.push_back(space); this->set_spaces(spaces); } template - void DiscreteProblem::assemble(SparseMatrix* mat, Vector* rhs) + bool DiscreteProblem::assemble(SparseMatrix* mat, Vector* rhs) { - assemble((Solution**)nullptr, mat, rhs); + Scalar* coeff_vec = nullptr; + return assemble(coeff_vec, mat, rhs); } template - void DiscreteProblem::assemble(Scalar* coeff_vec, Vector* rhs) + bool DiscreteProblem::assemble(Scalar*& coeff_vec, Vector* rhs) { - assemble(coeff_vec, nullptr, rhs); + return assemble(coeff_vec, nullptr, rhs); } template - void DiscreteProblem::assemble(Vector* rhs) + bool DiscreteProblem::assemble(Vector* rhs) { - assemble((Solution**)nullptr, nullptr, rhs); + Scalar* coeff_vec = nullptr; + return assemble(coeff_vec, nullptr, rhs); } template - void DiscreteProblem::assemble(Scalar* coeff_vec, SparseMatrix* mat, Vector* rhs) - { - Solution** u_ext_sln = nullptr; - - if (this->nonlinear && coeff_vec) - { - u_ext_sln = new Solution*[spaces_size]; - int first_dof = 0; - for (int i = 0; i < this->spaces_size; i++) - { - u_ext_sln[i] = new Solution(spaces[i]->get_mesh()); - Solution::vector_to_solution(coeff_vec, spaces[i], u_ext_sln[i], !this->rungeKutta, first_dof); - first_dof += spaces[i]->get_num_dofs(); - } - } - - assemble(u_ext_sln, mat, rhs); - - if (this->nonlinear && coeff_vec) - { - for (int i = 0; i < this->spaces_size; i++) - delete u_ext_sln[i]; - delete[] u_ext_sln; - } - } - - template - void DiscreteProblem::init_assembling(Traverse::State**& states, int& num_states, Solution** u_ext_sln, Hermes::vector& meshes) + void DiscreteProblem::init_assembling(Traverse::State**& states, unsigned int& num_states, std::vector& meshes) { // Vector of meshes. for (unsigned int space_i = 0; space_i < spaces.size(); space_i++) @@ -249,9 +254,9 @@ namespace Hermes for (unsigned int ext_i = 0; ext_i < this->wf->ext.size(); ext_i++) meshes.push_back(this->wf->ext[ext_i]->get_mesh()); for (unsigned int form_i = 0; form_i < this->wf->get_forms().size(); form_i++) - for (unsigned int ext_i = 0; ext_i < this->wf->get_forms()[form_i]->ext.size(); ext_i++) - if (this->wf->get_forms()[form_i]->ext[ext_i]) - meshes.push_back(this->wf->get_forms()[form_i]->ext[ext_i]->get_mesh()); + for (unsigned int ext_i = 0; ext_i < this->wf->get_forms()[form_i]->ext.size(); ext_i++) + if (this->wf->get_forms()[form_i]->ext[ext_i]) + meshes.push_back(this->wf->get_forms()[form_i]->ext[ext_i]->get_mesh()); if (this->nonlinear) { @@ -263,7 +268,7 @@ namespace Hermes // This must be here, because the weakforms may have changed since set_weak_formulation (where the following calls // used to be in development). And since the following clones the passed WeakForm, this has to be called // only after the weak forms are ready for calculation. - for (int i = 0; i < this->num_threads_used; i++) + for (unsigned char i = 0; i < this->num_threads_used; i++) this->threadAssembler[i]->set_weak_formulation(this->wf); Traverse trav(this->spaces_size); @@ -271,90 +276,132 @@ namespace Hermes // Init the caught parallel exception message. this->exceptionMessageCaughtInParallelBlock.clear(); + + // Dirichlet lift rhs part. + if (this->add_dirichlet_lift) + { + unsigned int ndof = Space::get_num_dofs(spaces); + this->dirichlet_lift_rhs->alloc(ndof); + } } template - void DiscreteProblem::assemble(Solution** u_ext_sln, SparseMatrix* mat, Vector* rhs) + bool DiscreteProblem::assemble(Scalar*& coeff_vec, SparseMatrix* mat, Vector* rhs) { // Check. this->check(); + this->tick(); // Set the matrices. - this->set_matrix(mat); - this->set_rhs(rhs); + bool result = this->set_matrix(mat) && this->set_rhs(rhs); // Initialize states && previous iterations. - int num_states; + unsigned int num_states; Traverse::State** states; - Hermes::vector meshes; - this->init_assembling(states, num_states, u_ext_sln, meshes); + std::vector meshes; + this->init_assembling(states, num_states, meshes); + this->tick(); + this->info("\tDiscreteProblem: Initialization: %s.", this->last_str().c_str()); + this->tick(); // Creating matrix sparse structure. // If there are no states, return. if (this->selectiveAssembler.prepare_sparse_structure(this->current_mat, this->current_rhs, this->spaces, states, num_states)) { - // Is this a DG assembling. - bool is_DG = this->wf->is_DG(); + this->tick(); + this->info("\tDiscreteProblem: Prepare sparse structure: %s.", this->last_str().c_str()); -#pragma omp parallel num_threads(this->num_threads_used) - { - int thread_number = omp_get_thread_num(); - int start = (num_states / this->num_threads_used) * thread_number; - int end = (num_states / this->num_threads_used) * (thread_number + 1); - if (thread_number == this->num_threads_used - 1) - end = num_states; + // The following does not make much sense to do just for rhs) + if (this->current_mat && this->reassembled_states_reuse_linear_system) + this->reassembled_states_reuse_linear_system(states, num_states, this->current_mat, this->current_rhs, this->dirichlet_lift_rhs, coeff_vec); - try + Solution** u_ext_sln = nullptr; + if (this->nonlinear && coeff_vec) + { + u_ext_sln = new Solution*[spaces_size]; + int first_dof = 0; + for (int i = 0; i < this->spaces_size; i++) { - this->threadAssembler[thread_number]->init_assembling(u_ext_sln, spaces, this->nonlinear, this->add_dirichlet_lift); + u_ext_sln[i] = new Solution(spaces[i]->get_mesh()); + Solution::vector_to_solution(coeff_vec, spaces[i], u_ext_sln[i], !this->rungeKutta, first_dof); + first_dof += spaces[i]->get_num_dofs(); + } + } - DiscreteProblemDGAssembler* dgAssembler; - if (is_DG) - dgAssembler = new DiscreteProblemDGAssembler(this->threadAssembler[thread_number], this->spaces, meshes); + if (num_states > 0) + { + // Is this a DG assembling. + bool is_DG = this->wf->is_DG(); - for (int state_i = start; state_i < end; state_i++) +#pragma omp parallel num_threads(this->num_threads_used) + { + int thread_number = omp_get_thread_num(); + int start = (num_states / this->num_threads_used) * thread_number; + int end = (num_states / this->num_threads_used) * (thread_number + 1); + if (thread_number == this->num_threads_used - 1) + end = num_states; + + try { - // Exception already thrown -> exit the loop. - if (!this->exceptionMessageCaughtInParallelBlock.empty()) - break; + this->threadAssembler[thread_number]->init_assembling(u_ext_sln, spaces, this->add_dirichlet_lift); - Traverse::State* current_state = states[state_i]; + DiscreteProblemDGAssembler* dgAssembler; + if (is_DG) + dgAssembler = new DiscreteProblemDGAssembler(this->threadAssembler[thread_number], this->spaces, meshes); - this->threadAssembler[thread_number]->init_assembling_one_state(spaces, current_state); + for (int state_i = start; state_i < end; state_i++) + { + // Exception already thrown -> exit the loop. + if (!this->exceptionMessageCaughtInParallelBlock.empty()) + break; - this->threadAssembler[thread_number]->assemble_one_state(); + Traverse::State* current_state = states[state_i]; - if (is_DG) - { - dgAssembler->init_assembling_one_state(current_state); - dgAssembler->assemble_one_state(); - dgAssembler->deinit_assembling_one_state(); + this->threadAssembler[thread_number]->init_assembling_one_state(spaces, current_state); + + this->threadAssembler[thread_number]->assemble_one_state(); + + if (is_DG) + { + dgAssembler->init_assembling_one_state(current_state); + dgAssembler->assemble_one_state(); + dgAssembler->deinit_assembling_one_state(); + } + this->threadAssembler[thread_number]->deinit_assembling_one_state(); } - this->threadAssembler[thread_number]->deinit_assembling_one_state(); - } - if (is_DG) - delete dgAssembler; + if (is_DG) + delete dgAssembler; - this->threadAssembler[thread_number]->deinit_assembling(); - } - catch (Hermes::Exceptions::Exception& e) - { + this->threadAssembler[thread_number]->deinit_assembling(); + } + catch (Hermes::Exceptions::Exception& e) + { #pragma omp critical (exceptionMessageCaughtInParallelBlock) - this->exceptionMessageCaughtInParallelBlock = e.info(); - } - catch (std::exception& e) - { + this->exceptionMessageCaughtInParallelBlock = e.info(); + } + catch (std::exception& e) + { #pragma omp critical (exceptionMessageCaughtInParallelBlock) - this->exceptionMessageCaughtInParallelBlock = e.what(); + this->exceptionMessageCaughtInParallelBlock = e.what(); + } } } + + if (this->nonlinear && coeff_vec) + { + for (int i = 0; i < this->spaces_size; i++) + delete u_ext_sln[i]; + delete[] u_ext_sln; + } } + this->tick(); + // Deinitialize states && previous iterations. this->deinit_assembling(states, num_states); - /// Finish the algebraic structures for solving. + // Finish the algebraic structures for solving. if (this->current_mat) this->current_mat->finish(); if (this->current_rhs) @@ -372,17 +419,26 @@ namespace Hermes e->visited = false; } } + + this->tick(); + this->info("\tDiscreteProblem: De-initialization: %s.", this->last_str().c_str()); + + return result; } template - void DiscreteProblem::deinit_assembling(Traverse::State** states, int num_states) + void DiscreteProblem::deinit_assembling(Traverse::State** states, unsigned int num_states) { - for (int i = 0; i < num_states; i++) + for (unsigned int i = 0; i < num_states; i++) delete states[i]; free_with_check(states); + + // Very important. + if (this->add_dirichlet_lift && this->current_rhs) + this->current_rhs->add_vector(this->dirichlet_lift_rhs); } - template class HERMES_API DiscreteProblem; - template class HERMES_API DiscreteProblem >; + template class HERMES_API DiscreteProblem < double > ; + template class HERMES_API DiscreteProblem < std::complex > ; } } diff --git a/hermes2d/src/discrete_problem/discrete_problem_form_assembler.cpp b/hermes2d/src/discrete_problem/discrete_problem_form_assembler.cpp deleted file mode 100644 index 21551f109d..0000000000 --- a/hermes2d/src/discrete_problem/discrete_problem_form_assembler.cpp +++ /dev/null @@ -1,304 +0,0 @@ -// This file is part of Hermes2D. -// -// Hermes2D is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// Hermes2D 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 Hermes2D. If not, see . - -#include "discrete_problem/discrete_problem_form_assembler.h" - -namespace Hermes -{ - namespace Hermes2D - { - template - bool DiscreteProblemFormAssembler::form_to_be_assembled(MatrixForm* form, Traverse::State* current_state) - { - if(current_state->e[form->i] && current_state->e[form->j]) - { - if(fabs(form->scaling_factor) < Hermes::HermesSqrtEpsilon) - return false; - - // If a block scaling table is provided, and if the scaling coefficient - // A_mn for this block is zero, then the form does not need to be assembled. - if(this->block_weights) - if(fabs(this->block_weights->get_A(form->i, form->j)) < Hermes::HermesSqrtEpsilon) - return false; - return true; - } - return false; - } - - template - bool DiscreteProblemFormAssembler::form_to_be_assembled(MatrixFormVol* form, Traverse::State* current_state) - { - if(!form_to_be_assembled((MatrixForm*)form, current_state)) - return false; - - if(form->assembleEverywhere) - return true; - - int this_marker = current_state->rep->marker; - for (unsigned int ss = 0; ss < form->areas_internal.size(); ss++) - if(form->areas_internal[ss] == this_marker) - return true; - - return false; - } - - template - bool DiscreteProblemFormAssembler::form_to_be_assembled(MatrixFormSurf* form, Traverse::State* current_state) - { - if(!form_to_be_assembled((MatrixForm*)form, current_state)) - return false; - - if(current_state->rep->en[current_state->isurf]->marker == 0) - return false; - - if(form->assembleEverywhere) - return true; - - int this_marker = current_state->rep->en[current_state->isurf]->marker; - for (unsigned int ss = 0; ss < form->areas_internal.size(); ss++) - if(form->areas_internal[ss] == this_marker) - return true; - - return false; - } - - template - bool DiscreteProblemFormAssembler::form_to_be_assembled(VectorForm* form, Traverse::State* current_state) - { - if(!current_state->e[form->i]) - return false; - if(fabs(form->scaling_factor) < Hermes::HermesSqrtEpsilon) - return false; - - return true; - } - - template - bool DiscreteProblemFormAssembler::form_to_be_assembled(VectorFormVol* form, Traverse::State* current_state) - { - if(!form_to_be_assembled((VectorForm*)form, current_state)) - return false; - - if(form->assembleEverywhere) - return true; - - int this_marker = current_state->rep->marker; - for (unsigned int ss = 0; ss < form->areas_internal.size(); ss++) - if(form->areas_internal[ss] == this_marker) - return true; - - return false; - } - - template - bool DiscreteProblemFormAssembler::form_to_be_assembled(VectorFormSurf* form, Traverse::State* current_state) - { - if(!form_to_be_assembled((VectorForm*)form, current_state)) - return false; - - if(current_state->rep->en[current_state->isurf]->marker == 0) - return false; - - if(form->assembleEverywhere) - return true; - - int this_marker = current_state->rep->en[current_state->isurf]->marker; - for (unsigned int ss = 0; ss < form->areas_internal.size(); ss++) - if(form->areas_internal[ss] == this_marker) - return true; - - return false; - } - - template - void DiscreteProblemFormAssembler::assemble_matrix_form(MatrixForm* form, int order, Func** base_fns, Func** test_fns, Func** ext, Func** u_ext, - AsmList* current_als_i, AsmList* current_als_j, Traverse::State* current_state, int n_quadrature_points, Geom* geometry, double* jacobian_x_weights) - { - bool surface_form = (dynamic_cast*>(form) == nullptr); - - double block_scaling_coefficient = this->block_scaling_coeff(form); - - bool tra = (form->i != form->j) && (form->sym != 0); - bool sym = (form->i == form->j) && (form->sym == 1); - - // Assemble the local stiffness matrix for the form form. - Scalar **local_stiffness_matrix = new_matrix(std::max(current_als_i->cnt, current_als_j->cnt)); - - Func** local_ext = ext; - // If the user supplied custom ext functions for this form. - if(form->ext.size() > 0) - { - int local_ext_count = form->ext.size(); - local_ext = malloc_with_check(local_ext_count, this); - for(int ext_i = 0; ext_i < local_ext_count; ext_i++) - if(form->ext[ext_i]) - local_ext[ext_i] = current_state->e[ext_i] == nullptr ? nullptr : init_fn(form->ext[ext_i].get(), order); - else - local_ext[ext_i] = nullptr; - } - - // Account for the previous time level solution previously inserted at the back of ext. - if(rungeKutta) - u_ext += form->u_ext_offset; - - // Actual form-specific calculation. - for (unsigned int i = 0; i < current_als_i->cnt; i++) - { - if(current_als_i->dof[i] < 0) - continue; - - if((!tra || surface_form) && current_als_i->dof[i] < 0) - continue; - if(std::abs(current_als_i->coef[i]) < Hermes::HermesSqrtEpsilon) - continue; - if(!sym) - { - for (unsigned int j = 0; j < current_als_j->cnt; j++) - { - if(current_als_j->dof[j] >= 0) - { - // Is this necessary, i.e. is there a coefficient smaller than Hermes::HermesSqrtEpsilon? - if(std::abs(current_als_j->coef[j]) < Hermes::HermesSqrtEpsilon) - continue; - - Func* u = base_fns[j]; - Func* v = test_fns[i]; - - if(surface_form) - local_stiffness_matrix[i][j] = 0.5 * block_scaling_coefficient * form->value(n_quadrature_points, jacobian_x_weights, u_ext, u, v, geometry, local_ext) * form->scaling_factor * current_als_j->coef[j] * current_als_i->coef[i]; - else - local_stiffness_matrix[i][j] = block_scaling_coefficient * form->value(n_quadrature_points, jacobian_x_weights, u_ext, u, v, geometry, local_ext) * form->scaling_factor * current_als_j->coef[j] * current_als_i->coef[i]; - } - } - } - // Symmetric block. - else - { - for (unsigned int j = 0; j < current_als_j->cnt; j++) - { - if(j < i && current_als_j->dof[j] >= 0) - continue; - if(current_als_j->dof[j] >= 0) - { - // Is this necessary, i.e. is there a coefficient smaller than Hermes::HermesSqrtEpsilon? - if(std::abs(current_als_j->coef[j]) < Hermes::HermesSqrtEpsilon) - continue; - - Func* u = base_fns[j]; - Func* v = test_fns[i]; - - Scalar val = block_scaling_coefficient * form->value(n_quadrature_points, jacobian_x_weights, u_ext, u, v, geometry, local_ext) * form->scaling_factor * current_als_j->coef[j] * current_als_i->coef[i]; - - local_stiffness_matrix[i][j] = local_stiffness_matrix[j][i] = val; - } - } - } - } - - // Insert the local stiffness matrix into the global one. - current_mat->add(current_als_i->cnt, current_als_j->cnt, local_stiffness_matrix, current_als_i->dof, current_als_j->dof); - - // Insert also the off-diagonal (anti-)symmetric block, if required. - if(tra) - { - if(form->sym < 0) - chsgn(local_stiffness_matrix, current_als_i->cnt, current_als_j->cnt); - transpose(local_stiffness_matrix, current_als_i->cnt, current_als_j->cnt); - - current_mat->add(current_als_j->cnt, current_als_i->cnt, local_stiffness_matrix, current_als_j->dof, current_als_i->dof); - } - - if(form->ext.size() > 0) - { - for(int ext_i = 0; ext_i < form->ext.size(); ext_i++) - if(form->ext[ext_i]) - { - local_ext[ext_i]->free_fn(); - delete local_ext[ext_i]; - } - free_with_check(local_ext); - } - - if(rungeKutta) - u_ext -= form->u_ext_offset; - - // Cleanup. - free_with_check(local_stiffness_matrix); - } - - template - void DiscreteProblemFormAssembler::assemble_vector_form(VectorForm* form, int order, Func** test_fns, Func** ext, Func** u_ext, - AsmList* current_als_i, Traverse::State* current_state, int n_quadrature_points, Geom* geometry, double* jacobian_x_weights) - { - bool surface_form = (dynamic_cast*>(form) == nullptr); - - Func** local_ext = ext; - - // If the user supplied custom ext functions for this form. - if(form->ext.size() > 0) - { - int local_ext_count = form->ext.size(); - local_ext = malloc_with_check(local_ext_count, this); - for(int ext_i = 0; ext_i < local_ext_count; ext_i++) - if(form->ext[ext_i]) - local_ext[ext_i] = init_fn(form->ext[ext_i].get(), order); - else - local_ext[ext_i] = nullptr; - } - - // Account for the previous time level solution previously inserted at the back of ext. - if(rungeKutta) - u_ext += form->u_ext_offset; - - // Actual form-specific calculation. - for (unsigned int i = 0; i < current_als_i->cnt; i++) - { - if(current_als_i->dof[i] < 0) - continue; - - // Is this necessary, i.e. is there a coefficient smaller than Hermes::HermesSqrtEpsilon? - if(std::abs(current_als_i->coef[i]) < Hermes::HermesSqrtEpsilon) - continue; - - Func* v = test_fns[i]; - - Scalar val; - if(surface_form) - val = 0.5 * form->value(n_quadrature_points, jacobian_x_weights, u_ext, v, geometry, local_ext) * form->scaling_factor * current_als_i->coef[i]; - else - val = form->value(n_quadrature_points, jacobian_x_weights, u_ext, v, geometry, local_ext) * form->scaling_factor * current_als_i->coef[i]; - - current_rhs->add(current_als_i->dof[i], val); - } - - if(form->ext.size() > 0) - { - for(int ext_i = 0; ext_i < form->ext.size(); ext_i++) - if(form->ext[ext_i]) - { - local_ext[ext_i]->free_fn(); - delete local_ext[ext_i]; - } - free_with_check(local_ext); - } - - if(rungeKutta) - u_ext -= form->u_ext_offset; - } - - template class HERMES_API DiscreteProblemFormAssembler; - template class HERMES_API DiscreteProblemFormAssembler >; - } -} \ No newline at end of file diff --git a/hermes2d/src/discrete_problem/discrete_problem_helpers.cpp b/hermes2d/src/discrete_problem/discrete_problem_helpers.cpp index 21db47c0f5..1e3df790d0 100644 --- a/hermes2d/src/discrete_problem/discrete_problem_helpers.cpp +++ b/hermes2d/src/discrete_problem/discrete_problem_helpers.cpp @@ -25,7 +25,6 @@ namespace Hermes template DiscreteProblemRungeKutta::DiscreteProblemRungeKutta() : rungeKutta(false), RK_original_spaces_count(0), force_diagonal_blocks(false), block_weights(nullptr) { - } template @@ -54,12 +53,12 @@ namespace Hermes } template - DiscreteProblemWeakForm::DiscreteProblemWeakForm(WeakForm* wf_) : wf(wf_) + DiscreteProblemWeakForm::DiscreteProblemWeakForm(WeakFormSharedPtr wf_) : wf(wf_) { } template - void DiscreteProblemWeakForm::set_weak_formulation(WeakForm* wf_) + void DiscreteProblemWeakForm::set_weak_formulation(WeakFormSharedPtr wf_) { if (!wf_) throw Hermes::Exceptions::NullException(0); @@ -68,7 +67,7 @@ namespace Hermes } template - WeakForm* DiscreteProblemWeakForm::get_weak_formulation() const + WeakFormSharedPtr DiscreteProblemWeakForm::get_weak_formulation() const { return this->wf; } @@ -79,30 +78,31 @@ namespace Hermes } template - void DiscreteProblemMatrixVector::set_matrix(SparseMatrix* mat) + bool DiscreteProblemMatrixVector::set_matrix(SparseMatrix* mat) { this->current_mat = mat; + return true; } template - void DiscreteProblemMatrixVector::set_rhs(Vector* rhs) + bool DiscreteProblemMatrixVector::set_rhs(Vector* rhs) { this->current_rhs = rhs; + return true; } - template class HERMES_API DiscreteProblemRungeKutta; - template class HERMES_API DiscreteProblemRungeKutta >; + template class HERMES_API DiscreteProblemRungeKutta < double > ; + template class HERMES_API DiscreteProblemRungeKutta < std::complex > ; - template class HERMES_API DiscreteProblemWeakForm; - template class HERMES_API DiscreteProblemWeakForm >; + template class HERMES_API DiscreteProblemWeakForm < double > ; + template class HERMES_API DiscreteProblemWeakForm < std::complex > ; - template class HERMES_API DiscreteProblemMatrixVector; - template class HERMES_API DiscreteProblemMatrixVector >; + template class HERMES_API DiscreteProblemMatrixVector < double > ; + template class HERMES_API DiscreteProblemMatrixVector < std::complex > ; } - int init_geometry_points(RefMap** reference_mapping, int reference_mapping_count, int order, Geom*& geometry, double*& jacobian_x_weights) + unsigned char init_geometry_points_allocated(RefMap** reference_mapping, unsigned short reference_mapping_count, int order, GeomVol& geometry, double* jacobian_x_weights) { - Element* rep_element = nullptr; RefMap* rep_reference_mapping = nullptr; for (int i = 0; i < reference_mapping_count; i++) { @@ -110,60 +110,42 @@ namespace Hermes { if (reference_mapping[i]->get_active_element()) { - rep_element = reference_mapping[i]->get_active_element(); rep_reference_mapping = reference_mapping[i]; break; } } } - - double3* pt = rep_reference_mapping->get_quad_2d()->get_points(order, rep_element->get_mode()); - int np = rep_reference_mapping->get_quad_2d()->get_num_points(order, rep_element->get_mode()); - - // Init geometry and jacobian*weights. - geometry = init_geom_vol(rep_reference_mapping, order); - - jacobian_x_weights = new double[np]; - if (rep_reference_mapping->is_jacobian_const()) - { - double jac = rep_reference_mapping->get_const_jacobian(); - for (int i = 0; i < np; i++) - jacobian_x_weights[i] = pt[i][2] * jac; - } - else - { - double* jac = rep_reference_mapping->get_jacobian(order); - for (int i = 0; i < np; i++) - jacobian_x_weights[i] = pt[i][2] * jac[i]; - } - return np; + return init_geometry_points_allocated(rep_reference_mapping, order, geometry, jacobian_x_weights); } - int init_geometry_points_allocated_jwt(RefMap* rep_reference_mapping, int order, Geom*& geometry, double* jacobian_x_weights) + unsigned char init_geometry_points_allocated(RefMap* rep_reference_mapping, int order, GeomVol& geometry, double* jacobian_x_weights) { Element* e = rep_reference_mapping->get_active_element(); - double3* pt = rep_reference_mapping->get_quad_2d()->get_points(order, e->get_mode()); - int np = rep_reference_mapping->get_quad_2d()->get_num_points(order, e->get_mode()); + ElementMode2D mode = e->get_mode(); + Quad2D* quad = rep_reference_mapping->get_quad_2d(); + + double3* pt = quad->get_points(order, mode); + unsigned char np = quad->get_num_points(order, mode); // Init geometry and jacobian*weights. - geometry = init_geom_vol(rep_reference_mapping, order); + init_geom_vol_allocated(geometry, rep_reference_mapping, order); if (rep_reference_mapping->is_jacobian_const()) { double jac = rep_reference_mapping->get_const_jacobian(); - for (int i = 0; i < np; i++) + for (unsigned char i = 0; i < np; i++) jacobian_x_weights[i] = pt[i][2] * jac; } else { double* jac = rep_reference_mapping->get_jacobian(order); - for (int i = 0; i < np; i++) + for (unsigned char i = 0; i < np; i++) jacobian_x_weights[i] = pt[i][2] * jac[i]; } return np; } - int init_surface_geometry_points(RefMap** reference_mapping, int reference_mapping_count, int& order, int isurf, int marker, Geom*& geometry, double*& jacobian_x_weights) + unsigned char init_surface_geometry_points_allocated(RefMap** reference_mapping, unsigned short reference_mapping_count, int& order, unsigned char isurf, int marker, GeomSurf& geometry, double* jacobian_x_weights) { RefMap* rep_reference_mapping = nullptr; for (int i = 0; i < reference_mapping_count; i++) @@ -177,35 +159,26 @@ namespace Hermes } } } - - int eo = rep_reference_mapping->get_quad_2d()->get_edge_points(isurf, order, rep_reference_mapping->get_active_element()->get_mode()); - double3* pt = rep_reference_mapping->get_quad_2d()->get_points(eo, rep_reference_mapping->get_active_element()->get_mode()); - int np = rep_reference_mapping->get_quad_2d()->get_num_points(eo, rep_reference_mapping->get_active_element()->get_mode()); - - // Init geometry and jacobian*weights. - double3* tan; - geometry = init_geom_surf(rep_reference_mapping, isurf, marker, eo, tan); - jacobian_x_weights = new double[np]; - for (int i = 0; i < np; i++) - jacobian_x_weights[i] = pt[i][2] * tan[i][2]; - order = eo; - return np; + return init_surface_geometry_points_allocated(rep_reference_mapping, order, isurf, marker, geometry, jacobian_x_weights); } - int init_surface_geometry_points_allocated_jwt(RefMap* rep_reference_mapping, int& order, int isurf, int marker, Geom*& geometry, double* jacobian_x_weights) + unsigned char init_surface_geometry_points_allocated(RefMap* rep_reference_mapping, int& order, unsigned char isurf, int marker, GeomSurf& geometry, double* jacobian_x_weights) { Element* e = rep_reference_mapping->get_active_element(); - int eo = rep_reference_mapping->get_quad_2d()->get_edge_points(isurf, order, e->get_mode()); - double3* pt = rep_reference_mapping->get_quad_2d()->get_points(eo, e->get_mode()); - int np = rep_reference_mapping->get_quad_2d()->get_num_points(eo, e->get_mode()); + ElementMode2D mode = e->get_mode(); + Quad2D* quad = rep_reference_mapping->get_quad_2d(); + + int eo = quad->get_edge_points(isurf, order, mode); + double3* pt = quad->get_points(eo, mode); + unsigned char np = quad->get_num_points(eo, mode); // Init geometry and jacobian*weights. double3* tan; - geometry = init_geom_surf(rep_reference_mapping, isurf, marker, eo, tan); - for (int i = 0; i < np; i++) + init_geom_surf_allocated(geometry, rep_reference_mapping, isurf, marker, eo, tan); + for (unsigned char i = 0; i < np; i++) jacobian_x_weights[i] = pt[i][2] * tan[i][2]; order = eo; return np; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/discrete_problem/discrete_problem_integration_order_calculator.cpp b/hermes2d/src/discrete_problem/discrete_problem_integration_order_calculator.cpp index 21409214ec..5ba5e0fc19 100644 --- a/hermes2d/src/discrete_problem/discrete_problem_integration_order_calculator.cpp +++ b/hermes2d/src/discrete_problem/discrete_problem_integration_order_calculator.cpp @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with Hermes2D. If not, see . -#include "discrete_problem.h" +#include "discrete_problem/discrete_problem.h" #include "discrete_problem/dg/discrete_problem_dg_assembler.h" #include "function/exact_solution.h" #include "global.h" @@ -33,8 +33,44 @@ namespace Hermes { namespace Hermes2D { + /// Geometry instance for order calculation. + static GeomVol geom_order_vol; + static GeomSurf geom_order_surf; + static InterfaceGeom geom_order_interface; + /// "Fake" integration weight for order calculation. + double wt_order = 1.0; + + Func func_order[g_max_quad + 1] = + { + Func(0), + Func(1), + Func(2), + Func(3), + Func(4), + Func(5), + Func(6), + Func(7), + Func(8), + Func(9), + Func(10), + Func(11), + Func(12), + Func(13), + Func(14), + Func(15), + Func(16), + Func(17), + Func(18), + Func(19), + Func(20), + Func(21), + Func(22), + Func(23), + Func(24) + }; + template - DiscreteProblemIntegrationOrderCalculator::DiscreteProblemIntegrationOrderCalculator(DiscreteProblemSelectiveAssembler* selectiveAssembler) : + DiscreteProblemIntegrationOrderCalculator::DiscreteProblemIntegrationOrderCalculator(DiscreteProblemSelectiveAssembler* selectiveAssembler) : selectiveAssembler(selectiveAssembler), current_state(nullptr), u_ext(nullptr) @@ -42,7 +78,7 @@ namespace Hermes } template - int DiscreteProblemIntegrationOrderCalculator::calculate_order(const Hermes::vector >& spaces, RefMap** current_refmaps, WeakForm* current_wf) + int DiscreteProblemIntegrationOrderCalculator::calculate_order(const std::vector >& spaces, RefMap** current_refmaps, WeakFormSharedPtr current_wf) { // Order set to constant. if (current_wf->global_integration_order_set) @@ -56,23 +92,23 @@ namespace Hermes // init - ext Func** ext_func = this->init_ext_orders(current_wf->ext, current_wf->u_ext_fn, u_ext_func); - for (int current_mfvol_i = 0; current_mfvol_i < current_wf->mfvol.size(); current_mfvol_i++) + for (unsigned short current_mfvol_i = 0; current_mfvol_i < current_wf->mfvol.size(); current_mfvol_i++) { MatrixFormVol* current_mfvol = current_wf->mfvol[current_mfvol_i]; if (!selectiveAssembler->form_to_be_assembled(current_mfvol, current_state)) continue; - current_mfvol->wf = current_wf; + current_mfvol->wf = current_wf.get(); int orderTemp = calc_order_matrix_form(spaces, current_mfvol, current_refmaps, ext_func, u_ext_func); if (order < orderTemp) order = orderTemp; } - for (int current_vfvol_i = 0; current_vfvol_i < current_wf->vfvol.size(); current_vfvol_i++) + for (unsigned short current_vfvol_i = 0; current_vfvol_i < current_wf->vfvol.size(); current_vfvol_i++) { VectorFormVol* current_vfvol = current_wf->vfvol[current_vfvol_i]; if (!selectiveAssembler->form_to_be_assembled(current_vfvol, current_state)) continue; - current_vfvol->wf = current_wf; + current_vfvol->wf = current_wf.get(); int orderTemp = calc_order_vector_form(spaces, current_vfvol, current_refmaps, ext_func, u_ext_func); if (order < orderTemp) order = orderTemp; @@ -92,24 +128,24 @@ namespace Hermes // init - ext Func** ext_funcSurf = this->init_ext_orders(current_wf->ext, current_wf->u_ext_fn, u_ext_func); - for (int current_mfsurf_i = 0; current_mfsurf_i < current_wf->mfsurf.size(); current_mfsurf_i++) + for (unsigned short current_mfsurf_i = 0; current_mfsurf_i < current_wf->mfsurf.size(); current_mfsurf_i++) { MatrixFormSurf* current_mfsurf = current_wf->mfsurf[current_mfsurf_i]; if (!selectiveAssembler->form_to_be_assembled(current_mfsurf, current_state)) continue; - current_mfsurf->wf = current_wf; + current_mfsurf->wf = current_wf.get(); int orderTemp = calc_order_matrix_form(spaces, current_mfsurf, current_refmaps, ext_funcSurf, u_ext_funcSurf); if (order < orderTemp) order = orderTemp; } - for (int current_vfsurf_i = 0; current_vfsurf_i < current_wf->vfsurf.size(); current_vfsurf_i++) + for (unsigned short current_vfsurf_i = 0; current_vfsurf_i < current_wf->vfsurf.size(); current_vfsurf_i++) { VectorFormSurf* current_vfsurf = current_wf->vfsurf[current_vfsurf_i]; if (!selectiveAssembler->form_to_be_assembled(current_vfsurf, current_state)) continue; - current_vfsurf->wf = current_wf; + current_vfsurf->wf = current_wf.get(); int orderTemp = calc_order_vector_form(spaces, current_vfsurf, current_refmaps, ext_funcSurf, u_ext_funcSurf); if (order < orderTemp) order = orderTemp; @@ -119,7 +155,7 @@ namespace Hermes this->deinit_u_ext_orders(u_ext_funcSurf); // deinit - ext - this->deinit_ext_orders(current_wf->ext, current_wf->u_ext_fn, ext_funcSurf); + this->deinit_ext_orders(ext_funcSurf); } } @@ -127,13 +163,14 @@ namespace Hermes this->deinit_u_ext_orders(u_ext_func); // deinit - ext - this->deinit_ext_orders(current_wf->ext, current_wf->u_ext_fn, ext_func); + this->deinit_ext_orders(ext_func); return order; } template - int DiscreteProblemIntegrationOrderCalculator::calc_order_matrix_form(const Hermes::vector >& spaces, MatrixForm *form, RefMap** current_refmaps, Func** ext, Func** u_ext) + template + int DiscreteProblemIntegrationOrderCalculator::calc_order_matrix_form(const std::vector >& spaces, MatrixFormType *form, RefMap** current_refmaps, Func** ext, Func** u_ext) { int order; @@ -164,29 +201,28 @@ namespace Hermes max_order_j = eo; } - Func* ou = init_fn_ord(max_order_j + (spaces[form->j]->get_shapeset()->get_num_components() > 1 ? 1 : 0)); - Func* ov = init_fn_ord(max_order_i + (spaces[form->i]->get_shapeset()->get_num_components() > 1 ? 1 : 0)); + Func* ou = &func_order[max_order_j + (spaces[form->j]->shapeset->num_components > 1 ? 1 : 0)]; + Func* ov = &func_order[max_order_i + (spaces[form->i]->shapeset->num_components > 1 ? 1 : 0)]; // Total order of the vector form. - double fake_wt = 1.0; - Geom *tmp = init_geom_ord(); - Hermes::Ord o = form->ord(1, &fake_wt, u_ext, ou, ov, tmp, local_ext); - delete tmp; + Hermes::Ord o; + if (dynamic_cast*>(form)) + o = (dynamic_cast*>(form))->ord(1, &wt_order, u_ext, ou, ov, &geom_order_vol, local_ext); + else + o = (dynamic_cast*>(form))->ord(1, &wt_order, u_ext, ou, ov, &geom_order_surf, local_ext); adjust_order_to_refmaps(form, order, &o, current_refmaps); // Cleanup. if (form->ext.size() > 0) - this->deinit_ext_orders(form->ext, (form->u_ext_fn.size() > 0 ? form->u_ext_fn : form->wf->u_ext_fn), local_ext); - - delete ou; - delete ov; + this->deinit_ext_orders(local_ext); return order; } template - int DiscreteProblemIntegrationOrderCalculator::calc_order_vector_form(const Hermes::vector >& spaces, VectorForm *form, RefMap** current_refmaps, Func** ext, Func** u_ext) + template + int DiscreteProblemIntegrationOrderCalculator::calc_order_vector_form(const std::vector >& spaces, VectorFormType *form, RefMap** current_refmaps, Func** ext, Func** u_ext) { int order; @@ -208,21 +244,20 @@ namespace Hermes if (eo > max_order_i) max_order_i = eo; } - Func* ov = init_fn_ord(max_order_i + (spaces[form->i]->get_shapeset()->get_num_components() > 1 ? 1 : 0)); + Func* ov = &func_order[max_order_i + (spaces[form->i]->shapeset->num_components > 1 ? 1 : 0)]; // Total order of the vector form. - double fake_wt = 1.0; - Geom *tmp = init_geom_ord(); - Hermes::Ord o = form->ord(1, &fake_wt, u_ext, ov, tmp, local_ext); - delete tmp; + Hermes::Ord o; + if (dynamic_cast*>(form)) + o = (dynamic_cast*>(form))->ord(1, &wt_order, u_ext, ov, &geom_order_vol, local_ext); + else + o = (dynamic_cast*>(form))->ord(1, &wt_order, u_ext, ov, &geom_order_surf, local_ext); adjust_order_to_refmaps(form, order, &o, current_refmaps); // Cleanup. if (form->ext.size() > 0) - this->deinit_ext_orders(form->ext, (form->u_ext_fn.size() > 0 ? form->u_ext_fn : form->wf->u_ext_fn), local_ext); - - delete ov; + this->deinit_ext_orders(local_ext); return order; } @@ -243,12 +278,12 @@ namespace Hermes if (this->u_ext[i]->get_active_element()) { if (surface_form) - u_ext_func[i] = init_fn_ord(this->u_ext[i]->get_edge_fn_order(this->current_state->isurf) + (this->u_ext[i]->get_num_components() > 1 ? 1 : 0)); + u_ext_func[i] = &func_order[this->u_ext[i]->get_edge_fn_order(this->current_state->isurf) + (this->u_ext[i]->get_num_components() > 1 ? 1 : 0)]; else - u_ext_func[i] = init_fn_ord(this->u_ext[i]->get_fn_order() + (this->u_ext[i]->get_num_components() > 1 ? 1 : 0)); + u_ext_func[i] = &func_order[this->u_ext[i]->get_fn_order() + (this->u_ext[i]->get_num_components() > 1 ? 1 : 0)]; } else - u_ext_func[i] = init_fn_ord(0); + u_ext_func[i] = &func_order[0]; } } @@ -258,19 +293,11 @@ namespace Hermes template void DiscreteProblemIntegrationOrderCalculator::deinit_u_ext_orders(Func** u_ext_func) { - if (u_ext_func) - { - for (int i = 0; i < this->selectiveAssembler->spaces_size; i++) - { - if (u_ext_func[i]) - delete u_ext_func[i]; - } - delete[] u_ext_func; - } + free_with_check(u_ext_func); } template - Func** DiscreteProblemIntegrationOrderCalculator::init_ext_orders(Hermes::vector >& ext, Hermes::vector >& u_ext_fns, Func** u_ext_func) + Func** DiscreteProblemIntegrationOrderCalculator::init_ext_orders(std::vector >& ext, std::vector >& u_ext_fns, Func** u_ext_func) { int ext_size = ext.size(); int u_ext_fns_size = u_ext_fns.size(); @@ -281,17 +308,17 @@ namespace Hermes if (ext_size > 0 || u_ext_fns_size > 0) { - ext_func = new Func*[ext_size + u_ext_fns_size]; - for (int ext_i = 0; ext_i < ext.size(); ext_i++) + ext_func = malloc_with_check*>(ext_size + u_ext_fns_size); + for (unsigned short ext_i = 0; ext_i < ext.size(); ext_i++) { if (ext[ext_i]) { if (ext[ext_i]->get_active_element()) { if (surface_form) - ext_func[u_ext_fns_size + ext_i] = init_fn_ord(ext[ext_i]->get_edge_fn_order(this->current_state->isurf) + (ext[ext_i]->get_num_components() > 1 ? 1 : 0)); + ext_func[u_ext_fns_size + ext_i] = &func_order[ext[ext_i]->get_edge_fn_order(this->current_state->isurf) + (ext[ext_i]->get_num_components() > 1 ? 1 : 0)]; else - ext_func[u_ext_fns_size + ext_i] = init_fn_ord(ext[ext_i]->get_fn_order() + (ext[ext_i]->get_num_components() > 1 ? 1 : 0)); + ext_func[u_ext_fns_size + ext_i] = &func_order[ext[ext_i]->get_fn_order() + (ext[ext_i]->get_num_components() > 1 ? 1 : 0)]; } else ext_func[u_ext_fns_size + ext_i] = nullptr; @@ -299,12 +326,12 @@ namespace Hermes else ext_func[u_ext_fns_size + ext_i] = nullptr; } - + for (int ext_i = 0; ext_i < u_ext_fns_size; ext_i++) { if (u_ext_fns[ext_i]) { - ext_func[ext_i] = init_fn_ord(0); + ext_func[ext_i] = &func_order[0]; u_ext_fns[ext_i]->ord(ext_func + u_ext_fns_size, u_ext_func, ext_func[ext_i]); } else @@ -316,21 +343,9 @@ namespace Hermes } template - void DiscreteProblemIntegrationOrderCalculator::deinit_ext_orders(Hermes::vector >& ext, Hermes::vector >& u_ext_fns, Func** ext_func) + void DiscreteProblemIntegrationOrderCalculator::deinit_ext_orders(Func** ext_func) { - if (ext_func) - { - for (int ext_i = 0; ext_i < u_ext_fns.size(); ext_i++) - delete ext_func[ext_i]; - - for (int ext_i = 0; ext_i < ext.size(); ext_i++) - { - if (ext[ext_i] && ext[ext_i]->get_active_element()) - delete ext_func[u_ext_fns.size() + ext_i]; - } - - delete[] ext_func; - } + free_with_check(ext_func); } template @@ -349,11 +364,11 @@ namespace Hermes int inc = (fu->get_num_components() == 2) ? 1 : 0; int central_order = fu->get_edge_fn_order(ns->active_edge) + inc; int neighbor_order = fu->get_edge_fn_order(ns->neighbor_edge.local_num_of_edge) + inc; - return new DiscontinuousFunc(init_fn_ord(central_order), init_fn_ord(neighbor_order)); + return new DiscontinuousFunc(&func_order[central_order], &func_order[neighbor_order]); } template - DiscontinuousFunc** DiscreteProblemIntegrationOrderCalculator::init_ext_fns_ord(Hermes::vector > &ext, + DiscontinuousFunc** DiscreteProblemIntegrationOrderCalculator::init_ext_fns_ord(std::vector > &ext, NeighborSearch** neighbor_searches) { DiscontinuousFunc** fake_ext_fns = new DiscontinuousFunc*[ext.size()]; @@ -368,6 +383,7 @@ namespace Hermes void DiscreteProblemIntegrationOrderCalculator::deinit_ext_fns_ord(Form *form, FormType** oi, FormType** oext) { unsigned int prev_size = oi ? (this->rungeKutta ? this->RK_original_spaces_count : form->wf->get_neq() - form->u_ext_offset) : 0; + if (oi) { for (int i = 0; i < prev_size; i++) @@ -386,11 +402,11 @@ namespace Hermes } template - int DiscreteProblemIntegrationOrderCalculator::calc_order_dg_matrix_form(const Hermes::vector >& spaces, Traverse::State* current_state, MatrixFormDG* mfDG, RefMap** current_refmaps, Solution** current_u_ext, bool neighbor_supp_u, bool neighbor_supp_v, NeighborSearch** neighbor_searches) + int DiscreteProblemIntegrationOrderCalculator::calc_order_dg_matrix_form(const std::vector > spaces, Traverse::State* current_state, MatrixFormDG* mfDG, RefMap** current_refmaps, Solution** current_u_ext, bool neighbor_supp_u, bool neighbor_supp_v, NeighborSearch** neighbor_searches) { NeighborSearch* nbs_u = neighbor_searches[mfDG->j]; - unsigned int prev_size = this->rungeKutta ? this->RK_original_spaces_count : mfDG->wf->get_neq() - mfDG->u_ext_offset; + unsigned short prev_size = this->rungeKutta ? this->RK_original_spaces_count : mfDG->wf->get_neq() - mfDG->u_ext_offset; // Order to return. int order = 0; @@ -398,15 +414,15 @@ namespace Hermes DiscontinuousFunc** u_ext_ord = current_u_ext == nullptr ? nullptr : new DiscontinuousFunc*[this->rungeKutta ? this->RK_original_spaces_count : mfDG->wf->get_neq() - mfDG->u_ext_offset]; if (current_u_ext) - for (int i = 0; i < prev_size; i++) - if (current_u_ext[i + mfDG->u_ext_offset]) - u_ext_ord[i] = init_ext_fn_ord(nbs_u, current_u_ext[i + mfDG->u_ext_offset]); - else - u_ext_ord[i] = new DiscontinuousFunc(init_fn_ord(0), false, false); + for (unsigned short i = 0; i < prev_size; i++) + if (current_u_ext[i + mfDG->u_ext_offset]) + u_ext_ord[i] = init_ext_fn_ord(nbs_u, current_u_ext[i + mfDG->u_ext_offset]); + else + u_ext_ord[i] = new DiscontinuousFunc(&func_order[0], false, false); // Order of additional external functions. DiscontinuousFunc** ext_ord = nullptr; - Hermes::vector > ext_ord_fns = mfDG->ext.size() ? mfDG->ext.size() : mfDG->wf->ext.size(); + std::vector > ext_ord_fns = mfDG->ext.size() ? mfDG->ext : mfDG->wf->ext; if (ext_ord_fns.size() > 0) ext_ord = init_ext_fns_ord(ext_ord_fns, neighbor_searches); @@ -423,16 +439,13 @@ namespace Hermes max_order_j = H2D_GET_H_ORDER(max_order_j); // Order of shape functions. - DiscontinuousFunc* ou = new DiscontinuousFunc(init_fn_ord(max_order_j), neighbor_supp_u); - DiscontinuousFunc* ov = new DiscontinuousFunc(init_fn_ord(max_order_i), neighbor_supp_v); + DiscontinuousFunc* ou = new DiscontinuousFunc(&func_order[max_order_j], neighbor_supp_u); + DiscontinuousFunc* ov = new DiscontinuousFunc(&func_order[max_order_i], neighbor_supp_v); // Order of geometric attributes (eg. for multiplication of a solution with coordinates, normals, etc.). - Geom *tmp = init_geom_ord(); - double fake_wt = 1.0; // Total order of the matrix form. - Ord o = mfDG->ord(1, &fake_wt, u_ext_ord, ou, ov, tmp, ext_ord); - delete tmp; + Ord o = mfDG->ord(1, &wt_order, u_ext_ord, ou, ov, &geom_order_interface, ext_ord); adjust_order_to_refmaps(mfDG, order, &o, current_refmaps); @@ -446,11 +459,11 @@ namespace Hermes } template - int DiscreteProblemIntegrationOrderCalculator::calc_order_dg_vector_form(const Hermes::vector >& spaces, Traverse::State* current_state, VectorFormDG* vfDG, RefMap** current_refmaps, Solution** current_u_ext, bool neighbor_supp_v, NeighborSearch** neighbor_searches) + int DiscreteProblemIntegrationOrderCalculator::calc_order_dg_vector_form(const std::vector > spaces, Traverse::State* current_state, VectorFormDG* vfDG, RefMap** current_refmaps, Solution** current_u_ext, bool neighbor_supp_v, NeighborSearch** neighbor_searches) { NeighborSearch* nbs_u = neighbor_searches[vfDG->i]; - unsigned int prev_size = this->rungeKutta ? this->RK_original_spaces_count : vfDG->wf->get_neq() - vfDG->u_ext_offset; + unsigned short prev_size = this->rungeKutta ? this->RK_original_spaces_count : vfDG->wf->get_neq() - vfDG->u_ext_offset; // Order to return. int order = 0; @@ -458,15 +471,15 @@ namespace Hermes DiscontinuousFunc** u_ext_ord = current_u_ext == nullptr ? nullptr : new DiscontinuousFunc*[this->rungeKutta ? this->RK_original_spaces_count : vfDG->wf->get_neq() - vfDG->u_ext_offset]; if (current_u_ext) - for (int i = 0; i < prev_size; i++) - if (current_u_ext[i + vfDG->u_ext_offset]) - u_ext_ord[i] = init_ext_fn_ord(nbs_u, current_u_ext[i + vfDG->u_ext_offset]); - else - u_ext_ord[i] = new DiscontinuousFunc(init_fn_ord(0), false, false); + for (unsigned short i = 0; i < prev_size; i++) + if (current_u_ext[i + vfDG->u_ext_offset]) + u_ext_ord[i] = init_ext_fn_ord(nbs_u, current_u_ext[i + vfDG->u_ext_offset]); + else + u_ext_ord[i] = new DiscontinuousFunc(&func_order[0], false, false); // Order of additional external functions. DiscontinuousFunc** ext_ord = nullptr; - Hermes::vector > ext_ord_fns = vfDG->ext.size() ? vfDG->ext.size() : vfDG->wf->ext.size(); + std::vector > ext_ord_fns = vfDG->ext.size() ? vfDG->ext : vfDG->wf->ext; if (ext_ord_fns.size() > 0) ext_ord = init_ext_fns_ord(ext_ord_fns, neighbor_searches); @@ -478,16 +491,10 @@ namespace Hermes max_order_i = H2D_GET_H_ORDER(max_order_i); // Order of shape functions. - DiscontinuousFunc* ov = new DiscontinuousFunc(init_fn_ord(max_order_i), neighbor_supp_v); - - // Order of geometric attributes (eg. for multiplication of a solution with coordinates, normals, etc.). - Geom *tmp = init_geom_ord(); - double fake_wt = 1.0; + DiscontinuousFunc* ov = new DiscontinuousFunc(&func_order[max_order_i], neighbor_supp_v); // Total order of the matrix form. - Ord o = vfDG->ord(1, &fake_wt, u_ext_ord, ov, tmp, ext_ord); - - delete tmp; + Ord o = vfDG->ord(1, &wt_order, u_ext_ord, ov, &geom_order_interface, ext_ord); adjust_order_to_refmaps(vfDG, order, &o, current_refmaps); @@ -498,7 +505,7 @@ namespace Hermes return order; } - template class HERMES_API DiscreteProblemIntegrationOrderCalculator; - template class HERMES_API DiscreteProblemIntegrationOrderCalculator >; + template class HERMES_API DiscreteProblemIntegrationOrderCalculator < double > ; + template class HERMES_API DiscreteProblemIntegrationOrderCalculator < std::complex > ; } -} \ No newline at end of file +} diff --git a/hermes2d/src/discrete_problem/discrete_problem_selective_assembler.cpp b/hermes2d/src/discrete_problem/discrete_problem_selective_assembler.cpp index fb11b86403..cf2c9a97f9 100644 --- a/hermes2d/src/discrete_problem/discrete_problem_selective_assembler.cpp +++ b/hermes2d/src/discrete_problem/discrete_problem_selective_assembler.cpp @@ -20,13 +20,14 @@ namespace Hermes { namespace Hermes2D { - template DiscreteProblemSelectiveAssembler::DiscreteProblemSelectiveAssembler() : sp_seq(nullptr), spaces_size(0), matrix_structure_reusable(false), - vector_structure_reusable(false) + previous_mat(nullptr), + vector_structure_reusable(false), + previous_rhs(nullptr) { } @@ -38,14 +39,14 @@ namespace Hermes } template - bool DiscreteProblemSelectiveAssembler::prepare_sparse_structure(SparseMatrix* mat, Vector* rhs, Hermes::vector >& spaces, Traverse::State**& states, int& num_states) + bool DiscreteProblemSelectiveAssembler::prepare_sparse_structure(SparseMatrix* mat, Vector* rhs, std::vector > spaces, Traverse::State**& states, unsigned int& num_states) { int ndof = Space::get_num_dofs(spaces); - if (matrix_structure_reusable && mat) + if (matrix_structure_reusable && mat && mat == this->previous_mat) mat->zero(); - if (vector_structure_reusable && rhs) + if (vector_structure_reusable && rhs && rhs == this->previous_rhs) { if (rhs->get_size() == 0) rhs->alloc(ndof); @@ -53,7 +54,7 @@ namespace Hermes rhs->zero(); } - if (!matrix_structure_reusable && mat) + if ((!matrix_structure_reusable || (mat != this->previous_mat)) && mat) { // Spaces have changed: create the matrix from scratch. matrix_structure_reusable = true; @@ -61,19 +62,23 @@ namespace Hermes mat->prealloc(ndof); AsmList* al = malloc_with_check >(spaces_size); + int* dofs_m, *dofs_n; + unsigned int cnts_m, cnts_n; bool **blocks = this->wf->get_blocks(this->force_diagonal_blocks); // Loop through all elements. - for (int state_i = 0; state_i < num_states; state_i++) + this->tick(); + for (unsigned int state_i = 0; state_i < num_states; state_i++) { Traverse::State* current_state = states[state_i]; // Obtain assembly lists for the element at all spaces. /// \todo do not get the assembly list again if the element was not changed. for (unsigned int i = 0; i < spaces_size; i++) - if (current_state->e[i]) - spaces[i]->get_element_assembly_list(current_state->e[i], &(al[i])); - + { + if (current_state->e[i]) + spaces[i]->get_element_assembly_list(current_state->e[i], &(al[i])); + } if (this->wf->is_DG() && !this->wf->mfDG.empty()) { // Number of edges ( = number of vertices). @@ -100,7 +105,7 @@ namespace Hermes continue; ns.set_active_edge(ed); - const Hermes::vector *neighbors = ns.get_neighbors(); + const std::vector *neighbors = ns.get_neighbors(); neighbor_elems_counts[el][ed] = ns.get_num_neighbors(); neighbor_elems_arrays[el][ed] = new Element *[neighbor_elems_counts[el][ed]]; @@ -124,7 +129,7 @@ namespace Hermes if ((blocks[m][el] || blocks[el][m]) && current_state->e[m]) { AsmList*am = &(al[m]); - AsmList*an = new AsmList; + AsmList*an = new AsmList < Scalar > ; spaces[el]->get_element_assembly_list(neighbor_elems_arrays[el][ed][neigh], an); // pretend assembling of the element stiffness matrix @@ -170,47 +175,77 @@ namespace Hermes } // Go through all equation-blocks of the local stiffness matrix. - for (unsigned int m = 0; m < spaces_size; m++) + if (spaces_size == 1) { - for (unsigned int n = 0; n < spaces_size; n++) + cnts_m = al[0].cnt; + dofs_m = al[0].dof; + if (blocks[0][0] && current_state->e[0]) { - if (blocks[m][n] && current_state->e[m] && current_state->e[n]) + for (unsigned int i = 0; i < cnts_m; i++) { - AsmList*am = &(al[m]); - AsmList*an = &(al[n]); - - // Pretend assembling of the element stiffness matrix. - for (unsigned int i = 0; i < am->cnt; i++) + if (dofs_m[i] >= 0) { - if (am->dof[i] >= 0) - for (unsigned int j = 0; j < an->cnt; j++) - if (an->dof[j] >= 0) - mat->pre_add_ij(am->dof[i], an->dof[j]); + for (unsigned int j = 0; j < cnts_m; j++) + if (dofs_m[j] >= 0) + mat->pre_add_ij(dofs_m[i], dofs_m[j]); + } + } + } + } + else + { + for (unsigned int m = 0; m < spaces_size; m++) + { + cnts_m = al[m].cnt; + dofs_m = al[m].dof; + for (unsigned int n = 0; n < spaces_size; n++) + { + if (blocks[m][n] && current_state->e[m] && current_state->e[n]) + { + cnts_n = al[n].cnt; + dofs_n = al[n].dof; + + // Pretend assembling of the element stiffness matrix. + for (unsigned int i = 0; i < cnts_m; i++) + { + if (dofs_m[i] >= 0) + for (unsigned int j = 0; j < cnts_n; j++) + if (dofs_n[j] >= 0) + mat->pre_add_ij(dofs_m[i], dofs_n[j]); + } } } } } } + this->tick(); + this->info("\tDiscreteProblemSelectiveAssembler: Loop: %s.", this->last_str().c_str()); + + this->tick(); free_with_check(al); free_with_check(blocks, true); - mat->alloc(); + + this->tick(); + this->info("\tDiscreteProblemSelectiveAssembler: Finish: %s.", this->last_str().c_str()); } // WARNING: unlike Matrix::alloc(), Vector::alloc(ndof) frees the memory occupied // by previous vector before allocating - if (!vector_structure_reusable && rhs) + if ((!vector_structure_reusable || (rhs != this->previous_rhs)) && rhs) { vector_structure_reusable = true; rhs->alloc(ndof); } + previous_mat = mat; + previous_rhs = rhs; return true; } template - void DiscreteProblemSelectiveAssembler::set_spaces(Hermes::vector >& spacesToSet) + void DiscreteProblemSelectiveAssembler::set_spaces(std::vector > spacesToSet) { if (!sp_seq) { @@ -236,7 +271,7 @@ namespace Hermes } template - void DiscreteProblemSelectiveAssembler::set_weak_formulation(WeakForm* wf_) + void DiscreteProblemSelectiveAssembler::set_weak_formulation(WeakFormSharedPtr wf_) { Mixins::DiscreteProblemWeakForm::set_weak_formulation(wf_); @@ -258,8 +293,8 @@ namespace Hermes // If a block scaling table is provided, and if the scaling coefficient // A_mn for this block is zero, then the form does not need to be assembled. if (this->block_weights) - if (fabs(this->block_weights->get_A(form->i / this->RK_original_spaces_count, form->j / this->RK_original_spaces_count)) < Hermes::HermesSqrtEpsilon) - return false; + if (fabs(this->block_weights->get_A(form->i / this->RK_original_spaces_count, form->j / this->RK_original_spaces_count)) < Hermes::HermesSqrtEpsilon) + return false; return true; } return false; @@ -276,8 +311,8 @@ namespace Hermes int this_marker = current_state->rep->marker; for (unsigned int ss = 0; ss < form->areas_internal.size(); ss++) - if (form->areas_internal[ss] == this_marker) - return true; + if (form->areas_internal[ss] == this_marker) + return true; return false; } @@ -296,8 +331,8 @@ namespace Hermes int this_marker = current_state->rep->en[current_state->isurf]->marker; for (unsigned int ss = 0; ss < form->areas_internal.size(); ss++) - if (form->areas_internal[ss] == this_marker) - return true; + if (form->areas_internal[ss] == this_marker) + return true; return false; } @@ -330,8 +365,8 @@ namespace Hermes int this_marker = current_state->rep->marker; for (unsigned int ss = 0; ss < form->areas_internal.size(); ss++) - if (form->areas_internal[ss] == this_marker) - return true; + if (form->areas_internal[ss] == this_marker) + return true; return false; } @@ -350,8 +385,8 @@ namespace Hermes int this_marker = current_state->rep->en[current_state->isurf]->marker; for (unsigned int ss = 0; ss < form->areas_internal.size(); ss++) - if (form->areas_internal[ss] == this_marker) - return true; + if (form->areas_internal[ss] == this_marker) + return true; return false; } @@ -362,7 +397,7 @@ namespace Hermes return form_to_be_assembled((VectorForm*)form, current_state); } - template class HERMES_API DiscreteProblemSelectiveAssembler; - template class HERMES_API DiscreteProblemSelectiveAssembler >; + template class HERMES_API DiscreteProblemSelectiveAssembler < double > ; + template class HERMES_API DiscreteProblemSelectiveAssembler < std::complex > ; } } \ No newline at end of file diff --git a/hermes2d/src/discrete_problem/discrete_problem_thread_assembler.cpp b/hermes2d/src/discrete_problem/discrete_problem_thread_assembler.cpp index b7df43d17e..f7067d6f12 100644 --- a/hermes2d/src/discrete_problem/discrete_problem_thread_assembler.cpp +++ b/hermes2d/src/discrete_problem/discrete_problem_thread_assembler.cpp @@ -25,48 +25,62 @@ namespace Hermes namespace Hermes2D { template - DiscreteProblemThreadAssembler::DiscreteProblemThreadAssembler(DiscreteProblemSelectiveAssembler* selectiveAssembler) : + DiscreteProblemThreadAssembler::DiscreteProblemThreadAssembler(DiscreteProblemSelectiveAssembler* selectiveAssembler, bool nonlinear) : pss(nullptr), refmaps(nullptr), u_ext(nullptr), selectiveAssembler(selectiveAssembler), integrationOrderCalculator(selectiveAssembler), - ext_funcs(nullptr), ext_funcs_allocated_size(0), ext_funcs_local(nullptr), ext_funcs_local_allocated_size(0) + ext_funcs(nullptr), ext_funcs_allocated_size(0), ext_funcs_local(nullptr), ext_funcs_local_allocated_size(0), + funcs_wf_initialized(false), funcs_space_initialized(false), spaces_size(0), nonlinear(nonlinear), reusable_DOFs(nullptr), reusable_Dirichlet(nullptr) { + // Init the memory pool - if PJLIB is linked, it will do the magic, if not, it will initialize the pointer to null. + this->init_funcs_memory_pool(); } template DiscreteProblemThreadAssembler::~DiscreteProblemThreadAssembler() { this->free(); +#ifdef WITH_PJLIB + pj_pool_release(this->FuncMemoryPool); +#endif } template - void DiscreteProblemThreadAssembler::init_spaces(const Hermes::vector >& spaces) + void DiscreteProblemThreadAssembler::init_spaces(const std::vector > spaces) { this->free_spaces(); + bool reinit_funcs = this->spaces_size != spaces.size(); this->spaces_size = spaces.size(); - pss = malloc_with_check(spaces_size); + if (reinit_funcs) + { + this->deinit_funcs_space(); + this->init_funcs_space(); + } + + pss = malloc_with_check(spaces_size); refmaps = malloc_with_check(spaces_size); for (unsigned int j = 0; j < spaces_size; j++) { - pss[j] = new PrecalcShapeset(spaces[j]->shapeset); + pss[j] = new PrecalcShapesetAssembling(spaces[j]->shapeset); refmaps[j] = new RefMap(); refmaps[j]->set_quad_2d(&g_quad_2d_std); } } template - void DiscreteProblemThreadAssembler::set_weak_formulation(WeakForm* wf_) + void DiscreteProblemThreadAssembler::set_weak_formulation(WeakFormSharedPtr wf_) { + this->deinit_funcs_wf(); this->free_weak_formulation(); - - this->wf = wf_->clone(); + this->wf = WeakFormSharedPtr(wf_->clone()); this->wf->cloneMembers(wf_); + this->init_funcs_wf(); } template - void DiscreteProblemThreadAssembler::init_u_ext(const Hermes::vector >& spaces, Solution** u_ext_sln) + void DiscreteProblemThreadAssembler::init_u_ext(const std::vector > spaces, Solution** u_ext_sln) { assert(this->spaces_size == spaces.size() && this->pss); @@ -93,13 +107,9 @@ namespace Hermes } template - void DiscreteProblemThreadAssembler::init_assembling(Solution** u_ext_sln, const Hermes::vector >& spaces, bool nonlinear_, bool add_dirichlet_lift_) + void DiscreteProblemThreadAssembler::init_assembling(Solution** u_ext_sln, const std::vector >& spaces, bool add_dirichlet_lift_) { - // Init the memory pool - if PJLIB is linked, it will do the magic, if not, it will initialize the pointer to null. - this->init_funcs_memory_pool(); - // Basic settings. - this->nonlinear = nonlinear_; this->add_dirichlet_lift = add_dirichlet_lift_; // Transformables setup. @@ -142,9 +152,6 @@ namespace Hermes // Process markers. this->wf->processFormMarkers(spaces); - - // Initialize Func storage. - this->init_funcs(); } template @@ -168,21 +175,29 @@ namespace Hermes } template - void DiscreteProblemThreadAssembler::init_funcs() + void DiscreteProblemThreadAssembler::init_funcs_space() { + this->funcs_space_initialized = true; + // Basis & test fns, u_ext funcs. - for (unsigned int space_i = 0; space_i < this->spaces_size; space_i++) + for (unsigned short space_i = 0; space_i < this->spaces_size; space_i++) { for (unsigned int j = 0; j < H2D_MAX_LOCAL_BASIS_SIZE; j++) this->funcs[space_i][j] = preallocate_fn(this->FuncMemoryPool); for (int edge_i = 0; edge_i < H2D_MAX_NUMBER_EDGES; edge_i++) - for (unsigned int j = 0; j < H2D_MAX_LOCAL_BASIS_SIZE; j++) - this->funcsSurface[edge_i][space_i][j] = preallocate_fn(this->FuncMemoryPool); + for (unsigned int j = 0; j < H2D_MAX_LOCAL_BASIS_SIZE; j++) + this->funcsSurface[edge_i][space_i][j] = preallocate_fn(this->FuncMemoryPool); if (this->nonlinear) this->u_ext_funcs[space_i] = preallocate_fn(this->FuncMemoryPool); } + } + + template + void DiscreteProblemThreadAssembler::init_funcs_wf() + { + this->funcs_wf_initialized = true; // Reallocation of wf-(nonlocal-) ext funcs. int ext_size = this->wf->ext.size(); @@ -205,9 +220,9 @@ namespace Hermes } // Calculating local sizes. - int local_ext_size = 0; - int local_u_ext_fns_size = 0; - for (int form_i = 0; form_i < this->wf->forms.size(); form_i++) + unsigned short local_ext_size = 0; + unsigned short local_u_ext_fns_size = 0; + for (unsigned short form_i = 0; form_i < this->wf->forms.size(); form_i++) { if (this->wf->forms[form_i]->ext.size() > local_ext_size) local_ext_size = this->wf->forms[form_i]->ext.size(); @@ -235,13 +250,14 @@ namespace Hermes } template - void DiscreteProblemThreadAssembler::deinit_funcs() + void DiscreteProblemThreadAssembler::deinit_funcs_space() { -#ifdef WITH_PJLIB - pj_pool_release(this->FuncMemoryPool); -#else + if (!funcs_space_initialized) + return; + else + funcs_space_initialized = false; - for (unsigned int space_i = 0; space_i < this->spaces_size; space_i++) + for (unsigned short space_i = 0; space_i < this->spaces_size; space_i++) { // Test functions for (unsigned int j = 0; j < H2D_MAX_LOCAL_BASIS_SIZE; j++) @@ -258,6 +274,15 @@ namespace Hermes if (this->nonlinear) delete this->u_ext_funcs[space_i]; } + } + + template + void DiscreteProblemThreadAssembler::deinit_funcs_wf() + { + if (!funcs_wf_initialized) + return; + else + funcs_wf_initialized = false; // Ext int ext_size = this->wf->ext.size(); @@ -272,9 +297,9 @@ namespace Hermes } // Ext - local - int local_ext_size = 0; - int local_u_ext_fns_size = 0; - for (int form_i = 0; form_i < this->wf->forms.size(); form_i++) + unsigned short local_ext_size = 0; + unsigned short local_u_ext_fns_size = 0; + for (unsigned short form_i = 0; form_i < this->wf->forms.size(); form_i++) { if (this->wf->forms[form_i]->ext.size() > local_ext_size) local_ext_size = this->wf->forms[form_i]->ext.size(); @@ -291,17 +316,23 @@ namespace Hermes for (int ext_i = 0; ext_i < local_ext_size; ext_i++) delete this->ext_funcs_local[local_u_ext_fns_size + ext_i]; } -#endif } template - void DiscreteProblemThreadAssembler::init_assembling_one_state(const Hermes::vector >& spaces, Traverse::State* current_state_) + void DiscreteProblemThreadAssembler::deinit_funcs() + { + this->deinit_funcs_wf(); + this->deinit_funcs_space(); + } + + template + void DiscreteProblemThreadAssembler::init_assembling_one_state(const std::vector >& spaces, Traverse::State* current_state_) { current_state = current_state_; this->integrationOrderCalculator.current_state = this->current_state; // Active elements. - for (int j = 0; j < fns.size(); j++) + for (unsigned short j = 0; j < fns.size(); j++) { if (current_state->e[j]) { @@ -348,7 +379,7 @@ namespace Hermes template void DiscreteProblemThreadAssembler::init_calculation_variables() { - for (unsigned int space_i = 0; space_i < this->spaces_size; space_i++) + for (unsigned short space_i = 0; space_i < this->spaces_size; space_i++) { if (current_state->e[space_i] == nullptr) continue; @@ -360,7 +391,7 @@ namespace Hermes } } - this->n_quadrature_points = init_geometry_points_allocated_jwt(this->rep_refmap, this->order, this->geometry, this->jacobian_x_weights); + this->n_quadrature_points = init_geometry_points_allocated(this->rep_refmap, this->order, this->geometry, this->jacobian_x_weights); if (current_state->isBnd && (this->wf->mfsurf.size() > 0 || this->wf->vfsurf.size() > 0)) { @@ -371,11 +402,11 @@ namespace Hermes if (!current_state->bnd[edge_i]) continue; - this->n_quadrature_pointsSurface[edge_i] = init_surface_geometry_points_allocated_jwt(this->rep_refmap, this->order, edge_i, current_state->rep->marker, this->geometrySurface[edge_i], this->jacobian_x_weightsSurface[edge_i]); + this->n_quadrature_pointsSurface[edge_i] = init_surface_geometry_points_allocated(this->rep_refmap, this->order, edge_i, current_state->rep->marker, this->geometrySurface[edge_i], this->jacobian_x_weightsSurface[edge_i]); this->orderSurface[edge_i] = this->order; this->order = order_local; - for (unsigned int space_i = 0; space_i < this->spaces_size; space_i++) + for (unsigned short space_i = 0; space_i < this->spaces_size; space_i++) { if (!current_state->e[space_i]) continue; @@ -393,20 +424,6 @@ namespace Hermes template void DiscreteProblemThreadAssembler::deinit_calculation_variables() { - this->geometry->free(); - delete this->geometry; - - if (current_state->isBnd && (this->wf->mfsurf.size() > 0 || this->wf->vfsurf.size() > 0)) - { - for (unsigned int edge_i = 0; edge_i < this->current_state->rep->nvert; edge_i++) - { - if (!current_state->bnd[edge_i]) - continue; - - this->geometrySurface[edge_i]->free(); - delete this->geometrySurface[edge_i]; - } - } } template @@ -423,7 +440,8 @@ namespace Hermes } template - void DiscreteProblemThreadAssembler::init_ext_values(Func** target_array, Hermes::vector >& ext, Hermes::vector >& u_ext_fns, int order, Func** u_ext_func, Geom* geometry) + template + void DiscreteProblemThreadAssembler::init_ext_values(Func** target_array, std::vector >& ext, std::vector >& u_ext_fns, int order, Func** u_ext_func, Geom* geometry) { int ext_size = ext.size(); int u_ext_fns_size = u_ext_fns.size(); @@ -438,17 +456,17 @@ namespace Hermes init_fn_preallocated(target_array[u_ext_fns_size + ext_i], ext[ext_i].get(), order); } } - + for (int ext_i = 0; ext_i < u_ext_fns_size; ext_i++) { if (u_ext_fns[ext_i]) - init_fn_preallocated(target_array[ext_i], u_ext_fns[ext_i].get(), target_array + u_ext_fns_size, u_ext_func, order, geometry, current_state->rep->get_mode()); + init_fn_preallocated(target_array[ext_i], u_ext_fns[ext_i].get(), target_array, u_ext_func, order, geometry, current_state->rep->get_mode()); } } if (this->rungeKutta) { - for (int ext_i = 0; ext_i < ext.size(); ext_i++) + for (unsigned short ext_i = 0; ext_i < ext.size(); ext_i++) u_ext_func[ext_i]->add(target_array[ext.size() - this->RK_original_spaces_count + ext_i]); } } @@ -460,11 +478,11 @@ namespace Hermes this->init_u_ext_values(this->order); // init - ext - this->init_ext_values(this->ext_funcs, this->wf->ext, this->wf->u_ext_fn, this->order, this->u_ext_funcs, this->geometry); + this->init_ext_values(this->ext_funcs, this->wf->ext, this->wf->u_ext_fn, this->order, this->u_ext_funcs, &this->geometry); if (this->current_mat || this->add_dirichlet_lift) { - for (int current_mfvol_i = 0; current_mfvol_i < this->wf->mfvol.size(); current_mfvol_i++) + for (unsigned short current_mfvol_i = 0; current_mfvol_i < this->wf->mfvol.size(); current_mfvol_i++) { if (!selectiveAssembler->form_to_be_assembled(this->wf->mfvol[current_mfvol_i], current_state)) continue; @@ -472,26 +490,26 @@ namespace Hermes int form_i = this->wf->mfvol[current_mfvol_i]->i; int form_j = this->wf->mfvol[current_mfvol_i]->j; - this->assemble_matrix_form(this->wf->mfvol[current_mfvol_i], order, funcs[form_j], funcs[form_i], &als[form_i], &als[form_j], n_quadrature_points, geometry, jacobian_x_weights); + this->assemble_matrix_form(this->wf->mfvol[current_mfvol_i], order, funcs[form_j], funcs[form_i], &als[form_i], &als[form_j], n_quadrature_points, &geometry, jacobian_x_weights); } } if (this->current_rhs) { - for (int current_vfvol_i = 0; current_vfvol_i < this->wf->vfvol.size(); current_vfvol_i++) + for (unsigned short current_vfvol_i = 0; current_vfvol_i < this->wf->vfvol.size(); current_vfvol_i++) { if (!selectiveAssembler->form_to_be_assembled(this->wf->vfvol[current_vfvol_i], current_state)) continue; int form_i = this->wf->vfvol[current_vfvol_i]->i; - this->assemble_vector_form(this->wf->vfvol[current_vfvol_i], order, funcs[form_i], &als[form_i], n_quadrature_points, geometry, jacobian_x_weights); + this->assemble_vector_form(this->wf->vfvol[current_vfvol_i], order, funcs[form_i], &als[form_i], n_quadrature_points, &geometry, jacobian_x_weights); } } // Assemble surface integrals now: loop through surfaces of the element. if (current_state->isBnd && (this->wf->mfsurf.size() > 0 || this->wf->vfsurf.size() > 0)) { - for (int isurf = 0; isurf < current_state->rep->nvert; isurf++) + for (unsigned char isurf = 0; isurf < current_state->rep->nvert; isurf++) { if (!current_state->bnd[isurf]) continue; @@ -505,11 +523,11 @@ namespace Hermes this->init_u_ext_values(this->orderSurface[isurf]); // init - ext - this->init_ext_values(this->ext_funcs, this->wf->ext, this->wf->u_ext_fn, this->orderSurface[isurf], this->u_ext_funcs, this->geometrySurface[isurf]); + this->init_ext_values(this->ext_funcs, this->wf->ext, this->wf->u_ext_fn, this->orderSurface[isurf], this->u_ext_funcs, &this->geometrySurface[isurf]); if (this->current_mat || this->add_dirichlet_lift) { - for (int current_mfsurf_i = 0; current_mfsurf_i < this->wf->mfsurf.size(); current_mfsurf_i++) + for (unsigned short current_mfsurf_i = 0; current_mfsurf_i < this->wf->mfsurf.size(); current_mfsurf_i++) { if (!selectiveAssembler->form_to_be_assembled(this->wf->mfsurf[current_mfsurf_i], current_state)) continue; @@ -518,13 +536,13 @@ namespace Hermes int form_j = this->wf->mfsurf[current_mfsurf_i]->j; this->assemble_matrix_form(this->wf->mfsurf[current_mfsurf_i], orderSurface[isurf], funcsSurface[isurf][form_j], funcsSurface[isurf][form_i], - &alsSurface[isurf][form_i], &alsSurface[isurf][form_j], n_quadrature_pointsSurface[isurf], geometrySurface[isurf], jacobian_x_weightsSurface[isurf]); + &alsSurface[isurf][form_i], &alsSurface[isurf][form_j], n_quadrature_pointsSurface[isurf], &geometrySurface[isurf], jacobian_x_weightsSurface[isurf]); } } if (this->current_rhs) { - for (int current_vfsurf_i = 0; current_vfsurf_i < this->wf->vfsurf.size(); current_vfsurf_i++) + for (unsigned short current_vfsurf_i = 0; current_vfsurf_i < this->wf->vfsurf.size(); current_vfsurf_i++) { if (!selectiveAssembler->form_to_be_assembled(this->wf->vfsurf[current_vfsurf_i], current_state)) continue; @@ -532,7 +550,7 @@ namespace Hermes int form_i = this->wf->vfsurf[current_vfsurf_i]->i; this->assemble_vector_form(this->wf->vfsurf[current_vfsurf_i], orderSurface[isurf], funcsSurface[isurf][form_i], &alsSurface[isurf][form_i], - n_quadrature_pointsSurface[isurf], geometrySurface[isurf], jacobian_x_weightsSurface[isurf]); + n_quadrature_pointsSurface[isurf], &geometrySurface[isurf], jacobian_x_weightsSurface[isurf]); } } } @@ -540,8 +558,9 @@ namespace Hermes } template - void DiscreteProblemThreadAssembler::assemble_matrix_form(MatrixForm* form, int order, Func** base_fns, Func** test_fns, - AsmList* current_als_i, AsmList* current_als_j, int n_quadrature_points, Geom* geometry, double* jacobian_x_weights) + template + void DiscreteProblemThreadAssembler::assemble_matrix_form(MatrixFormType* form, int order, Func** base_fns, Func** test_fns, + AsmList* current_als_i, AsmList* current_als_j, int n_quadrature_points, Geom* geometry, double* jacobian_x_weights) { bool surface_form = (dynamic_cast*>(form) == nullptr); @@ -574,6 +593,26 @@ namespace Hermes for (unsigned int j = 0; j < current_als_j->cnt; j++) { + if (current_als_j->dof[j] >= 0 && this->reusable_DOFs && *this->reusable_DOFs) + { + if ((*this->reusable_DOFs)[current_als_j->dof[j]] && (*this->reusable_DOFs)[current_als_i->dof[i]]) + { + unsigned short local_matrix_index_array = i * H2D_MAX_LOCAL_BASIS_SIZE + j; + local_stiffness_matrix[local_matrix_index_array] = 0.; + if (sym || tra) + { + unsigned short local_matrix_index_array_transposed = j * H2D_MAX_LOCAL_BASIS_SIZE + i; + local_stiffness_matrix[local_matrix_index_array_transposed] = 0.; + } + continue; + } + } + + if (current_als_j->dof[j] < 0 && this->reusable_Dirichlet && *this->reusable_Dirichlet && (*this->reusable_Dirichlet)[form->j]) + { + continue; + } + // Skip symmetric values that do not contribute to Dirichlet lift. if (sym && j < i && current_als_j->dof[j] >= 0) continue; @@ -582,7 +621,7 @@ namespace Hermes if (current_als_j->dof[j] >= 0 && !this->current_mat) continue; - if (std::abs(current_als_j->coef[j]) < Hermes::HermesSqrtEpsilon) + if (std::abs(current_als_j->coef[j]) < Hermes::HermesEpsilon) continue; Func* u = base_fns[j]; @@ -592,7 +631,7 @@ namespace Hermes if (current_als_j->dof[j] >= 0) { - int local_matrix_index_array = i * H2D_MAX_LOCAL_BASIS_SIZE + j; + unsigned short local_matrix_index_array = i * H2D_MAX_LOCAL_BASIS_SIZE + j; if (surface_form) local_stiffness_matrix[local_matrix_index_array] = 0.5 * val; @@ -601,13 +640,13 @@ namespace Hermes if (sym) { - int local_matrix_index_array_transposed = j * H2D_MAX_LOCAL_BASIS_SIZE + i; + unsigned short local_matrix_index_array_transposed = j * H2D_MAX_LOCAL_BASIS_SIZE + i; local_stiffness_matrix[local_matrix_index_array_transposed] = local_stiffness_matrix[local_matrix_index_array]; } } else if (this->add_dirichlet_lift && this->current_rhs) { - this->current_rhs->add(current_als_i->dof[i], -val); + this->dirichlet_lift_rhs->add(current_als_i->dof[i], -val); } } } @@ -637,7 +676,7 @@ namespace Hermes if (current_als_j->dof[i] >= 0) { int local_matrix_index_array = i * H2D_MAX_LOCAL_BASIS_SIZE + j; - this->current_rhs->add(current_als_j->dof[i], -local_stiffness_matrix[local_matrix_index_array]); + this->dirichlet_lift_rhs->add(current_als_j->dof[i], -local_stiffness_matrix[local_matrix_index_array]); } } } @@ -647,8 +686,9 @@ namespace Hermes } template - void DiscreteProblemThreadAssembler::assemble_vector_form(VectorForm* form, int order, Func** test_fns, - AsmList* current_als_i, int n_quadrature_points, Geom* geometry, double* jacobian_x_weights) + template + void DiscreteProblemThreadAssembler::assemble_vector_form(VectorFormType* form, int order, Func** test_fns, + AsmList* current_als_i, int n_quadrature_points, Geom* geometry, double* jacobian_x_weights) { bool surface_form = (dynamic_cast*>(form) == nullptr); @@ -671,6 +711,12 @@ namespace Hermes if (current_als_i->dof[i] < 0) continue; + if (this->reusable_DOFs && *this->reusable_DOFs) + { + if ((*this->reusable_DOFs)[current_als_i->dof[i]]) + continue; + } + // Is this necessary, i.e. is there a coefficient smaller than Hermes::HermesSqrtEpsilon? if (std::abs(current_als_i->coef[i]) < Hermes::HermesSqrtEpsilon) continue; @@ -696,12 +742,12 @@ namespace Hermes template void DiscreteProblemThreadAssembler::deinit_assembling() { - this->deinit_funcs(); } template void DiscreteProblemThreadAssembler::free() { + this->deinit_funcs(); this->free_spaces(); this->free_weak_formulation(); this->free_u_ext(); @@ -729,11 +775,7 @@ namespace Hermes void DiscreteProblemThreadAssembler::free_weak_formulation() { if (this->wf) - { this->wf->free_ext(); - delete this->wf; - this->wf = nullptr; - } } template @@ -747,7 +789,7 @@ namespace Hermes } } - template class HERMES_API DiscreteProblemThreadAssembler; - template class HERMES_API DiscreteProblemThreadAssembler >; + template class HERMES_API DiscreteProblemThreadAssembler < double > ; + template class HERMES_API DiscreteProblemThreadAssembler < std::complex > ; } -} \ No newline at end of file +} diff --git a/hermes2d/src/forms.cpp b/hermes2d/src/forms.cpp index 9045b381a9..de7b290ebb 100644 --- a/hermes2d/src/forms.cpp +++ b/hermes2d/src/forms.cpp @@ -39,6 +39,20 @@ namespace Hermes { } + Func::Func(const int order) : order(order) + { + Hermes::Ord d(order); + Hermes::Ord d1(order > 1 ? order - 1 : order); + + this->val = this->val0 = this->val1 = d; + this->dx = this->dy = this->curl = this->div = d1; + +#ifdef H2D_USE_SECOND_DERIVATIVES + Hermes::Ord d2(std::min(0, order - 2)); + this->laplace = d2; +#endif + } + void Func::subtract(Func* func) { if (this->np != func->np) @@ -178,70 +192,70 @@ namespace Hermes DiscontinuousFunc::DiscontinuousFunc(Func* fn, bool support_on_neighbor, bool reverse) : Func(fn->np, fn->nc), fn_central(nullptr), fn_neighbor(nullptr), reverse_neighbor_side(reverse) { - if (fn == nullptr) - throw Hermes::Exceptions::Exception("Invalid arguments to DiscontinuousFunc constructor."); - if (support_on_neighbor) + if (fn == nullptr) + throw Hermes::Exceptions::Exception("Invalid arguments to DiscontinuousFunc constructor."); + if (support_on_neighbor) + { + fn_neighbor = fn; + if (reverse_neighbor_side) { - fn_neighbor = fn; - if (reverse_neighbor_side) - { - this->val_neighbor = malloc_with_check, T>(this->np, this); - this->dx_neighbor = malloc_with_check, T>(this->np, this); - this->dy_neighbor = malloc_with_check, T>(this->np, this); - for (int i = 0; i < this->np; i++) - { - this->val_neighbor[i] = fn->val[this->np - i - 1]; - this->dx_neighbor[i] = fn->dx[this->np - i - 1]; - this->dy_neighbor[i] = fn->dy[this->np - i - 1]; - } - } - else + this->val_neighbor = malloc_with_check, T>(this->np, this); + this->dx_neighbor = malloc_with_check, T>(this->np, this); + this->dy_neighbor = malloc_with_check, T>(this->np, this); + for (int i = 0; i < this->np; i++) { - this->val_neighbor = fn->val; - this->dx_neighbor = fn->dx; - this->dy_neighbor = fn->dy; + this->val_neighbor[i] = fn->val[this->np - i - 1]; + this->dx_neighbor[i] = fn->dx[this->np - i - 1]; + this->dy_neighbor[i] = fn->dy[this->np - i - 1]; } - - this->val = this->dx = this->dy = nullptr; } else { - this->fn_central = fn; - this->val = fn->val; - this->dx = fn->dx; - this->dy = fn->dy; - this->val_neighbor = this->dx_neighbor = this->dy_neighbor = nullptr; + this->val_neighbor = fn->val; + this->dx_neighbor = fn->dx; + this->dy_neighbor = fn->dy; } + + this->val = this->dx = this->dy = nullptr; + } + else + { + this->fn_central = fn; + this->val = fn->val; + this->dx = fn->dx; + this->dy = fn->dy; + this->val_neighbor = this->dx_neighbor = this->dy_neighbor = nullptr; } + } template DiscontinuousFunc::DiscontinuousFunc(Func* fn_c, Func* fn_n, bool reverse) : Func(fn_c->np, fn_c->nc), fn_central(fn_c), fn_neighbor(fn_n), reverse_neighbor_side(reverse) { - if (reverse_neighbor_side) - { - this->val_neighbor = malloc_with_check, T>(this->np, this); - this->dx_neighbor = malloc_with_check, T>(this->np, this); - this->dy_neighbor = malloc_with_check, T>(this->np, this); - for (int i = 0; i < this->np; i++) - { - this->val_neighbor[i] = fn_neighbor->val[this->np - i - 1]; - this->dx_neighbor[i] = fn_neighbor->dx[this->np - i - 1]; - this->dy_neighbor[i] = fn_neighbor->dy[this->np - i - 1]; - } - } - else + if (reverse_neighbor_side) + { + this->val_neighbor = malloc_with_check, T>(this->np, this); + this->dx_neighbor = malloc_with_check, T>(this->np, this); + this->dy_neighbor = malloc_with_check, T>(this->np, this); + for (int i = 0; i < this->np; i++) { - this->val_neighbor = fn_neighbor->val; - this->dx_neighbor = fn_neighbor->dx; - this->dy_neighbor = fn_neighbor->dy; + this->val_neighbor[i] = fn_neighbor->val[this->np - i - 1]; + this->dx_neighbor[i] = fn_neighbor->dx[this->np - i - 1]; + this->dy_neighbor[i] = fn_neighbor->dy[this->np - i - 1]; } - this->val = fn_central->val; - this->dx = fn_central->dx; - this->dy = fn_central->dy; } + else + { + this->val_neighbor = fn_neighbor->val; + this->dx_neighbor = fn_neighbor->dx; + this->dy_neighbor = fn_neighbor->dy; + } + this->val = fn_central->val; + this->dx = fn_central->dx; + this->dy = fn_central->dy; + } - DiscontinuousFunc::DiscontinuousFunc(Func* fn, bool support_on_neighbor, bool reverse) : Func(), + DiscontinuousFunc::DiscontinuousFunc(Func* fn, bool support_on_neighbor, bool reverse) : Func(fn->order), fn_central(nullptr), fn_neighbor(nullptr), reverse_neighbor_side(reverse) { if (fn == nullptr) @@ -251,7 +265,7 @@ namespace Hermes this->fn_neighbor = fn; this->val_neighbor = fn->val; this->dx_neighbor = fn->dx; - this->dy_neighbor = fn->dy; + this->dy_neighbor = fn->dy; } else { @@ -262,7 +276,7 @@ namespace Hermes } } - DiscontinuousFunc::DiscontinuousFunc(Func* fn_c, Func* fn_n, bool reverse) : Func(), + DiscontinuousFunc::DiscontinuousFunc(Func* fn_c, Func* fn_n, bool reverse) : Func(std::max(fn_c->order, fn_n->order)), fn_central(fn_c), fn_neighbor(fn_n), reverse_neighbor_side(reverse) { this->val_neighbor = fn_neighbor->val; @@ -318,39 +332,15 @@ namespace Hermes } } - template - Geom::Geom() - { - elem_marker = -1; - edge_marker = -1; - id = 0; - isurf = 4; - x = y = nullptr; - nx = ny = nullptr; - tx = ty = nullptr; - } - - template - void Geom::free() - { - free_with_check(x); - free_with_check(tx); - free_with_check(nx); - - free_with_check(y); - free_with_check(ty); - free_with_check(ny); - } - template<> - double Geom::get_diam_approximation(int n) + double GeomVol::get_diam_approximation(unsigned char n) { double x_min = std::numeric_limits::max(), x_max = std::numeric_limits::min(), y_min = std::numeric_limits::max(), y_max = std::numeric_limits::min(); - for (int i = 0; i < n; i++) + for (unsigned char i = 0; i < n; i++) { if (this->x[i] < x_min) x_min = this->x[i]; @@ -367,164 +357,113 @@ namespace Hermes } template<> - double Geom::get_area(int n, double* wt) + double GeomVol::get_area(unsigned char n, double* wt) { double area = 0.; - for (int i = 0; i < n; i++) + for (unsigned char i = 0; i < n; i++) area += wt[i]; return area; } - template<> - Hermes::Ord Geom::get_diam_approximation(int n) - { - return Hermes::Ord(0); + template + InterfaceGeom::InterfaceGeom(GeomSurf* geom, Element* central_el, Element* neighb_el) : central_el(central_el), neighb_el(neighb_el) + { + // Let this class expose the standard Geom interface. + this->elem_marker = geom->elem_marker; + this->edge_marker = geom->edge_marker; + this->isurf = geom->isurf; + this->orientation = geom->orientation; + this->x = geom->x; + this->y = geom->y; + this->tx = geom->tx; + this->ty = geom->ty; + this->nx = geom->nx; + this->ny = geom->ny; + this->wrapped_geom = geom; } template<> - Hermes::Ord Geom::get_area(int n, double* wt) + double InterfaceGeom::get_diam_approximation(unsigned char n) { - return Hermes::Ord(0); - } + double x_min = std::numeric_limits::max(), + x_max = std::numeric_limits::min(), + y_min = std::numeric_limits::max(), + y_max = std::numeric_limits::min(); - template - InterfaceGeom::InterfaceGeom(Geom* geom, int n_marker, int n_id, T n_diam) : - Geom(), neighb_marker(n_marker), neighb_id(n_id), neighb_diam(n_diam) - { - // Let this class expose the standard Geom interface. - this->edge_marker = geom->edge_marker; - this->elem_marker = geom->elem_marker; - this->id = geom->id; - this->isurf = geom->isurf; - this->x = geom->x; - this->y = geom->y; - this->tx = geom->tx; - this->ty = geom->ty; - this->nx = geom->nx; - this->ny = geom->ny; - this->orientation = geom->orientation; - this->wrapped_geom = geom; - } + for (unsigned char i = 0; i < n; i++) + { + if (this->x[i] < x_min) + x_min = this->x[i]; + if (this->x[i] > x_max) + x_max = this->x[i]; - template - void InterfaceGeom::free() - { - wrapped_geom->free(); - delete wrapped_geom; - } + if (this->y[i] < y_min) + y_min = this->y[i]; + if (this->y[i] > y_max) + y_max = this->y[i]; + } - template - void InterfaceGeom::free_ord() - { - delete wrapped_geom; + return std::sqrt((x_max - x_min) * (x_max - x_min) + (y_max - y_min) * (y_max - y_min)); } - template - int InterfaceGeom::get_neighbor_marker() const + template<> + double InterfaceGeom::get_area(unsigned char n, double* wt) { - return neighb_marker; + double area = 0.; + for (unsigned char i = 0; i < n; i++) + area += wt[i]; + return area; } - template - int InterfaceGeom::get_neighbor_id() const + GeomVol* init_geom_vol(RefMap *rm, const int order) { - return neighb_id; + GeomVol* e = new GeomVol < double > ; + init_geom_vol_allocated(*e, rm, order); + return e; } - template - T InterfaceGeom::get_neighbor_diam() const + void init_geom_vol_allocated(GeomVol& geom, RefMap *rm, const int order) { - return neighb_diam; + Element* element = rm->get_active_element(); + ElementMode2D mode = element->get_mode(); + geom.id = element->id; + geom.elem_marker = element->marker; + Quad2D* quad = rm->get_quad_2d(); + unsigned char np = quad->get_num_points(order, mode); + memcpy(geom.x, rm->get_phys_x(order), np * sizeof(double)); + memcpy(geom.y, rm->get_phys_y(order), np * sizeof(double)); } - Geom* init_geom_ord() + GeomSurf* init_geom_surf(RefMap *rm, unsigned char isurf, int marker, const int order, double3*& tan) { - Geom* e = new Geom; - Hermes::Ord x[] = { Hermes::Ord(1) }; - Hermes::Ord y[] = { Hermes::Ord(1) }; - - Hermes::Ord nx[] = { Hermes::Ord(1) }; - Hermes::Ord ny[] = { Hermes::Ord(1) }; - - Hermes::Ord tx[] = { Hermes::Ord(1) }; - Hermes::Ord ty[] = { Hermes::Ord(1) }; - - Hermes::Ord diam = Hermes::Ord(1); - - e->x = x; e->y = y; - e->nx = nx; e->ny = ny; - e->tx = tx; e->ty = ty; - + GeomSurf* e = new GeomSurf < double > ; + init_geom_surf_allocated(*e, rm, isurf, marker, order, tan); return e; } - Geom* init_geom_vol(RefMap *rm, const int order) + void init_geom_surf_allocated(GeomSurf& geom, RefMap *rm, unsigned char isurf, int marker, const int order, double3*& tan) { - Geom* e = new Geom; - e->id = rm->get_active_element()->id; - e->elem_marker = rm->get_active_element()->marker; - Quad2D* quad = rm->get_quad_2d(); - int np = quad->get_num_points(order, rm->get_active_element()->get_mode()); - e->x = malloc_with_check(np); - e->y = malloc_with_check(np); - double* x = rm->get_phys_x(order); - double* y = rm->get_phys_y(order); - for (int i = 0; i < np; i++) - { - e->x[i] = x[i]; - e->y[i] = y[i]; - } - return e; - } + Element* element = rm->get_active_element(); + ElementMode2D mode = element->get_mode(); - Geom* init_geom_surf(RefMap *rm, int isurf, int marker, const int order, double3*& tan) - { - Geom* e = new Geom; - e->edge_marker = marker; - e->elem_marker = rm->get_active_element()->marker; - e->id = rm->get_active_element()->id; - e->isurf = isurf; + geom.edge_marker = marker; + geom.elem_marker = element->marker; + geom.isurf = isurf; tan = rm->get_tangent(isurf, order); - double* x = rm->get_phys_x(order); - double* y = rm->get_phys_y(order); Quad2D* quad = rm->get_quad_2d(); - int np = quad->get_num_points(order, rm->get_active_element()->get_mode()); - e->x = malloc_with_check(np); - e->y = malloc_with_check(np); - e->tx = malloc_with_check(np); - e->ty = malloc_with_check(np); - e->nx = malloc_with_check(np); - e->ny = malloc_with_check(np); + unsigned char np = quad->get_num_points(order, mode); + + memcpy(geom.x, rm->get_phys_x(order), np * sizeof(double)); + memcpy(geom.y, rm->get_phys_y(order), np * sizeof(double)); + for (int i = 0; i < np; i++) { - e->x[i] = x[i]; - e->y[i] = y[i]; - e->tx[i] = tan[i][0]; e->ty[i] = tan[i][1]; - e->nx[i] = tan[i][1]; e->ny[i] = -tan[i][0]; + geom.tx[i] = tan[i][0]; geom.ty[i] = tan[i][1]; + geom.nx[i] = tan[i][1]; geom.ny[i] = -tan[i][0]; } - e->orientation = rm->get_active_element()->get_edge_orientation(isurf); - return e; - } - - Func* init_fn_ord(const int order) - { - Hermes::Ord d(order); - Hermes::Ord d1(order > 1 ? order - 1 : order); - - Func* f = new Func(); - f->val = d; - f->dx = d1; - f->dy = d1; -#ifdef H2D_USE_SECOND_DERIVATIVES - Hermes::Ord d2(std::min(0, order - 2)); - f->laplace = d; -#endif - f->val0 = f->val1 = d; - f->curl = d1; - f->div = d1; - return f; + geom.orientation = rm->get_active_element()->get_edge_orientation(isurf); } Func* init_fn(PrecalcShapeset *fu, RefMap *rm, const int order) @@ -569,7 +508,7 @@ namespace Hermes #endif int nc = fu->get_num_components(); - int np = fu->get_quad_2d()->get_num_points(order, fu->get_active_element()->get_mode()); + unsigned char np = fu->get_quad_2d()->get_num_points(order, fu->get_active_element()->get_mode()); u->np = np; u->nc = nc; @@ -740,7 +679,7 @@ namespace Hermes fu->set_quad_order(order); #endif int nc = fu->get_num_components(); - int np = quad->get_num_points(order, fu->get_active_element()->get_mode()); + unsigned char np = quad->get_num_points(order, fu->get_active_element()->get_mode()); u->np = np; u->nc = nc; @@ -785,19 +724,18 @@ namespace Hermes throw Hermes::Exceptions::Exception("nullptr UExtFunction in Func*::init_fn()."); Quad2D* quad = &g_quad_2d_std; - int np = quad->get_num_points(order, mode); + unsigned char np = quad->get_num_points(order, mode); fu->value(np, ext, u_ext, u, geometry); } - template Func* init_zero_fn(ElementMode2D mode, int order, Quad2D* quad, int nc) { if (quad == nullptr) quad = &g_quad_2d_std; - int np = quad->get_num_points(order, mode); + unsigned char np = quad->get_num_points(order, mode); Func* u = new Func(np, nc); if (nc == 1) @@ -822,7 +760,7 @@ namespace Hermes int nc = 1; Quad2D* quad = &g_quad_2d_std; - int np = quad->get_num_points(order, mode); + unsigned char np = quad->get_num_points(order, mode); Func* u = new Func(np, nc); // Sanity check. @@ -843,21 +781,21 @@ namespace Hermes template HERMES_API void init_fn_preallocated(Func* u, MeshFunction* fu, const int order); template HERMES_API void init_fn_preallocated(Func >* u, MeshFunction >* fu, const int order); - template HERMES_API void init_fn_preallocated(Func* u, UExtFunction* fu, Func** ext, Func** u_ext,const int order, Geom* geometry, ElementMode2D mode); + template HERMES_API void init_fn_preallocated(Func* u, UExtFunction* fu, Func** ext, Func** u_ext, const int order, Geom* geometry, ElementMode2D mode); template HERMES_API void init_fn_preallocated(Func >* u, UExtFunction >* fu, Func >** ext, Func >** u_ext, const int order, Geom* geometry, ElementMode2D mode); - template HERMES_API Func* init_zero_fn(ElementMode2D mode, int order, Quad2D* quad_2d, int nc); template HERMES_API Func >* init_zero_fn(ElementMode2D mode, int order, Quad2D* quad_2d, int nc); template HERMES_API Func* init_fn(UExtFunction* fu, Func** ext, Func** u_ext, const int order, Geom* geometry, ElementMode2D mode); template HERMES_API Func >* init_fn(UExtFunction >* fu, Func >** ext, Func >** u_ext, const int order, Geom* geometry, ElementMode2D mode); - template class HERMES_API DiscontinuousFunc; - template class HERMES_API DiscontinuousFunc >; - template class HERMES_API Geom; - template class HERMES_API Geom; - template class HERMES_API InterfaceGeom; - template class HERMES_API InterfaceGeom; + template class HERMES_API DiscontinuousFunc < double > ; + template class HERMES_API DiscontinuousFunc < std::complex > ; + template class HERMES_API GeomVol < double > ; + template class HERMES_API GeomSurf < double > ; + template class HERMES_API Geom < double > ; + template class HERMES_API InterfaceGeom < Hermes::Ord > ; + template class HERMES_API InterfaceGeom < double > ; } } \ No newline at end of file diff --git a/hermes2d/src/function/exact_solution.cpp b/hermes2d/src/function/exact_solution.cpp index fc92b7ff5c..177eceb481 100644 --- a/hermes2d/src/function/exact_solution.cpp +++ b/hermes2d/src/function/exact_solution.cpp @@ -128,8 +128,6 @@ namespace Hermes dy = 0; }; - - template ExactSolutionVector::ExactSolutionVector(MeshSharedPtr mesh) : ExactSolution(mesh) { @@ -342,7 +340,6 @@ namespace Hermes return Ord(0); } - template<> void ConstantSolutionVector::save(const char* filename) const { @@ -552,10 +549,13 @@ namespace Hermes ExactSolutionEggShell::ExactSolutionEggShell(MeshSharedPtr mesh, int polynomialOrder) : ExactSolutionScalar(mesh) { - Hermes2D::WeakFormsH1::DefaultWeakFormLaplaceLinear wf; - EssentialBCs bcs(Hermes::vector*>(new DefaultEssentialBCConst(EggShell::eggShell0Marker, 0.), new DefaultEssentialBCConst(EggShell::eggShell1Marker, 1.))); + WeakFormSharedPtr wf(new WeakFormsH1::DefaultWeakFormLaplaceLinear()); + std::vector*> bcVector; + bcVector.push_back(new DefaultEssentialBCConst(EggShell::eggShell0Marker, 0.)); + bcVector.push_back(new DefaultEssentialBCConst(EggShell::eggShell1Marker, 1.)); + EssentialBCs bcs(bcVector); SpaceSharedPtr space(new H1Space(mesh, &bcs, polynomialOrder)); - Hermes::Hermes2D::LinearSolver linear_solver(&wf, space); + Hermes::Hermes2D::LinearSolver linear_solver(wf, space); MeshFunctionSharedPtr sln(new Solution()); linear_solver.solve(); Solution::vector_to_solution(linear_solver.get_sln_vector(), space, sln); @@ -581,7 +581,7 @@ namespace Hermes MeshFunction* ExactSolutionEggShell::clone() const { - Solution * sln = new Solution; + Solution * sln = new Solution < double > ; sln->copy(this); return sln; } @@ -601,7 +601,7 @@ namespace Hermes } template - void UExtFunction::precalculate(int order, int mask) + void UExtFunction::precalculate(unsigned short order, unsigned short mask) { } @@ -626,30 +626,30 @@ namespace Hermes std::tr1::shared_ptr >::operator=(other); } - template class HERMES_API UExtFunctionSharedPtr; - template class HERMES_API UExtFunctionSharedPtr >; + template class HERMES_API UExtFunctionSharedPtr < double > ; + template class HERMES_API UExtFunctionSharedPtr < std::complex > ; - template HERMES_API class ExactSolutionScalar; - template HERMES_API class ExactSolutionScalar >; + template HERMES_API class ExactSolutionScalar < double > ; + template HERMES_API class ExactSolutionScalar < std::complex > ; - template HERMES_API class ExactSolutionConstantArray; - template HERMES_API class ExactSolutionConstantArray; - template HERMES_API class ExactSolutionConstantArray; - template HERMES_API class ExactSolutionConstantArray; - template HERMES_API class ExactSolutionConstantArray, std::complex >; + template HERMES_API class ExactSolutionConstantArray < double, double > ; + template HERMES_API class ExactSolutionConstantArray < double, int > ; + template HERMES_API class ExactSolutionConstantArray < double, unsigned int > ; + template HERMES_API class ExactSolutionConstantArray < double, bool > ; + template HERMES_API class ExactSolutionConstantArray < std::complex, std::complex > ; - template HERMES_API class ExactSolutionVector; - template HERMES_API class ExactSolutionVector >; - template HERMES_API class ConstantSolution; - template HERMES_API class ConstantSolution >; - template HERMES_API class ConstantSolutionVector; - template HERMES_API class ConstantSolutionVector >; - template HERMES_API class ZeroSolution; - template HERMES_API class ZeroSolution >; - template HERMES_API class ZeroSolutionVector; - template HERMES_API class ZeroSolutionVector >; + template HERMES_API class ExactSolutionVector < double > ; + template HERMES_API class ExactSolutionVector < std::complex > ; + template HERMES_API class ConstantSolution < double > ; + template HERMES_API class ConstantSolution < std::complex > ; + template HERMES_API class ConstantSolutionVector < double > ; + template HERMES_API class ConstantSolutionVector < std::complex > ; + template HERMES_API class ZeroSolution < double > ; + template HERMES_API class ZeroSolution < std::complex > ; + template HERMES_API class ZeroSolutionVector < double > ; + template HERMES_API class ZeroSolutionVector < std::complex > ; - template HERMES_API class UExtFunction; - template HERMES_API class UExtFunction >; + template HERMES_API class UExtFunction < double > ; + template HERMES_API class UExtFunction < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/function/filter.cpp b/hermes2d/src/function/filter.cpp index 323ebff906..7f690d59bb 100644 --- a/hermes2d/src/function/filter.cpp +++ b/hermes2d/src/function/filter.cpp @@ -29,35 +29,8 @@ namespace Hermes } template - Filter::Filter(MeshFunctionSharedPtr* solutions, int num) : MeshFunction() + Filter::Filter(std::vector > solutions) : MeshFunction(), solutions(solutions) { - this->num = num; - if (num > H2D_MAX_COMPONENTS) - throw Hermes::Exceptions::Exception("Attempt to create an instance of Filter with more than 10 MeshFunctions."); - for (int i = 0; i < this->num; i++) - this->sln[i] = solutions[i]; - this->init(); - } - - template - Filter::Filter(Hermes::vector > solutions) : MeshFunction() - { - this->num = solutions.size(); - if (num > H2D_MAX_COMPONENTS) - throw Hermes::Exceptions::Exception("Attempt to create an instance of Filter with more than 10 MeshFunctions."); - for (int i = 0; i < this->num; i++) - this->sln[i] = solutions.at(i); - this->init(); - } - - template - void Filter::init(Hermes::vector > solutions) - { - this->num = solutions.size(); - if (num > H2D_MAX_COMPONENTS) - throw Hermes::Exceptions::Exception("Attempt to create an instance of Filter with more than 10 MeshFunctions."); - for (int i = 0; i < this->num; i++) - this->sln[i] = solutions.at(i); this->init(); } @@ -65,12 +38,15 @@ namespace Hermes void Filter::init() { // construct the union mesh, if necessary - MeshSharedPtr meshes[H2D_MAX_COMPONENTS]; - for (int i = 0; i < this->num; i++) - meshes[i] = this->sln[i]->get_mesh(); + std::vector meshes; + for (int i = 0; i < this->solutions.size(); i++) + meshes.push_back(this->solutions[i]->get_mesh()); this->mesh = meshes[0]; - Solution* sln = dynamic_cast*>(this->sln[0].get()); + for (int i = 0; i < this->solutions.size(); i++) + this->solutions_sub_idx.push_back(0); + + Solution* sln = dynamic_cast*>(this->solutions[0].get()); if (sln == nullptr) this->space_type = HERMES_INVALID_SPACE; else @@ -78,8 +54,7 @@ namespace Hermes unimesh = false; - for (int i = 1; i < num; i++) - + for (int i = 1; i < this->solutions.size(); i++) { if (meshes[i] == nullptr) { @@ -92,7 +67,7 @@ namespace Hermes break; } - sln = dynamic_cast*>(this->sln[i].get()); + sln = dynamic_cast*>(this->solutions[i].get()); if (sln == nullptr || sln->get_space_type() != this->space_type) this->space_type = HERMES_INVALID_SPACE; } @@ -100,14 +75,13 @@ namespace Hermes if (unimesh) { this->mesh = MeshSharedPtr(new Mesh); - this->unidata = Traverse::construct_union_mesh(num, meshes, this->mesh); + this->unidata = Traverse::construct_union_mesh(this->solutions.size(), &meshes[0], this->mesh); } // misc init this->num_components = 1; this->order = 0; - memset(sln_sub, 0, sizeof(sln_sub)); set_quad_2d(&g_quad_2d_std); } @@ -121,8 +95,9 @@ namespace Hermes void Filter::set_quad_2d(Quad2D* quad_2d) { MeshFunction::set_quad_2d(quad_2d); - for (int i = 0; i < num; i++) - this->sln[i]->set_quad_2d(quad_2d); // nodup + for (int i = 0; i < this->solutions.size(); i++) + // nodup + this->solutions[i]->set_quad_2d(quad_2d); } template @@ -131,21 +106,25 @@ namespace Hermes MeshFunction::set_active_element(e); if (!unimesh) { - for (int i = 0; i < num; i++) - this->sln[i]->set_active_element(e); // nodup - memset(sln_sub, 0, sizeof(sln_sub)); + for (int i = 0; i < this->solutions.size(); i++) + // nodup + this->solutions[i]->set_active_element(e); + + for (int i = 0; i < this->solutions.size(); i++) + solutions_sub_idx[i] = 0; } else { - for (int i = 0; i < num; i++) + for (int i = 0; i < this->solutions.size(); i++) { - this->sln[i]->set_active_element(unidata[i][e->id].e); - this->sln[i]->set_transform(unidata[i][e->id].idx); - sln_sub[i] = this->sln[i]->get_transform(); + this->solutions[i]->set_active_element(unidata[i][e->id].e); + this->solutions[i]->set_transform(unidata[i][e->id].idx); + solutions_sub_idx[i] = this->solutions[i]->get_transform(); } } - this->order = 20; // fixme + // fixme + this->order = 20; } template @@ -153,7 +132,7 @@ namespace Hermes { if (unimesh) { - for (int i = 0; i < num; i++) + for (int i = 0; i < this->solutions.size(); i++) free_with_check(unidata[i]); free_with_check(unidata); } @@ -170,9 +149,9 @@ namespace Hermes void Filter::push_transform(int son) { MeshFunction::push_transform(son); - for (int i = 0; i < num; i++) + for (int i = 0; i < this->solutions.size(); i++) { - // sln_sub[i] contains the value sln[i]->sub_idx, which the Filter thinks + // solutions_sub_idx[i] contains the value sln[i]->sub_idx, which the Filter thinks // the solution has, or at least had last time. If the filter graph is // cyclic, it could happen that some solutions would get pushed the transform // more than once. This mechanism prevents it. If the filter sees that the @@ -181,9 +160,9 @@ namespace Hermes // is actually the case for cyclic filter graphs and filters used in multi-mesh // computation. - if (this->sln[i]->get_transform() == sln_sub[i]) - this->sln[i]->push_transform(son); - sln_sub[i] = this->sln[i]->get_transform(); + if (this->solutions[i]->get_transform() == solutions_sub_idx[i]) + this->solutions[i]->push_transform(son); + solutions_sub_idx[i] = this->solutions[i]->get_transform(); } } @@ -191,11 +170,11 @@ namespace Hermes void Filter::pop_transform() { MeshFunction::pop_transform(); - for (int i = 0; i < num; i++) + for (int i = 0; i < this->solutions.size(); i++) { - if (this->sln[i]->get_transform() == sln_sub[i] && sln_sub[i] != 0) - this->sln[i]->pop_transform(); - sln_sub[i] = this->sln[i]->get_transform(); + if (this->solutions[i]->get_transform() == solutions_sub_idx[i] && solutions_sub_idx[i] != 0) + this->solutions[i]->pop_transform(); + solutions_sub_idx[i] = this->solutions[i]->get_transform(); } } @@ -205,26 +184,16 @@ namespace Hermes } template - SimpleFilter::SimpleFilter(Hermes::vector > solutions, const Hermes::vector items) + SimpleFilter::SimpleFilter(std::vector > solutions, const std::vector items) : Filter(solutions), items(items) { - this->num = solutions.size(); - if (this->num > H2D_MAX_COMPONENTS) - throw Hermes::Exceptions::Exception("Attempt to create an instance of Filter with more than 10 MeshFunctions."); - if (items.size() != (unsigned) this->num) - if (items.size() > 0) - throw Hermes::Exceptions::Exception("Attempt to create an instance of SimpleFilter with different supplied number of MeshFunctions than the number of types of data used from them."); - - for (int i = 0; i < this->num; i++) + if (this->items.size() > 0) + Hermes::Helpers::check_length(solutions, items); + else + for (int i = 0; i < this->solutions.size(); i++) + this->items.push_back(H2D_FN_VAL); - { - this->sln[i] = solutions.at(i); - if (items.size() > 0) - this->item[i] = items.at(i); - else - this->item[i] = H2D_FN_VAL; - } this->init(); - init_components(); + this->init_components(); } template @@ -236,17 +205,22 @@ namespace Hermes void SimpleFilter::init_components() { bool vec1 = false, vec2 = false; - for (int i = 0; i < this->num; i++) + for (int i = 0; i < this->solutions.size(); i++) { - if (this->sln[i]->get_num_components() > 1) vec1 = true; - if ((item[i] & H2D_FN_COMPONENT_0) && (item[i] & H2D_FN_COMPONENT_1)) vec2 = true; - if (this->sln[i]->get_num_components() == 1) item[i] &= H2D_FN_COMPONENT_0; + if (this->solutions[i]->get_num_components() > 1) + vec1 = true; + + if ((this->items[i] & H2D_FN_COMPONENT_0) && (this->items[i] & H2D_FN_COMPONENT_1)) + vec2 = true; + + if (this->solutions[i]->get_num_components() == 1) + this->items[i] &= H2D_FN_COMPONENT_0; } this->num_components = (vec1 && vec2) ? 2 : 1; } template - void SimpleFilter::precalculate(int order, int mask) + void SimpleFilter::precalculate(unsigned short order, unsigned short mask) { #ifdef H2D_USE_SECOND_DERIVATIVES if (mask & (H2D_FN_DX | H2D_FN_DY | H2D_FN_DXX | H2D_FN_DYY | H2D_FN_DXY)) @@ -256,47 +230,44 @@ namespace Hermes throw Hermes::Exceptions::Exception("SimpleFilter not defined for derivatives."); Quad2D* quad = this->quads[this->cur_quad]; - int np = quad->get_num_points(order, this->element->get_mode()); + unsigned char np = quad->get_num_points(order, this->element->get_mode()); // precalculate all solutions - for (int i = 0; i < this->num; i++) - this->sln[i]->set_quad_order(order, item[i]); + for (int i = 0; i < this->solutions.size(); i++) + this->solutions[i]->set_quad_order(order, this->items[i]); for (int j = 0; j < this->num_components; j++) { // obtain corresponding tables - Scalar* tab[H2D_MAX_COMPONENTS]; - for (int i = 0; i < this->num; i++) + std::vector tab; + for (int i = 0; i < this->solutions.size(); i++) { - int a = 0, b = 0, mask = item[i]; + int a = 0, b = 0, mask = this->items[i]; if (mask >= 0x40) { a = 1; mask >>= 6; } while (!(mask & 1)) { mask >>= 1; b++; } - tab[i] = const_cast(this->sln[i]->get_values(this->num_components == 1 ? a : j, b)); + tab.push_back(const_cast(this->solutions[i]->get_values(this->num_components == 1 ? a : j, b))); if (tab[i] == nullptr) throw Hermes::Exceptions::Exception("Value of 'item%d' is incorrect in filter definition.", i + 1); } - Hermes::vector values; - for (int i = 0; i < this->num; i++) - values.push_back(tab[i]); - // apply the filter - filter_fn(np, values, this->values[j][0]); + filter_fn(np, tab, this->values[j][0]); } + this->values_valid = true; } template Func* SimpleFilter::get_pt_value(double x, double y, bool use_MeshHashGrid, Element* e) { - Scalar val[H2D_MAX_COMPONENTS]; - for (int i = 0; i < this->num; i++) - val[i] = this->sln[i]->get_pt_value(x, y, use_MeshHashGrid, e)->val[0]; + std::vector val; + for (int i = 0; i < this->solutions.size(); i++) + val.push_back(this->solutions[i]->get_pt_value(x, y, use_MeshHashGrid, e)->val[0]); Func* toReturn = new Func(1, 1); Scalar result; - Hermes::vector values; - for (int i = 0; i < this->num; i++) + std::vector values; + for (int i = 0; i < this->solutions.size(); i++) values.push_back(&val[i]); // apply the filter @@ -308,17 +279,16 @@ namespace Hermes ComplexFilter::ComplexFilter() : Filter() { - this->num = 0; this->unimesh = false; } ComplexFilter::ComplexFilter(MeshFunctionSharedPtr > solution, int item) : Filter() { - this->num = 0; this->unimesh = false; this->sln_complex = solution; this->num_components = solution->get_num_components(); this->mesh = solution->get_mesh(); + this->solutions_sub_idx.push_back(0); set_quad_2d(&g_quad_2d_std); } @@ -340,12 +310,11 @@ namespace Hermes void ComplexFilter::set_active_element(Element* e) { MeshFunction::set_active_element(e); - this->sln_complex->set_active_element(e); + this->solutions_sub_idx[0] = 0; - memset(sln_sub, 0, sizeof(sln_sub)); - - this->order = 20; // fixme + // fixme + this->order = 20; } void ComplexFilter::push_transform(int son) @@ -360,7 +329,7 @@ namespace Hermes this->sln_complex->pop_transform(); } - void ComplexFilter::precalculate(int order, int mask) + void ComplexFilter::precalculate(unsigned short order, unsigned short mask) { #ifdef H2D_USE_SECOND_DERIVATIVES if (mask & (H2D_FN_DX | H2D_FN_DY | H2D_FN_DXX | H2D_FN_DYY | H2D_FN_DXY)) @@ -370,7 +339,7 @@ namespace Hermes throw Hermes::Exceptions::Exception("Filter not defined for derivatives."); Quad2D* quad = this->quads[this->cur_quad]; - int np = quad->get_num_points(order, this->element->get_mode()); + unsigned char np = quad->get_num_points(order, this->element->get_mode()); this->sln_complex->set_quad_order(order, H2D_FN_VAL); @@ -378,6 +347,7 @@ namespace Hermes filter_fn(np, const_cast*>(this->sln_complex->get_values(0, 0)), this->values[0][0]); if (num_components > 1) filter_fn(np, const_cast*>(this->sln_complex->get_values(1, 0)), this->values[1][0]); + this->values_valid = true; } Func* ComplexFilter::get_pt_value(double x, double y, bool use_MeshHashGrid, Element* e) @@ -410,7 +380,7 @@ namespace Hermes } template - DXDYFilter::DXDYFilter(Hermes::vector > solutions) : Filter(solutions) + DXDYFilter::DXDYFilter(std::vector > solutions) : Filter(solutions) { init_components(); } @@ -423,49 +393,49 @@ namespace Hermes template void DXDYFilter::init_components() { - this->num_components = this->sln[0]->get_num_components(); - for (int i = 1; i < this->num; i++) - if (this->sln[i]->get_num_components() != this->num_components) - throw Hermes::Exceptions::Exception("Filter: Solutions do not have the same number of components!"); + this->num_components = this->solutions[0]->get_num_components(); + for (int i = 1; i < this->solutions.size(); i++) + if (this->solutions[i]->get_num_components() != this->num_components) + throw Hermes::Exceptions::Exception("Filter: Solutions do not have the same number of components!"); } template - void DXDYFilter::init(Hermes::vector > solutions) + void DXDYFilter::init(std::vector > solutions) { - Filter::init(solutions); + Filter::init(); init_components(); } template - void DXDYFilter::precalculate(int order, int mask) + void DXDYFilter::precalculate(unsigned short order, unsigned short mask) { Quad2D* quad = this->quads[this->cur_quad]; - int np = quad->get_num_points(order, this->element->get_mode()); + unsigned char np = quad->get_num_points(order, this->element->get_mode()); // precalculate all solutions - for (int i = 0; i < this->num; i++) - this->sln[i]->set_quad_order(order, H2D_FN_DEFAULT); + for (int i = 0; i < this->solutions.size(); i++) + this->solutions[i]->set_quad_order(order, H2D_FN_DEFAULT); for (int j = 0; j < this->num_components; j++) { // obtain solution tables double *x, *y; const Scalar *val[H2D_MAX_COMPONENTS], *dx[H2D_MAX_COMPONENTS], *dy[H2D_MAX_COMPONENTS]; - x = this->sln[0]->get_refmap()->get_phys_x(order); - y = this->sln[0]->get_refmap()->get_phys_y(order); + x = this->solutions[0]->get_refmap()->get_phys_x(order); + y = this->solutions[0]->get_refmap()->get_phys_y(order); - for (int i = 0; i < this->num; i++) + for (int i = 0; i < this->solutions.size(); i++) { - val[i] = this->sln[i]->get_fn_values(j); - dx[i] = this->sln[i]->get_dx_values(j); - dy[i] = this->sln[i]->get_dy_values(j); + val[i] = this->solutions[i]->get_fn_values(j); + dx[i] = this->solutions[i]->get_dx_values(j); + dy[i] = this->solutions[i]->get_dy_values(j); } - Hermes::vector values_vector; - Hermes::vector dx_vector; - Hermes::vector dy_vector; + std::vector values_vector; + std::vector dx_vector; + std::vector dy_vector; - for (int i = 0; i < this->num; i++) + for (int i = 0; i < this->solutions.size(); i++) { values_vector.push_back(val[i]); dx_vector.push_back(dx[i]); @@ -475,6 +445,8 @@ namespace Hermes // apply the filter filter_fn(np, x, y, values_vector, dx_vector, dy_vector, this->values[j][0], this->values[j][1], this->values[j][2]); } + + this->values_valid = true; } template @@ -485,31 +457,34 @@ namespace Hermes } template - void MagFilter::filter_fn(int n, Hermes::vector values, Scalar* result) + void MagFilter::filter_fn(int n, const std::vector& values, Scalar* result) { for (int i = 0; i < n; i++) { result[i] = 0; for (unsigned int j = 0; j < values.size(); j++) - result[i] += sqr(values.at(j)[i]); + result[i] += sqr(values[j][i]); result[i] = sqrt(result[i]); } }; template - MagFilter::MagFilter(Hermes::vector > solutions, Hermes::vector items) : SimpleFilter(solutions, items) + MagFilter::MagFilter(std::vector > solutions, std::vector items) : SimpleFilter(solutions, items) { + Filter::init(); }; template MagFilter::MagFilter(MeshFunctionSharedPtr sln1, int item1) - : SimpleFilter(Hermes::vector >(sln1, sln1), - Hermes::vector(item1 & H2D_FN_COMPONENT_0, item1 & H2D_FN_COMPONENT_1)) + : SimpleFilter() { - if (sln1->get_num_components() < 2) - throw Hermes::Exceptions::Exception("The single-argument constructor is intended for vector-valued solutions."); - }; + this->solutions = { sln1, sln1 }; + this->items = { item1 & H2D_FN_COMPONENT_0, item1 & H2D_FN_COMPONENT_1 }; + if (sln1->get_num_components() < 2) + throw Hermes::Exceptions::Exception("The single-argument constructor is intended for vector-valued solutions."); + Filter::init(); + }; template MagFilter::~MagFilter() @@ -519,43 +494,42 @@ namespace Hermes template MeshFunction* MagFilter::clone() const { - Hermes::vector > slns; - Hermes::vector items; - for (int i = 0; i < this->num; i++) + std::vector > slns; + std::vector items; + for (int i = 0; i < this->solutions.size(); i++) { - slns.push_back(this->sln[i]->clone()); - items.push_back(this->item[i]); + slns.push_back(this->solutions[i]->clone()); + items.push_back(this->items[i]); } MagFilter* filter = new MagFilter(slns, items); return filter; } - void TopValFilter::filter_fn(int n, Hermes::vector values, double* result) + void TopValFilter::filter_fn(int n, const std::vector& values, double* result) { for (int i = 0; i < n; i++) { result[i] = 0; for (unsigned int j = 0; j < values.size(); j++) - if (values.at(j)[i] > limits[j]) - result[i] = limits[j]; - else - result[i] = values.at(j)[i]; + if (values[j][i] > limits[j]) + result[i] = limits[j]; + else + result[i] = values[j][i]; } }; - TopValFilter::TopValFilter(Hermes::vector > solutions, Hermes::vector limits, Hermes::vector items) : SimpleFilter(solutions, items), limits(limits) + TopValFilter::TopValFilter(std::vector > solutions, std::vector limits, std::vector items) : SimpleFilter(solutions, items), limits(limits) { }; TopValFilter::TopValFilter(MeshFunctionSharedPtr sln, double limit, int item) : SimpleFilter() { - this->limits.push_back(limit); - this->sln[0] = sln; - this->item[0] = item; - this->num = 1; - Filter::init(); - }; + this->limits.push_back(limit); + this->solutions.push_back(sln); + this->items.push_back(item); + Filter::init(); + }; TopValFilter::~TopValFilter() { @@ -563,43 +537,42 @@ namespace Hermes MeshFunction* TopValFilter::clone() const { - Hermes::vector > slns; - Hermes::vector items; - for (int i = 0; i < this->num; i++) + std::vector > slns; + std::vector items; + for (int i = 0; i < this->solutions.size(); i++) { - slns.push_back(this->sln[i]->clone()); - items.push_back(this->item[i]); + slns.push_back(this->solutions[i]->clone()); + items.push_back(this->items[i]); } TopValFilter* filter = new TopValFilter(slns, limits, items); return filter; } - void BottomValFilter::filter_fn(int n, Hermes::vector values, double* result) + void BottomValFilter::filter_fn(int n, const std::vector& values, double* result) { for (int i = 0; i < n; i++) { result[i] = 0; for (unsigned int j = 0; j < values.size(); j++) - if (values.at(j)[i] < limits[j]) - result[i] = limits[j]; - else - result[i] = values.at(j)[i]; + if (values[j][i] < limits[j]) + result[i] = limits[j]; + else + result[i] = values[j][i]; } }; - BottomValFilter::BottomValFilter(Hermes::vector > solutions, Hermes::vector limits, Hermes::vector items) : SimpleFilter(solutions, items), limits(limits) + BottomValFilter::BottomValFilter(std::vector > solutions, std::vector limits, std::vector items) : SimpleFilter(solutions, items), limits(limits) { }; BottomValFilter::BottomValFilter(MeshFunctionSharedPtr sln, double limit, int item) : SimpleFilter() { - this->limits.push_back(limit); - this->sln[0] = sln; - this->item[0] = item; - this->num = 1; - Filter::init(); - }; + this->limits.push_back(limit); + this->solutions.push_back(sln); + this->items.push_back(item); + Filter::init(); + }; BottomValFilter::~BottomValFilter() { @@ -607,47 +580,46 @@ namespace Hermes MeshFunction* BottomValFilter::clone() const { - Hermes::vector > slns; - Hermes::vector items; - for (int i = 0; i < this->num; i++) + std::vector > slns; + std::vector items; + for (int i = 0; i < this->solutions.size(); i++) { - slns.push_back(this->sln[i]->clone()); - items.push_back(this->item[i]); + slns.push_back(this->solutions[i]->clone()); + items.push_back(this->items[i]); } BottomValFilter* filter = new BottomValFilter(slns, limits, items); return filter; } - void ValFilter::filter_fn(int n, Hermes::vector values, double* result) + void ValFilter::filter_fn(int n, const std::vector& values, double* result) { for (int i = 0; i < n; i++) { result[i] = 0; for (unsigned int j = 0; j < values.size(); j++) - if (values.at(j)[i] < low_limits[j]) - result[i] = low_limits[j]; - else - if (values.at(j)[i] > high_limits[j]) - result[i] = high_limits[j]; - else - result[i] = values.at(j)[i]; + if (values[j][i] < low_limits[j]) + result[i] = low_limits[j]; + else + if (values[j][i] > high_limits[j]) + result[i] = high_limits[j]; + else + result[i] = values[j][i]; } }; - ValFilter::ValFilter(Hermes::vector > solutions, Hermes::vector low_limits, Hermes::vector high_limits, Hermes::vector items) : SimpleFilter(solutions, items), low_limits(low_limits), high_limits(high_limits) + ValFilter::ValFilter(std::vector > solutions, std::vector low_limits, std::vector high_limits, std::vector items) : SimpleFilter(solutions, items), low_limits(low_limits), high_limits(high_limits) { }; ValFilter::ValFilter(MeshFunctionSharedPtr sln, double low_limit, double high_limit, int item) : SimpleFilter() { - this->low_limits.push_back(low_limit); - this->high_limits.push_back(high_limit); - this->sln[0] = sln; - this->item[0] = item; - this->num = 1; - Filter::init(); - }; + this->low_limits.push_back(low_limit); + this->high_limits.push_back(high_limit); + this->solutions.push_back(sln); + this->items.push_back(item); + Filter::init(); + }; ValFilter::~ValFilter() { @@ -655,25 +627,25 @@ namespace Hermes MeshFunction* ValFilter::clone() const { - Hermes::vector > slns; - Hermes::vector items; - for (int i = 0; i < this->num; i++) + std::vector > slns; + std::vector items; + for (int i = 0; i < this->solutions.size(); i++) { - slns.push_back(this->sln[i]->clone()); - items.push_back(this->item[i]); + slns.push_back(this->solutions[i]->clone()); + items.push_back(this->items[i]); } ValFilter* filter = new ValFilter(slns, low_limits, high_limits, items); return filter; } template - void DiffFilter::filter_fn(int n, Hermes::vector values, Scalar* result) + void DiffFilter::filter_fn(int n, const std::vector& values, Scalar* result) { - for (int i = 0; i < n; i++) result[i] = values.at(0)[i] - values.at(1)[i]; + for (int i = 0; i < n; i++) result[i] = values[0][i] - values.at(1)[i]; }; template - DiffFilter::DiffFilter(Hermes::vector > solutions, Hermes::vector items) : SimpleFilter(solutions, items) {} + DiffFilter::DiffFilter(std::vector > solutions, std::vector items) : SimpleFilter(solutions, items) {} template DiffFilter::~DiffFilter() @@ -683,30 +655,30 @@ namespace Hermes template MeshFunction* DiffFilter::clone() const { - Hermes::vector > slns; - Hermes::vector items; - for (int i = 0; i < this->num; i++) + std::vector > slns; + std::vector items; + for (int i = 0; i < this->solutions.size(); i++) { - slns.push_back(this->sln[i]->clone()); - items.push_back(this->item[i]); + slns.push_back(this->solutions[i]->clone()); + items.push_back(this->items[i]); } DiffFilter* filter = new DiffFilter(slns, items); return filter; } template - void SumFilter::filter_fn(int n, Hermes::vector values, Scalar* result) + void SumFilter::filter_fn(int n, const std::vector& values, Scalar* result) { for (int i = 0; i < n; i++) { result[i] = 0; for (unsigned int j = 0; j < values.size(); j++) - result[i] += values.at(j)[i]; + result[i] += values[j][i]; } }; template - SumFilter::SumFilter(Hermes::vector > solutions, Hermes::vector items) : SimpleFilter(solutions, items) {} + SumFilter::SumFilter(std::vector > solutions, std::vector items) : SimpleFilter(solutions, items) {} template SumFilter::~SumFilter() @@ -716,38 +688,38 @@ namespace Hermes template MeshFunction* SumFilter::clone() const { - Hermes::vector > slns; - Hermes::vector items; - for (int i = 0; i < this->num; i++) + std::vector > slns; + std::vector items; + for (int i = 0; i < this->solutions.size(); i++) { - slns.push_back(this->sln[i]->clone()); - items.push_back(this->item[i]); + slns.push_back(this->solutions[i]->clone()); + items.push_back(this->items[i]); } SumFilter* filter = new SumFilter(slns, items); return filter; } template<> - void SquareFilter::filter_fn(int n, Hermes::vector v1, double* result) + void SquareFilter::filter_fn(int n, const std::vector& v1, double* result) { for (int i = 0; i < n; i++) - result[i] = sqr(v1.at(0)[i]); + result[i] = sqr(v1[0][i]); }; template<> - void SquareFilter >::filter_fn(int n, Hermes::vector *> v1, std::complex * result) + void SquareFilter >::filter_fn(int n, const std::vector *>& v1, std::complex * result) { for (int i = 0; i < n; i++) - result[i] = std::norm(v1.at(0)[i]); + result[i] = std::norm(v1[0][i]); }; template - SquareFilter::SquareFilter(Hermes::vector > solutions, Hermes::vector items) + SquareFilter::SquareFilter(std::vector > solutions, std::vector items) : SimpleFilter(solutions, items) { - if (solutions.size() > 1) - throw Hermes::Exceptions::Exception("SquareFilter only supports one MeshFunction."); - }; + if (solutions.size() > 1) + throw Hermes::Exceptions::Exception("SquareFilter only supports one MeshFunction."); + }; template SquareFilter::~SquareFilter() @@ -757,41 +729,40 @@ namespace Hermes template MeshFunction* SquareFilter::clone() const { - Hermes::vector > slns; - Hermes::vector items; - for (int i = 0; i < this->num; i++) + std::vector > slns; + std::vector items; + for (int i = 0; i < this->solutions.size(); i++) { - slns.push_back(this->sln[i]->clone()); - items.push_back(this->item[i]); + slns.push_back(this->solutions[i]->clone()); + items.push_back(this->items[i]); } SquareFilter* filter = new SquareFilter(slns, items); return filter; } - void AbsFilter::filter_fn(int n, Hermes::vector v1, double * result) + void AbsFilter::filter_fn(int n, const std::vector& v1, double * result) { for (int i = 0; i < n; i++) - result[i] = std::abs(v1.at(0)[i]); + result[i] = std::abs(v1[0][i]); }; - AbsFilter::AbsFilter(Hermes::vector > solutions, Hermes::vector items) + AbsFilter::AbsFilter(std::vector > solutions, std::vector items) : SimpleFilter(solutions, items) { - if (solutions.size() > 1) - throw Hermes::Exceptions::Exception("AbsFilter only supports one MeshFunction."); - }; + if (solutions.size() > 1) + throw Hermes::Exceptions::Exception("AbsFilter only supports one MeshFunction."); + }; AbsFilter::AbsFilter(MeshFunctionSharedPtr solution) : SimpleFilter() { - this->num = 1; - this->sln[0] = solution; + this->solutions.push_back(solution); - this->item[0] = H2D_FN_VAL; + this->items.push_back(H2D_FN_VAL); - this->init(); - init_components(); - }; + this->init(); + init_components(); + }; AbsFilter::~AbsFilter() { @@ -799,18 +770,18 @@ namespace Hermes MeshFunction* AbsFilter::clone() const { - Hermes::vector > slns; - Hermes::vector items; - for (int i = 0; i < this->num; i++) + std::vector > slns; + std::vector items; + for (int i = 0; i < this->solutions.size(); i++) { - slns.push_back(this->sln[i]->clone()); - items.push_back(this->item[i]); + slns.push_back(this->solutions[i]->clone()); + items.push_back(this->items[i]); } AbsFilter* filter = new AbsFilter(slns, items); return filter; } - void RealFilter::filter_fn(int n, std::complex* values, double* result) + void RealFilter::filter_fn(int n, const std::complex* values, double* result) { for (int i = 0; i < n; i++) result[i] = values[i].real(); @@ -836,7 +807,7 @@ namespace Hermes { } - void ImagFilter::filter_fn(int n, std::complex* values, double* result) + void ImagFilter::filter_fn(int n, const std::complex* values, double* result) { for (int i = 0; i < n; i++) result[i] = values[i].imag(); @@ -857,7 +828,7 @@ namespace Hermes return filter; } - void ComplexAbsFilter::filter_fn(int n, std::complex* values, double* result) + void ComplexAbsFilter::filter_fn(int n, const std::complex* values, double* result) { for (int i = 0; i < n; i++) result[i] = sqrt(sqr(values[i].real()) + sqr(values[i].imag())); @@ -878,24 +849,24 @@ namespace Hermes { } - void AngleFilter::filter_fn(int n, Hermes::vector*> v1, double* result) + void AngleFilter::filter_fn(int n, const std::vector*>& v1, double* result) { for (int i = 0; i < n; i++) - result[i] = atan2(v1.at(0)[i].imag(), v1.at(0)[i].real()); + result[i] = atan2(v1[0][i].imag(), v1[0][i].real()); }; - AngleFilter::AngleFilter(Hermes::vector > > solutions, Hermes::vector items) + AngleFilter::AngleFilter(std::vector > > solutions, std::vector items) : SimpleFilter >(solutions, items) { - if (solutions.size() > 1) - throw Hermes::Exceptions::Exception("RealFilter only supports one MeshFunction."); - }; + if (solutions.size() > 1) + throw Hermes::Exceptions::Exception("RealFilter only supports one MeshFunction."); + }; AngleFilter::~AngleFilter() { } - void VonMisesFilter::precalculate(int order, int mask) + void VonMisesFilter::precalculate(unsigned short order, unsigned short mask) { #ifdef H2D_USE_SECOND_DERIVATIVES if (mask & (H2D_FN_DX | H2D_FN_DY | H2D_FN_DXX | H2D_FN_DYY | H2D_FN_DXY)) @@ -905,18 +876,18 @@ namespace Hermes throw Hermes::Exceptions::Exception("VonMisesFilter not defined for derivatives."); Quad2D* quad = this->quads[this->cur_quad]; - int np = quad->get_num_points(order, this->element->get_mode()); + unsigned char np = quad->get_num_points(order, this->element->get_mode()); - this->sln[0]->set_quad_order(order, H2D_FN_VAL | H2D_FN_DX | H2D_FN_DY); - this->sln[1]->set_quad_order(order, H2D_FN_DX | H2D_FN_DY); + this->solutions[0]->set_quad_order(order, H2D_FN_VAL | H2D_FN_DX | H2D_FN_DY); + this->solutions[1]->set_quad_order(order, H2D_FN_DX | H2D_FN_DY); - const double *dudx = this->sln[0]->get_dx_values(); - const double *dudy = this->sln[0]->get_dy_values(); - const double *dvdx = this->sln[1]->get_dx_values(); - const double *dvdy = this->sln[1]->get_dy_values(); - const double *uval = this->sln[0]->get_fn_values(); + const double *dudx = this->solutions[0]->get_dx_values(); + const double *dudy = this->solutions[0]->get_dy_values(); + const double *dvdx = this->solutions[1]->get_dx_values(); + const double *dvdy = this->solutions[1]->get_dy_values(); + const double *uval = this->solutions[0]->get_fn_values(); update_refmap(); - double *x = refmap->get_phys_x(order); + double *x = refmap.get_phys_x(order); for (int i = 0; i < np; i++) { @@ -930,6 +901,7 @@ namespace Hermes // Von Mises stress this->values[0][0][i] = 1.0 / sqrt(2.0) * sqrt(sqr(tx - ty) + sqr(ty - tz) + sqr(tz - tx) + 6 * sqr(txy)); } + this->values_valid = true; } Func* VonMisesFilter::get_pt_value(double x, double y, bool use_MeshHashGrid, Element* e) @@ -938,26 +910,16 @@ namespace Hermes return 0; } - VonMisesFilter::VonMisesFilter(Hermes::vector > solutions, double lambda, double mu, + VonMisesFilter::VonMisesFilter(std::vector > solutions, double lambda, double mu, int cyl, int item1, int item2) : Filter(solutions) { - this->mu = mu; - this->lambda = lambda; - this->cyl = cyl; - this->item1 = item1; - this->item2 = item2; - } - - VonMisesFilter::VonMisesFilter(MeshFunctionSharedPtr* solutions, int num, double lambda, double mu, - int cyl, int item1, int item2) : Filter(solutions, num) - { - this->mu = mu; - this->lambda = lambda; - this->cyl = cyl; - this->item1 = item1; - this->item2 = item2; - } + this->mu = mu; + this->lambda = lambda; + this->cyl = cyl; + this->item1 = item1; + this->item2 = item2; + } VonMisesFilter::~VonMisesFilter() { @@ -965,57 +927,54 @@ namespace Hermes MeshFunction* VonMisesFilter::clone() const { - Hermes::vector > slns; - for (int i = 0; i < num; i++) - slns.push_back(sln[i]->clone()); - VonMisesFilter* filter = new VonMisesFilter(&slns[0], num, lambda, mu, cyl, item1, item2); + std::vector > slns; + for (int i = 0; i < this->solutions.size(); i++) + slns.push_back(this->solutions[i]->clone()); + VonMisesFilter* filter = new VonMisesFilter(slns, lambda, mu, cyl, item1, item2); return filter; } template - void LinearFilter::precalculate(int order, int mask) + void LinearFilter::precalculate(unsigned short order, unsigned short mask) { Quad2D* quad = this->quads[this->cur_quad]; - int np = quad->get_num_points(order, this->element->get_mode()); + unsigned char np = quad->get_num_points(order, this->element->get_mode()); struct Filter::Node* node = this->new_node(H2D_FN_DEFAULT, np); // precalculate all solutions - for (int i = 0; i < this->num; i++) - this->sln[i]->set_quad_order(order); + for (int i = 0; i < this->solutions.size(); i++) + this->solutions[i]->set_quad_order(order); for (int j = 0; j < this->num_components; j++) { // obtain solution tables - Scalar *val[H2D_MAX_COMPONENTS], *dx[H2D_MAX_COMPONENTS], *dy[H2D_MAX_COMPONENTS]; - for (int i = 0; i < this->num; i++) + std::vector val, dx, dy; + for (int i = 0; i < this->solutions.size(); i++) { - val[i] = this->sln[i]->get_fn_values(j); - dx[i] = this->sln[i]->get_dx_values(j); - dy[i] = this->sln[i]->get_dy_values(j); + val.push_back(this->solutions[i]->get_fn_values(j)); + dx.push_back(this->solutions[i]->get_dx_values(j)); + dy.push_back(this->solutions[i]->get_dy_values(j)); } - if (this->num == 2) - for (int i = 0; i < np; i++) + if (this->solutions.size() == 2) { - node->values[j][0][i] = tau_frac * (val[1][i] - val[0][i]) + val[1][i]; - node->values[j][1][i] = tau_frac * (dx[1][i] - dx[0][i]) + dx[1][i]; - node->values[j][2][i] = tau_frac * (dy[1][i] - dy[0][i]) + dy[1][i]; + for (int i = 0; i < np; i++) + { + node->values[j][0][i] = tau_frac * (val[1][i] - val[0][i]) + val[1][i]; + node->values[j][1][i] = tau_frac * (dx[1][i] - dx[0][i]) + dx[1][i]; + node->values[j][2][i] = tau_frac * (dy[1][i] - dy[0][i]) + dy[1][i]; + } } else - for (int i = 0; i < np; i++) { - node->values[j][0][i] = val[0][i]; - node->values[j][1][i] = dx[0][i]; - node->values[j][2][i] = dy[0][i]; + for (int i = 0; i < np; i++) + { + node->values[j][0][i] = val[0][i]; + node->values[j][1][i] = dx[0][i]; + node->values[j][2][i] = dy[0][i]; + } } } - - if (this->nodes->present(order)) - { - assert(this->nodes->get(order) == this->cur_node); - free_with_check(this->nodes->get(order)); - } - this->nodes->add(node, order); - this->cur_node = node; + this->values_valid = true; } template @@ -1033,11 +992,11 @@ namespace Hermes template LinearFilter::LinearFilter(MeshFunctionSharedPtr older, MeshFunctionSharedPtr old, double tau_frac) - : Filter(Hermes::vector >(older, old)) + : Filter({ older, old }) { - this->tau_frac = tau_frac; - init_components(); - } + this->tau_frac = tau_frac; + init_components(); + } template LinearFilter::~LinearFilter() @@ -1047,10 +1006,10 @@ namespace Hermes template void LinearFilter::init_components() { - this->num_components = this->sln[0]->get_num_components(); - for (int i = 1; i < this->num; i++) - if (this->sln[i]->get_num_components() != this->num_components) - throw Hermes::Exceptions::Exception("Filter: Solutions do not have the same number of components!"); + this->num_components = this->solutions[0]->get_num_components(); + for (int i = 1; i < this->solutions.size(); i++) + if (this->solutions[i]->get_num_components() != this->num_components) + throw Hermes::Exceptions::Exception("Filter: Solutions do not have the same number of components!"); } template @@ -1059,26 +1018,26 @@ namespace Hermes Filter::set_active_element(e); this->order = 0; - for (int i = 0; i < this->num; i++) + for (int i = 0; i < this->solutions.size(); i++) { - int o = this->sln[i]->get_fn_order(); + int o = this->solutions[i]->get_fn_order(); if (o > this->order) this->order = o; } } - template class HERMES_API Filter; - template class HERMES_API Filter >; - template class HERMES_API SimpleFilter; - template class HERMES_API SimpleFilter >; - template class HERMES_API DXDYFilter; - template class HERMES_API DXDYFilter >; - template class HERMES_API MagFilter; - template class HERMES_API MagFilter >; - template class HERMES_API DiffFilter; - template class HERMES_API DiffFilter >; - template class HERMES_API SumFilter; - template class HERMES_API SumFilter >; - template class HERMES_API SquareFilter; - template class HERMES_API SquareFilter >; + template class HERMES_API Filter < double > ; + template class HERMES_API Filter < std::complex > ; + template class HERMES_API SimpleFilter < double > ; + template class HERMES_API SimpleFilter < std::complex > ; + template class HERMES_API DXDYFilter < double > ; + template class HERMES_API DXDYFilter < std::complex > ; + template class HERMES_API MagFilter < double > ; + template class HERMES_API MagFilter < std::complex > ; + template class HERMES_API DiffFilter < double > ; + template class HERMES_API DiffFilter < std::complex > ; + template class HERMES_API SumFilter < double > ; + template class HERMES_API SumFilter < std::complex > ; + template class HERMES_API SquareFilter < double > ; + template class HERMES_API SquareFilter < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/function/function.cpp b/hermes2d/src/function/function.cpp index 2900ab3541..895c4f17a5 100644 --- a/hermes2d/src/function/function.cpp +++ b/hermes2d/src/function/function.cpp @@ -50,13 +50,13 @@ namespace Hermes } template - int Function::get_edge_fn_order(int edge) const + int Function::get_edge_fn_order(unsigned char) const { return order; } template - void Function::set_quad_order(unsigned int order, int mask) + void Function::set_quad_order(unsigned short order, unsigned short mask) { precalculate(order, mask); this->order = order; @@ -70,9 +70,9 @@ namespace Hermes } template - const Scalar* Function::get_values(int a, int b) const + const Scalar* Function::get_values(int component, int item) const { - return values[a][b]; + return values[component][item]; } template @@ -106,7 +106,7 @@ namespace Hermes } template - void Function::precalculate(int order, int mask) + void Function::precalculate(unsigned short order, unsigned short mask) { this->values_valid = true; } @@ -159,7 +159,7 @@ namespace Hermes } template - int Function::get_num_components() const + unsigned char Function::get_num_components() const { return num_components; } @@ -212,13 +212,13 @@ namespace Hermes Scalar* Function::deep_copy_array(int component, int item) const { assert(this->values_valid); - int np = this->quads[this->cur_quad]->get_num_points(this->order, this->element->get_mode()); + unsigned char np = this->quads[this->cur_quad]->get_num_points(this->order, this->element->get_mode()); Scalar* toReturn = malloc_with_check(np); - memcpy(toReturn, this->values[component][item], sizeof(Scalar)* np); + memcpy(toReturn, this->get_values(component, item), sizeof(Scalar)* np); return toReturn; } - template class HERMES_API Function; - template class HERMES_API Function >; + template class HERMES_API Function < double > ; + template class HERMES_API Function < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/function/mesh_function.cpp b/hermes2d/src/function/mesh_function.cpp index e05df61857..0597976e8b 100644 --- a/hermes2d/src/function/mesh_function.cpp +++ b/hermes2d/src/function/mesh_function.cpp @@ -41,29 +41,26 @@ namespace Hermes return dynamic_cast*>(this->get()); } - template class HERMES_API MeshFunctionSharedPtr; - template class HERMES_API MeshFunctionSharedPtr >; + template class HERMES_API MeshFunctionSharedPtr < double > ; + template class HERMES_API MeshFunctionSharedPtr < std::complex > ; template MeshFunction::MeshFunction() : Function() { - refmap = new RefMap; - this->element = nullptr; - } + this->element = nullptr; + } template MeshFunction::MeshFunction(MeshSharedPtr mesh) : Function() { - this->mesh = mesh; - this->refmap = new RefMap; - } + this->mesh = mesh; + } template MeshFunction::~MeshFunction() { - delete refmap; free(); } @@ -123,7 +120,7 @@ namespace Hermes } template - void MeshFunction::add(MeshFunctionSharedPtr other_mesh_function, SpaceSharedPtr target_space) + void MeshFunction::add(MeshFunctionSharedPtr& other_mesh_function, SpaceSharedPtr target_space) { throw Exceptions::MethodNotOverridenException("MeshFunction::add"); } @@ -257,14 +254,7 @@ namespace Hermes { if (update) this->update_refmap(); - return refmap; - } - - template - void MeshFunction::set_refmap(RefMap* refmap_to_set) - { - delete refmap; - this->refmap = refmap_to_set; + return &refmap; } template @@ -273,7 +263,7 @@ namespace Hermes if (quad_2d == nullptr) throw Exceptions::NullException(1); Function::set_quad_2d(quad_2d); - refmap->set_quad_2d(quad_2d); + refmap.set_quad_2d(quad_2d); } template @@ -284,16 +274,16 @@ namespace Hermes Function::set_active_element(e); mode = e->get_mode(); - refmap->set_active_element(e); + refmap.set_active_element(e); } template void MeshFunction::update_refmap() { - refmap->force_transform(this->sub_idx, this->ctm); + refmap.force_transform(this->sub_idx, this->ctm); } - template class HERMES_API MeshFunction; - template class HERMES_API MeshFunction >; + template class HERMES_API MeshFunction < double > ; + template class HERMES_API MeshFunction < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/function/postprocessing.cpp b/hermes2d/src/function/postprocessing.cpp index 5fef5f8635..4d74e52482 100644 --- a/hermes2d/src/function/postprocessing.cpp +++ b/hermes2d/src/function/postprocessing.cpp @@ -22,7 +22,7 @@ namespace Hermes } template - Limiter::Limiter(Hermes::vector > spaces, Scalar* solution_vector) : spaces(spaces), component_count(spaces.size()) + Limiter::Limiter(std::vector > spaces, Scalar* solution_vector) : spaces(spaces), component_count(spaces.size()) { this->init(solution_vector); } @@ -61,14 +61,14 @@ namespace Hermes warn_if(this->component_count > 1, "One solution asked from a Limiter, but multiple solutions exist for limiting."); MeshFunctionSharedPtr solution(new Solution()); - Hermes::vector > solutions; + std::vector > solutions; solutions.push_back(solution); this->get_solutions(solutions); return solutions.back(); } template - void Limiter::get_solutions(Hermes::vector > solutions) + void Limiter::get_solutions(std::vector > solutions) { if (solutions.size() != this->component_count) throw Exceptions::Exception("Limiter does not have correct number of spaces, solutions."); @@ -83,7 +83,7 @@ namespace Hermes } template - Hermes::vector Limiter::get_changed_element_ids() const + std::vector Limiter::get_changed_element_ids() const { return this->changed_element_ids; } @@ -123,14 +123,14 @@ namespace Hermes VertexBasedLimiter::VertexBasedLimiter(SpaceSharedPtr space, double* solution_vector, int maximum_polynomial_order) : Limiter(space, solution_vector) { - this->init(maximum_polynomial_order); - } + this->init(maximum_polynomial_order); + } - VertexBasedLimiter::VertexBasedLimiter(Hermes::vector > spaces, double* solution_vector, int maximum_polynomial_order) + VertexBasedLimiter::VertexBasedLimiter(std::vector > spaces, double* solution_vector, int maximum_polynomial_order) : Limiter(spaces, solution_vector) { - this->init(maximum_polynomial_order); - } + this->init(maximum_polynomial_order); + } void VertexBasedLimiter::set_p_coarsening_only() { @@ -145,7 +145,7 @@ namespace Hermes // Checking that this is the Taylor shapeset. for (int i = 0; i < this->component_count; i++) { - if (this->spaces[i]->get_shapeset()->get_id() != 31) + if (this->spaces[i]->get_shapeset()->get_id() != HERMES_L2_TAYLOR) throw Exceptions::Exception("VertexBasedLimiter designed for L2ShapesetTaylor. Ignore this exception for unforeseen problems."); } @@ -154,8 +154,6 @@ namespace Hermes // This is what is the key aspect of the necessity to use L2ShapesetTaylor (or any other one that uses P_{} also for quads). this->mixed_derivatives_count = (maximum_polynomial_order)*(maximum_polynomial_order + 1) / 2; - - this->print_details = false; } VertexBasedLimiter::~VertexBasedLimiter() @@ -163,12 +161,7 @@ namespace Hermes deallocate_vertex_values(); } - void VertexBasedLimiter::print_detailed_info(bool print_details_) - { - this->print_details = print_details_; - } - - Hermes::vector > VertexBasedLimiter::get_correction_factors() const + std::vector > VertexBasedLimiter::get_correction_factors() const { return this->correction_factors; } @@ -187,7 +180,7 @@ namespace Hermes Element* e; // Vector to remember if there was limiting of the second derivatives. - Hermes::vector quadratic_correction_done; + std::vector quadratic_correction_done; if (this->get_verbose_output()) std::cout << "Quadratic correction" << std::endl; @@ -219,7 +212,6 @@ namespace Hermes // Adjust the solutions according to the quadratic terms handling. Solution::vector_to_solutions(this->solution_vector, this->spaces, this->limited_solutions); - // 2. Linear // Prepare the vertex values for the linear part. prepare_min_max_vertex_values(false); @@ -281,21 +273,20 @@ namespace Hermes fraction = 1.; if (this->get_verbose_output()) std::cout << "\tcenter_value"; - } else - if (vertex_value > centroid_value_multiplied) - { + if (vertex_value > centroid_value_multiplied) + { fraction = std::min(1., (this->vertex_max_values[component][vertex->id][0] - centroid_value_multiplied) / (vertex_value - centroid_value_multiplied)); if (this->get_verbose_output()) std::cout << "\tmax_value: " << this->vertex_max_values[component][vertex->id][0]; - } - else - { - fraction = std::min(1., (this->vertex_min_values[component][vertex->id][0] - centroid_value_multiplied) / (vertex_value - centroid_value_multiplied)); - if (this->get_verbose_output()) - std::cout << "\tmin_value: " << this->vertex_min_values[component][vertex->id][0]; - } + } + else + { + fraction = std::min(1., (this->vertex_min_values[component][vertex->id][0] - centroid_value_multiplied) / (vertex_value - centroid_value_multiplied)); + if (this->get_verbose_output()) + std::cout << "\tmin_value: " << this->vertex_min_values[component][vertex->id][0]; + } correction_factor = std::min(correction_factor, fraction); } @@ -362,19 +353,18 @@ namespace Hermes fraction = 1.; } else - if (vertex_value > centroid_value_multiplied) - { + if (vertex_value > centroid_value_multiplied) + { fraction = std::min(1., (this->vertex_max_values[component][vertex->id][i_derivative] - centroid_value_multiplied) / (vertex_value - centroid_value_multiplied)); if (this->get_verbose_output()) std::cout << "\tmax_value: " << this->vertex_max_values[component][vertex->id][i_derivative]; - - } - else - { - fraction = std::min(1., (this->vertex_min_values[component][vertex->id][i_derivative] - centroid_value_multiplied) / (vertex_value - centroid_value_multiplied)); - if (this->get_verbose_output()) - std::cout << "\tmin_value: " << this->vertex_min_values[component][vertex->id][i_derivative]; - } + } + else + { + fraction = std::min(1., (this->vertex_min_values[component][vertex->id][i_derivative] - centroid_value_multiplied) / (vertex_value - centroid_value_multiplied)); + if (this->get_verbose_output()) + std::cout << "\tmin_value: " << this->vertex_min_values[component][vertex->id][i_derivative]; + } correction_factor = std::min(correction_factor, fraction); } @@ -586,14 +576,14 @@ namespace Hermes } template - IntegralCalculator::IntegralCalculator(Hermes::vector > source_functions, int number_of_integrals) : Hermes::Mixins::Loggable(false), source_functions(source_functions), number_of_integrals(number_of_integrals) + IntegralCalculator::IntegralCalculator(std::vector > source_functions, int number_of_integrals) : Hermes::Mixins::Loggable(false), source_functions(source_functions), number_of_integrals(number_of_integrals) { } template Scalar* IntegralCalculator::calculate(std::string marker) { - Hermes::vector markers; + std::vector markers; markers.push_back(marker); return this->calculate(markers); } @@ -624,23 +614,23 @@ namespace Hermes } template - VolumetricIntegralCalculator::VolumetricIntegralCalculator(Hermes::vector > source_functions, int number_of_integrals) : IntegralCalculator(source_functions, number_of_integrals) + VolumetricIntegralCalculator::VolumetricIntegralCalculator(std::vector > source_functions, int number_of_integrals) : IntegralCalculator(source_functions, number_of_integrals) { } template - Scalar* VolumetricIntegralCalculator::calculate(Hermes::vector markers) + Scalar* VolumetricIntegralCalculator::calculate(std::vector markers) { #ifdef _DEBUG this->info("User markers"); - for (int i = 0; i < markers.size(); i++) + for (unsigned short i = 0; i < markers.size(); i++) this->info("\t%s", markers[i].c_str()); #endif // This serves for assembling over the whole domain in the case a passed marker is HERMES_ANY. bool assemble_everywhere = false; - Hermes::vector internal_markers; - for (int i = 0; i < markers.size(); i++) + std::vector internal_markers; + for (unsigned short i = 0; i < markers.size(); i++) { if (markers[i] == HERMES_ANY) { @@ -649,7 +639,6 @@ namespace Hermes } else { - Hermes::Hermes2D::Mesh::MarkersConversion::IntValid internalMarker = this->source_functions[0]->get_mesh()->get_element_markers_conversion().get_internal_marker(markers[i]); if (internalMarker.valid) internal_markers.push_back(internalMarker.marker); @@ -663,14 +652,14 @@ namespace Hermes #ifdef _DEBUG this->info("Internal markers"); - for (int i = 0; i < internal_markers.size(); i++) + for (unsigned short i = 0; i < internal_markers.size(); i++) this->info("\t%i", internal_markers[i]); #endif int source_functions_size = this->source_functions.size(); Traverse trav(source_functions_size); - int num_states; + unsigned int num_states; Traverse::State** states = trav.get_states(this->source_functions, num_states); for (int i = 0; i < source_functions_size; i++) @@ -700,7 +689,7 @@ namespace Hermes Scalar* result_thread_local = calloc_with_check(this->number_of_integrals); Scalar* result_local = malloc_with_check(this->number_of_integrals); - double* jacobian_x_weights; + double jacobian_x_weights[H2D_MAX_INTEGRATION_POINTS_COUNT]; for (int state_i = start; state_i < end; state_i++) { @@ -712,7 +701,7 @@ namespace Hermes if (!assemble_everywhere) { bool target_marker = false; - for (int i = 0; i < internal_markers.size(); i++) + for (unsigned short i = 0; i < internal_markers.size(); i++) { if (current_state->rep->marker == internal_markers[i]) { @@ -730,11 +719,11 @@ namespace Hermes for (int i = 0; i < source_functions_size; i++) { if (current_state->e[i]) - if (current_state->e[i]->used) - { + if (current_state->e[i]->used) + { source_functions_cloned[i]->set_active_element(current_state->e[i]); source_functions_cloned[i]->set_transform(current_state->sub_idx[i]); - } + } } refmap->set_active_element(current_state->rep); @@ -749,12 +738,12 @@ namespace Hermes if (current_state->e[i]) { if (current_state->e[i]->used) - func_ord[i] = init_fn_ord(source_functions_cloned[i]->get_fn_order()); + func_ord[i] = new Func(source_functions_cloned[i]->get_fn_order()); else - func_ord[i] = init_fn_ord(0); + func_ord[i] = new Func(0); } else - func_ord[i] = init_fn_ord(0); + func_ord[i] = new Func(0); } this->order(func_ord, orders); @@ -778,29 +767,25 @@ namespace Hermes func[i] = init_zero_fn(current_state->rep->get_mode(), order_int); } - Geom* geometry; - int n = init_geometry_points(&refmap, 1, order_int, geometry, jacobian_x_weights); - - this->integral(n, jacobian_x_weights, func, geometry, result_local); + GeomVol geometry; + unsigned char n = init_geometry_points_allocated(refmap, order_int, geometry, jacobian_x_weights); - geometry->free(); - delete geometry; - delete[] jacobian_x_weights; + this->integral(n, jacobian_x_weights, func, &geometry, result_local); - for (int i = 0; i < source_functions_size; i++) + for (unsigned short i = 0; i < source_functions_size; i++) { delete func_ord[i]; delete func[i]; } - for (int i = 0; i < this->number_of_integrals; i++) + for (unsigned short i = 0; i < this->number_of_integrals; i++) result_thread_local[i] += result_local[i]; } this->add_results(result_thread_local, result); free_with_check(result_thread_local); - for (int i = 0; i < source_functions_size; i++) + for (unsigned short i = 0; i < source_functions_size; i++) delete source_functions_cloned[i]; free_with_check(source_functions_cloned); free_with_check(orders); @@ -812,7 +797,7 @@ namespace Hermes for (int i = 0; i < num_states; i++) delete states[i]; - free(states); + free_with_check(states); return result; } @@ -823,23 +808,23 @@ namespace Hermes } template - SurfaceIntegralCalculator::SurfaceIntegralCalculator(Hermes::vector > source_functions, int number_of_integrals) : IntegralCalculator(source_functions, number_of_integrals) + SurfaceIntegralCalculator::SurfaceIntegralCalculator(std::vector > source_functions, int number_of_integrals) : IntegralCalculator(source_functions, number_of_integrals) { } template - Scalar* SurfaceIntegralCalculator::calculate(Hermes::vector markers) + Scalar* SurfaceIntegralCalculator::calculate(std::vector markers) { #ifdef _DEBUG this->info("User markers"); - for (int i = 0; i < markers.size(); i++) + for (unsigned short i = 0; i < markers.size(); i++) this->info("\t%s", markers[i].c_str()); #endif // This serves for assembling over the whole domain in the case a passed marker is HERMES_ANY. bool assemble_everywhere = false; - Hermes::vector internal_markers; - for (int i = 0; i < markers.size(); i++) + std::vector internal_markers; + for (unsigned short i = 0; i < markers.size(); i++) { if (markers[i] == HERMES_ANY) { @@ -861,13 +846,13 @@ namespace Hermes #ifdef _DEBUG this->info("Internal markers"); - for (int i = 0; i < internal_markers.size(); i++) + for (unsigned short i = 0; i < internal_markers.size(); i++) this->info("\t%i", internal_markers[i]); #endif int source_functions_size = this->source_functions.size(); Traverse trav(source_functions_size); - int num_states; + unsigned int num_states; Traverse::State** states = trav.get_states(this->source_functions, num_states); for (int i = 0; i < source_functions_size; i++) @@ -898,7 +883,7 @@ namespace Hermes Scalar* result_thread_local = calloc_with_check(this->number_of_integrals); Scalar* result_local = malloc_with_check(this->number_of_integrals); - double* jacobian_x_weights; + double jacobian_x_weights[H2D_MAX_INTEGRATION_POINTS_COUNT]; for (int state_i = start; state_i < end; state_i++) { @@ -909,21 +894,21 @@ namespace Hermes Traverse::State* current_state = states[state_i]; // Set active element. - for (int i = 0; i < source_functions_size; i++) + for (unsigned short i = 0; i < source_functions_size; i++) { if (current_state->e[i]) - if (current_state->e[i]->used) - { + if (current_state->e[i]->used) + { source_functions_cloned[i]->set_active_element(current_state->e[i]); source_functions_cloned[i]->set_transform(current_state->sub_idx[i]); - } + } } refmap->set_active_element(current_state->rep); Hermes::Ord order = Hermes::Ord(refmap->get_inv_ref_order()); - for (int edge = 0; edge < current_state->rep->nvert; edge++) + for (unsigned short edge = 0; edge < current_state->rep->nvert; edge++) { #ifdef _DEBUG this->info("Thread %i, state %i, edge %i", thread_number, state_i, edge); @@ -931,7 +916,7 @@ namespace Hermes if (!assemble_everywhere) { bool target_marker = false; - for (int i = 0; i < internal_markers.size(); i++) + for (unsigned short i = 0; i < internal_markers.size(); i++) { if (current_state->rep->en[edge]->marker == internal_markers[i]) { @@ -949,7 +934,7 @@ namespace Hermes for (int i = 0; i < this->number_of_integrals; i++) orders[i] = Hermes::Ord(0); for (int i = 0; i < source_functions_size; i++) - func_ord[i] = init_fn_ord(source_functions_cloned[i]->get_fn_order()); + func_ord[i] = new Func(source_functions_cloned[i]->get_fn_order()); this->order(func_ord, orders); @@ -959,8 +944,8 @@ namespace Hermes int order_int = order.get_order(); limit_order(order_int, refmap->get_active_element()->get_mode()); - Geom* geometry; - int n = init_surface_geometry_points(&refmap, 1, order_int, edge, current_state->rep->en[edge]->marker, geometry, jacobian_x_weights); + GeomSurf geometry; + int n = init_surface_geometry_points_allocated(refmap, order_int, edge, current_state->rep->en[edge]->marker, geometry, jacobian_x_weights); for (int i = 0; i < source_functions_size; i++) { @@ -975,11 +960,7 @@ namespace Hermes func[i] = init_zero_fn(current_state->rep->get_mode(), order_int); } - this->integral(n, jacobian_x_weights, func, geometry, result_local); - - geometry->free(); - delete geometry; - delete[] jacobian_x_weights; + this->integral(n, jacobian_x_weights, func, &geometry, result_local); for (int i = 0; i < source_functions_size; i++) { @@ -1012,12 +993,12 @@ namespace Hermes return result; } - template class HERMES_API Limiter; - template class HERMES_API VolumetricIntegralCalculator; - template class HERMES_API SurfaceIntegralCalculator; - template class HERMES_API Limiter >; - template class HERMES_API VolumetricIntegralCalculator >; - template class HERMES_API SurfaceIntegralCalculator >; + template class HERMES_API Limiter < double > ; + template class HERMES_API VolumetricIntegralCalculator < double > ; + template class HERMES_API SurfaceIntegralCalculator < double > ; + template class HERMES_API Limiter < std::complex > ; + template class HERMES_API VolumetricIntegralCalculator < std::complex > ; + template class HERMES_API SurfaceIntegralCalculator < std::complex > ; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/function/solution.cpp b/hermes2d/src/function/solution.cpp index a2e3a98b1e..ba98182544 100644 --- a/hermes2d/src/function/solution.cpp +++ b/hermes2d/src/function/solution.cpp @@ -27,11 +27,11 @@ namespace Hermes { static double3* cheb_tab_tri[11]; static double3* cheb_tab_quad[11]; - static int cheb_np_tri[11]; - static int cheb_np_quad[11]; + static unsigned char cheb_np_tri[11]; + static unsigned char cheb_np_quad[11]; static double3** cheb_tab[2] = { cheb_tab_tri, cheb_tab_quad }; - static int* cheb_np[2] = { cheb_np_tri, cheb_np_quad }; + static unsigned char* cheb_np[2] = { cheb_np_tri, cheb_np_quad }; static class Quad2DCheb : public Quad2D { @@ -57,11 +57,11 @@ namespace Hermes tables[mode_i][k] = pt = malloc_with_check(n); for (i = k, m = 0; i >= 0; i--) - for (j = k; j >= (mode_i ? 0 : k - i); j--, m++) { + for (j = k; j >= (mode_i ? 0 : k - i); j--, m++) { pt[m][0] = k ? cos(j * M_PI / k) : 1.0; pt[m][1] = k ? cos(i * M_PI / k) : 1.0; pt[m][2] = 1.0; - } + } } } }; @@ -69,10 +69,15 @@ namespace Hermes ~Quad2DCheb() { for (int mode_i = 0; mode_i <= 1; mode_i++) - for (int k = 1; k <= 10; k++) - free_with_check(tables[mode_i][k]); + for (int k = 1; k <= 10; k++) + free_with_check(tables[mode_i][k]); } + virtual unsigned char get_id() + { + return 3; + }; + virtual void dummy_fn() {} } g_quad_2d_cheb; @@ -106,17 +111,17 @@ namespace Hermes Solution::Solution() : MeshFunction() { - space_type = HERMES_INVALID_SPACE; - this->init(); - } + space_type = HERMES_INVALID_SPACE; + this->init(); + } template<> Solution >::Solution() : MeshFunction >() { - space_type = HERMES_INVALID_SPACE; - this->init(); - } + space_type = HERMES_INVALID_SPACE; + this->init(); + } template<> Solution::Solution(MeshSharedPtr mesh) : MeshFunction(mesh) @@ -243,7 +248,7 @@ namespace Hermes public: // this is a set of LU-decomposed matrices shared by all Solutions double** mat[2][11]; - int* perm[2][11]; + unsigned char* perm[2][11]; mono_lu_init() { @@ -272,13 +277,14 @@ namespace Hermes mono_lu; template - double** Solution::calc_mono_matrix(int mode, int o) + double** Solution::calc_mono_matrix(int mode, unsigned char o) { if (mono_lu.mat[mode][o] == nullptr) { - int i, j, k, l, m, row; + unsigned char i, j, m, row; + char k, l; double x, y, xn, yn; - int n = this->mode ? sqr(o + 1) : (o + 1)*(o + 2) / 2; + unsigned char n = this->mode ? sqr(o + 1) : (o + 1)*(o + 2) / 2; // loop through all chebyshev points mono_lu.mat[mode][o] = new_matrix(n, n); @@ -291,14 +297,14 @@ namespace Hermes // each row of the matrix contains all the monomials x^i*y^j for (i = 0, yn = 1.0, m = n - 1; i <= o; i++, yn *= y) - for (j = (this->mode ? 0 : i), xn = 1.0; j <= o; j++, xn *= x, m--) - mono_lu.mat[mode][o][row][m] = xn * yn; + for (j = (this->mode ? 0 : i), xn = 1.0; j <= o; j++, xn *= x, m--) + mono_lu.mat[mode][o][row][m] = xn * yn; } } double d; if (mono_lu.perm[mode][o] == nullptr) - mono_lu.perm[mode][o] = malloc_with_check, int>(n, this); + mono_lu.perm[mode][o] = malloc_with_check, unsigned char>(n, this); ludcmp(mono_lu.mat[mode][o], n, mono_lu.perm[mode][o], &d); } @@ -320,51 +326,31 @@ namespace Hermes } template - void Solution::set_coeff_vector(SpaceSharedPtr space, const Scalar* coeffs, - bool add_dir_lift, int start_index) - { - // Initialize precalc shapeset using the space's shapeset. - Shapeset *shapeset = space->shapeset; - if (space->shapeset == nullptr) - throw Exceptions::Exception("Space->shapeset == nullptr in Solution::set_coeff_vector()."); - PrecalcShapeset *pss = new PrecalcShapeset(shapeset); - if (pss == nullptr) - throw Exceptions::Exception("PrecalcShapeset could not be allocated in Solution::set_coeff_vector()."); - set_coeff_vector(space, pss, coeffs, add_dir_lift, start_index); - delete pss; - } - - template - void Solution::set_coeff_vector(SpaceSharedPtr space, PrecalcShapeset* pss, + void Solution::set_coeff_vector(SpaceSharedPtr space, const Scalar* coeff_vec, bool add_dir_lift, int start_index) { - int o; + PrecalcShapeset pss(space->shapeset); + if (Solution::static_verbose_output) Hermes::Mixins::Loggable::Static::info("Solution: set_coeff_vector called."); + // Sanity checks. if (space->get_mesh() == nullptr) throw Exceptions::Exception("Mesh == nullptr in Solution::set_coeff_vector()."); - if (pss == nullptr) throw Exceptions::NullException(2); - if (coeff_vec == nullptr) - throw Exceptions::NullException(3); - if (coeff_vec == nullptr) - throw Exceptions::Exception("Coefficient vector == nullptr in Solution::set_coeff_vector()."); + Helpers::check_for_null(space->get_mesh()); + Helpers::check_for_null(coeff_vec); + if (!space->is_up_to_date()) throw Exceptions::Exception("Provided 'space' is not up to date."); - if (space->shapeset != pss->shapeset) - throw Exceptions::Exception("Provided 'space' and 'pss' must have the same shapesets."); if (Solution::static_verbose_output) Hermes::Mixins::Loggable::Static::info("Solution: set_coeff_vector - solution being freed."); - free(); + this->free(); this->space_type = space->get_type(); - - this->num_components = pss->get_num_components(); - sln_type = HERMES_SLN; - - // Copy the mesh. + this->num_components = pss.get_num_components(); + this->sln_type = HERMES_SLN; this->mesh = space->get_mesh(); // Allocate the coefficient arrays. @@ -379,6 +365,7 @@ namespace Hermes // Obtain element orders, allocate mono_coeffs. Element* e; + int o; num_coeffs = 0; for_all_active_elements(e, this->mesh) { @@ -394,8 +381,8 @@ namespace Hermes // Hcurl and Hdiv: actual order of functions is one higher than element order if (space->shapeset->get_num_components() == 2) - if (o < space->shapeset->get_max_order()) - o++; + if (o < space->shapeset->get_max_order()) + o++; num_coeffs += this->mode ? sqr(o + 1) : (o + 1)*(o + 2) / 2; elem_orders[e->id] = o; @@ -406,17 +393,17 @@ namespace Hermes // Express the solution on elements as a linear combination of monomials. Quad2D* quad = &g_quad_2d_cheb; - pss->set_quad_2d(quad); + pss.set_quad_2d(quad); Scalar* mono = mono_coeffs; for_all_active_elements(e, this->mesh) { this->mode = e->get_mode(); o = elem_orders[e->id]; - int np = quad->get_num_points(o, e->get_mode()); + unsigned char np = quad->get_num_points(o, e->get_mode()); AsmList al; space->get_element_assembly_list(e, &al); - pss->set_active_element(e); + pss.set_active_element(e); for (int l = 0; l < this->num_components; l++) { @@ -426,15 +413,15 @@ namespace Hermes memset(val, 0, sizeof(Scalar)*np); for (unsigned int k = 0; k < al.cnt; k++) { - pss->set_active_shape(al.idx[k]); - pss->set_quad_order(o, H2D_FN_VAL); + pss.set_active_shape(al.idx[k]); + pss.set_quad_order(o, H2D_FN_VAL); int dof = al.dof[k]; double dir_lift_coeff = add_dir_lift ? 1.0 : 0.0; // By subtracting space->first_dof we make sure that it does not matter where the // enumeration of dofs in the space starts. This ca be either zero or there can be some // offset. By adding start_index we move to the desired section of coeff_vec. Scalar coef = al.coef[k] * (dof >= 0 ? coeff_vec[dof - space->first_dof + start_index] : dir_lift_coeff); - const double* shape = pss->get_fn_values(l); + const double* shape = pss.get_fn_values(l); for (int i = 0; i < np; i++) val[i] += shape[i] * coef; } @@ -442,11 +429,10 @@ namespace Hermes // solve for the monomial coefficients calc_mono_matrix(this->mode, o); - lubksb(mono_lu.mat[this->mode][o], np, mono_lu.perm[this->mode][o], val); + lubksb(mono_lu.mat[this->mode][o], np, mono_lu.perm[this->mode][o], val); } } - if (this->mesh == nullptr) throw Hermes::Exceptions::Exception("mesh == nullptr"); init_dxdy_buffer(); this->element = nullptr; if (Solution::static_verbose_output) @@ -455,20 +441,18 @@ namespace Hermes template void Solution::vector_to_solutions(const Scalar* solution_vector, - Hermes::vector > spaces, Hermes::vector > solutions, - Hermes::vector add_dir_lift, Hermes::vector start_indices) + std::vector > spaces, std::vector > solutions, + std::vector add_dir_lift, std::vector start_indices) { - if (solution_vector == nullptr) - throw Exceptions::NullException(1); - if (spaces.size() != solutions.size()) - throw Exceptions::LengthException(2, 3, spaces.size(), solutions.size()); + Helpers::check_for_null(solution_vector); + Helpers::check_length(solutions, spaces); // If start indices are not given, calculate them using the dimension of each space. - Hermes::vector start_indices_new; + std::vector start_indices_new; if (start_indices.empty()) { int counter = 0; - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { start_indices_new.push_back(counter); counter += spaces[i]->get_num_dofs(); @@ -477,18 +461,18 @@ namespace Hermes else { if (start_indices.size() != spaces.size()) throw Hermes::Exceptions::Exception("Mismatched start indices in vector_to_solutions()."); - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { start_indices_new.push_back(start_indices[i]); } } - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { if (Solution::static_verbose_output) Hermes::Mixins::Loggable::Static::info("Vector to Solution: %d-th solution", i); - if (add_dir_lift == Hermes::vector()) + if (add_dir_lift == std::vector()) Solution::vector_to_solution(solution_vector, spaces[i], solutions[i], true, start_indices_new[i]); else Solution::vector_to_solution(solution_vector, spaces[i], solutions[i], add_dir_lift[i], start_indices_new[i]); @@ -499,10 +483,7 @@ namespace Hermes void Solution::vector_to_solution(const Scalar* solution_vector, SpaceSharedPtr space, Solution* solution, bool add_dir_lift, int start_index) { - // Sanity checks. - if (solution_vector == nullptr) - throw Exceptions::NullException(1); - + Helpers::check_for_null(solution_vector); solution->set_coeff_vector(space, solution_vector, add_dir_lift, start_index); } @@ -510,9 +491,7 @@ namespace Hermes void Solution::vector_to_solution(const Scalar* solution_vector, SpaceSharedPtr space, MeshFunctionSharedPtr solution, bool add_dir_lift, int start_index) { - // Sanity checks. - if (solution_vector == nullptr) - throw Exceptions::NullException(1); + Helpers::check_for_null(solution_vector); Solution* sln = dynamic_cast*>(solution.get()); if (sln == nullptr) @@ -522,20 +501,18 @@ namespace Hermes } template - void Solution::vector_to_solutions(const Vector* solution_vector, Hermes::vector > spaces, - Hermes::vector > solutions, Hermes::vector add_dir_lift, Hermes::vector start_indices) + void Solution::vector_to_solutions(const Vector* solution_vector, std::vector > spaces, + std::vector > solutions, std::vector add_dir_lift, std::vector start_indices) { - if (solution_vector == nullptr) - throw Exceptions::NullException(1); - if (spaces.size() != solutions.size()) - throw Exceptions::LengthException(2, 3, spaces.size(), solutions.size()); + Helpers::check_for_null(solution_vector); + Helpers::check_length(solutions, spaces); // If start indices are not given, calculate them using the dimension of each space. - Hermes::vector start_indices_new; + std::vector start_indices_new; if (start_indices.empty()) { int counter = 0; - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { start_indices_new.push_back(counter); counter += spaces[i]->get_num_dofs(); @@ -544,18 +521,18 @@ namespace Hermes else { if (start_indices.size() != spaces.size()) throw Hermes::Exceptions::Exception("Mismatched start indices in vector_to_solutions()."); - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { start_indices_new.push_back(start_indices[i]); } } - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { if (Solution::static_verbose_output) Hermes::Mixins::Loggable::Static::info("Vector to Solution: %d-th solution", i); - if (add_dir_lift == Hermes::vector()) + if (add_dir_lift == std::vector()) Solution::vector_to_solution(solution_vector, spaces[i], solutions[i], true, start_indices_new[i]); else Solution::vector_to_solution(solution_vector, spaces[i], solutions[i], add_dir_lift[i], start_indices_new[i]); @@ -563,24 +540,22 @@ namespace Hermes } template - void Solution::vector_to_solutions_common_dir_lift(const Vector* solution_vector, Hermes::vector > spaces, - Hermes::vector > solutions, bool add_dir_lift) + void Solution::vector_to_solutions_common_dir_lift(const Vector* solution_vector, std::vector > spaces, + std::vector > solutions, bool add_dir_lift) { - if (solution_vector == nullptr) - throw Exceptions::NullException(1); - if (spaces.size() != solutions.size()) - throw Exceptions::LengthException(2, 3, spaces.size(), solutions.size()); + Helpers::check_for_null(solution_vector); + Helpers::check_length(spaces, solutions); // If start indices are not given, calculate them using the dimension of each space. - Hermes::vector start_indices_new; + std::vector start_indices_new; int counter = 0; - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { start_indices_new.push_back(counter); counter += spaces[i]->get_num_dofs(); } - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { if (Solution::static_verbose_output) Hermes::Mixins::Loggable::Static::info("Vector to Solution: %d-th solution", i); @@ -590,24 +565,22 @@ namespace Hermes } template - void Solution::vector_to_solutions_common_dir_lift(const Scalar* solution_vector, Hermes::vector > spaces, - Hermes::vector > solutions, bool add_dir_lift) + void Solution::vector_to_solutions_common_dir_lift(const Scalar* solution_vector, std::vector > spaces, + std::vector > solutions, bool add_dir_lift) { - if (solution_vector == nullptr) - throw Exceptions::NullException(1); - if (spaces.size() != solutions.size()) - throw Exceptions::LengthException(2, 3, spaces.size(), solutions.size()); + Helpers::check_for_null(solution_vector); + Helpers::check_length(solutions, spaces); // If start indices are not given, calculate them using the dimension of each space. - Hermes::vector start_indices_new; + std::vector start_indices_new; int counter = 0; - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { start_indices_new.push_back(counter); counter += spaces[i]->get_num_dofs(); } - for (int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { if (Solution::static_verbose_output) Hermes::Mixins::Loggable::Static::info("Vector to Solution: %d-th solution", i); @@ -621,8 +594,7 @@ namespace Hermes MeshFunctionSharedPtr solution, bool add_dir_lift, int start_index) { // Sanity checks. - if (solution_vector == nullptr) - throw Exceptions::NullException(1); + Helpers::check_for_null(solution_vector); Solution* sln = dynamic_cast*>(solution.get()); if (sln == nullptr) @@ -632,66 +604,7 @@ namespace Hermes } template - void Solution::vector_to_solutions(const Scalar* solution_vector, Hermes::vector > spaces, - Hermes::vector > solutions, Hermes::vector pss, - Hermes::vector add_dir_lift, Hermes::vector start_indices) - { - if (solution_vector == nullptr) - throw Exceptions::NullException(1); - if (spaces.size() != solutions.size()) - throw Exceptions::LengthException(2, 3, spaces.size(), solutions.size()); - - // If start indices are not given, calculate them using the dimension of each space. - Hermes::vector start_indices_new; - if (start_indices.empty()) - { - int counter = 0; - for (int i = 0; i < spaces.size(); i++) - { - start_indices_new.push_back(counter); - counter += spaces[i]->get_num_dofs(); - } - } - else - { - if (start_indices.size() != spaces.size()) - throw Hermes::Exceptions::Exception("Mismatched start indices in vector_to_solutions()."); - for (int i = 0; i < spaces.size(); i++) - { - start_indices_new.push_back(start_indices[i]); - } - } - - for (int i = 0; i < spaces.size(); i++) - { - if (Solution::static_verbose_output) - Hermes::Mixins::Loggable::Static::info("Vector to Solution: %d-th solution", i); - - if (add_dir_lift == Hermes::vector()) - Solution::vector_to_solution(solution_vector, spaces[i], solutions[i], true, start_indices_new[i]); - else - Solution::vector_to_solution(solution_vector, spaces[i], solutions[i], add_dir_lift[i], start_indices_new[i]); - } - } - - template - void Solution::vector_to_solution(const Scalar* solution_vector, SpaceSharedPtr space, MeshFunctionSharedPtr solution, - PrecalcShapeset* pss, bool add_dir_lift, int start_index) - { - if (solution_vector == nullptr) - throw Exceptions::NullException(1); - if (pss == nullptr) - throw Exceptions::NullException(4); - - Solution* sln = dynamic_cast*>(solution.get()); - if (sln == nullptr) - throw Exceptions::Exception("Passed solution is in fact not a Solution instance in vector_to_solution()."); - - sln->set_coeff_vector(space, pss, solution_vector, add_dir_lift, start_index); - } - - template - void Solution::set_dirichlet_lift(SpaceSharedPtr space, PrecalcShapeset* pss) + void Solution::set_dirichlet_lift(SpaceSharedPtr space) { space_type = space->get_type(); int ndof = space->get_num_dofs(); @@ -699,7 +612,7 @@ namespace Hermes memset(temp, 0, sizeof(Scalar)*ndof); bool add_dir_lift = true; int start_index = 0; - this->set_coeff_vector(space, pss, temp, add_dir_lift, start_index); + this->set_coeff_vector(space, temp, add_dir_lift, start_index); free_with_check(temp); } @@ -712,7 +625,7 @@ namespace Hermes } template - void Solution::add(MeshFunctionSharedPtr other_mesh_function, SpaceSharedPtr target_space) + void Solution::add(MeshFunctionSharedPtr& other_mesh_function, SpaceSharedPtr target_space) { Scalar* base_vector = malloc_with_check, Scalar>(target_space->get_num_dofs(), this); Scalar* added_vector = malloc_with_check, Scalar>(target_space->get_num_dofs(), this); @@ -762,8 +675,8 @@ namespace Hermes for (j = 0; j <= o; j++) *result++ = 0.0; for (i = 0; i < o; i++) - for (j = 0; j <= o; j++) - *result++ = (Scalar)(o - i) * (*mono++); + for (j = 0; j <= o; j++) + *result++ = (Scalar)(o - i) * (*mono++); } else { for (i = 0; i <= o; i++) @@ -850,8 +763,8 @@ namespace Hermes if ((newmask & H2D_SECOND) == H2D_SECOND) { this->update_refmap(); - mat = this->refmap->get_inv_ref_map(order); - double3x2 *mm, *mat2 = this->refmap->get_second_ref_map(order); + mat = this->refmap.get_inv_ref_map(order); + double3x2 *mm, *mat2 = this->refmap.get_second_ref_map(order); for (i = 0, m = mat, mm = mat2; i < np; i++, m++, mm++) { Scalar vx = this->values[0][1][i]; @@ -860,17 +773,20 @@ namespace Hermes Scalar vyy = this->values[0][4][i]; Scalar vxy = this->values[0][5][i]; - this->values[0][3][i] = sqr((*m)[0][0])*vxx + 2 * (*m)[0][1] * (*m)[0][0] * vxy + sqr((*m)[0][1])*vyy + (*mm)[0][0] * vx + (*mm)[0][1] * vy; // dxx - this->values[0][4][i] = sqr((*m)[1][0])*vxx + 2 * (*m)[1][1] * (*m)[1][0] * vxy + sqr((*m)[1][1])*vyy + (*mm)[2][0] * vx + (*mm)[2][1] * vy; // dyy - this->values[0][5][i] = (*m)[0][0] * (*m)[1][0] * vxx + ((*m)[0][0] * (*m)[1][1] + (*m)[1][0] * (*m)[0][1])*vxy + (*m)[0][1] * (*m)[1][1] * vyy + (*mm)[1][0] * vx + (*mm)[1][1] * vy; //dxy + // dxx + this->values[0][3][i] = sqr((*m)[0][0])*vxx + 2 * (*m)[0][1] * (*m)[0][0] * vxy + sqr((*m)[0][1])*vyy + (*mm)[0][0] * vx + (*mm)[0][1] * vy; + // dyy + this->values[0][4][i] = sqr((*m)[1][0])*vxx + 2 * (*m)[1][1] * (*m)[1][0] * vxy + sqr((*m)[1][1])*vyy + (*mm)[2][0] * vx + (*mm)[2][1] * vy; + //dxy + this->values[0][5][i] = (*m)[0][0] * (*m)[1][0] * vxx + ((*m)[0][0] * (*m)[1][1] + (*m)[1][0] * (*m)[0][1])*vxy + (*m)[0][1] * (*m)[1][1] * vyy + (*mm)[1][0] * vx + (*mm)[1][1] * vy; } } #endif if ((mask & H2D_GRAD) == H2D_GRAD) { this->update_refmap(); - mat = this->refmap->get_const_inv_ref_map(); - if (!this->refmap->is_jacobian_const()) { mat = this->refmap->get_inv_ref_map(order); mstep = 1; } + mat = this->refmap.get_const_inv_ref_map(); + if (!this->refmap.is_jacobian_const()) { mat = this->refmap.get_inv_ref_map(order); mstep = 1; } for (i = 0, m = mat; i < np; i++, m += mstep) { @@ -885,26 +801,26 @@ namespace Hermes // Hcurl space else if (space_type == HERMES_HCURL_SPACE) { - this->update_refmap(); - mat = this->refmap->get_const_inv_ref_map(); - if (!this->refmap->is_jacobian_const()) { mat = this->refmap->get_inv_ref_map(order); mstep = 1; } + this->update_refmap(); + mat = this->refmap.get_const_inv_ref_map(); + if (!this->refmap.is_jacobian_const()) { mat = this->refmap.get_inv_ref_map(order); mstep = 1; } - for (i = 0, m = mat; i < np; i++, m += mstep) + for (i = 0, m = mat; i < np; i++, m += mstep) + { + if ((mask & H2D_FN_VAL) == H2D_FN_VAL) { - if ((mask & H2D_FN_VAL) == H2D_FN_VAL) - { - Scalar vx = this->values[0][0][i]; - Scalar vy = this->values[1][0][i]; - this->values[0][0][i] = (*m)[0][0] * vx + (*m)[0][1] * vy; - this->values[1][0][i] = (*m)[1][0] * vx + (*m)[1][1] * vy; - } - if ((mask & H2D_CURL) == H2D_CURL) - { - Scalar e0x = this->values[0][1][i], e0y = this->values[0][2][i]; - Scalar e1x = this->values[1][1][i], e1y = this->values[1][2][i]; - this->values[1][1][i] = (*m)[0][0] * ((*m)[1][0] * e0x + (*m)[1][1] * e1x) + (*m)[0][1] * ((*m)[1][0] * e0y + (*m)[1][1] * e1y); - this->values[0][2][i] = (*m)[1][0] * ((*m)[0][0] * e0x + (*m)[0][1] * e1x) + (*m)[1][1] * ((*m)[0][0] * e0y + (*m)[0][1] * e1y); - } + Scalar vx = this->values[0][0][i]; + Scalar vy = this->values[1][0][i]; + this->values[0][0][i] = (*m)[0][0] * vx + (*m)[0][1] * vy; + this->values[1][0][i] = (*m)[1][0] * vx + (*m)[1][1] * vy; + } + if ((mask & H2D_CURL) == H2D_CURL) + { + Scalar e0x = this->values[0][1][i], e0y = this->values[0][2][i]; + Scalar e1x = this->values[1][1][i], e1y = this->values[1][2][i]; + this->values[1][1][i] = (*m)[0][0] * ((*m)[1][0] * e0x + (*m)[1][1] * e1x) + (*m)[0][1] * ((*m)[1][0] * e0y + (*m)[1][1] * e1y); + this->values[0][2][i] = (*m)[1][0] * ((*m)[0][0] * e0x + (*m)[0][1] * e1x) + (*m)[1][1] * ((*m)[0][0] * e0y + (*m)[0][1] * e1y); + } } } @@ -914,8 +830,8 @@ namespace Hermes if ((mask & H2D_FN_VAL) == H2D_FN_VAL) { this->update_refmap(); - mat = this->refmap->get_const_inv_ref_map(); - if (!this->refmap->is_jacobian_const()) { mat = this->refmap->get_inv_ref_map(order); mstep = 1; } + mat = this->refmap.get_const_inv_ref_map(); + if (!this->refmap.is_jacobian_const()) { mat = this->refmap.get_inv_ref_map(order); mstep = 1; } for (i = 0, m = mat; i < np; i++, m += mstep) { @@ -929,11 +845,11 @@ namespace Hermes } template - void Solution::precalculate(int order, int mask) + void Solution::precalculate(unsigned short order, unsigned short mask) { int i, j, k, l; Quad2D* quad = this->quads[this->cur_quad]; - int np = quad->get_num_points(order, this->mode); + unsigned char np = quad->get_num_points(order, this->mode); if (sln_type == HERMES_SLN) { @@ -1004,10 +920,10 @@ namespace Hermes { if (mask & ~H2D_FN_DEFAULT) throw Hermes::Exceptions::Exception("Cannot obtain second derivatives of an exact solution."); - + this->update_refmap(); - double* x = this->refmap->get_phys_x(order); - double* y = this->refmap->get_phys_y(order); + double* x = this->refmap.get_phys_x(order); + double* y = this->refmap.get_phys_y(order); // evaluate the exact solution if (this->num_components == 1) @@ -1017,8 +933,8 @@ namespace Hermes { double2x2 *mat, *m; int mstep = 0; - mat = this->refmap->get_const_inv_ref_map(); - if (!this->refmap->is_jacobian_const()) { mat = this->refmap->get_inv_ref_map(order); mstep = 1; } + mat = this->refmap.get_const_inv_ref_map(); + if (!this->refmap.is_jacobian_const()) { mat = this->refmap.get_inv_ref_map(order); mstep = 1; } for (i = 0, m = mat; i < np; i++, m += mstep) { @@ -1397,9 +1313,8 @@ namespace Hermes this->elem_orders[parsed_xml_solution->elem_orders().at(elems_i).id()] = parsed_xml_solution->elem_orders().at(elems_i).ord(); for (unsigned int component_i = 0; component_i < this->num_components; component_i++) - for (unsigned int elems_i = 0; elems_i < num_elems; elems_i++) - this->elem_coeffs[component_i][parsed_xml_solution->component().at(component_i).elem_coeffs().at(elems_i).id()] = parsed_xml_solution->component().at(component_i).elem_coeffs().at(elems_i).c(); - + for (unsigned int elems_i = 0; elems_i < num_elems; elems_i++) + this->elem_coeffs[component_i][parsed_xml_solution->component().at(component_i).elem_coeffs().at(elems_i).id()] = parsed_xml_solution->component().at(component_i).elem_coeffs().at(elems_i).c(); } init_dxdy_buffer(); } @@ -1460,8 +1375,8 @@ namespace Hermes this->elem_orders[parsed_xml_solution->elem_orders().at(elems_i).id()] = parsed_xml_solution->elem_orders().at(elems_i).ord(); for (unsigned int component_i = 0; component_i < this->num_components; component_i++) - for (unsigned int elems_i = 0; elems_i < num_elems; elems_i++) - this->elem_coeffs[component_i][parsed_xml_solution->component().at(component_i).elem_coeffs().at(elems_i).id()] = parsed_xml_solution->component().at(component_i).elem_coeffs().at(elems_i).c(); + for (unsigned int elems_i = 0; elems_i < num_elems; elems_i++) + this->elem_coeffs[component_i][parsed_xml_solution->component().at(component_i).elem_coeffs().at(elems_i).id()] = parsed_xml_solution->component().at(component_i).elem_coeffs().at(elems_i).c(); } init_dxdy_buffer(); @@ -1506,7 +1421,7 @@ namespace Hermes bson_iterator it_complex; bson_find(&it_complex, &br, "complex"); - bool complex = bson_iterator_bool(&it_complex); + bool is_complex = bson_iterator_bool(&it_complex); bson_iterator it_components; bson_find(&it_components, &br, "components_count"); @@ -1517,14 +1432,14 @@ namespace Hermes if (sln_type == HERMES_EXACT) { - Hermes::vector values; + std::vector values; // values bson_find(&it, &br, "values"); bson_iterator_subobject_init(&it, &sub, 0); bson_iterator_init(&it, &sub); while (bson_iterator_next(&it)) values.push_back(bson_iterator_double(&it)); - this->load_exact_solution(this->num_components, space, complex, values[0], values[1], values[2], values[3]); + this->load_exact_solution(this->num_components, space, is_complex, values[0], values[1], values[2], values[3]); } else { @@ -1624,7 +1539,7 @@ namespace Hermes bson_iterator it_complex; bson_find(&it_complex, &br, "complex"); - bool complex = bson_iterator_bool(&it_complex); + bool is_complex = bson_iterator_bool(&it_complex); bson_iterator it_components; bson_find(&it_components, &br, "components_count"); @@ -1635,14 +1550,14 @@ namespace Hermes if (sln_type == HERMES_EXACT) { - Hermes::vector values; + std::vector values; // values bson_find(&it, &br, "values"); bson_iterator_subobject_init(&it, &sub, 0); bson_iterator_init(&it, &sub); while (bson_iterator_next(&it)) values.push_back(bson_iterator_double(&it)); - this->load_exact_solution(this->num_components, space, complex, values[0], values[1], values[2], values[3]); + this->load_exact_solution(this->num_components, space, is_complex, values[0], values[1], values[2], values[3]); } else { @@ -1668,7 +1583,7 @@ namespace Hermes this->elem_orders = malloc_with_check(num_elems); // coeffs. - Hermes::vector real_coeffs, imag_coeffs; + std::vector real_coeffs, imag_coeffs; bson_find(&it_coeffs_real, &br, "coeffs-real"); bson_iterator_subobject_init(&it_coeffs_real, &sub, 0); bson_iterator_init(&it, &sub); @@ -1681,7 +1596,7 @@ namespace Hermes while (bson_iterator_next(&it)) imag_coeffs.push_back(bson_iterator_double(&it)); - for (int i = 0; i < imag_coeffs.size(); i++) + for (unsigned short i = 0; i < imag_coeffs.size(); i++) this->mono_coeffs[i] = std::complex(real_coeffs[i], imag_coeffs[i]); // elem order @@ -1739,32 +1654,30 @@ namespace Hermes void Solution::check_space_type_compliance(const char* space_type_to_check) const { if (!strcmp(space_type_to_check, "h1")) - if (this->space_type != HERMES_H1_SPACE) - throw Exceptions::Exception("Space types not compliant in Solution::load()."); + if (this->space_type != HERMES_H1_SPACE) + throw Exceptions::Exception("Space types not compliant in Solution::load()."); if (!strcmp(space_type_to_check, "l2")) - if (this->space_type != HERMES_L2_SPACE) - throw Exceptions::Exception("Space types not compliant in Solution::load()."); + if (this->space_type != HERMES_L2_SPACE) + throw Exceptions::Exception("Space types not compliant in Solution::load()."); if (!strcmp(space_type_to_check, "hcurl")) - if (this->space_type != HERMES_HCURL_SPACE) - throw Exceptions::Exception("Space types not compliant in Solution::load()."); + if (this->space_type != HERMES_HCURL_SPACE) + throw Exceptions::Exception("Space types not compliant in Solution::load()."); if (!strcmp(space_type_to_check, "hdiv")) - if (this->space_type != HERMES_HDIV_SPACE) - throw Exceptions::Exception("Space types not compliant in Solution::load()."); + if (this->space_type != HERMES_HDIV_SPACE) + throw Exceptions::Exception("Space types not compliant in Solution::load()."); if (!strcmp(space_type_to_check, "l2-markerwise")) - if (this->space_type != HERMES_L2_MARKERWISE_CONST_SPACE) - throw Exceptions::Exception("Space types not compliant in Solution::load()."); + if (this->space_type != HERMES_L2_MARKERWISE_CONST_SPACE) + throw Exceptions::Exception("Space types not compliant in Solution::load()."); } template Scalar Solution::get_ref_value(Element* e, double xi1, double xi2, int component, int item) { - if (e == nullptr) - throw Exceptions::NullException(1); - + Helpers::check_for_null(e); set_active_element(e); int o = elem_orders[e->id]; @@ -1786,8 +1699,7 @@ namespace Hermes template Scalar Solution::get_ref_value_transformed(Element* e, double xi1, double xi2, int a, int b) { - if (e == nullptr) - throw Exceptions::NullException(1); + Helpers::check_for_null(e); if (this->sln_type != HERMES_SLN) throw Exceptions::Exception("Solution::get_ref_value_transformed only works for solutions wrt. FE space, project if you want to use the method for exact solutions."); @@ -1802,11 +1714,13 @@ namespace Hermes { double2x2 m; double xx, yy; - this->refmap->inv_ref_map_at_point(xi1, xi2, xx, yy, m); + this->refmap.inv_ref_map_at_point(xi1, xi2, xx, yy, m); Scalar dx = get_ref_value(e, xi1, xi2, a, 1); Scalar dy = get_ref_value(e, xi1, xi2, a, 2); - if (b == 1) return m[0][0] * dx + m[0][1] * dy; // H2D_FN_DX - if (b == 2) return m[1][0] * dx + m[1][1] * dy; // H2D_FN_DY + // H2D_FN_DX + if (b == 1) return m[0][0] * dx + m[0][1] * dy; + // H2D_FN_DY + if (b == 2) return m[1][0] * dx + m[1][1] * dy; } #ifdef H2D_USE_SECOND_DERIVATIVES else @@ -1815,20 +1729,23 @@ namespace Hermes double3x2 mat2; double xx, yy; - this->refmap->inv_ref_map_at_point(xi1, xi2, xx, yy, mat); + this->refmap.inv_ref_map_at_point(xi1, xi2, xx, yy, mat); Scalar vx = get_ref_value(e, xi1, xi2, a, 1); Scalar vy = get_ref_value(e, xi1, xi2, a, 2); Scalar vxx = get_ref_value(e, xi1, xi2, a, 3); Scalar vyy = get_ref_value(e, xi1, xi2, a, 4); Scalar vxy = get_ref_value(e, xi1, xi2, a, 5); - this->refmap->second_ref_map_at_point(xi1, xi2, xx, yy, mat2); + this->refmap.second_ref_map_at_point(xi1, xi2, xx, yy, mat2); if (b == 3) - return sqr(mat[0][0])*vxx + 2 * mat[0][1] * mat[0][0] * vxy + sqr(mat[0][1])*vyy + mat2[0][0] * vx + mat2[0][1] * vy; // dxx + // dxx + return sqr(mat[0][0])*vxx + 2 * mat[0][1] * mat[0][0] * vxy + sqr(mat[0][1])*vyy + mat2[0][0] * vx + mat2[0][1] * vy; if (b == 4) - return sqr(mat[1][0])*vxx + 2 * mat[1][1] * mat[1][0] * vxy + sqr(mat[1][1])*vyy + mat2[2][0] * vx + mat2[2][1] * vy; // dyy + // dyy + return sqr(mat[1][0])*vxx + 2 * mat[1][1] * mat[1][0] * vxy + sqr(mat[1][1])*vyy + mat2[2][0] * vx + mat2[2][1] * vy; if (b == 5) - return mat[0][0] * mat[1][0] * vxx + (mat[0][0] * mat[1][1] + mat[1][0] * mat[0][1])*vxy + mat[0][1] * mat[1][1] * vyy + mat2[1][0] * vx + mat2[1][1] * vy; //dxy + //dxy + return mat[0][0] * mat[1][0] * vxx + (mat[0][0] * mat[1][1] + mat[1][0] * mat[0][1])*vxy + mat[0][1] * mat[1][1] * vyy + mat2[1][0] * vx + mat2[1][1] * vy; } #else throw Exceptions::Exception("Hermes not built with second derivatives support. Consult the macro H2D_USE_SECOND_DERIVATIVES."); @@ -1840,11 +1757,13 @@ namespace Hermes { double2x2 m; double xx, yy; - this->refmap->inv_ref_map_at_point(xi1, xi2, xx, yy, m); + this->refmap.inv_ref_map_at_point(xi1, xi2, xx, yy, m); Scalar vx = get_ref_value(e, xi1, xi2, 0, 0); Scalar vy = get_ref_value(e, xi1, xi2, 1, 0); - if (a == 0) return m[0][0] * vx + m[0][1] * vy; // H2D_FN_VAL_0 - if (a == 1) return m[1][0] * vx + m[1][1] * vy; // H2D_FN_VAL_1 + // H2D_FN_VAL_0 + if (a == 0) return m[0][0] * vx + m[0][1] * vy; + // H2D_FN_VAL_1 + if (a == 1) return m[1][0] * vx + m[1][1] * vy; } else throw Hermes::Exceptions::Exception("Getting derivatives of the vector solution: Not implemented yet."); @@ -1866,7 +1785,7 @@ namespace Hermes Scalar** toReturn = malloc_with_check, Scalar*>(2, this); double2x2 mat; - this->refmap->inv_ref_map_at_point(x_ref, y_ref, x_dummy, y_dummy, mat); + this->refmap.inv_ref_map_at_point(x_ref, y_ref, x_dummy, y_dummy, mat); if (this->num_components == 1) { toReturn[0] = malloc_with_check, Scalar>(6, this); @@ -1893,7 +1812,7 @@ namespace Hermes toReturn[0][2] = mat[1][0] * result[1] + mat[1][1] * result[2]; #ifdef H2D_USE_SECOND_DERIVATIVES double3x2 mat2; - this->refmap->second_ref_map_at_point(x_ref, y_ref, x_dummy, y_dummy, mat2); + this->refmap.second_ref_map_at_point(x_ref, y_ref, x_dummy, y_dummy, mat2); toReturn[0][3] = sqr(mat[0][0])*result[3] + 2 * mat[0][1] * mat[0][0] * result[5] + sqr(mat[0][1])*result[4] + mat2[0][0] * result[1] + mat2[0][1] * result[2]; toReturn[0][4] = sqr(mat[1][0])*result[3] + 2 * mat[1][1] * mat[1][0] * result[5] + sqr(mat[1][1])*result[4] + mat2[2][0] * result[1] + mat2[2][1] * result[2]; @@ -1965,7 +1884,7 @@ namespace Hermes double2x2 m; double xx, yy; - this->refmap->inv_ref_map_at_point(xi1, xi2, xx, yy, m); + this->refmap.inv_ref_map_at_point(xi1, xi2, xx, yy, m); Scalar dx = get_ref_value(e, xi1, xi2, 0, 1); Scalar dy = get_ref_value(e, xi1, xi2, 0, 2); toReturn->dx[0] = m[0][0] * dx + m[0][1] * dy; @@ -1976,14 +1895,16 @@ namespace Hermes double2x2 mat; double3x2 mat2; - this->refmap->inv_ref_map_at_point(xi1, xi2, xx, yy, mat); - this->refmap->second_ref_map_at_point(xi1, xi2, xx, yy, mat2); + this->refmap.inv_ref_map_at_point(xi1, xi2, xx, yy, mat); + this->refmap.second_ref_map_at_point(xi1, xi2, xx, yy, mat2); Scalar vxx = get_ref_value(e, xi1, xi2, 0, 3); Scalar vyy = get_ref_value(e, xi1, xi2, 0, 4); Scalar vxy = get_ref_value(e, xi1, xi2, 0, 5); - Scalar dxx = sqr(mat[0][0])*vxx + 2 * mat[0][1] * mat[0][0] * vxy + sqr(mat[0][1])*vyy + mat2[0][0] * dx + mat2[0][1] * dy; // dxx - Scalar dyy = sqr(mat[1][0])*vxx + 2 * mat[1][1] * mat[1][0] * vxy + sqr(mat[1][1])*vyy + mat2[2][0] * dx + mat2[2][1] * dy; // dyy + // dxx + Scalar dxx = sqr(mat[0][0])*vxx + 2 * mat[0][1] * mat[0][0] * vxy + sqr(mat[0][1])*vyy + mat2[0][0] * dx + mat2[0][1] * dy; + // dyy + Scalar dyy = sqr(mat[1][0])*vxx + 2 * mat[1][1] * mat[1][0] * vxy + sqr(mat[1][1])*vyy + mat2[2][0] * dx + mat2[2][1] * dy; toReturn->laplace[0] = dxx + dyy; #endif } @@ -1991,7 +1912,7 @@ namespace Hermes { double2x2 m; double xx, yy; - this->refmap->inv_ref_map_at_point(xi1, xi2, xx, yy, m); + this->refmap.inv_ref_map_at_point(xi1, xi2, xx, yy, m); Scalar vx = get_ref_value(e, xi1, xi2, 0, 0); Scalar vy = get_ref_value(e, xi1, xi2, 1, 0); toReturn->val0[0] = m[0][0] * vx + m[0][1] * vy; @@ -2006,7 +1927,7 @@ namespace Hermes } } - template class HERMES_API Solution; - template class HERMES_API Solution >; + template class HERMES_API Solution < double > ; + template class HERMES_API Solution < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/function/transformable.cpp b/hermes2d/src/function/transformable.cpp index 75d2751c15..22ce5c0ee5 100644 --- a/hermes2d/src/function/transformable.cpp +++ b/hermes2d/src/function/transformable.cpp @@ -23,10 +23,10 @@ namespace Hermes Trf tri_trf[H2D_TRF_NUM] = { - { { 0.5, 0.5 }, { -0.5, -0.5 } }, // son 0 - { { 0.5, 0.5 }, { 0.5, -0.5 } }, // son 1 - { { 0.5, 0.5 }, { -0.5, 0.5 } }, // son 2 - { {-0.5, -0.5 }, { -0.5, -0.5 } }, // son 3 + { { 0.5, 0.5 }, { -0.5, -0.5 } }, // son 0 + { { 0.5, 0.5 }, { 0.5, -0.5 } }, // son 1 + { { 0.5, 0.5 }, { -0.5, 0.5 } }, // son 2 + { { -0.5, -0.5 }, { -0.5, -0.5 } }, // son 3 { H2D_IDENTIFY_TRF }, // identity { H2D_IDENTIFY_TRF }, // identity { H2D_IDENTIFY_TRF }, // identity @@ -37,13 +37,13 @@ namespace Hermes Trf quad_trf[H2D_TRF_NUM] = { { { 0.5, 0.5 }, { -0.5, -0.5 } }, // son 0 - { { 0.5, 0.5 }, { 0.5, -0.5 } }, // son 1 - { { 0.5, 0.5 }, { 0.5, 0.5 } }, // son 2 - { { 0.5, 0.5 }, { -0.5, 0.5 } }, // son 3 - { { 1.0, 0.5 }, { 0.0, -0.5 } }, // horz son 0 - { { 1.0, 0.5 }, { 0.0, 0.5 } }, // horz son 1 - { { 0.5, 1.0 }, { -0.5, 0.0 } }, // vert son 0 - { { 0.5, 1.0 }, { 0.5, 0.0 } }, // vert son 1 + { { 0.5, 0.5 }, { 0.5, -0.5 } }, // son 1 + { { 0.5, 0.5 }, { 0.5, 0.5 } }, // son 2 + { { 0.5, 0.5 }, { -0.5, 0.5 } }, // son 3 + { { 1.0, 0.5 }, { 0.0, -0.5 } }, // horz son 0 + { { 1.0, 0.5 }, { 0.0, 0.5 } }, // horz son 1 + { { 0.5, 1.0 }, { -0.5, 0.0 } }, // vert son 0 + { { 0.5, 1.0 }, { 0.5, 0.0 } }, // vert son 1 { H2D_IDENTIFY_TRF } // identity }; @@ -80,7 +80,7 @@ namespace Hermes if (e == nullptr) throw Exceptions::NullException(1); - + this->element = e; this->reset_transform(); @@ -96,7 +96,7 @@ namespace Hermes idx = (idx - 1) >> 3; } reset_transform(); - for (int k = i-1; k >= 0; k--) + for (int k = i - 1; k >= 0; k--) push_transform(son[k]); } @@ -109,7 +109,7 @@ namespace Hermes void Transformable::push_transform(int son) { assert(element != nullptr); - if(top >= H2D_MAX_TRN_LEVEL) + if (top >= H2D_MAX_TRN_LEVEL) throw Hermes::Exceptions::Exception("Too deep transform."); Trf* mat = stack + (++top); @@ -121,19 +121,20 @@ namespace Hermes mat->t[1] = ctm->m[1] * tr->t[1] + ctm->t[1]; ctm = mat; - sub_idx = (sub_idx << 3) + son + 1; // see traverse.cpp if this changes + // see traverse.cpp if this changes + sub_idx = (sub_idx << 3) + son + 1; } void Transformable::push_transforms(std::set& transformables, int son) { - for(std::set::iterator it = transformables.begin(); it != transformables.end(); ++it) - if(*it != nullptr) + for (std::set::iterator it = transformables.begin(); it != transformables.end(); ++it) + if (*it != nullptr) (*it)->push_transform(son); } void Transformable::pop_transforms(std::set& transformables) { - for(std::set::iterator it = transformables.begin(); it != transformables.end(); ++it) - if(*it != nullptr) + for (std::set::iterator it = transformables.begin(); it != transformables.end(); ++it) + if (*it != nullptr) (*it)->pop_transform(); } } diff --git a/hermes2d/src/graph.cpp b/hermes2d/src/graph.cpp index d8aac053d6..1f740da934 100644 --- a/hermes2d/src/graph.cpp +++ b/hermes2d/src/graph.cpp @@ -78,7 +78,8 @@ namespace Hermes void Graph::add_values(int row, double x, double y) { if (!rows.size()) add_row(nullptr); - if (fabs(x) < Hermes::HermesSqrtEpsilon) return; // this is to avoid problems with plotting in log-log scale + // this is to avoid problems with plotting in log-log scale + if (fabs(x) < Hermes::HermesSqrtEpsilon) return; // (sometimes the CPU time was zero and plotting crashed) if (row < 0 || row >= (int)rows.size()) throw Hermes::Exceptions::Exception("Invalid row number."); Values xy = { x, y }; @@ -89,7 +90,8 @@ namespace Hermes { int row = 0; if (!rows.size()) add_row(nullptr); - if (fabs(x) < Hermes::HermesSqrtEpsilon) return; // this is to avoid problems with plotting in log-log scale + // this is to avoid problems with plotting in log-log scale + if (fabs(x) < Hermes::HermesSqrtEpsilon) return; // (sometimes the CPU time was zero and plotting crashed) Values xy = { x, y }; rows[row].data.push_back(xy); @@ -196,42 +198,70 @@ namespace Hermes static void get_style_types(std::string line, std::string mark, std::string col, int& lt, int& pt, int& ct) { if (line == "-") - lt = 1; // solid + // solid + lt = 1; else if (line == ":") - lt = 4; // dotted + // dotted + lt = 4; else if (line == "-.") - lt = 5; // dash dot + // dash dot + lt = 5; else if (line == "--") - lt = 2; // dashed + // dashed + lt = 2; else lt = 1; - if (mark == ".") pt = 7; // full circle - else if (mark == "o") pt = 6; // empty circle - else if (mark == "O") pt = 7; // full circle - else if (mark == "x") pt = 2; // cross - else if (mark == "+") pt = 1; // cross - else if (mark == "*") pt = 3; // star - else if (mark == "s") pt = 4; // empty square - else if (mark == "S") pt = 5; // full square - else if (mark == "d") pt = 10; // empty diamond - else if (mark == "D") pt = 11; // full diamond - else if (mark == "v") pt = 12; // empty triangle down - else if (mark == "V") pt = 13; // full triangle down - else if (mark == "^") pt = 9; // full triangle up - else if (mark == "<") pt = 12; // empty triangle down - else if (mark == ">") pt = 8; // empty triangle up - else if (mark == "p") pt = 14; // empty pentagon - else if (mark == "P") pt = 15; // full pentagon + // full circle + if (mark == ".") pt = 7; + // empty circle + else if (mark == "o") pt = 6; + // full circle + else if (mark == "O") pt = 7; + // cross + else if (mark == "x") pt = 2; + // cross + else if (mark == "+") pt = 1; + // star + else if (mark == "*") pt = 3; + // empty square + else if (mark == "s") pt = 4; + // full square + else if (mark == "S") pt = 5; + // empty diamond + else if (mark == "d") pt = 10; + // full diamond + else if (mark == "D") pt = 11; + // empty triangle down + else if (mark == "v") pt = 12; + // full triangle down + else if (mark == "V") pt = 13; + // full triangle up + else if (mark == "^") pt = 9; + // empty triangle down + else if (mark == "<") pt = 12; + // empty triangle up + else if (mark == ">") pt = 8; + // empty pentagon + else if (mark == "p") pt = 14; + // full pentagon + else if (mark == "P") pt = 15; else pt = 0; - if (col == "k") ct = -1; // black - else if (col == "b") ct = 3; // blue - else if (col == "g") ct = 2; // green - else if (col == "c") ct = 5; // cyan - else if (col == "m") ct = 4; // magenta - else if (col == "y") ct = 6; // yellow - else if (col == "r") ct = 1; // red + // black + if (col == "k") ct = -1; + // blue + else if (col == "b") ct = 3; + // green + else if (col == "g") ct = 2; + // cyan + else if (col == "c") ct = 5; + // magenta + else if (col == "m") ct = 4; + // yellow + else if (col == "y") ct = 6; + // red + else if (col == "r") ct = 1; else ct = -1; } @@ -328,4 +358,4 @@ namespace Hermes terminal_str = sstm.str(); } } -} +} \ No newline at end of file diff --git a/hermes2d/src/mesh/curved.cpp b/hermes2d/src/mesh/curved.cpp index 724357adf3..93082be22c 100644 --- a/hermes2d/src/mesh/curved.cpp +++ b/hermes2d/src/mesh/curved.cpp @@ -23,7 +23,6 @@ #include "quad_all.h" #include "matrix.h" #include "algebra/dense_matrix_operations.h" -#include "mesh/refmap.h" using namespace Hermes::Algebra::DenseMatrixOperations; @@ -31,8 +30,11 @@ namespace Hermes { namespace Hermes2D { - static H1ShapesetJacobi ref_map_shapeset; - static PrecalcShapeset ref_map_pss_static(&ref_map_shapeset); + HERMES_API Quad1DStd g_quad_1d_std; + HERMES_API Quad2DStd g_quad_2d_std; + + H1ShapesetJacobi ref_map_shapeset; + PrecalcShapesetAssembling ref_map_pss_static(&ref_map_shapeset); CurvMapStatic::CurvMapStatic() { @@ -69,9 +71,9 @@ namespace Hermes free_with_check(bubble_quad_p); } - double** CurvMapStatic::calculate_bubble_projection_matrix(int* indices, ElementMode2D mode) + double** CurvMapStatic::calculate_bubble_projection_matrix(short* indices, ElementMode2D mode) { - int nb; + unsigned short nb; double** mat; if (mode == HERMES_MODE_TRIANGLE) @@ -85,30 +87,29 @@ namespace Hermes nb = this->quad_bubble_np; } - for (int i = 0; i < nb; i++) + PrecalcShapesetAssembling ref_map_pss_static_temp(&ref_map_shapeset); + ref_map_pss_static_temp.set_active_element(ref_map_pss_static.get_active_element()); + for (unsigned short i = 0; i < nb; i++) { - for (int j = i; j < nb; j++) + for (unsigned short j = i; j < nb; j++) { - int ii = indices[i], ij = indices[j]; - int o = ref_map_shapeset.get_order(ii, mode) + ref_map_shapeset.get_order(ij, mode); + short ii = indices[i], ij = indices[j]; + unsigned short o = ref_map_shapeset.get_order(ii, mode) + ref_map_shapeset.get_order(ij, mode); o = std::max(H2D_GET_V_ORDER(o), H2D_GET_H_ORDER(o)); ref_map_pss_static.set_active_shape(ii); ref_map_pss_static.set_quad_order(o, H2D_FN_VAL); - double* fni = ref_map_pss_static.deep_copy_array(); + const double* fni = ref_map_pss_static.get_fn_values(); - ref_map_pss_static.set_active_shape(ij); - ref_map_pss_static.set_quad_order(o, H2D_FN_VAL); - double* fnj = ref_map_pss_static.deep_copy_array(); + ref_map_pss_static_temp.set_active_shape(ij); + ref_map_pss_static_temp.set_quad_order(o, H2D_FN_VAL); + const double* fnj = ref_map_pss_static_temp.get_fn_values(); double3* pt = g_quad_2d_std.get_points(o, mode); double val = 0.0; - for (int k = 0; k < g_quad_2d_std.get_num_points(o, mode); k++) + for (unsigned short k = 0; k < g_quad_2d_std.get_num_points(o, mode); k++) val += pt[k][2] * (fni[k] * fnj[k]); - free_with_check(fni); - free_with_check(fnj); - mat[i][j] = mat[j][i] = val; } } @@ -123,8 +124,10 @@ namespace Hermes { Element e; e.nvert = 3; + e.cm = nullptr; + e.id = -1; ref_map_pss_static.set_active_element(&e); - int* indices = ref_map_shapeset.get_bubble_indices(ref_map_shapeset.get_max_order(), HERMES_MODE_TRIANGLE); + short* indices = ref_map_shapeset.get_bubble_indices(ref_map_shapeset.get_max_order(), HERMES_MODE_TRIANGLE); curvMapStatic.bubble_proj_matrix_tri = calculate_bubble_projection_matrix(indices, HERMES_MODE_TRIANGLE); // cholesky factorization of the matrix @@ -134,15 +137,17 @@ namespace Hermes // *** quads *** // calculate projection matrix of maximum order { - Element e; - e.nvert = 4; - ref_map_pss_static.set_active_element(&e); - int *indices = ref_map_shapeset.get_bubble_indices(H2D_MAKE_QUAD_ORDER(ref_map_shapeset.get_max_order(), ref_map_shapeset.get_max_order()), HERMES_MODE_QUAD); - curvMapStatic.bubble_proj_matrix_quad = calculate_bubble_projection_matrix(indices, HERMES_MODE_QUAD); - - // cholesky factorization of the matrix - choldc(curvMapStatic.bubble_proj_matrix_quad, this->quad_bubble_np, curvMapStatic.bubble_quad_p); - } + Element e; + e.nvert = 4; + e.cm = nullptr; + e.id = -1; + ref_map_pss_static.set_active_element(&e); + short *indices = ref_map_shapeset.get_bubble_indices(H2D_MAKE_QUAD_ORDER(ref_map_shapeset.get_max_order(), ref_map_shapeset.get_max_order()), HERMES_MODE_QUAD); + curvMapStatic.bubble_proj_matrix_quad = calculate_bubble_projection_matrix(indices, HERMES_MODE_QUAD); + + // cholesky factorization of the matrix + choldc(curvMapStatic.bubble_proj_matrix_quad, this->quad_bubble_np, curvMapStatic.bubble_quad_p); + } } void CurvMapStatic::precalculate_cholesky_projection_matrix_edge() @@ -312,14 +317,16 @@ namespace Hermes return 0.5 * (y + 1); } - CurvMap::CurvMap() : ref_map_pss(PrecalcShapeset(&ref_map_shapeset)) + CurvMap::CurvMap() : ref_map_pss(&ref_map_shapeset) { coeffs = nullptr; ctm = nullptr; memset(curves, 0, sizeof(Curve*)* H2D_MAX_NUMBER_EDGES); + this->parent = nullptr; + this->sub_idx = 0; } - CurvMap::CurvMap(const CurvMap* cm) : ref_map_pss(PrecalcShapeset(&ref_map_shapeset)) + CurvMap::CurvMap(const CurvMap* cm) : ref_map_pss(&ref_map_shapeset) { this->nc = cm->nc; this->order = cm->order; @@ -343,6 +350,8 @@ namespace Hermes else this->curves[i] = nullptr; } + this->parent = nullptr; + this->sub_idx = 0; } else { @@ -364,17 +373,15 @@ namespace Hermes if (toplevel) { for (int i = 0; i < 4; i++) - if (curves[i]) - { - delete curves[i]; - curves[i] = nullptr; - } + if (curves[i]) + { + delete curves[i]; + curves[i] = nullptr; + } } } - bool CurvMap::warning_issued = false; - - double CurvMap::nurbs_basis_fn(int i, int k, double t, double* knot) + double CurvMap::nurbs_basis_fn(unsigned short i, unsigned short k, double t, double* knot) { if (k == 0) { @@ -385,213 +392,74 @@ namespace Hermes double N1 = nurbs_basis_fn(i, k - 1, t, knot); double N2 = nurbs_basis_fn(i + 1, k - 1, t, knot); - double result = 0.0; - if (knot[i + k] != knot[i]) - { - result += ((t - knot[i]) / (knot[i + k] - knot[i])) * N1; - } - if (knot[i + k + 1] != knot[i + 1]) + if ((N1 > HermesEpsilon) || (N2 > HermesEpsilon)) { - result += ((knot[i + k + 1] - t) / (knot[i + k + 1] - knot[i + 1])) * N2; + double result = 0.0; + if ((N1 > HermesEpsilon) && knot[i + k] != knot[i]) + result += ((t - knot[i]) / (knot[i + k] - knot[i])) * N1; + if ((N2 > HermesEpsilon) && knot[i + k + 1] != knot[i + 1]) + result += ((knot[i + k + 1] - t) / (knot[i + k + 1] - knot[i + 1])) * N2; + return result; } - return result; + else + return 0.0; } } void CurvMap::nurbs_edge(Element* e, Curve* curve, int edge, double t, double& x, - double& y, double& n_x, double& n_y, double& t_x, double& t_y) + double& y) { // Nurbs curves are parametrized from 0 to 1. t = (t + 1.0) / 2.0; // Start point A, end point B. - double2 A, B; - A[0] = e->vn[edge]->x; - A[1] = e->vn[edge]->y; - B[0] = e->vn[e->next_vert(edge)]->x; - B[1] = e->vn[e->next_vert(edge)]->y; + double2 A = { e->vn[edge]->x, e->vn[edge]->y }; + double2 B = { e->vn[e->next_vert(edge)]->x, e->vn[e->next_vert(edge)]->y }; // Vector pointing from A to B. - double2 v; - v[0] = B[0] - A[0]; - v[1] = B[1] - A[1]; - double abs_v = sqrt(sqr(v[0]) + sqr(v[1])); + double2 v = { B[0] - A[0], B[1] - A[1] }; // Straight line. if (!curve) { x = A[0] + t * v[0]; y = A[1] + t * v[1]; - t_x = v[0] / abs_v; - t_y = v[1] / abs_v; - n_x = t_y; - n_y = -t_x; } else { - // Circular arc. + double3* cp; + int degree, np; + double* kv; if (curve->type == ArcType) { - double3* cp = ((Arc*)curve)->pt; - x = y = 0.0; - double sum = 0.0; // sum of basis fns and weights - - for (int i = 0; i < ((Arc*)curve)->np; i++) - { - double basis = nurbs_basis_fn(i, ((Arc*)curve)->degree, t, ((Arc*)curve)->kv); - sum += cp[i][2] * basis; - double x_i = cp[i][0]; - double y_i = cp[i][1]; - double w_i = cp[i][2]; - x += w_i * basis * x_i; - y += w_i * basis * y_i; - } - - x /= sum; - y /= sum; - - // Normal and tangential vectors. - // FIXME; This calculation is artificial and it assumes that - // the NURBS is a circular arc. This should be done in the - // same way for all NURBS. - - // End points, midpoint. - double2 M; - M[0] = (A[0] + B[0]) / 2.; - M[1] = (A[1] + B[1]) / 2.; - //printf("***** A = %g %g\n", A[0], A[1]); - //printf("***** B = %g %g\n", B[0], B[1]); - //printf("***** M = %g %g\n", M[0], M[1]); - - // Unit vector from M to center of circle S. - double2 w; - w[0] = -v[1] / abs_v; - w[1] = v[0] / abs_v; - - // Distance L between M and center of circle S - // can be calculated using a right-angle triangle - // whose one angle is alpha/2. - double alpha_rad = ((Arc*)curve)->angle * M_PI / 180.; - double L = 0.5 * abs_v / tan(0.5 * alpha_rad); - //printf("***** L = %g\n", L); - - // Center of circle. - double2 S; - S[0] = M[0] + w[0] * L; - S[1] = M[1] + w[1] * L; - //printf("***** S = %g %g\n", S[0], S[1]); - - // Calculation of radius and test. - double2 SA, SB; - SA[0] = A[0] - S[0]; - SA[1] = A[1] - S[1]; - SB[0] = B[0] - S[0]; - SB[1] = B[1] - S[1]; - double R = sqrt(sqr(SA[0]) + sqr(SA[1])); - double R2 = sqrt(sqr(SB[0]) + sqr(SB[1])); - if (std::abs(R - R2) > Hermes::HermesSqrtEpsilon) - throw Hermes::Exceptions::Exception("Internal error in nurbs_edge() - bad radius R."); - - // Normal vectors to circular arc at edge end points A, B. - double2 normal_A, normal_B; - normal_A[0] = SA[0] / R; - normal_A[1] = SA[1] / R; - normal_B[0] = SB[0] / R; - normal_B[1] = SB[1] / R; - //printf("***** normal_A = %g %g\n", normal_A[0], normal_A[1]); - //printf("***** normal_B = %g %g\n", normal_B[0], normal_B[1]); - - // Calculate rotational matrix that transforms AS_ref = (R, 0) -> SA - // and SB_ref -> SB. - double2 SB_ref; - SB_ref[0] = R * cos(alpha_rad); - SB_ref[1] = R * sin(alpha_rad); - // First we need to invert the matrix[(R 0)^T, SB_ref^T]. - double m_11, m_12, m_21, m_22; - m_11 = R; - m_12 = SB_ref[0]; - m_21 = 0; - m_22 = SB_ref[1]; - double m_det = m_11 * m_22 - m_12 * m_21; - double inv_11, inv_12, inv_21, inv_22; - inv_11 = m_22 / m_det; - inv_12 = -m_12 / m_det; - inv_21 = -m_21 / m_det; - inv_22 = m_11 / m_det; - double s_11, s_12, s_21, s_22; - s_11 = SA[0]; - s_12 = SB[0]; - s_21 = SA[1]; - s_22 = SB[1]; - //Rotation matrix. - double r_11, r_12, r_21, r_22; - r_11 = s_11 * inv_11 + s_12 * inv_21; - r_12 = s_11 * inv_12 + s_12 * inv_22; - r_21 = s_21 * inv_11 + s_22 * inv_21; - r_22 = s_21 * inv_12 + s_22 * inv_22; - // The desired normal vector in reference coordinates. - double n_x_ref = cos(alpha_rad * t); - double n_y_ref = sin(alpha_rad * t); - // Rotate it. - n_x = r_11 * n_x_ref + r_12 * n_y_ref; - n_y = r_21 * n_x_ref + r_22 * n_y_ref; - - /* - // Calculate normal at point corresponding to the - // position of parameter 't' between 0 and 1. - n_x = normal_A[0] + t * (normal_B[0] - normal_A[0]); - n_y = normal_A[1] + t * (normal_B[1] - normal_A[1]); - double size_n = sqrt(sqr(n_x) + sqr(n_y)); - n_x /= size_n; - n_y /= size_n; - */ - - // Calculate tangential vectors. - t_x = -n_y; - t_y = n_x; - - // Correcting sign so that the normal points outside - // if the angle is negative. - if (((Arc*)curve)->angle < 0) - { - n_x *= -1; - n_y *= -1; - t_x *= -1; - t_y *= -1; - } + cp = ((Arc*)curve)->pt; + np = ((Arc*)curve)->np; + degree = ((Arc*)curve)->degree; + kv = ((Arc*)curve)->kv; } - // General NURBS. - // FIXME - calculation of normal and tangential vectors needs to be added. else { - double3* cp = ((Nurbs*)curve)->pt; - x = y = 0.0; - double sum = 0.0; // sum of basis fns and weights - - for (int i = 0; i < ((Nurbs*)curve)->np; i++) - { - double basis = nurbs_basis_fn(i, ((Nurbs*)curve)->degree, t, ((Nurbs*)curve)->kv); - sum += cp[i][2] * basis; - double x_i = cp[i][0]; - double y_i = cp[i][1]; - double w_i = cp[i][2]; - x += w_i * basis * x_i; - y += w_i * basis * y_i; - } - - x /= sum; - y /= sum; + cp = ((Nurbs*)curve)->pt; + np = ((Nurbs*)curve)->np; + degree = ((Nurbs*)curve)->degree; + kv = ((Nurbs*)curve)->kv; + } - if (!warning_issued) - { - printf("FIXME: IMPLEMENT CALCULATION OF n_x, n_y, t_x, t_y in nurbs_edge() !!!\n"); - warning_issued = true; - } - n_x = 0; - n_y = 0; - t_x = 0; - t_y = 0; + // sum of basis fns and weights + double sum = 0.0; + x = y = 0.0; + for (int i = 0; i < np; i++) + { + double basis = nurbs_basis_fn(i, degree, t, kv); + sum += cp[i][2] * basis; + double x_i = cp[i][0]; + double y_i = cp[i][1]; + double w_i = cp[i][2]; + x += w_i * basis * x_i; + y += w_i * basis * y_i; } + x /= sum; + y /= sum; } } @@ -601,11 +469,11 @@ namespace Hermes { { -1.0, -1.0 }, { 1.0, -1.0 }, { 1.0, 1.0 }, { -1.0, 1.0 } } }; - void CurvMap::nurbs_edge_0(Element* e, Curve* curve, int edge, double t, double& x, double& y, double& n_x, double& n_y, double& t_x, double& t_y) + void CurvMap::nurbs_edge_0(Element* e, Curve* curve, unsigned short edge, double t, double& x, double& y, double& n_x, double& n_y, double& t_x, double& t_y) { - int va = edge; - int vb = e->next_vert(edge); - nurbs_edge(e, curve, edge, t, x, y, n_x, n_y, t_x, t_y); + unsigned short va = edge; + unsigned short vb = e->next_vert(edge); + nurbs_edge(e, curve, edge, t, x, y); x -= 0.5 * ((1 - t) * (e->vn[va]->x) + (1 + t) * (e->vn[vb]->x)); y -= 0.5 * ((1 - t) * (e->vn[va]->y) + (1 + t) * (e->vn[vb]->y)); @@ -620,51 +488,27 @@ namespace Hermes double fx, fy; x = y = 0.0; - for (unsigned int j = 0; j < e->get_nvert(); j++) + double l[3] = { lambda_0(xi_1, xi_2), lambda_1(xi_1, xi_2), lambda_2(xi_1, xi_2) }; + + for (unsigned char j = 0; j < e->get_nvert(); j++) { int va = j; int vb = e->next_vert(j); - double l_a = 0; - double l_b = 0; - switch (va) - { - case 0: - l_a = lambda_0(xi_1, xi_2); - break; - case 1: - l_a = lambda_1(xi_1, xi_2); - break; - case 2: - l_a = lambda_2(xi_1, xi_2); - break; - } - - switch (vb) - { - case 0: - l_b = lambda_0(xi_1, xi_2); - break; - case 1: - l_b = lambda_1(xi_1, xi_2); - break; - case 2: - l_b = lambda_2(xi_1, xi_2); - break; - } + double la = l[va]; + double lb = l[vb]; // vertex part - x += e->vn[j]->x * l_a; - y += e->vn[j]->y * l_a; + x += e->vn[j]->x * la; + y += e->vn[j]->y * la; - if (!(((ref_vert[0][va][0] == xi_1) && (ref_vert[0][va][1] == xi_2)) || - ((ref_vert[0][vb][0] == xi_1) && (ref_vert[0][vb][1] == xi_2)))) + if (!(((ref_vert[0][va][0] == xi_1) && (ref_vert[0][va][1] == xi_2)) || ((ref_vert[0][vb][0] == xi_1) && (ref_vert[0][vb][1] == xi_2)))) { // edge part - double t = l_b - l_a; + double t = lb - la; double n_x, n_y, t_x, t_y; nurbs_edge_0(e, curve[j], j, t, fx, fy, n_x, n_y, t_x, t_y); - x += fx * l_a * l_b; - y += fy * l_a * l_b; + x += fx * lb * la; + y += fy * lb * la; } } } @@ -674,11 +518,10 @@ namespace Hermes { double ex[H2D_MAX_NUMBER_EDGES], ey[H2D_MAX_NUMBER_EDGES]; - double n_x, n_y, t_x, t_y; - nurbs_edge(e, curve[0], 0, xi_1, ex[0], ey[0], n_x, n_y, t_x, t_y); - nurbs_edge(e, curve[1], 1, xi_2, ex[1], ey[1], n_x, n_y, t_x, t_y); - nurbs_edge(e, curve[2], 2, -xi_1, ex[2], ey[2], n_x, n_y, t_x, t_y); - nurbs_edge(e, curve[3], 3, -xi_2, ex[3], ey[3], n_x, n_y, t_x, t_y); + nurbs_edge(e, curve[0], 0, xi_1, ex[0], ey[0]); + nurbs_edge(e, curve[1], 1, xi_2, ex[1], ey[1]); + nurbs_edge(e, curve[2], 2, -xi_1, ex[2], ey[2]); + nurbs_edge(e, curve[3], 3, -xi_2, ex[3], ey[3]); x = (1 - xi_2) / 2.0 * ex[0] + (1 + xi_1) / 2.0 * ex[1] + (1 + xi_2) / 2.0 * ex[2] + (1 - xi_1) / 2.0 * ex[3] - @@ -699,9 +542,9 @@ namespace Hermes calc_ref_map_tri(e, curve, xi_1, xi_2, f[0], f[1]); } - void CurvMap::edge_coord(Element* e, int edge, double t, double2& x, double2& v) const + void CurvMap::edge_coord(Element* e, unsigned short edge, double t, double2& x) const { - int mode = e->get_mode(); + unsigned short mode = e->get_mode(); double2 a, b; a[0] = ctm->m[0] * ref_vert[mode][edge][0] + ctm->t[0]; a[1] = ctm->m[1] * ref_vert[mode][edge][1] + ctm->t[1]; @@ -710,25 +553,21 @@ namespace Hermes for (int i = 0; i < 2; i++) { - v[i] = b[i] - a[i]; - x[i] = a[i] + (t + 1.0) / 2.0 * v[i]; + x[i] = a[i] + (t + 1.0) / 2.0 * (b[i] - a[i]); } - double lenght = sqrt(v[0] * v[0] + v[1] * v[1]); - v[0] /= lenght; v[1] /= lenght; } - void CurvMap::calc_edge_projection(Element* e, int edge, Curve** nurbs, int order, double2* proj) const + void CurvMap::calc_edge_projection(Element* e, unsigned short edge, Curve** nurbs, unsigned short order, double2* proj) const { - int i, j, k; - int mo1 = g_quad_1d_std.get_max_order(); - int np = g_quad_1d_std.get_num_points(mo1); - int ne = order - 1; - int mode = e->get_mode(); + unsigned short i, j, k; + unsigned short mo1 = g_quad_1d_std.get_max_order(); + unsigned char np = g_quad_1d_std.get_num_points(mo1); + unsigned short ne = order - 1; + unsigned short mode = e->get_mode(); assert(np <= 15 && ne <= 10); double2 fn[15]; double rhside[2][10]; - memset(fn, 0, sizeof(double2)* np); memset(rhside[0], 0, sizeof(double)* ne); memset(rhside[1], 0, sizeof(double)* ne); @@ -744,11 +583,12 @@ namespace Hermes calc_ref_map(e, nurbs, b_1, b_2, fb); double2* pt = g_quad_1d_std.get_points(mo1); - for (j = 0; j < np; j++) // over all integration points + // over all integration points + for (j = 0; j < np; j++) { - double2 x, v; + double2 x; double t = pt[j][0]; - edge_coord(e, edge, t, x, v); + edge_coord(e, edge, t, x); calc_ref_map(e, nurbs, x[0], x[1], fn[j]); for (k = 0; k < 2; k++) @@ -813,12 +653,13 @@ namespace Hermes } } - void CurvMap::old_projection(Element* e, int order, double2* proj, double* old[2]) + void CurvMap::old_projection(Element* e, unsigned short order, double2* proj, double* old[2]) { - int mo2 = g_quad_2d_std.get_max_order(e->get_mode()); - int np = g_quad_2d_std.get_num_points(mo2, e->get_mode()); + unsigned short mo2 = g_quad_2d_std.get_max_order(e->get_mode()); + unsigned char np = g_quad_2d_std.get_num_points(mo2, e->get_mode()); + unsigned short nvert = e->get_nvert(); - for (unsigned int k = 0; k < e->get_nvert(); k++) // loop over vertices + for (unsigned int k = 0; k < nvert; k++) // loop over vertices { // vertex basis functions in all integration points int index_v = ref_map_shapeset.get_vertex_index(k, e->get_mode()); @@ -827,8 +668,8 @@ namespace Hermes const double* vd = ref_map_pss.get_fn_values(); for (int m = 0; m < 2; m++) // part 0 or 1 - for (int j = 0; j < np; j++) - old[m][j] += proj[k][m] * vd[j]; + for (int j = 0; j < np; j++) + old[m][j] += proj[k][m] * vd[j]; for (int ii = 0; ii < order - 1; ii++) { @@ -839,21 +680,21 @@ namespace Hermes const double* ed = ref_map_pss.get_fn_values(); for (int m = 0; m < 2; m++) //part 0 or 1 - for (int j = 0; j < np; j++) - old[m][j] += proj[e->get_nvert() + k * (order - 1) + ii][m] * ed[j]; + for (int j = 0; j < np; j++) + old[m][j] += proj[nvert + k * (order - 1) + ii][m] * ed[j]; } } } - void CurvMap::calc_bubble_projection(Element* e, Curve** curve, int order, double2* proj) + void CurvMap::calc_bubble_projection(Element* e, Curve** curve, unsigned short order, double2* proj) { ref_map_pss.set_active_element(e); - int i, j, k; - int mo2 = g_quad_2d_std.get_max_order(e->get_mode()); - int np = g_quad_2d_std.get_num_points(mo2, e->get_mode()); - int qo = e->is_quad() ? H2D_MAKE_QUAD_ORDER(order, order) : order; - int nb = ref_map_shapeset.get_num_bubbles(qo, e->get_mode()); + unsigned short i, j, k; + unsigned short mo2 = g_quad_2d_std.get_max_order(e->get_mode()); + unsigned char np = g_quad_2d_std.get_num_points(mo2, e->get_mode()); + unsigned short qo = e->is_quad() ? H2D_MAKE_QUAD_ORDER(order, order) : order; + unsigned short nb = ref_map_shapeset.get_num_bubbles(qo, e->get_mode()); double2* fn = new double2[np]; memset(fn, 0, np * sizeof(double2)); @@ -920,11 +761,11 @@ namespace Hermes ref_map_pss.set_active_element(e); // allocate projection coefficients - int nv = e->get_nvert(); - int ne = order - 1; - int qo = e->is_quad() ? H2D_MAKE_QUAD_ORDER(order, order) : order; - int nb = ref_map_shapeset.get_num_bubbles(qo, e->get_mode()); - nc = nv + nv*ne + nb; + unsigned char nvert = e->get_nvert(); + unsigned char ne = order - 1; + unsigned short qo = e->is_quad() ? H2D_MAKE_QUAD_ORDER(order, order) : order; + unsigned short nb = ref_map_shapeset.get_num_bubbles(qo, e->get_mode()); + this->nc = nvert + nvert*ne + nb; this->coeffs = realloc_with_check(this->coeffs, nc); // WARNING: do not change the format of the array 'coeffs'. If it changes, @@ -945,26 +786,24 @@ namespace Hermes // calculation of new_ projection coefficients // vertex part - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < nvert; i++) { coeffs[i][0] = e->vn[i]->x; coeffs[i][1] = e->vn[i]->y; } - if (e->cm->toplevel == false) + if (!e->cm->toplevel) e = e->cm->parent; // edge part - for (int edge = 0; edge < e->get_nvert(); edge++) + for (unsigned char edge = 0; edge < nvert; edge++) calc_edge_projection(e, edge, curves, order, coeffs); //bubble part calc_bubble_projection(e, curves, order, coeffs); - - RefMap::set_element_iro_cache(e); } - void CurvMap::get_mid_edge_points(Element* e, double2* pt, int n) + void CurvMap::get_mid_edge_points(Element* e, double2* pt, unsigned short n) { Curve** curves = this->curves; Transformable tran; @@ -979,7 +818,7 @@ namespace Hermes ctm = tran.get_ctm(); double xi_1, xi_2; - for (int i = 0; i < n; i++) + for (unsigned short i = 0; i < n; i++) { xi_1 = ctm->m[0] * pt[i][0] + ctm->t[0]; xi_2 = ctm->m[1] * pt[i][1] + ctm->t[1]; @@ -1017,4 +856,4 @@ namespace Hermes return cm; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/mesh/element.cpp b/hermes2d/src/mesh/element.cpp index ed14c98956..25012f6ed0 100644 --- a/hermes2d/src/mesh/element.cpp +++ b/hermes2d/src/mesh/element.cpp @@ -40,7 +40,7 @@ namespace Hermes if (elem[1] == nullptr) elem[1] = e; else - throw Hermes::Exceptions::Exception(false, "No free slot 'elem'"); + throw Hermes::Exceptions::Exception("No free slot 'elem'"); } } ref++; @@ -73,9 +73,9 @@ namespace Hermes this->calc_diameter(); } - int Element::get_edge_orientation(int ie) const + bool Element::get_edge_orientation(int ie) const { - return (this->vn[ie]->id < this->vn[this->next_vert(ie)]->id) ? 0 : 1; + return !(this->vn[ie]->id < this->vn[this->next_vert(ie)]->id); } void Element::unref_all_nodes(HashTable* ht) @@ -92,15 +92,6 @@ namespace Hermes Element::Element() : visited(false), area(0.0), diameter(0.0), center_set(false) { }; - int Element::next_vert(int i) const - { - return (i < (int)nvert - 1) ? i + 1 : 0; - } - - int Element::prev_vert(int i) const - { - return (i > 0) ? i - 1 : nvert - 1; - } bool Element::hsplit() const { @@ -167,11 +158,11 @@ namespace Hermes double x_center, y_center; this->get_center(x_center, y_center); - for (int isurf = 0; isurf < this->nvert; isurf++) + for (unsigned char isurf = 0; isurf < this->nvert; isurf++) { // 0 - prepare data structures. int eo = g_quad_2d_std.get_edge_points(isurf, this->get_mode() == HERMES_MODE_TRIANGLE ? g_max_tri : g_max_quad, this->get_mode()); - int np = g_quad_2d_std.get_num_points(eo, this->get_mode()); + unsigned char np = g_quad_2d_std.get_num_points(eo, this->get_mode()); double* x_curv = new double[np]; double* y_curv = new double[np]; double* x_straight = new double[np]; @@ -179,19 +170,18 @@ namespace Hermes // 1 - get the x,y coordinates for the curved element. refmap_curv.set_active_element(this); - Geom* geometry = init_geom_surf(&refmap_curv, isurf, this->en[isurf]->marker, eo, tan); - memcpy(x_curv, geometry->x, np*sizeof(double)); - memcpy(y_curv, geometry->y, np*sizeof(double)); - delete geometry; + GeomSurf geometry; + init_geom_surf_allocated(geometry, &refmap_curv, isurf, this->en[isurf]->marker, eo, tan); + memcpy(x_curv, geometry.x, np*sizeof(double)); + memcpy(y_curv, geometry.y, np*sizeof(double)); // 2. - act if there was no curvature CurvMap* cm_temp = this->cm; this->cm = nullptr; refmap_straight.set_active_element(this); - geometry = init_geom_surf(&refmap_straight, isurf, this->en[isurf]->marker, eo, tan); - memcpy(x_straight, geometry->x, np*sizeof(double)); - memcpy(y_straight, geometry->y, np*sizeof(double)); - delete geometry; + init_geom_surf_allocated(geometry, &refmap_straight, isurf, this->en[isurf]->marker, eo, tan); + memcpy(x_straight, geometry.x, np*sizeof(double)); + memcpy(y_straight, geometry.y, np*sizeof(double)); // 3. - compare the two, get the updated area. double previous_distance; @@ -335,4 +325,4 @@ namespace Hermes return newnode; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/mesh/hash.cpp b/hermes2d/src/mesh/hash.cpp index d61315c0c0..4d7fd361f1 100644 --- a/hermes2d/src/mesh/hash.cpp +++ b/hermes2d/src/mesh/hash.cpp @@ -35,8 +35,8 @@ namespace Hermes { v_table = e_table = nullptr; - mask = size-1; - if(size & mask) throw Hermes::Exceptions::Exception("Parameter 'size' must be a power of two."); + mask = size - 1; + if (size & mask) throw Hermes::Exceptions::Exception("Parameter 'size' must be a power of two."); // allocate and initialize the hash tables v_table = new Node*[size]; @@ -62,13 +62,11 @@ namespace Hermes return &(nodes[id]); } - /// Returns the total number of nodes stored. int HashTable::get_num_nodes() const { return nodes.get_num_items(); } - /// Returns the maximum node id number plus one. int HashTable::get_max_node_id() const { return nodes.get_size(); @@ -98,10 +96,10 @@ namespace Hermes for_all_nodes(node, this) { int p1 = node->p1, p2 = node->p2; - if(p1 > p2) std::swap(p1, p2); + if (p1 > p2) std::swap(p1, p2); int idx = hash(p1, p2); - if(node->type == HERMES_TYPE_VERTEX) + if (node->type == HERMES_TYPE_VERTEX) { node->next_hash = v_table[idx]; v_table[idx] = node; @@ -117,14 +115,14 @@ namespace Hermes void HashTable::free() { nodes.free(); - if(v_table != nullptr) + if (v_table != nullptr) { - delete [] v_table; + delete[] v_table; v_table = nullptr; } - if(e_table != nullptr) + if (e_table != nullptr) { - delete [] e_table; + delete[] e_table; e_table = nullptr; } } @@ -133,7 +131,7 @@ namespace Hermes { while (node != nullptr) { - if(node->p1 == p1 && node->p2 == p2) + if (node->p1 == p1 && node->p2 == p2) return node; node = node->next_hash; } @@ -143,10 +141,10 @@ namespace Hermes Node* HashTable::get_vertex_node(int p1, int p2) { // search for the node in the vertex hashtable - if(p1 > p2) std::swap(p1, p2); + if (p1 > p2) std::swap(p1, p2); int i = hash(p1, p2); Node* node = search_list(v_table[i], p1, p2); - if(node != nullptr) + if (node != nullptr) return node; // not found - create a new_ one @@ -172,10 +170,10 @@ namespace Hermes Node* HashTable::get_edge_node(int p1, int p2) { // search for the node in the edge hashtable - if(p1 > p2) std::swap(p1, p2); + if (p1 > p2) std::swap(p1, p2); int i = hash(p1, p2); Node* node = search_list(e_table[i], p1, p2); - if(node != nullptr) return node; + if (node != nullptr) return node; // not found - create a new_ one Node* newnode = nodes.add(); @@ -198,13 +196,13 @@ namespace Hermes Node* HashTable::peek_vertex_node(int p1, int p2) const { - if(p1 > p2) std::swap(p1, p2); + if (p1 > p2) std::swap(p1, p2); return search_list(v_table[hash(p1, p2)], p1, p2); } Node* HashTable::peek_edge_node(int p1, int p2) const { - if(p1 > p2) std::swap(p1, p2); + if (p1 > p2) std::swap(p1, p2); return search_list(e_table[hash(p1, p2)], p1, p2); } @@ -216,7 +214,7 @@ namespace Hermes Node* node = *ptr; while (node != nullptr) { - if(node->id == id) + if (node->id == id) { *ptr = node->next_hash; break; @@ -237,7 +235,7 @@ namespace Hermes Node* node = *ptr; while (node != nullptr) { - if(node->id == id) + if (node->id == id) { *ptr = node->next_hash; break; diff --git a/hermes2d/src/mesh/mesh.cpp b/hermes2d/src/mesh/mesh.cpp index 2b414e8654..fcf794ab0d 100644 --- a/hermes2d/src/mesh/mesh.cpp +++ b/hermes2d/src/mesh/mesh.cpp @@ -95,8 +95,8 @@ namespace Hermes double2x2* m = r.get_inv_ref_map(mo); double* jac = r.get_jacobian(mo); for (i = 0; i < quad->get_num_points(mo, e->get_mode()); i++) - if (jac[i] <= 0.0) - throw Hermes::Exceptions::MeshLoadFailureException("Element #%d is concave or badly oriented in initial_single_check().", e->id); + if (jac[i] <= 0.0) + throw Hermes::Exceptions::MeshLoadFailureException("Element #%d is concave or badly oriented in initial_single_check().", e->id); } } } @@ -168,7 +168,6 @@ namespace Hermes return elements.get_num_items(); } - /// Returns the number of coarse mesh elements. int Mesh::get_num_base_elements() const { if (this == nullptr) throw Hermes::Exceptions::Exception("this == nullptr in Mesh::get_num_base_elements()."); @@ -179,7 +178,6 @@ namespace Hermes return nbase; } - /// Returns the number of coarse mesh elements. int Mesh::get_num_used_base_elements() const { int toReturn = 0; @@ -197,7 +195,6 @@ namespace Hermes return toReturn; } - /// Returns the current number of active elements in the mesh. int Mesh::get_num_active_elements() const { if (this == nullptr) @@ -208,7 +205,6 @@ namespace Hermes return nactive; } - /// Returns the maximum node id number plus one. int Mesh::get_max_element_id() const { if (this == nullptr) @@ -339,10 +335,10 @@ namespace Hermes throw Hermes::Exceptions::MeshLoadFailureException("Some of the vertices of element #%d are identical which is impossible.", e->id); if (v0->x == v1->x && v0->x == v2->x) - throw Hermes::Exceptions::MeshLoadFailureException("Vertices in element %i share coordinates: [%i, %i, %i].", e->id, v0->id, v1->id, v2->id); + throw Hermes::Exceptions::MeshLoadFailureException("Vertices [%i, %i, %i] in element %i share x-coordinates: [%f, %f, %f].", e->id, v0->id, v1->id, v2->id, v0->x, v1->x, v2->x); if (v0->y == v1->y && v0->y == v2->y) - throw Hermes::Exceptions::MeshLoadFailureException("Vertices in element %i share coordinates: [%i, %i, %i].", e->id, v0->id, v1->id, v2->id); + throw Hermes::Exceptions::MeshLoadFailureException("Vertices [%i, %i, %i] in element %i share y-coordinates: [%f, %f, %f].", e->id, v0->id, v1->id, v2->id, v0->y, v1->y, v2->y); e->vn[0] = v0; e->vn[1] = v1; @@ -379,6 +375,13 @@ namespace Hermes // set vertex and edge node pointers if (v0 == v1 || v1 == v2 || v2 == v3 || v3 == v0 || v2 == v0 || v3 == v1) throw Hermes::Exceptions::MeshLoadFailureException("Some of the vertices of element #%d are identical which is not right.", e->id); + + if ((v0->x == v1->x && v0->x == v2->x) || (v0->x == v1->x && v0->x == v3->x) || (v0->x == v2->x && v0->x == v3->x) || (v1->x == v2->x && v2->x == v3->x)) + throw Hermes::Exceptions::MeshLoadFailureException("Some of the vertices [%i, %i, %i, %i] in element %i share x-coordinates: [%f, %f, %f, %f].", e->id, v0->id, v1->id, v2->id, v0->x, v1->x, v2->x, v3->x); + + if ((v0->y == v1->y && v0->y == v2->y) || (v0->y == v1->y && v0->y == v3->y) || (v0->y == v2->y && v0->y == v3->y) || (v1->y == v2->y && v2->y == v3->y)) + throw Hermes::Exceptions::MeshLoadFailureException("Some of the vertices [%i, %i, %i, %i] in element %i share y-coordinates: [%f, %f, %f, %f].", e->id, v0->id, v1->id, v2->id, v0->y, v1->y, v2->y, v3->y); + e->vn[0] = v0; e->vn[1] = v1; e->vn[2] = v2; @@ -392,7 +395,6 @@ namespace Hermes // register in the nodes e->ref_all_nodes(); - return e; } @@ -434,8 +436,8 @@ namespace Hermes // update coefficients of curved reference mapping for (int i = 0; i < 4; i++) - if (sons[i]->is_curved()) - sons[i]->cm->update_refmap_coeffs(sons[i]); + if (sons[i]->is_curved()) + sons[i]->cm->update_refmap_coeffs(sons[i]); // deactivate this element and unregister from its nodes e->active = 0; @@ -639,16 +641,16 @@ namespace Hermes // update coefficients of curved reference mapping for (i = 0; i < 4; i++) - if (sons[i]) - { - if(sons[i]->cm) + if (sons[i]) + { + if (sons[i]->cm) sons[i]->cm->update_refmap_coeffs(sons[i]); - } + } // set pointers to parent element for sons for (int i = 0; i < 4; i++) - if (sons[i] != nullptr) - sons[i]->parent = e; + if (sons[i] != nullptr) + sons[i]->parent = e; // copy son pointers (could not have been done earlier because of the union) memcpy(e->sons, sons, sizeof(sons)); @@ -728,8 +730,8 @@ namespace Hermes } else refine_quad(e, refinement); - for(int i = 0; i < H2D_MAX_ELEMENT_SONS; i++) - if(e->sons[i]) + for (int i = 0; i < H2D_MAX_ELEMENT_SONS; i++) + if (e->sons[i]) e->sons[i]->iro_cache = e->iro_cache; this->seq = g_mesh_seq++; @@ -794,8 +796,8 @@ namespace Hermes static int rtv_criterion(Element* e) { for (unsigned int i = 0; i < e->get_nvert(); i++) - if (e->vn[i]->id == rtv_id) - return 0; + if (e->vn[i]->id == rtv_id) + return 0; return -1; } @@ -840,7 +842,7 @@ namespace Hermes return 0; } - void Mesh::refine_towards_boundary(Hermes::vector markers, int depth, bool aniso, bool mark_as_initial) + void Mesh::refine_towards_boundary(std::vector markers, int depth, bool aniso, bool mark_as_initial) { rtb_aniso = aniso; bool refined = true; @@ -855,18 +857,18 @@ namespace Hermes Element* e; for_all_active_elements(e, this) - for (unsigned int j = 0; j < e->get_nvert(); j++) - { + for (unsigned int j = 0; j < e->get_nvert(); j++) + { bool marker_matched = false; for (unsigned int marker_i = 0; marker_i < markers.size(); marker_i++) - if (e->en[j]->marker == this->boundary_markers_conversion.get_internal_marker(markers[marker_i]).marker) - marker_matched = true; + if (e->en[j]->marker == this->boundary_markers_conversion.get_internal_marker(markers[marker_i]).marker) + marker_matched = true; if (marker_matched) { rtb_vert[e->vn[j]->id] = rtb_vert[e->vn[e->next_vert(j)]->id] = 1; refined = true; } - } + } refine_by_criterion(rtb_criterion, 1); delete[] rtb_vert; @@ -881,8 +883,8 @@ namespace Hermes void Mesh::refine_towards_boundary(std::string marker, int depth, bool aniso, bool mark_as_initial) { if (marker == HERMES_ANY) - for (std::map::iterator it = this->boundary_markers_conversion.conversion_table.begin(); it != this->boundary_markers_conversion.conversion_table.end(); ++it) - refine_towards_boundary(it->second, depth, aniso, mark_as_initial); + for (std::map::iterator it = this->boundary_markers_conversion.conversion_table.begin(); it != this->boundary_markers_conversion.conversion_table.end(); ++it) + refine_towards_boundary(it->second, depth, aniso, mark_as_initial); else { @@ -900,14 +902,14 @@ namespace Hermes Element* e; for_all_active_elements(e, this) - for (unsigned int j = 0; j < e->get_nvert(); j++) - { + for (unsigned int j = 0; j < e->get_nvert(); j++) + { if (e->en[j]->marker == rtb_marker) { rtb_vert[e->vn[j]->id] = rtb_vert[e->vn[e->next_vert(j)]->id] = 1; refined = true; } - } + } refine_by_criterion(rtb_criterion, 1); delete[] rtb_vert; @@ -922,14 +924,14 @@ namespace Hermes void Mesh::refine_in_area(std::string marker, int depth, int refinement, bool mark_as_initial) { - Hermes::vector markers; + std::vector markers; markers.push_back(marker); this->refine_in_areas(markers, depth, refinement, mark_as_initial); } - void Mesh::refine_in_areas(Hermes::vector markers, int depth, int refinement, bool mark_as_initial) + void Mesh::refine_in_areas(std::vector markers, int depth, int refinement, bool mark_as_initial) { - Hermes::vector internal_markers; + std::vector internal_markers; bool any_marker = false; for (unsigned int marker_i = 0; marker_i < markers.size(); marker_i++) { @@ -961,11 +963,11 @@ namespace Hermes for_all_active_elements(e, this) { for (unsigned int marker_i = 0; marker_i < internal_markers.size(); marker_i++) - if (e->marker == internal_markers[marker_i]) - { + if (e->marker == internal_markers[marker_i]) + { this->refine_element(e, refinement); refined = true; - } + } } } } @@ -983,8 +985,8 @@ namespace Hermes if (e->active) return; for (int i = 0; i < 4; i++) - if (e->sons[i] != nullptr) - unrefine_element_id(e->sons[i]->id); + if (e->sons[i] != nullptr) + unrefine_element_id(e->sons[i]->id); unrefine_element_internal(e); seq = g_mesh_seq++; @@ -993,18 +995,18 @@ namespace Hermes void Mesh::unrefine_all_elements(bool keep_initial_refinements) { // find inactive elements with active sons - Hermes::vector list; + std::vector list; Element* e; for_all_inactive_elements(e, this) { bool found = true; for (unsigned int i = 0; i < 4; i++) - if (e->sons[i] != nullptr && - (!e->sons[i]->active || (keep_initial_refinements && e->sons[i]->id < ninitial)) - ) - { + if (e->sons[i] != nullptr && + (!e->sons[i]->active || (keep_initial_refinements && e->sons[i]->id < ninitial)) + ) + { found = false; break; - } + } if (found) list.push_back(e->id); } @@ -1113,11 +1115,11 @@ namespace Hermes // If curvilinear, throw an exception. Element* e; for_all_used_elements(e, this) - if (e->cm != nullptr) - { + if (e->cm != nullptr) + { throw CurvedException(e->id); return false; - } + } return true; } @@ -1150,8 +1152,8 @@ namespace Hermes { // update son pointers for (i = 0; i < 4; i++) - if (e->sons[i] != nullptr) - e->sons[i] = &elements[e->sons[i]->id]; + if (e->sons[i] != nullptr) + e->sons[i] = &elements[e->sons[i]->id]; } // copy CurvMap, update its parent @@ -1170,9 +1172,9 @@ namespace Hermes // update element pointers in edge nodes Node* node; for_all_edge_nodes(node, this) - for (i = 0; i < 2; i++) - if (node->elem[i] != nullptr) - node->elem[i] = &elements[node->elem[i]->id]; + for (i = 0; i < 2; i++) + if (node->elem[i] != nullptr) + node->elem[i] = &elements[node->elem[i]->id]; nbase = mesh->nbase; nactive = mesh->nactive; @@ -1228,7 +1230,8 @@ namespace Hermes for (unsigned int j = 0; j < e->get_nvert(); j++) { Node* en = MeshUtil::get_base_edge_node(e, j); - enew->en[j]->bnd = en->bnd; // copy bnd data from the active el. + // copy bnd data from the active el. + enew->en[j]->bnd = en->bnd; enew->en[j]->marker = en->marker; } @@ -1267,6 +1270,10 @@ namespace Hermes this->element_markers_conversion.conversion_table_inverse.clear(); this->refinements.clear(); this->seq = -1; + + for (std::map::iterator p = marker_areas.begin(); p != marker_areas.end(); p++) + delete p->second; + marker_areas.clear(); } Element* Mesh::element_on_physical_coordinates(double x, double y) @@ -1610,9 +1617,9 @@ namespace Hermes } Arc* curve = new Arc(angle2); - + int inner = 1, outer = 0; - + curve->pt[0][0] = nodes[p1].x; curve->pt[0][1] = nodes[p1].y; curve->pt[0][2] = 1.0; @@ -1644,8 +1651,8 @@ namespace Hermes // update coefficients of curved reference mapping for (int i = 0; i < 3; i++) - if (sons[i]->is_curved()) - sons[i]->cm->update_refmap_coeffs(sons[i]); + if (sons[i]->is_curved()) + sons[i]->cm->update_refmap_coeffs(sons[i]); // deactivate this element and unregister from its nodes e->active = 0; @@ -1706,8 +1713,9 @@ namespace Hermes nactive--; e->unref_all_nodes(this); - bool bcheck = true; ///< if bcheck is true, it is default add a new_ edge between - ///< vn[0] and vn[2] + // if bcheck is true, it is default add a new_ edge between + bool bcheck = true; + // vn[0] and vn[2] double length_x_0_2 = (e->vn[0]->x - e->vn[2]->x)*(e->vn[0]->x - e->vn[2]->x); double length_x_1_3 = (e->vn[1]->x - e->vn[3]->x)*(e->vn[1]->x - e->vn[3]->x); @@ -1753,7 +1761,8 @@ namespace Hermes cm[1] = new CurvMap; memset(cm[1], 0, sizeof(CurvMap)); } - i_case2 = 1; //switch to the shorter diagonal + //switch to the shorter diagonal + i_case2 = 1; } for (unsigned int k = 0; k < 2; k++) @@ -1767,7 +1776,8 @@ namespace Hermes int p1, p2; p1 = e->vn[(idx + i_case2) % 4]->id; - p2 = e->vn[(idx + i_case2 + 1) % 4]->id; //node_temp->id; + //node_temp->id; + p2 = e->vn[(idx + i_case2 + 1) % 4]->id; Arc* curve = new Arc(angle2); @@ -1846,8 +1856,8 @@ namespace Hermes //set pointers to parent element for sons for (int i = 0; i < H2D_MAX_ELEMENT_SONS; i++) - if (sons[i] != nullptr) - sons[i]->parent = e; + if (sons[i] != nullptr) + sons[i]->parent = e; // copy son pointers (could not have been done earlier because of the union) memcpy(e->sons, sons, H2D_MAX_ELEMENT_SONS * sizeof(Element*)); @@ -1876,7 +1886,8 @@ namespace Hermes if (e->is_triangle()) convert_triangles_to_base(e); else - convert_quads_to_base(e);// FIXME: + // FIXME: + convert_quads_to_base(e); seq = g_mesh_seq++; } @@ -2045,8 +2056,8 @@ namespace Hermes memset(cm, 0, sizeof(CurvMap)); for (idx = 0; idx < 3; idx++) - if ((e->cm->curves[idx] != nullptr) && (bnd[idx] == 1)) - { + if ((e->cm->curves[idx] != nullptr) && (bnd[idx] == 1)) + { angle2 = refinement_angle[idx]; int p1, p2; p1 = e->en[idx]->p1; @@ -2074,7 +2085,7 @@ namespace Hermes cm->toplevel = true; cm->order = 4; cm->curves[idx] = curve; - } + } } // create a new_ element. @@ -2134,8 +2145,8 @@ namespace Hermes // FIXME: if (rtb_aniso) - for (unsigned int i = 0; i < e->get_nvert(); i++) - refinement_angle[i] = refinement_angle[i] * 2; + for (unsigned int i = 0; i < e->get_nvert(); i++) + refinement_angle[i] = refinement_angle[i] * 2; // deactivate this element and unregister from its nodes e->active = false; @@ -2166,8 +2177,8 @@ namespace Hermes } for (idx = 0; idx < 4; idx++) - if (fabs(refinement_angle[idx] - 0.0) > 1e-4) - { + if (fabs(refinement_angle[idx] - 0.0) > 1e-4) + { angle2 = refinement_angle[idx]; int p1, p2; p1 = e->en[idx]->p1; @@ -2175,7 +2186,7 @@ namespace Hermes if (p1 > p2) std::swap(p1, p2); Arc* curve = new Arc(angle2); - + curve->pt[0][0] = nodes[p1].x; curve->pt[0][1] = nodes[p1].y; curve->pt[0][2] = 1.0; @@ -2195,7 +2206,7 @@ namespace Hermes cm->toplevel = true; cm->order = 4; cm->curves[idx] = curve; - } + } } // create a new_ element. @@ -2305,8 +2316,8 @@ namespace Hermes } for (idx = 0; idx < 4; idx++) - if (cm[idx] != nullptr) - { + if (cm[idx] != nullptr) + { if ((fabs(refinement_angle[idx % 4] - 0.0) > 1e-4)) { angle2 = refinement_angle[idx % 4] / 2; @@ -2333,7 +2344,7 @@ namespace Hermes curve->pt[1][0] = 0.5*((curve->pt[2][0] + curve->pt[0][0]) + (curve->pt[2][1] - curve->pt[0][1]) * x); curve->pt[1][1] = 0.5*((curve->pt[2][1] + curve->pt[0][1]) - (curve->pt[2][0] - curve->pt[0][0]) * x); curve->pt[1][2] = cos((M_PI - a) * 0.5); - + cm[idx]->toplevel = true; cm[idx]->order = 4; cm[idx]->curves[idx % 4] = curve; @@ -2370,7 +2381,7 @@ namespace Hermes cm[idx]->order = 4; cm[idx]->curves[(idx + 3) % 4] = curve; } - } + } } // create the four sons @@ -2395,13 +2406,13 @@ namespace Hermes // update coefficients of curved reference mapping for (i = 0; i < 4; i++) - if (sons[i] != nullptr && sons[i]->cm != nullptr) - sons[i]->cm->update_refmap_coeffs(sons[i]); + if (sons[i] != nullptr && sons[i]->cm != nullptr) + sons[i]->cm->update_refmap_coeffs(sons[i]); //set pointers to parent element for sons for (int i = 0; i < 4; i++) - if (sons[i] != nullptr) - sons[i]->parent = e; + if (sons[i] != nullptr) + sons[i]->parent = e; // copy son pointers (could not have been done earlier because of the union) memcpy(e->sons, sons, sizeof(sons)); @@ -2443,7 +2454,7 @@ namespace Hermes { Node* v4; for (i = 0; i < 3; i++) - if (eo[i] == 1) k = i; + if (eo[i] == 1) k = i; k1 = e->next_vert(k); k2 = e->prev_vert(k); v4 = peek_vertex_node(e->vn[k]->id, e->vn[k1]->id); @@ -2470,7 +2481,7 @@ namespace Hermes { Node *v4, *v5; for (i = 0; i < 3; i++) - if (eo[i] == 0) k = i; + if (eo[i] == 0) k = i; k1 = e->next_vert(k); k2 = e->prev_vert(k); v4 = peek_vertex_node(e->vn[k1]->id, e->vn[k2]->id); @@ -2528,7 +2539,7 @@ namespace Hermes if (sum == 1) { for (i = 0; i < 4; i++) - if (eo[i] == 1) k = i; + if (eo[i] == 1) k = i; k1 = e->next_vert(k); k2 = e->next_vert(k1); k3 = e->prev_vert(k); @@ -2563,7 +2574,7 @@ namespace Hermes else // two hanging nodes next to each other { for (i = 0; i < 4; i++) - if (eo[i] == 1 && eo[e->next_vert(i)] == 1) k = i; + if (eo[i] == 1 && eo[e->next_vert(i)] == 1) k = i; k1 = e->next_vert(k); k2 = e->next_vert(k1); k3 = e->prev_vert(k); @@ -2760,52 +2771,183 @@ namespace Hermes const std::string EggShell::eggShellMarker = "Eggshell"; bool EggShell::egg_shell_verbose = false; - MeshSharedPtr EggShell::get_egg_shell(MeshSharedPtr mesh, std::string marker, unsigned int levels, int n_element_guess) + MeshSharedPtr EggShell::get_egg_shell(MeshSharedPtr mesh, std::string marker, unsigned int levels) { if (levels < 2) { throw Hermes::Exceptions::ValueException("levels", levels, 2); return MeshSharedPtr(new Mesh()); } - Hermes::vector markers; + std::vector markers; markers.push_back(marker); - return get_egg_shell(mesh, markers, levels, n_element_guess); + return get_egg_shell(mesh, markers, levels); } - MeshSharedPtr EggShell::get_egg_shell(MeshSharedPtr mesh, Hermes::vector markers, unsigned int levels, int n_element_guess) + MeshSharedPtr EggShell::get_egg_shell(MeshSharedPtr mesh, std::vector markers, unsigned int levels) { if (levels < 2) { throw Hermes::Exceptions::ValueException("levels", levels, 2); return MeshSharedPtr(new Mesh); } + MeshSharedPtr target_mesh(new Mesh); target_mesh->copy(mesh); - Element** elements = nullptr; - int n_elements; + int eggShell_marker_0 = target_mesh->get_boundary_markers_conversion().insert_marker(eggShell0Marker); + int eggShell_marker_1 = target_mesh->get_boundary_markers_conversion().insert_marker(eggShell1Marker); + int eggShell_marker_inner = target_mesh->get_boundary_markers_conversion().insert_marker(eggShellInnerMarker); + int eggShell_marker_volume = target_mesh->get_element_markers_conversion().insert_marker(eggShellMarker); - get_egg_shell_structures(target_mesh, elements, n_elements, markers, levels, n_element_guess); - make_egg_shell_mesh(target_mesh, elements, n_elements); + // Search for the adjacent element with the basic logic + vertex-based lookup. + // This only: + // - fills the "1" marker where appropriate + // - fills the volumetric marker + get_egg_shell_structures(target_mesh, markers, levels); - free_with_check(elements); + // Fix hanging nodes. + // This only: + // - adds the volumetric marker where necessary + EggShell::fix_hanging_nodes(target_mesh); + + Element* e; + + /* + bool elements_added; + // Fill holes. + while (true) + { + elements_added = false; + for_all_active_elements(e, target_mesh) + { + NeighborSearch ns(e, target_mesh); + ns.set_ignore_errors(true); + int edges_eggShell = 0; + for (int edge = 0; edge < e->get_nvert(); edge++) + { + // This has been taken care of above. + if (e->en[edge]->marker == eggShell_marker_1 || e->en[edge]->bnd) + continue; + + ns.set_active_edge(edge); + for (int neighbor = 0; neighbor < ns.get_num_neighbors(); neighbor++) + { + Element* neighbor_el = ns.get_neighb_el(); + if (neighbor_el && neighbor_el->marker == eggShell_marker_volume) + { + edges_eggShell++; + break; + } + } + } + if (edges_eggShell > 2) + { + e->marker = eggShell_marker_volume; + elements_added = true; + } + } + if (elements_added) + EggShell::fix_hanging_nodes(target_mesh); + else + break; + } + */ + + // Mark used / not used elements according to the marker. + for_all_active_elements(e, target_mesh) + { + e->used = false; + Element* elem = e; + while (elem->parent) + { + elem->parent->used = false; + elem = elem->parent; + } + } + + for_all_elements(e, target_mesh) + { + if (e->marker == eggShell_marker_volume) + { + e->used = true; + Element* elem = e; + while (elem->parent) + { + elem->parent->used = true; + elem = elem->parent; + } + } + } + + // Now mark the boundaries + calculate active elements. + target_mesh->nactive = 0; + for_all_active_elements(e, target_mesh) + { + target_mesh->nactive++; + NeighborSearch ns(e, target_mesh); + ns.set_ignore_errors(true); + for (int edge = 0; edge < e->get_nvert(); edge++) + { + // This has been taken care of above. + if (e->en[edge]->marker == eggShell_marker_1 || e->en[edge]->bnd) + continue; + + // Find out if all neighbors are eggShell (should be). + bool neighbors_eggshell = false; + ns.set_active_edge(edge); + for (int neighbor = 0; neighbor < ns.get_num_neighbors(); neighbor++) + { + Element* neighbor_el = ns.get_neighb_el(); + if (neighbors_eggshell) + assert(neighbor_el->marker == eggShell_marker_volume); + else if (neighbor_el->marker == eggShell_marker_volume) + neighbors_eggshell = true; + + if (neighbors_eggshell) + { + e->en[edge]->marker = eggShell_marker_inner; + neighbor_el->en[ns.get_neighbor_edge().local_num_of_edge]->marker = eggShell_marker_inner; + } + else if (e->en[edge]->marker != eggShell_marker_1) + { + e->en[edge]->marker = eggShell_marker_0; + } + } + } + + for_all_active_elements(e, target_mesh) + { + for (int edge = 0; edge < e->get_nvert(); edge++) + { + if (e->en[edge]->marker == eggShell_marker_0 || e->en[edge]->marker == eggShell_marker_1) + { + e->en[edge]->bnd = true; + e->vn[edge]->bnd = true; + e->vn[(edge + 1) % e->get_nvert()]->bnd = true; + } + else if (e->en[edge]->bnd) + { + e->en[edge]->marker = eggShell_marker_0; + } + } + } + } fix_markers(target_mesh, mesh); return target_mesh; } - void EggShell::get_egg_shell_structures(MeshSharedPtr target_mesh, Element**& elements, int& n_elements, Hermes::vector markers, unsigned int levels, int n_element_guess) + void EggShell::get_egg_shell_structures(MeshSharedPtr target_mesh, std::vector markers, unsigned int levels) { - int eggShell_marker_1 = target_mesh->get_boundary_markers_conversion().insert_marker(eggShell1Marker); - int eggShell_marker_inner = target_mesh->get_boundary_markers_conversion().insert_marker(eggShellInnerMarker); - int eggShell_marker_volume = target_mesh->get_element_markers_conversion().insert_marker(eggShellMarker); - // Check. if (levels < 1) throw Exceptions::ValueException("levels", levels, 1); - Hermes::vector internal_markers; + int eggShell_marker_1 = target_mesh->get_boundary_markers_conversion().get_internal_marker(eggShell1Marker).marker; + int eggShell_marker_volumetric = target_mesh->get_element_markers_conversion().get_internal_marker(eggShellMarker).marker; + + std::vector internal_markers; for (int i = 0; i < markers.size(); i++) { Hermes::Hermes2D::Mesh::MarkersConversion::IntValid internalMarker = target_mesh->get_element_markers_conversion().get_internal_marker(markers[i]); @@ -2815,14 +2957,9 @@ namespace Hermes throw Exceptions::Exception("Marker %s not valid in target_mesh::get_egg_shell.", markers[i].c_str()); } - // Initial allocation - int n_elements_alloc = n_element_guess == -1 ? (int)std::sqrt((double)target_mesh->get_num_active_elements()) : n_element_guess; - elements = malloc_with_check(n_elements_alloc); - n_elements = 0; - // Initial setup. int* neighbors_target = calloc_with_check(target_mesh->get_max_element_id()); - int* neighbors_target_local = calloc_with_check(target_mesh->get_max_element_id()); + int* neighbor_targets_local = calloc_with_check(target_mesh->get_max_element_id()); Element* e; for_all_active_elements(e, target_mesh) { @@ -2836,169 +2973,127 @@ namespace Hermes } } if (target_marker) - neighbors_target_local[e->id] = 1; + neighbor_targets_local[e->id] = 1; } // And calculation. for (int level = 1; level <= levels; level++) { - if (EggShell::egg_shell_verbose) - Hermes::Mixins::Loggable::Static::info("Level: %i.", level); - memcpy(neighbors_target, neighbors_target_local, target_mesh->get_max_element_id() * sizeof(int)); + memcpy(neighbors_target, neighbor_targets_local, target_mesh->get_max_element_id() * sizeof(int)); for_all_active_elements(e, target_mesh) { if (neighbors_target[e->id] == level) { - if (EggShell::egg_shell_verbose) - Hermes::Mixins::Loggable::Static::info("\tElement: %i.", e->id); NeighborSearch ns(e, target_mesh); for (int edge = 0; edge < e->get_nvert(); edge++) { + // Vertices handling. + if (level == 1) + handle_vertex_on_target_mesh(e, edge, target_mesh, internal_markers, neighbor_targets_local); + if (e->en[edge]->bnd) continue; - if (EggShell::egg_shell_verbose) - Hermes::Mixins::Loggable::Static::info("\t\tEdge: %i.", edge); - ns.set_active_edge(edge); for (int neighbor = 0; neighbor < ns.get_num_neighbors(); neighbor++) { - if (EggShell::egg_shell_verbose) - Hermes::Mixins::Loggable::Static::info("\t\t\tNeighbor: %i.", neighbor); - ns.set_active_segment(neighbor); Element* neighbor_el = ns.get_neighb_el(); - if (neighbors_target_local[neighbor_el->id] > 0) + + // The neighbor has been already visited. + // This respects the vertex-based lookup, because that had already set the value. + if (neighbor_targets_local[neighbor_el->id] > 0 && level > 1) continue; - e->en[edge]->marker = eggShell_marker_1; - neighbor_el->en[ns.get_neighbor_edge().local_num_of_edge]->marker = eggShell_marker_1; - if (n_elements == n_elements_alloc) + + // Mark the appropriate boundary as "1". + if (level == 1) { - int new_n_elements_alloc = std::max(n_elements_alloc * 2, n_elements_alloc + 1); - elements = (Element**)realloc(elements, new_n_elements_alloc * sizeof(Element*)); - memset(elements + new_n_elements_alloc - n_elements_alloc, 0, sizeof(Element*)); - n_elements_alloc = new_n_elements_alloc; + e->en[edge]->marker = eggShell_marker_1; + neighbor_el->en[ns.get_neighbor_edge().local_num_of_edge]->marker = eggShell_marker_1; } - elements[n_elements++] = ns.get_neighb_el(); - ns.get_neighb_el()->marker = eggShell_marker_volume; - neighbors_target_local[ns.get_neighb_el()->id] = level + 1; + + if (neighbor_targets_local[neighbor_el->id] > 0) + continue; + + // Store the level. + neighbor_targets_local[ns.get_neighb_el()->id] = level + 1; + ns.get_neighb_el()->marker = eggShell_marker_volumetric; } } } } } free_with_check(neighbors_target); - free_with_check(neighbors_target_local); } - void EggShell::make_egg_shell_mesh(MeshSharedPtr target_mesh, Element** elements, int n_elements) + void EggShell::handle_vertex_on_target_mesh(Element* e, int vertex, MeshSharedPtr target_mesh, std::vector markers, int* neighbor_targets_local) { - Element* elem; - - for_all_active_elements(elem, target_mesh) - { - elem->used = false; - while (elem->parent) - { - elem->parent->used = false; - elem = elem->parent; - } - } - target_mesh->nactive = 0; - - for (int i = 0; i < n_elements; i++) - { - elem = elements[i]; - elem->used = true; - while (elem->parent) - { - elem->parent->used = true; - elem = elem->parent; - } - target_mesh->nactive++; - } - - EggShell::fix_hanging_nodes(target_mesh, elements, n_elements); - - int marker_temp = target_mesh->get_boundary_markers_conversion().get_internal_marker(eggShellInnerMarker).marker; - int marker_1 = target_mesh->get_boundary_markers_conversion().get_internal_marker(eggShell1Marker).marker; - int marker_0 = target_mesh->get_boundary_markers_conversion().insert_marker(eggShell0Marker); - int marker_volume = target_mesh->get_element_markers_conversion().insert_marker(eggShellMarker); - - for_all_active_elements(elem, target_mesh) + int eggShell_marker_volumetric = target_mesh->get_element_markers_conversion().get_internal_marker(eggShellMarker).marker; + Node* n; + Node* v = e->vn[vertex]; + int max_id = target_mesh->get_max_node_id(); + for (int i = 0; i < max_id; i++) { - NeighborSearch ns(elem, target_mesh); - - for (int edge = 0; edge < elem->get_nvert(); edge++) + n = &target_mesh->nodes[i]; + if ((n->p1 == v->id || n->p2 == v->id) && n->used && n->type) { - if (elem->en[edge]->bnd) - continue; - - bool egg_shell_neighbor = false; - ns.set_active_edge(edge); - for (int neighbor = 0; neighbor < ns.get_num_neighbors(); neighbor++) + bool marker_check_failed[2] = { false, false }; + for (unsigned short marker_i = 0; marker_i < markers.size(); marker_i++) { - ns.set_active_segment(neighbor); - Element* neighbor_el = ns.get_neighb_el(); - if (neighbor_el->marker == marker_volume) + if (n->elem[0]) + if (n->elem[0]->marker == markers[marker_i]) + marker_check_failed[0] = true; + if (n->elem[1]) + if (n->elem[1]->marker == markers[marker_i]) + marker_check_failed[1] = true; + } + for (unsigned char i = 0; i < 2; i++) + if (n->elem[i] && !marker_check_failed[i]) { - elem->en[edge]->marker = marker_temp; - egg_shell_neighbor = true; - break; + // Store the level. + //neighbor_targets_local[n->elem[i]->id] = 2; + n->elem[i]->marker = eggShell_marker_volumetric; } - } - - // If this is not the 1-marker, it is the 0- one now. - if (!egg_shell_neighbor && elem->en[edge]->marker != marker_1) - elem->en[edge]->marker = marker_0; - - if (elem->en[edge]->marker == marker_1 || elem->en[edge]->marker == marker_0) - { - elem->en[edge]->bnd = true; - elem->vn[edge]->bnd = true; - elem->vn[(edge + 1) % elem->get_nvert()]->bnd = true; - } } } } - void EggShell::fix_hanging_nodes(MeshSharedPtr target_mesh, Element** elements, int n_elements) + void EggShell::fix_hanging_nodes(MeshSharedPtr target_mesh) { - int marker_1 = target_mesh->get_boundary_markers_conversion().get_internal_marker(eggShell1Marker).marker; - int marker_0 = target_mesh->get_boundary_markers_conversion().insert_marker(eggShell0Marker); - int marker_temp = target_mesh->get_boundary_markers_conversion().get_internal_marker(eggShellInnerMarker).marker; int marker = target_mesh->get_element_markers_conversion().get_internal_marker(eggShellMarker).marker; - for (int i = 0; i < n_elements; i++) + for_all_active_elements_fast(target_mesh) { - for (int e = 0; e < elements[i]->nvert; e++) + if (e->marker != marker) + continue; + + for (int edge = 0; edge < e->nvert; edge++) { - Node* edge = elements[i]->en[e]; - if (edge->bnd) + Node* en = e->en[edge]; + if (en->bnd) continue; // eliminate good elements. - if (!(edge->elem[0] && edge->elem[1])) + if (!(en->elem[0] && en->elem[1])) { // eliminate go-down (smaller neighbor) - if (!target_mesh->peek_vertex_node(edge->p1, edge->p2)) + if (!target_mesh->peek_vertex_node(en->p1, en->p2)) { - Element* elem = elements[i]; bool processed = false; - while (elem->parent) + while (e->parent) { - Node* parent_edge = target_mesh->peek_edge_node(elem->parent->vn[e]->id, elem->parent->vn[(e + 1) % elem->nvert]->id); + Node* parent_edge = target_mesh->peek_edge_node(e->parent->vn[edge]->id, e->parent->vn[(edge + 1) % e->nvert]->id); // Found edge -> make sure it has some elements (should have) if (parent_edge) { if (parent_edge->elem[0] || parent_edge->elem[1]) { - mark_elements_down_used(marker, elem->parent); + mark_elements_down_used(marker, e->parent); processed = true; break; } } // Not found edge -> have to go up - elem = elem->parent; + e = e->parent; } // In the worst case, the original (base) element should pass with the correct edge. assert(processed); @@ -3010,12 +3105,9 @@ namespace Hermes void EggShell::mark_elements_down_used(int eggShell_marker_volume, Element* element) { - if (!element->used && element->active) - { + if (element->active) element->marker = eggShell_marker_volume; - } - - if (!element->active) + else { for (int i = 0; i < H2D_MAX_ELEMENT_SONS; i++) { @@ -3023,17 +3115,13 @@ namespace Hermes EggShell::mark_elements_down_used(eggShell_marker_volume, element->sons[i]); } } - - element->used = true; } void EggShell::fix_markers(MeshSharedPtr target_mesh, MeshSharedPtr original_mesh) { Element* e; for_all_active_elements(e, target_mesh) - { e->marker = original_mesh->get_element(e->id)->marker; - } } } -} +} \ No newline at end of file diff --git a/hermes2d/src/mesh/mesh_data.cpp b/hermes2d/src/mesh/mesh_data.cpp index a5649c605a..95260761b5 100644 --- a/hermes2d/src/mesh/mesh_data.cpp +++ b/hermes2d/src/mesh/mesh_data.cpp @@ -87,21 +87,21 @@ namespace Hermes std::string temp; // Remove comments - if(str.find('#') != str.npos) + if (str.find('#') != str.npos) str.erase(str.find('#')); // Remove brackets, commas and unnecessary tab spaces for (size_t i = 0; i < str.length(); i++) { //if(str[i] != ' ' && str[i] != '\t' && str[i] != '[' && str[i] != ']' && str[i] != '{' && str[i] != '}' && str[i] != '"') - if(str[i] != '\t' && str[i] != '[' && str[i] != ']' && str[i] != '{' && str[i] != '}') + if (str[i] != '\t' && str[i] != '[' && str[i] != ']' && str[i] != '{' && str[i] != '}') { - if(str[i] == ',' || str[i] == ';') + if (str[i] == ',' || str[i] == ';') temp.append("\t"); - else if(str[i] == '=') + else if (str[i] == '=') temp.append("=\t"); else - temp.append(1,str[i]); + temp.append(1, str[i]); } } @@ -109,22 +109,22 @@ namespace Hermes temp.clear(); // Remove leading whitespaces - str.erase(0,str.find_first_not_of("\t ")); + str.erase(0, str.find_first_not_of("\t ")); // Remove trailing whitespaces - if(str.find_last_of("\t ") == (str.size() - 1)) + if (str.find_last_of("\t ") == (str.size() - 1)) str.erase(str.find_last_not_of("\t ") + 1); // Remove unnecessary blank spaces for (size_t i = 0; i < str.length(); i++) { - if(str[i] == ' ') + if (str[i] == ' ') { - if(str[i + 1] != ' ' && str[i + 1] != '\t' && str[i + 1] != '=' && str[i - 1] != ' ' && str[i - 1] != '\t') - temp.append(1,';'); // Meaningful blank spaces are temporarily replaced with ';' + if (str[i + 1] != ' ' && str[i + 1] != '\t' && str[i + 1] != '=' && str[i - 1] != ' ' && str[i - 1] != '\t') + temp.append(1, ';'); // Meaningful blank spaces are temporarily replaced with ';' } else - temp.append(1,str[i]); + temp.append(1, str[i]); } str.assign(temp); @@ -136,12 +136,12 @@ namespace Hermes for (size_t i = 0; i < str.length(); i++) { - if(str[i] != '"') + if (str[i] != '"') { - if(str[i] == ';') - temp.append(1,' '); + if (str[i] == ';') + temp.append(1, ' '); else - temp.append(1,str[i]); + temp.append(1, str[i]); } } @@ -151,7 +151,7 @@ namespace Hermes void MeshData::parse_mesh(void) { - int dummy_int; + int dummy_int; double dummy_dbl; std::ifstream inFile(mesh_file_.c_str()); @@ -160,45 +160,45 @@ namespace Hermes int counter(0); bool isVert(false), isElt(false), isBdy(false), isCurv(false), isRef(false), isVar(false); - while (std::getline(inFile,line)) + while (std::getline(inFile, line)) { // Remove all comments, unnecessary blank spaces, commas and paranthesis strip(line); - if(line.find_first_not_of("\t ") != line.npos) + if (line.find_first_not_of("\t ") != line.npos) { std::istringstream stream(line); stream >> word; - if(*word.rbegin() == '=') + if (*word.rbegin() == '=') { word.erase(word.size() - 1); - if(word == "vertices") + if (word == "vertices") { isVert = true; isElt = false; isBdy = false; isCurv = false; isRef = false; isVar = false; counter = -1; } - else if(word == "elements") + else if (word == "elements") { isElt = true; isVert = false; isBdy = false; isCurv = false; isRef = false; isVar = false; counter = -1; } - else if(word == "boundaries") + else if (word == "boundaries") { isBdy = true; isVert = false; isElt = false; isCurv = false; isRef = false; isVar = false; counter = -1; } - else if(word == "curves") + else if (word == "curves") { isCurv = true; isVert = false; isElt = false; isBdy = false; isRef = false; isVar = false; counter = -1; } - else if(word == "refinements") + else if (word == "refinements") { isRef = true; isVert = false; isElt = false; isBdy = false; isCurv = false; isVar = false; @@ -214,88 +214,88 @@ namespace Hermes } } - if(counter == -1) + if (counter == -1) counter = 0; else { - if(isVert) + if (isVert) { std::istringstream istr(word); - if(!(istr >> dummy_dbl)) + if (!(istr >> dummy_dbl)) x_vertex.push_back(atof(vars_[restore(word)][0].c_str())); else x_vertex.push_back(atof(word.c_str())); ++counter; } - if(isElt) + if (isElt) { std::istringstream istr(word); - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) en1.push_back(atoi(vars_[restore(word)][0].c_str())); else en1.push_back(atoi(word.c_str())); ++counter; } - else if(isBdy) + else if (isBdy) { std::istringstream istr(word); - if(!(istr >> dummy_dbl)) + if (!(istr >> dummy_dbl)) bdy_first.push_back(atof(vars_[restore(word)][0].c_str())); else bdy_first.push_back(atof(word.c_str())); ++counter; } - else if(isCurv) + else if (isCurv) { std::istringstream istr(word); - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) curv_first.push_back(atoi(vars_[restore(word)][0].c_str())); else curv_first.push_back(atoi(word.c_str())); ++counter; } - else if(isRef) + else if (isRef) { std::istringstream istr(word); - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) ref_elt.push_back(atoi(vars_[restore(word)][0].c_str())); else ref_elt.push_back(atoi(word.c_str())); ++counter; } - else if(isVar) + else if (isVar) { vars_[temp_word].push_back(restore(word)); ++counter; } } - if(isVert) + if (isVert) { while (stream >> word) { std::istringstream istr(word); - if(counter%2 == 0) + if (counter % 2 == 0) { - if(!(istr >> dummy_dbl)) + if (!(istr >> dummy_dbl)) x_vertex.push_back(atof(vars_[restore(word)][0].c_str())); else x_vertex.push_back(atof(word.c_str())); } else { - if(!(istr >> dummy_dbl)) + if (!(istr >> dummy_dbl)) y_vertex.push_back(atof(vars_[restore(word)][0].c_str())); else y_vertex.push_back(atof(word.c_str())); @@ -304,36 +304,36 @@ namespace Hermes ++counter; } } - else if(isElt) + else if (isElt) { while (stream >> word) { std::istringstream istr(word); - if(counter%5 == 0) + if (counter % 5 == 0) { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) en1.push_back(atoi(vars_[restore(word)][0].c_str())); else en1.push_back(atoi(word.c_str())); } - else if(counter%5 == 1) + else if (counter % 5 == 1) { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) en2.push_back(atoi(vars_[restore(word)][0].c_str())); else en2.push_back(atoi(word.c_str())); } - else if(counter%5 == 2) + else if (counter % 5 == 2) { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) en3.push_back(atoi(vars_[restore(word)][0].c_str())); else en3.push_back(atoi(word.c_str())); } - else if(counter%5 == 3) + else if (counter % 5 == 3) { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) { en4.push_back(-1); e_mtl.push_back(restore(word)); @@ -349,22 +349,22 @@ namespace Hermes ++counter; } } - else if(isBdy) + else if (isBdy) { while (stream >> word) { std::istringstream istr(word); - if(counter%3 == 0) + if (counter % 3 == 0) { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) bdy_first.push_back(atoi(vars_[restore(word)][0].c_str())); else bdy_first.push_back(atoi(word.c_str())); } - else if(counter%3 == 1) + else if (counter % 3 == 1) { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) bdy_second.push_back(atoi(vars_[restore(word)][0].c_str())); else bdy_second.push_back(atoi(word.c_str())); @@ -375,29 +375,29 @@ namespace Hermes ++counter; } } - else if(isCurv) + else if (isCurv) { while (stream >> word) { std::istringstream istr(word); - if(counter%5 == 0) + if (counter % 5 == 0) { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) curv_first.push_back(atoi(vars_[restore(word)][0].c_str())); else curv_first.push_back(atoi(word.c_str())); } - else if(counter%5 == 1) + else if (counter % 5 == 1) { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) curv_second.push_back(atoi(vars_[restore(word)][0].c_str())); else curv_second.push_back(atoi(word.c_str())); } - else if(counter%5 == 2) + else if (counter % 5 == 2) { - if(istr >> dummy_dbl) + if (istr >> dummy_dbl) { curv_third.push_back(atof(word.c_str())); } @@ -408,7 +408,7 @@ namespace Hermes stream >> next_word; - if(next_word == "") + if (next_word == "") { curv_nurbs.push_back(false); @@ -422,7 +422,7 @@ namespace Hermes curv_nurbs.push_back(true); } } - else if(counter%5 == 3) + else if (counter % 5 == 3) { curv_inner_pts.push_back(restore(next_word)); curv_knots.push_back(restore(word)); @@ -432,22 +432,22 @@ namespace Hermes ++counter; } } - else if(isRef) + else if (isRef) { while (stream >> word) { std::istringstream istr(word); - if(counter%2 == 0) + if (counter % 2 == 0) { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) ref_elt.push_back(atoi(vars_[restore(word)][0].c_str())); else ref_elt.push_back(atoi(word.c_str())); } else { - if(!(istr >> dummy_int)) + if (!(istr >> dummy_int)) ref_type.push_back(atoi(vars_[restore(word)][0].c_str())); else ref_type.push_back(atoi(word.c_str())); @@ -456,7 +456,7 @@ namespace Hermes ++counter; } } - else if(isVar) + else if (isVar) { while (stream >> word) { diff --git a/hermes2d/src/mesh/mesh_reader_exodusii.cpp b/hermes2d/src/mesh/mesh_reader_exodusii.cpp index 142fcbf98c..20e34656bc 100644 --- a/hermes2d/src/mesh/mesh_reader_exodusii.cpp +++ b/hermes2d/src/mesh/mesh_reader_exodusii.cpp @@ -41,11 +41,11 @@ namespace Hermes { bool operator()(Vertex a, Vertex b) const { - if(a.x < b.x) return true; - else if(a.x > b.x) return false; + if (a.x < b.x) return true; + else if (a.x > b.x) return false; else { - if(a.y < b.y) return true; + if (a.y < b.y) return true; return false; } } @@ -54,8 +54,10 @@ namespace Hermes void MeshReaderExodusII::load(const char *file_name, MeshSharedPtr mesh) { int err; - int cpu_ws = sizeof(double); // use float or double - int io_ws = 8; // store variables as doubles + // use float or double + int cpu_ws = sizeof(double); + // store variables as doubles + int io_ws = 8; float version; int exoid = ex_open(file_name, EX_READ, &cpu_ws, &io_ws, &version); @@ -63,7 +65,7 @@ namespace Hermes int n_dims, n_nodes, n_elems, n_eblocks, n_nodesets, n_sidesets; char title[MAX_LINE_LENGTH + 1]; err = ex_get_init(exoid, title, &n_dims, &n_nodes, &n_elems, &n_eblocks, &n_nodesets, &n_sidesets); - if(n_dims != 2) + if (n_dims != 2) throw Hermes::Exceptions::Exception("File '%s' does not contain 2D mesh", file_name); // load coordinates @@ -72,15 +74,18 @@ namespace Hermes err = ex_get_coord(exoid, x, y, nullptr); // remove duplicate vertices and build renumbering map - std::map vtx_list; // map for eliminating duplicities - std::map vmap; // reindexing map - Hermes::vector vtx_arr; // vertex array + // map for eliminating duplicities + std::map vtx_list; + // reindexing map + std::map vmap; + // vertex array + std::vector vtx_arr; int vid = 0; for (int i = 0; i < n_nodes; i++) { int k; Vertex v = { x[i], y[i] }; - if(vtx_list.count(v) == 0) + if (vtx_list.count(v) == 0) { vtx_arr.push_back(v); k = vid++; @@ -91,8 +96,8 @@ namespace Hermes vmap[i + 1] = k; } - delete [] x; - delete [] y; + delete[] x; + delete[] y; int n_vtx = vtx_arr.size(); double2 *vtx = new double2[n_vtx]; @@ -102,8 +107,10 @@ namespace Hermes vtx[i][1] = vtx_arr[i].y; } - int n_tri = 0; // number of triangles - int n_quad = 0; // number of quads + // number of triangles + int n_tri = 0; + // number of quads + int n_quad = 0; // get info about element blocks int *eid_blocks = new int[n_eblocks]; @@ -118,22 +125,27 @@ namespace Hermes int n_elems_in_blk, n_elem_nodes, n_attrs; err = ex_get_elem_block(exoid, id, elem_type, &n_elems_in_blk, &n_elem_nodes, &n_attrs); - if(n_elem_nodes == 3) n_tri += n_elems_in_blk; - else if(n_elem_nodes == 4) n_quad += n_elems_in_blk; + if (n_elem_nodes == 3) n_tri += n_elems_in_blk; + else if (n_elem_nodes == 4) n_quad += n_elems_in_blk; else { - delete [] vtx; + delete[] vtx; throw Hermes::Exceptions::Exception("Unknown type of element"); } } - int3 *tri = n_tri > 0 ? new int3[n_tri] : nullptr; // triangles + // triangles + int3 *tri = n_tri > 0 ? new int3[n_tri] : nullptr; std::string *tri_markers = n_tri > 0 ? new std::string[n_tri] : nullptr; - int4 *quad = n_quad > 0 ? new int4[n_quad] : nullptr; // quads + // quads + int4 *quad = n_quad > 0 ? new int4[n_quad] : nullptr; std::string *quad_markers = n_quad > 0 ? new std::string[n_quad] : nullptr; - int n_els = n_tri + n_quad; // total number of elements - int **els = n_els > 0 ? new int *[n_els] : nullptr; // elements - int *el_nv = n_els > 0 ? new int[n_els] : nullptr; // number of vertices for each element + // total number of elements + int n_els = n_tri + n_quad; + // elements + int **els = n_els > 0 ? new int *[n_els] : nullptr; + // number of vertices for each element + int *el_nv = n_els > 0 ? new int[n_els] : nullptr; int it = 0, iq = 0, iel = 0; for (int i = 0; i < n_eblocks; i++) @@ -162,7 +174,7 @@ namespace Hermes for (int j = 0; j < n_elems_in_blk; j++) { el_nv[iel] = n_elem_nodes; - if(n_elem_nodes == 3) + if (n_elem_nodes == 3) { tri[it][0] = vmap[connect[ic++]]; tri[it][1] = vmap[connect[ic++]]; @@ -171,7 +183,7 @@ namespace Hermes els[iel] = tri[it]; it++; } - else if(n_elem_nodes == 4) + else if (n_elem_nodes == 4) { quad[iq][0] = vmap[connect[ic++]]; quad[iq][1] = vmap[connect[ic++]]; @@ -183,21 +195,22 @@ namespace Hermes } else { - delete [] vtx; + delete[] vtx; throw Hermes::Exceptions::Exception("Unknown type of element"); } iel++; } - delete [] connect; + delete[] connect; } - delete [] eid_blocks; + delete[] eid_blocks; // query number of side sets int *sid_blocks = new int[n_sidesets]; err = ex_get_side_set_ids(exoid, sid_blocks); // go over the sidesets - int n_mark = 0; // number of markers + // number of markers + int n_mark = 0; for (int i = 0; i < n_sidesets; i++) { int sid = sid_blocks[i]; @@ -231,7 +244,8 @@ namespace Hermes for (int j = 0; j < num_elem_in_set; j++) { - int nv = el_nv[side_list[j] - 1]; // # of vertices of the element + // # of vertices of the element + int nv = el_nv[side_list[j] - 1]; int vt = side_list[j] - 1; marks[im][0] = els[elem_list[j] - 1][vt]; marks[im][1] = els[elem_list[j] - 1][(vt + 1) % nv]; @@ -239,10 +253,10 @@ namespace Hermes im++; } - delete [] elem_list; - delete [] side_list; + delete[] elem_list; + delete[] side_list; } - delete [] sid_blocks; + delete[] sid_blocks; // we are done err = ex_close(exoid); @@ -250,15 +264,15 @@ namespace Hermes mesh->create(n_vtx, vtx, n_tri, tri, tri_markers, n_quad, quad, quad_markers, n_mark, marks, bnd_markers); // clean-up - delete [] marks; - delete [] tri; - delete [] quad; - delete [] tri_markers; - delete [] quad_markers; - delete [] bnd_markers; - delete [] vtx; - delete [] el_nv; - delete [] els; + delete[] marks; + delete[] tri; + delete[] quad; + delete[] tri_markers; + delete[] quad_markers; + delete[] bnd_markers; + delete[] vtx; + delete[] el_nv; + delete[] els; } } } diff --git a/hermes2d/src/mesh/mesh_reader_h1d_xml.cpp b/hermes2d/src/mesh/mesh_reader_h1d_xml.cpp index bc53a0ac29..2be65bc4a0 100644 --- a/hermes2d/src/mesh/mesh_reader_h1d_xml.cpp +++ b/hermes2d/src/mesh/mesh_reader_h1d_xml.cpp @@ -89,20 +89,20 @@ namespace Hermes // test of value if no variable found. if (!x_found) - if (std::strtod(x.c_str(), nullptr) != 0.0) - x_value = std::strtod(x.c_str(), nullptr); - else - { - // This is a hard part, to find out if it is really zero. - int dot_position = strchr(x.c_str(), '.') == nullptr ? -1 : strchr(x.c_str(), '.') - x.c_str(); - for (int i = 0; i < dot_position; i++) - if (strncmp(x.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertices_i % vertices_count + 1); - for (int i = dot_position + 1; i < x.length(); i++) - if (strncmp(x.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertices_i % vertices_count + 1); - x_value = std::strtod(x.c_str(), nullptr); - } + if (std::strtod(x.c_str(), nullptr) != 0.0) + x_value = std::strtod(x.c_str(), nullptr); + else + { + // This is a hard part, to find out if it is really zero. + int dot_position = strchr(x.c_str(), '.') == nullptr ? -1 : strchr(x.c_str(), '.') - x.c_str(); + for (int i = 0; i < dot_position; i++) + if (strncmp(x.c_str() + i, "0", 1) != 0) + this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertices_i % vertices_count + 1); + for (int i = dot_position + 1; i < x.length(); i++) + if (strncmp(x.c_str() + i, "0", 1) != 0) + this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertices_i % vertices_count + 1); + x_value = std::strtod(x.c_str(), nullptr); + } // assignment. node->x = x_value; @@ -120,10 +120,10 @@ namespace Hermes Node* node; for_all_nodes(node, mesh) - if (node->y == 0) - node->y = 0; - else - node->y = (b - a) / 100; + if (node->y == 0) + node->y = 0; + else + node->y = (b - a) / 100; // Elements // mesh->nbase = mesh->nactive = mesh->ninitial = vertices_count - 1; @@ -204,4 +204,4 @@ namespace Hermes /// \todo Is this necessary? It is a valid H2D mesh afterall. } } -} +} \ No newline at end of file diff --git a/hermes2d/src/mesh/mesh_reader_h2d.cpp b/hermes2d/src/mesh/mesh_reader_h2d.cpp index 6c04ccfd73..703761738b 100644 --- a/hermes2d/src/mesh/mesh_reader_h2d.cpp +++ b/hermes2d/src/mesh/mesh_reader_h2d.cpp @@ -19,477 +19,488 @@ namespace Hermes { - namespace Hermes2D - { - extern unsigned g_mesh_seq; - - MeshReaderH2D::MeshReaderH2D() - { - } - - MeshReaderH2D::~MeshReaderH2D() - { - } - - Arc* MeshReaderH2D::load_arc(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2, Arc* arc) - { - // read the end point indices - p1 = m->curv_first[id]; - p2 = m->curv_second[id]; - - *en = mesh->peek_edge_node(p1, p2); - if (*en == nullptr) - throw Hermes::Exceptions::MeshLoadFailureException("Curve #%d: edge %d-%d does not exist.", id, p1, p2); - - // get the number of control points - std::vector vCP; - - // edge endpoints are also control points, with weight 1.0 - arc->pt[0][0] = mesh->nodes[p1].x; - arc->pt[0][1] = mesh->nodes[p1].y; - arc->pt[0][2] = 1.0; - arc->pt[2][0] = mesh->nodes[p2].x; - arc->pt[2][1] = mesh->nodes[p2].y; - arc->pt[2][2] = 1.0; - - // read the arc angle - arc->angle = m->curv_third[id]; - double a = (180.0 - arc->angle) / 180.0 * M_PI; - - // generate one control point - double x = 1.0 / tan(a * 0.5); - arc->pt[1][0] = 0.5*((arc->pt[2][0] + arc->pt[0][0]) + (arc->pt[2][1] - arc->pt[0][1]) * x); - arc->pt[1][1] = 0.5*((arc->pt[2][1] + arc->pt[0][1]) - (arc->pt[2][0] - arc->pt[0][0]) * x); - arc->pt[1][2] = cos((M_PI - a) * 0.5); - - // get the number of knot vector points - std::vector vKnots; - - return arc; - } - - Nurbs* MeshReaderH2D::load_nurbs(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2, Nurbs* nurbs) - { - // read the end point indices - p1 = m->curv_first[id]; - p2 = m->curv_second[id]; - - *en = mesh->peek_edge_node(p1, p2); - if (*en == nullptr) - throw Hermes::Exceptions::MeshLoadFailureException("Curve #%d: edge %d-%d does not exist.", id, p1, p2); - - nurbs->degree = m->curv_third[id]; - - // get the number of control points - std::vector vCP; - - int inner = 1, outer; - for (unsigned int i = 0; i < m->vars_[m->curv_inner_pts[id]].size(); ++i) - { - std::istringstream istr(m->vars_[m->curv_inner_pts[id]][i]); - - double dummy_dbl; - if (!(istr >> dummy_dbl)) - vCP.push_back(atof(m->vars_[m->vars_[m->curv_inner_pts[id]][i]][0].c_str())); - else - vCP.push_back(atof(m->vars_[m->curv_inner_pts[id]][i].c_str())); - } - inner = vCP.size() / 3; - - nurbs->np = inner + 2; - - // edge endpoints are also control points, with weight 1.0 - nurbs->pt = new double3[nurbs->np]; - nurbs->pt[0][0] = mesh->nodes[p1].x; - nurbs->pt[0][1] = mesh->nodes[p1].y; - nurbs->pt[0][2] = 1.0; - nurbs->pt[inner + 1][0] = mesh->nodes[p2].x; - nurbs->pt[inner + 1][1] = mesh->nodes[p2].y; - nurbs->pt[inner + 1][2] = 1.0; - - // read inner control points - for (int i = 0; i < inner; i++) - { - for (int j = 0; j < 3; ++j) - nurbs->pt[i + 1][j] = vCP[3 * i + j]; - } - - // get the number of knot vector points - std::vector vKnots; - - inner = 0; - for (unsigned int i = 0; i < m->vars_[m->curv_knots[id]].size(); ++i) - { - std::istringstream istr(m->vars_[m->curv_knots[id]][i]); - double dummy_dbl; - - if (!(istr >> dummy_dbl)) - vKnots.push_back(atof(m->vars_[m->vars_[m->curv_knots[id]][i]][0].c_str())); - else - vKnots.push_back(atof(m->vars_[m->curv_knots[id]][i].c_str())); - } - inner = vKnots.size(); - - nurbs->nk = nurbs->degree + nurbs->np + 1; - outer = nurbs->nk - inner; - if ((outer & 1) == 1) - throw Hermes::Exceptions::MeshLoadFailureException("Curve #%d: incorrect number of knot points.", id); - - // knot vector is completed by 0.0 on the left and by 1.0 on the right - nurbs->kv = new double[nurbs->nk]; - - for (int i = 0; i < outer / 2; i++) - nurbs->kv[i] = 0.0; - - if (inner) { - for (int i = outer / 2; i < inner + outer / 2; i++) { - nurbs->kv[i] = vKnots[i - (outer / 2)]; - } - } - - for (int i = outer / 2 + inner; i < nurbs->nk; i++) - nurbs->kv[i] = 1.0; - - return nurbs; - } - - Curve* MeshReaderH2D::load_curve(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2) - { - if (m->curv_nurbs[id]) - return load_nurbs(mesh, m, id, en, p1, p2, new Nurbs); - else - return load_arc(mesh, m, id, en, p1, p2, new Arc); - } - - void MeshReaderH2D::load(const char *filename, MeshSharedPtr mesh) - { - // Check if file exists - std::ifstream s(filename); - if(!s.good()) - throw Hermes::Exceptions::MeshLoadFailureException("Mesh file not found."); - s.close(); - - int i, j, n; - Node* en; - bool debug = false; - - mesh->free(); - - std::string fName(filename); - MeshData m(fName); - m.parse_mesh(); - - //// vertices //////////////////////////////////////////////////////////////// - - n = m.n_vert; - if(n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'vertices' must be a list.", filename); - if(n < 2) throw Hermes::Exceptions::MeshLoadFailureException("File %s: invalid number of vertices.", filename); - - // create a hash table large enough - int size = HashTable::H2D_DEFAULT_HASH_SIZE; - while (size < 8*n) size *= 2; - mesh->init(size); - - // create top-level vertex nodes - for (i = 0; i < n; i++) - { - Node* node = mesh->nodes.add(); - assert(node->id == i); - node->ref = TOP_LEVEL_REF; - node->type = HERMES_TYPE_VERTEX; - node->bnd = 0; - node->p1 = node->p2 = -1; - node->next_hash = nullptr; - node->x = m.x_vertex[i]; - node->y = m.y_vertex[i]; - } - mesh->ntopvert = n; - - //// elements //////////////////////////////////////////////////////////////// - - n = m.n_el; - if(n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'elements' must be a list.", filename); - if(n < 1) throw Hermes::Exceptions::MeshLoadFailureException("File %s: no elements defined.", filename); - - // create elements - mesh->nactive = 0; - for (i = 0; i < n; i++) - { - // read and check vertex indices - int nv; - if(m.en4[i] == -1) nv = 4; - else nv = 5; - - int* idx = new int[nv-1]; - std::string el_marker; - if(!nv) { - mesh->elements.skip_slot()->cm = nullptr; - continue; - } - - if(nv < 4 || nv > 5) - { - delete [] idx; - throw Hermes::Exceptions::MeshLoadFailureException("File %s: element #%d: wrong number of vertex indices.", filename, i); - } - - if(nv == 4) { - idx[0] = m.en1[i]; - idx[1] = m.en2[i]; - idx[2] = m.en3[i]; - - el_marker = m.e_mtl[i]; - } - else { - idx[0] = m.en1[i]; - idx[1] = m.en2[i]; - idx[2] = m.en3[i]; - idx[3] = m.en4[i]; - - el_marker = m.e_mtl[i]; - } - for (j = 0; j < nv-1; j++) - if(idx[j] < 0 || idx[j] >= mesh->ntopvert) - { - delete [] idx; - throw Hermes::Exceptions::MeshLoadFailureException("File %s: error creating element #%d: vertex #%d does not exist.", filename, i, idx[j]); - } - - Node *v0 = &mesh->nodes[idx[0]], *v1 = &mesh->nodes[idx[1]], *v2 = &mesh->nodes[idx[2]]; - - int marker; - - // This functions check if the user-supplied marker on this element has been - // already used, and if not, inserts it in the appropriate structure. - mesh->element_markers_conversion.insert_marker(el_marker); - marker = mesh->element_markers_conversion.get_internal_marker(el_marker).marker; - - if(nv == 4) { - Mesh::check_triangle(i, v0, v1, v2); - mesh->create_triangle(marker, v0, v1, v2, nullptr); - } - else { - Node *v3 = &mesh->nodes[idx[3]]; - Mesh::check_quad(i, v0, v1, v2, v3); - mesh->create_quad(marker, v0, v1, v2, v3, nullptr); - } - - mesh->nactive++; - - delete [] idx; - } - mesh->nbase = n; - - //// boundaries ////////////////////////////////////////////////////////////// - if(m.n_bdy > 0) - { - n = m.n_bdy; - - // read boundary data - for (i = 0; i < n; i++) - { - int v1, v2, marker; - v1 = m.bdy_first[i]; - v2 = m.bdy_second[i]; - - en = mesh->peek_edge_node(v1, v2); - if(en == nullptr) - throw Hermes::Exceptions::MeshLoadFailureException("File %s: boundary data #%d: edge %d-%d does not exist", filename, i, v1, v2); - - std::string bnd_marker; - bnd_marker = m.bdy_type[i]; - - // This functions check if the user-supplied marker on this element has been - // already used, and if not, inserts it in the appropriate structure. - mesh->boundary_markers_conversion.insert_marker(bnd_marker); - marker = mesh->boundary_markers_conversion.get_internal_marker(bnd_marker).marker; - - en->marker = marker; - } - } - - Node* node; - for_all_edge_nodes(node, mesh) - { - if (node->ref < 2) - { - mesh->nodes[node->p1].bnd = 1; - mesh->nodes[node->p2].bnd = 1; - node->bnd = 1; - } - } - - //// curves ////////////////////////////////////////////////////////////////// - if(m.n_curv > 0) - { - n = m.n_curv; - if(n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'curves' must be a list.", filename); - - // load curved edges - for (i = 0; i < n; i++) - { - // load the control points, knot vector, etc. - Node* en; - int p1, p2; - - Curve* curve = load_curve(mesh, &m, i, &en, p1, p2); - - // assign the arc to the elements sharing the edge node - MeshUtil::assign_curve(en, curve, p1, p2); - } - } - - // update refmap coeffs of curvilinear elements - Element* e; - for_all_used_elements(e, mesh) - { - if (e->cm != nullptr) - e->cm->update_refmap_coeffs(e); - RefMap::set_element_iro_cache(e); - } - - //// refinements ///////////////////////////////////////////////////////////// - if(m.n_ref > 0) - { - n = m.n_ref; - if(n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'refinements' must be a list.", filename); - - // perform initial refinements - for (i = 0; i < n; i++) - { - int id, ref; - id = m.ref_elt[i]; - ref = m.ref_type[i]; - mesh->refine_element_id(id, ref); - } - } - mesh->ninitial = mesh->elements.get_num_items(); - - mesh->seq = g_mesh_seq++; - if(HermesCommonApi.get_integral_param_value(checkMeshesOnLoad)) - mesh->initial_single_check(); - } - - void MeshReaderH2D::save_refinements(MeshSharedPtr mesh, FILE* f, Element* e, int id, bool& first) - { - if(e->active) return; - fprintf(f, first ? "refinements =\n{\n" : ",\n"); first = false; - if(e->bsplit()) - { - fprintf(f, " { %d, 0 }", id); - int sid = mesh->seq; mesh->seq += 4; - for (int i = 0; i < 4; i++) - save_refinements(mesh, f, e->sons[i], sid+i, first); - } - else if(e->hsplit()) - { - fprintf(f, " { %d, 1 }", id); - int sid = mesh->seq; mesh->seq += 2; - save_refinements(mesh, f, e->sons[0], sid, first); - save_refinements(mesh, f, e->sons[1], sid+1, first); - } - else - { - fprintf(f, " { %d, 2 }", id); - int sid = mesh->seq; mesh->seq += 2; - save_refinements(mesh, f, e->sons[2], sid, first); - save_refinements(mesh, f, e->sons[3], sid+1, first); - } - } - - void MeshReaderH2D::save_curve(MeshSharedPtr mesh, FILE* f, int p1, int p2, Curve* curve) - { - if(curve->type == ArcType) - { - fprintf(f, " [ %d, %d, %.16g ]", p1, p2, ((Arc*)curve)->angle); - } - else - { - int inner = ((Nurbs*)curve)->np - 2; - int outer = ((Nurbs*)curve)->nk - inner; - fprintf(f, " ú %d, %d, %d, ú ", p1, p2, ((Nurbs*)curve)->degree); - for (int i = 1; i < ((Nurbs*)curve)->np - 1; i++) - fprintf(f, "ú %.16g, %.16g, %.16g ]%s ", - ((Nurbs*)curve)->pt[i][0], ((Nurbs*)curve)->pt[i][1], ((Nurbs*)curve)->pt[i][2], - i < ((Nurbs*)curve)->np - 2 ? "," : ""); - - fprintf(f, "],[ "); - int max = ((Nurbs*)curve)->nk - (((Nurbs*)curve)->degree + 1); - for (int i = ((Nurbs*)curve)->degree + 1; i < max; i++) - fprintf(f, "%.16g%s", ((Nurbs*)curve)->kv[i], i < max - 1 ? "," : ""); - fprintf(f, "] ]"); - } - } - - void MeshReaderH2D::save(const char* filename, MeshSharedPtr mesh) - { - int i, mrk; - Element* e; - - // open output file - FILE* f = fopen(filename, "w"); - if(f == nullptr) throw Hermes::Exceptions::MeshLoadFailureException("Could not create mesh file."); - //fprintf(f, "# hermes2d saved mesh\n\n"); - - // save vertices - fprintf(f, "vertices =\n[\n"); - for (i = 0; i < mesh->ntopvert; i++) - fprintf(f, " [ %.16g, %.16g ]%s\n", mesh->nodes[i].x, mesh->nodes[i].y, (i < mesh->ntopvert-1 ? "," : "")); - - // save elements - fprintf(f, "]\n\nelements =\n["); - bool first = true; - for (i = 0; i < mesh->get_num_base_elements(); i++) - { - const char* nl = first ? "\n" : ",\n"; first = false; - e = mesh->get_element_fast(i); - if(!e->used) - fprintf(f, "%s [ ]", nl); - else if(e->is_triangle()) - fprintf(f, "%s [ %d, %d, %d, \"%s\" ]", nl, e->vn[0]->id, e->vn[1]->id, e->vn[2]->id, mesh->get_element_markers_conversion().get_user_marker(e->marker).marker.c_str()); - else - fprintf(f, "%s [ %d, %d, %d, %d, \"%s\" ]", nl, e->vn[0]->id, e->vn[1]->id, e->vn[2]->id, e->vn[3]->id, mesh->get_element_markers_conversion().get_user_marker(e->marker).marker.c_str()); - } - - // save boundary markers - fprintf(f, "\n]\n\nboundaries =\n["); - first = true; - for_all_base_elements(e, mesh) - { - for (unsigned i = 0; i < e->get_nvert(); i++) - if((mrk = MeshUtil::get_base_edge_node(e, i)->marker)) - { - const char* nl = first ? "\n" : ",\n"; first = false; - fprintf(f, "%s [ %d, %d, \"%s\" ]", nl, e->vn[i]->id, e->vn[e->next_vert(i)]->id, mesh->boundary_markers_conversion.get_user_marker(mrk).marker.c_str()); - } - } - fprintf(f, "\n]\n\n"); - - // save curved edges - first = true; - for_all_base_elements(e, mesh) - { - if(e->is_curved()) - { - for (unsigned i = 0; i < e->get_nvert(); i++) - if(e->cm->curves[i] != nullptr) - { - fprintf(f, first ? "curves =\n[\n" : ",\n"); first = false; - save_curve(mesh, f, e->vn[i]->id, e->vn[e->next_vert(i)]->id, e->cm->curves[i]); - } - if(!first) fprintf(f, "\n]\n\n"); - } - } - // save refinements - unsigned temp = mesh->seq; - mesh->seq = mesh->nbase; - first = true; - for_all_base_elements(e, mesh) - save_refinements(mesh, f, e, e->id, first); - if(!first) fprintf(f, "\n]\n\n"); - - mesh->seq = temp; - fclose(f); - } - } + namespace Hermes2D + { + extern unsigned g_mesh_seq; + + MeshReaderH2D::MeshReaderH2D() + { + } + + MeshReaderH2D::~MeshReaderH2D() + { + } + + Arc* MeshReaderH2D::load_arc(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2, Arc* arc) + { + // read the end point indices + p1 = m->curv_first[id]; + p2 = m->curv_second[id]; + + *en = mesh->peek_edge_node(p1, p2); + if (*en == nullptr) + throw Hermes::Exceptions::MeshLoadFailureException("Curve #%d: edge %d-%d does not exist.", id, p1, p2); + + // get the number of control points + std::vector vCP; + + // edge endpoints are also control points, with weight 1.0 + arc->pt[0][0] = mesh->nodes[p1].x; + arc->pt[0][1] = mesh->nodes[p1].y; + arc->pt[0][2] = 1.0; + arc->pt[2][0] = mesh->nodes[p2].x; + arc->pt[2][1] = mesh->nodes[p2].y; + arc->pt[2][2] = 1.0; + + // read the arc angle + arc->angle = m->curv_third[id]; + double a = (180.0 - arc->angle) / 180.0 * M_PI; + + // generate one control point + double x = 1.0 / tan(a * 0.5); + arc->pt[1][0] = 0.5*((arc->pt[2][0] + arc->pt[0][0]) + (arc->pt[2][1] - arc->pt[0][1]) * x); + arc->pt[1][1] = 0.5*((arc->pt[2][1] + arc->pt[0][1]) - (arc->pt[2][0] - arc->pt[0][0]) * x); + arc->pt[1][2] = cos((M_PI - a) * 0.5); + + // get the number of knot vector points + std::vector vKnots; + + return arc; + } + + Nurbs* MeshReaderH2D::load_nurbs(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2, Nurbs* nurbs) + { + // read the end point indices + p1 = m->curv_first[id]; + p2 = m->curv_second[id]; + + *en = mesh->peek_edge_node(p1, p2); + if (*en == nullptr) + throw Hermes::Exceptions::MeshLoadFailureException("Curve #%d: edge %d-%d does not exist.", id, p1, p2); + + nurbs->degree = m->curv_third[id]; + + // get the number of control points + std::vector vCP; + + int inner = 1, outer; + for (unsigned int i = 0; i < m->vars_[m->curv_inner_pts[id]].size(); ++i) + { + std::istringstream istr(m->vars_[m->curv_inner_pts[id]][i]); + + double dummy_dbl; + if (!(istr >> dummy_dbl)) + vCP.push_back(atof(m->vars_[m->vars_[m->curv_inner_pts[id]][i]][0].c_str())); + else + vCP.push_back(atof(m->vars_[m->curv_inner_pts[id]][i].c_str())); + } + inner = vCP.size() / 3; + + nurbs->np = inner + 2; + + // edge endpoints are also control points, with weight 1.0 + nurbs->pt = new double3[nurbs->np]; + nurbs->pt[0][0] = mesh->nodes[p1].x; + nurbs->pt[0][1] = mesh->nodes[p1].y; + nurbs->pt[0][2] = 1.0; + nurbs->pt[inner + 1][0] = mesh->nodes[p2].x; + nurbs->pt[inner + 1][1] = mesh->nodes[p2].y; + nurbs->pt[inner + 1][2] = 1.0; + + // read inner control points + for (int i = 0; i < inner; i++) + { + for (int j = 0; j < 3; ++j) + nurbs->pt[i + 1][j] = vCP[3 * i + j]; + } + + // get the number of knot vector points + std::vector vKnots; + + inner = 0; + for (unsigned int i = 0; i < m->vars_[m->curv_knots[id]].size(); ++i) + { + std::istringstream istr(m->vars_[m->curv_knots[id]][i]); + double dummy_dbl; + + if (!(istr >> dummy_dbl)) + vKnots.push_back(atof(m->vars_[m->vars_[m->curv_knots[id]][i]][0].c_str())); + else + vKnots.push_back(atof(m->vars_[m->curv_knots[id]][i].c_str())); + } + inner = vKnots.size(); + + nurbs->nk = nurbs->degree + nurbs->np + 1; + outer = nurbs->nk - inner; + if ((outer & 1) == 1) + throw Hermes::Exceptions::MeshLoadFailureException("Curve #%d: incorrect number of knot points.", id); + + // knot vector is completed by 0.0 on the left and by 1.0 on the right + nurbs->kv = new double[nurbs->nk]; + + for (int i = 0; i < outer / 2; i++) + nurbs->kv[i] = 0.0; + + if (inner) { + for (int i = outer / 2; i < inner + outer / 2; i++) { + nurbs->kv[i] = vKnots[i - (outer / 2)]; + } + } + + for (int i = outer / 2 + inner; i < nurbs->nk; i++) + nurbs->kv[i] = 1.0; + + return nurbs; + } + + Curve* MeshReaderH2D::load_curve(MeshSharedPtr mesh, MeshData *m, int id, Node** en, int &p1, int &p2) + { + if (m->curv_nurbs[id]) + return load_nurbs(mesh, m, id, en, p1, p2, new Nurbs); + else + return load_arc(mesh, m, id, en, p1, p2, new Arc); + } + + void MeshReaderH2D::load(std::string filename, MeshSharedPtr mesh) + { + // Check if file exists + std::ifstream s(filename); + if (!s.good()) + throw Hermes::Exceptions::MeshLoadFailureException("Mesh file not found."); + s.close(); + + int i, j, n; + Node* en; + bool debug = false; + + mesh->free(); + + MeshData m(filename); + m.parse_mesh(); + + //// vertices //////////////////////////////////////////////////////////////// + + n = m.n_vert; + if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'vertices' must be a list.", filename.c_str()); + if (n < 2) throw Hermes::Exceptions::MeshLoadFailureException("File %s: invalid number of vertices.", filename.c_str()); + + // create a hash table large enough + int size = HashTable::H2D_DEFAULT_HASH_SIZE; + while (size < 8 * n) size *= 2; + mesh->init(size); + + // create top-level vertex nodes + for (i = 0; i < n; i++) + { + Node* node = mesh->nodes.add(); + assert(node->id == i); + node->ref = TOP_LEVEL_REF; + node->type = HERMES_TYPE_VERTEX; + node->bnd = 0; + node->p1 = node->p2 = -1; + node->next_hash = nullptr; + node->x = m.x_vertex[i]; + node->y = m.y_vertex[i]; + } + mesh->ntopvert = n; + + //// elements //////////////////////////////////////////////////////////////// + + n = m.n_el; + if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'elements' must be a list.", filename.c_str()); + if (n < 1) throw Hermes::Exceptions::MeshLoadFailureException("File %s: no elements defined.", filename.c_str()); + + // create elements + mesh->nactive = 0; + for (i = 0; i < n; i++) + { + // read and check vertex indices + int nv; + if (m.en4[i] == -1) nv = 4; + else nv = 5; + + int* idx = new int[nv - 1]; + std::string el_marker; + if (!nv) { + mesh->elements.skip_slot()->cm = nullptr; + continue; + } + + if (nv < 4 || nv > 5) + { + delete[] idx; + throw Hermes::Exceptions::MeshLoadFailureException("File %s: element #%d: wrong number of vertex indices.", filename.c_str(), i); + } + + if (nv == 4) { + idx[0] = m.en1[i]; + idx[1] = m.en2[i]; + idx[2] = m.en3[i]; + + el_marker = m.e_mtl[i]; + } + else { + idx[0] = m.en1[i]; + idx[1] = m.en2[i]; + idx[2] = m.en3[i]; + idx[3] = m.en4[i]; + + el_marker = m.e_mtl[i]; + } + for (j = 0; j < nv - 1; j++) + if (idx[j] < 0 || idx[j] >= mesh->ntopvert) + { + delete[] idx; + throw Hermes::Exceptions::MeshLoadFailureException("File %s: error creating element #%d: vertex #%d does not exist.", filename.c_str(), i, idx[j]); + } + + Node *v0 = &mesh->nodes[idx[0]], *v1 = &mesh->nodes[idx[1]], *v2 = &mesh->nodes[idx[2]]; + + int marker; + + // This functions check if the user-supplied marker on this element has been + // already used, and if not, inserts it in the appropriate structure. + mesh->element_markers_conversion.insert_marker(el_marker); + marker = mesh->element_markers_conversion.get_internal_marker(el_marker).marker; + + if (nv == 4) { + Mesh::check_triangle(i, v0, v1, v2); + mesh->create_triangle(marker, v0, v1, v2, nullptr); + } + else { + Node *v3 = &mesh->nodes[idx[3]]; + Mesh::check_quad(i, v0, v1, v2, v3); + mesh->create_quad(marker, v0, v1, v2, v3, nullptr); + } + + mesh->nactive++; + + delete[] idx; + } + mesh->nbase = n; + + //// boundaries ////////////////////////////////////////////////////////////// + if (m.n_bdy > 0) + { + n = m.n_bdy; + + // read boundary data + for (i = 0; i < n; i++) + { + int v1, v2, marker; + v1 = m.bdy_first[i]; + v2 = m.bdy_second[i]; + + en = mesh->peek_edge_node(v1, v2); + if (en == nullptr) + throw Hermes::Exceptions::MeshLoadFailureException("File %s: boundary data #%d: edge %d-%d does not exist", filename.c_str(), i, v1, v2); + + std::string bnd_marker; + bnd_marker = m.bdy_type[i]; + + // This functions check if the user-supplied marker on this element has been + // already used, and if not, inserts it in the appropriate structure. + mesh->boundary_markers_conversion.insert_marker(bnd_marker); + marker = mesh->boundary_markers_conversion.get_internal_marker(bnd_marker).marker; + + en->marker = marker; + } + } + + Node* node; + for_all_edge_nodes(node, mesh) + { + if (node->ref < 2) + { + mesh->nodes[node->p1].bnd = 1; + mesh->nodes[node->p2].bnd = 1; + node->bnd = 1; + } + } + + //// curves ////////////////////////////////////////////////////////////////// + if (m.n_curv > 0) + { + n = m.n_curv; + if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'curves' must be a list.", filename.c_str()); + + // load curved edges + for (i = 0; i < n; i++) + { + // load the control points, knot vector, etc. + Node* en; + int p1, p2; + + Curve* curve = load_curve(mesh, &m, i, &en, p1, p2); + + // assign the arc to the elements sharing the edge node + MeshUtil::assign_curve(en, curve, p1, p2); + } + } + + // update refmap coeffs of curvilinear elements + Element* e; + for_all_used_elements(e, mesh) + { + if (e->cm != nullptr) + e->cm->update_refmap_coeffs(e); + this->ref_map.set_element_iro_cache(e); + } + + //// refinements ///////////////////////////////////////////////////////////// + if (m.n_ref > 0) + { + n = m.n_ref; + if (n < 0) throw Hermes::Exceptions::MeshLoadFailureException("File %s: 'refinements' must be a list.", filename.c_str()); + + // perform initial refinements + for (i = 0; i < n; i++) + { + int id, ref; + id = m.ref_elt[i]; + ref = m.ref_type[i]; + mesh->refine_element_id(id, ref); + } + } + mesh->ninitial = mesh->elements.get_num_items(); + + mesh->seq = g_mesh_seq++; + if (HermesCommonApi.get_integral_param_value(checkMeshesOnLoad)) + mesh->initial_single_check(); + } + + void MeshReaderH2D::load(const char *filename, MeshSharedPtr mesh) + { + std::string s(filename); + return this->load(s, mesh); + } + + void MeshReaderH2D::save_refinements(MeshSharedPtr mesh, FILE* f, Element* e, int id, bool& first) + { + if (e->active) return; + fprintf(f, first ? "refinements =\n{\n" : ",\n"); first = false; + if (e->bsplit()) + { + fprintf(f, " { %d, 0 }", id); + int sid = mesh->seq; mesh->seq += 4; + for (int i = 0; i < 4; i++) + save_refinements(mesh, f, e->sons[i], sid + i, first); + } + else if (e->hsplit()) + { + fprintf(f, " { %d, 1 }", id); + int sid = mesh->seq; mesh->seq += 2; + save_refinements(mesh, f, e->sons[0], sid, first); + save_refinements(mesh, f, e->sons[1], sid + 1, first); + } + else + { + fprintf(f, " { %d, 2 }", id); + int sid = mesh->seq; mesh->seq += 2; + save_refinements(mesh, f, e->sons[2], sid, first); + save_refinements(mesh, f, e->sons[3], sid + 1, first); + } + } + + void MeshReaderH2D::save_curve(MeshSharedPtr mesh, FILE* f, int p1, int p2, Curve* curve) + { + if (curve->type == ArcType) + { + fprintf(f, " [ %d, %d, %.16g ]", p1, p2, ((Arc*)curve)->angle); + } + else + { + int inner = ((Nurbs*)curve)->np - 2; + int outer = ((Nurbs*)curve)->nk - inner; + fprintf(f, " ú %d, %d, %d, ú ", p1, p2, ((Nurbs*)curve)->degree); + for (int i = 1; i < ((Nurbs*)curve)->np - 1; i++) + fprintf(f, "ú %.16g, %.16g, %.16g ]%s ", + ((Nurbs*)curve)->pt[i][0], ((Nurbs*)curve)->pt[i][1], ((Nurbs*)curve)->pt[i][2], + i < ((Nurbs*)curve)->np - 2 ? "," : ""); + + fprintf(f, "],[ "); + int max = ((Nurbs*)curve)->nk - (((Nurbs*)curve)->degree + 1); + for (int i = ((Nurbs*)curve)->degree + 1; i < max; i++) + fprintf(f, "%.16g%s", ((Nurbs*)curve)->kv[i], i < max - 1 ? "," : ""); + fprintf(f, "] ]"); + } + } + + void MeshReaderH2D::save(const char* filename, MeshSharedPtr mesh) + { + std::string s(filename); + return this->save(s, mesh); + } + + void MeshReaderH2D::save(std::string filename, MeshSharedPtr mesh) + { + int i, mrk; + Element* e; + + // open output file + FILE* f = fopen(filename.c_str(), "w"); + if (f == nullptr) throw Hermes::Exceptions::MeshLoadFailureException("Could not create mesh file."); + //fprintf(f, "# hermes2d saved mesh\n\n"); + + // save vertices + fprintf(f, "vertices =\n[\n"); + for (i = 0; i < mesh->ntopvert; i++) + fprintf(f, " [ %.16g, %.16g ]%s\n", mesh->nodes[i].x, mesh->nodes[i].y, (i < mesh->ntopvert - 1 ? "," : "")); + + // save elements + fprintf(f, "]\n\nelements =\n["); + bool first = true; + for (i = 0; i < mesh->get_num_base_elements(); i++) + { + const char* nl = first ? "\n" : ",\n"; first = false; + e = mesh->get_element_fast(i); + if (!e->used) + fprintf(f, "%s [ ]", nl); + else if (e->is_triangle()) + fprintf(f, "%s [ %d, %d, %d, \"%s\" ]", nl, e->vn[0]->id, e->vn[1]->id, e->vn[2]->id, mesh->get_element_markers_conversion().get_user_marker(e->marker).marker.c_str()); + else + fprintf(f, "%s [ %d, %d, %d, %d, \"%s\" ]", nl, e->vn[0]->id, e->vn[1]->id, e->vn[2]->id, e->vn[3]->id, mesh->get_element_markers_conversion().get_user_marker(e->marker).marker.c_str()); + } + + // save boundary markers + fprintf(f, "\n]\n\nboundaries =\n["); + first = true; + for_all_base_elements(e, mesh) + { + for (unsigned char i = 0; i < e->get_nvert(); i++) + if ((mrk = MeshUtil::get_base_edge_node(e, i)->marker)) + { + const char* nl = first ? "\n" : ",\n"; first = false; + fprintf(f, "%s [ %d, %d, \"%s\" ]", nl, e->vn[i]->id, e->vn[e->next_vert(i)]->id, mesh->boundary_markers_conversion.get_user_marker(mrk).marker.c_str()); + } + } + fprintf(f, "\n]\n\n"); + + // save curved edges + first = true; + for_all_base_elements(e, mesh) + { + if (e->is_curved()) + { + for (unsigned char i = 0; i < e->get_nvert(); i++) + if (e->cm->curves[i] != nullptr) + { + fprintf(f, first ? "curves =\n[\n" : ",\n"); first = false; + save_curve(mesh, f, e->vn[i]->id, e->vn[e->next_vert(i)]->id, e->cm->curves[i]); + } + if (!first) fprintf(f, "\n]\n\n"); + } + } + // save refinements + unsigned temp = mesh->seq; + mesh->seq = mesh->nbase; + first = true; + for_all_base_elements(e, mesh) + save_refinements(mesh, f, e, e->id, first); + if (!first) fprintf(f, "\n]\n\n"); + + mesh->seq = temp; + fclose(f); + } + } } \ No newline at end of file diff --git a/hermes2d/src/mesh/mesh_reader_h2d_bson.cpp b/hermes2d/src/mesh/mesh_reader_h2d_bson.cpp index 7041038343..f1e73f2e31 100644 --- a/hermes2d/src/mesh/mesh_reader_h2d_bson.cpp +++ b/hermes2d/src/mesh/mesh_reader_h2d_bson.cpp @@ -37,7 +37,7 @@ namespace Hermes void MeshReaderH2DBSON::load(const char *filename, MeshSharedPtr mesh) { - if(!mesh) + if (!mesh) throw Exceptions::NullException(1); mesh->free(); @@ -46,7 +46,7 @@ namespace Hermes fpr = fopen(filename, "rb"); // file size: - fseek (fpr, 0, SEEK_END); + fseek(fpr, 0, SEEK_END); int size = ftell(fpr); rewind(fpr); @@ -107,9 +107,8 @@ namespace Hermes } mesh->ntopvert = vertices_count; - delete [] vertex_xes; - delete [] vertex_yes; - + delete[] vertex_xes; + delete[] vertex_yes; // Elements // bson_find(&it, &br, "element-count"); @@ -162,7 +161,7 @@ namespace Hermes for (int element_i = 0; element_i < element_count; element_i++) { mesh->element_markers_conversion.insert_marker(markers[element_i]); - if(vertex_3[element_i] != -1) + if (vertex_3[element_i] != -1) e = mesh->create_quad(mesh->element_markers_conversion.get_internal_marker(markers[element_i]).marker, &mesh->nodes[vertex_0[element_i]], &mesh->nodes[vertex_1[element_i]], @@ -177,11 +176,11 @@ namespace Hermes nullptr); } - delete [] vertex_0; - delete [] vertex_1; - delete [] vertex_2; - delete [] vertex_3; - delete [] markers; + delete[] vertex_0; + delete[] vertex_1; + delete[] vertex_2; + delete[] vertex_3; + delete[] markers; // Boundaries // bson_find(&it, &br, "edge-count"); @@ -217,7 +216,7 @@ namespace Hermes for (unsigned int edge_i = 0; edge_i < edges_count; edge_i++) { en = mesh->peek_edge_node(vertex_0_edge[edge_i], vertex_1_edge[edge_i]); - if(en == nullptr) + if (en == nullptr) throw Hermes::Exceptions::MeshLoadFailureException("Boundary data #%d: edge %d-%d does not exist.", edge_i, vertex_0_edge[edge_i], vertex_1_edge[edge_i]); std::string edge_marker = edge_markers[edge_i]; @@ -242,12 +241,12 @@ namespace Hermes // check that all boundary edges have a marker assigned for_all_edge_nodes(en, mesh) - if(en->ref < 2 && en->marker == 0) + if (en->ref < 2 && en->marker == 0) this->warn("Boundary edge node does not have a boundary marker."); - delete [] vertex_0_edge; - delete [] vertex_1_edge; - delete [] edge_markers; + delete[] vertex_0_edge; + delete[] vertex_1_edge; + delete[] edge_markers; // Curves // @@ -311,9 +310,9 @@ namespace Hermes RefMap::set_element_iro_cache(e); } - delete [] p1s; - delete [] p2s; - delete [] angles; + delete[] p1s; + delete[] p2s; + delete[] angles; // Refinements. bson_find(&it, &br, "refinement-count"); @@ -344,16 +343,16 @@ namespace Hermes { int element_id = refined_elements[refinement_i]; int refinement_type = refinement_types[refinement_i]; - if(refinement_type == -1) + if (refinement_type == -1) mesh->unrefine_element_id(element_id); else mesh->refine_element_id(element_id, refinement_type); } - delete [] refined_elements; - delete [] refinement_types; + delete[] refined_elements; + delete[] refinement_types; - if(HermesCommonApi.get_integral_param_value(checkMeshesOnLoad)) + if (HermesCommonApi.get_integral_param_value(checkMeshesOnLoad)) mesh->initial_single_check(); } @@ -383,7 +382,7 @@ namespace Hermes // Save elements // - count. bson_append_int(&bw, "element-count", mesh->get_num_base_elements()); - // - first vertex ids + // - first vertex ids bson_append_start_array(&bw, "element-1"); for (int i = 0; i < mesh->get_num_base_elements(); i++) { @@ -391,7 +390,7 @@ namespace Hermes bson_append_int(&bw, "c", e->vn[0]->id); } bson_append_finish_array(&bw); - // - second vertex ids + // - second vertex ids bson_append_start_array(&bw, "element-2"); for (int i = 0; i < mesh->get_num_base_elements(); i++) { @@ -399,7 +398,7 @@ namespace Hermes bson_append_int(&bw, "c", e->vn[1]->id); } bson_append_finish_array(&bw); - // - third vertex ids + // - third vertex ids bson_append_start_array(&bw, "element-3"); for (int i = 0; i < mesh->get_num_base_elements(); i++) { @@ -407,12 +406,12 @@ namespace Hermes bson_append_int(&bw, "c", e->vn[2]->id); } bson_append_finish_array(&bw); - // - first vertex ids + // - first vertex ids bson_append_start_array(&bw, "element-4"); for (int i = 0; i < mesh->get_num_base_elements(); i++) { e = mesh->get_element_fast(i); - if(e->is_triangle()) + if (e->is_triangle()) bson_append_int(&bw, "c", -1); else bson_append_int(&bw, "c", e->vn[3]->id); @@ -432,28 +431,28 @@ namespace Hermes int edge_count = 0; for_all_base_elements(e, mesh) for (unsigned i = 0; i < e->get_nvert(); i++) - if(MeshUtil::get_base_edge_node(e, i)->marker) + if (MeshUtil::get_base_edge_node(e, i)->marker) edge_count++; bson_append_int(&bw, "edge-count", edge_count); // - ids 1 bson_append_start_array(&bw, "edge-1"); for_all_base_elements(e, mesh) for (unsigned i = 0; i < e->get_nvert(); i++) - if(MeshUtil::get_base_edge_node(e, i)->marker) + if (MeshUtil::get_base_edge_node(e, i)->marker) bson_append_int(&bw, "c", e->vn[i]->id); bson_append_finish_array(&bw); // - ids 2 bson_append_start_array(&bw, "edge-2"); for_all_base_elements(e, mesh) for (unsigned i = 0; i < e->get_nvert(); i++) - if(MeshUtil::get_base_edge_node(e, i)->marker) + if (MeshUtil::get_base_edge_node(e, i)->marker) bson_append_int(&bw, "c", e->vn[e->next_vert(i)]->id); bson_append_finish_array(&bw); // - markers bson_append_start_array(&bw, "edge-marker"); for_all_base_elements(e, mesh) for (unsigned i = 0; i < e->get_nvert(); i++) - if(MeshUtil::get_base_edge_node(e, i)->marker) + if (MeshUtil::get_base_edge_node(e, i)->marker) bson_append_string(&bw, "c", mesh->boundary_markers_conversion.get_user_marker(MeshUtil::get_base_edge_node(e, i)->marker).marker.c_str()); bson_append_finish_array(&bw); @@ -462,10 +461,10 @@ namespace Hermes int arc_count = 0; for_all_base_elements(e, mesh) { - if(e->is_curved()) + if (e->is_curved()) for (unsigned i = 0; i < e->get_nvert(); i++) - if(e->cm->curves[i] != nullptr) - if(e->cm->curves[i]->type == ArcType) + if (e->cm->curves[i] != nullptr) + if (e->cm->curves[i]->type == ArcType) arc_count++; } bson_append_int(&bw, "arc-count", arc_count); @@ -473,13 +472,13 @@ namespace Hermes bson_append_start_array(&bw, "arcs-p1"); for_all_base_elements(e, mesh) { - if(e->is_curved()) + if (e->is_curved()) for (unsigned i = 0; i < e->get_nvert(); i++) - if(e->cm->curves[i] != nullptr) + if (e->cm->curves[i] != nullptr) { - if(e->cm->curves[i]->type != ArcType) - continue; - bson_append_int(&bw, "c", e->vn[i]->id); + if (e->cm->curves[i]->type != ArcType) + continue; + bson_append_int(&bw, "c", e->vn[i]->id); } } bson_append_finish_array(&bw); @@ -487,13 +486,13 @@ namespace Hermes bson_append_start_array(&bw, "arcs-p2"); for_all_base_elements(e, mesh) { - if(e->is_curved()) + if (e->is_curved()) for (unsigned i = 0; i < e->get_nvert(); i++) - if(e->cm->curves[i] != nullptr) + if (e->cm->curves[i] != nullptr) { - if(e->cm->curves[i]->type != ArcType) - continue; - bson_append_int(&bw, "c", e->vn[e->next_vert(i)]->id); + if (e->cm->curves[i]->type != ArcType) + continue; + bson_append_int(&bw, "c", e->vn[e->next_vert(i)]->id); } } bson_append_finish_array(&bw); @@ -501,13 +500,13 @@ namespace Hermes bson_append_start_array(&bw, "arcs-angle"); for_all_base_elements(e, mesh) { - if(e->is_curved()) + if (e->is_curved()) for (unsigned i = 0; i < e->get_nvert(); i++) - if(e->cm->curves[i] != nullptr) + if (e->cm->curves[i] != nullptr) { - if(e->cm->curves[i]->type != ArcType) - continue; - bson_append_int(&bw, "c", ((Arc*)e->cm->curves[i])->angle); + if (e->cm->curves[i]->type != ArcType) + continue; + bson_append_int(&bw, "c", ((Arc*)e->cm->curves[i])->angle); } } bson_append_finish_array(&bw); @@ -515,24 +514,24 @@ namespace Hermes // Save general NURBS. // - count. for_all_base_elements(e, mesh) - if(e->is_curved()) + if (e->is_curved()) for (unsigned i = 0; i < e->get_nvert(); i++) - if(e->cm->curves[i] != nullptr) - if(e->cm->curves[i]->type != ArcType) + if (e->cm->curves[i] != nullptr) + if (e->cm->curves[i]->type != ArcType) throw Exceptions::Exception("BSON mesh loader can not operate with general NURBS so far."); // Save refinements // - count. - for(unsigned int refinement_i = 0; refinement_i < mesh->refinements.size(); refinement_i++) + for (unsigned int refinement_i = 0; refinement_i < mesh->refinements.size(); refinement_i++) bson_append_int(&bw, "refinement-count", mesh->refinements.size()); // - ids bson_append_start_array(&bw, "refinement-id"); - for(unsigned int refinement_i = 0; refinement_i < mesh->refinements.size(); refinement_i++) + for (unsigned int refinement_i = 0; refinement_i < mesh->refinements.size(); refinement_i++) bson_append_int(&bw, "c", mesh->refinements[refinement_i].first); bson_append_finish_array(&bw); // - type bson_append_start_array(&bw, "refinement-type"); - for(unsigned int refinement_i = 0; refinement_i < mesh->refinements.size(); refinement_i++) + for (unsigned int refinement_i = 0; refinement_i < mesh->refinements.size(); refinement_i++) bson_append_int(&bw, "c", mesh->refinements[refinement_i].second); bson_append_finish_array(&bw); @@ -542,14 +541,14 @@ namespace Hermes // Write to disk. FILE *fpw; fpw = fopen(filename, "wb"); - const char *dataw = (const char *) bson_data(&bw); + const char *dataw = (const char *)bson_data(&bw); fwrite(dataw, bson_size(&bw), 1, fpw); fclose(fpw); bson_destroy(&bw); } - void MeshReaderH2DBSON::save(const char *filename, Hermes::vector meshes) + void MeshReaderH2DBSON::save(const char *filename, std::vector meshes) { // For mapping of physical coordinates onto top vertices. std::map, unsigned int> points_to_vertices; @@ -558,18 +557,18 @@ namespace Hermes // For mapping of vertex pairs onto curves. std::map, bool> vertices_to_curves; - Hermes::vector elements; - Hermes::vector edges; - Hermes::vector vertices; - Hermes::vector arcs; - Hermes::vector subdomains; + std::vector elements; + std::vector edges; + std::vector vertices; + std::vector arcs; + std::vector subdomains; bool* baseElementsSaved = new bool[meshes[0]->get_num_base_elements()]; - memset(baseElementsSaved, 0, sizeof(bool) * meshes[0]->get_num_base_elements()); + memset(baseElementsSaved, 0, sizeof(bool)* meshes[0]->get_num_base_elements()); #pragma region Save to structures - for(unsigned int meshes_i = 0; meshes_i < meshes.size(); meshes_i++) + for (unsigned int meshes_i = 0; meshes_i < meshes.size(); meshes_i++) { bool hasAllElements = (meshes[meshes_i]->get_num_used_base_elements() == meshes[meshes_i]->get_num_base_elements()); @@ -588,7 +587,7 @@ namespace Hermes // If found, then insert the pair into vertices_to_vertices dictionary. // If not, insert. std::map, unsigned int>::iterator it = points_to_vertices.find(std::pair(meshes[meshes_i]->nodes[i].x, meshes[meshes_i]->nodes[i].y)); - if(it != points_to_vertices.end()) + if (it != points_to_vertices.end()) vertices_to_vertices.insert(std::pair(i, it->second)); else { @@ -598,7 +597,7 @@ namespace Hermes vertices.push_back(vertex_BSON(meshes[meshes_i]->nodes[i].x, meshes[meshes_i]->nodes[i].y, new_i)); } - if(!hasAllElements) + if (!hasAllElements) subdomain.vertices.push_back(vertices_to_vertices.find(i)->second); } @@ -606,18 +605,18 @@ namespace Hermes for (int i = 0; i < meshes[meshes_i]->get_num_base_elements(); i++) { e = &(meshes[meshes_i]->elements[i]); - if(!e->used) + if (!e->used) continue; - if(!baseElementsSaved[e->id]) + if (!baseElementsSaved[e->id]) { - if(e->nvert == 3) + if (e->nvert == 3) elements.push_back(element_BSON(vertices_to_vertices.find(e->vn[0]->id)->second, vertices_to_vertices.find(e->vn[1]->id)->second, vertices_to_vertices.find(e->vn[2]->id)->second, -1, meshes[meshes_i]->get_element_markers_conversion().get_user_marker(e->marker).marker, e->id)); else elements.push_back(element_BSON(vertices_to_vertices.find(e->vn[0]->id)->second, vertices_to_vertices.find(e->vn[1]->id)->second, vertices_to_vertices.find(e->vn[2]->id)->second, vertices_to_vertices.find(e->vn[3]->id)->second, meshes[meshes_i]->get_element_markers_conversion().get_user_marker(e->marker).marker, e->id)); baseElementsSaved[e->id] = true; } - if(!hasAllElements) + if (!hasAllElements) subdomain.elements.push_back(e->id); } @@ -627,15 +626,15 @@ namespace Hermes { for (unsigned i = 0; i < e->get_nvert(); i++) { - if(MeshUtil::get_base_edge_node(e, i)->bnd) + if (MeshUtil::get_base_edge_node(e, i)->bnd) { - if(vertices_to_boundaries.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second))) == vertices_to_boundaries.end()) + if (vertices_to_boundaries.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second))) == vertices_to_boundaries.end()) { unsigned int edge_i = edges.size(); vertices_to_boundaries.insert(std::pair, unsigned int>(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)), edge_i)); edges.push_back(edge_BSON(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second, meshes[meshes_i]->boundary_markers_conversion.get_user_marker(MeshUtil::get_base_edge_node(e, i)->marker).marker, edge_i)); } - if(!hasAllElements) + if (!hasAllElements) subdomain.boundary_edges.push_back(vertices_to_boundaries.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)))->second); } else @@ -643,52 +642,52 @@ namespace Hermes } } - if(has_inner_edges) + if (has_inner_edges) { for_all_base_elements(e, meshes[meshes_i]) for (unsigned i = 0; i < e->get_nvert(); i++) { - if(!MeshUtil::get_base_edge_node(e, i)->bnd) + if (!MeshUtil::get_base_edge_node(e, i)->bnd) + { + if (vertices_to_boundaries.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second))) == vertices_to_boundaries.end()) { - if(vertices_to_boundaries.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second))) == vertices_to_boundaries.end()) - { - unsigned int edge_i = edges.size(); - vertices_to_boundaries.insert(std::pair, unsigned int>(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)), edge_i)); - edges.push_back(edge_BSON(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second, meshes[meshes_i]->boundary_markers_conversion.get_user_marker(MeshUtil::get_base_edge_node(e, i)->marker).marker, edge_i)); - } - if(!hasAllElements) - subdomain.inner_edges.push_back(vertices_to_boundaries.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)))->second); + unsigned int edge_i = edges.size(); + vertices_to_boundaries.insert(std::pair, unsigned int>(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)), edge_i)); + edges.push_back(edge_BSON(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second, meshes[meshes_i]->boundary_markers_conversion.get_user_marker(MeshUtil::get_base_edge_node(e, i)->marker).marker, edge_i)); } + if (!hasAllElements) + subdomain.inner_edges.push_back(vertices_to_boundaries.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)))->second); + } } } // save curved edges for_all_base_elements(e, meshes[meshes_i]) { - if(e->is_curved()) + if (e->is_curved()) for (unsigned i = 0; i < e->get_nvert(); i++) - if(e->cm->curves[i] != nullptr) - if(vertices_to_curves.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second))) == vertices_to_curves.end()) + if (e->cm->curves[i] != nullptr) + if (vertices_to_curves.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second))) == vertices_to_curves.end()) { - if(e->cm->curves[i]->type == ArcType) - arcs.push_back(arc_BSON(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second, ((Arc*)e->cm->curves[i])->angle)); - else - throw Exceptions::Exception("BSON mesh loader can not operate with general NURBS so far."); + if (e->cm->curves[i]->type == ArcType) + arcs.push_back(arc_BSON(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second, ((Arc*)e->cm->curves[i])->angle)); + else + throw Exceptions::Exception("BSON mesh loader can not operate with general NURBS so far."); - vertices_to_curves.insert(std::pair, bool>(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)), true)); + vertices_to_curves.insert(std::pair, bool>(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)), true)); } } // save refinements - for(unsigned int refinement_i = 0; refinement_i < meshes[meshes_i]->refinements.size(); refinement_i++) + for (unsigned int refinement_i = 0; refinement_i < meshes[meshes_i]->refinements.size(); refinement_i++) subdomain.refinements.push_back(refinement_BSON(meshes[meshes_i]->refinements[refinement_i].first, meshes[meshes_i]->refinements[refinement_i].second)); subdomains.push_back(subdomain); } - delete [] baseElementsSaved; + delete[] baseElementsSaved; - std::sort (elements.begin(), elements.end(), elementCompare); + std::sort(elements.begin(), elements.end(), elementCompare); #pragma endregion // Init bson @@ -729,20 +728,20 @@ namespace Hermes // Write to disk. FILE *fpw; fpw = fopen(filename, "wb"); - const char *dataw = (const char *) bson_data(&bw); + const char *dataw = (const char *)bson_data(&bw); fwrite(dataw, bson_size(&bw), 1, fpw); fclose(fpw); bson_destroy(&bw); } - void MeshReaderH2DBSON::load(const char *filename, Hermes::vector meshes) + void MeshReaderH2DBSON::load(const char *filename, std::vector meshes) { FILE *fpr; fpr = fopen(filename, "rb"); // file size: - fseek (fpr, 0, SEEK_END); + fseek(fpr, 0, SEEK_END); int size = ftell(fpr); rewind(fpr); @@ -754,7 +753,7 @@ namespace Hermes bson br; bson_init_finished_data(&br, datar, 0); - for(unsigned int meshes_i = 0; meshes_i < meshes.size(); meshes_i++) + for (unsigned int meshes_i = 0; meshes_i < meshes.size(); meshes_i++) meshes.at(meshes_i)->free(); MeshSharedPtr global_mesh(new Mesh); @@ -763,34 +762,34 @@ namespace Hermes std::map element_is; std::map edge_is; - Hermes::vector elements; - Hermes::vector edges; - Hermes::vector vertices; - Hermes::vector arcs; - Hermes::vector subdomains; + std::vector elements; + std::vector edges; + std::vector vertices; + std::vector arcs; + std::vector subdomains; // load this->load_domain(br, global_mesh, vertex_is, element_is, edge_is, elements, edges, vertices, arcs, subdomains); int max_vertex_i = -1; - for(std::map::iterator it = vertex_is.begin(); it != vertex_is.end(); ++it) - if(it->first > max_vertex_i) + for (std::map::iterator it = vertex_is.begin(); it != vertex_is.end(); ++it) + if (it->first > max_vertex_i) max_vertex_i = it->first; int max_element_i = -1; - for(std::map::iterator it = element_is.begin(); it != element_is.end(); ++it) - if(it->first > max_element_i) + for (std::map::iterator it = element_is.begin(); it != element_is.end(); ++it) + if (it->first > max_element_i) max_element_i = it->first; int max_edge_i = -1; - for(std::map::iterator it = edge_is.begin(); it != edge_is.end(); ++it) - if(it->first > max_edge_i) + for (std::map::iterator it = edge_is.begin(); it != edge_is.end(); ++it) + if (it->first > max_edge_i) max_edge_i = it->first; // Subdomains // unsigned int subdomains_count = subdomains.size(); - if(subdomains_count != meshes.size()) + if (subdomains_count != meshes.size()) throw Hermes::Exceptions::MeshLoadFailureException("Number of subdomains( = %u) does not equal the number of provided meshes in the vector( = %u).", subdomains_count, meshes.size()); - for(unsigned int subdomains_i = 0; subdomains_i < subdomains_count; subdomains_i++) + for (unsigned int subdomains_i = 0; subdomains_i < subdomains_count; subdomains_i++) { for (int element_i = 0; element_i < elements.size(); element_i++) { @@ -798,7 +797,7 @@ namespace Hermes meshes[subdomains_i]->element_markers_conversion.insert_marker(element.marker); } - for(unsigned int edge_i = 0; edge_i < edges.size(); edge_i++) + for (unsigned int edge_i = 0; edge_i < edges.size(); edge_i++) { edge_BSON edge = edges.at(edge_i); @@ -806,7 +805,7 @@ namespace Hermes } } - for(unsigned int subdomains_i = 0; subdomains_i < subdomains_count; subdomains_i++) + for (unsigned int subdomains_i = 0; subdomains_i < subdomains_count; subdomains_i++) { unsigned int vertex_number_count = subdomains.at(subdomains_i).vertices.empty() ? 0 : subdomains.at(subdomains_i).vertices.size(); unsigned int element_number_count = subdomains.at(subdomains_i).elements.empty() ? 0 : subdomains.at(subdomains_i).elements.size(); @@ -814,18 +813,18 @@ namespace Hermes unsigned int inner_edge_number_count = subdomains.at(subdomains_i).inner_edges.empty() ? 0 : subdomains.at(subdomains_i).inner_edges.size(); // copy the whole mesh if the subdomain is the whole mesh. - if(element_number_count == 0 || element_number_count == elements.size()) + if (element_number_count == 0 || element_number_count == elements.size()) { meshes[subdomains_i]->copy(global_mesh); // refinements. - if(!subdomains.at(subdomains_i).refinements.empty() && subdomains.at(subdomains_i).refinements.size() > 0) + if (!subdomains.at(subdomains_i).refinements.empty() && subdomains.at(subdomains_i).refinements.size() > 0) { // perform initial refinements for (unsigned int i = 0; i < subdomains.at(subdomains_i).refinements.size(); i++) { int element_id = subdomains.at(subdomains_i).refinements.at(i).id; int refinement_type = subdomains.at(subdomains_i).refinements.at(i).type; - if(refinement_type == -1) + if (refinement_type == -1) meshes[subdomains_i]->unrefine_element_id(element_id); else meshes[subdomains_i]->refine_element_id(element_id, refinement_type); @@ -845,17 +844,17 @@ namespace Hermes meshes[subdomains_i]->init(size); // Create top-level vertex nodes. - if(vertex_number_count == 0) + if (vertex_number_count == 0) vertex_number_count = vertices.size(); for (unsigned int vertex_numbers_i = 0; vertex_numbers_i < vertex_number_count; vertex_numbers_i++) { unsigned int vertex_number; - if(vertex_number_count == vertices.size()) + if (vertex_number_count == vertices.size()) vertex_number = vertex_is[vertex_numbers_i]; else { - vertex_number = subdomains.at(subdomains_i).vertices.at(vertex_numbers_i); - if(vertex_number > max_vertex_i) + vertex_number = subdomains.at(subdomains_i).vertices.at(vertex_numbers_i); + if (vertex_number > max_vertex_i) throw Exceptions::MeshLoadFailureException("Wrong vertex number:%u in subdomain %u.", vertex_number, subdomains_i); } @@ -881,12 +880,12 @@ namespace Hermes Element* e; int* elements_existing = new int[element_count]; - for(int i = 0; i < element_count; i++) + for (int i = 0; i < element_count; i++) elements_existing[i] = -1; for (int element_number_i = 0; element_number_i < element_number_count; element_number_i++) { int elementI = subdomains.at(subdomains_i).elements.at(element_number_i); - if(elementI > max_element_i) + if (elementI > max_element_i) throw Exceptions::MeshLoadFailureException("Wrong element number:%i in subdomain %u.", elementI, subdomains_i); elements_existing[element_is[subdomains.at(subdomains_i).elements.at(element_number_i)]] = elementI; @@ -894,28 +893,28 @@ namespace Hermes for (int element_i = 0; element_i < element_count; element_i++) { bool found = false; - if(element_number_count == 0) + if (element_number_count == 0) found = true; else found = elements_existing[element_i] != -1; - if(!found) + if (!found) { meshes[subdomains_i]->elements.skip_slot()->cm = nullptr; continue; } - element_BSON element(-1,-1,-1,-1, "", -1); - for(int searched_element_i = 0; searched_element_i < element_count; searched_element_i++) + element_BSON element(-1, -1, -1, -1, "", -1); + for (int searched_element_i = 0; searched_element_i < element_count; searched_element_i++) { element = elements.at(searched_element_i); - if(element.i == elements_existing[element_i]) + if (element.i == elements_existing[element_i]) break; } - if(element.i == -1) + if (element.i == -1) throw Exceptions::MeshLoadFailureException("Element number wrong in the mesh file."); - if(element.v4 != -1) + if (element.v4 != -1) e = meshes[subdomains_i]->create_quad(meshes[subdomains_i]->element_markers_conversion.get_internal_marker(element.marker).marker, &meshes[subdomains_i]->nodes[vertex_vertex_numbers.find(element.v1)->second], &meshes[subdomains_i]->nodes[vertex_vertex_numbers.find(element.v2)->second], @@ -931,18 +930,18 @@ namespace Hermes } // Boundary Edge numbers // - if(boundary_edge_number_count == 0) + if (boundary_edge_number_count == 0) boundary_edge_number_count = edges.size(); for (int boundary_edge_number_i = 0; boundary_edge_number_i < boundary_edge_number_count; boundary_edge_number_i++) { - edge_BSON edge(-1,-1, "", -1); + edge_BSON edge(-1, -1, "", -1); int domain_edge_count = edges.size(); - for(unsigned int to_find_i = 0; to_find_i < domain_edge_count; to_find_i++) + for (unsigned int to_find_i = 0; to_find_i < domain_edge_count; to_find_i++) { - if(boundary_edge_number_count != domain_edge_count) + if (boundary_edge_number_count != domain_edge_count) { - if(edges.at(to_find_i).i == subdomains.at(subdomains_i).boundary_edges.at(boundary_edge_number_i)) + if (edges.at(to_find_i).i == subdomains.at(subdomains_i).boundary_edges.at(boundary_edge_number_i)) { edge = edges.at(to_find_i); break; @@ -950,7 +949,7 @@ namespace Hermes } else { - if(edges.at(to_find_i).i == edge_is[boundary_edge_number_i]) + if (edges.at(to_find_i).i == edge_is[boundary_edge_number_i]) { edge = edges.at(to_find_i); break; @@ -958,11 +957,11 @@ namespace Hermes } } - if(edge.i == -1) + if (edge.i == -1) throw Exceptions::MeshLoadFailureException("Wrong boundary-edge number:%i in subdomain %u.", subdomains.at(subdomains_i).boundary_edges.at(boundary_edge_number_i), subdomains_i); Node* en = meshes[subdomains_i]->peek_edge_node(vertex_vertex_numbers.find(edge.v1)->second, vertex_vertex_numbers.find(edge.v2)->second); - if(en == nullptr) + if (en == nullptr) throw Hermes::Exceptions::MeshLoadFailureException("Boundary data error (edge %i does not exist).", boundary_edge_number_i); en->marker = meshes[subdomains_i]->boundary_markers_conversion.get_internal_marker(edge.marker).marker; @@ -977,20 +976,20 @@ namespace Hermes { edge_BSON edge(-1, -1, "", -1); - for(unsigned int to_find_i = 0; to_find_i < edges.size(); to_find_i++) + for (unsigned int to_find_i = 0; to_find_i < edges.size(); to_find_i++) { - if(edges.at(to_find_i).i == subdomains.at(subdomains_i).inner_edges.at(inner_edge_number_i)) + if (edges.at(to_find_i).i == subdomains.at(subdomains_i).inner_edges.at(inner_edge_number_i)) { edge = edges.at(to_find_i); break; } } - if(edge.i == -1) + if (edge.i == -1) throw Exceptions::MeshLoadFailureException("Wrong inner-edge number:%i in subdomain %u.", subdomains.at(subdomains_i).boundary_edges.at(inner_edge_number_i), subdomains_i); Node* en = meshes[subdomains_i]->peek_edge_node(vertex_vertex_numbers.find(edge.v1)->second, vertex_vertex_numbers.find(edge.v2)->second); - if(en == nullptr) + if (en == nullptr) throw Hermes::Exceptions::MeshLoadFailureException("Inner data error (edge %i does not exist).", inner_edge_number_i); en->marker = meshes[subdomains_i]->boundary_markers_conversion.get_internal_marker(edge.marker).marker; @@ -1009,7 +1008,7 @@ namespace Hermes // first do arcs, then NURBSs. Curve* curve; - if(vertex_vertex_numbers.find(arcs.at(curves_i).p1) == vertex_vertex_numbers.end() || + if (vertex_vertex_numbers.find(arcs.at(curves_i).p1) == vertex_vertex_numbers.end() || vertex_vertex_numbers.find(arcs.at(curves_i).p2) == vertex_vertex_numbers.end()) continue; else @@ -1019,7 +1018,7 @@ namespace Hermes p2 = vertex_vertex_numbers.find(arcs.at(curves_i).p2)->second; curve = MeshUtil::load_arc(meshes[subdomains_i], curves_i, &en, p1, p2, arcs.at(curves_i).angle, true); - if(curve == nullptr) + if (curve == nullptr) continue; } @@ -1036,24 +1035,24 @@ namespace Hermes } // refinements. - if(!subdomains.at(subdomains_i).refinements.empty() && subdomains.at(subdomains_i).refinements.size() > 0) + if (!subdomains.at(subdomains_i).refinements.empty() && subdomains.at(subdomains_i).refinements.size() > 0) { // perform initial refinements for (unsigned int i = 0; i < subdomains.at(subdomains_i).refinements.size(); i++) { int element_id = subdomains.at(subdomains_i).refinements.at(i).id; int refinement_type = subdomains.at(subdomains_i).refinements.at(i).type; - if(refinement_type == -1) + if (refinement_type == -1) meshes[subdomains_i]->unrefine_element_id(element_id); else meshes[subdomains_i]->refine_element_id(element_id, refinement_type); } } - delete [] elements_existing; + delete[] elements_existing; } meshes[subdomains_i]->seq = g_mesh_seq++; - if(HermesCommonApi.get_integral_param_value(checkMeshesOnLoad)) + if (HermesCommonApi.get_integral_param_value(checkMeshesOnLoad)) meshes[subdomains_i]->initial_single_check(); } bson_destroy(&br); @@ -1061,7 +1060,7 @@ namespace Hermes } void MeshReaderH2DBSON::load_domain(bson& br, MeshSharedPtr mesh, std::map& vertex_is, std::map& element_is, std::map& edge_is, - Hermes::vector& elements, Hermes::vector& edges, Hermes::vector& vertices, Hermes::vector& arcs, Hermes::vector& subdomains) + std::vector& elements, std::vector& edges, std::vector& vertices, std::vector& arcs, std::vector& subdomains) { bson_iterator it, it_sub; bson b_sub, b_sub_sub; @@ -1140,11 +1139,11 @@ namespace Hermes node->p1 = node->p2 = -1; node->next_hash = nullptr; - if(vertices[vertex_i].i > H2D_MAX_NODE_ID - 1) + if (vertices[vertex_i].i > H2D_MAX_NODE_ID - 1) throw Exceptions::MeshLoadFailureException("The index 'i' of vertex in the mesh file must be lower than %i.", H2D_MAX_NODE_ID); // insert - vertex_is.insert(std::pair(vertices[vertex_i].i, vertex_i)); + vertex_is.insert(std::pair(vertices[vertex_i].i, vertex_i)); // assignment. node->x = vertices[vertex_i].x; @@ -1162,14 +1161,14 @@ namespace Hermes element_BSON element = elements[element_i]; // insert. - if(element.i > H2D_MAX_NODE_ID - 1) + if (element.i > H2D_MAX_NODE_ID - 1) throw Exceptions::MeshLoadFailureException("The index 'i' of element in the mesh file must be lower than %i.", H2D_MAX_NODE_ID); - element_is.insert(std::pair(element.i, element_i)); + element_is.insert(std::pair(element.i, element_i)); mesh->element_markers_conversion.insert_marker(element.marker); - if(element.v4 != -1) + if (element.v4 != -1) e = mesh->create_quad(mesh->element_markers_conversion.get_internal_marker(element.marker).marker, &mesh->nodes[element.v1], &mesh->nodes[element.v2], @@ -1194,13 +1193,13 @@ namespace Hermes int v2 = edges[edge_i].v2; // insert - if(edges[edge_i].i > H2D_MAX_NODE_ID - 1) + if (edges[edge_i].i > H2D_MAX_NODE_ID - 1) throw Exceptions::MeshLoadFailureException("The index 'i' of edge in the mesh file must be lower than %i.", H2D_MAX_NODE_ID); edge_is.insert(std::pair(edge_i, edges[edge_i].i)); en = mesh->peek_edge_node(v1, v2); - if(en == nullptr) + if (en == nullptr) throw Hermes::Exceptions::MeshLoadFailureException("Boundary data #%d: edge %d-%d does not exist.", edge_i, v1, v2); std::string edge_marker = edges[edge_i].marker; @@ -1232,7 +1231,7 @@ namespace Hermes // check that all boundary edges have a marker assigned for_all_edge_nodes(en, mesh) - if(en->ref < 2 && en->marker == 0) + if (en->ref < 2 && en->marker == 0) this->warn("Boundary edge node does not have a boundary marker."); // Curves // @@ -1268,4 +1267,4 @@ namespace Hermes } } -#endif +#endif \ No newline at end of file diff --git a/hermes2d/src/mesh/mesh_reader_h2d_xml.cpp b/hermes2d/src/mesh/mesh_reader_h2d_xml.cpp index 46d1f34098..a170c2b81b 100644 --- a/hermes2d/src/mesh/mesh_reader_h2d_xml.cpp +++ b/hermes2d/src/mesh/mesh_reader_h2d_xml.cpp @@ -97,15 +97,7 @@ namespace Hermes // save vertices XMLMesh::vertices_type vertices; for (int i = 0; i < mesh->ntopvert; i++) - { - std::ostringstream x_stream; - x_stream << mesh->nodes[i].x; - - std::ostringstream y_stream; - y_stream << mesh->nodes[i].y; - - vertices.v().push_back(std::auto_ptr(new XMLMesh::v(x_stream.str(), y_stream.str(), i))); - } + vertices.v().push_back(std::auto_ptr(new XMLMesh::v(std::to_string((long double)mesh->nodes[i].x), std::to_string((long double)mesh->nodes[i].y), i))); // save elements XMLMesh::elements_type elements; @@ -113,28 +105,28 @@ namespace Hermes { e = mesh->get_element_fast(i); if (e->used) - if (e->is_triangle()) - elements.el().push_back(XMLMesh::t_t(e->vn[0]->id, e->vn[1]->id, e->vn[2]->id, mesh->get_element_markers_conversion().get_user_marker(e->marker).marker.c_str())); - else - elements.el().push_back(XMLMesh::q_t(e->vn[0]->id, e->vn[1]->id, e->vn[2]->id, mesh->get_element_markers_conversion().get_user_marker(e->marker).marker.c_str(), e->vn[3]->id)); + if (e->is_triangle()) + elements.el().push_back(XMLMesh::t_t(e->vn[0]->id, e->vn[1]->id, e->vn[2]->id, mesh->get_element_markers_conversion().get_user_marker(e->marker).marker.c_str())); + else + elements.el().push_back(XMLMesh::q_t(e->vn[0]->id, e->vn[1]->id, e->vn[2]->id, mesh->get_element_markers_conversion().get_user_marker(e->marker).marker.c_str(), e->vn[3]->id)); } // save boundary markers XMLMesh::edges_type edges; for_all_base_elements(e, mesh) - for (unsigned i = 0; i < e->get_nvert(); i++) - if (MeshUtil::get_base_edge_node(e, i)->marker) - edges.ed().push_back(XMLMesh::ed(e->vn[i]->id, e->vn[e->next_vert(i)]->id, mesh->boundary_markers_conversion.get_user_marker(MeshUtil::get_base_edge_node(e, i)->marker).marker.c_str())); + for (unsigned char i = 0; i < e->get_nvert(); i++) + if (MeshUtil::get_base_edge_node(e, i)->marker) + edges.ed().push_back(XMLMesh::ed(e->vn[i]->id, e->vn[e->next_vert(i)]->id, mesh->boundary_markers_conversion.get_user_marker(MeshUtil::get_base_edge_node(e, i)->marker).marker.c_str())); // save curved edges XMLMesh::curves_type curves; for_all_base_elements(e, mesh) - if (e->is_curved()) - for (unsigned i = 0; i < e->get_nvert(); i++) - if (e->cm->curves[i] != nullptr) - if (e->cm->curves[i]->type == ArcType) - save_arc(mesh, e->vn[i]->id, e->vn[e->next_vert(i)]->id, (Arc*)e->cm->curves[i], curves); - else - save_nurbs(mesh, e->vn[i]->id, e->vn[e->next_vert(i)]->id, (Nurbs*)e->cm->curves[i], curves); + if (e->is_curved()) + for (unsigned char i = 0; i < e->get_nvert(); i++) + if (e->cm->curves[i] != nullptr) + if (e->cm->curves[i]->type == ArcType) + save_arc(mesh, e->vn[i]->id, e->vn[e->next_vert(i)]->id, (Arc*)e->cm->curves[i], curves); + else + save_nurbs(mesh, e->vn[i]->id, e->vn[e->next_vert(i)]->id, (Nurbs*)e->cm->curves[i], curves); // save refinements XMLMesh::refinements_type refinements; @@ -158,7 +150,7 @@ namespace Hermes out.close(); } - void MeshReaderH2DXML::load(const char *filename, Hermes::vector meshes) + void MeshReaderH2DXML::load(const char *filename, std::vector meshes) { try { @@ -177,7 +169,7 @@ namespace Hermes } } - void MeshReaderH2DXML::load(std::auto_ptr & parsed_xml_domain, Hermes::vector meshes) + void MeshReaderH2DXML::load(std::auto_ptr & parsed_xml_domain, std::vector meshes) { for (unsigned int meshes_i = 0; meshes_i < meshes.size(); meshes_i++) { @@ -197,16 +189,16 @@ namespace Hermes int max_vertex_i = -1; for (std::map::iterator it = vertex_is.begin(); it != vertex_is.end(); ++it) - if (it->first > max_vertex_i) - max_vertex_i = it->first; + if (it->first > max_vertex_i) + max_vertex_i = it->first; int max_element_i = -1; for (std::map::iterator it = element_is.begin(); it != element_is.end(); ++it) - if (it->first > max_element_i) - max_element_i = it->first; + if (it->first > max_element_i) + max_element_i = it->first; int max_edge_i = -1; for (std::map::iterator it = edge_is.begin(); it != edge_is.end(); ++it) - if (it->first > max_edge_i) - max_edge_i = it->first; + if (it->first > max_edge_i) + max_edge_i = it->first; // Subdomains // unsigned int subdomains_count = parsed_xml_domain->subdomains().subdomain().size(); @@ -215,7 +207,7 @@ namespace Hermes for (unsigned int subdomains_i = 0; subdomains_i < subdomains_count; subdomains_i++) { - for (int element_i = 0; element_i < parsed_xml_domain->elements().el().size(); element_i++) + for (unsigned short element_i = 0; element_i < parsed_xml_domain->elements().el().size(); element_i++) { XMLSubdomains::domain::elements_type::el_type* element = &parsed_xml_domain->elements().el().at(element_i); @@ -335,36 +327,9 @@ namespace Hermes // test of value if no variable found. if (!x_found) - if (std::strtod(x.c_str(), nullptr) != 0.0) x_value = std::strtod(x.c_str(), nullptr); - else - { - // This is a hard part, to find out if it is really zero. - int dot_position = strchr(x.c_str(), '.') == nullptr ? -1 : strchr(x.c_str(), '.') - x.c_str(); - for (int i = 0; i < dot_position; i++) - if (strncmp(x.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertex_number + 1); - for (int i = dot_position + 1; i < x.length(); i++) - if (strncmp(x.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertex_number + 1); - x_value = std::strtod(x.c_str(), nullptr); - } - if (!y_found) - if (std::strtod(y.c_str(), nullptr) != 0.0) y_value = std::strtod(y.c_str(), nullptr); - else - { - // This is a hard part, to find out if it is really zero. - int dot_position = strchr(y.c_str(), '.') == nullptr ? -1 : strchr(y.c_str(), '.') - y.c_str(); - for (int i = 0; i < dot_position; i++) - if (strncmp(y.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the y coordinate of vertex no. %i.", vertex_number + 1); - for (int i = dot_position + 1; i < y.length(); i++) - if (strncmp(y.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the y coordinate of vertex no. %i.", vertex_number + 1); - y_value = std::strtod(y.c_str(), nullptr); - } // assignment. node->x = x_value; @@ -593,7 +558,7 @@ namespace Hermes static bool elementCompare(XMLSubdomains::el_t* el_i, XMLSubdomains::el_t* el_j) { return (el_i->i() < el_j->i()); } - void MeshReaderH2DXML::save(const char *filename, Hermes::vector meshes) + void MeshReaderH2DXML::save(const char *filename, std::vector meshes) { // For mapping of physical coordinates onto top vertices. std::map, unsigned int> points_to_vertices; @@ -605,7 +570,7 @@ namespace Hermes // Global vertices list. XMLMesh::vertices_type vertices; // Global elements list. - Hermes::vector elements; + std::vector elements; // Global boudnary edges list. XMLSubdomains::edges_type edges; // Global curves list. @@ -647,14 +612,9 @@ namespace Hermes { int new_i = points_to_vertices.size(); vertices_to_vertices.insert(std::pair(i, new_i)); - points_to_vertices.insert(std::pair, unsigned int>(std::pair(meshes[meshes_i]->nodes[i].x, meshes[meshes_i]->nodes[i].y), points_to_vertices.size())); - std::ostringstream x_stream; - x_stream << meshes[meshes_i]->nodes[i].x; + points_to_vertices.insert(std::pair, unsigned int>(std::pair(meshes[meshes_i]->nodes[i].x, meshes[meshes_i]->nodes[i].y), new_i)); - std::ostringstream y_stream; - y_stream << meshes[meshes_i]->nodes[i].y; - - vertices.v().push_back(std::auto_ptr(new XMLMesh::v(x_stream.str(), y_stream.str(), new_i))); + vertices.v().push_back(std::auto_ptr(new XMLMesh::v(std::to_string((long double)meshes[meshes_i]->nodes[i].x), std::to_string((long double)meshes[meshes_i]->nodes[i].y), new_i))); } if (!hasAllElements) subdomain.vertices()->i().push_back(vertices_to_vertices.find(i)->second); @@ -689,7 +649,7 @@ namespace Hermes bool has_inner_edges = false; for_all_base_elements(e, meshes[meshes_i]) { - for (unsigned i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { if (MeshUtil::get_base_edge_node(e, i)->bnd) { @@ -711,8 +671,8 @@ namespace Hermes { subdomain.inner_edges().set(XMLSubdomains::subdomain::inner_edges_type()); for_all_base_elements(e, meshes[meshes_i]) - for (unsigned i = 0; i < e->get_nvert(); i++) - { + for (unsigned char i = 0; i < e->get_nvert(); i++) + { if (!MeshUtil::get_base_edge_node(e, i)->bnd) { if (vertices_to_boundaries.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second))) == vertices_to_boundaries.end()) @@ -724,23 +684,23 @@ namespace Hermes if (!hasAllElements) subdomain.inner_edges()->i().push_back(vertices_to_boundaries.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)))->second); } - } + } } // save curved edges for_all_base_elements(e, meshes[meshes_i]) { if (e->is_curved()) - for (unsigned i = 0; i < e->get_nvert(); i++) - if (e->cm->curves[i] != nullptr) - if (vertices_to_curves.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second))) == vertices_to_curves.end()) - { + for (unsigned char i = 0; i < e->get_nvert(); i++) + if (e->cm->curves[i] != nullptr) + if (vertices_to_curves.find(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second))) == vertices_to_curves.end()) + { if (e->cm->curves[i]->type == ArcType) save_arc(meshes[meshes_i], vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second, (Arc*)e->cm->curves[i], curves); else save_nurbs(meshes[meshes_i], vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second, (Nurbs*)e->cm->curves[i], curves); vertices_to_curves.insert(std::pair, bool>(std::pair(std::min(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second), std::max(vertices_to_vertices.find(e->vn[i]->id)->second, vertices_to_vertices.find(e->vn[e->next_vert(i)]->id)->second)), true)); - } + } } // save refinements @@ -756,10 +716,10 @@ namespace Hermes std::sort(elements.begin(), elements.end(), elementCompare); XMLSubdomains::elements_type elementsToPass; - for (int i = 0; i < elements.size(); i++) + for (unsigned short i = 0; i < elements.size(); i++) elementsToPass.el().push_back(*elements[i]); - for (int i = 0; i < elements.size(); i++) + for (unsigned short i = 0; i < elements.size(); i++) delete elements[i]; XMLSubdomains::domain xmldomain(vertices, elementsToPass, edges, subdomains); xmldomain.curves().set(curves); @@ -842,36 +802,10 @@ namespace Hermes // test of value if no variable found. if (!x_found) - if (std::strtod(x.c_str(), nullptr) != 0.0) x_value = std::strtod(x.c_str(), nullptr); - else - { - // This is a hard part, to find out if it is really zero. - int dot_position = strchr(x.c_str(), '.') == nullptr ? -1 : strchr(x.c_str(), '.') - x.c_str(); - for (int i = 0; i < dot_position; i++) - if (strncmp(x.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertex_i + 1); - for (int i = dot_position + 1; i < x.length(); i++) - if (strncmp(x.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertex_i + 1); - x_value = std::strtod(x.c_str(), nullptr); - } if (!y_found) - if (std::strtod(y.c_str(), nullptr) != 0.0) y_value = std::strtod(y.c_str(), nullptr); - else - { - // This is a hard part, to find out if it is really zero. - int dot_position = strchr(y.c_str(), '.') == nullptr ? -1 : strchr(y.c_str(), '.') - y.c_str(); - for (int i = 0; i < dot_position; i++) - if (strncmp(y.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the y coordinate of vertex no. %i.", vertex_i + 1); - for (int i = dot_position + 1; i < y.length(); i++) - if (strncmp(y.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the y coordinate of vertex no. %i.", vertex_i + 1); - y_value = std::strtod(y.c_str(), nullptr); - } // assignment. node->x = x_value; @@ -954,8 +888,8 @@ namespace Hermes // check that all boundary edges have a marker assigned for_all_edge_nodes(en, mesh) - if (en->ref < 2 && en->marker == 0) - this->warn("Boundary edge node does not have a boundary marker."); + if (en->ref < 2 && en->marker == 0) + this->warn("Boundary edge node does not have a boundary marker."); // Curves // // Arcs & NURBSs // @@ -1017,7 +951,6 @@ namespace Hermes variables.insert(std::pair((std::string)parsed_xml_domain->variables()->var().at(variables_i).name(), parsed_xml_domain->variables()->var().at(variables_i).value())); #endif - // Vertices // int vertices_count = parsed_xml_domain->vertices().v().size(); @@ -1027,6 +960,38 @@ namespace Hermes size *= 2; mesh->init(size); + // Initial vertices check. + /* + for (int vertex_i = 0; vertex_i < vertices_count; vertex_i++) + { + std::string x_i_s = parsed_xml_domain->vertices().v().at(vertex_i).x(); + std::string y_i_s = parsed_xml_domain->vertices().v().at(vertex_i).y(); + + double x_i = ::atof(x_i_s.c_str()); + double y_i = ::atof(y_i_s.c_str()); + for (int vertex_j = vertex_i + 1; vertex_j < vertices_count; vertex_j++) + { + std::string x_j_s = parsed_xml_domain->vertices().v().at(vertex_j).x(); + std::string y_j_s = parsed_xml_domain->vertices().v().at(vertex_j).y(); + + double x_j = ::atof(x_j_s.c_str()); + double y_j = ::atof(y_j_s.c_str()); + if(x_i == x_j && y_i == y_j) + { + std::cout << std::endl; + std::cout << "|" << x_i_s << "|"; + std::cout << std::endl; + std::cout << "|" << y_i_s << "|"; + std::cout << std::endl; + std::cout << "|" << x_j_s << "|"; + std::cout << std::endl; + std::cout << "|"<< y_j_s << "|"; + std::cout << std::endl; + throw Exceptions::MeshLoadFailureException("Vertices %i and %i share coordinates [%f, %f].", vertex_i, vertex_j, x_i, y_i); + } + } + } + */ // Create top-level vertex nodes. for (int vertex_i = 0; vertex_i < vertices_count; vertex_i++) { @@ -1067,36 +1032,10 @@ namespace Hermes // test of value if no variable found. if (!x_found) - if (std::strtod(x.c_str(), nullptr) != 0.0) x_value = std::strtod(x.c_str(), nullptr); - else - { - // This is a hard part, to find out if it is really zero. - int dot_position = strchr(x.c_str(), '.') == nullptr ? -1 : strchr(x.c_str(), '.') - x.c_str(); - for (int i = 0; i < dot_position; i++) - if (strncmp(x.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertex_i + 1); - for (int i = dot_position + 1; i < x.length(); i++) - if (strncmp(x.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the x coordinate of vertex no. %i.", vertex_i + 1); - x_value = std::strtod(x.c_str(), nullptr); - } if (!y_found) - if (std::strtod(y.c_str(), nullptr) != 0.0) - y_value = std::strtod(y.c_str(), nullptr); - else - { - // This is a hard part, to find out if it is really zero. - int dot_position = strchr(y.c_str(), '.') == nullptr ? -1 : strchr(y.c_str(), '.') - y.c_str(); - for (int i = 0; i < dot_position; i++) - if (strncmp(y.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the y coordinate of vertex no. %i.", vertex_i + 1); - for (int i = dot_position + 1; i < y.length(); i++) - if (strncmp(y.c_str() + i, "0", 1) != 0) - this->warn("Probably wrong syntax in the y coordinate of vertex no. %i.", vertex_i + 1); - y_value = std::strtod(y.c_str(), nullptr); - } + y_value = std::strtod(y.c_str(), NULL); // assignment. node->x = x_value; @@ -1192,8 +1131,8 @@ namespace Hermes // check that all boundary edges have a marker assigned for_all_edge_nodes(en, mesh) - if (en->ref < 2 && en->marker == 0) - this->warn("Boundary edge node does not have a boundary marker."); + if (en->ref < 2 && en->marker == 0) + this->warn("Boundary edge node does not have a boundary marker."); // Curves // // Arcs & NURBSs // @@ -1233,7 +1172,7 @@ namespace Hermes { if (e->cm != nullptr) e->cm->update_refmap_coeffs(e); - //RefMap::set_element_iro_cache(e); + RefMap::set_element_iro_cache(e); } } catch (const xml_schema::exception& e) @@ -1296,8 +1235,8 @@ namespace Hermes nurbs->kv[i] = 0.0; if (inner > 0) - for (int i = outer / 2; i < inner + outer / 2; i++) - nurbs->kv[i] = parsed_xml_entity->curves()->NURBS().at(id).knot().at(i - (outer / 2)).value(); + for (int i = outer / 2; i < inner + outer / 2; i++) + nurbs->kv[i] = parsed_xml_entity->curves()->NURBS().at(id).knot().at(i - (outer / 2)).value(); for (int i = outer / 2 + inner; i < nurbs->nk; i++) nurbs->kv[i] = 1.0; @@ -1324,4 +1263,4 @@ namespace Hermes nurbs_xml.knot().push_back(XMLMesh::knot(curve->kv[i])); } } -} +} \ No newline at end of file diff --git a/hermes2d/src/mesh/mesh_util.cpp b/hermes2d/src/mesh/mesh_util.cpp index 7726645bc7..ff44894f47 100644 --- a/hermes2d/src/mesh/mesh_util.cpp +++ b/hermes2d/src/mesh/mesh_util.cpp @@ -88,7 +88,7 @@ namespace Hermes for (int i = ((Nurbs*)curve)->degree + 1; i < ((Nurbs*)curve)->nk - ((Nurbs*)curve)->degree - 1; i++) toReturn->kv[((Nurbs*)curve)->nk - 1 - i] = 1.0 - ((Nurbs*)curve)->kv[i]; - return toReturn; + return toReturn; } } @@ -135,14 +135,14 @@ namespace Hermes *en = mesh->peek_edge_node(p1, p2); - if(*en == nullptr) + if (*en == nullptr) { - if(!skip_check) + if (!skip_check) throw Hermes::Exceptions::MeshLoadFailureException("Curve #%d: edge %d-%d does not exist.", id, p1, p2); else return nullptr; } - + // edge endpoints control points. curve->pt[0][0] = mesh->nodes[p1].x; curve->pt[0][1] = mesh->nodes[p1].y; @@ -243,8 +243,8 @@ namespace Hermes { this->elements = new Element*[MAX_ELEMENTS]; for (int i = 0; i < 2; i++) - for (int j = 0; j < 2; j++) - m_sons[i][j] = nullptr; + for (int j = 0; j < 2; j++) + m_sons[i][j] = nullptr; } MeshHashGridElement::~MeshHashGridElement() @@ -252,9 +252,9 @@ namespace Hermes if (elements) delete[] elements; for (int i = 0; i < 2; i++) - for (int j = 0; j < 2; j++) - if (m_sons[i][j]) - delete m_sons[i][j]; + for (int j = 0; j < 2; j++) + if (m_sons[i][j]) + delete m_sons[i][j]; } bool MeshHashGridElement::belongs(Element *element) @@ -324,8 +324,8 @@ namespace Hermes if (m_active) { for (int elem_i = 0; elem_i < this->element_count; elem_i++) - if (RefMap::is_element_on_physical_coordinates(elements[elem_i], x, y)) - return elements[elem_i]; + if (RefMap::is_element_on_physical_coordinates(elements[elem_i], x, y)) + return elements[elem_i]; return nullptr; } @@ -423,4 +423,4 @@ namespace Hermes return this->area; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/mesh/refmap.cpp b/hermes2d/src/mesh/refmap.cpp index d4cdb97b97..3fa7af4304 100644 --- a/hermes2d/src/mesh/refmap.cpp +++ b/hermes2d/src/mesh/refmap.cpp @@ -21,7 +21,7 @@ namespace Hermes { namespace Hermes2D { - RefMap::RefMap() : ref_map_shapeset(H1ShapesetJacobi()), ref_map_pss(PrecalcShapeset(&ref_map_shapeset)) + RefMap::RefMap() : ref_map_shapeset(H1ShapesetJacobi()), ref_map_pss(&ref_map_shapeset) { quad_2d = nullptr; set_quad_2d(&g_quad_2d_std); @@ -74,17 +74,17 @@ namespace Hermes Transformable::set_active_element(e); ref_map_pss.set_active_element(e); - this->is_const = !element->is_curved() && (element->is_triangle() || is_parallelogram(element)); + this->is_const = element->has_const_ref_map(); // prepare the shapes and coefficients of the reference map - int j, k = 0; - for (unsigned int i = 0; i < e->get_nvert(); i++) + unsigned short j, k = 0; + for (unsigned char i = 0; i < e->get_nvert(); i++) indices[k++] = ref_map_shapeset.get_vertex_index(i, e->get_mode()); // straight-edged element if (e->cm == nullptr) { - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { lin_coeffs[i][0] = e->vn[i]->x; lin_coeffs[i][1] = e->vn[i]->y; @@ -94,10 +94,10 @@ namespace Hermes } else // curvilinear element - edge and bubble shapes { - int o = e->cm->order; - for (unsigned int i = 0; i < e->get_nvert(); i++) - for (j = 2; j <= o; j++) - indices[k++] = ref_map_shapeset.get_edge_index(i, 0, j, e->get_mode()); + unsigned short o = e->cm->order; + for (unsigned char i = 0; i < e->get_nvert(); i++) + for (j = 2; j <= o; j++) + indices[k++] = ref_map_shapeset.get_edge_index(i, 0, j, e->get_mode()); if (e->is_quad()) o = H2D_MAKE_QUAD_ORDER(o, o); memcpy(indices + k, ref_map_shapeset.get_bubble_indices(o, e->get_mode()), @@ -118,7 +118,7 @@ namespace Hermes void RefMap::set_element_iro_cache(Element* element) { - bool is_const = !element->is_curved() && (element->is_triangle() || is_parallelogram(element)); + bool is_const = element->has_const_ref_map(); if (is_const) { @@ -178,7 +178,6 @@ namespace Hermes for (i = 0; i < nc; i++) { - double coeff_0 = coeffs[i][0]; double coeff_1 = coeffs[i][1]; ref_map_pss.set_active_shape(indices[i]); @@ -225,14 +224,6 @@ namespace Hermes this->jacobian_calculated = order; } - bool RefMap::is_parallelogram(Element* e) - { - const double eps = 1e-14; - assert(e->is_quad()); - return fabs(e->vn[2]->x - (e->vn[1]->x + e->vn[3]->x - e->vn[0]->x)) < eps && - fabs(e->vn[2]->y - (e->vn[1]->y + e->vn[3]->y - e->vn[0]->y)) < eps; - } - void RefMap::calc_const_inv_ref_map() { int k = element->is_triangle() ? 2 : 3; @@ -290,7 +281,7 @@ namespace Hermes void RefMap::calc_tangent(int edge, int eo) { int i, j; - int np = quad_2d->get_num_points(eo, element->get_mode()); + unsigned char np = quad_2d->get_num_points(eo, element->get_mode()); double3* tan = this->tan[edge]; int a = edge, b = element->next_vert(edge); @@ -362,8 +353,8 @@ namespace Hermes double2x2* m = get_inv_ref_map(mo); double* jac = get_jacobian(mo); for (i = 0; i < quad->get_num_points(mo, element->get_mode()); i++) - if (jac[i] <= 0.0) - throw Hermes::Exceptions::Exception("Element #%d is concave or badly oriented.", element->id); + if (jac[i] <= 0.0) + throw Hermes::Exceptions::Exception("Element #%d is concave or badly oriented.", element->id); // next, estimate the "exact" value of the typical integral int_grad_u_grad_v // (with grad_u == grad_v == (1, 1)) using the maximum integration rule @@ -457,20 +448,26 @@ namespace Hermes // coefficients in second derivative with respect to xx a = sqr(m[j][0][0])*k[j][0][0] + 2 * m[j][0][0] * m[j][0][1] * k[j][1][0] + sqr(m[j][0][1])*k[j][2][0]; b = sqr(m[j][0][0])*k[j][0][1] + 2 * m[j][0][0] * m[j][0][1] * k[j][1][1] + sqr(m[j][0][1])*k[j][2][1]; - mm[j][0][0] = -(a * m[j][0][0] + b * m[j][1][0]); // du/dx - mm[j][0][1] = -(a * m[j][0][1] + b * m[j][1][1]); // du/dy + // du/dx + mm[j][0][0] = -(a * m[j][0][0] + b * m[j][1][0]); + // du/dy + mm[j][0][1] = -(a * m[j][0][1] + b * m[j][1][1]); // coefficients in second derivative with respect to xy a = m[j][0][0] * m[j][1][0] * k[j][0][0] + (m[j][0][1] * m[j][1][0] + m[j][0][0] * m[j][1][1])*k[j][1][0] + m[j][0][1] * m[j][1][1] * k[j][2][0]; b = m[j][0][0] * m[j][1][0] * k[j][0][1] + (m[j][0][1] * m[j][1][0] + m[j][0][0] * m[j][1][1])*k[j][1][1] + m[j][0][1] * m[j][1][1] * k[j][2][1]; - mm[j][1][0] = -(a * m[j][0][0] + b * m[j][1][0]); // du/dx - mm[j][1][1] = -(a * m[j][0][1] + b * m[j][1][1]); // du/dy + // du/dx + mm[j][1][0] = -(a * m[j][0][0] + b * m[j][1][0]); + // du/dy + mm[j][1][1] = -(a * m[j][0][1] + b * m[j][1][1]); // coefficients in second derivative with respect to yy a = sqr(m[j][1][0])*k[j][0][0] + 2 * m[j][1][0] * m[j][1][1] * k[j][1][0] + sqr(m[j][1][1])*k[j][2][0]; b = sqr(m[j][1][0])*k[j][0][1] + 2 * m[j][1][0] * m[j][1][1] * k[j][1][1] + sqr(m[j][1][1])*k[j][2][1]; - mm[j][2][0] = -(a * m[j][0][0] + b * m[j][1][0]); // du/dx - mm[j][2][1] = -(a * m[j][0][1] + b * m[j][1][1]); // du/dy + // du/dx + mm[j][2][0] = -(a * m[j][0][0] + b * m[j][1][0]); + // du/dy + mm[j][2][1] = -(a * m[j][0][1] + b * m[j][1][1]); } free_with_check(k); @@ -478,7 +475,7 @@ namespace Hermes this->second_ref_map_calculated = order; } - void RefMap::second_ref_map_at_point(double xi1, double xi2, double& x, double& y, double3x2& mm) + void RefMap::second_ref_map_at_point(double xi1, double xi2, double& x, double& y, double3x2& mm)this- { double3x2 k; memset(k, 0, sizeof(double3x2)); @@ -510,20 +507,26 @@ namespace Hermes // coefficients in second derivative with respect to xx a = sqr(m[0][0])*k[0][0] + 2 * m[0][0] * m[0][1] * k[1][0] + sqr(m[0][1])*k[2][0]; b = sqr(m[0][0])*k[0][1] + 2 * m[0][0] * m[0][1] * k[1][1] + sqr(m[0][1])*k[2][1]; - mm[0][0] = -(a * m[0][0] + b * m[1][0]); // du/dx - mm[0][1] = -(a * m[0][1] + b * m[1][1]); // du/dy + // du/dx + mm[0][0] = -(a * m[0][0] + b * m[1][0]); + // du/dy + mm[0][1] = -(a * m[0][1] + b * m[1][1]); // coefficients in second derivative with respect to xy a = m[0][0] * m[1][0] * k[0][0] + (m[0][1] * m[1][0] + m[0][0] * m[1][1])*k[1][0] + m[0][1] * m[1][1] * k[2][0]; b = m[0][0] * m[1][0] * k[0][1] + (m[0][1] * m[1][0] + m[0][0] * m[1][1])*k[1][1] + m[0][1] * m[1][1] * k[2][1]; - mm[1][0] = -(a * m[0][0] + b * m[1][0]); // du/dx - mm[1][1] = -(a * m[0][1] + b * m[1][1]); // du/dy + // du/dx + mm[1][0] = -(a * m[0][0] + b * m[1][0]); + // du/dy + mm[1][1] = -(a * m[0][1] + b * m[1][1]); // coefficients in second derivative with respect to yy a = sqr(m[1][0])*k[0][0] + 2 * m[1][0] * m[1][1] * k[1][0] + sqr(m[1][1])*k[2][0]; b = sqr(m[1][0])*k[0][1] + 2 * m[1][0] * m[1][1] * k[1][1] + sqr(m[1][1])*k[2][1]; - mm[2][0] = -(a * m[0][0] + b * m[1][0]); // du/dx - mm[2][1] = -(a * m[0][1] + b * m[1][1]); // du/dy + // du/dx + mm[2][0] = -(a * m[0][0] + b * m[1][0]); + // du/dy + mm[2][1] = -(a * m[0][1] + b * m[1][1]); } double3x2* RefMap::get_second_ref_map(int order) @@ -545,17 +548,17 @@ namespace Hermes double2* local_coeffs; double2 local_lin_coeffs[H2D_MAX_NUMBER_VERTICES]; H1ShapesetJacobi shapeset; - int local_indices[70]; + short local_indices[70]; // prepare the shapes and coefficients of the reference map int j, k = 0; - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) local_indices[k++] = shapeset.get_vertex_index(i, e->get_mode()); // straight-edged element if (e->cm == nullptr) { - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { local_lin_coeffs[i][0] = e->vn[i]->x; local_lin_coeffs[i][1] = e->vn[i]->y; @@ -566,20 +569,21 @@ namespace Hermes else // curvilinear element - edge and bubble shapes { int o = e->cm->order; - for (unsigned int i = 0; i < e->get_nvert(); i++) - for (j = 2; j <= o; j++) - local_indices[k++] = shapeset.get_edge_index(i, 0, j, e->get_mode()); + for (unsigned char i = 0; i < e->get_nvert(); i++) + for (j = 2; j <= o; j++) + local_indices[k++] = shapeset.get_edge_index(i, 0, j, e->get_mode()); - if (e->is_quad()) o = H2D_MAKE_QUAD_ORDER(o, o); + if (e->is_quad()) + o = H2D_MAKE_QUAD_ORDER(o, o); memcpy(local_indices + k, shapeset.get_bubble_indices(o, e->get_mode()), - shapeset.get_num_bubbles(o, e->get_mode()) * sizeof(int)); + shapeset.get_num_bubbles(o, e->get_mode()) * sizeof(short)); local_coeffs = e->cm->coeffs; local_nc = e->cm->nc; } // Constant reference mapping. - if (!e->is_curved() && (e->is_triangle() || is_parallelogram(e))) + if (!e->is_curved() && (e->is_triangle() || e->is_parallelogram())) { double dx = e->vn[0]->x - x; double dy = e->vn[0]->y - y; @@ -610,7 +614,8 @@ namespace Hermes double xi1_old = 0.0, xi2_old = 0.0; double vx, vy; double2x2 m; - int it = 0; // number of Newton iterations + // number of Newton iterations + int it = 0; while (1) { double2x2 tmp; @@ -784,7 +789,7 @@ namespace Hermes // vector for curved elements that do not contain the point when considering straightened edges. // these are then checked at the end of this method, as they are really slow to look for the point in. - Hermes::vector improbable_curved_elements; + std::vector improbable_curved_elements; // main loop over all active elements. for_all_active_elements(e, mesh) @@ -904,7 +909,7 @@ namespace Hermes } // loop through the improbable curved elements. - for (int i = 0; i < improbable_curved_elements.size(); i++) + for (unsigned short i = 0; i < improbable_curved_elements.size(); i++) { untransform(improbable_curved_elements[i], x, y, xi1, xi2); if (is_in_ref_domain(improbable_curved_elements[i], xi1, xi2)) @@ -926,9 +931,9 @@ namespace Hermes this->sub_idx = sub_idx; stack[top] = *ctm; this->ctm = stack + top; - if (is_const) + if (this->is_const) calc_const_inv_ref_map(); this->reinit_storage(); } } -} +} \ No newline at end of file diff --git a/hermes2d/src/mesh/traverse.cpp b/hermes2d/src/mesh/traverse.cpp index 96484e521a..26d7f9f3c6 100644 --- a/hermes2d/src/mesh/traverse.cpp +++ b/hermes2d/src/mesh/traverse.cpp @@ -92,7 +92,7 @@ namespace Hermes } } - void Traverse::init_transforms(Traverse::State* s, int i) + void Traverse::init_transforms(Traverse::State* s, unsigned char i) { Rect r; memcpy(&r, s->er + i, sizeof(Rect)); @@ -165,7 +165,6 @@ namespace Hermes memcpy(state->bnd, other->bnd, 4 * sizeof(bool)); state->rep = other->rep; - state->rep_subidx = other->rep_subidx; state->rep_i = other->rep_i; state->visited = other->visited; state->isurf = other->isurf; @@ -182,7 +181,7 @@ namespace Hermes delete[] sub_idx; } - void Traverse::State::push_transform(int son, int i, bool is_triangle) + void Traverse::State::push_transform(unsigned char son, unsigned char i, bool is_triangle) { this->sub_idx[i] = (sub_idx[i] << 3) + son + 1; @@ -215,7 +214,7 @@ namespace Hermes } } - uint64_t Traverse::State::get_transform(int i) + uint64_t Traverse::State::get_transform(unsigned char i) { return this->sub_idx[i]; } @@ -248,7 +247,7 @@ namespace Hermes { Element* e = nullptr; for (int i = 0; i < num; i++) - if ((e = s->e[i]) != nullptr) break; + if ((e = s->e[i]) != nullptr) break; if (e->is_triangle()) { @@ -282,27 +281,27 @@ namespace Hermes } template - Traverse::State** Traverse::get_states(Hermes::vector > mesh_functions, int& states_count) + Traverse::State** Traverse::get_states(std::vector > mesh_functions, unsigned int& states_count) { - Hermes::vector meshes; - for (int i = 0; i < mesh_functions.size(); i++) + std::vector meshes; + for (unsigned short i = 0; i < mesh_functions.size(); i++) meshes.push_back(mesh_functions[i]->get_mesh()); return this->get_states(meshes, states_count); } - Traverse::State** Traverse::get_states(Hermes::vector meshes, int& states_count) + Traverse::State** Traverse::get_states(std::vector meshes, unsigned int& states_count) { return Traverse::get_states(&meshes[0], meshes.size(), states_count); } - Traverse::State** Traverse::get_states(MeshSharedPtr* meshes, int meshes_count, int& states_count) + Traverse::State** Traverse::get_states(MeshSharedPtr* meshes, unsigned short meshes_count, unsigned int& states_count) { // This will be returned. int count = 0, predictedCount = 0; this->num = meshes_count; for (int i = 0; i < meshes_count; i++) - if (meshes[i]->get_num_active_elements() > predictedCount) - predictedCount = meshes[i]->get_num_active_elements(); + if (meshes[i]->get_num_active_elements() > predictedCount) + predictedCount = meshes[i]->get_num_active_elements(); State** states = malloc_with_check(predictedCount); this->begin(num); @@ -353,7 +352,6 @@ namespace Hermes else { s->rep = s->e[i]; - s->rep_subidx = 0; s->rep_i = 0; } s->er[i] = H2D_UNITY; @@ -369,8 +367,8 @@ namespace Hermes (id)++; if (s->is_triangle()) - for (i = 0; i < 3; i++) - s->bnd[i] = true; + for (i = 0; i < 3; i++) + s->bnd[i] = true; } // Entering a new_ state, perform transformations. @@ -379,9 +377,9 @@ namespace Hermes { // ..where the element is used .. if (s->e[i] != nullptr && s->e[i]->used) - if (s->sub_idx[i] == 0 && s->e[i]->active) - if (!s->e[i]->is_triangle()) - init_transforms(s, i); + if (s->sub_idx[i] == 0 && s->e[i]->active) + if (!s->e[i]->is_triangle()) + init_transforms(s, i); } // Is this the leaf state? @@ -389,11 +387,11 @@ namespace Hermes for (i = 0; i < num; i++) { if (s->e[i] != nullptr && s->e[i]->used) - if (!s->e[i]->active) - { + if (!s->e[i]->active) + { leaf = false; break; - } + } } // if yes, set boundary flags and return the state @@ -413,12 +411,11 @@ namespace Hermes // The reason is not to include states that only have elements // on meshes that are not a part of the weak form. for (int j = 0; j < this->spaces_size; j++) - if (s->e[j] != nullptr && s->e[j]->used) - { + if (s->e[j] != nullptr && s->e[j]->used) + { s->rep = s->e[j]; - s->rep_subidx = s->sub_idx[j]; s->rep_i = j; - } + } if (s->rep) states[count++] = State::clone(s); continue; @@ -480,8 +477,8 @@ namespace Hermes int4* current_sons = new int4[num]; int split = 0; for (i = 0; i < num; i++) - if (s->e[i] != nullptr && !s->e[i]->active) - split |= get_split_and_sons(s->e[i], &s->cr, s->er + i, current_sons[i]); + if (s->e[i] != nullptr && !s->e[i]->active) + split |= get_split_and_sons(s->e[i], &s->cr, s->er + i, current_sons[i]); // Both splits: recur to four sons, similar to triangles. if (split == 3) @@ -593,8 +590,8 @@ namespace Hermes // Test whether all master meshes have the same number of elements. int base_elem_num = meshes[0]->get_num_base_elements(); for (int i = 1; i < n; i++) - if (base_elem_num != meshes[i]->get_num_base_elements()) - throw Hermes::Exceptions::Exception("Meshes not compatible in Traverse::begin()."); + if (base_elem_num != meshes[i]->get_num_base_elements()) + throw Hermes::Exceptions::Exception("Meshes not compatible in Traverse::begin()."); } static void testMeshesQuality(int n, MeshSharedPtr* meshes) @@ -634,10 +631,10 @@ namespace Hermes for_all_base_elements_incl_inactive(e, meshes[i]) { if (e->used) - if (fabs(areas[counter] - e->area) > tolerance && areas[counter] > Hermes::HermesSqrtEpsilon) - { + if (fabs(areas[counter] - e->area) > tolerance && areas[counter] > Hermes::HermesSqrtEpsilon) + { throw Hermes::Exceptions::Exception("An element is probably too distorted, try different meshing."); - } + } counter++; } } @@ -671,8 +668,8 @@ namespace Hermes return; for (int i = 0; i < size; i++) - if (stack[i].e != nullptr) - free_state(stack + i); + if (stack[i].e != nullptr) + free_state(stack + i); delete[] stack; stack = nullptr; @@ -771,8 +768,8 @@ namespace Hermes // obtain split types and son numbers for the current rectangle on all elements int split = 0; for (i = 0; i < num; i++) - if (!e[i]->active) - split |= get_split_and_sons(e[i], cr, er + i, sons[i]); + if (!e[i]->active) + split |= get_split_and_sons(e[i], cr, er + i, sons[i]); // both splits: recur to four sons if (split == 3) @@ -856,7 +853,7 @@ namespace Hermes delete[] idx_new; } - UniData** Traverse::construct_union_mesh(int n, MeshSharedPtr* meshes, MeshSharedPtr unimesh) + UniData** Traverse::construct_union_mesh(unsigned char n, MeshSharedPtr* meshes, MeshSharedPtr unimesh) { // Initial check. testMeshesCompliance(n, meshes); @@ -904,7 +901,7 @@ namespace Hermes return traverse.unidata; } - template HERMES_API Traverse::State** Traverse::get_states(Hermes::vector > mesh_functions, int& states_count); - template HERMES_API Traverse::State** Traverse::get_states >(Hermes::vector > > mesh_functions, int& states_count); + template HERMES_API Traverse::State** Traverse::get_states(std::vector > mesh_functions, unsigned int& states_count); + template HERMES_API Traverse::State** Traverse::get_states >(std::vector > > mesh_functions, unsigned int& states_count); } -} +} \ No newline at end of file diff --git a/hermes2d/src/mixins2d.cpp b/hermes2d/src/mixins2d.cpp index 1f216fbdc6..df157433de 100644 --- a/hermes2d/src/mixins2d.cpp +++ b/hermes2d/src/mixins2d.cpp @@ -29,10 +29,9 @@ namespace Hermes this->validate = to_set; } - Parallel::Parallel() : num_threads_used(HermesCommonApi.get_integral_param_value(numThreads)) { } } } -} +} \ No newline at end of file diff --git a/hermes2d/src/neighbor_search.cpp b/hermes2d/src/neighbor_search.cpp index 9cfec2bd98..2007de2dd2 100644 --- a/hermes2d/src/neighbor_search.cpp +++ b/hermes2d/src/neighbor_search.cpp @@ -109,12 +109,12 @@ namespace Hermes clear_supported_shapes(); for (unsigned int i = 0; i < central_transformations_alloc_size; i++) - if (this->central_transformations[i]) - delete this->central_transformations[i]; + if (this->central_transformations[i]) + delete this->central_transformations[i]; free_with_check(this->central_transformations); for (unsigned int i = 0; i < neighbor_transformations_alloc_size; i++) - if (this->neighbor_transformations[i]) - delete this->neighbor_transformations[i]; + if (this->neighbor_transformations[i]) + delete this->neighbor_transformations[i]; free_with_check(this->neighbor_transformations); } @@ -125,7 +125,7 @@ namespace Hermes } template - const Hermes::vector* NeighborSearch::get_neighbors() const + const std::vector* NeighborSearch::get_neighbors() const { return &neighbors; } @@ -249,8 +249,10 @@ namespace Hermes { neighborhood_type = H2D_DG_GO_DOWN; - int sons[Transformations::max_level]; // array of virtual sons of the central el. visited on the way down to the neighbor - int n_sons = 0; // number of used transformations + // array of virtual sons of the central el. visited on the way down to the neighbor + int sons[Transformations::max_level]; + // number of used transformations + int n_sons = 0; // Start the search by going down to the first son. find_act_elem_down(vertex, orig_vertex_id, sons, n_sons + 1); @@ -264,7 +266,7 @@ namespace Hermes template bool NeighborSearch::set_active_edge_multimesh(const int& edge) { - Hermes::vector transformations = get_transforms(original_central_el_transform); + std::vector transformations = get_transforms(original_central_el_transform); // Inter-element edge. if (is_inter_edge(edge, transformations)) { @@ -295,15 +297,15 @@ namespace Hermes } template - Hermes::vector NeighborSearch::get_transforms(uint64_t sub_idx) const + std::vector NeighborSearch::get_transforms(uint64_t sub_idx) const { - Hermes::vector transformations_backwards; + std::vector transformations_backwards; while (sub_idx > 0) { transformations_backwards.push_back((sub_idx - 1) & 7); sub_idx = (sub_idx - 1) >> 3; } - Hermes::vector transformations; + std::vector transformations; for (unsigned int i = 0; i < transformations_backwards.size(); i++) transformations.push_back(transformations_backwards[transformations_backwards.size() - 1 - i]); @@ -311,7 +313,7 @@ namespace Hermes } template - bool NeighborSearch::is_inter_edge(const int& edge, const Hermes::vector& transformations) const + bool NeighborSearch::is_inter_edge(const int& edge, const std::vector& transformations) const { // No subelements => of course this edge is an inter-element one. if (transformations.size() == 0) @@ -319,22 +321,22 @@ namespace Hermes // Triangles. for (unsigned int i = 0; i < transformations.size(); i++) - if (central_el->get_mode() == HERMES_MODE_TRIANGLE) - { + if (central_el->get_mode() == HERMES_MODE_TRIANGLE) + { if ((edge == 0 && (transformations[i] == 2 || transformations[i] == 3)) || (edge == 1 && (transformations[i] == 0 || transformations[i] == 3)) || (edge == 2 && (transformations[i] == 1 || transformations[i] == 3))) return false; - } + } // Quads. - else - { - if ((edge == 0 && (transformations[i] == 2 || transformations[i] == 3 || transformations[i] == 5)) || - (edge == 1 && (transformations[i] == 0 || transformations[i] == 3 || transformations[i] == 6)) || - (edge == 2 && (transformations[i] == 0 || transformations[i] == 1 || transformations[i] == 4)) || - (edge == 3 && (transformations[i] == 1 || transformations[i] == 2 || transformations[i] == 7))) - return false; - } + else + { + if ((edge == 0 && (transformations[i] == 2 || transformations[i] == 3 || transformations[i] == 5)) || + (edge == 1 && (transformations[i] == 0 || transformations[i] == 3 || transformations[i] == 6)) || + (edge == 2 && (transformations[i] == 0 || transformations[i] == 1 || transformations[i] == 4)) || + (edge == 3 && (transformations[i] == 1 || transformations[i] == 2 || transformations[i] == 7))) + return false; + } return true; } @@ -391,7 +393,7 @@ namespace Hermes } template - void NeighborSearch::update_according_to_sub_idx(const Hermes::vector& transformations) + void NeighborSearch::update_according_to_sub_idx(const std::vector& transformations) { if (neighborhood_type == H2D_DG_NO_TRANSF && transformations.size() == 0) return; @@ -407,37 +409,37 @@ namespace Hermes for (unsigned int i = 0; i < transformations.size(); i++) // Triangles. - if (central_el->get_mode() == HERMES_MODE_TRIANGLE) - if ((active_edge == 0 && transformations[i] == 0) || - (active_edge == 1 && transformations[i] == 1) || - (active_edge == 2 && transformations[i] == 2)) - tr->transf[tr->num_levels++] = (!neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 3); - else - tr->transf[tr->num_levels++] = (neighbor_edges[0].orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 3); + if (central_el->get_mode() == HERMES_MODE_TRIANGLE) + if ((active_edge == 0 && transformations[i] == 0) || + (active_edge == 1 && transformations[i] == 1) || + (active_edge == 2 && transformations[i] == 2)) + tr->transf[tr->num_levels++] = (!neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 3); + else + tr->transf[tr->num_levels++] = (neighbor_edges[0].orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 3); // Quads. - else - if ((active_edge == 0 && (transformations[i] == 0 || transformations[i] == 6)) || - (active_edge == 1 && (transformations[i] == 1 || transformations[i] == 4)) || - (active_edge == 2 && (transformations[i] == 2 || transformations[i] == 7)) || - (active_edge == 3 && (transformations[i] == 3 || transformations[i] == 5))) - tr->transf[tr->num_levels++] = (!neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 4); - else if ((active_edge == 0 && (transformations[i] == 1 || transformations[i] == 7)) || - (active_edge == 1 && (transformations[i] == 2 || transformations[i] == 5)) || - (active_edge == 2 && (transformations[i] == 3 || transformations[i] == 6)) || - (active_edge == 3 && (transformations[i] == 0 || transformations[i] == 4))) - tr->transf[tr->num_levels++] = (neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 4); + else + if ((active_edge == 0 && (transformations[i] == 0 || transformations[i] == 6)) || + (active_edge == 1 && (transformations[i] == 1 || transformations[i] == 4)) || + (active_edge == 2 && (transformations[i] == 2 || transformations[i] == 7)) || + (active_edge == 3 && (transformations[i] == 3 || transformations[i] == 5))) + tr->transf[tr->num_levels++] = (!neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 4); + else if ((active_edge == 0 && (transformations[i] == 1 || transformations[i] == 7)) || + (active_edge == 1 && (transformations[i] == 2 || transformations[i] == 5)) || + (active_edge == 2 && (transformations[i] == 3 || transformations[i] == 6)) || + (active_edge == 3 && (transformations[i] == 0 || transformations[i] == 4))) + tr->transf[tr->num_levels++] = (neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 4); } else handle_sub_idx_way_down(transformations); } template - void NeighborSearch::handle_sub_idx_way_down(const Hermes::vector& transformations) + void NeighborSearch::handle_sub_idx_way_down(const std::vector& transformations) { - Hermes::vector neighbors_to_be_deleted; - Hermes::vector neighbors_not_to_be_deleted; + std::vector neighbors_to_be_deleted; + std::vector neighbors_not_to_be_deleted; - Hermes::vector updated_transformations; - for (int i = 0; i < transformations.size(); i++) + std::vector updated_transformations; + for (unsigned short i = 0; i < transformations.size(); i++) { if (!((active_edge == 0 && transformations[i] == 4) || (active_edge == 1 && transformations[i] == 7) || (active_edge == 2 && transformations[i] == 5) || (active_edge == 3 && transformations[i] == 6))) { @@ -505,8 +507,8 @@ namespace Hermes // Now we truly delete (in the reverse order) the neighbors. if (neighbors_to_be_deleted.size() > 0) - for (unsigned int neighbors_to_be_deleted_i = neighbors_to_be_deleted.size(); neighbors_to_be_deleted_i >= 1; neighbors_to_be_deleted_i--) - delete_neighbor(neighbors_to_be_deleted[neighbors_to_be_deleted_i - 1]); + for (unsigned int neighbors_to_be_deleted_i = neighbors_to_be_deleted.size(); neighbors_to_be_deleted_i >= 1; neighbors_to_be_deleted_i--) + delete_neighbor(neighbors_to_be_deleted[neighbors_to_be_deleted_i - 1]); } template @@ -555,10 +557,10 @@ namespace Hermes if (neighborhood_type != H2D_DG_GO_DOWN) return; // Obtain the transformations sequence. - Hermes::vector transformations = get_transforms(original_central_el_transform); + std::vector transformations = get_transforms(original_central_el_transform); - Hermes::vector updated_transformations; - for (int i = 0; i < transformations.size(); i++) + std::vector updated_transformations; + for (unsigned short i = 0; i < transformations.size(); i++) { if (!((active_edge == 0 && transformations[i] == 4) || (active_edge == 1 && transformations[i] == 7) || (active_edge == 2 && transformations[i] == 5) || (active_edge == 3 && transformations[i] == 6))) { @@ -596,8 +598,8 @@ namespace Hermes // Also the function compatible_transformations() does not have to be used, as now the array central_transformations // has been adjusted so that it contains the array transformations. while (central_transformations[i]->transf[j] == updated_transformations[j]) - if (++j > updated_transformations.size() - 1) - break; + if (++j > updated_transformations.size() - 1) + break; if (j > central_transformations[i]->num_levels) j = central_transformations[i]->num_levels; @@ -610,24 +612,24 @@ namespace Hermes // Triangles. if (central_el->get_mode() == HERMES_MODE_TRIANGLE) - if ((active_edge == 0 && updated_transformations[level] == 0) || - (active_edge == 1 && updated_transformations[level] == 1) || - (active_edge == 2 && updated_transformations[level] == 2)) - neighbor_transforms->transf[neighbor_transforms->num_levels++] = (!neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 3); - else - neighbor_transforms->transf[neighbor_transforms->num_levels++] = (neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 3); + if ((active_edge == 0 && updated_transformations[level] == 0) || + (active_edge == 1 && updated_transformations[level] == 1) || + (active_edge == 2 && updated_transformations[level] == 2)) + neighbor_transforms->transf[neighbor_transforms->num_levels++] = (!neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 3); + else + neighbor_transforms->transf[neighbor_transforms->num_levels++] = (neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 3); // Quads. else - if ((active_edge == 0 && (updated_transformations[level] == 0 || updated_transformations[level] == 6)) || - (active_edge == 1 && (updated_transformations[level] == 1 || updated_transformations[level] == 4)) || - (active_edge == 2 && (updated_transformations[level] == 2 || updated_transformations[level] == 7)) || - (active_edge == 3 && (updated_transformations[level] == 3 || updated_transformations[level] == 5))) - neighbor_transforms->transf[neighbor_transforms->num_levels++] = (!neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 4); - else if ((active_edge == 0 && (updated_transformations[level] == 1 || updated_transformations[level] == 7)) || - (active_edge == 1 && (updated_transformations[level] == 2 || updated_transformations[level] == 5)) || - (active_edge == 2 && (updated_transformations[level] == 3 || updated_transformations[level] == 6)) || - (active_edge == 3 && (updated_transformations[level] == 0 || updated_transformations[level] == 4))) - neighbor_transforms->transf[neighbor_transforms->num_levels++] = (neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 4); + if ((active_edge == 0 && (updated_transformations[level] == 0 || updated_transformations[level] == 6)) || + (active_edge == 1 && (updated_transformations[level] == 1 || updated_transformations[level] == 4)) || + (active_edge == 2 && (updated_transformations[level] == 2 || updated_transformations[level] == 7)) || + (active_edge == 3 && (updated_transformations[level] == 3 || updated_transformations[level] == 5))) + neighbor_transforms->transf[neighbor_transforms->num_levels++] = (!neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 4); + else if ((active_edge == 0 && (updated_transformations[level] == 1 || updated_transformations[level] == 7)) || + (active_edge == 1 && (updated_transformations[level] == 2 || updated_transformations[level] == 5)) || + (active_edge == 2 && (updated_transformations[level] == 3 || updated_transformations[level] == 6)) || + (active_edge == 3 && (updated_transformations[level] == 0 || updated_transformations[level] == 4))) + neighbor_transforms->transf[neighbor_transforms->num_levels++] = (neighbor_edge.orientation ? neighbor_edge.local_num_of_edge : (neighbor_edge.local_num_of_edge + 1) % 4); } central_transformations[i]->strip_initial_transformations(j); @@ -653,8 +655,8 @@ namespace Hermes void NeighborSearch::delete_neighbor(unsigned int position) { for (unsigned int i = position; i < n_neighbors - 1; i++) - if (i + 1 < this->central_transformations_alloc_size) - central_transformations[i]->copy_from(central_transformations[i + 1]); + if (i + 1 < this->central_transformations_alloc_size) + central_transformations[i]->copy_from(central_transformations[i + 1]); if ((n_neighbors - 1 < this->central_transformations_alloc_size) && central_transformations[n_neighbors - 1]) central_transformations[n_neighbors - 1]->reset(); @@ -703,11 +705,11 @@ namespace Hermes if (n_parents == 0) par_mid_vertices[n_parents++] = vertex; else - if (n_parents == Transformations::max_level - 1) - throw Hermes::Exceptions::Exception("Maximum number of intermediate parents exceeded in NeighborSearch::finding_act_elem_up"); - else - if (par_mid_vertices[n_parents - 1]->id != vertex->id) - par_mid_vertices[n_parents++] = vertex; + if (n_parents == Transformations::max_level - 1) + throw Hermes::Exceptions::Exception("Maximum number of intermediate parents exceeded in NeighborSearch::finding_act_elem_up"); + else + if (par_mid_vertices[n_parents - 1]->id != vertex->id) + par_mid_vertices[n_parents++] = vertex; } if ((edge == nullptr) || (central_el->en[active_edge]->id == edge->id)) @@ -722,19 +724,19 @@ namespace Hermes // Get a pointer to the active neighbor element. if ((edge->elem[i] != nullptr) && (edge->elem[i]->active == 1)) { - neighb_el = edge->elem[i]; //debug_log("way up neighbor: %d", neighb_el->id); + //debug_log("way up neighbor: %d", neighb_el->id); + neighb_el = edge->elem[i]; // Get local number of the edge used by the neighbor. neighbor_edge.local_num_of_edge = -1; for (unsigned int j = 0; j < neighb_el->get_nvert(); j++) - if (neighb_el->en[j] == edge) - { + if (neighb_el->en[j] == edge) + { neighbor_edge.local_num_of_edge = j; break; - } + } if (neighbor_edge.local_num_of_edge == -1) throw Hermes::Exceptions::Exception("Neighbor edge wasn't found"); - // Add to the array of neighbor_transformations one that transforms central el. to its parent completely // adjacent to the single big neighbor. assert(n_neighbors == 0); @@ -761,7 +763,6 @@ namespace Hermes if (n->id == par_mid_vertices[j - 1]->id) { neighbor_transforms->transf[n_parents - j - 1] = (neighbor_edge.local_num_of_edge + 1) % neighb_el->get_nvert(); - /// \todo This is never used. Why? p2 = par_mid_vertices[j]->id; } else @@ -799,7 +800,8 @@ namespace Hermes template void NeighborSearch::find_act_elem_down(Node* vertex, int* bounding_verts_id, int* sons, unsigned int n_sons) { - int mid_vert = vertex->id; // ID of vertex in between vertices from par_vertex_id. + // ID of vertex in between vertices from par_vertex_id. + int mid_vert = vertex->id; int bnd_verts[2]; bnd_verts[0] = bounding_verts_id[0]; bnd_verts[1] = bounding_verts_id[1]; @@ -840,16 +842,17 @@ namespace Hermes { if ((edge->elem[j] != nullptr) && (edge->elem[j]->active == 1)) { - neighb_el = mesh->get_element(edge->elem[j]->id); //debug_log("way down neighbor: %d", edge->elem[j]->id); + //debug_log("way down neighbor: %d", edge->elem[j]->id); + neighb_el = mesh->get_element(edge->elem[j]->id); // Get local number of the edge used by the neighbor. neighbor_edge.local_num_of_edge = -1; for (unsigned int k = 0; k < neighb_el->get_nvert(); k++) - if (neighb_el->en[k] == edge) - { + if (neighb_el->en[k] == edge) + { neighbor_edge.local_num_of_edge = k; break; - } + } if (neighbor_edge.local_num_of_edge == -1) throw Hermes::Exceptions::Exception("Neighbor edge wasn't found"); @@ -886,13 +889,15 @@ namespace Hermes { // neighbor edge goes from parent1 to middle vertex if (neighb_el->vn[neighbor_edge.local_num_of_edge]->id != bounding_vert1) - return true; // orientation reversed + // orientation reversed + return true; } else { // neighbor edge goes from middle vertex to parent2 if (neighb_el->vn[neighbor_edge.local_num_of_edge]->id == bounding_vert2) - return true; // orientation reversed + // orientation reversed + return true; } return false; } @@ -1105,13 +1110,13 @@ namespace Hermes } template - NeighborSearch::Transformations::Transformations(const Hermes::vector& t) + NeighborSearch::Transformations::Transformations(const std::vector& t) { copy_from(t); } template - void NeighborSearch::Transformations::copy_from(const Hermes::vector& t) + void NeighborSearch::Transformations::copy_from(const std::vector& t) { num_levels = std::min(t.size(), max_level); std::copy(t.begin(), t.begin() + num_levels, transf); @@ -1125,7 +1130,7 @@ namespace Hermes } template - void NeighborSearch::Transformations::copy_to(Hermes::vector* t) + void NeighborSearch::Transformations::copy_to(std::vector* t) { t->assign(transf, transf + num_levels); } @@ -1145,14 +1150,14 @@ namespace Hermes } template - void NeighborSearch::Transformations::apply_on(const Hermes::vector& tr) const + void NeighborSearch::Transformations::apply_on(const std::vector& tr) const { - for (Hermes::vector::const_iterator it = tr.begin(); it != tr.end(); ++it) - for (unsigned int i = 0; i < num_levels; i++) - (*it)->push_transform(transf[i]); + for (std::vector::const_iterator it = tr.begin(); it != tr.end(); ++it) + for (unsigned int i = 0; i < num_levels; i++) + (*it)->push_transform(transf[i]); } - template class HERMES_API NeighborSearch; - template class HERMES_API NeighborSearch >; + template class HERMES_API NeighborSearch < double > ; + template class HERMES_API NeighborSearch < std::complex > ; } } \ No newline at end of file diff --git a/hermes2d/src/norm_form.cpp b/hermes2d/src/norm_form.cpp index b9b57c4fb8..1a33cb6982 100644 --- a/hermes2d/src/norm_form.cpp +++ b/hermes2d/src/norm_form.cpp @@ -76,27 +76,27 @@ namespace Hermes } template - NormFormVol::NormFormVol(int i, int j) : NormForm(i, j) + NormFormVol::NormFormVol(int i, int j, FunctionsEvaluatedType functionType) : NormForm(i, j, functionType) { } template - NormFormSurf::NormFormSurf(int i, int j) : NormForm(i, j) + NormFormSurf::NormFormSurf(int i, int j, FunctionsEvaluatedType functionType) : NormForm(i, j, functionType) { } template - NormFormDG::NormFormDG(int i, int j) : NormForm(i, j) + NormFormDG::NormFormDG(int i, int j, FunctionsEvaluatedType functionType) : NormForm(i, j, functionType) { } template - DefaultNormFormVol::DefaultNormFormVol(int i, int j, NormType normType) : NormFormVol(i, j), normType(normType) + DefaultNormFormVol::DefaultNormFormVol(int i, int j, NormType normType, FunctionsEvaluatedType functionType) : NormFormVol(i, j, functionType), normType(normType) { } template - Scalar DefaultNormFormVol::value(int n, double *wt, Func *u, Func *v, Geom *e) const + Scalar DefaultNormFormVol::value(int n, double *wt, Func *u, Func *v, GeomVol *e) const { switch (this->normType) { @@ -116,12 +116,12 @@ namespace Hermes } } template - DefaultNormFormSurf::DefaultNormFormSurf(int i, int j, NormType normType) : NormFormSurf(i, j), normType(normType) + DefaultNormFormSurf::DefaultNormFormSurf(int i, int j, NormType normType, FunctionsEvaluatedType functionType) : NormFormSurf(i, j, functionType), normType(normType) { } template - Scalar DefaultNormFormSurf::value(int n, double *wt, Func *u, Func *v, Geom *e) const + Scalar DefaultNormFormSurf::value(int n, double *wt, Func *u, Func *v, GeomSurf *e) const { switch (this->normType) { @@ -141,7 +141,6 @@ namespace Hermes } } - template MatrixDefaultNormFormVol::MatrixDefaultNormFormVol(int i, int j, NormType normType) : MatrixFormVol(i, j), normType(normType) { @@ -150,7 +149,7 @@ namespace Hermes template Scalar MatrixDefaultNormFormVol::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { switch (this->normType) { @@ -172,7 +171,7 @@ namespace Hermes template Ord MatrixDefaultNormFormVol::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { switch (this->normType) { @@ -204,7 +203,7 @@ namespace Hermes } template - Scalar VectorDefaultNormFormVol::value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const + Scalar VectorDefaultNormFormVol::value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { switch (this->normType) { @@ -226,7 +225,7 @@ namespace Hermes template Ord VectorDefaultNormFormVol::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { switch (this->normType) { @@ -252,19 +251,19 @@ namespace Hermes return new VectorDefaultNormFormVol(this->i, this->normType); } - template HERMES_API class NormFormVol; - template HERMES_API class NormFormVol >; - template HERMES_API class NormFormSurf; - template HERMES_API class NormFormSurf >; - template HERMES_API class NormFormDG; - template HERMES_API class NormFormDG >; - template HERMES_API class DefaultNormFormVol; - template HERMES_API class DefaultNormFormVol >; - template HERMES_API class DefaultNormFormSurf; - template HERMES_API class DefaultNormFormSurf >; - template HERMES_API class MatrixDefaultNormFormVol; - template HERMES_API class MatrixDefaultNormFormVol >; - template HERMES_API class VectorDefaultNormFormVol; - template HERMES_API class VectorDefaultNormFormVol >; + template HERMES_API class NormFormVol < double > ; + template HERMES_API class NormFormVol < std::complex > ; + template HERMES_API class NormFormSurf < double > ; + template HERMES_API class NormFormSurf < std::complex > ; + template HERMES_API class NormFormDG < double > ; + template HERMES_API class NormFormDG < std::complex > ; + template HERMES_API class DefaultNormFormVol < double > ; + template HERMES_API class DefaultNormFormVol < std::complex > ; + template HERMES_API class DefaultNormFormSurf < double > ; + template HERMES_API class DefaultNormFormSurf < std::complex > ; + template HERMES_API class MatrixDefaultNormFormVol < double > ; + template HERMES_API class MatrixDefaultNormFormVol < std::complex > ; + template HERMES_API class VectorDefaultNormFormVol < double > ; + template HERMES_API class VectorDefaultNormFormVol < std::complex > ; } } \ No newline at end of file diff --git a/hermes2d/src/projections/ogprojection.cpp b/hermes2d/src/projections/ogprojection.cpp index ae37381b65..5442070e44 100644 --- a/hermes2d/src/projections/ogprojection.cpp +++ b/hermes2d/src/projections/ogprojection.cpp @@ -22,8 +22,7 @@ namespace Hermes namespace Hermes2D { template - void OGProjection::project_internal(SpaceSharedPtr space, WeakForm* wf, - Scalar* target_vec) + void OGProjection::project_internal(SpaceSharedPtr space, WeakFormSharedPtr wf, Scalar* target_vec) { // Sanity check. if (wf == nullptr) @@ -31,12 +30,8 @@ namespace Hermes if (target_vec == nullptr) throw Exceptions::NullException(2); - // Initialize DiscreteProblem. - DiscreteProblem dp(wf, space); - dp.set_linear(); - // Initialize linear solver. - Hermes::Hermes2D::LinearSolver linear_solver(&dp, true); + Hermes::Hermes2D::LinearSolver linear_solver(wf, space, true); linear_solver.set_verbose_output(false); // Perform Newton iteration. @@ -52,15 +47,12 @@ namespace Hermes Scalar* target_vec) { // Define projection weak form. - WeakForm* proj_wf = new WeakForm(1); + WeakFormSharedPtr proj_wf(new WeakForm(1)); proj_wf->add_matrix_form(custom_projection_jacobian); proj_wf->add_vector_form(custom_projection_residual); // Call the main function. project_internal(space, proj_wf, target_vec); - - // Clean up. - delete proj_wf; } template @@ -82,45 +74,39 @@ namespace Hermes } template - void OGProjection::project_global(const Hermes::vector >& spaces, - const Hermes::vector*>& custom_projection_jacobians, - const Hermes::vector*>& custom_projection_residuals, + void OGProjection::project_global(const std::vector > spaces, + const std::vector*>& custom_projection_jacobians, + const std::vector*>& custom_projection_residuals, Scalar* target_vec) { - int n = spaces.size(); - // Sanity checks. if (target_vec == nullptr) throw Exceptions::NullException(3); - if (n != custom_projection_jacobians.size()) throw Exceptions::LengthException(1, 2, n, custom_projection_residuals.size()); - if (n != custom_projection_residuals.size()) throw Exceptions::LengthException(1, 2, n, custom_projection_residuals.size()); + // Sanity checks. + Helpers::check_length(custom_projection_jacobians, spaces); + Helpers::check_length(custom_projection_residuals, spaces); - int start_index = 0; - for (int i = 0; i < n; i++) + int start_index = 0, spaces_size = spaces.size(); + for (int i = 0; i < spaces_size; i++) { - project_global(spaces[i], custom_projection_jacobians[i], custom_projection_residuals[i], target_vec + start_index); - start_index += spaces[i]->get_num_dofs(); } } template - void OGProjection::project_global(const Hermes::vector >& spaces, - const Hermes::vector*>& custom_projection_jacobians, - const Hermes::vector*>& custom_projection_residuals, - const Hermes::vector >& target_slns) + void OGProjection::project_global(const std::vector > spaces, + const std::vector*>& custom_projection_jacobians, + const std::vector*>& custom_projection_residuals, + const std::vector >& target_slns) { - int n = spaces.size(); - // Sanity checks. - if (n != target_slns.size()) throw Exceptions::LengthException(1, 2, n, target_slns.size()); - if (n != custom_projection_jacobians.size()) throw Exceptions::LengthException(1, 2, n, custom_projection_residuals.size()); - if (n != custom_projection_residuals.size()) throw Exceptions::LengthException(1, 2, n, custom_projection_residuals.size()); + Helpers::check_length(target_slns, spaces); + Helpers::check_length(custom_projection_jacobians, spaces); + Helpers::check_length(custom_projection_residuals, spaces); - for (int i = 0; i < n; i++) - { + int spaces_size = spaces.size(); + for (int i = 0; i < spaces_size; i++) project_global(spaces[i], custom_projection_jacobians[i], custom_projection_residuals[i], target_slns[i]); - } } template @@ -165,7 +151,7 @@ namespace Hermes else norm = proj_norm; // Define temporary projection weak form. - WeakForm* proj_wf = new WeakForm(1); + WeakFormSharedPtr proj_wf(new WeakForm(1)); proj_wf->set_verbose_output(false); proj_wf->set_ext(source_meshfn); // Add Jacobian. @@ -175,9 +161,6 @@ namespace Hermes // Call main function. project_internal(space, proj_wf, target_vec); - - // Clean up. - delete proj_wf; } template @@ -211,21 +194,18 @@ namespace Hermes } template - void OGProjection::project_global(Hermes::vector > spaces, Hermes::vector > source_slns, - Scalar* target_vec, Hermes::vector proj_norms) + void OGProjection::project_global(std::vector > spaces, std::vector > source_slns, + Scalar* target_vec, std::vector proj_norms) { - int n = spaces.size(); - // Sanity checks. - if (n != source_slns.size()) - throw Exceptions::LengthException(1, 2, n, source_slns.size()); + Helpers::check_length(source_slns, spaces); if (target_vec == nullptr) throw Exceptions::NullException(3); - if (!proj_norms.empty() && n != proj_norms.size()) - throw Exceptions::LengthException(1, 5, n, proj_norms.size()); + if (!proj_norms.empty()) + Helpers::check_length(proj_norms, spaces); - int start_index = 0; - for (int i = 0; i < n; i++) + int start_index = 0, spaces_size = spaces.size(); + for (int i = 0; i < spaces_size; i++) { if (proj_norms.empty()) project_global(spaces[i], source_slns[i], target_vec + start_index, HERMES_UNSET_NORM); @@ -236,8 +216,8 @@ namespace Hermes } template - void OGProjection::project_global(Hermes::vector > spaces, Hermes::vector > source_slns, - Hermes::Algebra::Vector* target_vec, Hermes::vector proj_norms) + void OGProjection::project_global(std::vector > spaces, std::vector > source_slns, + Hermes::Algebra::Vector* target_vec, std::vector proj_norms) { if (target_vec->get_size() != Space::get_num_dofs(spaces)) throw Exceptions::ValueException("target_vec->size", target_vec->get_size(), Space::get_num_dofs(spaces)); @@ -249,8 +229,8 @@ namespace Hermes } template - void OGProjection::project_global(Hermes::vector > spaces, Hermes::vector > source_slns, - Hermes::vector > target_slns, Hermes::vector proj_norms, bool delete_old_meshes) + void OGProjection::project_global(std::vector > spaces, std::vector > source_slns, + std::vector > target_slns, std::vector proj_norms, bool delete_old_meshes) { int n = spaces.size(); @@ -271,7 +251,7 @@ namespace Hermes } } - template class HERMES_API OGProjection; - template class HERMES_API OGProjection >; + template class HERMES_API OGProjection < double > ; + template class HERMES_API OGProjection < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/projections/ogprojection_nox.cpp b/hermes2d/src/projections/ogprojection_nox.cpp index 751b3e7e8a..33ac9f5fed 100644 --- a/hermes2d/src/projections/ogprojection_nox.cpp +++ b/hermes2d/src/projections/ogprojection_nox.cpp @@ -17,7 +17,7 @@ */ #include "projections/ogprojection_nox.h" #include "space.h" -#include "discrete_problem.h" +#include "discrete_problem/discrete_problem.h" #include "solver/nox_solver.h" #if(defined HAVE_NOX && defined HAVE_EPETRA && defined HAVE_TEUCHOS) @@ -25,18 +25,13 @@ namespace Hermes { namespace Hermes2D { - template - OGProjectionNOX::OGProjectionNOX() : ndof(0) - { - } - template void OGProjectionNOX::project_internal(SpaceSharedPtr space, WeakForm* wf, Scalar* target_vec, double newton_tol, int newton_max_iter) { - // Sanity check. - if(space == nullptr) - throw Hermes::Exceptions::Exception("this->space == nullptr in project_internal()."); + // Sanity check. + if (space == nullptr) + throw Hermes::Exceptions::Exception("this->space == nullptr in project_internal()."); // Get dimension of the space. int ndof = space->get_num_dofs(); @@ -45,25 +40,32 @@ namespace Hermes DiscreteProblemNOX dp(wf, space); // Initial coefficient vector for the Newton's method. - Scalar* coeff_vec = malloc_with_check(ndof, this); - memset(coeff_vec, 0, ndof*sizeof(Scalar)); + Scalar* coeff_vec = calloc_with_check(ndof); - const char* iterative_method = "GMRES"; // Name of the iterative method employed by AztecOO (ignored + // Name of the iterative method employed by AztecOO (ignored + const char* iterative_method = "GMRES"; // by the other solvers). // Possibilities: gmres, cg, cgs, tfqmr, bicgstab. - const char* preconditioner = "New Ifpack"; // Name of the preconditioner employed by AztecOO + // Name of the preconditioner employed by AztecOO + const char* preconditioner = "New Ifpack"; // Possibilities: None" - No preconditioning. // "AztecOO" - AztecOO internal preconditioner. // "new_ Ifpack" - Ifpack internal preconditioner. // "ML" - Multi level preconditione unsigned message_type = NOX::Utils::Error | NOX::Utils::Warning | NOX::Utils::OuterIteration | NOX::Utils::InnerIteration | NOX::Utils::Parameters | NOX::Utils::LinearSolverDetails; // NOX error messages, see NOX_Utils.h. - double ls_tolerance = 1e-5; // Tolerance for linear system. - unsigned flag_absresid = 0; // Flag for absolute value of the residuum. - double abs_resid = 1.0e-3; // Tolerance for absolute value of the residuum. - unsigned flag_relresid = 1; // Flag for relative value of the residuum. - double rel_resid = newton_tol; // Tolerance for relative value of the residuum. - int max_iters = newton_max_iter; // Max number of iterations. + // Tolerance for linear system. + double ls_tolerance = 1e-5; + // Flag for absolute value of the residuum. + unsigned flag_absresid = 0; + // Tolerance for absolute value of the residuum. + double abs_resid = 1.0e-3; + // Flag for relative value of the residuum. + unsigned flag_relresid = 1; + // Tolerance for relative value of the residuum. + double rel_resid = newton_tol; + // Max number of iterations. + int max_iters = newton_max_iter; // Initialize NOX. NewtonSolverNOX newton_nox(&dp); @@ -74,9 +76,9 @@ namespace Hermes newton_nox.set_ls_type(iterative_method); newton_nox.set_ls_tolerance(ls_tolerance); newton_nox.set_conv_iters(max_iters); - if(flag_absresid) + if (flag_absresid) newton_nox.set_conv_abs_resid(abs_resid); - if(flag_relresid) + if (flag_relresid) newton_nox.set_conv_rel_resid(rel_resid); newton_nox.set_precond(preconditioner); newton_nox.set_precond_reuse("Rebuild"); @@ -86,7 +88,7 @@ namespace Hermes free_with_check(coeff_vec); - if(target_vec != nullptr) + if (target_vec != nullptr) for (int i = 0; i < ndof; i++) target_vec[i] = newton_nox.get_sln_vector()[i]; } @@ -117,12 +119,12 @@ namespace Hermes double newton_tol, int newton_max_iter) { // Sanity checks. - if(target_vec == nullptr) throw Exceptions::NullException(3); + if (target_vec == nullptr) throw Exceptions::NullException(3); // If projection norm is not provided, set it // to match the type of the space. NormType norm = HERMES_UNSET_NORM; - if(proj_norm == HERMES_UNSET_NORM) + if (proj_norm == HERMES_UNSET_NORM) { SpaceType space_type = space->get_type(); switch (space_type) @@ -151,7 +153,7 @@ namespace Hermes // Clean up. delete proj_wf; } - + template void OGProjectionNOX::project_global(SpaceSharedPtr space, MeshFunctionSharedPtr source_meshfn, Scalar* target_vec, @@ -167,7 +169,7 @@ namespace Hermes NormType proj_norm, double newton_tol, int newton_max_iter) { - if(proj_norm == HERMES_UNSET_NORM) + if (proj_norm == HERMES_UNSET_NORM) { SpaceType space_type = space->get_type(); switch (space_type) @@ -183,7 +185,7 @@ namespace Hermes // Calculate the coefficient vector. int ndof = space->get_num_dofs(); - Scalar* target_vec = malloc_with_check(ndof, this); + Scalar* target_vec = malloc_with_check(ndof); project_global(space, source_sln, target_vec, proj_norm, newton_tol, newton_max_iter); // Translate coefficient vector into a Solution. @@ -194,22 +196,22 @@ namespace Hermes } template - void OGProjectionNOX::project_global(Hermes::vector > spaces, - Hermes::vector* > source_meshfns, - Scalar* target_vec, Hermes::vector proj_norms, + void OGProjectionNOX::project_global(std::vector > spaces, + std::vector* > source_meshfns, + Scalar* target_vec, std::vector proj_norms, double newton_tol, int newton_max_iter) { int n = spaces.size(); // Sanity checks. - if(n != source_meshfns.size()) throw Exceptions::LengthException(1, 2, n, source_meshfns.size()); - if(target_vec == nullptr) throw Exceptions::NullException(3); - if(!proj_norms.empty() && n != proj_norms.size()) throw Exceptions::LengthException(1, 5, n, proj_norms.size()); + if (n != source_meshfns.size()) throw Exceptions::LengthException(1, 2, n, source_meshfns.size()); + if (target_vec == nullptr) throw Exceptions::NullException(3); + if (!proj_norms.empty() && n != proj_norms.size()) throw Exceptions::LengthException(1, 5, n, proj_norms.size()); int start_index = 0; for (int i = 0; i < n; i++) { - if(proj_norms.empty()) + if (proj_norms.empty()) project_global(spaces[i], source_meshfns[i], target_vec + start_index, HERMES_UNSET_NORM, newton_tol, newton_max_iter); else project_global(spaces[i], source_meshfns[i], target_vec + start_index, proj_norms[i], newton_tol, newton_max_iter); @@ -219,21 +221,21 @@ namespace Hermes } template - void OGProjectionNOX::project_global(Hermes::vector > spaces, Hermes::vector > source_slns, - Scalar* target_vec, Hermes::vector proj_norms, + void OGProjectionNOX::project_global(std::vector > spaces, std::vector > source_slns, + Scalar* target_vec, std::vector proj_norms, double newton_tol, int newton_max_iter) { int n = spaces.size(); // Sanity checks. - if(n != source_slns.size()) throw Exceptions::LengthException(1, 2, n, source_slns.size()); - if(target_vec == nullptr) throw Exceptions::NullException(3); - if(!proj_norms.empty() && n != proj_norms.size()) throw Exceptions::LengthException(1, 5, n, proj_norms.size()); + if (n != source_slns.size()) throw Exceptions::LengthException(1, 2, n, source_slns.size()); + if (target_vec == nullptr) throw Exceptions::NullException(3); + if (!proj_norms.empty() && n != proj_norms.size()) throw Exceptions::LengthException(1, 5, n, proj_norms.size()); int start_index = 0; for (int i = 0; i < n; i++) { - if(proj_norms.empty()) + if (proj_norms.empty()) project_global(spaces[i], source_slns[i], target_vec + start_index, HERMES_UNSET_NORM, newton_tol, newton_max_iter); else project_global(spaces[i], source_slns[i], target_vec + start_index, proj_norms[i], newton_tol, newton_max_iter); @@ -242,22 +244,22 @@ namespace Hermes } template - void OGProjectionNOX::project_global(Hermes::vector > spaces, Hermes::vector > source_slns, - Hermes::vector > target_slns, - Hermes::vector proj_norms, bool delete_old_meshes, + void OGProjectionNOX::project_global(std::vector > spaces, std::vector > source_slns, + std::vector > target_slns, + std::vector proj_norms, bool delete_old_meshes, double newton_tol, int newton_max_iter) { int n = spaces.size(); // Sanity checks. - if(n != source_slns.size()) throw Exceptions::LengthException(1, 2, n, source_slns.size()); - if(n != target_slns.size()) throw Exceptions::LengthException(1, 2, n, target_slns.size()); - if(!proj_norms.empty() && n != proj_norms.size()) throw Exceptions::LengthException(1, 5, n, proj_norms.size()); + if (n != source_slns.size()) throw Exceptions::LengthException(1, 2, n, source_slns.size()); + if (n != target_slns.size()) throw Exceptions::LengthException(1, 2, n, target_slns.size()); + if (!proj_norms.empty() && n != proj_norms.size()) throw Exceptions::LengthException(1, 5, n, proj_norms.size()); int start_index = 0; for (int i = 0; i < n; i++) { - if(proj_norms.empty()) + if (proj_norms.empty()) project_global(spaces[i], source_slns[i], target_slns[i], HERMES_UNSET_NORM, newton_tol, newton_max_iter); else project_global(spaces[i], source_slns[i], target_slns[i], proj_norms[i], newton_tol, newton_max_iter); @@ -265,9 +267,10 @@ namespace Hermes } } - template class HERMES_API OGProjectionNOX; - // template class HERMES_API OGProjectionNOX >; //complex version of nox solver is not implemented + template class HERMES_API OGProjectionNOX < double > ; + //complex version of nox solver is not implemented + // template class HERMES_API OGProjectionNOX >; } } -#endif \ No newline at end of file +#endif diff --git a/hermes2d/src/quadrature/limit_order.cpp b/hermes2d/src/quadrature/limit_order.cpp index e7b86862ff..edd1f765b2 100644 --- a/hermes2d/src/quadrature/limit_order.cpp +++ b/hermes2d/src/quadrature/limit_order.cpp @@ -6,7 +6,7 @@ namespace Hermes { namespace Hermes2D { - static int default_order_table_tri[] = + static unsigned short default_order_table_tri[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, @@ -16,7 +16,7 @@ namespace Hermes }; #ifdef EXTREME_QUAD - static int default_order_table_quad[] = + static unsigned short default_order_table_quad[] = { 1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 23, 25, 25, 27, 27, 29, 29, 31, 31, @@ -27,7 +27,7 @@ namespace Hermes 97, 97, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }; #else - static int default_order_table_quad[] = + static unsigned short default_order_table_quad[] = { 1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, 13, 15, 15, 17, 17, 19, 19, 21, 21, 23, 23, 24, 24, 24, 24, 24, 24, 24, @@ -37,17 +37,18 @@ namespace Hermes }; #endif - static int* g_order_table_quad = default_order_table_quad; - static int* g_order_table_tri = default_order_table_tri; + static unsigned short* g_order_table_quad = default_order_table_quad; + static unsigned short* g_order_table_tri = default_order_table_tri; static bool warned_order = false; - HERMES_API int g_max_order; - HERMES_API int g_safe_max_order; + HERMES_API unsigned short g_max_order; + HERMES_API unsigned short g_safe_max_order; - HERMES_API void set_order_limit_table(int* tri_table, int* quad_table, int n) + HERMES_API void set_order_limit_table(unsigned short* tri_table, unsigned short* quad_table, unsigned short n) { - if(n < 24) throw Hermes::Exceptions::Exception("Hermes::Order limit tables must have at least 24 entries."); - g_order_table_tri = tri_table; + if (n < 24) + throw Hermes::Exceptions::Exception("Hermes::Order limit tables must have at least 24 entries."); + g_order_table_tri = tri_table; g_order_table_quad = quad_table; } @@ -57,11 +58,34 @@ namespace Hermes g_safe_max_order = g_quad_2d_std.get_safe_max_order(mode); } + HERMES_API void reset_warn_order() + { + warned_order = false; + } + + HERMES_API void warn_order() + { + if (HermesCommonApi.get_integral_param_value(Hermes::showInternalWarnings)) + if (!warned_order) + { +#pragma omp critical (warn_oder) + if (!warned_order) + { + /// \todo Fix this, so that it complies with the rest of the code. + Hermes::Mixins::Loggable::Static::warn("Warning: Not enough integration rules for exact integration."); + warned_order = true; + } + } + } + HERMES_API void limit_order(int& o, ElementMode2D mode) { - if(o > g_quad_2d_std.get_safe_max_order(mode)) + if (o >= g_quad_2d_std.get_safe_max_order(mode)) + { o = g_quad_2d_std.get_safe_max_order(mode); - if(mode == HERMES_MODE_TRIANGLE) + warn_order(); + } + if (mode == HERMES_MODE_TRIANGLE) o = g_order_table_tri[o]; else o = g_order_table_quad[o]; @@ -69,9 +93,9 @@ namespace Hermes HERMES_API void limit_order_nowarn(int& o, ElementMode2D mode) { - if(o > g_quad_2d_std.get_safe_max_order(mode)) + if (o > g_quad_2d_std.get_safe_max_order(mode)) o = g_quad_2d_std.get_safe_max_order(mode); - if(mode == HERMES_MODE_TRIANGLE) + if (mode == HERMES_MODE_TRIANGLE) o = g_order_table_tri[o]; else o = g_order_table_quad[o]; diff --git a/hermes2d/src/quadrature/quad_std.cpp b/hermes2d/src/quadrature/quad_std.cpp index 2e85ab5701..662dce1125 100644 --- a/hermes2d/src/quadrature/quad_std.cpp +++ b/hermes2d/src/quadrature/quad_std.cpp @@ -1549,7 +1549,7 @@ namespace Hermes std_pts_98_99_1d, std_pts_98_99_1d }; - static int std_np_1d[] = + static unsigned char std_np_1d[] = { sizeof(std_pts_0_1_1d) / sizeof(double2), sizeof(std_pts_0_1_1d) / sizeof(double2), @@ -2380,7 +2380,7 @@ namespace Hermes { -0.978904561411718, 0.859512343113706, 0.007147818771900 } }; - static int std_np_2d_tri[g_max_tri + 1 + 3 * g_max_tri + 3] = + static unsigned char std_np_2d_tri[g_max_tri + 1 + 3 * g_max_tri + 3] = { sizeof(std_pts_0_2d_tri) / sizeof(double3), sizeof(std_pts_1_2d_tri) / sizeof(double3), @@ -2422,7 +2422,7 @@ namespace Hermes /////////////////////////////////////////////////////////////////////////////////////////////////// - static double3* make_quad_table(int order, int& np) + static double3* make_quad_table(int order, unsigned char& np) { // points on a quad are calculated as a simple cartesian // product of 1D quadrature points... @@ -2444,13 +2444,13 @@ namespace Hermes return result; } - static double3* make_edge_table(double2& v1, double2& v2, int& np, int order) + static double3* make_edge_table(double2& v1, double2& v2, unsigned char& np, unsigned short order) { np = std_np_1d[order]; double3* result = malloc_with_check(np); double2* table = std_tables_1d[order]; - for (int i = 0; i < np; i++) + for (unsigned char i = 0; i < np; i++) { double s = (table[i][0] + 1.0) * 0.5; double t = 1.0 - s; @@ -2463,7 +2463,7 @@ namespace Hermes } static double3* std_tables_2d_quad[g_max_quad + 1 + 4 * g_max_quad + 4]; - static int std_np_2d_quad[g_max_quad + 1 + 4 * g_max_quad + 4]; + static unsigned char std_np_2d_quad[g_max_quad + 1 + 4 * g_max_quad + 4]; static double3** std_tables_2d[2] = { @@ -2471,7 +2471,7 @@ namespace Hermes std_tables_2d_quad }; - static int* std_np_2d[2] = + static unsigned char* std_np_2d[2] = { std_np_2d_tri, std_np_2d_quad @@ -2502,7 +2502,7 @@ namespace Hermes num_tables[1] = max_order[1] + 1 + 4 * max_order[1] + 4; // create quad tables and edge tables - int i, j, k, l; + unsigned short i, j, k, l; for (i = 0; i <= max_order[0]; i++) { @@ -2531,7 +2531,7 @@ namespace Hermes Quad2DStd::~Quad2DStd() { - int i, j, k, l; + unsigned short i, j, k, l; for (i = 0; i <= max_order[0]; i++) { for (j = 0; j < 3; j++) @@ -2554,12 +2554,8 @@ namespace Hermes } //// global standard 1d and 2d quadrature ////////////////////////////////////////////////////////// - // ... for use in any module - HERMES_API Quad1DStd g_quad_1d_std; - HERMES_API Quad2DStd g_quad_2d_std; - Quad2DLin g_quad_lin; Quad2DLin::Quad2DLin() @@ -2626,7 +2622,7 @@ namespace Hermes { -0.5, 0.5, 0.0 } // 20 }; - int quad_indices[9][5] = + unsigned short quad_indices[9][5] = { { 0, 1, 2, 3, 4 }, { 5, 6, 7, 8, 9 }, { 10, 11, 12, 6, 13 }, @@ -2635,14 +2631,14 @@ namespace Hermes { 5, 4, 18, 3, 7 }, { 10, 1, 15, 4, 12 } }; - int tri_indices[5][3] = + unsigned short tri_indices[5][3] = { { 0, 1, 2 }, { 3, 4, 5 }, { 6, 7, 8 }, { 9, 10, 11 }, { 9, 4, 8 } }; - int lin_np_tri[2] = { 3, 12 }; - int lin_np_quad[2] = { 4, 21 }; - int* lin_np[2] = { lin_np_tri, lin_np_quad }; + unsigned char lin_np_tri[2] = { 3, 12 }; + unsigned char lin_np_quad[2] = { 4, 21 }; + unsigned char* lin_np[2] = { lin_np_tri, lin_np_quad }; double3* lin_tables_tri[2] = { lin_pts_0_tri, lin_pts_1_tri }; double3* lin_tables_quad[2] = { lin_pts_0_quad, lin_pts_1_quad }; diff --git a/hermes2d/src/refinement_selectors/candidates.cpp b/hermes2d/src/refinement_selectors/candidates.cpp index 3eb31d0aad..698879fc7b 100644 --- a/hermes2d/src/refinement_selectors/candidates.cpp +++ b/hermes2d/src/refinement_selectors/candidates.cpp @@ -4,46 +4,11 @@ namespace Hermes { namespace Hermes2D { - HERMES_API bool is_refin_aniso(const int refin_type) - { - if(refin_type == H2D_REFINEMENT_ANISO_H || refin_type == H2D_REFINEMENT_ANISO_V) - return true; - else - return false; - } - - HERMES_API int get_refin_sons(const int refin_type) - { - switch(refin_type) - { - case H2D_REFINEMENT_P: return 1; break; - case H2D_REFINEMENT_H: return 4; break; - case H2D_REFINEMENT_ANISO_H: - case H2D_REFINEMENT_ANISO_V: return 2; break; - default: throw Hermes::Exceptions::Exception("Invalid refinement type %d", (int)refin_type); return -1; - } - } - - HERMES_API const std::string get_refin_str(const int refin_type) - { - switch(refin_type) - { - case H2D_REFINEMENT_P: return "P"; break; - case H2D_REFINEMENT_H: return "H"; break; - case H2D_REFINEMENT_ANISO_H: return "AnisoH"; break; - case H2D_REFINEMENT_ANISO_V: return "AnisoV"; break; - default: - std::stringstream str; - str << "Unknown(" << refin_type << ")"; - return str.str(); - } - } - namespace RefinementSelectors { HERMES_API const char* get_cand_list_str(const CandList cand_list) { - switch(cand_list) + switch (cand_list) { case H2D_NONE: return "Custom"; case H2D_P_ISO: return "P_ISO"; @@ -62,7 +27,7 @@ namespace Hermes HERMES_API bool is_hp(const CandList cand_list) { - switch(cand_list) + switch (cand_list) { case H2D_P_ISO: case H2D_P_ANISO: @@ -77,9 +42,9 @@ namespace Hermes } } - HERMES_API bool is_p(const CandList cand_list) + HERMES_API bool is_p(const CandList cand_list) { - switch(cand_list) + switch (cand_list) { case H2D_H_ISO: case H2D_H_ANISO: return false; break; @@ -96,7 +61,7 @@ namespace Hermes HERMES_API bool is_p_aniso(const CandList cand_list) { - switch(cand_list) + switch (cand_list) { case H2D_NONE: return false; case H2D_P_ISO: return false; @@ -111,32 +76,32 @@ namespace Hermes } } - Cand::Cand(const int split, const int order_elems[H2D_MAX_ELEMENT_SONS]) + Cand::Cand(const RefinementType split, const unsigned short order_elems[H2D_MAX_ELEMENT_SONS]) : dofs(-1), split(split), score(0) { - p[0] = order_elems[0]; - p[1] = order_elems[1]; - p[2] = order_elems[2]; - p[3] = order_elems[3]; + p[0] = order_elems[0]; + p[1] = order_elems[1]; + p[2] = order_elems[2]; + p[3] = order_elems[3]; }; - Cand::Cand(const int split, const int order_elem0, const int order_elem1, const int order_elem2, const int order_elem3) + Cand::Cand(const RefinementType split, const unsigned short order_elem0, const unsigned short order_elem1, const unsigned short order_elem2, const unsigned short order_elem3) : dofs(-1), split(split), score(0) { - p[0] = order_elem0; - p[1] = order_elem1; - p[2] = order_elem2; - p[3] = order_elem3; + p[0] = order_elem0; + p[1] = order_elem1; + p[2] = order_elem2; + p[3] = order_elem3; }; - int Cand::get_num_elems() const { + unsigned char Cand::get_num_elems() const { switch (split) { case H2D_REFINEMENT_H: return 4; case H2D_REFINEMENT_P: return 1; - case H2D_REFINEMENT_ANISO_H: - case H2D_REFINEMENT_ANISO_V: + case H2D_REFINEMENT_H_ANISO_H: + case H2D_REFINEMENT_H_ANISO_V: return 2; default: throw Hermes::Exceptions::Exception("Invalid refinement type %d.", split); - return -1; + return 0; break; } } diff --git a/hermes2d/src/refinement_selectors/element_to_refine.cpp b/hermes2d/src/refinement_selectors/element_to_refine.cpp index d33c07afb4..8b025ef214 100644 --- a/hermes2d/src/refinement_selectors/element_to_refine.cpp +++ b/hermes2d/src/refinement_selectors/element_to_refine.cpp @@ -1,39 +1,65 @@ #include "element_to_refine.h" -#include "refinement_selectors/candidates.h" namespace Hermes { namespace Hermes2D { - ElementToRefine::ElementToRefine() : id(-1), comp(-1) + bool HERMES_API is_refin_aniso(const RefinementType refin_type) { - }; + if (refin_type == H2D_REFINEMENT_H_ANISO_H || refin_type == H2D_REFINEMENT_H_ANISO_V) + return true; + else + return false; + } + + int HERMES_API get_refin_sons(const RefinementType refin_type) + { + switch (refin_type) + { + case H2D_REFINEMENT_P: return 1; break; + case H2D_REFINEMENT_H: return 4; break; + case H2D_REFINEMENT_H_ANISO_H: + case H2D_REFINEMENT_H_ANISO_V: return 2; break; + default: throw Hermes::Exceptions::Exception("Invalid refinement type %d", (int)refin_type); return -1; + } + } - ElementToRefine::ElementToRefine(int id, int comp) : id(id), comp(comp), split(H2D_REFINEMENT_H) + const HERMES_API std::string get_refin_str(const RefinementType refin_type) + { + switch (refin_type) + { + case H2D_REFINEMENT_P: return "P"; break; + case H2D_REFINEMENT_H: return "H"; break; + case H2D_REFINEMENT_H_ANISO_H: return "AnisoH"; break; + case H2D_REFINEMENT_H_ANISO_V: return "AnisoV"; break; + default: + std::stringstream str; + str << "Unknown(" << refin_type << ")"; + return str.str(); + } + } + + ElementToRefine::ElementToRefine() : valid(false) { }; - ElementToRefine::ElementToRefine(const ElementToRefine &orig) : id(orig.id), comp(orig.comp), split(orig.split) + ElementToRefine::ElementToRefine(int id, unsigned short comp, bool space_only) : id(id), comp(comp), split(H2D_REFINEMENT_H), valid(true), space_only(space_only) { - copy_orders(this->refinement_polynomial_order, orig.refinement_polynomial_order); - for(int i = 0; i < 4; i++) - copy_orders(this->best_refinement_polynomial_order_type[i], orig.best_refinement_polynomial_order_type[i]); - copy_errors(errors, orig.errors); }; - int ElementToRefine::get_num_sons() const + unsigned short ElementToRefine::get_num_sons() const { return get_refin_sons(split); }; - void ElementToRefine::copy_orders(int* dest, const int* src) + void ElementToRefine::copy_orders(unsigned short* dest, const unsigned short* src) { - memcpy(dest, src, sizeof(int) * H2D_MAX_ELEMENT_SONS); + memcpy(dest, src, sizeof(unsigned short)* H2D_MAX_ELEMENT_SONS); } void ElementToRefine::copy_errors(double* dest, const double* src) { - memcpy(dest, src, sizeof(double) * H2D_MAX_ELEMENT_SONS); + memcpy(dest, src, sizeof(double)* H2D_MAX_ELEMENT_SONS); } ElementToRefine& ElementToRefine::operator=(const ElementToRefine& orig) @@ -41,8 +67,9 @@ namespace Hermes id = orig.id; comp = orig.comp; split = orig.split; + valid = orig.valid; copy_orders(this->refinement_polynomial_order, orig.refinement_polynomial_order); - for(int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) copy_orders(this->best_refinement_polynomial_order_type[i], orig.best_refinement_polynomial_order_type[i]); return *this; } diff --git a/hermes2d/src/refinement_selectors/h1_proj_based_selector.cpp b/hermes2d/src/refinement_selectors/h1_proj_based_selector.cpp index 192131498b..f23e51ddca 100644 --- a/hermes2d/src/refinement_selectors/h1_proj_based_selector.cpp +++ b/hermes2d/src/refinement_selectors/h1_proj_based_selector.cpp @@ -11,7 +11,7 @@ namespace Hermes H1ProjBasedSelector::H1ProjBasedSelector(CandList cand_list, int max_order, H1Shapeset* user_shapeset) : ProjBasedSelector(cand_list, max_order, user_shapeset == nullptr ? new H1Shapeset() : user_shapeset, Range(1, 1), Range(2, H2DRS_MAX_ORDER)), user_shapeset(user_shapeset == nullptr ? false : true) { - if(user_shapeset != nullptr) + if (user_shapeset != nullptr) { this->warn("Warn: The user shapeset provided for the selector has to have a correct copy constructor implemented."); this->warn("Warning: The functionality for cloning user shapeset is to be implemented yet."); @@ -21,15 +21,15 @@ namespace Hermes template H1ProjBasedSelector::~H1ProjBasedSelector() { - if(!this->user_shapeset) + if (!this->user_shapeset) delete this->shapeset; } template void H1ProjBasedSelector::get_current_order_range(Element* element, int& min_order_, int& max_order_) { - int max_element_order = (20 - element->iro_cache)/2 - 1; - if(this->max_order == H2DRS_DEFAULT_ORDER) + int max_element_order = (20 - element->iro_cache) / 2 - 1; + if (this->max_order == H2DRS_DEFAULT_ORDER) max_order_ = max_element_order; else max_order_ = std::min(this->max_order, max_element_order); @@ -37,7 +37,7 @@ namespace Hermes } template - void H1ProjBasedSelector::precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) + void H1ProjBasedSelector::precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) { //for all transformations bool done = false; @@ -46,14 +46,14 @@ namespace Hermes { //prepare data for processing const Trf& trf = trfs[inx_trf]; - Hermes::vector::TrfShapeExp>& trf_svals = svals[inx_trf]; + std::vector::TrfShapeExp>& trf_svals = svals[inx_trf]; //allocate trf_svals.resize(max_shape_inx + 1); //for all shapes const int num_shapes = (int)shapes.size(); - for(int i = 0; i < num_shapes; i++) + for (int i = 0; i < num_shapes; i++) { int inx_shape = shapes[i].inx; typename ProjBasedSelector::TrfShapeExp& shape_exp = trf_svals[inx_shape]; @@ -62,7 +62,7 @@ namespace Hermes shape_exp.allocate(H2D_H1FE_NUM, num_gip_points); //for all GIP points - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { //transform coordinates double ref_x = gip_points[k][H2D_GIP2D_X] * trf.m[0] + trf.t[0]; @@ -76,39 +76,40 @@ namespace Hermes } //move to the next transformation - if(inx_trf == H2D_TRF_IDENTITY) + if (inx_trf == H2D_TRF_IDENTITY) done = true; else { inx_trf++; - if(inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation + if (inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation inx_trf = H2D_TRF_IDENTITY; } } - if(!done) - throw Exceptions::Exception("All transformation processed but identity transformation not found."); //identity transformation has to be the last transformation + if (!done) + //identity transformation has to be the last transformation + throw Exceptions::Exception("All transformation processed but identity transformation not found."); } template - void H1ProjBasedSelector::precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) + void H1ProjBasedSelector::precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) { //calculate values precalc_shapes(gip_points, num_gip_points, trfs, num_noni_trfs, shapes, max_shape_inx, svals, mode); //calculate orthonormal basis const int num_shapes = (int)shapes.size(); - for(int i = 0; i < num_shapes; i++) + for (int i = 0; i < num_shapes; i++) { const int inx_shape_i = shapes[i].inx; //orthogonalize - for(int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { const int inx_shape_j = shapes[j].inx; //calculate product of non-transformed functions double product = 0.0; - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { double sum = 0.0; sum += svals[H2D_TRF_IDENTITY][inx_shape_i][H2D_H1FE_VALUE][k] * svals[H2D_TRF_IDENTITY][inx_shape_j][H2D_H1FE_VALUE][k]; @@ -123,7 +124,7 @@ namespace Hermes while (!done && inx_trf < H2D_TRF_NUM) { //for all integration points - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { svals[inx_trf][inx_shape_i][H2D_H1FE_VALUE][k] -= product * svals[inx_trf][inx_shape_j][H2D_H1FE_VALUE][k]; svals[inx_trf][inx_shape_i][H2D_H1FE_DX][k] -= product * svals[inx_trf][inx_shape_j][H2D_H1FE_DX][k]; @@ -131,23 +132,24 @@ namespace Hermes } //move to the next transformation - if(inx_trf == H2D_TRF_IDENTITY) + if (inx_trf == H2D_TRF_IDENTITY) done = true; else { inx_trf++; - if(inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation + if (inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation inx_trf = H2D_TRF_IDENTITY; } } - if(!done) - throw Exceptions::Exception("All transformation processed but identity transformation not found."); //identity transformation has to be the last transformation + if (!done) + //identity transformation has to be the last transformation + throw Exceptions::Exception("All transformation processed but identity transformation not found."); } //normalize //calculate norm double norm_squared = 0.0; - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { double sum = 0.0; sum += sqr(svals[H2D_TRF_IDENTITY][inx_shape_i][H2D_H1FE_VALUE][k]); @@ -156,7 +158,7 @@ namespace Hermes norm_squared += gip_points[k][H2D_GIP2D_W] * sum; } double norm = sqrt(norm_squared); - if(!finite(1/norm)) + if (!finite(1 / norm)) throw Exceptions::Exception("Norm (%g) is almost zero.", norm); //for all transformations: normalize @@ -165,7 +167,7 @@ namespace Hermes while (!done && inx_trf < H2D_TRF_NUM) { //for all integration points - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { svals[inx_trf][inx_shape_i][H2D_H1FE_VALUE][k] /= norm; svals[inx_trf][inx_shape_i][H2D_H1FE_DX][k] /= norm; @@ -173,17 +175,18 @@ namespace Hermes } //move to the next transformation - if(inx_trf == H2D_TRF_IDENTITY) + if (inx_trf == H2D_TRF_IDENTITY) done = true; else { inx_trf++; - if(inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation + if (inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation inx_trf = H2D_TRF_IDENTITY; } } - if(!done) - throw Exceptions::Exception("All transformation processed but identity transformation not found."); //identity transformation has to be the last transformation + if (!done) + //identity transformation has to be the last transformation + throw Exceptions::Exception("All transformation processed but identity transformation not found."); } } @@ -218,16 +221,16 @@ namespace Hermes //calculate products int inx_row = 0; - for(int i = 0; i < num_shapes; i++, inx_row += num_shapes) + for (int i = 0; i < num_shapes; i++, inx_row += num_shapes) { double* matrix_row = matrix[i]; int shape0_inx = shape_inx[i]; - for(int k = 0; k < num_shapes; k++) + for (int k = 0; k < num_shapes; k++) { int shape1_inx = shape_inx[k]; double value = 0.0; - for(int j = 0; j < num_gip_points; j++) + for (int j = 0; j < num_gip_points; j++) { double gip_x = gip_points[j][H2D_GIP2D_X], gip_y = gip_points[j][H2D_GIP2D_Y]; double value0 = this->shapeset->get_value(H2D_FEI_VALUE, shape0_inx, gip_x, gip_y, 0, mode); @@ -250,16 +253,16 @@ namespace Hermes Scalar H1ProjBasedSelector::evaluate_rhs_subdomain(Element* sub_elem, const typename ProjBasedSelector::ElemGIP& sub_gip, int son, const typename ProjBasedSelector::ElemSubTrf& sub_trf, const typename ProjBasedSelector::ElemSubShapeFunc& sub_shape, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]) { Scalar total_value = 0; - for(int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) + for (int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) { double3 &gip_pt = sub_gip.gip_points[gip_inx]; //get value of a shape function - double shape_value[H2D_H1FE_NUM] = {0, 0, 0}; + double shape_value[H2D_H1FE_NUM] = { 0, 0, 0 }; shape_value[H2D_H1FE_VALUE] = sub_shape.svals[H2D_H1FE_VALUE][gip_inx]; shape_value[H2D_H1FE_DX] = sub_shape.svals[H2D_H1FE_DX][gip_inx]; shape_value[H2D_H1FE_DY] = sub_shape.svals[H2D_H1FE_DY][gip_inx]; - + //get value of ref. solution Scalar ref_value[H2D_H1FE_NUM]; ref_value[H2D_H1FE_VALUE] = rval[son][H2D_H1FE_VALUE][gip_inx]; @@ -280,20 +283,20 @@ namespace Hermes double H1ProjBasedSelector::evaluate_error_squared_subdomain(Element* sub_elem, const typename ProjBasedSelector::ElemGIP& sub_gip, int son, const typename ProjBasedSelector::ElemSubTrf& sub_trf, const typename ProjBasedSelector::ElemProj& elem_proj, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]) { double total_error_squared = 0; - for(int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) + for (int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) { double3 &gip_pt = sub_gip.gip_points[gip_inx]; //calculate value of projected solution - Scalar proj_value[H2D_H1FE_NUM] = {0, 0, 0}; - for(int i = 0; i < elem_proj.num_shapes; i++) + Scalar proj_value[H2D_H1FE_NUM] = { 0, 0, 0 }; + for (int i = 0; i < elem_proj.num_shapes; i++) { int shape_inx = elem_proj.shape_inxs[i]; proj_value[H2D_H1FE_VALUE] += elem_proj.shape_coeffs[i] * elem_proj.svals[shape_inx][H2D_H1FE_VALUE][gip_inx]; proj_value[H2D_H1FE_DX] += elem_proj.shape_coeffs[i] * elem_proj.svals[shape_inx][H2D_H1FE_DX][gip_inx]; proj_value[H2D_H1FE_DY] += elem_proj.shape_coeffs[i] * elem_proj.svals[shape_inx][H2D_H1FE_DY][gip_inx]; } - + { //get value of ref. solution Scalar ref_value[3]; @@ -312,8 +315,8 @@ namespace Hermes return total_error_squared; } - template class HERMES_API H1ProjBasedSelector; - template class HERMES_API H1ProjBasedSelector >; + template class HERMES_API H1ProjBasedSelector < double > ; + template class HERMES_API H1ProjBasedSelector < std::complex > ; } } } \ No newline at end of file diff --git a/hermes2d/src/refinement_selectors/hcurl_proj_based_selector.cpp b/hermes2d/src/refinement_selectors/hcurl_proj_based_selector.cpp index e866b078d4..23c243fc3a 100644 --- a/hermes2d/src/refinement_selectors/hcurl_proj_based_selector.cpp +++ b/hermes2d/src/refinement_selectors/hcurl_proj_based_selector.cpp @@ -14,7 +14,7 @@ namespace Hermes HcurlProjBasedSelector::HcurlProjBasedSelector(CandList cand_list, int max_order, HcurlShapeset* user_shapeset) : ProjBasedSelector(cand_list, max_order, user_shapeset == nullptr ? new HcurlShapeset() : user_shapeset, Range(), Range(0, H2DRS_MAX_HCURL_ORDER)) { - if(user_shapeset != nullptr) + if (user_shapeset != nullptr) { this->warn("Warning: The user shapeset provided for the selector has to have a correct copy constructor implemented."); this->warn("Warning: The functionality for cloning user shapeset is to be implemented yet."); @@ -29,8 +29,8 @@ namespace Hermes template void HcurlProjBasedSelector::get_current_order_range(Element* element, int& min_order_, int& max_order_) { - int max_element_order = (20 - element->iro_cache)/2 - 1; - if(this->max_order == H2DRS_DEFAULT_ORDER) + int max_element_order = (20 - element->iro_cache) / 2 - 1; + if (this->max_order == H2DRS_DEFAULT_ORDER) max_order_ = max_element_order; else max_order_ = std::min(this->max_order, max_element_order); @@ -38,7 +38,7 @@ namespace Hermes } template - void HcurlProjBasedSelector::precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) + void HcurlProjBasedSelector::precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) { //for all transformations bool done = false; @@ -47,14 +47,14 @@ namespace Hermes { //prepare data for processing const Trf& trf = trfs[inx_trf]; - Hermes::vector::TrfShapeExp>& trf_svals = svals[inx_trf]; + std::vector::TrfShapeExp>& trf_svals = svals[inx_trf]; //allocate trf_svals.resize(max_shape_inx + 1); //for all shapes const int num_shapes = (int)shapes.size(); - for(int i = 0; i < num_shapes; i++) + for (int i = 0; i < num_shapes; i++) { int inx_shape = shapes[i].inx; typename ProjBasedSelector::TrfShapeExp& shape_exp = trf_svals[inx_shape]; @@ -63,7 +63,7 @@ namespace Hermes shape_exp.allocate(H2D_HCFE_NUM, num_gip_points); //for all GIP points - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { //transform coordinates double ref_x = gip_points[k][H2D_GIP2D_X] * trf.m[0] + trf.t[0]; @@ -77,39 +77,40 @@ namespace Hermes } //move to the next transformation - if(inx_trf == H2D_TRF_IDENTITY) + if (inx_trf == H2D_TRF_IDENTITY) done = true; else { inx_trf++; - if(inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation + if (inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation inx_trf = H2D_TRF_IDENTITY; } } - if(!done) - throw Exceptions::Exception("All transformation processed but identity transformation not found."); //identity transformation has to be the last transformation + if (!done) + //identity transformation has to be the last transformation + throw Exceptions::Exception("All transformation processed but identity transformation not found."); } template - void HcurlProjBasedSelector::precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) + void HcurlProjBasedSelector::precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) { //calculate values precalc_shapes(gip_points, num_gip_points, trfs, num_noni_trfs, shapes, max_shape_inx, svals, mode); //calculate orthonormal basis const int num_shapes = (int)shapes.size(); - for(int i = 0; i < num_shapes; i++) + for (int i = 0; i < num_shapes; i++) { const int inx_shape_i = shapes[i].inx; //orthogonalize - for(int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { const int inx_shape_j = shapes[j].inx; //calculate product of non-transformed functions double product = 0.0; - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { double sum = 0.0; sum += svals[H2D_TRF_IDENTITY][inx_shape_i][H2D_HCFE_VALUE0][k] * svals[H2D_TRF_IDENTITY][inx_shape_j][H2D_HCFE_VALUE0][k]; @@ -124,7 +125,7 @@ namespace Hermes while (!done && inx_trf < H2D_TRF_NUM) { //for all integration points - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { svals[inx_trf][inx_shape_i][H2D_HCFE_VALUE0][k] -= product * svals[inx_trf][inx_shape_j][H2D_HCFE_VALUE0][k]; svals[inx_trf][inx_shape_i][H2D_HCFE_VALUE1][k] -= product * svals[inx_trf][inx_shape_j][H2D_HCFE_VALUE1][k]; @@ -132,23 +133,24 @@ namespace Hermes } //move to the next transformation - if(inx_trf == H2D_TRF_IDENTITY) + if (inx_trf == H2D_TRF_IDENTITY) done = true; else { inx_trf++; - if(inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation + if (inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation inx_trf = H2D_TRF_IDENTITY; } } - if(!done) - throw Exceptions::Exception("All transformation processed but identity transformation not found."); //identity transformation has to be the last transformation + if (!done) + //identity transformation has to be the last transformation + throw Exceptions::Exception("All transformation processed but identity transformation not found."); } //normalize //calculate norm double norm_squared = 0.0; - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { double sum = 0.0; sum += sqr(svals[H2D_TRF_IDENTITY][inx_shape_i][H2D_HCFE_VALUE0][k]); @@ -157,7 +159,7 @@ namespace Hermes norm_squared += gip_points[k][H2D_GIP2D_W] * sum; } double norm = sqrt(norm_squared); - if(!finite(1/norm)) + if (!finite(1 / norm)) throw Exceptions::Exception("Norm (%g) is almost zero.", norm); //for all transformations: normalize @@ -166,7 +168,7 @@ namespace Hermes while (!done && inx_trf < H2D_TRF_NUM) { //for all integration points - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { svals[inx_trf][inx_shape_i][H2D_HCFE_VALUE0][k] /= norm; svals[inx_trf][inx_shape_i][H2D_HCFE_VALUE1][k] /= norm; @@ -174,17 +176,18 @@ namespace Hermes } //move to the next transformation - if(inx_trf == H2D_TRF_IDENTITY) + if (inx_trf == H2D_TRF_IDENTITY) done = true; else { inx_trf++; - if(inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation + if (inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation inx_trf = H2D_TRF_IDENTITY; } } - if(!done) - throw Exceptions::Exception("All transformation processed but identity transformation not found."); //identity transformation has to be the last transformation + if (!done) + //identity transformation has to be the last transformation + throw Exceptions::Exception("All transformation processed but identity transformation not found."); } } @@ -224,16 +227,16 @@ namespace Hermes //calculate products int inx_row = 0; - for(int i = 0; i < num_shapes; i++, inx_row += num_shapes) + for (int i = 0; i < num_shapes; i++, inx_row += num_shapes) { double* matrix_row = matrix[i]; int shape0_inx = shape_inx[i]; - for(int k = 0; k < num_shapes; k++) + for (int k = 0; k < num_shapes; k++) { int shape1_inx = shape_inx[k]; double value = 0.0; - for(int j = 0; j < num_gip_points; j++) + for (int j = 0; j < num_gip_points; j++) { double gip_x = gip_points[j][H2D_GIP2D_X], gip_y = gip_points[j][H2D_GIP2D_Y]; double value0[2] = { this->shapeset->get_value(H2D_FEI_VALUE, shape0_inx, gip_x, gip_y, 0, mode), this->shapeset->get_value(H2D_FEI_VALUE, shape0_inx, gip_x, gip_y, 1, mode) }; @@ -245,7 +248,7 @@ namespace Hermes double curl0 = d1dx0 - d0dy0; double curl1 = d1dx1 - d0dy1; - value += gip_points[j][H2D_GIP2D_W] * (value0[0]*value1[0] + value0[1]*value1[1] + curl0*curl1); + value += gip_points[j][H2D_GIP2D_W] * (value0[0] * value1[0] + value0[1] * value1[1] + curl0*curl1); } matrix_row[k] = value; @@ -260,7 +263,7 @@ namespace Hermes { double coef_curl = std::abs(sub_trf.coef_mx * sub_trf.coef_my); Scalar total_value = 0; - for(int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) + for (int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) { //get location and transform it double3 &gip_pt = sub_gip.gip_points[gip_inx]; @@ -273,7 +276,8 @@ namespace Hermes //get value of ref. solution Scalar ref_value0 = sub_trf.coef_mx * rval[son][H2D_HCFE_VALUE0][gip_inx]; Scalar ref_value1 = sub_trf.coef_my * rval[son][H2D_HCFE_VALUE1][gip_inx]; - Scalar ref_curl = coef_curl * rval[son][H2D_HCFE_CURL][gip_inx]; //coef_curl * curl + //coef_curl * curl + Scalar ref_curl = coef_curl * rval[son][H2D_HCFE_CURL][gip_inx]; //evaluate a right-hand value Scalar value = (shape_value0 * ref_value0) @@ -290,14 +294,14 @@ namespace Hermes { double total_error_squared = 0; double coef_curl = std::abs(sub_trf.coef_mx * sub_trf.coef_my); - for(int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) + for (int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) { //get location and transform it double3 &gip_pt = sub_gip.gip_points[gip_inx]; //calculate value of projected solution Scalar proj_value0 = 0, proj_value1 = 0, proj_curl = 0; - for(int i = 0; i < elem_proj.num_shapes; i++) + for (int i = 0; i < elem_proj.num_shapes; i++) { int shape_inx = elem_proj.shape_inxs[i]; proj_value0 += elem_proj.shape_coeffs[i] * elem_proj.svals[shape_inx][H2D_HCFE_VALUE0][gip_inx]; @@ -309,7 +313,8 @@ namespace Hermes //get value of ref. solution Scalar ref_value0 = sub_trf.coef_mx * rval[son][H2D_HCFE_VALUE0][gip_inx]; Scalar ref_value1 = sub_trf.coef_my * rval[son][H2D_HCFE_VALUE1][gip_inx]; - Scalar ref_curl = coef_curl * rval[son][H2D_HCFE_CURL][gip_inx]; //coef_curl * curl + //coef_curl * curl + Scalar ref_curl = coef_curl * rval[son][H2D_HCFE_CURL][gip_inx]; //evaluate error double error_squared = sqr(proj_value0 - ref_value0) @@ -321,8 +326,8 @@ namespace Hermes } return total_error_squared; } - template class HERMES_API HcurlProjBasedSelector; - template class HERMES_API HcurlProjBasedSelector >; + template class HERMES_API HcurlProjBasedSelector < double > ; + template class HERMES_API HcurlProjBasedSelector < std::complex > ; } } } \ No newline at end of file diff --git a/hermes2d/src/refinement_selectors/l2_proj_based_selector.cpp b/hermes2d/src/refinement_selectors/l2_proj_based_selector.cpp index 7f0a3df02f..15411aad7f 100644 --- a/hermes2d/src/refinement_selectors/l2_proj_based_selector.cpp +++ b/hermes2d/src/refinement_selectors/l2_proj_based_selector.cpp @@ -11,7 +11,7 @@ namespace Hermes L2ProjBasedSelector::L2ProjBasedSelector(CandList cand_list, int max_order, L2Shapeset* user_shapeset) : ProjBasedSelector(cand_list, max_order, user_shapeset == nullptr ? new L2Shapeset() : user_shapeset, Range(1, 1), Range(0, H2DRS_MAX_ORDER)), user_shapeset(user_shapeset == nullptr ? false : true) { - if(user_shapeset != nullptr) + if (user_shapeset != nullptr) { this->warn("Warning: The user shapeset provided for the selector has to have a correct copy constructor implemented."); this->warn("Warning: The functionality for cloning user shapeset is to be implemented yet."); @@ -21,15 +21,15 @@ namespace Hermes template L2ProjBasedSelector::~L2ProjBasedSelector() { - if(!this->user_shapeset) + if (!this->user_shapeset) delete this->shapeset; } template void L2ProjBasedSelector::get_current_order_range(Element* element, int& min_order_, int& max_order_) { - int max_element_order = (20 - element->iro_cache)/2 - 1; - if(this->max_order == H2DRS_DEFAULT_ORDER) + int max_element_order = (20 - element->iro_cache) / 2 - 1; + if (this->max_order == H2DRS_DEFAULT_ORDER) max_order_ = max_element_order; else max_order_ = std::min(this->max_order, max_element_order); @@ -37,7 +37,7 @@ namespace Hermes } template - void L2ProjBasedSelector::precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) + void L2ProjBasedSelector::precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) { //for all transformations bool done = false; @@ -46,14 +46,14 @@ namespace Hermes { //prepare data for processing const Trf& trf = trfs[inx_trf]; - Hermes::vector::TrfShapeExp>& trf_svals = svals[inx_trf]; + std::vector::TrfShapeExp>& trf_svals = svals[inx_trf]; //allocate trf_svals.resize(max_shape_inx + 1); //for all shapes const int num_shapes = (int)shapes.size(); - for(int i = 0; i < num_shapes; i++) + for (int i = 0; i < num_shapes; i++) { int inx_shape = shapes[i].inx; typename ProjBasedSelector::TrfShapeExp& shape_exp = trf_svals[inx_shape]; @@ -62,7 +62,7 @@ namespace Hermes shape_exp.allocate(H2D_L2FE_NUM, num_gip_points); //for all GIP points - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { //transform coordinates double ref_x = gip_points[k][H2D_GIP2D_X] * trf.m[0] + trf.t[0]; @@ -74,39 +74,39 @@ namespace Hermes } //move to the next transformation - if(inx_trf == H2D_TRF_IDENTITY) + if (inx_trf == H2D_TRF_IDENTITY) done = true; else { inx_trf++; - if(inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation + if (inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation inx_trf = H2D_TRF_IDENTITY; } } - if(!done) + if (!done) throw Exceptions::Exception("All transformation processed but identity transformation not found."); } template - void L2ProjBasedSelector::precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const Hermes::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) + void L2ProjBasedSelector::precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector::ShapeInx>& shapes, const int max_shape_inx, typename ProjBasedSelector::TrfShape& svals, ElementMode2D mode) { //calculate values precalc_shapes(gip_points, num_gip_points, trfs, num_noni_trfs, shapes, max_shape_inx, svals, mode); //calculate orthonormal basis const int num_shapes = (int)shapes.size(); - for(int i = 0; i < num_shapes; i++) + for (int i = 0; i < num_shapes; i++) { const int inx_shape_i = shapes[i].inx; //orthogonalize - for(int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { const int inx_shape_j = shapes[j].inx; //calculate product of non-transformed functions double product = 0.0; - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { double sum = 0.0; sum += svals[H2D_TRF_IDENTITY][inx_shape_i][H2D_L2FE_VALUE][k] * svals[H2D_TRF_IDENTITY][inx_shape_j][H2D_L2FE_VALUE][k]; @@ -119,37 +119,37 @@ namespace Hermes while (!done && inx_trf < H2D_TRF_NUM) { //for all integration points - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { svals[inx_trf][inx_shape_i][H2D_L2FE_VALUE][k] -= product * svals[inx_trf][inx_shape_j][H2D_L2FE_VALUE][k]; } //move to the next transformation - if(inx_trf == H2D_TRF_IDENTITY) + if (inx_trf == H2D_TRF_IDENTITY) done = true; else { inx_trf++; - if(inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation + if (inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation inx_trf = H2D_TRF_IDENTITY; } } //identity transformation has to be the last transformation - if(!done) + if (!done) throw Exceptions::Exception("All transformation processed but identity transformation not found."); } //normalize //calculate norm double norm_squared = 0.0; - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { double sum = 0.0; sum += sqr(svals[H2D_TRF_IDENTITY][inx_shape_i][H2D_L2FE_VALUE][k]); norm_squared += gip_points[k][H2D_GIP2D_W] * sum; } double norm = sqrt(norm_squared); - if(!finite(1/norm)) + if (!finite(1 / norm)) throw Exceptions::Exception("Norm (%g) is almost zero.", norm); //for all transformations: normalize @@ -158,23 +158,23 @@ namespace Hermes while (!done && inx_trf < H2D_TRF_NUM) { //for all integration points - for(int k = 0; k < num_gip_points; k++) + for (int k = 0; k < num_gip_points; k++) { svals[inx_trf][inx_shape_i][H2D_L2FE_VALUE][k] /= norm; } //move to the next transformation - if(inx_trf == H2D_TRF_IDENTITY) + if (inx_trf == H2D_TRF_IDENTITY) done = true; else { inx_trf++; - if(inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation + if (inx_trf >= num_noni_trfs) //if all transformations were processed, move to the identity transformation inx_trf = H2D_TRF_IDENTITY; } } //identity transformation has to be the last transformation - if(!done) + if (!done) throw Exceptions::Exception("All transformation processed but identity transformation not found."); } } @@ -202,16 +202,16 @@ namespace Hermes //calculate products int inx_row = 0; - for(int i = 0; i < num_shapes; i++, inx_row += num_shapes) + for (int i = 0; i < num_shapes; i++, inx_row += num_shapes) { double* matrix_row = matrix[i]; int shape0_inx = shape_inx[i]; - for(int k = 0; k < num_shapes; k++) + for (int k = 0; k < num_shapes; k++) { int shape1_inx = shape_inx[k]; double value = 0.0; - for(int j = 0; j < num_gip_points; j++) + for (int j = 0; j < num_gip_points; j++) { double gip_x = gip_points[j][H2D_GIP2D_X], gip_y = gip_points[j][H2D_GIP2D_Y]; double value0 = this->shapeset->get_value(H2D_FEI_VALUE, shape0_inx, gip_x, gip_y, 0, mode); @@ -231,7 +231,7 @@ namespace Hermes Scalar L2ProjBasedSelector::evaluate_rhs_subdomain(Element* sub_elem, const typename ProjBasedSelector::ElemGIP& sub_gip, int son, const typename ProjBasedSelector::ElemSubTrf& sub_trf, const typename ProjBasedSelector::ElemSubShapeFunc& sub_shape, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]) { Scalar total_value = 0; - for(int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) + for (int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) { //get location and transform it double3 &gip_pt = sub_gip.gip_points[gip_inx]; @@ -255,14 +255,14 @@ namespace Hermes double L2ProjBasedSelector::evaluate_error_squared_subdomain(Element* sub_elem, const typename ProjBasedSelector::ElemGIP& sub_gip, int son, const typename ProjBasedSelector::ElemSubTrf& sub_trf, const typename ProjBasedSelector::ElemProj& elem_proj, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS]) { double total_error_squared = 0; - for(int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) + for (int gip_inx = 0; gip_inx < sub_gip.num_gip_points; gip_inx++) { //get location and transform it double3 &gip_pt = sub_gip.gip_points[gip_inx]; //calculate value of projected solution Scalar proj_value = 0; - for(int i = 0; i < elem_proj.num_shapes; i++) + for (int i = 0; i < elem_proj.num_shapes; i++) { int shape_inx = elem_proj.shape_inxs[i]; proj_value += elem_proj.shape_coeffs[i] * elem_proj.svals[shape_inx][H2D_L2FE_VALUE][gip_inx]; @@ -279,8 +279,8 @@ namespace Hermes return total_error_squared; } - template class HERMES_API L2ProjBasedSelector; - template class HERMES_API L2ProjBasedSelector >; + template class HERMES_API L2ProjBasedSelector < double > ; + template class HERMES_API L2ProjBasedSelector < std::complex > ; } } } \ No newline at end of file diff --git a/hermes2d/src/refinement_selectors/optimum_selector.cpp b/hermes2d/src/refinement_selectors/optimum_selector.cpp index b08fa1d2ec..108741296b 100644 --- a/hermes2d/src/refinement_selectors/optimum_selector.cpp +++ b/hermes2d/src/refinement_selectors/optimum_selector.cpp @@ -16,23 +16,23 @@ namespace Hermes max_order, Shapeset* shapeset, const Range& vertex_order, const Range& edge_bubble_order) : Selector(shapeset->get_min_order(), max_order), cand_list(cand_list), shapeset(shapeset), dof_score_exponent(1.0) { - if(shapeset == nullptr) + if (shapeset == nullptr) throw Exceptions::NullException(3); num_shapes = new int***[2]; - for(int i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { /// Why H2DRS_MAX_ORDER + 3? /// Because H2DRS_MAX_ORDER ( = 9 ) is the max order refinement selectors support (\todo verify the purpose of this). /// But we need to know number of shapes for polynomial degrees 0, ..., 10 ( = 11 ) + 1 special (any order - at 0th position). num_shapes[i] = new int**[H2D_NUM_SHAPES_SIZE]; - for(int j = 0; j < H2D_NUM_SHAPES_SIZE; j++) + for (int j = 0; j < H2D_NUM_SHAPES_SIZE; j++) { num_shapes[i][j] = new int*[H2D_NUM_SHAPES_SIZE]; - for(int k = 0; k < H2D_NUM_SHAPES_SIZE; k++) + for (int k = 0; k < H2D_NUM_SHAPES_SIZE; k++) { num_shapes[i][j][k] = new int[6]; - memset(num_shapes[i][j][k], 0, 6*sizeof(int)); + memset(num_shapes[i][j][k], 0, 6 * sizeof(int)); } } } @@ -45,39 +45,39 @@ namespace Hermes template OptimumSelector::~OptimumSelector() { - for(int i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { - for(int j = 0; j < H2D_NUM_SHAPES_SIZE; j++) + for (int j = 0; j < H2D_NUM_SHAPES_SIZE; j++) { - for(int k = 0; k < H2D_NUM_SHAPES_SIZE; k++) + for (int k = 0; k < H2D_NUM_SHAPES_SIZE; k++) { - delete [] num_shapes[i][j][k]; + delete[] num_shapes[i][j][k]; } - delete [] num_shapes[i][j]; + delete[] num_shapes[i][j]; } - delete [] num_shapes[i]; + delete[] num_shapes[i]; } - delete [] num_shapes; + delete[] num_shapes; } - + template - void OptimumSelector::add_bubble_shape_index(int order_h, int order_v, std::map& used_shape_index, Hermes::vector& indices, ElementMode2D mode) + void OptimumSelector::add_bubble_shape_index(int order_h, int order_v, std::map& used_shape_index, std::vector& indices, ElementMode2D mode) { int quad_order = H2D_MAKE_QUAD_ORDER(order_h, order_v); const int num_bubbles = shapeset->get_num_bubbles(quad_order, mode); - int* bubble_inxs = shapeset->get_bubble_indices(quad_order, mode); - for(int j = 0; j < num_bubbles; j++) + short* bubble_inxs = shapeset->get_bubble_indices(quad_order, mode); + for (int j = 0; j < num_bubbles; j++) { int inx_bubble = bubble_inxs[j]; - if(used_shape_index.find(inx_bubble) == used_shape_index.end()) + if (used_shape_index.find(inx_bubble) == used_shape_index.end()) { used_shape_index[inx_bubble] = true; indices.push_back(ShapeInx(order_h, order_v, inx_bubble, H2DST_BUBBLE)); - for(int order_h_i = order_h+1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) - for(int order_v_i = order_v+1; order_v_i < H2D_NUM_SHAPES_SIZE; order_v_i++) + for (int order_h_i = order_h + 1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) + for (int order_v_i = order_v + 1; order_v_i < H2D_NUM_SHAPES_SIZE; order_v_i++) { - num_shapes[mode][order_h_i][order_v_i][H2DSI_BUBBLE]++; - num_shapes[mode][order_h_i][order_v_i][H2DSI_ANY]++; + num_shapes[mode][order_h_i][order_v_i][H2DSI_BUBBLE]++; + num_shapes[mode][order_h_i][order_v_i][H2DSI_ANY]++; } num_shapes[mode][0][0][H2DSI_BUBBLE]++; num_shapes[mode][0][0][H2DSI_ANY]++; @@ -88,7 +88,7 @@ namespace Hermes template void OptimumSelector::build_shape_indices(const ElementMode2D mode, const Range& vertex_order, const Range& edge_bubble_order) { - Hermes::vector &indices = shape_indices[mode]; + std::vector &indices = shape_indices[mode]; int* next_order = this->next_order_shape[mode]; int& max_shape_inx = this->max_shape_inx[mode]; int num_edges = (mode == HERMES_MODE_QUAD) ? 4 : 3; @@ -110,135 +110,138 @@ namespace Hermes //for all orders max_shape_inx = 0; int examined_shape = 0; - for(int i = order_range.lower(); i <= 10; i++) + for (unsigned char i = order_range.lower(); i <= 10; i++) { - //vertex functions - if(vertex_order.is_in_closed(i)) + if (shapeset->get_space_type() != HERMES_L2_SPACE && shapeset->get_space_type() != HERMES_L2_MARKERWISE_CONST_SPACE) { - for (int j = 0; j < num_edges; j++) + //vertex functions + if (vertex_order.is_in_closed(i)) { - int inx = shapeset->get_vertex_index(j, mode); - if(inx >= 0) + for (int j = 0; j < num_edges; j++) { - used_shape_index[inx] = true; - indices.push_back(ShapeInx(1, 1, inx, H2DST_VERTEX)); - if(mode == HERMES_MODE_QUAD) + int inx = shapeset->get_vertex_index(j, mode); + if (inx >= 0) { - for(int order_h_i = 2; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) - for(int order_v_i = 2; order_v_i < H2D_NUM_SHAPES_SIZE; order_v_i++) - { + used_shape_index[inx] = true; + indices.push_back(ShapeInx(1, 1, inx, H2DST_VERTEX)); + if (mode == HERMES_MODE_QUAD) + { + for (int order_h_i = 2; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) + for (int order_v_i = 2; order_v_i < H2D_NUM_SHAPES_SIZE; order_v_i++) + { num_shapes[mode][order_h_i][order_v_i][H2DSI_VERTEX]++; num_shapes[mode][order_h_i][order_v_i][H2DSI_ANY]++; - } - num_shapes[mode][0][0][H2DSI_VERTEX]++; - num_shapes[mode][0][0][H2DSI_ANY]++; - } - else - { - for(int order_h_i = 2; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) + } + num_shapes[mode][0][0][H2DSI_VERTEX]++; + num_shapes[mode][0][0][H2DSI_ANY]++; + } + else { - num_shapes[mode][order_h_i][0][H2DSI_VERTEX]++; - num_shapes[mode][order_h_i][0][H2DSI_ANY]++; + for (int order_h_i = 2; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) + { + num_shapes[mode][order_h_i][0][H2DSI_VERTEX]++; + num_shapes[mode][order_h_i][0][H2DSI_ANY]++; + } + num_shapes[mode][0][0][H2DSI_VERTEX]++; + num_shapes[mode][0][0][H2DSI_ANY]++; } - num_shapes[mode][0][0][H2DSI_VERTEX]++; - num_shapes[mode][0][0][H2DSI_ANY]++; + has_vertex = true; } - has_vertex = true; } } - } - //edge functions - if(edge_bubble_order.is_in_closed(i)) - { //edge functions - if(mode == HERMES_MODE_QUAD) + if (edge_bubble_order.is_in_closed(i)) { - for (int j = 0; j < num_edges; j++) + //edge functions + if (mode == HERMES_MODE_QUAD) { - int inx = shapeset->get_edge_index(j, 0, i, HERMES_MODE_QUAD); - if(inx >= 0) + for (int j = 0; j < num_edges; j++) { - used_shape_index[inx] = true; - if((j&1) == 0)//horizontal edge + int inx = shapeset->get_edge_index(j, 0, i, HERMES_MODE_QUAD); + if (inx >= 0) { - indices.push_back(ShapeInx(i, 0, inx, H2DST_HORIZ_EDGE)); - for(int order_h_i = i+1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) - for(int order_v_i = 1; order_v_i < H2D_NUM_SHAPES_SIZE; order_v_i++) - { + used_shape_index[inx] = true; + if ((j & 1) == 0)//horizontal edge + { + indices.push_back(ShapeInx(i, 0, inx, H2DST_HORIZ_EDGE)); + for (int order_h_i = i + 1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) + for (int order_v_i = 1; order_v_i < H2D_NUM_SHAPES_SIZE; order_v_i++) + { num_shapes[mode][order_h_i][order_v_i][H2DST_HORIZ_EDGE]++; num_shapes[mode][order_h_i][order_v_i][H2DSI_ANY]++; - } - num_shapes[mode][0][0][H2DST_HORIZ_EDGE]++; - num_shapes[mode][0][0][H2DSI_ANY]++; - } - else //vertical edge - { - indices.push_back(ShapeInx(0, i, inx, H2DST_VERT_EDGE)); - for(int order_h_i = 1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) - for(int order_v_i = i+1; order_v_i < H2D_NUM_SHAPES_SIZE; order_v_i++) - { + } + num_shapes[mode][0][0][H2DST_HORIZ_EDGE]++; + num_shapes[mode][0][0][H2DSI_ANY]++; + } + else //vertical edge + { + indices.push_back(ShapeInx(0, i, inx, H2DST_VERT_EDGE)); + for (int order_h_i = 1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) + for (int order_v_i = i + 1; order_v_i < H2D_NUM_SHAPES_SIZE; order_v_i++) + { num_shapes[mode][order_h_i][order_v_i][H2DSI_VERT_EDGE]++; num_shapes[mode][order_h_i][order_v_i][H2DSI_ANY]++; - } - num_shapes[mode][0][0][H2DSI_VERT_EDGE]++; - num_shapes[mode][0][0][H2DSI_ANY]++; + } + num_shapes[mode][0][0][H2DSI_VERT_EDGE]++; + num_shapes[mode][0][0][H2DSI_ANY]++; + } + has_edge = true; } - has_edge = true; } } - } - else - { - for (int j = 0; j < num_edges; j++) + else { - int inx = shapeset->get_edge_index(j, 0, i, HERMES_MODE_TRIANGLE); - if(inx >= 0) + for (int j = 0; j < num_edges; j++) { - used_shape_index[inx] = true; - indices.push_back(ShapeInx(i, i, inx, H2DST_TRI_EDGE)); - for(int order_h_i = i+1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) + int inx = shapeset->get_edge_index(j, 0, i, HERMES_MODE_TRIANGLE); + if (inx >= 0) { - num_shapes[mode][order_h_i][0][H2DSI_TRI_EDGE]++; - num_shapes[mode][order_h_i][0][H2DSI_ANY]++; + used_shape_index[inx] = true; + indices.push_back(ShapeInx(i, i, inx, H2DST_TRI_EDGE)); + for (int order_h_i = i + 1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) + { + num_shapes[mode][order_h_i][0][H2DSI_TRI_EDGE]++; + num_shapes[mode][order_h_i][0][H2DSI_ANY]++; + } + num_shapes[mode][0][0][H2DSI_TRI_EDGE]++; + num_shapes[mode][0][0][H2DSI_ANY]++; + has_edge = true; } - num_shapes[mode][0][0][H2DSI_TRI_EDGE]++; - num_shapes[mode][0][0][H2DSI_ANY]++; - has_edge = true; } } } //bubble functions - if(mode == HERMES_MODE_QUAD) + if (mode == HERMES_MODE_QUAD) { //NOTE: shapeset returns a set of all possible bubble functions and it is not possible to identify which is the smallest // order of an element which contains this function, e.g., in a case of a Hcurl and an element of an order 1/1, it returns // a list that contains a function of poly-order 2/0. Also, order of indices is not given. int order = i; unsigned num_indices_prev = indices.size(); - for(int order_other = edge_bubble_order.lower(); order_other <= order; order_other++) + for (int order_other = edge_bubble_order.lower(); order_other <= order; order_other++) { add_bubble_shape_index(order, order_other, used_shape_index, indices, mode); add_bubble_shape_index(order_other, order, used_shape_index, indices, mode); } //check if indices were added - if(num_indices_prev < indices.size()) + if (num_indices_prev < indices.size()) has_bubble = true; } else { //triangles int order = i; - int num_bubbles = shapeset->get_num_bubbles(order, mode); - int* bubble_inxs = shapeset->get_bubble_indices(order, mode); - for(int j = 0; j < num_bubbles; j++) + unsigned short num_bubbles = shapeset->get_num_bubbles(order, mode); + short* bubble_inxs = shapeset->get_bubble_indices(order, mode); + for (unsigned short j = 0; j < num_bubbles; j++) { int inx_bubble = bubble_inxs[j]; - if(used_shape_index.find(inx_bubble) == used_shape_index.end()) + if (used_shape_index.find(inx_bubble) == used_shape_index.end()) { used_shape_index[inx_bubble] = true; indices.push_back(ShapeInx(order, order, inx_bubble, H2DST_BUBBLE)); - for(int order_h_i = order+1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) + for (int order_h_i = order + 1; order_h_i < H2D_NUM_SHAPES_SIZE; order_h_i++) { num_shapes[mode][order_h_i][0][H2DSI_BUBBLE]++; num_shapes[mode][order_h_i][0][H2DSI_ANY]++; @@ -254,7 +257,7 @@ namespace Hermes next_order[i] = (int)indices.size(); //update maximum - while(examined_shape < next_order[i]) + while (examined_shape < next_order[i]) { max_shape_inx = std::max(max_shape_inx, indices[examined_shape].inx); examined_shape++; @@ -270,24 +273,24 @@ namespace Hermes { //test whether the evaluation is necessary bool full_eval = false; - if((allowed_type_mask & H2DST_VERTEX) != 0) + if ((allowed_type_mask & H2DST_VERTEX) != 0) full_eval |= has_vertex_shape[mode]; - if((allowed_type_mask & (H2DST_HORIZ_EDGE | H2DST_VERT_EDGE | H2DST_TRI_EDGE)) != 0) + if ((allowed_type_mask & (H2DST_HORIZ_EDGE | H2DST_VERT_EDGE | H2DST_TRI_EDGE)) != 0) full_eval |= has_edge_shape[mode]; - if((allowed_type_mask & H2DST_BUBBLE) != 0) + if ((allowed_type_mask & H2DST_BUBBLE) != 0) full_eval |= has_bubble_shape[mode]; //evaluate - if(full_eval) + if (full_eval) { - Hermes::vector& shapes = shape_indices[mode]; + std::vector& shapes = shape_indices[mode]; int num = 0; - typename Hermes::vector::const_iterator shape = shapes.begin(); + typename std::vector::const_iterator shape = shapes.begin(); while (shape != shapes.end()) { - if(((int)shape->type & allowed_type_mask) != 0) + if (((int)shape->type & allowed_type_mask) != 0) { - if((order_h == H2DRS_ORDER_ANY || shape->order_h <= order_h) && (order_v == H2DRS_ORDER_ANY || shape->order_v <= order_v)) + if ((order_h == H2DRS_ORDER_ANY || shape->order_h <= order_h) && (order_v == H2DRS_ORDER_ANY || shape->order_v <= order_v)) num++; } shape++; @@ -299,31 +302,31 @@ namespace Hermes } template - void OptimumSelector::append_candidates_split(Hermes::vector& candidates, const int start_order, const int last_order, const int split, bool iso_p) + void OptimumSelector::append_candidates_split(std::vector& candidates, const int start_order, const int last_order, const RefinementType split, bool iso_p) { //check whether end orders are not lower than start orders - if(last_order < 0 || start_order < 0) + if (last_order < 0 || start_order < 0) return; - if(H2D_GET_H_ORDER(start_order) > H2D_GET_H_ORDER(last_order) || H2D_GET_V_ORDER(start_order) > H2D_GET_V_ORDER(last_order)) + if (H2D_GET_H_ORDER(start_order) > H2D_GET_H_ORDER(last_order) || H2D_GET_V_ORDER(start_order) > H2D_GET_V_ORDER(last_order)) return; //get number of sons const int num_sons = get_refin_sons(split); //initialize orders - int quad_orders[H2D_MAX_ELEMENT_SONS]; + unsigned short quad_orders[H2D_MAX_ELEMENT_SONS]; OrderPermutator quad_perms[H2D_MAX_ELEMENT_SONS]; - for(int i = 0; i < num_sons; i++) + for (int i = 0; i < num_sons; i++) { quad_orders[i] = start_order; quad_perms[i] = OrderPermutator(start_order, last_order, iso_p, &quad_orders[i]); } - for(int i = num_sons; i < H2D_MAX_ELEMENT_SONS; i++) + for (int i = num_sons; i < H2D_MAX_ELEMENT_SONS; i++) quad_orders[i] = 0; //generate permutations of orders bool quit = false; - while(!quit) + while (!quit) { do { //create permutation of son 0 candidates.push_back(Cand(split, quad_orders)); @@ -336,18 +339,19 @@ namespace Hermes int inx_son = 1; while (inx_son < num_sons && !quad_perms[inx_son].next()) { - quad_perms[inx_son].reset(); //reset order of the son + //reset order of the son + quad_perms[inx_son].reset(); inx_son++; } - if(inx_son >= num_sons) + if (inx_son >= num_sons) quit = true; } } template - Hermes::vector OptimumSelector::create_candidates(Element* e, int quad_order) + std::vector OptimumSelector::create_candidates(Element* e, int quad_order) { - Hermes::vector candidates; + std::vector candidates; // Get the current order range. int current_min_order, current_max_order; @@ -355,7 +359,7 @@ namespace Hermes int order_h = H2D_GET_H_ORDER(quad_order), order_v = H2D_GET_V_ORDER(quad_order); - if(current_max_order < std::max(order_h, order_v)) + if (current_max_order < std::max(order_h, order_v)) current_max_order = std::max(order_h, order_v); bool tri = e->is_triangle(); @@ -368,7 +372,7 @@ namespace Hermes bool iso_p = false; int last_order_h = std::min(current_max_order, order_h + H2DRS_MAX_ORDER_INC), last_order_v = std::min(current_max_order, order_v + H2DRS_MAX_ORDER_INC); int last_order = H2D_MAKE_QUAD_ORDER(last_order_h, last_order_v); - switch(cand_list) + switch (cand_list) { case H2D_H_ISO: case H2D_H_ANISO: last_order = quad_order; break; //no P-candidates except the original candidate @@ -384,7 +388,7 @@ namespace Hermes int start_order = H2D_MAKE_QUAD_ORDER(start_order_h, start_order_v); last_order_h = std::min(current_max_order, order_h + H2DRS_MAX_ORDER_INC), last_order_v = std::min(current_max_order, order_v + H2DRS_MAX_ORDER_INC); last_order = H2D_MAKE_QUAD_ORDER(last_order_h, last_order_v); - switch(cand_list) + switch (cand_list) { case H2D_H_ISO: case H2D_H_ANISO: @@ -398,22 +402,23 @@ namespace Hermes //generate all ANISO-candidates /** \todo Find and why is iro_cache compared with the number 8. What does the number 8 mean? */ - if(!tri && e->iro_cache < 8 && (cand_list == H2D_H_ANISO || cand_list == H2D_HP_ANISO_H || cand_list == H2D_HP_ANISO)) + if (!tri && e->iro_cache < 8 && (cand_list == H2D_H_ANISO || cand_list == H2D_HP_ANISO_H || cand_list == H2D_HP_ANISO)) { iso_p = false; int start_order_hz = H2D_MAKE_QUAD_ORDER(order_h, std::max(current_min_order, (order_v - 1))); int last_order_hz = H2D_MAKE_QUAD_ORDER(std::min(current_max_order, order_h + H2DRS_MAX_ORDER_INC), std::min(order_v, H2D_GET_V_ORDER(start_order) + H2DRS_MAX_ORDER_INC)); int start_order_vt = H2D_MAKE_QUAD_ORDER(std::max(current_min_order, (order_h - 1)), order_v); int last_order_vt = H2D_MAKE_QUAD_ORDER(std::min(order_h, H2D_GET_H_ORDER(start_order) + H2DRS_MAX_ORDER_INC), std::min(current_max_order, order_v + H2DRS_MAX_ORDER_INC)); - switch(cand_list) + switch (cand_list) { case H2D_H_ANISO: last_order_hz = start_order_hz = quad_order; last_order_vt = start_order_vt = quad_order; - break; //only one candidate will be created + //only one candidate will be created + break; case H2D_HP_ANISO_H: iso_p = true; break; //iso change of orders } - if(iso_p) { //make orders uniform: take mininmum order since nonuniformity is caused by different handling of orders along directions + if (iso_p) { //make orders uniform: take mininmum order since nonuniformity is caused by different handling of orders along directions int order = std::min(H2D_GET_H_ORDER(start_order_hz), H2D_GET_V_ORDER(start_order_hz)); start_order_hz = H2D_MAKE_QUAD_ORDER(order, order); order = std::min(H2D_GET_H_ORDER(start_order_vt), H2D_GET_V_ORDER(start_order_vt)); @@ -424,33 +429,33 @@ namespace Hermes order = std::min(H2D_GET_H_ORDER(last_order_vt), H2D_GET_V_ORDER(last_order_vt)); last_order_vt = H2D_MAKE_QUAD_ORDER(order, order); } - append_candidates_split(candidates, start_order_hz, last_order_hz, H2D_REFINEMENT_ANISO_H, iso_p); - append_candidates_split(candidates, start_order_vt, last_order_vt, H2D_REFINEMENT_ANISO_V, iso_p); + append_candidates_split(candidates, start_order_hz, last_order_hz, H2D_REFINEMENT_H_ANISO_H, iso_p); + append_candidates_split(candidates, start_order_vt, last_order_vt, H2D_REFINEMENT_H_ANISO_V, iso_p); } return candidates; } template - void OptimumSelector::update_cands_info(Hermes::vector& candidates, CandsInfo& info_h, CandsInfo& info_p, CandsInfo& info_aniso) const + void OptimumSelector::update_cands_info(std::vector& candidates, CandsInfo& info_h, CandsInfo& info_p, CandsInfo& info_aniso) const { - for(int i = 0; i < candidates.size(); i++) + for (unsigned short i = 0; i < candidates.size(); i++) { CandsInfo* info = nullptr; Cand& cand = candidates[i]; - if(cand.split == H2D_REFINEMENT_H) info = &info_h; - else if(cand.split == H2D_REFINEMENT_P) info = &info_p; - else if(cand.split == H2D_REFINEMENT_ANISO_H || cand.split == H2D_REFINEMENT_ANISO_V) info = &info_aniso; + if (cand.split == H2D_REFINEMENT_H) info = &info_h; + else if (cand.split == H2D_REFINEMENT_P) info = &info_p; + else if (cand.split == H2D_REFINEMENT_H_ANISO_H || cand.split == H2D_REFINEMENT_H_ANISO_V) info = &info_aniso; else { throw Hermes::Exceptions::Exception("Invalid candidate type: %d.", cand.split); }; //evaluate elements of candidates const int num_elems = cand.get_num_elems(); - for(int i = 0; i < num_elems; i++) + for (int i = 0; i < num_elems; i++) { int elem_order_h = H2D_GET_H_ORDER(cand.p[i]), elem_order_v = H2D_GET_V_ORDER(cand.p[i]); - if(elem_order_h != elem_order_v) + if (elem_order_h != elem_order_v) info->uniform_orders = false; - if(info->min_quad_order < 0 || info->max_quad_order < 0) + if (info->min_quad_order < 0 || info->max_quad_order < 0) info->min_quad_order = info->max_quad_order = H2D_MAKE_QUAD_ORDER(elem_order_h, elem_order_v); else { @@ -462,31 +467,34 @@ namespace Hermes } template - void OptimumSelector::evaluate_cands_dof(Hermes::vector& candidates, Element* e, MeshFunction* rsln) + void OptimumSelector::evaluate_cands_dof(std::vector& candidates, Element* e, MeshFunction* rsln) { bool tri = e->is_triangle(); for (unsigned i = 0; i < candidates.size(); i++) { Cand& c = candidates[i]; - if(tri) { //triangle - switch(c.split) + if (tri) { //triangle + switch (c.split) { case H2D_REFINEMENT_H: + { + //central triangle + const int central = 3; + c.dofs = 0; + for (int j = 0; j < H2D_MAX_ELEMENT_SONS; j++) { - const int central = 3; //central triangle - c.dofs = 0; - for(int j = 0; j < H2D_MAX_ELEMENT_SONS; j++) + c.dofs += num_shapes[HERMES_MODE_TRIANGLE][H2D_GET_H_ORDER(c.p[j]) + 1][H2DRS_ORDER_ANY + 1][H2DSI_ANY]; + if (j != central) { - c.dofs += num_shapes[HERMES_MODE_TRIANGLE][H2D_GET_H_ORDER(c.p[j]) + 1][H2DRS_ORDER_ANY + 1][H2DSI_ANY]; - if(j != central) - { - c.dofs -= num_shapes[HERMES_MODE_TRIANGLE][std::min(H2D_GET_H_ORDER(c.p[j]) , H2D_GET_H_ORDER(c.p[central])) + 1][H2DRS_ORDER_ANY + 1][H2DSI_TRI_EDGE] / 3; //shared edge: since triangle has three edges which are identified by a single order this will find 3 x different edge of a given order - } + //shared edge: since triangle has three edges which are identified by a single order this will find 3 x different edge of a given order + c.dofs -= num_shapes[HERMES_MODE_TRIANGLE][std::min(H2D_GET_H_ORDER(c.p[j]), H2D_GET_H_ORDER(c.p[central])) + 1][H2DRS_ORDER_ANY + 1][H2DSI_TRI_EDGE] / 3; } - if(has_vertex_shape[HERMES_MODE_TRIANGLE]) - c.dofs -= 2*3; // Every vertex function belonging to vertices of the middle triangle is added 3-times, so it has to be deducted 2 times. } + if (has_vertex_shape[HERMES_MODE_TRIANGLE]) + // Every vertex function belonging to vertices of the middle triangle is added 3-times, so it has to be deducted 2 times. + c.dofs -= 2 * 3; + } break; case H2D_REFINEMENT_P: @@ -498,34 +506,41 @@ namespace Hermes } } else { //quad - switch(c.split) + switch (c.split) { case H2D_REFINEMENT_H: c.dofs = 0; - for(int j = 0; j < H2D_MAX_ELEMENT_SONS; j++) + for (int j = 0; j < H2D_MAX_ELEMENT_SONS; j++) c.dofs += num_shapes[HERMES_MODE_QUAD][H2D_GET_H_ORDER(c.p[j]) + 1][H2D_GET_V_ORDER(c.p[j]) + 1][H2DSI_ANY]; - for(int j = 0; j < 2; j++) { //shared edge functions - c.dofs -= num_shapes[HERMES_MODE_QUAD][H2DRS_ORDER_ANY + 1][std::min(H2D_GET_V_ORDER(c.p[2*j]), H2D_GET_V_ORDER(c.p[2*j + 1])) + 1][H2DSI_VERT_EDGE] / 2; //shared vertical edge functions: every edge is twice there - c.dofs -= num_shapes[HERMES_MODE_QUAD][std::min(H2D_GET_H_ORDER(c.p[j]), H2D_GET_H_ORDER(c.p[j^3])) + 1][H2DRS_ORDER_ANY + 1][H2DSI_HORIZ_EDGE] / 2; //shared horizontal edge functions: every edge is twice there + for (int j = 0; j < 2; j++) { //shared edge functions + //shared vertical edge functions: every edge is twice there + c.dofs -= num_shapes[HERMES_MODE_QUAD][H2DRS_ORDER_ANY + 1][std::min(H2D_GET_V_ORDER(c.p[2 * j]), H2D_GET_V_ORDER(c.p[2 * j + 1])) + 1][H2DSI_VERT_EDGE] / 2; + //shared horizontal edge functions: every edge is twice there + c.dofs -= num_shapes[HERMES_MODE_QUAD][std::min(H2D_GET_H_ORDER(c.p[j]), H2D_GET_H_ORDER(c.p[j ^ 3])) + 1][H2DRS_ORDER_ANY + 1][H2DSI_HORIZ_EDGE] / 2; } - if(has_vertex_shape[HERMES_MODE_QUAD]) - c.dofs -= 4 + 3; //edge vertex + central vertex + if (has_vertex_shape[HERMES_MODE_QUAD]) + //edge vertex + central vertex + c.dofs -= 4 + 3; break; - case H2D_REFINEMENT_ANISO_H: + case H2D_REFINEMENT_H_ANISO_H: c.dofs = num_shapes[HERMES_MODE_QUAD][H2D_GET_H_ORDER(c.p[0]) + 1][H2D_GET_V_ORDER(c.p[0]) + 1][H2DSI_ANY]; c.dofs += num_shapes[HERMES_MODE_QUAD][H2D_GET_H_ORDER(c.p[1]) + 1][H2D_GET_V_ORDER(c.p[1]) + 1][H2DSI_ANY]; - c.dofs -= num_shapes[HERMES_MODE_QUAD][std::min(H2D_GET_H_ORDER(c.p[0]), H2D_GET_H_ORDER(c.p[1])) + 1][H2DRS_ORDER_ANY + 1][H2DSI_HORIZ_EDGE] / 2; //shared edge functions - if(has_vertex_shape[HERMES_MODE_QUAD]) - c.dofs -= 2; //shared vertex functions + //shared edge functions + c.dofs -= num_shapes[HERMES_MODE_QUAD][std::min(H2D_GET_H_ORDER(c.p[0]), H2D_GET_H_ORDER(c.p[1])) + 1][H2DRS_ORDER_ANY + 1][H2DSI_HORIZ_EDGE] / 2; + if (has_vertex_shape[HERMES_MODE_QUAD]) + //shared vertex functions + c.dofs -= 2; break; - case H2D_REFINEMENT_ANISO_V: + case H2D_REFINEMENT_H_ANISO_V: c.dofs = num_shapes[HERMES_MODE_QUAD][H2D_GET_H_ORDER(c.p[0]) + 1][H2D_GET_V_ORDER(c.p[0]) + 1][H2DSI_ANY]; c.dofs += num_shapes[HERMES_MODE_QUAD][H2D_GET_H_ORDER(c.p[1]) + 1][H2D_GET_V_ORDER(c.p[1]) + 1][H2DSI_ANY]; - c.dofs -= num_shapes[HERMES_MODE_QUAD][H2DRS_ORDER_ANY + 1][std::min(H2D_GET_V_ORDER(c.p[0]), H2D_GET_V_ORDER(c.p[1])) + 1][H2DSI_VERT_EDGE] / 2; //shared edge functions - if(has_vertex_shape[HERMES_MODE_QUAD]) - c.dofs -= 2; //shared vertex functions + //shared edge functions + c.dofs -= num_shapes[HERMES_MODE_QUAD][H2DRS_ORDER_ANY + 1][std::min(H2D_GET_V_ORDER(c.p[0]), H2D_GET_V_ORDER(c.p[1])) + 1][H2DSI_VERT_EDGE] / 2; + if (has_vertex_shape[HERMES_MODE_QUAD]) + //shared vertex functions + c.dofs -= 2; break; case H2D_REFINEMENT_P: @@ -540,7 +555,7 @@ namespace Hermes } template - void OptimumSelector::evaluate_candidates(Hermes::vector& candidates, Element* e, MeshFunction* rsln) + void OptimumSelector::evaluate_candidates(std::vector& candidates, Element* e, MeshFunction* rsln) { evaluate_cands_error(candidates, e, rsln); @@ -556,19 +571,19 @@ namespace Hermes } template - void OptimumSelector::evaluate_cands_score(Hermes::vector& candidates, Element* e) + void OptimumSelector::evaluate_cands_score(std::vector& candidates, Element* e) { // Original candidate. Cand& unrefined = candidates[0]; // Original candidate score is zero. unrefined.score = 0; - for (int i = 1; i < candidates.size(); i++) + for (unsigned short i = 1; i < candidates.size(); i++) { Cand& candidate = candidates[i]; // We are only interested in candidates decreasing the error. - if(candidate.error < unrefined.error) + if (candidate.error < unrefined.error) candidate.score = (log(unrefined.error / candidate.error)) / std::pow(candidate.dofs - unrefined.dofs, this->dof_score_exponent); else candidate.score = 0; @@ -582,54 +597,54 @@ namespace Hermes } template - void OptimumSelector::select_best_candidate(Hermes::vector& candidates, Element* e, Cand*& best_candidate, Cand* best_candidates_specific_type[4]) + void OptimumSelector::select_best_candidate(std::vector& candidates, Element* e, Cand*& best_candidate, Cand* best_candidates_specific_type[4]) { //sort according to the score const int num_cands = (int)candidates.size(); - - if(num_cands > 2) + + if (num_cands > 2) std::sort(candidates.begin() + 1, candidates.end(), compare_cand_score); // Overall best candidate. - if(candidates[1].score == 0) + if (candidates[1].score == 0) // This means that the best candidate is the 'do-nothing' one. best_candidate = &candidates[0]; else // The one with the highest score is the best. best_candidate = &candidates[1]; - for(int i = 0; i < num_cands; i++) + for (int i = 0; i < num_cands; i++) { - if(candidates[i].split == H2D_REFINEMENT_P) + if (candidates[i].split == H2D_REFINEMENT_P) { best_candidates_specific_type[H2D_REFINEMENT_P] = &candidates[i]; break; } } - for(int i = 0; i < num_cands; i++) + for (int i = 0; i < num_cands; i++) { - if(candidates[i].split == H2D_REFINEMENT_H) + if (candidates[i].split == H2D_REFINEMENT_H) { best_candidates_specific_type[H2D_REFINEMENT_H] = &candidates[i]; break; } } - for(int i = 0; i < num_cands; i++) + for (int i = 0; i < num_cands; i++) { - if(candidates[i].split == H2D_REFINEMENT_ANISO_H) + if (candidates[i].split == H2D_REFINEMENT_H_ANISO_H) { - best_candidates_specific_type[H2D_REFINEMENT_ANISO_H] = &candidates[i]; + best_candidates_specific_type[H2D_REFINEMENT_H_ANISO_H] = &candidates[i]; break; } } - for(int i = 0; i < num_cands; i++) + for (int i = 0; i < num_cands; i++) { - if(candidates[i].split == H2D_REFINEMENT_ANISO_V) + if (candidates[i].split == H2D_REFINEMENT_H_ANISO_V) { - best_candidates_specific_type[H2D_REFINEMENT_ANISO_V] = &candidates[i]; + best_candidates_specific_type[H2D_REFINEMENT_H_ANISO_V] = &candidates[i]; break; } } @@ -640,21 +655,22 @@ namespace Hermes { //make an uniform order in a case of a triangle int order_h = H2D_GET_H_ORDER(quad_order), order_v = H2D_GET_V_ORDER(quad_order); - if(element->is_triangle()) + if (element->is_triangle()) { order_v = order_h; - quad_order = H2D_MAKE_QUAD_ORDER(order_h, order_v); //in a case of a triangle, order_v is zero. Set it to order_h in order to simplify the routines. + //in a case of a triangle, order_v is zero. Set it to order_h in order to simplify the routines. + quad_order = H2D_MAKE_QUAD_ORDER(order_h, order_v); } //build candidates. - Hermes::vector candidates = create_candidates(element, quad_order); + std::vector candidates = create_candidates(element, quad_order); //there are candidates to choose from Cand* best_candidate; Cand* best_candidates_specific_type[4]; memset(best_candidates_specific_type, 0, 4 * sizeof(Cand*)); - if(candidates.size() > 1) - { + if (candidates.size() > 1) + { // evaluate candidates (sum partial projection errors, calculate dofs) evaluate_candidates(candidates, element, rsln); @@ -664,32 +680,32 @@ namespace Hermes //there is not candidate to choose from, select the original candidate else - { + { best_candidate = &candidates[0]; } - if(best_candidate == &candidates[0]) + if (best_candidate == &candidates[0]) return false; //copy result to output refinement.split = best_candidate->split; ElementToRefine::copy_orders(refinement.refinement_polynomial_order, best_candidate->p); - for(int i = 1; i < 4; i++) - if(best_candidates_specific_type[i] != nullptr) + for (int i = 1; i < 4; i++) + if (best_candidates_specific_type[i] != nullptr) ElementToRefine::copy_orders(refinement.best_refinement_polynomial_order_type[i], best_candidates_specific_type[i]->p); ElementToRefine::copy_errors(refinement.errors, best_candidate->errors); //modify orders in a case of a triangle such that order_v is zero - if(element->is_triangle()) + if (element->is_triangle()) { - for(int i = 0; i < H2D_MAX_ELEMENT_SONS; i++) + for (int i = 0; i < H2D_MAX_ELEMENT_SONS; i++) { assert(H2D_GET_V_ORDER(refinement.refinement_polynomial_order[i]) == 0 || H2D_GET_H_ORDER(refinement.refinement_polynomial_order[i]) == H2D_GET_V_ORDER(refinement.refinement_polynomial_order[i])); refinement.refinement_polynomial_order[i] = H2D_MAKE_QUAD_ORDER(H2D_GET_H_ORDER(refinement.refinement_polynomial_order[i]), 0); - for(int poly_order_type_i = 1; poly_order_type_i < 4; poly_order_type_i++) + for (int poly_order_type_i = 1; poly_order_type_i < 4; poly_order_type_i++) refinement.best_refinement_polynomial_order_type[poly_order_type_i][i] = H2D_MAKE_QUAD_ORDER(H2D_GET_H_ORDER(refinement.best_refinement_polynomial_order_type[poly_order_type_i][i]), 0); } } @@ -697,8 +713,8 @@ namespace Hermes return true; } - template class HERMES_API OptimumSelector; - template class HERMES_API OptimumSelector >; + template class HERMES_API OptimumSelector < double > ; + template class HERMES_API OptimumSelector < std::complex > ; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/refinement_selectors/order_permutator.cpp b/hermes2d/src/refinement_selectors/order_permutator.cpp index 5314d7706f..460d47110e 100644 --- a/hermes2d/src/refinement_selectors/order_permutator.cpp +++ b/hermes2d/src/refinement_selectors/order_permutator.cpp @@ -21,7 +21,7 @@ namespace Hermes { namespace RefinementSelectors { - OrderPermutator::OrderPermutator(int start_quad_order, int end_quad_order, bool iso_p, int* tgt_quad_order) + OrderPermutator::OrderPermutator(unsigned short start_quad_order, unsigned short end_quad_order, bool iso_p, unsigned short* tgt_quad_order) : start_order_h(H2D_GET_H_ORDER(start_quad_order)), start_order_v(H2D_GET_V_ORDER(start_quad_order)) , end_order_h(H2D_GET_H_ORDER(end_quad_order)), end_order_v(H2D_GET_V_ORDER(end_quad_order)) , iso_p(iso_p), tgt_quad_order(tgt_quad_order) @@ -31,9 +31,9 @@ namespace Hermes bool OrderPermutator::next() { - if(iso_p) + if (iso_p) { - if(order_h >= end_order_h || order_v >= end_order_v) + if (order_h >= end_order_h || order_v >= end_order_v) return false; order_h++; @@ -41,18 +41,18 @@ namespace Hermes } else { - if(order_h >= end_order_h && order_v >= end_order_v) + if (order_h >= end_order_h && order_v >= end_order_v) return false; order_h++; - if(order_h > end_order_h) + if (order_h > end_order_h) { order_h = start_order_h; order_v++; } } - if(tgt_quad_order != nullptr) + if (tgt_quad_order != nullptr) *tgt_quad_order = H2D_MAKE_QUAD_ORDER(order_h, order_v); return true; } @@ -61,31 +61,31 @@ namespace Hermes { order_h = start_order_h; order_v = start_order_v; - if(tgt_quad_order != nullptr) + if (tgt_quad_order != nullptr) *tgt_quad_order = H2D_MAKE_QUAD_ORDER(order_h, order_v); } - int OrderPermutator::get_order_h() const + unsigned short OrderPermutator::get_order_h() const { return order_h; } - int OrderPermutator::get_order_v() const + unsigned short OrderPermutator::get_order_v() const { return order_v; } - int OrderPermutator::get_quad_order() const + unsigned short OrderPermutator::get_quad_order() const { return H2D_MAKE_QUAD_ORDER(order_h, order_v); } - int OrderPermutator::get_start_quad_order() const + unsigned short OrderPermutator::get_start_quad_order() const { return H2D_MAKE_QUAD_ORDER(start_order_h, start_order_v); } - int OrderPermutator::get_end_quad_order() const + unsigned short OrderPermutator::get_end_quad_order() const { return H2D_MAKE_QUAD_ORDER(end_order_h, end_order_v); } diff --git a/hermes2d/src/refinement_selectors/proj_based_selector.cpp b/hermes2d/src/refinement_selectors/proj_based_selector.cpp index 316ea2adaa..93a99dc60a 100644 --- a/hermes2d/src/refinement_selectors/proj_based_selector.cpp +++ b/hermes2d/src/refinement_selectors/proj_based_selector.cpp @@ -37,19 +37,19 @@ namespace Hermes error_weight_p(H2DRS_DEFAULT_ERR_WEIGHT_P), error_weight_aniso(H2DRS_DEFAULT_ERR_WEIGHT_ANISO) { - cached_shape_vals_valid = new bool[2]; - cached_shape_ortho_vals = new TrfShape[2]; - cached_shape_vals = new TrfShape[2]; + cached_shape_vals_valid = new bool[2]; + cached_shape_ortho_vals = new TrfShape[2]; + cached_shape_vals = new TrfShape[2]; - //clean svals initialization state - std::fill(cached_shape_vals_valid, cached_shape_vals_valid + H2D_NUM_MODES, false); + //clean svals initialization state + std::fill(cached_shape_vals_valid, cached_shape_vals_valid + H2D_NUM_MODES, false); - //clear matrix cache - for (int m = 0; m < H2D_NUM_MODES; m++) + //clear matrix cache + for (int m = 0; m < H2D_NUM_MODES; m++) for (int i = 0; i < H2DRS_MAX_ORDER + 2; i++) - for (int k = 0; k < H2DRS_MAX_ORDER + 2; k++) - proj_matrix_cache[m][i][k] = nullptr; - } + for (int k = 0; k < H2DRS_MAX_ORDER + 2; k++) + proj_matrix_cache[m][i][k] = nullptr; + } template ProjBasedSelector::~ProjBasedSelector() @@ -58,11 +58,11 @@ namespace Hermes for (int m = 0; m < H2D_NUM_MODES; m++) { for (int i = 0; i < H2DRS_MAX_ORDER + 2; i++) - for (int k = 0; k < H2DRS_MAX_ORDER + 2; k++) - { + for (int k = 0; k < H2DRS_MAX_ORDER + 2; k++) + { if (proj_matrix_cache[m][i][k] != nullptr) - delete[] proj_matrix_cache[m][i][k]; - } + free_with_check(proj_matrix_cache[m][i][k], true); + } } delete[] cached_shape_vals_valid; @@ -127,7 +127,7 @@ namespace Hermes } template - void ProjBasedSelector::evaluate_cands_error(Hermes::vector& candidates, Element* e, MeshFunction* rsln) + void ProjBasedSelector::evaluate_cands_error(std::vector& candidates, Element* e, MeshFunction* rsln) { bool tri = e->is_triangle(); @@ -156,14 +156,15 @@ namespace Hermes c.errors[j] = herr[j][order][order]; error_squared += c.errors[j]; } - error_squared *= 0.25; //element of a candidate occupies 1/4 of the reference domain defined over a candidate + //element of a candidate occupies 1/4 of the reference domain defined over a candidate + error_squared *= 0.25; break; case H2D_REFINEMENT_P: { - int order = H2D_GET_H_ORDER(c.p[0]); - c.errors[0] = perr[order][order]; - error_squared = perr[order][order]; + int order = H2D_GET_H_ORDER(c.p[0]); + c.errors[0] = perr[order][order]; + error_squared = perr[order][order]; } break; @@ -184,27 +185,29 @@ namespace Hermes c.errors[j] = herr[j][order_h][order_v]; error_squared += c.errors[j]; } - error_squared *= 0.25; //element of a candidate occupies 1/4 of the reference domain defined over a candidate + //element of a candidate occupies 1/4 of the reference domain defined over a candidate + error_squared *= 0.25; break; - case H2D_REFINEMENT_ANISO_H: - case H2D_REFINEMENT_ANISO_V: + case H2D_REFINEMENT_H_ANISO_H: + case H2D_REFINEMENT_H_ANISO_V: { - error_squared = 0.0; - for (int j = 0; j < 2; j++) - { - c.errors[j] = anisoerr[(c.split == H2D_REFINEMENT_ANISO_H) ? j : j + 2][H2D_GET_H_ORDER(c.p[j])][H2D_GET_V_ORDER(c.p[j])]; - error_squared += c.errors[j]; - } - error_squared *= 0.5; //element of a candidate occupies 1/2 of the reference domain defined over a candidate + error_squared = 0.0; + for (int j = 0; j < 2; j++) + { + c.errors[j] = anisoerr[(c.split == H2D_REFINEMENT_H_ANISO_H) ? j : j + 2][H2D_GET_H_ORDER(c.p[j])][H2D_GET_V_ORDER(c.p[j])]; + error_squared += c.errors[j]; + } + //element of a candidate occupies 1/2 of the reference domain defined over a candidate + error_squared *= 0.5; } break; case H2D_REFINEMENT_P: { - int order_h = H2D_GET_H_ORDER(c.p[0]), order_v = H2D_GET_V_ORDER(c.p[0]); - c.errors[0] = perr[order_h][order_v]; - error_squared = c.errors[0]; + int order_h = H2D_GET_H_ORDER(c.p[0]), order_v = H2D_GET_V_ORDER(c.p[0]); + c.errors[0] = perr[order_h][order_v]; + error_squared = c.errors[0]; } break; @@ -220,8 +223,8 @@ namespace Hermes switch (c.split) { case H2D_REFINEMENT_H: c.error *= error_weight_h; break; - case H2D_REFINEMENT_ANISO_H: - case H2D_REFINEMENT_ANISO_V: c.error *= error_weight_aniso; break; + case H2D_REFINEMENT_H_ANISO_H: + case H2D_REFINEMENT_H_ANISO_V: c.error *= error_weight_aniso; break; case H2D_REFINEMENT_P: c.error *= error_weight_p; break; default: throw Hermes::Exceptions::Exception("Unknown split type \"%d\" at candidate %d", c.split, i); } @@ -322,8 +325,8 @@ namespace Hermes if (base_element->active) { Trf* sub_trfs[4] = { &trfs[0], &trfs[1], &trfs[2], &trfs[3] }; - Hermes::vector* p_trf_svals[4] = { &svals[0], &svals[1], &svals[2], &svals[3] }; - Hermes::vector* p_trf_ortho_svals[4] = { &ortho_svals[0], &ortho_svals[1], &ortho_svals[2], &ortho_svals[3] }; + std::vector* p_trf_svals[4] = { &svals[0], &svals[1], &svals[2], &svals[3] }; + std::vector* p_trf_ortho_svals[4] = { &ortho_svals[0], &ortho_svals[1], &ortho_svals[2], &ortho_svals[3] }; for (int son = 0; son < H2D_MAX_ELEMENT_SONS; son++) { int sub_rval[1] = { son }; @@ -336,8 +339,8 @@ namespace Hermes else { Trf* p_trf_identity[1] = { &trfs[H2D_TRF_IDENTITY] }; - Hermes::vector* p_trf_svals[1] = { &svals[H2D_TRF_IDENTITY] }; - Hermes::vector* p_trf_ortho_svals[1] = { &ortho_svals[H2D_TRF_IDENTITY] }; + std::vector* p_trf_svals[1] = { &svals[H2D_TRF_IDENTITY] }; + std::vector* p_trf_ortho_svals[1] = { &ortho_svals[H2D_TRF_IDENTITY] }; for (int son = 0; son < H2D_MAX_ELEMENT_SONS; son++) { int sub_rval[1] = { son }; @@ -360,8 +363,8 @@ namespace Hermes Trf* sub_trfs[2] = { &trfs[tr[version][0]], &trfs[tr[version][1]] }; Element* sub_domains[2] = { base_element, base_element }; int sub_rval[2] = { tr[version][0], tr[version][1] }; - Hermes::vector* sub_svals[2] = { &svals[tr[version][0]], &svals[tr[version][1]] }; - Hermes::vector* sub_ortho_svals[2] = { &ortho_svals[tr[version][0]], &ortho_svals[tr[version][1]] }; + std::vector* sub_svals[2] = { &svals[tr[version][0]], &svals[tr[version][1]] }; + std::vector* sub_ortho_svals[2] = { &ortho_svals[tr[version][0]], &ortho_svals[tr[version][1]] }; calc_error_cand_element(mode, gip_points, num_gip_points , 2, sub_domains, sub_trfs, sub_rval , sub_svals, sub_ortho_svals @@ -370,15 +373,17 @@ namespace Hermes } else { - const int sons[4][2] = { { 0, 1 }, { 3, 2 }, { 0, 3 }, { 1, 2 } }; //indices of sons for sub-areas - const int tr[4][2] = { { 6, 7 }, { 6, 7 }, { 4, 5 }, { 4, 5 } }; //indices of ref. domain transformations for sub-areas + //indices of sons for sub-areas + const int sons[4][2] = { { 0, 1 }, { 3, 2 }, { 0, 3 }, { 1, 2 } }; + //indices of ref. domain transformations for sub-areas + const int tr[4][2] = { { 6, 7 }, { 6, 7 }, { 4, 5 }, { 4, 5 } }; for (int version = 0; version < 4; version++) { // 2 elements for vertical split, 2 elements for horizontal split Trf* sub_trfs[2] = { &trfs[tr[version][0]], &trfs[tr[version][1]] }; Element* sub_domains[2] = { base_element->sons[sons[version][0]], base_element->sons[sons[version][1]] }; int sub_rval[2] = { sons[version][0], sons[version][1] }; - Hermes::vector* sub_svals[2] = { &svals[tr[version][0]], &svals[tr[version][1]] }; - Hermes::vector* sub_ortho_svals[2] = { &ortho_svals[tr[version][0]], &ortho_svals[tr[version][1]] }; + std::vector* sub_svals[2] = { &svals[tr[version][0]], &svals[tr[version][1]] }; + std::vector* sub_ortho_svals[2] = { &ortho_svals[tr[version][0]], &ortho_svals[tr[version][1]] }; calc_error_cand_element(mode, gip_points, num_gip_points , 2, sub_domains, sub_trfs, sub_rval , sub_svals, sub_ortho_svals @@ -394,8 +399,8 @@ namespace Hermes { Trf* sub_trfs[4] = { &trfs[0], &trfs[1], &trfs[2], &trfs[3] }; int sub_rval[4] = { 0, 1, 2, 3 }; - Hermes::vector* sub_svals[4] = { &svals[0], &svals[1], &svals[2], &svals[3] }; - Hermes::vector* sub_ortho_svals[4] = { &ortho_svals[0], &ortho_svals[1], &ortho_svals[2], &ortho_svals[3] }; + std::vector* sub_svals[4] = { &svals[0], &svals[1], &svals[2], &svals[3] }; + std::vector* sub_ortho_svals[4] = { &ortho_svals[0], &ortho_svals[1], &ortho_svals[2], &ortho_svals[3] }; Element* sub_domains[4] = { base_element, base_element, base_element, base_element }; calc_error_cand_element(mode, gip_points, num_gip_points @@ -407,8 +412,8 @@ namespace Hermes { Trf* sub_trfs[4] = { &trfs[0], &trfs[1], &trfs[2], &trfs[3] }; int sub_rval[4] = { 0, 1, 2, 3 }; - Hermes::vector* sub_svals[4] = { &svals[0], &svals[1], &svals[2], &svals[3] }; - Hermes::vector* sub_ortho_svals[4] = { &ortho_svals[0], &ortho_svals[1], &ortho_svals[2], &ortho_svals[3] }; + std::vector* sub_svals[4] = { &svals[0], &svals[1], &svals[2], &svals[3] }; + std::vector* sub_ortho_svals[4] = { &ortho_svals[0], &ortho_svals[1], &ortho_svals[2], &ortho_svals[3] }; calc_error_cand_element(mode, gip_points, num_gip_points , 4, base_element->sons, sub_trfs, sub_rval @@ -426,7 +431,7 @@ namespace Hermes void ProjBasedSelector::calc_error_cand_element(const ElementMode2D mode , double3* gip_points, int num_gip_points , const int num_sub, Element** sub_domains, Trf** sub_trfs, int* sons - , Hermes::vector** sub_nonortho_svals, Hermes::vector** sub_ortho_svals + , std::vector** sub_nonortho_svals, std::vector** sub_ortho_svals , const typename OptimumSelector::CandsInfo& info , CandElemProjError errors_squared, Scalar* rval[H2D_MAX_ELEMENT_SONS][MAX_NUMBER_FUNCTION_VALUES_FOR_SELECTORS] ) @@ -435,20 +440,22 @@ namespace Hermes int max_num_shapes = this->next_order_shape[mode][this->max_order == H2DRS_DEFAULT_ORDER ? H2DRS_MAX_ORDER : this->max_order]; Scalar* right_side = new Scalar[max_num_shapes]; int* shape_inxs = new int[max_num_shapes]; - int* indx = new int[max_num_shapes]; //solver data - double* d = new double[max_num_shapes]; //solver data + //solver data + int* indx = new int[max_num_shapes]; + //solver data + double* d = new double[max_num_shapes]; double** proj_matrix = new_matrix(max_num_shapes, max_num_shapes); ProjMatrixCache& proj_matrices = proj_matrix_cache[mode]; - Hermes::vector::ShapeInx>& full_shape_indices = this->shape_indices[mode]; + std::vector::ShapeInx>& full_shape_indices = this->shape_indices[mode]; //check whether ortho-svals are available bool ortho_svals_available = true; for (int i = 0; i < num_sub && ortho_svals_available; i++) ortho_svals_available &= !sub_ortho_svals[i]->empty(); - /// An array of cached right-hand side values. - Hermes::vector< ValueCacheItem > nonortho_rhs_cache; - Hermes::vector< ValueCacheItem > ortho_rhs_cache; + // An array of cached right-hand side values. + std::vector< ValueCacheItem > nonortho_rhs_cache; + std::vector< ValueCacheItem > ortho_rhs_cache; for (int i = 0; i <= this->max_shape_inx[mode]; i++) { nonortho_rhs_cache.push_back(ValueCacheItem()); @@ -486,8 +493,8 @@ namespace Hermes bool use_ortho = ortho_svals_available && order_perm.get_order_h() == order_perm.get_order_v(); //select a cache - Hermes::vector< ValueCacheItem >& rhs_cache = use_ortho ? ortho_rhs_cache : nonortho_rhs_cache; - Hermes::vector** sub_svals = use_ortho ? sub_ortho_svals : sub_nonortho_svals; + std::vector< ValueCacheItem >& rhs_cache = use_ortho ? ortho_rhs_cache : nonortho_rhs_cache; + std::vector** sub_svals = use_ortho ? sub_ortho_svals : sub_nonortho_svals; //calculate projection matrix iff no ortho is used if (!use_ortho) @@ -503,7 +510,8 @@ namespace Hermes } } - copy_matrix(proj_matrix, proj_matrices[order_h][order_v], num_shapes, num_shapes); //copy projection matrix because original matrix will be modified + //copy projection matrix because original matrix will be modified + copy_matrix(proj_matrix, proj_matrices[order_h][order_v], num_shapes, num_shapes); } //build right side (fill cache values that are missing) @@ -512,7 +520,7 @@ namespace Hermes Element* this_sub_domain = sub_domains[inx_sub]; ElemSubTrf this_sub_trf = { sub_trfs[inx_sub], 1 / sub_trfs[inx_sub]->m[0], 1 / sub_trfs[inx_sub]->m[1] }; ElemGIP this_sub_gip = { gip_points, num_gip_points }; - Hermes::vector& this_sub_svals = *(sub_svals[inx_sub]); + std::vector& this_sub_svals = *(sub_svals[inx_sub]); for (int k = 0; k < num_shapes; k++) { @@ -553,7 +561,8 @@ namespace Hermes error_squared += evaluate_error_squared_subdomain(this_sub_domain, this_sub_gip, sons[inx_sub], this_sub_trf, elem_proj, rval); } - errors_squared[order_h][order_v] = error_squared * sub_area_corr_coef; //apply area correction coefficient + //apply area correction coefficient + errors_squared[order_h][order_v] = error_squared * sub_area_corr_coef; } while (order_perm.next()); free_with_check(proj_matrix, true); @@ -563,8 +572,8 @@ namespace Hermes delete[] d; } - template class HERMES_API ProjBasedSelector; - template class HERMES_API ProjBasedSelector >; + template class HERMES_API ProjBasedSelector < double > ; + template class HERMES_API ProjBasedSelector < std::complex > ; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/refinement_selectors/selector.cpp b/hermes2d/src/refinement_selectors/selector.cpp index 0d77e8b60e..5a383ba78f 100644 --- a/hermes2d/src/refinement_selectors/selector.cpp +++ b/hermes2d/src/refinement_selectors/selector.cpp @@ -12,10 +12,10 @@ namespace Hermes bool HOnlySelector::select_refinement(Element* element, int order, MeshFunction* rsln, ElementToRefine& refinement) { refinement.split = H2D_REFINEMENT_H; - refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_H][0] = - refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_H][1] = - refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_H][2] = - refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_H][3] = + refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_H][0] = + refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_H][1] = + refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_H][2] = + refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_H][3] = order; ElementToRefine::copy_orders(refinement.refinement_polynomial_order, refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_H]); return true; @@ -25,9 +25,9 @@ namespace Hermes POnlySelector::POnlySelector(int max_order, int order_h_inc, int order_v_inc) : Selector(max_order), order_h_inc(order_h_inc), order_v_inc(order_v_inc) { - if(order_h_inc < 0) + if (order_h_inc < 0) throw Hermes::Exceptions::ValueException("horizontal increase", order_h_inc, 0); - if(order_v_inc < 0) + if (order_v_inc < 0) throw Hermes::Exceptions::ValueException("vertical increase", order_v_inc, 0); } @@ -38,31 +38,31 @@ namespace Hermes //determin max. order int max_allowed_order = this->max_order; - if(this->max_order == H2DRS_DEFAULT_ORDER) + if (this->max_order == H2DRS_DEFAULT_ORDER) max_allowed_order = H2DRS_MAX_ORDER; //calculate new_ order int order_h = H2D_GET_H_ORDER(order), order_v = H2D_GET_V_ORDER(order); int new_order_h = std::min(max_allowed_order, order_h + order_h_inc); int new_order_v = std::min(max_allowed_order, order_v + order_v_inc); - if(element->is_triangle()) + if (element->is_triangle()) refinement.refinement_polynomial_order[0] = refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_P][0] = new_order_h; else refinement.refinement_polynomial_order[0] = refinement.best_refinement_polynomial_order_type[H2D_REFINEMENT_P][0] = H2D_MAKE_QUAD_ORDER(new_order_h, new_order_v); //decide if successful - if(new_order_h > order_h || new_order_v > order_v) + if (new_order_h > order_h || new_order_v > order_v) return true; else return false; } - template class HERMES_API Selector; - template class HERMES_API Selector >; - template class HERMES_API HOnlySelector; - template class HERMES_API HOnlySelector >; - template class HERMES_API POnlySelector; - template class HERMES_API POnlySelector >; + template class HERMES_API Selector < double > ; + template class HERMES_API Selector < std::complex > ; + template class HERMES_API HOnlySelector < double > ; + template class HERMES_API HOnlySelector < std::complex > ; + template class HERMES_API POnlySelector < double > ; + template class HERMES_API POnlySelector < std::complex > ; } } } \ No newline at end of file diff --git a/hermes2d/src/shapeset/precalc.cpp b/hermes2d/src/shapeset/precalc.cpp index 168f14ad65..1af7780bb1 100644 --- a/hermes2d/src/shapeset/precalc.cpp +++ b/hermes2d/src/shapeset/precalc.cpp @@ -17,6 +17,11 @@ #include "quad_all.h" #include "precalc.h" #include "mesh.h" +#include "shapeset/shapeset_h1_all.h" +#include "shapeset/shapeset_l2_all.h" +#include "shapeset/shapeset_hc_all.h" +#include "shapeset/shapeset_hd_all.h" + namespace Hermes { namespace Hermes2D @@ -51,14 +56,14 @@ namespace Hermes this->order = std::max(H2D_GET_H_ORDER(shapeset->get_order(index, element->get_mode())), H2D_GET_V_ORDER(shapeset->get_order(index, element->get_mode()))); } - void PrecalcShapeset::precalculate(int order, int mask) + void PrecalcShapeset::precalculate(unsigned short order, unsigned short mask) { Function::precalculate(order, mask); - int np = this->quads[cur_quad]->get_num_points(order, this->element->get_mode()); + unsigned char np = this->quads[cur_quad]->get_num_points(order, this->element->get_mode()); double3* pt = this->quads[cur_quad]->get_points(order, this->element->get_mode()); - int i, j, k; + unsigned short j, k; ElementMode2D mode = element->get_mode(); @@ -72,18 +77,48 @@ namespace Hermes } for (j = 0; j < num_components; j++) - for (k = 0; k < H2D_NUM_FUNCTION_VALUES; k++) - if (mask & idx2mask[k][j]) - for (i = 0; i < np; i++) - this->values[j][k][i] = shapeset->get_value(k, index, ref_points[i][0], ref_points[i][1], j, mode); + for (k = 0; k < H2D_NUM_FUNCTION_VALUES; k++) + if (mask & idx2mask[k][j]) + for (short i = 0; i < np; i++) + this->values[j][k][i] = shapeset->get_value(k, index, ref_points[i][0], ref_points[i][1], j, mode); } else { - for (j = 0; j < num_components; j++) - for (k = 0; k < H2D_NUM_FUNCTION_VALUES; k++) - if (mask & idx2mask[k][j]) - for (i = 0; i < np; i++) - this->values[j][k][i] = shapeset->get_value(k, index, pt[i][0], pt[i][1], j, mode); + if (this->num_components == 1) + { + if (mode == HERMES_MODE_TRIANGLE) + { + if (mask & idx2mask[0][0]) + for (short i = 0; i < np; i++) + this->values[0][0][i] = shapeset->get_fn_value_0_tri(index, pt[i][0], pt[i][1]); + if (mask & idx2mask[1][0]) + for (short i = 0; i < np; i++) + this->values[0][1][i] = shapeset->get_dx_value_0_tri(index, pt[i][0], pt[i][1]); + if (mask & idx2mask[2][0]) + for (short i = 0; i < np; i++) + this->values[0][2][i] = shapeset->get_dy_value_0_tri(index, pt[i][0], pt[i][1]); + } + else + { + if (mask & idx2mask[0][0]) + for (short i = 0; i < np; i++) + this->values[0][0][i] = shapeset->get_fn_value_0_quad(index, pt[i][0], pt[i][1]); + if (mask & idx2mask[1][0]) + for (short i = 0; i < np; i++) + this->values[0][1][i] = shapeset->get_dx_value_0_quad(index, pt[i][0], pt[i][1]); + if (mask & idx2mask[2][0]) + for (short i = 0; i < np; i++) + this->values[0][2][i] = shapeset->get_dy_value_0_quad(index, pt[i][0], pt[i][1]); + } + } + else + { + for (j = 0; j < num_components; j++) + for (k = 0; k < H2D_NUM_FUNCTION_VALUES; k++) + if (mask & idx2mask[k][j]) + for (short i = 0; i < np; i++) + this->values[j][k][i] = shapeset->get_value(k, index, pt[i][0], pt[i][1], j, mode); + } } } @@ -91,8 +126,6 @@ namespace Hermes { } - extern PrecalcShapeset ref_map_pss; - PrecalcShapeset::~PrecalcShapeset() { free(); @@ -113,9 +146,320 @@ namespace Hermes return shapeset->get_space_type(); } - int PrecalcShapeset::get_edge_fn_order(int edge) + unsigned short PrecalcShapeset::get_edge_fn_order(int edge) { return H2D_MAKE_EDGE_ORDER(element->get_mode(), edge, shapeset->get_order(index, element->get_mode())); } + + // This is a technical thing - to be able to share the storage +#ifdef HERMES_FOR_AGROS + static PrecalcShapesetAssemblingStorage* PrecalcShapesetAssemblingTables[H2D_NUM_SHAPESETS] = { nullptr, nullptr }; +#else + static PrecalcShapesetAssemblingStorage* PrecalcShapesetAssemblingTables[H2D_NUM_SHAPESETS] = { nullptr, nullptr, nullptr, nullptr, nullptr }; +#endif + +#ifndef HERMES_FOR_AGROS + static PrecalcShapesetAssemblingInternal temp[H2D_NUM_SHAPESETS] = { PrecalcShapesetAssemblingInternal(new HcurlShapesetGradLeg), PrecalcShapesetAssemblingInternal(new HdivShapesetLegendre), PrecalcShapesetAssemblingInternal(new L2ShapesetLegendre), PrecalcShapesetAssemblingInternal(new L2ShapesetTaylor), PrecalcShapesetAssemblingInternal(new H1ShapesetJacobi) }; +#endif + + PrecalcShapesetAssemblingInternal::PrecalcShapesetAssemblingInternal(Shapeset* shapeset) : PrecalcShapesetAssembling(shapeset) + { + } + + PrecalcShapesetAssemblingInternal::~PrecalcShapesetAssemblingInternal() + { + delete PrecalcShapesetAssemblingTables[(int)this->shapeset->get_id()]; + delete this->shapeset; + } + + PrecalcShapesetAssembling::PrecalcShapesetAssembling(Shapeset* shapeset) : PrecalcShapeset(shapeset), storage(nullptr) + { + if (PrecalcShapesetAssemblingTables[(int)shapeset->get_id()]) + { + this->storage = PrecalcShapesetAssemblingTables[(int)shapeset->get_id()]; + this->storage->ref_count++; + } + if (!this->storage) + { +#pragma omp critical (pss_table_creation) + { + this->storage = new PrecalcShapesetAssemblingStorage(this->shapeset); + this->storage->ref_count++; + PrecalcShapesetAssemblingTables[(int)shapeset->get_id()] = storage; + } + } + } + + PrecalcShapesetAssembling::PrecalcShapesetAssembling(const PrecalcShapesetAssembling& other) : PrecalcShapeset(other.shapeset) + { + this->storage = other.storage; + this->storage->ref_count++; + } + + PrecalcShapesetAssembling::~PrecalcShapesetAssembling() + { + } + + const double* PrecalcShapesetAssembling::get_fn_values(int component) const + { + if (this->attempt_to_reuse(this->order)) + return this->storage->PrecalculatedValues[this->element->get_mode()][0][this->order][this->index]; + assert(this->values_valid); + return &values[component][0][0]; + } + + const double* PrecalcShapesetAssembling::get_dx_values(int component) const + { + if (this->attempt_to_reuse(this->order)) + return this->storage->PrecalculatedValues[this->element->get_mode()][1][this->order][this->index]; + assert(this->values_valid); + return &values[component][1][0]; + } + + const double* PrecalcShapesetAssembling::get_dy_values(int component) const + { + if (this->attempt_to_reuse(this->order)) + return this->storage->PrecalculatedValues[this->element->get_mode()][2][this->order][this->index]; + assert(this->values_valid); + return &values[component][2][0]; + } + +#ifdef H2D_USE_SECOND_DERIVATIVES + const double* PrecalcShapesetAssembling::get_dxx_values(int component) const + { + assert(this->values_valid); + return &values[component][3][0]; + } + + const double* PrecalcShapesetAssembling::get_dyy_values(int component) const + { + assert(this->values_valid); + return &values[component][4][0]; + } + + const double* PrecalcShapesetAssembling::get_dxy_values(int component) const + { + assert(this->values_valid); + return &values[component][5][0]; + } +#endif + + bool PrecalcShapesetAssembling::attempt_to_reuse(unsigned short order_) const + { + return (this->reuse_possible() && this->storage->PrecalculatedInfo[this->element->get_mode()][order_][this->index]); + } + + bool PrecalcShapesetAssembling::reuse_possible() const + { + return (this->index >= 0 && this->get_quad_2d()->get_id() == 1 && this->sub_idx == 0 && this->num_components == 1); + } + + const double* PrecalcShapesetAssembling::get_values(int component, unsigned short item) const + { + if (item == 0) + return this->get_fn_values(component); + else if (item == 1) + return this->get_dx_values(component); + else if (item == 2) + return this->get_dy_values(component); + else + return Function::get_values(component, item); + } + + void PrecalcShapesetAssembling::precalculate(unsigned short order_, unsigned short mask) + { + if (this->attempt_to_reuse(order_)) + return; + else + { + Function::precalculate(order_, mask); + + unsigned char np = this->quads[cur_quad]->get_num_points(order_, this->element->get_mode()); + double3* pt = this->quads[cur_quad]->get_points(order_, this->element->get_mode()); + + unsigned short j, k; + + ElementMode2D mode = element->get_mode(); + + if (this->num_components == 1) + { + if (this->reuse_possible()) + { +#pragma omp critical (precalculatingPSS) + { + double* valuePointer; + if (mode == HERMES_MODE_TRIANGLE) + { + valuePointer = this->storage->PrecalculatedValues[HERMES_MODE_TRIANGLE][0][order_][index]; + for (short i = 0; i < np; i++) + valuePointer[i] = shapeset->get_fn_value_0_tri(index, pt[i][0], pt[i][1]); + + valuePointer = this->storage->PrecalculatedValues[HERMES_MODE_TRIANGLE][1][order_][index]; + for (short i = 0; i < np; i++) + valuePointer[i] = shapeset->get_dx_value_0_tri(index, pt[i][0], pt[i][1]); + + valuePointer = this->storage->PrecalculatedValues[HERMES_MODE_TRIANGLE][2][order_][index]; + for (short i = 0; i < np; i++) + valuePointer[i] = shapeset->get_dy_value_0_tri(index, pt[i][0], pt[i][1]); + + this->storage->PrecalculatedInfo[HERMES_MODE_TRIANGLE][order_][index] = true; + } + else + { + valuePointer = this->storage->PrecalculatedValues[HERMES_MODE_QUAD][0][order_][index]; + for (short i = 0; i < np; i++) + valuePointer[i] = shapeset->get_fn_value_0_quad(index, pt[i][0], pt[i][1]); + + valuePointer = this->storage->PrecalculatedValues[HERMES_MODE_QUAD][1][order_][index]; + for (short i = 0; i < np; i++) + valuePointer[i] = shapeset->get_dx_value_0_quad(index, pt[i][0], pt[i][1]); + + valuePointer = this->storage->PrecalculatedValues[HERMES_MODE_QUAD][2][order_][index]; + for (short i = 0; i < np; i++) + valuePointer[i] = shapeset->get_dy_value_0_quad(index, pt[i][0], pt[i][1]); + + this->storage->PrecalculatedInfo[HERMES_MODE_QUAD][order_][index] = true; + } + } + } + else + { + // Correction of points for sub-element mappings. + if (this->sub_idx != 0) + { + for (short i = 0; i < np; i++) + { + ref_points[i][0] = ctm->m[0] * pt[i][0] + ctm->t[0]; + ref_points[i][1] = ctm->m[1] * pt[i][1] + ctm->t[1]; + } + + for (k = 0; k < H2D_NUM_FUNCTION_VALUES; k++) + if (mask & idx2mask[k][0]) + for (short i = 0; i < np; i++) + this->values[0][k][i] = shapeset->get_value(k, index, ref_points[i][0], ref_points[i][1], 0, mode); + } + else if (mode == HERMES_MODE_TRIANGLE) + { + if (mask & idx2mask[0][0]) + for (short i = 0; i < np; i++) + this->values[0][0][i] = shapeset->get_fn_value_0_tri(index, pt[i][0], pt[i][1]); + if (mask & idx2mask[1][0]) + for (short i = 0; i < np; i++) + this->values[0][1][i] = shapeset->get_dx_value_0_tri(index, pt[i][0], pt[i][1]); + if (mask & idx2mask[2][0]) + for (short i = 0; i < np; i++) + this->values[0][2][i] = shapeset->get_dy_value_0_tri(index, pt[i][0], pt[i][1]); + } + else + { + if (mask & idx2mask[0][0]) + for (short i = 0; i < np; i++) + this->values[0][0][i] = shapeset->get_fn_value_0_quad(index, pt[i][0], pt[i][1]); + if (mask & idx2mask[1][0]) + for (short i = 0; i < np; i++) + this->values[0][1][i] = shapeset->get_dx_value_0_quad(index, pt[i][0], pt[i][1]); + if (mask & idx2mask[2][0]) + for (short i = 0; i < np; i++) + this->values[0][2][i] = shapeset->get_dy_value_0_quad(index, pt[i][0], pt[i][1]); + } + } + } + else + { + // Correction of points for sub-element mappings. + if (this->sub_idx != 0) + { + for (short i = 0; i < np; i++) + { + ref_points[i][0] = ctm->m[0] * pt[i][0] + ctm->t[0]; + ref_points[i][1] = ctm->m[1] * pt[i][1] + ctm->t[1]; + } + + for (j = 0; j < num_components; j++) + for (k = 0; k < H2D_NUM_FUNCTION_VALUES; k++) + if (mask & idx2mask[k][j]) + for (short i = 0; i < np; i++) + this->values[j][k][i] = shapeset->get_value(k, index, ref_points[i][0], ref_points[i][1], j, mode); + } + else + { + for (j = 0; j < num_components; j++) + for (k = 0; k < H2D_NUM_FUNCTION_VALUES; k++) + if (mask & idx2mask[k][j]) + for (short i = 0; i < np; i++) + this->values[j][k][i] = shapeset->get_value(k, index, pt[i][0], pt[i][1], j, mode); + } + } + } + } + + PrecalcShapesetAssemblingStorage::PrecalcShapesetAssemblingStorage(Shapeset* shapeset) : shapeset_id(shapeset->get_id()), ref_count(0) + { + this->max_index[0] = shapeset->get_max_index(HERMES_MODE_TRIANGLE); + this->max_index[1] = shapeset->get_max_index(HERMES_MODE_QUAD); + + for (int i = 0; i < H2D_NUM_MODES; i++) + { + unsigned short g_max, np; + if (i == HERMES_MODE_TRIANGLE) + { + g_max = g_max_tri + 1 + 3 * g_max_tri + 3; + np = H2D_MAX_INTEGRATION_POINTS_COUNT_TRI; + } + else + { + g_max = g_max_quad + 1 + 4 * g_max_quad + 4; + np = H2D_MAX_INTEGRATION_POINTS_COUNT_QUAD; + } + + unsigned short local_base_size = this->max_index[i] + 1; + + this->PrecalculatedInfo[i] = malloc_with_check(g_max); + + for (int j = 0; j < H2D_NUM_FUNCTION_VALUES; j++) + { + this->PrecalculatedValues[i][j] = malloc_with_check(g_max); + + for (int k = 0; k < g_max; k++) + { + this->PrecalculatedValues[i][j][k] = malloc_with_check(local_base_size); + if (j == 0) + this->PrecalculatedInfo[i][k] = calloc_with_check(local_base_size); + + for (int l = 0; l < local_base_size; l++) + this->PrecalculatedValues[i][j][k][l] = malloc_with_check(np); + } + } + } + } + + PrecalcShapesetAssemblingStorage::~PrecalcShapesetAssemblingStorage() + { + for (int i = 0; i < H2D_NUM_MODES; i++) + { + unsigned short g_max; + if (i == HERMES_MODE_TRIANGLE) + g_max = g_max_tri + 1 + 3 * g_max_tri + 3; + else + g_max = g_max_quad + 1 + 4 * g_max_quad + 4; + + unsigned short local_base_size = this->max_index[i] + 1; + + for (int j = 0; j < H2D_NUM_FUNCTION_VALUES; j++) + { + for (int k = 0; k < g_max; k++) + { + for (int l = 0; l < local_base_size; l++) + free_with_check(this->PrecalculatedValues[i][j][k][l]); + free_with_check(this->PrecalculatedValues[i][j][k]); + if (j == 0) + free_with_check(this->PrecalculatedInfo[i][k]); + } + + free_with_check(this->PrecalculatedValues[i][j]); + free_with_check(this->PrecalculatedInfo[i][j]); + } + } + } } -} \ No newline at end of file +} diff --git a/hermes2d/src/shapeset/shapeset.cpp b/hermes2d/src/shapeset/shapeset.cpp index 6742b7af67..a59c53bfb9 100644 --- a/hermes2d/src/shapeset/shapeset.cpp +++ b/hermes2d/src/shapeset/shapeset.cpp @@ -24,7 +24,7 @@ namespace Hermes { namespace Hermes2D { - double* Shapeset::calculate_constrained_edge_combination(int order, int part, int ori, ElementMode2D mode) + double* Shapeset::calculate_constrained_edge_combination(unsigned short order, unsigned short part, unsigned short ori, ElementMode2D mode) { /* "ebias" is the order of the first edge function, this has to be subtracted @@ -34,7 +34,7 @@ namespace Hermes assert((order - ebias) >= 0); assert(part >= 0); - int i, j, n; + unsigned short i, j, n; // determine the interval of the edge for (n = 2; n <= part; n <<= 1) @@ -44,7 +44,7 @@ namespace Hermes double hi = -((double)part * n2 - 1.0); double lo = -((double)(part + 1) * n2 - 1.0); - int idx[16]; + unsigned short idx[16]; ori = ori ? 0 : 1; for (i = 0; i <= order; i++) idx[i] = get_edge_index(0, ori, i, mode); @@ -66,14 +66,14 @@ namespace Hermes // fill the matrix of the linear system n = order + 1 - ebias; - int space_type = this->get_space_type(); - int component = (space_type == HERMES_HDIV_SPACE) ? 1 : 0; + unsigned short space_type = this->get_space_type(); + unsigned short component = (space_type == HERMES_HDIV_SPACE) ? 1 : 0; double** a = new_matrix(n, n); double* b = malloc_with_check(n); for (i = 0; i < n; i++) { // chebyshev point - int o = (ebias == 0) ? order + 1 : order; + unsigned short o = (ebias == 0) ? order + 1 : order; double p = cos((i + 1) * M_PI / o); double r = (p + 1.0) * 0.5; double s = 1.0 - r; @@ -88,7 +88,7 @@ namespace Hermes // solve the system double d; - int* iperm = malloc_with_check(n); + unsigned short* iperm = malloc_with_check(n); ludcmp(a, n, iperm, &d); lubksb(a, n, iperm, b); @@ -99,9 +99,9 @@ namespace Hermes return b; } - double* Shapeset::get_constrained_edge_combination(int order, int part, int ori, int& nitems, ElementMode2D mode) + double* Shapeset::get_constrained_edge_combination(unsigned short order, unsigned short part, unsigned short ori, unsigned short& nitems, ElementMode2D mode) { - int index = 2 * ((max_order + 1 - ebias)*part + (order - ebias)) + ori; + unsigned short index = 2 * ((max_order + 1 - ebias)*part + (order - ebias)) + ori; // allocate/reallocate the array if necessary if (!this->comb_table) @@ -122,7 +122,7 @@ namespace Hermes #pragma omp critical { // adjust table_size to accommodate the required depth - int old_size = table_size; + unsigned short old_size = table_size; while (index >= table_size) table_size *= 2; @@ -160,16 +160,16 @@ namespace Hermes } } - double Shapeset::get_constrained_value(int n, int index, double x, double y, int component, ElementMode2D mode) + double Shapeset::get_constrained_value(int n, int index, double x, double y, unsigned short component, ElementMode2D mode) { index = -1 - index; - int part = (unsigned)index >> 7; - int order = (index >> 3) & 15; - int edge = (index >> 1) & 3; - int ori = index & 1; + unsigned short part = (unsigned)index >> 7; + unsigned short order = (index >> 3) & 15; + unsigned short edge = (index >> 1) & 3; + unsigned short ori = index & 1; - int i, nc; + unsigned short i, nc; double sum, *comb = get_constrained_edge_combination(order, part, ori, nc, mode); sum = 0.0; @@ -182,19 +182,19 @@ namespace Hermes Shapeset::~Shapeset() { free_constrained_edge_combinations(); } - int Shapeset::get_max_order() const + unsigned short Shapeset::get_max_order() const { return max_order; } - int Shapeset::get_min_order() const + unsigned short Shapeset::get_min_order() const { return min_order; } - int Shapeset::get_num_components() const { return num_components; } + unsigned char Shapeset::get_num_components() const { return num_components; } - int Shapeset::get_vertex_index(int vertex, ElementMode2D mode) const + short Shapeset::get_vertex_index(int vertex, ElementMode2D mode) const { #ifdef _DEBUG if (mode == HERMES_MODE_TRIANGLE) @@ -205,7 +205,7 @@ namespace Hermes return vertex_indices[mode][vertex]; } - int Shapeset::get_edge_index(int edge, int ori, int order, ElementMode2D mode) const + short Shapeset::get_edge_index(unsigned char edge, unsigned short ori, unsigned short order, ElementMode2D mode) const { #ifdef _DEBUG if (mode == HERMES_MODE_TRIANGLE) @@ -218,19 +218,19 @@ namespace Hermes return edge_indices[mode][edge][2 * order + ori]; } - int* Shapeset::get_bubble_indices(int order, ElementMode2D mode) const + short* Shapeset::get_bubble_indices(unsigned short order, ElementMode2D mode) const { #ifdef _DEBUG assert(H2D_GET_H_ORDER(order) >= 0 && H2D_GET_H_ORDER(order) <= max_order); assert(H2D_GET_V_ORDER(order) >= 0 && H2D_GET_V_ORDER(order) <= max_order); #endif - int index = order; + unsigned short index = order; if (mode == HERMES_MODE_QUAD) //tables of bubble indices are transposed index = H2D_MAKE_QUAD_ORDER(H2D_GET_V_ORDER(order), H2D_GET_H_ORDER(order)); return bubble_indices[mode][index]; } - int Shapeset::get_num_bubbles(int order, ElementMode2D mode) const + unsigned short Shapeset::get_num_bubbles(unsigned short order, ElementMode2D mode) const { #ifdef _DEBUG assert(H2D_GET_H_ORDER(order) >= 0 && H2D_GET_H_ORDER(order) <= max_order); @@ -239,7 +239,7 @@ namespace Hermes return bubble_count[mode][order]; } - int Shapeset::get_constrained_edge_index(int edge, int order, int ori, int part, ElementMode2D mode) const + int Shapeset::get_constrained_edge_index(unsigned char edge, unsigned short order, unsigned short ori, unsigned short part, ElementMode2D mode) const { #ifdef _DEBUG if (mode == HERMES_MODE_TRIANGLE) @@ -253,7 +253,7 @@ namespace Hermes return -1 - ((part << 7) + (order << 3) + (edge << 1) + ori); } - int Shapeset::get_order(int index, ElementMode2D mode) const + unsigned short Shapeset::get_order(int index, ElementMode2D mode) const { if (index >= 0) { return index_to_order[mode][index]; @@ -261,7 +261,7 @@ namespace Hermes else return ((-1 - index) >> 3) & 15; } - double Shapeset::get_value(int n, int index, double x, double y, int component, ElementMode2D mode) + double Shapeset::get_value(int n, int index, double x, double y, unsigned short component, ElementMode2D mode) { if (index >= 0) return shape_table[n][mode][component][index](x, y); @@ -269,14 +269,94 @@ namespace Hermes return get_constrained_value(n, index, x, y, component, mode); } - double Shapeset::get_fn_value(int index, double x, double y, int component, ElementMode2D mode) { return get_value(0, index, x, y, component, mode); } - double Shapeset::get_dx_value(int index, double x, double y, int component, ElementMode2D mode) { return get_value(1, index, x, y, component, mode); } - double Shapeset::get_dy_value(int index, double x, double y, int component, ElementMode2D mode) { return get_value(2, index, x, y, component, mode); } - double Shapeset::get_dxx_value(int index, double x, double y, int component, ElementMode2D mode) { return get_value(3, index, x, y, component, mode); } - double Shapeset::get_dyy_value(int index, double x, double y, int component, ElementMode2D mode) { return get_value(4, index, x, y, component, mode); } - double Shapeset::get_dxy_value(int index, double x, double y, int component, ElementMode2D mode) { return get_value(5, index, x, y, component, mode); } + double Shapeset::get_fn_value(int index, double x, double y, unsigned short component, ElementMode2D mode) + { + if (index < 0) + return get_value(0, index, x, y, component, mode); + else + return shape_table[0][mode][component][index](x, y); + } + double Shapeset::get_dx_value(int index, double x, double y, unsigned short component, ElementMode2D mode) + { + if (index < 0) + return get_value(1, index, x, y, component, mode); + else + return shape_table[1][mode][component][index](x, y); + } + double Shapeset::get_dy_value(int index, double x, double y, unsigned short component, ElementMode2D mode) + { + if (index < 0) + return get_value(2, index, x, y, component, mode); + else + return shape_table[2][mode][component][index](x, y); + } + + double Shapeset::get_fn_value_0_tri(int index, double x, double y) + { + if (index < 0) + return get_value(0, index, x, y, 0, HERMES_MODE_TRIANGLE); + else + return shape_table[0][HERMES_MODE_TRIANGLE][0][index](x, y); + } + double Shapeset::get_dx_value_0_tri(int index, double x, double y) + { + if (index < 0) + return get_value(1, index, x, y, 0, HERMES_MODE_TRIANGLE); + else + return shape_table[1][HERMES_MODE_TRIANGLE][0][index](x, y); + } + double Shapeset::get_dy_value_0_tri(int index, double x, double y) + { + if (index < 0) + return get_value(2, index, x, y, 0, HERMES_MODE_TRIANGLE); + else + return shape_table[2][HERMES_MODE_TRIANGLE][0][index](x, y); + } + + double Shapeset::get_fn_value_0_quad(int index, double x, double y) + { + if (index < 0) + return get_value(0, index, x, y, 0, HERMES_MODE_QUAD); + else + return shape_table[0][HERMES_MODE_QUAD][0][index](x, y); + } + double Shapeset::get_dx_value_0_quad(int index, double x, double y) + { + if (index < 0) + return get_value(1, index, x, y, 0, HERMES_MODE_QUAD); + else + return shape_table[1][HERMES_MODE_QUAD][0][index](x, y); + } + double Shapeset::get_dy_value_0_quad(int index, double x, double y) + { + if (index < 0) + return get_value(2, index, x, y, 0, HERMES_MODE_QUAD); + else + return shape_table[2][HERMES_MODE_QUAD][0][index](x, y); + } + + double Shapeset::get_dxx_value(int index, double x, double y, unsigned short component, ElementMode2D mode) + { + if (index < 0) + return get_value(3, index, x, y, component, mode); + else + return shape_table[3][mode][component][index](x, y); + } + double Shapeset::get_dyy_value(int index, double x, double y, unsigned short component, ElementMode2D mode) + { + if (index < 0) + return get_value(4, index, x, y, component, mode); + else + return shape_table[4][mode][component][index](x, y); + } + double Shapeset::get_dxy_value(int index, double x, double y, unsigned short component, ElementMode2D mode) + { + if (index < 0) + return get_value(5, index, x, y, component, mode); + else + return shape_table[5][mode][component][index](x, y); + } - /// Returns the coordinates of the reference domain vertices. double2* Shapeset::get_ref_vertex(int vertex, ElementMode2D mode) { return &ref_vert[mode][vertex]; diff --git a/hermes2d/src/shapeset/shapeset_h1_jacobi.cpp b/hermes2d/src/shapeset/shapeset_h1_jacobi.cpp index 947ec97469..15cec3d88c 100644 --- a/hermes2d/src/shapeset/shapeset_h1_jacobi.cpp +++ b/hermes2d/src/shapeset/shapeset_h1_jacobi.cpp @@ -136,10 +136,10 @@ namespace Hermes inline double jacobi_f4(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .15309310892394863113733025466911821*a2-.15309310892394863113733025466911821*b2; + return .15309310892394863113733025466911821*a2 - .15309310892394863113733025466911821*b2; } inline double jacobi_f4_dx(double x, double y) @@ -151,7 +151,7 @@ namespace Hermes inline double jacobi_f4_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .30618621784789726227466050933823642*a + .30618621784789726227466050933823642*b; } @@ -178,12 +178,12 @@ namespace Hermes inline double jacobi_f5_dx(double x, double y) { - return -.61237243569579452454932101867647285-.61237243569579452454932101867647285*y; + return -.61237243569579452454932101867647285 - .61237243569579452454932101867647285*y; } inline double jacobi_f5_dy(double x, double y) { - return -.61237243569579452454932101867647285*x-.61237243569579452454932101867647285; + return -.61237243569579452454932101867647285*x - .61237243569579452454932101867647285; } inline double jacobi_f5_dxx(double x, double y) @@ -240,10 +240,10 @@ namespace Hermes inline double jacobi_f7_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return (-.98821176880261854124965423263522453e-1*b2 + .98821176880261854124965423263522453e-1*a2)*a; + return (-.98821176880261854124965423263522453e-1 * b2 + .98821176880261854124965423263522453e-1 * a2)*a; } inline double jacobi_f7_1(double x, double y) @@ -254,10 +254,10 @@ namespace Hermes inline double jacobi_f7_dx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .59292706128157112474979253958113472*a2-.19764235376052370824993084652704491*b2; + return .59292706128157112474979253958113472*a2 - .19764235376052370824993084652704491*b2; } inline double jacobi_f7_dx_1(double x, double y) @@ -268,9 +268,9 @@ namespace Hermes inline double jacobi_f7_dy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; - return -.98821176880261854124965423263522453e-1*b2 + (.19764235376052370824993084652704491*b + .29646353064078556237489626979056736*a)*a; + return -.98821176880261854124965423263522453e-1 * b2 + (.19764235376052370824993084652704491*b + .29646353064078556237489626979056736*a)*a; } inline double jacobi_f7_dy_1(double x, double y) @@ -292,7 +292,7 @@ namespace Hermes inline double jacobi_f7_dyy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .39528470752104741649986169305408981*a + .39528470752104741649986169305408981*b; } @@ -304,7 +304,7 @@ namespace Hermes inline double jacobi_f7_dxy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 1.1858541225631422494995850791622694*a + .39528470752104741649986169305408981*b; } @@ -357,7 +357,7 @@ namespace Hermes inline double jacobi_f8_dyy_0(double x, double y) { - return -1.5811388300841896659994467722163592*x-1.5811388300841896659994467722163592; + return -1.5811388300841896659994467722163592*x - 1.5811388300841896659994467722163592; } inline double jacobi_f8_dyy_1(double x, double y) @@ -367,7 +367,7 @@ namespace Hermes inline double jacobi_f8_dxy_0(double x, double y) { - return -1.5811388300841896659994467722163592*y-.79056941504209483299972338610817962; + return -1.5811388300841896659994467722163592*y - .79056941504209483299972338610817962; } inline double jacobi_f8_dxy_1(double x, double y) @@ -399,7 +399,7 @@ namespace Hermes inline double jacobi_f9_dy_0(double x, double y) { - return -.79056941504209483299972338610817962*y*(3.*y + 2.)-.79056941504209483299972338610817962*(2.*y + 1.)*x; + return -.79056941504209483299972338610817962*y*(3.*y + 2.) - .79056941504209483299972338610817962*(2.*y + 1.)*x; } inline double jacobi_f9_dy_1(double x, double y) @@ -419,7 +419,7 @@ namespace Hermes inline double jacobi_f9_dyy_0(double x, double y) { - return -1.5811388300841896659994467722163592*x-4.7434164902525689979983403166490778*y-1.5811388300841896659994467722163592; + return -1.5811388300841896659994467722163592*x - 4.7434164902525689979983403166490778*y - 1.5811388300841896659994467722163592; } inline double jacobi_f9_dyy_1(double x, double y) @@ -429,7 +429,7 @@ namespace Hermes inline double jacobi_f9_dxy_0(double x, double y) { - return -1.5811388300841896659994467722163592*y-.79056941504209483299972338610817962; + return -1.5811388300841896659994467722163592*y - .79056941504209483299972338610817962; } inline double jacobi_f9_dxy_1(double x, double y) @@ -443,10 +443,10 @@ namespace Hermes inline double jacobi_f10(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .48412291827592711064740817497279995*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(1. + y); + return .48412291827592711064740817497279995*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(1. + y); } inline double jacobi_f10_dx(double x, double y) @@ -458,9 +458,9 @@ namespace Hermes inline double jacobi_f10_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.59292706128157112474979253958113472 + .59292706128157112474979253958113472*y-.29646353064078556237489626979056736*b)*b+ - (.59292706128157112474979253958113472 + .59292706128157112474979253958113472*y + .29646353064078556237489626979056736*a)*a; + double b = 1.0 - y; + return (.59292706128157112474979253958113472 + .59292706128157112474979253958113472*y - .29646353064078556237489626979056736*b)*b + + (.59292706128157112474979253958113472 + .59292706128157112474979253958113472*y + .29646353064078556237489626979056736*a)*a; } inline double jacobi_f10_dxx(double x, double y) @@ -471,7 +471,7 @@ namespace Hermes inline double jacobi_f10_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 1.1858541225631422494995850791622694*a + 1.1858541225631422494995850791622694*b; } @@ -489,17 +489,17 @@ namespace Hermes inline double jacobi_f11(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; - return .14615849167085708537436518485611521e-1*b4 + (-.87695095002514251224619110913669124e-1*b2 + .73079245835428542687182592428057604e-1*a2)*a2; + return .14615849167085708537436518485611521e-1 * b4 + (-.87695095002514251224619110913669124e-1 * b2 + .73079245835428542687182592428057604e-1 * a2)*a2; } inline double jacobi_f11_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return (-.35078038001005700489847644365467650*b2 + .58463396668342834149746073942446083*a2)*a; @@ -508,33 +508,33 @@ namespace Hermes inline double jacobi_f11_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return -.58463396668342834149746073942446083e-1*b3 + (-.17539019000502850244923822182733825*b2+ - (.17539019000502850244923822182733825*b + .29231698334171417074873036971223041*a)*a)*a; + return -.58463396668342834149746073942446083e-1 * b3 + (-.17539019000502850244923822182733825*b2 + + (.17539019000502850244923822182733825*b + .29231698334171417074873036971223041*a)*a)*a; } inline double jacobi_f11_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 3.5078038001005700489847644365467650*a2-.70156076002011400979695288730935299*b2; + return 3.5078038001005700489847644365467650*a2 - .70156076002011400979695288730935299*b2; } inline double jacobi_f11_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return (.70156076002011400979695288730935299*b + .70156076002011400979695288730935299*a)*a; } inline double jacobi_f11_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; return -.35078038001005700489847644365467650*b2 + (.70156076002011400979695288730935299*b + 1.7539019000502850244923822182733825*a)*a; } @@ -543,13 +543,13 @@ namespace Hermes inline double jacobi_f12(double x, double y) { double y2 = y*y; - return -.23385358667337133659898429576978433*(x + 1.)*(5.*y2-1.)*(1. + y); + return -.23385358667337133659898429576978433*(x + 1.)*(5.*y2 - 1.)*(1. + y); } inline double jacobi_f12_dx(double x, double y) { double y2 = y*y; - return -.23385358667337133659898429576978433*(5.*y2-1.)*(1. + y); + return -.23385358667337133659898429576978433*(5.*y2 - 1.)*(1. + y); } inline double jacobi_f12_dy(double x, double y) @@ -570,27 +570,27 @@ namespace Hermes inline double jacobi_f12_dxy(double x, double y) { - return .23385358667337133659898429576978433-.23385358667337133659898429576978433*(10. + 15.*y)*y; + return .23385358667337133659898429576978433 - .23385358667337133659898429576978433*(10. + 15.*y)*y; } // number 13 inline double jacobi_f13(double x, double y) { double y2 = y*y; - return .23385358667337133659898429576978433*(x + y)*(5.*y2-1.)*(1. + y); + return .23385358667337133659898429576978433*(x + y)*(5.*y2 - 1.)*(1. + y); } inline double jacobi_f13_dx(double x, double y) { double y2 = y*y; - return .23385358667337133659898429576978433*(5.*y2-1.)*(1. + y); + return .23385358667337133659898429576978433*(5.*y2 - 1.)*(1. + y); } inline double jacobi_f13_dy(double x, double y) { double y2 = y*y; - return -.23385358667337133659898429576978433 + .23385358667337133659898429576978433*(-2. + (15. + 20.*y)*y)*y+ - .23385358667337133659898429576978433*(-1. + (10. + 15.*y)*y)*x; + return -.23385358667337133659898429576978433 + .23385358667337133659898429576978433*(-2. + (15. + 20.*y)*y)*y + + .23385358667337133659898429576978433*(-1. + (10. + 15.*y)*y)*x; } inline double jacobi_f13_dxx(double x, double y) @@ -600,8 +600,8 @@ namespace Hermes inline double jacobi_f13_dyy(double x, double y) { - return -.46770717334674267319796859153956866 + .46770717334674267319796859153956866*(15. + 30.*y)*y+ - .46770717334674267319796859153956866*(5. + 15.*y)*x; + return -.46770717334674267319796859153956866 + .46770717334674267319796859153956866*(15. + 30.*y)*y + + .46770717334674267319796859153956866*(5. + 15.*y)*x; } inline double jacobi_f13_dxy(double x, double y) @@ -615,55 +615,55 @@ namespace Hermes inline double jacobi_f14(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .84229416444580658121520354710938710*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)* - (.25000000000000000000000000000000000 + (1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y); + return .84229416444580658121520354710938710*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)* + (.25000000000000000000000000000000000 + (1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y); } inline double jacobi_f14_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - return 2.0631909162161306774360682303013260*a*(.25000000000000000000000000000000000+ - (1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y); + return 2.0631909162161306774360682303013260*a*(.25000000000000000000000000000000000 + + (1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y); } inline double jacobi_f14_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.25789886452701633467950852878766574 + 1.0315954581080653387180341151506630*(1.5000000000000000000000000000000000+ - 1.2500000000000000000000000000000000*y)*y-.51579772905403266935901705757533149*(2.5000000000000000000000000000000000*y + 1.5000000000000000000000000000000000)*b)*b + (.25789886452701633467950852878766574 + 1.0315954581080653387180341151506630*(1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y + .51579772905403266935901705757533149*(2.5000000000000000000000000000000000*y + 1.5000000000000000000000000000000000)*a)*a; + double b = 1.0 - y; + return (.25789886452701633467950852878766574 + 1.0315954581080653387180341151506630*(1.5000000000000000000000000000000000 + + 1.2500000000000000000000000000000000*y)*y - .51579772905403266935901705757533149*(2.5000000000000000000000000000000000*y + 1.5000000000000000000000000000000000)*b)*b + (.25789886452701633467950852878766574 + 1.0315954581080653387180341151506630*(1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y + .51579772905403266935901705757533149*(2.5000000000000000000000000000000000*y + 1.5000000000000000000000000000000000)*a)*a; } inline double jacobi_f14_dxx(double x, double y) { - return 1.0315954581080653387180341151506630 + 4.1263818324322613548721364606026519*(1.5000000000000000000000000000000000+ - 1.2500000000000000000000000000000000*y)*y; + return 1.0315954581080653387180341151506630 + 4.1263818324322613548721364606026519*(1.5000000000000000000000000000000000 + + 1.2500000000000000000000000000000000*y)*y; } inline double jacobi_f14_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (5.1579772905403266935901705757533151*y + 3.0947863743241960161541023454519890-1.2894943226350816733975426439383287*b)*b+ - (5.1579772905403266935901705757533151*y + 3.0947863743241960161541023454519890 + 1.2894943226350816733975426439383287*a)*a; + double b = 1.0 - y; + return (5.1579772905403266935901705757533151*y + 3.0947863743241960161541023454519890 - 1.2894943226350816733975426439383287*b)*b + + (5.1579772905403266935901705757533151*y + 3.0947863743241960161541023454519890 + 1.2894943226350816733975426439383287*a)*a; } inline double jacobi_f14_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - return .51579772905403266935901705757533151 + 2.0631909162161306774360682303013260*(1.5000000000000000000000000000000000+ - 1.2500000000000000000000000000000000*y)*y + 2.0631909162161306774360682303013260*(2.5000000000000000000000000000000000*y+ - 1.5000000000000000000000000000000000)*a; + return .51579772905403266935901705757533151 + 2.0631909162161306774360682303013260*(1.5000000000000000000000000000000000 + + 1.2500000000000000000000000000000000*y)*y + 2.0631909162161306774360682303013260*(2.5000000000000000000000000000000000*y + + 1.5000000000000000000000000000000000)*a; } // number 15 inline double jacobi_f15(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .44370598373247120319254962186712128*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(1. + y); @@ -672,44 +672,44 @@ namespace Hermes inline double jacobi_f15_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .44370598373247120319254962186712128*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(1. + y); + return .44370598373247120319254962186712128*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(1. + y); } inline double jacobi_f15_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; - return -.35078038001005700489847644365467649*b2*(1. + y) + ((.70156076002011400979695288730935298 + .70156076002011400979695288730935298*y- - .35078038001005700489847644365467649*b)*b + (1.0523411400301710146954293309640295 + 1.0523411400301710146954293309640295*y+ - .35078038001005700489847644365467649*a)*a)*a; + return -.35078038001005700489847644365467649*b2*(1. + y) + ((.70156076002011400979695288730935298 + .70156076002011400979695288730935298*y - + .35078038001005700489847644365467649*b)*b + (1.0523411400301710146954293309640295 + 1.0523411400301710146954293309640295*y + + .35078038001005700489847644365467649*a)*a)*a; } inline double jacobi_f15_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 8.4187291202413681175634346477122357*a*(1. + y); } inline double jacobi_f15_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y-.70156076002011400979695288730935298*b)*b+ - (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y + 1.4031215200402280195939057746187060*b+ - 2.1046822800603420293908586619280589*a)*a; + double b = 1.0 - y; + return (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y - .70156076002011400979695288730935298*b)*b + + (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y + 1.4031215200402280195939057746187060*b + + 2.1046822800603420293908586619280589*a)*a; } inline double jacobi_f15_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y-.70156076002011400979695288730935298*b)*b+ - (4.2093645601206840587817173238561178 + 4.2093645601206840587817173238561178*y + 2.1046822800603420293908586619280589*a)*a; + double b = 1.0 - y; + return (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y - .70156076002011400979695288730935298*b)*b + + (4.2093645601206840587817173238561178 + 4.2093645601206840587817173238561178*y + 2.1046822800603420293908586619280589*a)*a; } // ORDER 5 @@ -720,11 +720,11 @@ namespace Hermes inline double jacobi_f16_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; - return (.24859222776089561404717184605248599e-1*b4 + (-.82864075920298538015723948684161998e-1*b2 + .58004853144208976611006764078913399e-1*a2)*a2)*a; + return (.24859222776089561404717184605248599e-1 * b4 + (-.82864075920298538015723948684161998e-1 * b2 + .58004853144208976611006764078913399e-1 * a2)*a2)*a; } inline double jacobi_f16_1(double x, double y) @@ -735,12 +735,12 @@ namespace Hermes inline double jacobi_f16_dx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .49718445552179122809434369210497199e-1*b4 + (-.49718445552179122809434369210497199*b2 + .58004853144208976611006764078913399*a2)*a2; + return .49718445552179122809434369210497199e-1 * b4 + (-.49718445552179122809434369210497199*b2 + .58004853144208976611006764078913399*a2)*a2; } inline double jacobi_f16_dx_1(double x, double y) @@ -751,13 +751,13 @@ namespace Hermes inline double jacobi_f16_dy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .24859222776089561404717184605248599e-1*b4 + (-.99436891104358245618868738420994398e-1*b3 + (-.24859222776089561404717184605248599*b2+ - (.16572815184059707603144789736832400*b + .29002426572104488305503382039456699*a)*a)*a)*a; + return .24859222776089561404717184605248599e-1 * b4 + (-.99436891104358245618868738420994398e-1 * b3 + (-.24859222776089561404717184605248599*b2 + + (.16572815184059707603144789736832400*b + .29002426572104488305503382039456699*a)*a)*a)*a; } inline double jacobi_f16_dy_1(double x, double y) @@ -768,7 +768,7 @@ namespace Hermes inline double jacobi_f16_dxx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -783,12 +783,12 @@ namespace Hermes inline double jacobi_f16_dyy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -.19887378220871649123773747684198880*b3 + (-.19887378220871649123773747684198880*b2+ - (.99436891104358245618868738420994398*b + .99436891104358245618868738420994398*a)*a)*a; + return -.19887378220871649123773747684198880*b3 + (-.19887378220871649123773747684198880*b2 + + (.99436891104358245618868738420994398*b + .99436891104358245618868738420994398*a)*a)*a; } inline double jacobi_f16_dyy_1(double x, double y) @@ -799,12 +799,12 @@ namespace Hermes inline double jacobi_f16_dxy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -.19887378220871649123773747684198880*b3 + (-.99436891104358245618868738420994398*b2+ - (.99436891104358245618868738420994398*b + 2.3201941257683590644402705631565359*a)*a)*a; + return -.19887378220871649123773747684198880*b3 + (-.99436891104358245618868738420994398*b2 + + (.99436891104358245618868738420994398*b + 2.3201941257683590644402705631565359*a)*a)*a; } inline double jacobi_f16_dxy_1(double x, double y) @@ -816,7 +816,7 @@ namespace Hermes inline double jacobi_f17_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(x + 1.)*(7.*y2-3.)*y*(1. + y); + return -.26516504294495532165031663578931839*(x + 1.)*(7.*y2 - 3.)*y*(1. + y); } // number 17 @@ -828,7 +828,7 @@ namespace Hermes inline double jacobi_f17_dx_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(7.*y2-3.)*y*(1. + y); + return -.26516504294495532165031663578931839*(7.*y2 - 3.)*y*(1. + y); } inline double jacobi_f17_dx_1(double x, double y) @@ -869,7 +869,7 @@ namespace Hermes inline double jacobi_f17_dxy_0(double x, double y) { - return .79549512883486596495094990736795518-.26516504294495532165031663578931839*(-6. + (21. + 28.*y)*y)*y; + return .79549512883486596495094990736795518 - .26516504294495532165031663578931839*(-6. + (21. + 28.*y)*y)*y; } inline double jacobi_f17_dxy_1(double x, double y) @@ -881,7 +881,7 @@ namespace Hermes inline double jacobi_f18_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(x + y)*(7.*y2-3.)*y*(1. + y); + return -.26516504294495532165031663578931839*(x + y)*(7.*y2 - 3.)*y*(1. + y); } // number 18 @@ -893,7 +893,7 @@ namespace Hermes inline double jacobi_f18_dx_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(7.*y2-3.)*y*(1. + y); + return -.26516504294495532165031663578931839*(7.*y2 - 3.)*y*(1. + y); } inline double jacobi_f18_dx_1(double x, double y) @@ -904,7 +904,7 @@ namespace Hermes inline double jacobi_f18_dy_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(-6. + (-9. + (28. + 35.*y)*y)*y)*y-.26516504294495532165031663578931839*(-3. + (-6. + (21. + 28.*y)*y)*y)*x; + return -.26516504294495532165031663578931839*(-6. + (-9. + (28. + 35.*y)*y)*y)*y - .26516504294495532165031663578931839*(-3. + (-6. + (21. + 28.*y)*y)*y)*x; } inline double jacobi_f18_dy_1(double x, double y) @@ -924,8 +924,8 @@ namespace Hermes inline double jacobi_f18_dyy_0(double x, double y) { - return 1.5909902576697319299018998147359104-.53033008588991064330063327157863679*(-9. + (42. + 70.*y)*y)*y- - .53033008588991064330063327157863679*(-3. + (21. + 42.*y)*y)*x; + return 1.5909902576697319299018998147359104 - .53033008588991064330063327157863679*(-9. + (42. + 70.*y)*y)*y - + .53033008588991064330063327157863679*(-3. + (21. + 42.*y)*y)*x; } inline double jacobi_f18_dyy_1(double x, double y) @@ -935,7 +935,7 @@ namespace Hermes inline double jacobi_f18_dxy_0(double x, double y) { - return .79549512883486596495094990736795518-.26516504294495532165031663578931839*(-6. + (21. + 28.*y)*y)*y; + return .79549512883486596495094990736795518 - .26516504294495532165031663578931839*(-6. + (21. + 28.*y)*y)*y; } inline double jacobi_f18_dxy_1(double x, double y) @@ -949,67 +949,67 @@ namespace Hermes inline double jacobi_f19(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.1023963796102460793756732306830252*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)* - (-.25000000000000000000000000000000000 + (.25000000000000000000000000000000000 + (2.2500000000000000000000000000000000+ - 1.7500000000000000000000000000000000*y)*y)*y); + return 1.1023963796102460793756732306830252*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)* + (-.25000000000000000000000000000000000 + (.25000000000000000000000000000000000 + (2.2500000000000000000000000000000000 + + 1.7500000000000000000000000000000000*y)*y)*y); } inline double jacobi_f19_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return 2.7003086243366084295691530983699986*a*(-.25000000000000000000000000000000000 + (.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y); + double b = 1.0 - y; + return 2.7003086243366084295691530983699986*a*(-.25000000000000000000000000000000000 + (.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y); } inline double jacobi_f19_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-.33753857804207605369614413729624983 + 1.3501543121683042147845765491849993*(.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y-.67507715608415210739228827459249967* - (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*b)*b+ - (-.33753857804207605369614413729624983 + 1.3501543121683042147845765491849993*(.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y + .67507715608415210739228827459249967* - (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*a)*a; + double b = 1.0 - y; + return (-.33753857804207605369614413729624983 + 1.3501543121683042147845765491849993*(.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y - .67507715608415210739228827459249967* + (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*b)*b + + (-.33753857804207605369614413729624983 + 1.3501543121683042147845765491849993*(.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y + .67507715608415210739228827459249967* + (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*a)*a; } inline double jacobi_f19_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return -1.3501543121683042147845765491849993 + 5.4006172486732168591383061967399971*(.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y; + double b = 1.0 - y; + return -1.3501543121683042147845765491849993 + 5.4006172486732168591383061967399971*(.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y; } inline double jacobi_f19_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986*(4.5000000000000000000000000000000000+ - 5.2500000000000000000000000000000000*y)*y-.67507715608415210739228827459249967*(10.500000000000000000000000000000000*y+ - 4.5000000000000000000000000000000000)*b)*b + (.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986* - (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y + .67507715608415210739228827459249967* - (10.500000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a; + double b = 1.0 - y; + return (.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986*(4.5000000000000000000000000000000000 + + 5.2500000000000000000000000000000000*y)*y - .67507715608415210739228827459249967*(10.500000000000000000000000000000000*y + + 4.5000000000000000000000000000000000)*b)*b + (.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986* + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y + .67507715608415210739228827459249967* + (10.500000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a; } inline double jacobi_f19_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return -.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986*(.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y + 2.7003086243366084295691530983699986* - (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*a; + double b = 1.0 - y; + return -.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986*(.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y + 2.7003086243366084295691530983699986* + (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*a; } // number 20 inline double jacobi_f20(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .72944814386945601069179830653602616*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y); @@ -1018,47 +1018,47 @@ namespace Hermes inline double jacobi_f20_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .72944814386945601069179830653602616*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y); + return .72944814386945601069179830653602616*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y); } inline double jacobi_f20_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -.57667939240241767253899168157713749*b2*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y) + ((.86501908860362650880848752236570622 + 1.1533587848048353450779833631542750*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y-.57667939240241767253899168157713749*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (1.2975286329054397632127312835485594 + 1.7300381772072530176169750447314125*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + .57667939240241767253899168157713749*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*a)*a)*a; + return -.57667939240241767253899168157713749*b2*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y) + ((.86501908860362650880848752236570622 + 1.1533587848048353450779833631542750*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y - .57667939240241767253899168157713749*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (1.2975286329054397632127312835485594 + 1.7300381772072530176169750447314125*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + .57667939240241767253899168157713749*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*a)*a)*a; } inline double jacobi_f20_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 13.840305417658024140935800357851299*a*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y); } inline double jacobi_f20_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y-1.1533587848048353450779833631542750*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + (8.0735114936338474155458835420799248*y + 5.7667939240241767253899168157713747-2.0183778734084618538864708855199811*b)*b + (12.110267240450771123318825313119887*y + 8.6501908860362650880848752236570620 + 2.0183778734084618538864708855199811*a)*a)*a; + double b = 1.0 - y; + return (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y - 1.1533587848048353450779833631542750*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + (8.0735114936338474155458835420799248*y + 5.7667939240241767253899168157713747 - 2.0183778734084618538864708855199811*b)*b + (12.110267240450771123318825313119887*y + 8.6501908860362650880848752236570620 + 2.0183778734084618538864708855199811*a)*a)*a; } inline double jacobi_f20_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y-1.1533587848048353450779833631542750*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (5.1901145316217590528509251341942374 + 6.9201527088290120704679001789256498*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + 3.4600763544145060352339500894628249*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*a)*a; + double b = 1.0 - y; + return (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y - 1.1533587848048353450779833631542750*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (5.1901145316217590528509251341942374 + 6.9201527088290120704679001789256498*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + 3.4600763544145060352339500894628249*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*a)*a; } // number 21 inline double jacobi_f21(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -1068,7 +1068,7 @@ namespace Hermes inline double jacobi_f21_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1078,41 +1078,41 @@ namespace Hermes inline double jacobi_f21_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-.31004898176538170982440809612960083-.31004898176538170982440809612960083*y + .77512245441345427456102024032400208e-1*b)*b3 + (-.93014694529614512947322428838880250*b2*(1. + y) + ((.93014694529614512947322428838880250 + .93014694529614512947322428838880250*y-.46507347264807256473661214419440125*b)*b + (1.5502449088269085491220404806480042 + 1.5502449088269085491220404806480042*y + .38756122720672713728051012016200104*a)*a)*a)*a; + return (-.31004898176538170982440809612960083 - .31004898176538170982440809612960083*y + .77512245441345427456102024032400208e-1 * b)*b3 + (-.93014694529614512947322428838880250*b2*(1. + y) + ((.93014694529614512947322428838880250 + .93014694529614512947322428838880250*y - .46507347264807256473661214419440125*b)*b + (1.5502449088269085491220404806480042 + 1.5502449088269085491220404806480042*y + .38756122720672713728051012016200104*a)*a)*a)*a; } inline double jacobi_f21_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return .33145630368119415206289579473664799*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(1. + y); + return .33145630368119415206289579473664799*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(1. + y); } inline double jacobi_f21_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -.62009796353076341964881619225920167*b3 + ((3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y-1.8602938905922902589464485767776050*b)*b + (3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y + 1.8602938905922902589464485767776050*b + 3.1004898176538170982440809612960083*a)*a)*a; + return -.62009796353076341964881619225920167*b3 + ((3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y - 1.8602938905922902589464485767776050*b)*b + (3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y + 1.8602938905922902589464485767776050*b + 3.1004898176538170982440809612960083*a)*a)*a; } inline double jacobi_f21_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -1.8602938905922902589464485767776050*b2*(1. + y) + ((3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y-1.8602938905922902589464485767776050*b)*b + (9.3014694529614512947322428838880250 + 9.3014694529614512947322428838880250*y + 3.1004898176538170982440809612960083*a)*a)*a; + return -1.8602938905922902589464485767776050*b2*(1. + y) + ((3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y - 1.8602938905922902589464485767776050*b)*b + (9.3014694529614512947322428838880250 + 9.3014694529614512947322428838880250*y + 3.1004898176538170982440809612960083*a)*a)*a; } // ORDER 6 @@ -1123,18 +1123,18 @@ namespace Hermes inline double jacobi_f22(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; - return -.22902420702262839621902490788791339e-2*b6 + (.34353631053394259432853736183187009e-1*b4 + (-.80158472457919938676658717760769688e-1*b2 + .48095083474751963205995230656461813e-1*a2)*a2)*a2; + return -.22902420702262839621902490788791339e-2 * b6 + (.34353631053394259432853736183187009e-1 * b4 + (-.80158472457919938676658717760769688e-1 * b2 + .48095083474751963205995230656461813e-1 * a2)*a2)*a2; } inline double jacobi_f22_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1146,19 +1146,19 @@ namespace Hermes inline double jacobi_f22_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return .13741452421357703773141494473274804e-1*b5 + (.68707262106788518865707472366374018e-1*b4 + (-.13741452421357703773141494473274804*b3 + (-.32063388983167975470663487104307875*b2 + (.16031694491583987735331743552153938*b + .28857050084851177923597138393877088*a)*a)*a)*a)*a; + return .13741452421357703773141494473274804e-1 * b5 + (.68707262106788518865707472366374018e-1 * b4 + (-.13741452421357703773141494473274804*b3 + (-.32063388983167975470663487104307875*b2 + (.16031694491583987735331743552153938*b + .28857050084851177923597138393877088*a)*a)*a)*a)*a; } inline double jacobi_f22_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1169,7 +1169,7 @@ namespace Hermes inline double jacobi_f22_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1180,7 +1180,7 @@ namespace Hermes inline double jacobi_f22_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1219,7 +1219,7 @@ namespace Hermes inline double jacobi_f23_dxy(double x, double y) { - return -.14657549249448217358017594104826457-.14657549249448217358017594104826457*(-28. + (-42. + (84. + 105.*y)*y)*y)*y; + return -.14657549249448217358017594104826457 - .14657549249448217358017594104826457*(-28. + (-42. + (84. + 105.*y)*y)*y)*y; } // number 24 @@ -1262,17 +1262,17 @@ namespace Hermes inline double jacobi_f25(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double y2 = y*y; - return 1.3055824196677337863296844245952112*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(-.12500000000000000000000000000000000 + (-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y); + return 1.3055824196677337863296844245952112*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(-.12500000000000000000000000000000000 + (-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y); } inline double jacobi_f25_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; return 3.1980107453341565144765659865075906*a*(-.12500000000000000000000000000000000 + (-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y); } @@ -1280,15 +1280,15 @@ namespace Hermes inline double jacobi_f25_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; - return (-.19987567158338478215478537415672443 + 1.5990053726670782572382829932537954*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y-.79950268633353912861914149662689767*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*b)*b + (-.19987567158338478215478537415672443 + 1.5990053726670782572382829932537954*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y + .79950268633353912861914149662689767*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*a)*a; + return (-.19987567158338478215478537415672443 + 1.5990053726670782572382829932537954*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y - .79950268633353912861914149662689767*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*b)*b + (-.19987567158338478215478537415672443 + 1.5990053726670782572382829932537954*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y + .79950268633353912861914149662689767*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*a)*a; } inline double jacobi_f25_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; return -.79950268633353912861914149662689769 + 6.3960214906683130289531319730151814*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y; } @@ -1296,15 +1296,15 @@ namespace Hermes inline double jacobi_f25_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; - return (-3.1980107453341565144765659865075906 + 3.1980107453341565144765659865075906*(10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2-.79950268633353912861914149662689767*(21. + 31.500000000000000000000000000000000*y)*y*b)*b + (-3.1980107453341565144765659865075906 + 3.1980107453341565144765659865075906*(10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2 + .79950268633353912861914149662689767*(21. + 31.500000000000000000000000000000000*y)*y*a)*a; + return (-3.1980107453341565144765659865075906 + 3.1980107453341565144765659865075906*(10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2 - .79950268633353912861914149662689767*(21. + 31.500000000000000000000000000000000*y)*y*b)*b + (-3.1980107453341565144765659865075906 + 3.1980107453341565144765659865075906*(10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2 + .79950268633353912861914149662689767*(21. + 31.500000000000000000000000000000000*y)*y*a)*a; } inline double jacobi_f25_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; return -.39975134316676956430957074831344884 + 3.1980107453341565144765659865075906*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y + 3.1980107453341565144765659865075906*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*a; } @@ -1313,7 +1313,7 @@ namespace Hermes inline double jacobi_f26(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .99215674164922147143810590761472265*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(2. + (5. + 3.*y)*y)*y; @@ -1322,47 +1322,47 @@ namespace Hermes inline double jacobi_f26_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .99215674164922147143810590761472265*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(2. + (5. + 3.*y)*y)*y; + return .99215674164922147143810590761472265*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(2. + (5. + 3.*y)*y)*y; } inline double jacobi_f26_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -.78436877487569582622953627417361325*b2*(2. + (5. + 3.*y)*y)*y + ((1.5687375497513916524590725483472265*(2. + (5. + 3.*y)*y)*y-.78436877487569582622953627417361325*(2. + (10. + 9.*y)*y)*b)*b + (2.3531063246270874786886088225208398*(2. + (5. + 3.*y)*y)*y + .78436877487569582622953627417361325*(2. + (10. + 9.*y)*y)*a)*a)*a; + return -.78436877487569582622953627417361325*b2*(2. + (5. + 3.*y)*y)*y + ((1.5687375497513916524590725483472265*(2. + (5. + 3.*y)*y)*y - .78436877487569582622953627417361325*(2. + (10. + 9.*y)*y)*b)*b + (2.3531063246270874786886088225208398*(2. + (5. + 3.*y)*y)*y + .78436877487569582622953627417361325*(2. + (10. + 9.*y)*y)*a)*a)*a; } inline double jacobi_f26_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 18.824850597016699829508870580166718*a*(2. + (5. + 3.*y)*y)*y; } inline double jacobi_f26_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y-1.5687375497513916524590725483472265*(2. + (10. + 9.*y)*y)*b)*b + (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y + (6.2749501990055666098362901933889059 + 3.1374750995027833049181450966944530*(10. + 9.*y)*y-.78436877487569582622953627417361325*(18.*y + 10.)*b)*b + (9.4124252985083499147544352900833588 + 4.7062126492541749573772176450416795*(10. + 9.*y)*y + .78436877487569582622953627417361325*(18.*y + 10.)*a)*a)*a; + double b = 1.0 - y; + return (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y - 1.5687375497513916524590725483472265*(2. + (10. + 9.*y)*y)*b)*b + (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y + (6.2749501990055666098362901933889059 + 3.1374750995027833049181450966944530*(10. + 9.*y)*y - .78436877487569582622953627417361325*(18.*y + 10.)*b)*b + (9.4124252985083499147544352900833588 + 4.7062126492541749573772176450416795*(10. + 9.*y)*y + .78436877487569582622953627417361325*(18.*y + 10.)*a)*a)*a; } inline double jacobi_f26_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y-1.5687375497513916524590725483472265*(2. + (10. + 9.*y)*y)*b)*b + (9.4124252985083499147544352900833590*(2. + (5. + 3.*y)*y)*y + 4.7062126492541749573772176450416795*(2. + (10. + 9.*y)*y)*a)*a; + double b = 1.0 - y; + return (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y - 1.5687375497513916524590725483472265*(2. + (10. + 9.*y)*y)*b)*b + (9.4124252985083499147544352900833590*(2. + (5. + 3.*y)*y)*y + 4.7062126492541749573772176450416795*(2. + (10. + 9.*y)*y)*a)*a; } // number 27 inline double jacobi_f27(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -1372,7 +1372,7 @@ namespace Hermes inline double jacobi_f27_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1382,48 +1382,48 @@ namespace Hermes inline double jacobi_f27_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-.58593750000000000000000000000000000-.46875000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + .11718750000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b3 + (-1.4062500000000000000000000000000000*b2*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y) + ((1.7578125000000000000000000000000000 + 1.4062500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y-.70312500000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (2.9296875000000000000000000000000000 + 2.3437500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + .58593750000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*a)*a)*a)*a; + return (-.58593750000000000000000000000000000 - .46875000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + .11718750000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b3 + (-1.4062500000000000000000000000000000*b2*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y) + ((1.7578125000000000000000000000000000 + 1.4062500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y - .70312500000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (2.9296875000000000000000000000000000 + 2.3437500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + .58593750000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*a)*a)*a)*a; } inline double jacobi_f27_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return .50111482858579572128353777664953786*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y); + return .50111482858579572128353777664953786*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y); } inline double jacobi_f27_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-4.2187500000000000000000000000000000*y-3.2812500000000000000000000000000000 + .52734375000000000000000000000000000*b)*b3 + ((7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y-2.8125000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + (12.656250000000000000000000000000000*y + 9.8437500000000000000000000000000000-3.1640625000000000000000000000000000*b)*b + (21.093750000000000000000000000000000*y + 16.406250000000000000000000000000000 + 2.6367187500000000000000000000000000*a)*a)*a)*a; + return (-4.2187500000000000000000000000000000*y - 3.2812500000000000000000000000000000 + .52734375000000000000000000000000000*b)*b3 + ((7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y - 2.8125000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + (12.656250000000000000000000000000000*y + 9.8437500000000000000000000000000000 - 3.1640625000000000000000000000000000*b)*b + (21.093750000000000000000000000000000*y + 16.406250000000000000000000000000000 + 2.6367187500000000000000000000000000*a)*a)*a)*a; } inline double jacobi_f27_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -2.8125000000000000000000000000000000*b2*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y) + ((7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y-2.8125000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (17.578125000000000000000000000000000 + 14.062500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + 4.6875000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*a)*a)*a; + return -2.8125000000000000000000000000000000*b2*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y) + ((7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y - 2.8125000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (17.578125000000000000000000000000000 + 14.062500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + 4.6875000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*a)*a)*a; } // number 28 inline double jacobi_f28(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -1433,7 +1433,7 @@ namespace Hermes inline double jacobi_f28_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1444,18 +1444,18 @@ namespace Hermes inline double jacobi_f28_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .18012218143288356533005732055603413*b4*(1. + y) + ((-.72048872573153426132022928222413650-.72048872573153426132022928222413650*y + .18012218143288356533005732055603413*b)*b3 + (-1.8012218143288356533005732055603413*b2*(1. + y) + ((1.2008145428858904355337154703735608 + 1.2008145428858904355337154703735608*y-.60040727144294521776685773518678042*b)*b + (2.1014254500503082621840020731537315 + 2.1014254500503082621840020731537315*y + .42028509001006165243680041463074629*a)*a)*a)*a)*a; + return .18012218143288356533005732055603413*b4*(1. + y) + ((-.72048872573153426132022928222413650 - .72048872573153426132022928222413650*y + .18012218143288356533005732055603413*b)*b3 + (-1.8012218143288356533005732055603413*b2*(1. + y) + ((1.2008145428858904355337154703735608 + 1.2008145428858904355337154703735608*y - .60040727144294521776685773518678042*b)*b + (2.1014254500503082621840020731537315 + 2.1014254500503082621840020731537315*y + .42028509001006165243680041463074629*a)*a)*a)*a)*a; } inline double jacobi_f28_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1465,21 +1465,21 @@ namespace Hermes inline double jacobi_f28_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-1.4409774514630685226404585644482730-1.4409774514630685226404585644482730*y + .36024436286576713066011464111206825*b)*b3 + ((-1.4409774514630685226404585644482730-1.4409774514630685226404585644482730*y-1.4409774514630685226404585644482730*b)*b2 + ((7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y-3.6024436286576713066011464111206825*b)*b + (7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y + 2.4016290857717808710674309407471217*b + 4.2028509001006165243680041463074629*a)*a)*a)*a; + return (-1.4409774514630685226404585644482730 - 1.4409774514630685226404585644482730*y + .36024436286576713066011464111206825*b)*b3 + ((-1.4409774514630685226404585644482730 - 1.4409774514630685226404585644482730*y - 1.4409774514630685226404585644482730*b)*b2 + ((7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y - 3.6024436286576713066011464111206825*b)*b + (7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y + 2.4016290857717808710674309407471217*b + 4.2028509001006165243680041463074629*a)*a)*a)*a; } inline double jacobi_f28_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-1.4409774514630685226404585644482730-1.4409774514630685226404585644482730*y + .36024436286576713066011464111206825*b)*b3 + (-7.2048872573153426132022928222413650*b2*(1. + y) + ((7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y-3.6024436286576713066011464111206825*b)*b + (16.811403600402466097472016585229852 + 16.811403600402466097472016585229852*y + 4.2028509001006165243680041463074629*a)*a)*a)*a; + return (-1.4409774514630685226404585644482730 - 1.4409774514630685226404585644482730*y + .36024436286576713066011464111206825*b)*b3 + (-7.2048872573153426132022928222413650*b2*(1. + y) + ((7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y - 3.6024436286576713066011464111206825*b)*b + (16.811403600402466097472016585229852 + 16.811403600402466097472016585229852*y + 4.2028509001006165243680041463074629*a)*a)*a)*a; } // ORDER 7 @@ -1490,12 +1490,12 @@ namespace Hermes inline double jacobi_f29_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; - return (-.62243890546786924194680470080844507e-2*b6 + (.43570723382750846936276329056591155e-1*b4 + (-.78427302088951524485297392301864079e-1*b2 + .41080967760879369968489110253357375e-1*a2)*a2)*a2)*a; + return (-.62243890546786924194680470080844507e-2 * b6 + (.43570723382750846936276329056591155e-1 * b4 + (-.78427302088951524485297392301864079e-1 * b2 + .41080967760879369968489110253357375e-1 * a2)*a2)*a2)*a; } inline double jacobi_f29_1(double x, double y) @@ -1506,14 +1506,14 @@ namespace Hermes inline double jacobi_f29_dx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.12448778109357384838936094016168901e-1*b6 + (.26142434029650508161765797433954693*b4 + (-.78427302088951524485297392301864079*b2 + .57513354865231117955884754354700324*a2)*a2)*a2; + return -.12448778109357384838936094016168901e-1 * b6 + (.26142434029650508161765797433954693*b4 + (-.78427302088951524485297392301864079*b2 + .57513354865231117955884754354700324*a2)*a2)*a2; } inline double jacobi_f29_dx_1(double x, double y) @@ -1524,14 +1524,14 @@ namespace Hermes inline double jacobi_f29_dy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.62243890546786924194680470080844507e-2*b6 + (.37346334328072154516808282048506704e-1*b5 + (.13071217014825254080882898716977346*b4 + (-.17428289353100338774510531622636462*b3 + (-.39213651044475762242648696150932039*b2 + (.15685460417790304897059478460372816*b + .28756677432615558977942377177350162*a)*a)*a)*a)*a)*a; + return -.62243890546786924194680470080844507e-2 * b6 + (.37346334328072154516808282048506704e-1 * b5 + (.13071217014825254080882898716977346*b4 + (-.17428289353100338774510531622636462*b3 + (-.39213651044475762242648696150932039*b2 + (.15685460417790304897059478460372816*b + .28756677432615558977942377177350162*a)*a)*a)*a)*a)*a; } inline double jacobi_f29_dy_1(double x, double y) @@ -1542,7 +1542,7 @@ namespace Hermes inline double jacobi_f29_dxx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1559,13 +1559,13 @@ namespace Hermes inline double jacobi_f29_dyy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return .74692668656144309033616564097013408e-1*b5 + (.74692668656144309033616564097013408e-1*b4 + (-1.0456973611860203264706318973581877*b3 + (-1.0456973611860203264706318973581877*b2 + (1.5685460417790304897059478460372816*b + 1.5685460417790304897059478460372816*a)*a)*a)*a)*a; + return .74692668656144309033616564097013408e-1 * b5 + (.74692668656144309033616564097013408e-1 * b4 + (-1.0456973611860203264706318973581877*b3 + (-1.0456973611860203264706318973581877*b2 + (1.5685460417790304897059478460372816*b + 1.5685460417790304897059478460372816*a)*a)*a)*a)*a; } inline double jacobi_f29_dyy_1(double x, double y) @@ -1576,13 +1576,13 @@ namespace Hermes inline double jacobi_f29_dxy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return .74692668656144309033616564097013408e-1*b5 + (.52284868059301016323531594867909386*b4 + (-1.0456973611860203264706318973581877*b3 + (-3.1370920835580609794118956920745631*b2 + (1.5685460417790304897059478460372816*b + 3.4508012919138670773530852612820195*a)*a)*a)*a)*a; + return .74692668656144309033616564097013408e-1 * b5 + (.52284868059301016323531594867909386*b4 + (-1.0456973611860203264706318973581877*b3 + (-3.1370920835580609794118956920745631*b2 + (1.5685460417790304897059478460372816*b + 3.4508012919138670773530852612820195*a)*a)*a)*a)*a; } inline double jacobi_f29_dxy_1(double x, double y) @@ -1647,7 +1647,7 @@ namespace Hermes inline double jacobi_f30_dxy_0(double x, double y) { - return -.79672179899887262969191001703480969-.15934435979977452593838200340696194*(10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y; + return -.79672179899887262969191001703480969 - .15934435979977452593838200340696194*(10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y; } inline double jacobi_f30_dxy_1(double x, double y) @@ -1682,7 +1682,7 @@ namespace Hermes inline double jacobi_f31_dy_0(double x, double y) { double y2 = y*y; - return -.15934435979977452593838200340696194*(10. + (15. + (-120. + (-150. + (198. + 231.*y)*y)*y)*y)*y)*y-.15934435979977452593838200340696194*(5. + (10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y)*x; + return -.15934435979977452593838200340696194*(10. + (15. + (-120. + (-150. + (198. + 231.*y)*y)*y)*y)*y)*y - .15934435979977452593838200340696194*(5. + (10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y)*x; } inline double jacobi_f31_dy_1(double x, double y) @@ -1702,7 +1702,7 @@ namespace Hermes inline double jacobi_f31_dyy_0(double x, double y) { - return -1.5934435979977452593838200340696194-.31868871959954905187676400681392388*(15. + (-180. + (-300. + (495. + 693.*y)*y)*y)*y)*y-.31868871959954905187676400681392388*(5. + (-90. + (-180. + (330. + 495.*y)*y)*y)*y)*x; + return -1.5934435979977452593838200340696194 - .31868871959954905187676400681392388*(15. + (-180. + (-300. + (495. + 693.*y)*y)*y)*y)*y - .31868871959954905187676400681392388*(5. + (-90. + (-180. + (330. + 495.*y)*y)*y)*y)*x; } inline double jacobi_f31_dyy_1(double x, double y) @@ -1712,7 +1712,7 @@ namespace Hermes inline double jacobi_f31_dxy_0(double x, double y) { - return -.79672179899887262969191001703480969-.15934435979977452593838200340696194*(10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y; + return -.79672179899887262969191001703480969 - .15934435979977452593838200340696194*(10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y; } inline double jacobi_f31_dxy_1(double x, double y) @@ -1726,44 +1726,44 @@ namespace Hermes inline double jacobi_f32(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.4752421108802058983765559207693054*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(.12500000000000000000000000000000000 + (-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y); + return 1.4752421108802058983765559207693054*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(.12500000000000000000000000000000000 + (-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y); } inline double jacobi_f32_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 3.6135904187228682497009747173648780*a*(.12500000000000000000000000000000000 + (-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y); } inline double jacobi_f32_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.22584940117017926560631091983530488 + 1.8067952093614341248504873586824390*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y-.90339760468071706242524367934121949*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*b)*b + (.22584940117017926560631091983530488 + 1.8067952093614341248504873586824390*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y + .90339760468071706242524367934121949*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (.22584940117017926560631091983530488 + 1.8067952093614341248504873586824390*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y - .90339760468071706242524367934121949*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*b)*b + (.22584940117017926560631091983530488 + 1.8067952093614341248504873586824390*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y + .90339760468071706242524367934121949*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*a)*a; } inline double jacobi_f32_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .90339760468071706242524367934121949 + 7.2271808374457364994019494347297560*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y; } inline double jacobi_f32_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-1.3550964070210755936378655190118293 + 3.6135904187228682497009747173648780*(-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y-.90339760468071706242524367934121949*(-5.5000000000000000000000000000000000 + (-4.5000000000000000000000000000000000 + (67.500000000000000000000000000000000 + 82.500000000000000000000000000000000*y)*y)*y)*b)*b + (-1.3550964070210755936378655190118293 + 3.6135904187228682497009747173648780*(-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y + .90339760468071706242524367934121949*(-5.5000000000000000000000000000000000 + (-4.5000000000000000000000000000000000 + (67.500000000000000000000000000000000 + 82.500000000000000000000000000000000*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (-1.3550964070210755936378655190118293 + 3.6135904187228682497009747173648780*(-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y - .90339760468071706242524367934121949*(-5.5000000000000000000000000000000000 + (-4.5000000000000000000000000000000000 + (67.500000000000000000000000000000000 + 82.500000000000000000000000000000000*y)*y)*y)*b)*b + (-1.3550964070210755936378655190118293 + 3.6135904187228682497009747173648780*(-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y + .90339760468071706242524367934121949*(-5.5000000000000000000000000000000000 + (-4.5000000000000000000000000000000000 + (67.500000000000000000000000000000000 + 82.500000000000000000000000000000000*y)*y)*y)*a)*a; } inline double jacobi_f32_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .45169880234035853121262183967060975 + 3.6135904187228682497009747173648780*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y + 3.6135904187228682497009747173648780*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*a; } @@ -1771,7 +1771,7 @@ namespace Hermes inline double jacobi_f33(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return 1.2208540490103741136884064212095202*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y); @@ -1780,47 +1780,47 @@ namespace Hermes inline double jacobi_f33_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.2208540490103741136884064212095202*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y); + return 1.2208540490103741136884064212095202*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y); } inline double jacobi_f33_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -.96516987137790443929991476509124903*b2*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y) + ((-.66355428657230930201869140100023374 + 1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y-.96516987137790443929991476509124903*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-.99533142985846395302803710150035059 + 2.8955096141337133178997442952737472*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + .96516987137790443929991476509124903*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*a)*a)*a; + return -.96516987137790443929991476509124903*b2*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y) + ((-.66355428657230930201869140100023374 + 1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y - .96516987137790443929991476509124903*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-.99533142985846395302803710150035059 + 2.8955096141337133178997442952737472*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + .96516987137790443929991476509124903*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*a)*a)*a; } inline double jacobi_f33_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 23.164076913069706543197954362189978*a*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y); } inline double jacobi_f33_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y-1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + (-2.4129246784447610982497869127281226 + 3.8606794855116177571996590603649962*(7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y-.96516987137790443929991476509124903*(7.8750000000000000000000000000000000 + (56.250000000000000000000000000000000 + 61.875000000000000000000000000000000*y)*y)*b)*b + (-3.6193870176671416473746803690921840 + 5.7910192282674266357994885905474944*(7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y + .96516987137790443929991476509124903*(7.8750000000000000000000000000000000 + (56.250000000000000000000000000000000 + 61.875000000000000000000000000000000*y)*y)*a)*a)*a; + double b = 1.0 - y; + return (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y - 1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + (-2.4129246784447610982497869127281226 + 3.8606794855116177571996590603649962*(7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y - .96516987137790443929991476509124903*(7.8750000000000000000000000000000000 + (56.250000000000000000000000000000000 + 61.875000000000000000000000000000000*y)*y)*b)*b + (-3.6193870176671416473746803690921840 + 5.7910192282674266357994885905474944*(7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y + .96516987137790443929991476509124903*(7.8750000000000000000000000000000000 + (56.250000000000000000000000000000000 + 61.875000000000000000000000000000000*y)*y)*a)*a)*a; } inline double jacobi_f33_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y-1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-3.9813257194338558121121484060014024 + 11.582038456534853271598977181094989*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + 5.7910192282674266357994885905474944*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y - 1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-3.9813257194338558121121484060014024 + 11.582038456534853271598977181094989*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + 5.7910192282674266357994885905474944*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*a)*a; } // number 34 inline double jacobi_f34(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -1830,7 +1830,7 @@ namespace Hermes inline double jacobi_f34_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1840,48 +1840,48 @@ namespace Hermes inline double jacobi_f34_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-.36576554434386081824112622088898979-.62702664744661854555621637866683965*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + .15675666186165463638905409466670991*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b3 + (-1.8810799423398556366686491360005189*b2*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y) + ((1.0972966330315824547233786626669694 + 1.8810799423398556366686491360005189*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y-.94053997116992781833432456800025947*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (1.8288277217193040912056311044449490 + 3.1351332372330927277810818933341982*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + .78378330930827318194527047333354953*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*a)*a)*a)*a; + return (-.36576554434386081824112622088898979 - .62702664744661854555621637866683965*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + .15675666186165463638905409466670991*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b3 + (-1.8810799423398556366686491360005189*b2*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y) + ((1.0972966330315824547233786626669694 + 1.8810799423398556366686491360005189*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y - .94053997116992781833432456800025947*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (1.8288277217193040912056311044449490 + 3.1351332372330927277810818933341982*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + .78378330930827318194527047333354953*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*a)*a)*a)*a; } inline double jacobi_f34_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return .67031968203506862686507519221230759*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y); + return .67031968203506862686507519221230759*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y); } inline double jacobi_f34_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-5.9567531507428761827840555973349767-1.2540532948932370911124327573336793*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y + .15675666186165463638905409466670991*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*b)*b3 + ((4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y-3.7621598846797112733372982720010379*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + (17.870259452228628548352166792004930 + 3.7621598846797112733372982720010379*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y-.94053997116992781833432456800025947*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*b)*b + (29.783765753714380913920277986674883 + 6.2702664744661854555621637866683965*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y + .78378330930827318194527047333354953*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*a)*a)*a)*a; + return (-5.9567531507428761827840555973349767 - 1.2540532948932370911124327573336793*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y + .15675666186165463638905409466670991*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*b)*b3 + ((4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y - 3.7621598846797112733372982720010379*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + (17.870259452228628548352166792004930 + 3.7621598846797112733372982720010379*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y - .94053997116992781833432456800025947*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*b)*b + (29.783765753714380913920277986674883 + 6.2702664744661854555621637866683965*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y + .78378330930827318194527047333354953*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*a)*a)*a)*a; } inline double jacobi_f34_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -3.7621598846797112733372982720010379*b2*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y) + ((4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y-3.7621598846797112733372982720010379*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (10.972966330315824547233786626669694 + 18.810799423398556366686491360005189*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + 6.2702664744661854555621637866683965*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*a)*a)*a; + return -3.7621598846797112733372982720010379*b2*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y) + ((4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y - 3.7621598846797112733372982720010379*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (10.972966330315824547233786626669694 + 18.810799423398556366686491360005189*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + 6.2702664744661854555621637866683965*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*a)*a)*a; } // number 35 inline double jacobi_f35(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -1891,7 +1891,7 @@ namespace Hermes inline double jacobi_f35_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1902,18 +1902,18 @@ namespace Hermes inline double jacobi_f35_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .25543394004820110678174896037405033*b4*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((-1.7880375803374077474722427226183523-1.0217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .25543394004820110678174896037405033*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + (-2.5543394004820110678174896037405033*b2*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((2.9800626338956795791204045376972539 + 1.7028929336546740452116597358270022*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y-.85144646682733702260582986791350110*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (5.2151096093174392634607079409701943 + 2.9800626338956795791204045376972539*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .59601252677913591582408090753945079*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a)*a)*a)*a; + return .25543394004820110678174896037405033*b4*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((-1.7880375803374077474722427226183523 - 1.0217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .25543394004820110678174896037405033*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + (-2.5543394004820110678174896037405033*b2*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((2.9800626338956795791204045376972539 + 1.7028929336546740452116597358270022*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y - .85144646682733702260582986791350110*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (5.2151096093174392634607079409701943 + 2.9800626338956795791204045376972539*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .59601252677913591582408090753945079*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a)*a)*a)*a; } inline double jacobi_f35_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1923,28 +1923,28 @@ namespace Hermes inline double jacobi_f35_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-3.5760751606748154949444854452367047-2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .51086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + ((-3.5760751606748154949444854452367047-2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + (-11.239093362120848698396954256458215*y-9.1956218417352398441429625734658122 + 1.4048866702651060872996192820572768*b)*b)*b2 + ((17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y-5.1086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + (18.731822270201414497328257094097024*y + 15.326036402892066406904937622443020-4.6829555675503536243320642735242559*b)*b + (32.780688972852475370324449914669793*y + 26.820563705061116212083640839275286 + 3.2780688972852475370324449914669793*a)*a)*a)*a)*a; + return (-3.5760751606748154949444854452367047 - 2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .51086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + ((-3.5760751606748154949444854452367047 - 2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + (-11.239093362120848698396954256458215*y - 9.1956218417352398441429625734658122 + 1.4048866702651060872996192820572768*b)*b)*b2 + ((17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y - 5.1086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + (18.731822270201414497328257094097024*y + 15.326036402892066406904937622443020 - 4.6829555675503536243320642735242559*b)*b + (32.780688972852475370324449914669793*y + 26.820563705061116212083640839275286 + 3.2780688972852475370324449914669793*a)*a)*a)*a)*a; } inline double jacobi_f35_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-3.5760751606748154949444854452367047-2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .51086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + (-10.217357601928044271269958414962013*b2*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y-5.1086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (41.720876874539514107685663527761555 + 23.840501071165436632963236301578031*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + 5.9601252677913591582408090753945079*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a)*a)*a; + return (-3.5760751606748154949444854452367047 - 2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .51086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + (-10.217357601928044271269958414962013*b2*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y - 5.1086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (41.720876874539514107685663527761555 + 23.840501071165436632963236301578031*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + 5.9601252677913591582408090753945079*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a)*a)*a; } // number 36 inline double jacobi_f36(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -1955,7 +1955,7 @@ namespace Hermes inline double jacobi_f36_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1967,19 +1967,19 @@ namespace Hermes inline double jacobi_f36_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.12872301429969852374331755029475975 + .12872301429969852374331755029475975*y-.21453835716616420623886258382459958e-1*b)*b5 + (.64361507149849261871658775147379875*b4*(1. + y) + ((-1.2872301429969852374331755029475975-1.2872301429969852374331755029475975*y + .32180753574924630935829387573689937*b)*b3 + (-3.0035370003262988873440761735443942*b2*(1. + y) + ((1.5017685001631494436720380867721971 + 1.5017685001631494436720380867721971*y-.75088425008157472183601904338609854*b)*b + (2.7031833002936689986096685561899547 + 2.7031833002936689986096685561899547*y + .45053055004894483310161142603165912*a)*a)*a)*a)*a)*a; + return (.12872301429969852374331755029475975 + .12872301429969852374331755029475975*y - .21453835716616420623886258382459958e-1 * b)*b5 + (.64361507149849261871658775147379875*b4*(1. + y) + ((-1.2872301429969852374331755029475975 - 1.2872301429969852374331755029475975*y + .32180753574924630935829387573689937*b)*b3 + (-3.0035370003262988873440761735443942*b2*(1. + y) + ((1.5017685001631494436720380867721971 + 1.5017685001631494436720380867721971*y - .75088425008157472183601904338609854*b)*b + (2.7031833002936689986096685561899547 + 2.7031833002936689986096685561899547*y + .45053055004894483310161142603165912*a)*a)*a)*a)*a)*a; } inline double jacobi_f36_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -1991,23 +1991,23 @@ namespace Hermes inline double jacobi_f36_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return .25744602859939704748663510058951950*b5 + ((-5.1489205719879409497327020117903900-5.1489205719879409497327020117903900*y + 1.2872301429969852374331755029475975*b)*b3 + ((-5.1489205719879409497327020117903900-5.1489205719879409497327020117903900*y-2.5744602859939704748663510058951950*b)*b2 + ((12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y-6.0070740006525977746881523470887883*b)*b + (12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y + 3.0035370003262988873440761735443942*b + 5.4063666005873379972193371123799095*a)*a)*a)*a)*a; + return .25744602859939704748663510058951950*b5 + ((-5.1489205719879409497327020117903900 - 5.1489205719879409497327020117903900*y + 1.2872301429969852374331755029475975*b)*b3 + ((-5.1489205719879409497327020117903900 - 5.1489205719879409497327020117903900*y - 2.5744602859939704748663510058951950*b)*b2 + ((12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y - 6.0070740006525977746881523470887883*b)*b + (12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y + 3.0035370003262988873440761735443942*b + 5.4063666005873379972193371123799095*a)*a)*a)*a)*a; } inline double jacobi_f36_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return 1.2872301429969852374331755029475975*b4*(1. + y) + ((-5.1489205719879409497327020117903900-5.1489205719879409497327020117903900*y + 1.2872301429969852374331755029475975*b)*b3 + (-18.021222001957793324064457041266365*b2*(1. + y) + ((12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y-6.0070740006525977746881523470887883*b)*b + (27.031833002936689986096685561899547 + 27.031833002936689986096685561899547*y + 5.4063666005873379972193371123799095*a)*a)*a)*a)*a; + return 1.2872301429969852374331755029475975*b4*(1. + y) + ((-5.1489205719879409497327020117903900 - 5.1489205719879409497327020117903900*y + 1.2872301429969852374331755029475975*b)*b3 + (-18.021222001957793324064457041266365*b2*(1. + y) + ((12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y - 6.0070740006525977746881523470887883*b)*b + (27.031833002936689986096685561899547 + 27.031833002936689986096685561899547*y + 5.4063666005873379972193371123799095*a)*a)*a)*a)*a; } // ORDER 8 @@ -2018,58 +2018,58 @@ namespace Hermes inline double jacobi_f37(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return .41787914848721779896314222930969401e-3*b8 + (-.11700616157642098370967982420671432e-1*b6 + (.52652772709389442669355920893021445e-1*b4 + (-.77224066640437849248388683976431453e-1*b2 + .35854030940203287151037603274771746e-1*a2)*a2)*a2)*a2; + return .41787914848721779896314222930969401e-3 * b8 + (-.11700616157642098370967982420671432e-1 * b6 + (.52652772709389442669355920893021445e-1 * b4 + (-.77224066640437849248388683976431453e-1 * b2 + .35854030940203287151037603274771746e-1 * a2)*a2)*a2)*a2; } inline double jacobi_f37_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return (-.46802464630568393483871929682685729e-1*b6 + (.42122218167511554135484736714417156*b4 + (-.92668879968525419098066420771717743*b2 + .57366449504325259441660165239634793*a2)*a2)*a2)*a; + return (-.46802464630568393483871929682685729e-1 * b6 + (.42122218167511554135484736714417156*b4 + (-.92668879968525419098066420771717743*b2 + .57366449504325259441660165239634793*a2)*a2)*a2)*a; } inline double jacobi_f37_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.33430331878977423917051378344775521e-2*b7 + (-.23401232315284196741935964841342864e-1*b6 + (.70203696945852590225807894524028593e-1*b5 + (.21061109083755777067742368357208578*b4 + (-.21061109083755777067742368357208578*b3 + (-.46334439984262709549033210385858872*b2 + (.15444813328087569849677736795286291*b + .28683224752162629720830082619817397*a)*a)*a)*a)*a)*a)*a; + return -.33430331878977423917051378344775521e-2 * b7 + (-.23401232315284196741935964841342864e-1 * b6 + (.70203696945852590225807894524028593e-1 * b5 + (.21061109083755777067742368357208578*b4 + (-.21061109083755777067742368357208578*b3 + (-.46334439984262709549033210385858872*b2 + (.15444813328087569849677736795286291*b + .28683224752162629720830082619817397*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f37_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.93604929261136786967743859365371458e-1*b6 + (2.5273330900506932481290842028650294*b4 + (-9.2668879968525419098066420771717743*b2 + 8.0313029306055363218324231335488711*a2)*a2)*a2; + return -.93604929261136786967743859365371458e-1 * b6 + (2.5273330900506932481290842028650294*b4 + (-9.2668879968525419098066420771717743*b2 + 8.0313029306055363218324231335488711*a2)*a2)*a2; } inline double jacobi_f37_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; @@ -2080,31 +2080,31 @@ namespace Hermes inline double jacobi_f37_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.46802464630568393483871929682685729e-1*b6 + (.28081478778341036090323157809611437*b5 + (1.2636665450253466240645421014325147*b4 + (-1.6848887267004621654193894685766862*b3 + (-4.6334439984262709549033210385858872*b2 + (1.8533775993705083819613284154343549*b + 4.0156514653027681609162115667744355*a)*a)*a)*a)*a)*a; + return -.46802464630568393483871929682685729e-1 * b6 + (.28081478778341036090323157809611437*b5 + (1.2636665450253466240645421014325147*b4 + (-1.6848887267004621654193894685766862*b3 + (-4.6334439984262709549033210385858872*b2 + (1.8533775993705083819613284154343549*b + 4.0156514653027681609162115667744355*a)*a)*a)*a)*a)*a; } // number 38 inline double jacobi_f38(double x, double y) { double y2 = y*y; - return -.21395412402545551306912882140656333e-1*(x + 1.)*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); + return -.21395412402545551306912882140656333e-1 * (x + 1.)*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); } inline double jacobi_f38_dx(double x, double y) { double y2 = y*y; - return -.21395412402545551306912882140656333e-1*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); + return -.21395412402545551306912882140656333e-1 * (-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); } inline double jacobi_f38_dy(double x, double y) { - return -.21395412402545551306912882140656333e-1*(x + 1.)*(-5. + (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y); + return -.21395412402545551306912882140656333e-1 * (x + 1.)*(-5. + (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y); } inline double jacobi_f38_dxx(double x, double y) @@ -2119,25 +2119,25 @@ namespace Hermes inline double jacobi_f38_dxy(double x, double y) { - return .10697706201272775653456441070328166-.21395412402545551306912882140656333e-1*(270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y; + return .10697706201272775653456441070328166 - .21395412402545551306912882140656333e-1 * (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y; } // number 39 inline double jacobi_f39(double x, double y) { double y2 = y*y; - return .21395412402545551306912882140656333e-1*(x + y)*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); + return .21395412402545551306912882140656333e-1 * (x + y)*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); } inline double jacobi_f39_dx(double x, double y) { double y2 = y*y; - return .21395412402545551306912882140656333e-1*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); + return .21395412402545551306912882140656333e-1 * (-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); } inline double jacobi_f39_dy(double x, double y) { - return -.10697706201272775653456441070328166 + .21395412402545551306912882140656333e-1*(-10. + (405. + (540. + (-2475. + (-2970. + (3003. + 3432.*y)*y)*y)*y)*y)*y)*y + .21395412402545551306912882140656333e-1*(-5. + (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y)*x; + return -.10697706201272775653456441070328166 + .21395412402545551306912882140656333e-1 * (-10. + (405. + (540. + (-2475. + (-2970. + (3003. + 3432.*y)*y)*y)*y)*y)*y)*y + .21395412402545551306912882140656333e-1 * (-5. + (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y)*x; } inline double jacobi_f39_dxx(double x, double y) @@ -2147,12 +2147,12 @@ namespace Hermes inline double jacobi_f39_dyy(double x, double y) { - return -.21395412402545551306912882140656333 + .42790824805091102613825764281312666e-1*(405. + (810. + (-4950. + (-7425. + (9009. + 12012.*y)*y)*y)*y)*y)*y + .42790824805091102613825764281312666e-1*(135. + (405. + (-2970. + (-4950. + (6435. + 9009.*y)*y)*y)*y)*y)*x; + return -.21395412402545551306912882140656333 + .42790824805091102613825764281312666e-1 * (405. + (810. + (-4950. + (-7425. + (9009. + 12012.*y)*y)*y)*y)*y)*y + .42790824805091102613825764281312666e-1 * (135. + (405. + (-2970. + (-4950. + (6435. + 9009.*y)*y)*y)*y)*y)*x; } inline double jacobi_f39_dxy(double x, double y) { - return -.10697706201272775653456441070328166 + .21395412402545551306912882140656333e-1*(270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y; + return -.10697706201272775653456441070328166 + .21395412402545551306912882140656333e-1 * (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y; } // Bubble functions, order 8 @@ -2161,10 +2161,10 @@ namespace Hermes inline double jacobi_f40(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.6233099319400270136250045367308206*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(.78125000000000000000000000000000000e-1 + (.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y); + return 1.6233099319400270136250045367308206*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(.78125000000000000000000000000000000e-1 + (.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y); } inline double jacobi_f40_dx(double x, double y) @@ -2176,8 +2176,8 @@ namespace Hermes inline double jacobi_f40_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.15532347764238887165464436921518476 + 1.9881405138225775571794479259543650*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y-.99407025691128877858972396297718251*(.78125000000000000000000000000000000 + (-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (.15532347764238887165464436921518476 + 1.9881405138225775571794479259543650*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y + .99407025691128877858972396297718251*(.78125000000000000000000000000000000 + (-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (.15532347764238887165464436921518476 + 1.9881405138225775571794479259543650*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y - .99407025691128877858972396297718251*(.78125000000000000000000000000000000 + (-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (.15532347764238887165464436921518476 + 1.9881405138225775571794479259543650*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y + .99407025691128877858972396297718251*(.78125000000000000000000000000000000 + (-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; } inline double jacobi_f40_dxx(double x, double y) @@ -2188,8 +2188,8 @@ namespace Hermes inline double jacobi_f40_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (3.1064695528477774330928873843036954 + 3.9762810276451551143588958519087301*(-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y-.99407025691128877858972396297718251*(-1.4062500000000000000000000000000000 + (-39.375000000000000000000000000000000 + (-30.937500000000000000000000000000000 + (185.62500000000000000000000000000000 + 201.09375000000000000000000000000000*y)*y)*y)*y)*b)*b + (3.1064695528477774330928873843036954 + 3.9762810276451551143588958519087301*(-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y + .99407025691128877858972396297718251*(-1.4062500000000000000000000000000000 + (-39.375000000000000000000000000000000 + (-30.937500000000000000000000000000000 + (185.62500000000000000000000000000000 + 201.09375000000000000000000000000000*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (3.1064695528477774330928873843036954 + 3.9762810276451551143588958519087301*(-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y - .99407025691128877858972396297718251*(-1.4062500000000000000000000000000000 + (-39.375000000000000000000000000000000 + (-30.937500000000000000000000000000000 + (185.62500000000000000000000000000000 + 201.09375000000000000000000000000000*y)*y)*y)*y)*b)*b + (3.1064695528477774330928873843036954 + 3.9762810276451551143588958519087301*(-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y + .99407025691128877858972396297718251*(-1.4062500000000000000000000000000000 + (-39.375000000000000000000000000000000 + (-30.937500000000000000000000000000000 + (185.62500000000000000000000000000000 + 201.09375000000000000000000000000000*y)*y)*y)*y)*a)*a; } inline double jacobi_f40_dxy(double x, double y) @@ -2202,7 +2202,7 @@ namespace Hermes inline double jacobi_f41(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return 1.4187993420613458492725943245537961*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y); @@ -2211,18 +2211,18 @@ namespace Hermes inline double jacobi_f41_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.4187993420613458492725943245537961*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y); + return 1.4187993420613458492725943245537961*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y); } inline double jacobi_f41_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; - return -1.1216593659155472035363028403674680*b2*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y) + ((-.14020742073944340044203785504593349 + 2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y-1.1216593659155472035363028403674680*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.21031113110916510066305678256890025 + 3.3649780977466416106089085211024040*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + 1.1216593659155472035363028403674680*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; + return -1.1216593659155472035363028403674680*b2*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y) + ((-.14020742073944340044203785504593349 + 2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y - 1.1216593659155472035363028403674680*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.21031113110916510066305678256890025 + 3.3649780977466416106089085211024040*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + 1.1216593659155472035363028403674680*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; } inline double jacobi_f41_dxx(double x, double y) @@ -2234,22 +2234,22 @@ namespace Hermes inline double jacobi_f41_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y-2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + (-8.1320304028877172256381955926641427 + 4.4866374636621888141452113614698719*(-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y-1.1216593659155472035363028403674680*(-6.2500000000000000000000000000000000 + (41.250000000000000000000000000000000 + (206.25000000000000000000000000000000 + 178.75000000000000000000000000000000*y)*y)*y)*b)*b + (-12.198045604331575838457293388996214 + 6.7299561954932832212178170422048078*(-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y + 1.1216593659155472035363028403674680*(-6.2500000000000000000000000000000000 + (41.250000000000000000000000000000000 + (206.25000000000000000000000000000000 + 178.75000000000000000000000000000000*y)*y)*y)*a)*a)*a; + double b = 1.0 - y; + return (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y - 2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + (-8.1320304028877172256381955926641427 + 4.4866374636621888141452113614698719*(-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y - 1.1216593659155472035363028403674680*(-6.2500000000000000000000000000000000 + (41.250000000000000000000000000000000 + (206.25000000000000000000000000000000 + 178.75000000000000000000000000000000*y)*y)*y)*b)*b + (-12.198045604331575838457293388996214 + 6.7299561954932832212178170422048078*(-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y + 1.1216593659155472035363028403674680*(-6.2500000000000000000000000000000000 + (41.250000000000000000000000000000000 + (206.25000000000000000000000000000000 + 178.75000000000000000000000000000000*y)*y)*y)*a)*a)*a; } inline double jacobi_f41_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y-2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.84124452443666040265222713027560098 + 13.459912390986566442435634084409616*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + 6.7299561954932832212178170422048078*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y - 2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.84124452443666040265222713027560098 + 13.459912390986566442435634084409616*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + 6.7299561954932832212178170422048078*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*a)*a; } // number 42 inline double jacobi_f42(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -2259,7 +2259,7 @@ namespace Hermes inline double jacobi_f42_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .82946008478893335842946748358641783*(-5.6124860801609120783756230984748240*b2 + 9.3541434669348534639593718307913732*a2)*a*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y); @@ -2268,43 +2268,43 @@ namespace Hermes inline double jacobi_f42_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (.24246526978786345616698149680517773-.77588886332116305973434078977656874*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + .19397221583029076493358519744414218*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b3 + (-2.3276665899634891792030223693297061*b2*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y) + ((-.72739580936359036850094449041553317 + 2.3276665899634891792030223693297061*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y-1.1638332949817445896015111846648531*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-1.2123263489393172808349074840258886 + 3.8794443166058152986717039488828435*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + .96986107915145382466792598722071090*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; + return (.24246526978786345616698149680517773 - .77588886332116305973434078977656874*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + .19397221583029076493358519744414218*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b3 + (-2.3276665899634891792030223693297061*b2*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y) + ((-.72739580936359036850094449041553317 + 2.3276665899634891792030223693297061*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y - 1.1638332949817445896015111846648531*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-1.2123263489393172808349074840258886 + 3.8794443166058152986717039488828435*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + .96986107915145382466792598722071090*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; } inline double jacobi_f42_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .82946008478893335842946748358641783*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y); + return .82946008478893335842946748358641783*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y); } inline double jacobi_f42_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (-2.7156110216240707090701927642179905-1.5517777266423261194686815795531374*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y + .19397221583029076493358519744414218*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*b)*b3 + ((-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y-4.6553331799269783584060447386594123*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + (8.1468330648722121272105782926539716 + 4.6553331799269783584060447386594123*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y-1.1638332949817445896015111846648531*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*b)*b + (13.578055108120353545350963821089953 + 7.7588886332116305973434078977656874*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y + .96986107915145382466792598722071090*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*a)*a)*a)*a; + return (-2.7156110216240707090701927642179905 - 1.5517777266423261194686815795531374*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y + .19397221583029076493358519744414218*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*b)*b3 + ((-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y - 4.6553331799269783584060447386594123*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + (8.1468330648722121272105782926539716 + 4.6553331799269783584060447386594123*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y - 1.1638332949817445896015111846648531*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*b)*b + (13.578055108120353545350963821089953 + 7.7588886332116305973434078977656874*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y + .96986107915145382466792598722071090*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*a)*a)*a)*a; } inline double jacobi_f42_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; - return -4.6553331799269783584060447386594123*b2*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y) + ((-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y-4.6553331799269783584060447386594123*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-7.2739580936359036850094449041553317 + 23.276665899634891792030223693297061*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + 7.7588886332116305973434078977656874*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*a)*a)*a; + return -4.6553331799269783584060447386594123*b2*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y) + ((-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y - 4.6553331799269783584060447386594123*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-7.2739580936359036850094449041553317 + 23.276665899634891792030223693297061*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + 7.7588886332116305973434078977656874*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*a)*a)*a; } // number 43 inline double jacobi_f43(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -2314,7 +2314,7 @@ namespace Hermes inline double jacobi_f43_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -2325,17 +2325,17 @@ namespace Hermes inline double jacobi_f43_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .33292808027579391902410751141834787*b4*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((-1.9975684816547635141446450685100873-1.3317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .33292808027579391902410751141834787*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + (-3.3292808027579391902410751141834787*b2*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((3.3292808027579391902410751141834788 + 2.2195205351719594601607167427889859*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y-1.1097602675859797300803583713944929*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (5.8262414048263935829218814498210879 + 3.8841609365509290552812542998807252*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .77683218731018581105625085997614505*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; + return .33292808027579391902410751141834787*b4*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((-1.9975684816547635141446450685100873 - 1.3317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .33292808027579391902410751141834787*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + (-3.3292808027579391902410751141834787*b2*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((3.3292808027579391902410751141834788 + 2.2195205351719594601607167427889859*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y - 1.1097602675859797300803583713944929*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (5.8262414048263935829218814498210879 + 3.8841609365509290552812542998807252*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .77683218731018581105625085997614505*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; } inline double jacobi_f43_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .41851680570743669240797557420461342*(-63.639610306789277196075992589436414*b2 + 148.49242404917498012417731604201830*a2)*a*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y); @@ -2344,26 +2344,26 @@ namespace Hermes inline double jacobi_f43_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (-3.9951369633095270282892901370201747-2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .66585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + ((-3.9951369633095270282892901370201747-2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + (-22.639109458753986493639310776447656-2.6634246422063513521928600913467831*(27. + 19.500000000000000000000000000000000*y)*y + .33292808027579391902410751141834787*(39.*y + 27.)*b)*b)*b2 + ((19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y-6.6585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + (37.731849097923310822732184627412759 + 4.4390410703439189203214334855779718*(27. + 19.500000000000000000000000000000000*y)*y-1.1097602675859797300803583713944929*(39.*y + 27.)*b)*b + (66.030735921365793939781323097972327 + 7.7683218731018581105625085997614505*(27. + 19.500000000000000000000000000000000*y)*y + .77683218731018581105625085997614505*(39.*y + 27.)*a)*a)*a)*a)*a; + return (-3.9951369633095270282892901370201747 - 2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .66585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + ((-3.9951369633095270282892901370201747 - 2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + (-22.639109458753986493639310776447656 - 2.6634246422063513521928600913467831*(27. + 19.500000000000000000000000000000000*y)*y + .33292808027579391902410751141834787*(39.*y + 27.)*b)*b)*b2 + ((19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y - 6.6585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + (37.731849097923310822732184627412759 + 4.4390410703439189203214334855779718*(27. + 19.500000000000000000000000000000000*y)*y - 1.1097602675859797300803583713944929*(39.*y + 27.)*b)*b + (66.030735921365793939781323097972327 + 7.7683218731018581105625085997614505*(27. + 19.500000000000000000000000000000000*y)*y + .77683218731018581105625085997614505*(39.*y + 27.)*a)*a)*a)*a)*a; } inline double jacobi_f43_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (-3.9951369633095270282892901370201747-2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .66585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + (-13.317123211031756760964300456733915*b2*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y-6.6585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (46.609931238611148663375051598568703 + 31.073287492407432442250034399045802*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + 7.7683218731018581105625085997614505*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*a)*a)*a)*a; + return (-3.9951369633095270282892901370201747 - 2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .66585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + (-13.317123211031756760964300456733915*b2*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y - 6.6585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (46.609931238611148663375051598568703 + 31.073287492407432442250034399045802*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + 7.7683218731018581105625085997614505*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*a)*a)*a)*a; } // number 44 inline double jacobi_f44(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -2374,7 +2374,7 @@ namespace Hermes inline double jacobi_f44_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -2385,18 +2385,18 @@ namespace Hermes inline double jacobi_f44_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.39148713351102899664245105172126804 + .17399428156045733184108935632056358*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y-.28999046926742888640181559386760596e-1*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b5 + (.86997140780228665920544678160281788*b4*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((-3.9148713351102899664245105172126804-1.7399428156045733184108935632056358*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + .43498570390114332960272339080140894*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + (-4.0598665697440044096254183141464834*b2*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((4.5673498909620049608285956034147938 + 2.0299332848720022048127091570732417*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y-1.0149666424360011024063545785366209*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (8.2212298037316089294914720861466287 + 3.6538799127696039686628764827318351*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + .60897998546160066144381274712197252*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a; + return (.39148713351102899664245105172126804 + .17399428156045733184108935632056358*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y - .28999046926742888640181559386760596e-1 * (6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b5 + (.86997140780228665920544678160281788*b4*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((-3.9148713351102899664245105172126804 - 1.7399428156045733184108935632056358*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + .43498570390114332960272339080140894*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + (-4.0598665697440044096254183141464834*b2*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((4.5673498909620049608285956034147938 + 2.0299332848720022048127091570732417*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y - 1.0149666424360011024063545785366209*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (8.2212298037316089294914720861466287 + 3.6538799127696039686628764827318351*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + .60897998546160066144381274712197252*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a; } inline double jacobi_f44_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -2407,92 +2407,92 @@ namespace Hermes inline double jacobi_f44_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (2.2619256602859453139341616321673265*y + 1.9139370971650306502519829195261993-.18849380502382877616118013601394388*b)*b5 + ((-15.659485340441159865698042068850722-6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 1.7399428156045733184108935632056358*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + ((-15.659485340441159865698042068850722-6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + (-22.619256602859453139341616321673265*y-19.139370971650306502519829195261993 + 2.8274070753574316424177020402091581*b)*b)*b2 + ((36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y-8.1197331394880088192508366282929670*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + (26.389132703336028662565219041952143*y + 22.329266133592024252939800727805659-6.5972831758340071656413047604880354*b)*b + (47.500438866004851592617394275513857*y + 40.192679040465643655291641310050186 + 3.9583699055004042993847828562928213*a)*a)*a)*a)*a)*a; + return (2.2619256602859453139341616321673265*y + 1.9139370971650306502519829195261993 - .18849380502382877616118013601394388*b)*b5 + ((-15.659485340441159865698042068850722 - 6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 1.7399428156045733184108935632056358*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + ((-15.659485340441159865698042068850722 - 6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + (-22.619256602859453139341616321673265*y - 19.139370971650306502519829195261993 + 2.8274070753574316424177020402091581*b)*b)*b2 + ((36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y - 8.1197331394880088192508366282929670*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + (26.389132703336028662565219041952143*y + 22.329266133592024252939800727805659 - 6.5972831758340071656413047604880354*b)*b + (47.500438866004851592617394275513857*y + 40.192679040465643655291641310050186 + 3.9583699055004042993847828562928213*a)*a)*a)*a)*a)*a; } inline double jacobi_f44_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return 1.7399428156045733184108935632056358*b4*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((-15.659485340441159865698042068850722-6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 1.7399428156045733184108935632056358*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + (-24.359199418464026457752509884878900*b2*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y-8.1197331394880088192508366282929670*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (82.212298037316089294914720861466287 + 36.538799127696039686628764827318351*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 7.3077598255392079373257529654636703*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*a)*a)*a)*a)*a; + return 1.7399428156045733184108935632056358*b4*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((-15.659485340441159865698042068850722 - 6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 1.7399428156045733184108935632056358*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + (-24.359199418464026457752509884878900*b2*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y - 8.1197331394880088192508366282929670*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (82.212298037316089294914720861466287 + 36.538799127696039686628764827318351*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 7.3077598255392079373257529654636703*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*a)*a)*a)*a)*a; } // number 45 inline double jacobi_f45(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; - return .91069207987015857989057523397342891e-1*(-.79672179899887262969191001703480969*b6 + (5.5770525929921084078433701192436678*b4 + (-10.038694667385795134118066214638602*b2 + 5.2583638733925593559666061124297439*a2)*a2)*a2)*a*(1. + y); + return .91069207987015857989057523397342891e-1 * (-.79672179899887262969191001703480969*b6 + (5.5770525929921084078433701192436678*b4 + (-10.038694667385795134118066214638602*b2 + 5.2583638733925593559666061124297439*a2)*a2)*a2)*a*(1. + y); } inline double jacobi_f45_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return .91069207987015857989057523397342891e-1*(-1.5934435979977452593838200340696194*b6 + (33.462315557952650447060220715462007*b4 + (-100.38694667385795134118066214638602*b2 + 73.617094227495830983532485574016415*a2)*a2)*a2)*(1. + y); + return .91069207987015857989057523397342891e-1 * (-1.5934435979977452593838200340696194*b6 + (33.462315557952650447060220715462007*b4 + (-100.38694667385795134118066214638602*b2 + 73.617094227495830983532485574016415*a2)*a2)*a2)*(1. + y); } inline double jacobi_f45_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.72556823220817774297504599550421409e-1*b6*(1. + y) + ((.43534093932490664578502759730252845 + .43534093932490664578502759730252845*y-.72556823220817774297504599550421409e-1*b)*b5 + (1.5236932876371732602475965905588496*b4*(1. + y) + ((-2.0315910501828976803301287874117995-2.0315910501828976803301287874117995*y + .50789776254572442008253219685294985*b)*b3 + (-4.5710798629115197807427897716765487*b2*(1. + y) + ((1.8284319451646079122971159086706195 + 1.8284319451646079122971159086706195*y-.91421597258230395614855795433530975*b)*b + (3.3521252328017811725447124992294690 + 3.3521252328017811725447124992294690*y + .47887503325739731036353035703278130*a)*a)*a)*a)*a)*a)*a; + return -.72556823220817774297504599550421409e-1 * b6*(1. + y) + ((.43534093932490664578502759730252845 + .43534093932490664578502759730252845*y - .72556823220817774297504599550421409e-1 * b)*b5 + (1.5236932876371732602475965905588496*b4*(1. + y) + ((-2.0315910501828976803301287874117995 - 2.0315910501828976803301287874117995*y + .50789776254572442008253219685294985*b)*b3 + (-4.5710798629115197807427897716765487*b2*(1. + y) + ((1.8284319451646079122971159086706195 + 1.8284319451646079122971159086706195*y - .91421597258230395614855795433530975*b)*b + (3.3521252328017811725447124992294690 + 3.3521252328017811725447124992294690*y + .47887503325739731036353035703278130*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f45_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .91069207987015857989057523397342891e-1*(133.84926223181060178824088286184803*b4 + (-803.09557339086361072944529717108816*b2 + 883.40513072994997180238982688819698*a2)*a2)*a*(1. + y); + return .91069207987015857989057523397342891e-1 * (133.84926223181060178824088286184803*b4 + (-803.09557339086361072944529717108816*b2 + 883.40513072994997180238982688819698*a2)*a2)*a*(1. + y); } inline double jacobi_f45_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y-.14511364644163554859500919910084282*b)*b5 + ((.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y + .87068187864981329157005519460505690*b)*b4 + ((-12.189546301097386081980772724470796-12.189546301097386081980772724470796*y + 3.0473865752743465204951931811176992*b)*b3 + ((-12.189546301097386081980772724470796-12.189546301097386081980772724470796*y-4.0631821003657953606602575748235988*b)*b2 + ((18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y-9.1421597258230395614855795433530975*b)*b + (18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y + 3.6568638903292158245942318173412390*b + 6.7042504656035623450894249984589381*a)*a)*a)*a)*a)*a; + return (.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y - .14511364644163554859500919910084282*b)*b5 + ((.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y + .87068187864981329157005519460505690*b)*b4 + ((-12.189546301097386081980772724470796 - 12.189546301097386081980772724470796*y + 3.0473865752743465204951931811176992*b)*b3 + ((-12.189546301097386081980772724470796 - 12.189546301097386081980772724470796*y - 4.0631821003657953606602575748235988*b)*b2 + ((18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y - 9.1421597258230395614855795433530975*b)*b + (18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y + 3.6568638903292158245942318173412390*b + 6.7042504656035623450894249984589381*a)*a)*a)*a)*a)*a; } inline double jacobi_f45_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y-.14511364644163554859500919910084282*b)*b5 + (6.0947731505486930409903863622353983*b4*(1. + y) + ((-12.189546301097386081980772724470796-12.189546301097386081980772724470796*y + 3.0473865752743465204951931811176992*b)*b3 + (-36.568638903292158245942318173412390*b2*(1. + y) + ((18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y-9.1421597258230395614855795433530975*b)*b + (40.225502793621374070536549990753629 + 40.225502793621374070536549990753629*y + 6.7042504656035623450894249984589381*a)*a)*a)*a)*a)*a; + return (.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y - .14511364644163554859500919910084282*b)*b5 + (6.0947731505486930409903863622353983*b4*(1. + y) + ((-12.189546301097386081980772724470796 - 12.189546301097386081980772724470796*y + 3.0473865752743465204951931811176992*b)*b3 + (-36.568638903292158245942318173412390*b2*(1. + y) + ((18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y - 9.1421597258230395614855795433530975*b)*b + (40.225502793621374070536549990753629 + 40.225502793621374070536549990753629*y + 6.7042504656035623450894249984589381*a)*a)*a)*a)*a)*a; } // ORDER 9 @@ -2503,13 +2503,13 @@ namespace Hermes inline double jacobi_f46_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return (.15570321374480096167037609154822953e-2*b8 + (-.18684385649376115400445130985787544e-1*b6 + (.61658472642941180821468932253098894e-1*b4 + (-.76339061367450985778961535170503392e-1*b2 + .31807942236437910741233972987709747e-1*a2)*a2)*a2)*a2)*a; + return (.15570321374480096167037609154822953e-2 * b8 + (-.18684385649376115400445130985787544e-1 * b6 + (.61658472642941180821468932253098894e-1 * b4 + (-.76339061367450985778961535170503392e-1 * b2 + .31807942236437910741233972987709747e-1 * a2)*a2)*a2)*a2)*a; } inline double jacobi_f46_1(double x, double y) @@ -2520,7 +2520,7 @@ namespace Hermes inline double jacobi_f46_dx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -2529,7 +2529,7 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .31140642748960192334075218309645906e-2*b8 + (-.11210631389625669240267078591472526*b6 + (.61658472642941180821468932253098894*b4 + (-1.0687468591443138009054614923870475*b2 + .57254296025588239334221151377877544*a2)*a2)*a2)*a2; + return .31140642748960192334075218309645906e-2 * b8 + (-.11210631389625669240267078591472526*b6 + (.61658472642941180821468932253098894*b4 + (-1.0687468591443138009054614923870475*b2 + .57254296025588239334221151377877544*a2)*a2)*a2)*a2; } inline double jacobi_f46_dx_1(double x, double y) @@ -2540,7 +2540,7 @@ namespace Hermes inline double jacobi_f46_dy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; @@ -2548,7 +2548,7 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .15570321374480096167037609154822953e-2*b8 + (-.12456257099584076933630087323858362e-1*b7 + (-.56053156948128346201335392957362631e-1*b6 + (.11210631389625669240267078591472526*b5 + (.30829236321470590410734466126549447*b4 + (-.24663389057176472328587572901239557*b3 + (-.53437342957215690045273074619352374*b2 + (.15267812273490197155792307034100678*b + .28627148012794119667110575688938772*a)*a)*a)*a)*a)*a)*a)*a; + return .15570321374480096167037609154822953e-2 * b8 + (-.12456257099584076933630087323858362e-1 * b7 + (-.56053156948128346201335392957362631e-1 * b6 + (.11210631389625669240267078591472526*b5 + (.30829236321470590410734466126549447*b4 + (-.24663389057176472328587572901239557*b3 + (-.53437342957215690045273074619352374*b2 + (.15267812273490197155792307034100678*b + .28627148012794119667110575688938772*a)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f46_dy_1(double x, double y) @@ -2559,7 +2559,7 @@ namespace Hermes inline double jacobi_f46_dxx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -2577,14 +2577,14 @@ namespace Hermes inline double jacobi_f46_dyy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.24912514199168153867260174647716725e-1*b7 + (-.24912514199168153867260174647716725e-1*b6 + (.67263788337754015441602471548835157*b5 + (.67263788337754015441602471548835157*b4 + (-2.4663389057176472328587572901239557*b3 + (-2.4663389057176472328587572901239557*b2 + (2.1374937182886276018109229847740950*b + 2.1374937182886276018109229847740950*a)*a)*a)*a)*a)*a)*a; + return -.24912514199168153867260174647716725e-1 * b7 + (-.24912514199168153867260174647716725e-1 * b6 + (.67263788337754015441602471548835157*b5 + (.67263788337754015441602471548835157*b4 + (-2.4663389057176472328587572901239557*b3 + (-2.4663389057176472328587572901239557*b2 + (2.1374937182886276018109229847740950*b + 2.1374937182886276018109229847740950*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f46_dyy_1(double x, double y) @@ -2595,14 +2595,14 @@ namespace Hermes inline double jacobi_f46_dxy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.24912514199168153867260174647716725e-1*b7 + (-.22421262779251338480534157182945052*b6 + (.67263788337754015441602471548835157*b5 + (2.4663389057176472328587572901239557*b4 + (-2.4663389057176472328587572901239557*b3 + (-6.4124811548658828054327689543222849*b2 + (2.1374937182886276018109229847740950*b + 4.5803436820470591467376921102302035*a)*a)*a)*a)*a)*a)*a; + return -.24912514199168153867260174647716725e-1 * b7 + (-.22421262779251338480534157182945052*b6 + (.67263788337754015441602471548835157*b5 + (2.4663389057176472328587572901239557*b4 + (-2.4663389057176472328587572901239557*b3 + (-6.4124811548658828054327689543222849*b2 + (2.1374937182886276018109229847740950*b + 4.5803436820470591467376921102302035*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f46_dxy_1(double x, double y) @@ -2614,7 +2614,7 @@ namespace Hermes inline double jacobi_f47_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(x + 1.)*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); + return -.22777155839239454964352159677912434e-1 * (x + 1.)*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); } // number 47 @@ -2626,7 +2626,7 @@ namespace Hermes inline double jacobi_f47_dx_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); + return -.22777155839239454964352159677912434e-1 * (-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); } inline double jacobi_f47_dx_1(double x, double y) @@ -2636,7 +2636,7 @@ namespace Hermes inline double jacobi_f47_dy_0(double x, double y) { - return -.22777155839239454964352159677912434e-1*(x + 1.)*(-35. + (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y); + return -.22777155839239454964352159677912434e-1 * (x + 1.)*(-35. + (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y); } inline double jacobi_f47_dy_1(double x, double y) @@ -2666,7 +2666,7 @@ namespace Hermes inline double jacobi_f47_dxy_0(double x, double y) { - return .79720045437338092375232558872693520-.22777155839239454964352159677912434e-1*(-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y; + return .79720045437338092375232558872693520 - .22777155839239454964352159677912434e-1 * (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y; } inline double jacobi_f47_dxy_1(double x, double y) @@ -2678,7 +2678,7 @@ namespace Hermes inline double jacobi_f48_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(x + y)*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); + return -.22777155839239454964352159677912434e-1 * (x + y)*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); } // number 48 @@ -2690,7 +2690,7 @@ namespace Hermes inline double jacobi_f48_dx_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); + return -.22777155839239454964352159677912434e-1 * (-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); } inline double jacobi_f48_dx_1(double x, double y) @@ -2700,7 +2700,7 @@ namespace Hermes inline double jacobi_f48_dy_0(double x, double y) { - return -.22777155839239454964352159677912434e-1*(-70. + (-105. + (1540. + (1925. + (-6006. + (-7007. + (5720. + 6435.*y)*y)*y)*y)*y)*y)*y)*y-.22777155839239454964352159677912434e-1*(-35. + (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y)*x; + return -.22777155839239454964352159677912434e-1 * (-70. + (-105. + (1540. + (1925. + (-6006. + (-7007. + (5720. + 6435.*y)*y)*y)*y)*y)*y)*y)*y - .22777155839239454964352159677912434e-1 * (-35. + (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y)*x; } inline double jacobi_f48_dy_1(double x, double y) @@ -2720,7 +2720,7 @@ namespace Hermes inline double jacobi_f48_dyy_0(double x, double y) { - return 1.5944009087467618475046511774538704-.45554311678478909928704319355824868e-1*(-105. + (2310. + (3850. + (-15015. + (-21021. + (20020. + 25740.*y)*y)*y)*y)*y)*y)*y-.45554311678478909928704319355824868e-1*(-35. + (1155. + (2310. + (-10010. + (-15015. + (15015. + 20020.*y)*y)*y)*y)*y)*y)*x; + return 1.5944009087467618475046511774538704 - .45554311678478909928704319355824868e-1 * (-105. + (2310. + (3850. + (-15015. + (-21021. + (20020. + 25740.*y)*y)*y)*y)*y)*y)*y - .45554311678478909928704319355824868e-1 * (-35. + (1155. + (2310. + (-10010. + (-15015. + (15015. + 20020.*y)*y)*y)*y)*y)*y)*x; } inline double jacobi_f48_dyy_1(double x, double y) @@ -2730,7 +2730,7 @@ namespace Hermes inline double jacobi_f48_dxy_0(double x, double y) { - return .79720045437338092375232558872693520-.22777155839239454964352159677912434e-1*(-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y; + return .79720045437338092375232558872693520 - .22777155839239454964352159677912434e-1 * (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y; } inline double jacobi_f48_dxy_1(double x, double y) @@ -2744,10 +2744,10 @@ namespace Hermes inline double jacobi_f49(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.7563249754401486360699529803715482*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(-.78125000000000000000000000000000000e-1 + (.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); + return 1.7563249754401486360699529803715482*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(-.78125000000000000000000000000000000e-1 + (.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); } inline double jacobi_f49_dx(double x, double y) @@ -2759,8 +2759,8 @@ namespace Hermes inline double jacobi_f49_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-.16805078173181879973008782379451375 + 2.1510500061672806365451241445697760*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y-1.0755250030836403182725620722848880*(.39062500000000000000000000000000000 + (6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (-.16805078173181879973008782379451375 + 2.1510500061672806365451241445697760*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 1.0755250030836403182725620722848880*(.39062500000000000000000000000000000 + (6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (-.16805078173181879973008782379451375 + 2.1510500061672806365451241445697760*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y - 1.0755250030836403182725620722848880*(.39062500000000000000000000000000000 + (6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (-.16805078173181879973008782379451375 + 2.1510500061672806365451241445697760*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 1.0755250030836403182725620722848880*(.39062500000000000000000000000000000 + (6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a; } inline double jacobi_f49_dxx(double x, double y) @@ -2771,8 +2771,8 @@ namespace Hermes inline double jacobi_f49_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.6805078173181879973008782379451375 + 4.3021000123345612730902482891395519*(6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y-1.0755250030836403182725620722848880*(6.0937500000000000000000000000000000 + (-5.1562500000000000000000000000000000 + (-175.31250000000000000000000000000000 + (-134.06250000000000000000000000000000 + (469.21875000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (1.6805078173181879973008782379451375 + 4.3021000123345612730902482891395519*(6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.0755250030836403182725620722848880*(6.0937500000000000000000000000000000 + (-5.1562500000000000000000000000000000 + (-175.31250000000000000000000000000000 + (-134.06250000000000000000000000000000 + (469.21875000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (1.6805078173181879973008782379451375 + 4.3021000123345612730902482891395519*(6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y - 1.0755250030836403182725620722848880*(6.0937500000000000000000000000000000 + (-5.1562500000000000000000000000000000 + (-175.31250000000000000000000000000000 + (-134.06250000000000000000000000000000 + (469.21875000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (1.6805078173181879973008782379451375 + 4.3021000123345612730902482891395519*(6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.0755250030836403182725620722848880*(6.0937500000000000000000000000000000 + (-5.1562500000000000000000000000000000 + (-175.31250000000000000000000000000000 + (-134.06250000000000000000000000000000 + (469.21875000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; } inline double jacobi_f49_dxy(double x, double y) @@ -2785,7 +2785,7 @@ namespace Hermes inline double jacobi_f50(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return 1.5921853230058714151559241260993711*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y); @@ -2794,18 +2794,18 @@ namespace Hermes inline double jacobi_f50_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.5921853230058714151559241260993711*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y); + return 1.5921853230058714151559241260993711*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y); } inline double jacobi_f50_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; - return -1.2587330194473605815215838648165324*b2*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y) + ((.51136028915049023624314344508171630 + 2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y-1.2587330194473605815215838648165324*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (.76704043372573535436471516762257442 + 3.7761990583420817445647515944495971*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.2587330194473605815215838648165324*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a)*a; + return -1.2587330194473605815215838648165324*b2*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y) + ((.51136028915049023624314344508171630 + 2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y - 1.2587330194473605815215838648165324*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (.76704043372573535436471516762257442 + 3.7761990583420817445647515944495971*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.2587330194473605815215838648165324*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a)*a; } inline double jacobi_f50_dxx(double x, double y) @@ -2817,22 +2817,22 @@ namespace Hermes inline double jacobi_f50_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y-2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + (.15734162743092007269019798310206655 + 5.0349320777894423260863354592661295*(-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y-1.2587330194473605815215838648165324*(-12.031250000000000000000000000000000 + (-61.875000000000000000000000000000000 + (134.06250000000000000000000000000000 + (625.62500000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*b)*b + (.23601244114638010903529697465309982 + 7.5523981166841634891295031888991943*(-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y + 1.2587330194473605815215838648165324*(-12.031250000000000000000000000000000 + (-61.875000000000000000000000000000000 + (134.06250000000000000000000000000000 + (625.62500000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; + double b = 1.0 - y; + return (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y - 2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + (.15734162743092007269019798310206655 + 5.0349320777894423260863354592661295*(-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y - 1.2587330194473605815215838648165324*(-12.031250000000000000000000000000000 + (-61.875000000000000000000000000000000 + (134.06250000000000000000000000000000 + (625.62500000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*b)*b + (.23601244114638010903529697465309982 + 7.5523981166841634891295031888991943*(-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y + 1.2587330194473605815215838648165324*(-12.031250000000000000000000000000000 + (-61.875000000000000000000000000000000 + (134.06250000000000000000000000000000 + (625.62500000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; } inline double jacobi_f50_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y-2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (3.0681617349029414174588606704902977 + 15.104796233368326978259006377798388*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + 7.5523981166841634891295031888991943*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y - 2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (3.0681617349029414174588606704902977 + 15.104796233368326978259006377798388*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + 7.5523981166841634891295031888991943*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; } // number 51 inline double jacobi_f51(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -2842,7 +2842,7 @@ namespace Hermes inline double jacobi_f51_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .97509833420206208638416899890309576*(-5.6124860801609120783756230984748240*b2 + 9.3541434669348534639593718307913732*a2)*a*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y); @@ -2851,43 +2851,43 @@ namespace Hermes inline double jacobi_f51_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (.39905292492166838819716431718425096-.91212097124952774445066129642114507*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + .22803024281238193611266532410528627*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-2.7363629137485832333519838892634352*b2*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y) + ((-1.1971587747650051645914929515527529 + 2.7363629137485832333519838892634352*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y-1.3681814568742916166759919446317176*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-1.9952646246083419409858215859212548 + 4.5606048562476387222533064821057254*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + 1.1401512140619096805633266205264313*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a; + return (.39905292492166838819716431718425096 - .91212097124952774445066129642114507*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + .22803024281238193611266532410528627*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-2.7363629137485832333519838892634352*b2*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y) + ((-1.1971587747650051645914929515527529 + 2.7363629137485832333519838892634352*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y - 1.3681814568742916166759919446317176*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-1.9952646246083419409858215859212548 + 4.5606048562476387222533064821057254*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + 1.1401512140619096805633266205264313*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a; } inline double jacobi_f51_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .97509833420206208638416899890309576*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y); + return .97509833420206208638416899890309576*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y); } inline double jacobi_f51_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (4.9026502204662116264223044682636546-1.8242419424990554889013225928422901*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y + .22803024281238193611266532410528627*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*b)*b3 + ((-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y-5.4727258274971664667039677785268703*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + (-14.707950661398634879266913404790964 + 5.4727258274971664667039677785268703*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y-1.3681814568742916166759919446317176*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*b)*b + (-24.513251102331058132111522341318273 + 9.1212097124952774445066129642114507*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y + 1.1401512140619096805633266205264313*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; + return (4.9026502204662116264223044682636546 - 1.8242419424990554889013225928422901*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y + .22803024281238193611266532410528627*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*b)*b3 + ((-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y - 5.4727258274971664667039677785268703*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + (-14.707950661398634879266913404790964 + 5.4727258274971664667039677785268703*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y - 1.3681814568742916166759919446317176*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*b)*b + (-24.513251102331058132111522341318273 + 9.1212097124952774445066129642114507*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y + 1.1401512140619096805633266205264313*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; } inline double jacobi_f51_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; - return -5.4727258274971664667039677785268703*b2*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y) + ((-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y-5.4727258274971664667039677785268703*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-11.971587747650051645914929515527529 + 27.363629137485832333519838892634352*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + 9.1212097124952774445066129642114507*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; + return -5.4727258274971664667039677785268703*b2*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y) + ((-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y - 5.4727258274971664667039677785268703*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-11.971587747650051645914929515527529 + 27.363629137485832333519838892634352*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + 9.1212097124952774445066129642114507*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; } // number 52 inline double jacobi_f52(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -2897,7 +2897,7 @@ namespace Hermes inline double jacobi_f52_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -2908,17 +2908,17 @@ namespace Hermes inline double jacobi_f52_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .40891964427865092013487337229616315*b4*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((-.35780468874381955511801420075914278-1.6356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .40891964427865092013487337229616315*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + (-4.0891964427865092013487337229616315*b2*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((.59634114790636592519669033459857128 + 2.7261309618576728008991558153077544*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y-1.3630654809288364004495779076538772*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (1.0435970088361403690942080855474997 + 4.7707291832509274015735226767885701*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .95414583665018548031470453535771402*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a)*a; + return .40891964427865092013487337229616315*b4*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((-.35780468874381955511801420075914278 - 1.6356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .40891964427865092013487337229616315*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + (-4.0891964427865092013487337229616315*b2*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((.59634114790636592519669033459857128 + 2.7261309618576728008991558153077544*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y - 1.3630654809288364004495779076538772*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (1.0435970088361403690942080855474997 + 4.7707291832509274015735226767885701*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .95414583665018548031470453535771402*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a)*a; } inline double jacobi_f52_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .51404418387524420707255933386925244*(-63.639610306789277196075992589436414*b2 + 148.49242404917498012417731604201830*a2)*a*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y); @@ -2927,26 +2927,26 @@ namespace Hermes inline double jacobi_f52_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (-.71560937748763911023602840151828554-3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .81783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + ((-.71560937748763911023602840151828554-3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + (-23.308419723883102447687782220881300-3.2713571542292073610789869783693052*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y + .40891964427865092013487337229616315*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*b)*b)*b2 + ((3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y-8.1783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + (38.847366206471837412812970368135500 + 5.4522619237153456017983116306155087*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y-1.3630654809288364004495779076538772*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*b)*b + (67.982890861325715472422698144237124 + 9.5414583665018548031470453535771402*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y + .95414583665018548031470453535771402*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; + return (-.71560937748763911023602840151828554 - 3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .81783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + ((-.71560937748763911023602840151828554 - 3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + (-23.308419723883102447687782220881300 - 3.2713571542292073610789869783693052*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y + .40891964427865092013487337229616315*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*b)*b)*b2 + ((3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y - 8.1783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + (38.847366206471837412812970368135500 + 5.4522619237153456017983116306155087*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y - 1.3630654809288364004495779076538772*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*b)*b + (67.982890861325715472422698144237124 + 9.5414583665018548031470453535771402*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y + .95414583665018548031470453535771402*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; } inline double jacobi_f52_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (-.71560937748763911023602840151828554-3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .81783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + (-16.356785771146036805394934891846526*b2*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y-8.1783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (8.3487760706891229527536646843799979 + 38.165833466007419212588181414308561*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + 9.5414583665018548031470453535771402*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; + return (-.71560937748763911023602840151828554 - 3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .81783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + (-16.356785771146036805394934891846526*b2*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y - 8.1783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (8.3487760706891229527536646843799979 + 38.165833466007419212588181414308561*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + 9.5414583665018548031470453535771402*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; } // number 53 inline double jacobi_f53(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -2957,7 +2957,7 @@ namespace Hermes inline double jacobi_f53_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -2968,18 +2968,18 @@ namespace Hermes inline double jacobi_f53_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.60822596331878833691165842189837477 + .22117307757046848614969397159940900*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y-.36862179595078081024948995266568168e-1*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b5 + (1.1058653878523424307484698579970450*b4*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((-6.0822596331878833691165842189837477-2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + .55293269392617121537423492899852251*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + (-5.1607051433109313434928593373195434*b2*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((7.0959695720525305973026815888143723 + 2.5803525716554656717464296686597717*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y-1.2901762858277328358732148343298859*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (12.772745229694555075144826859865870 + 4.6446346289798382091435734035875891*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + .77410577149663970152392890059793149*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a)*a; + return (.60822596331878833691165842189837477 + .22117307757046848614969397159940900*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y - .36862179595078081024948995266568168e-1 * (13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b5 + (1.1058653878523424307484698579970450*b4*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((-6.0822596331878833691165842189837477 - 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + .55293269392617121537423492899852251*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + (-5.1607051433109313434928593373195434*b2*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((7.0959695720525305973026815888143723 + 2.5803525716554656717464296686597717*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y - 1.2901762858277328358732148343298859*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (12.772745229694555075144826859865870 + 4.6446346289798382091435734035875891*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + .77410577149663970152392890059793149*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a)*a; } inline double jacobi_f53_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -2990,29 +2990,29 @@ namespace Hermes inline double jacobi_f53_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (5.8610865556174148829668902473843387 + .44234615514093697229938794319881801*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y-.36862179595078081024948995266568168e-1*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b5 + ((-24.329038532751533476466336875934991-8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + ((-24.329038532751533476466336875934991-8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + (-58.610865556174148829668902473843387-4.4234615514093697229938794319881801*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y + .55293269392617121537423492899852251*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b)*b2 + ((56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y-10.321410286621862686985718674639087*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + (68.379343148869840301280386219483951 + 5.1607051433109313434928593373195434*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y-1.2901762858277328358732148343298859*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b + (123.08281766796571254230469519507111 + 9.2892692579596764182871468071751781*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y + .77410577149663970152392890059793149*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*a)*a)*a)*a)*a)*a; + return (5.8610865556174148829668902473843387 + .44234615514093697229938794319881801*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y - .36862179595078081024948995266568168e-1 * (52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b5 + ((-24.329038532751533476466336875934991 - 8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + ((-24.329038532751533476466336875934991 - 8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + (-58.610865556174148829668902473843387 - 4.4234615514093697229938794319881801*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y + .55293269392617121537423492899852251*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b)*b2 + ((56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y - 10.321410286621862686985718674639087*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + (68.379343148869840301280386219483951 + 5.1607051433109313434928593373195434*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y - 1.2901762858277328358732148343298859*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b + (123.08281766796571254230469519507111 + 9.2892692579596764182871468071751781*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y + .77410577149663970152392890059793149*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*a)*a)*a)*a)*a)*a; } inline double jacobi_f53_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return 2.2117307757046848614969397159940900*b4*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((-24.329038532751533476466336875934991-8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + (-30.964230859865588060957156023917261*b2*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y-10.321410286621862686985718674639087*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (127.72745229694555075144826859865870 + 46.446346289798382091435734035875891*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 9.2892692579596764182871468071751781*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; + return 2.2117307757046848614969397159940900*b4*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((-24.329038532751533476466336875934991 - 8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + (-30.964230859865588060957156023917261*b2*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y - 10.321410286621862686985718674639087*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (127.72745229694555075144826859865870 + 46.446346289798382091435734035875891*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 9.2892692579596764182871468071751781*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; } // number 54 inline double jacobi_f54(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -3023,7 +3023,7 @@ namespace Hermes inline double jacobi_f54_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3036,19 +3036,19 @@ namespace Hermes inline double jacobi_f54_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.94533039239549870023101308425754951e-1*b6*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((1.5597951474525728553811715890249567 + .56719823543729922013860785055452969*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-.94533039239549870023101308425754951e-1*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + (1.9851938240305472704851274769408539*b4*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((-7.2790440214453399917788007487831311-2.6469250987073963606468366359211386*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + .66173127467684909016170915898028464*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + (-5.9555814720916418114553824308225617*b2*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((6.5511396193008059926009206739048179 + 2.3822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-1.1911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (12.010422635384810986435021235492166 + 4.3674264128672039950672804492698786*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + .62391805898102914215246863560998266*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a; + return -.94533039239549870023101308425754951e-1 * b6*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((1.5597951474525728553811715890249567 + .56719823543729922013860785055452969*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - .94533039239549870023101308425754951e-1 * (7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + (1.9851938240305472704851274769408539*b4*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((-7.2790440214453399917788007487831311 - 2.6469250987073963606468366359211386*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + .66173127467684909016170915898028464*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + (-5.9555814720916418114553824308225617*b2*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((6.5511396193008059926009206739048179 + 2.3822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - 1.1911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (12.010422635384810986435021235492166 + 4.3674264128672039950672804492698786*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + .62391805898102914215246863560998266*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f54_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3059,100 +3059,100 @@ namespace Hermes inline double jacobi_f54_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-.18906607847909974004620261685150989*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + ((3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (8.5079735315594883020791177583179455*y + 7.3735770606848898618019020572088860-.70899779429662402517325981319316211*b)*b)*b4 + ((-43.674264128672039950672804492698787-15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 3.9703876480610945409702549538817078*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + ((-43.674264128672039950672804492698787-15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (-39.703876480610945409702549538817079*y-34.410026283196152688408876266974801 + 4.9629845600763681762128186923521348*b)*b)*b2 + ((65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-11.911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (35.733488832549850868732294584935370*y + 30.969023654876537419567988640277321-8.9333722081374627171830736462338426*b)*b + (65.511396193008059926009206739048179*y + 56.776543367273651935874645840508422 + 4.6793854423577185661435147670748699*a)*a)*a)*a)*a)*a)*a; + return (3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - .18906607847909974004620261685150989*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + ((3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (8.5079735315594883020791177583179455*y + 7.3735770606848898618019020572088860 - .70899779429662402517325981319316211*b)*b)*b4 + ((-43.674264128672039950672804492698787 - 15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 3.9703876480610945409702549538817078*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + ((-43.674264128672039950672804492698787 - 15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (-39.703876480610945409702549538817079*y - 34.410026283196152688408876266974801 + 4.9629845600763681762128186923521348*b)*b)*b2 + ((65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - 11.911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (35.733488832549850868732294584935370*y + 30.969023654876537419567988640277321 - 8.9333722081374627171830736462338426*b)*b + (65.511396193008059926009206739048179*y + 56.776543367273651935874645840508422 + 4.6793854423577185661435147670748699*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f54_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-.18906607847909974004620261685150989*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + (7.9407752961221890819405099077634157*b4*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((-43.674264128672039950672804492698787-15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 3.9703876480610945409702549538817078*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + (-47.644651776733134491643059446580494*b2*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-11.911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (144.12507162461773183722025482590599 + 52.409116954406447940807365391238543*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 8.7348528257344079901345608985397572*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a; + return (3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - .18906607847909974004620261685150989*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + (7.9407752961221890819405099077634157*b4*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((-43.674264128672039950672804492698787 - 15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 3.9703876480610945409702549538817078*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + (-47.644651776733134491643059446580494*b2*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - 11.911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (144.12507162461773183722025482590599 + 52.409116954406447940807365391238543*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 8.7348528257344079901345608985397572*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a; } // number 55 inline double jacobi_f55(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return .55090590344733555051405113120224709e-1*(.10697706201272775653456441070328167*b8 + (-2.9953577363563771829678034996918866*b6 + (13.479109813603697323355115748613490*b4 + (-19.769361059952089407587503097966452*b2 + 9.1786319206920415106656264383415669*a2)*a2)*a2)*a2)*(1. + y); + return .55090590344733555051405113120224709e-1 * (.10697706201272775653456441070328167*b8 + (-2.9953577363563771829678034996918866*b6 + (13.479109813603697323355115748613490*b4 + (-19.769361059952089407587503097966452*b2 + 9.1786319206920415106656264383415669*a2)*a2)*a2)*a2)*(1. + y); } inline double jacobi_f55_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return .55090590344733555051405113120224709e-1*(-11.981430945425508731871213998767547*b6 + (107.83287850882957858684092598890792*b4 + (-237.23233271942507289105003717559742*b2 + 146.85811073107266417065002301346507*a2)*a2)*a2)*a*(1. + y); + return .55090590344733555051405113120224709e-1 * (-11.981430945425508731871213998767547*b6 + (107.83287850882957858684092598890792*b4 + (-237.23233271942507289105003717559742*b2 + 146.85811073107266417065002301346507*a2)*a2)*a2)*a*(1. + y); } inline double jacobi_f55_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-.47147435997010740107742172080116283e-1-.47147435997010740107742172080116283e-1*y + .58934294996263425134677715100145354e-2*b)*b7 + (-.33003205197907518075419520456081398*b6*(1. + y) + ((.99009615593722554226258561368244194 + .99009615593722554226258561368244194*y-.16501602598953759037709760228040699*b)*b5 + (2.9702884678116766267877568410473258*b4*(1. + y) + ((-2.9702884678116766267877568410473258-2.9702884678116766267877568410473258*y + .74257211695291915669693921026183146*b)*b3 + (-6.5346346291856885789330650503041168*b2*(1. + y) + ((2.1782115430618961929776883501013723 + 2.1782115430618961929776883501013723*y-1.0891057715309480964888441750506861*b)*b + (4.0452500085435215012442783644739771 + 4.0452500085435215012442783644739771*y + .50565625106794018765553479555924713*a)*a)*a)*a)*a)*a)*a)*a; + return (-.47147435997010740107742172080116283e-1 - .47147435997010740107742172080116283e-1 * y + .58934294996263425134677715100145354e-2 * b)*b7 + (-.33003205197907518075419520456081398*b6*(1. + y) + ((.99009615593722554226258561368244194 + .99009615593722554226258561368244194*y - .16501602598953759037709760228040699*b)*b5 + (2.9702884678116766267877568410473258*b4*(1. + y) + ((-2.9702884678116766267877568410473258 - 2.9702884678116766267877568410473258*y + .74257211695291915669693921026183146*b)*b3 + (-6.5346346291856885789330650503041168*b2*(1. + y) + ((2.1782115430618961929776883501013723 + 2.1782115430618961929776883501013723*y - 1.0891057715309480964888441750506861*b)*b + (4.0452500085435215012442783644739771 + 4.0452500085435215012442783644739771*y + .50565625106794018765553479555924713*a)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f55_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return .55090590344733555051405113120224709e-1*(-23.962861890851017463742427997535093*b6 + (646.99727105297747152104555593344752*b4 + (-2372.3233271942507289105003717559742*b2 + 2056.0135502350172983891003221885110*a2)*a2)*a2)*(1. + y); + return .55090590344733555051405113120224709e-1 * (-23.962861890851017463742427997535093*b6 + (646.99727105297747152104555593344752*b4 + (-2372.3233271942507289105003717559742*b2 + 2056.0135502350172983891003221885110*a2)*a2)*a2)*(1. + y); } inline double jacobi_f55_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.94294871994021480215484344160232566e-1*b7 + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y-.66006410395815036150839040912162796*b)*b5 + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y + 1.9801923118744510845251712273648839*b)*b4 + ((-23.762307742493413014302054728378607-23.762307742493413014302054728378607*y + 5.9405769356233532535755136820946517*b)*b3 + ((-23.762307742493413014302054728378607-23.762307742493413014302054728378607*y-5.9405769356233532535755136820946517*b)*b2 + ((26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y-13.069269258371377157866130100608234*b)*b + (26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y + 4.3564230861237923859553767002027445*b + 8.0905000170870430024885567289479542*a)*a)*a)*a)*a)*a)*a; + return -.94294871994021480215484344160232566e-1 * b7 + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y - .66006410395815036150839040912162796*b)*b5 + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y + 1.9801923118744510845251712273648839*b)*b4 + ((-23.762307742493413014302054728378607 - 23.762307742493413014302054728378607*y + 5.9405769356233532535755136820946517*b)*b3 + ((-23.762307742493413014302054728378607 - 23.762307742493413014302054728378607*y - 5.9405769356233532535755136820946517*b)*b2 + ((26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y - 13.069269258371377157866130100608234*b)*b + (26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y + 4.3564230861237923859553767002027445*b + 8.0905000170870430024885567289479542*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f55_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.66006410395815036150839040912162796*b6*(1. + y) + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y-.66006410395815036150839040912162796*b)*b5 + (17.821730806870059760726541046283955*b4*(1. + y) + ((-23.762307742493413014302054728378607-23.762307742493413014302054728378607*y + 5.9405769356233532535755136820946517*b)*b3 + (-65.346346291856885789330650503041168*b2*(1. + y) + ((26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y-13.069269258371377157866130100608234*b)*b + (56.633500119609301017419897102635679 + 56.633500119609301017419897102635679*y + 8.0905000170870430024885567289479542*a)*a)*a)*a)*a)*a)*a; + return -.66006410395815036150839040912162796*b6*(1. + y) + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y - .66006410395815036150839040912162796*b)*b5 + (17.821730806870059760726541046283955*b4*(1. + y) + ((-23.762307742493413014302054728378607 - 23.762307742493413014302054728378607*y + 5.9405769356233532535755136820946517*b)*b3 + (-65.346346291856885789330650503041168*b2*(1. + y) + ((26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y - 13.069269258371377157866130100608234*b)*b + (56.633500119609301017419897102635679 + 56.633500119609301017419897102635679*y + 8.0905000170870430024885567289479542*a)*a)*a)*a)*a)*a)*a; } // ORDER 10 @@ -3163,20 +3163,20 @@ namespace Hermes inline double jacobi_f56(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; double b10 = b8*b2; - return -.82303806344571752837660497036322993e-4*b10 + (.37036712855057288776947223666345347e-2*b8 + (-.27160256093708678436427964021986588e-1*b6 + (.70616665843642563934712706457165128e-1*b4 + (-.75660713403902747072906471204105494e-1*b2 + .28582936174807704449764666899328742e-1*a2)*a2)*a2)*a2)*a2; + return -.82303806344571752837660497036322993e-4 * b10 + (.37036712855057288776947223666345347e-2 * b8 + (-.27160256093708678436427964021986588e-1 * b6 + (.70616665843642563934712706457165128e-1 * b4 + (-.75660713403902747072906471204105494e-1 * b2 + .28582936174807704449764666899328742e-1 * a2)*a2)*a2)*a2)*a2; } inline double jacobi_f56_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3185,13 +3185,13 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return (.14814685142022915510778889466538139e-1*b8 + (-.21728204874966942749142371217589270*b6 + (.84739999012371076721655247748598154*b4 + (-1.2105714144624439531665035392656879*b2 + .57165872349615408899529333798657485*a2)*a2)*a2)*a2)*a; + return (.14814685142022915510778889466538139e-1 * b8 + (-.21728204874966942749142371217589270*b6 + (.84739999012371076721655247748598154*b4 + (-1.2105714144624439531665035392656879*b2 + .57165872349615408899529333798657485*a2)*a2)*a2)*a2)*a; } inline double jacobi_f56_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; @@ -3200,13 +3200,13 @@ namespace Hermes double b7 = b6*b; double b8 = b7*b; double b9 = b8*b; - return .82303806344571752837660497036322993e-3*b9 + (.74073425710114577553894447332690694e-2*b8 + (-.29629370284045831021557778933076278e-1*b7 + (-.10864102437483471374571185608794635*b6 + (.16296153656225207061856778413191953*b5 + (.42369999506185538360827623874299077*b4 + (-.28246666337457025573885082582866051*b3 + (-.60528570723122197658325176963284395*b2 + (.15132142680780549414581294240821099*b + .28582936174807704449764666899328742*a)*a)*a)*a)*a)*a)*a)*a)*a; + return .82303806344571752837660497036322993e-3 * b9 + (.74073425710114577553894447332690694e-2 * b8 + (-.29629370284045831021557778933076278e-1 * b7 + (-.10864102437483471374571185608794635*b6 + (.16296153656225207061856778413191953*b5 + (.42369999506185538360827623874299077*b4 + (-.28246666337457025573885082582866051*b3 + (-.60528570723122197658325176963284395*b2 + (.15132142680780549414581294240821099*b + .28582936174807704449764666899328742*a)*a)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f56_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3215,13 +3215,13 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .29629370284045831021557778933076278e-1*b8 + (-1.3036922924980165649485422730553562*b6 + (8.4739999012371076721655247748598154*b4 + (-16.947999802474215344331049549719631*b2 + 10.289857022930773601915280083758347*a2)*a2)*a2)*a2; + return .29629370284045831021557778933076278e-1 * b8 + (-1.3036922924980165649485422730553562*b6 + (8.4739999012371076721655247748598154*b4 + (-16.947999802474215344331049549719631*b2 + 10.289857022930773601915280083758347*a2)*a2)*a2)*a2; } inline double jacobi_f56_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; @@ -3234,7 +3234,7 @@ namespace Hermes inline double jacobi_f56_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; @@ -3242,25 +3242,25 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .14814685142022915510778889466538139e-1*b8 + (-.11851748113618332408623111573230511*b7 + (-.65184614624900828247427113652767811*b6 + (1.3036922924980165649485422730553562*b5 + (4.2369999506185538360827623874299077*b4 + (-3.3895999604948430688662099099439261*b3 + (-8.4739999012371076721655247748598154*b2 + (2.4211428289248879063330070785313758*b + 5.1449285114653868009576400418791736*a)*a)*a)*a)*a)*a)*a)*a; + return .14814685142022915510778889466538139e-1 * b8 + (-.11851748113618332408623111573230511*b7 + (-.65184614624900828247427113652767811*b6 + (1.3036922924980165649485422730553562*b5 + (4.2369999506185538360827623874299077*b4 + (-3.3895999604948430688662099099439261*b3 + (-8.4739999012371076721655247748598154*b2 + (2.4211428289248879063330070785313758*b + 5.1449285114653868009576400418791736*a)*a)*a)*a)*a)*a)*a)*a; } // number 57 inline double jacobi_f57(double x, double y) { double y2 = y*y; - return -.12039871099548782129394906995027821e-1*(x + 1.)*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); + return -.12039871099548782129394906995027821e-1 * (x + 1.)*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); } inline double jacobi_f57_dx(double x, double y) { double y2 = y*y; - return -.12039871099548782129394906995027821e-1*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); + return -.12039871099548782129394906995027821e-1 * (7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); } inline double jacobi_f57_dy(double x, double y) { - return -.12039871099548782129394906995027821e-1*(x + 1.)*(7. + (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y); + return -.12039871099548782129394906995027821e-1 * (x + 1.)*(7. + (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y); } inline double jacobi_f57_dxx(double x, double y) @@ -3275,25 +3275,25 @@ namespace Hermes inline double jacobi_f57_dxy(double x, double y) { - return -.84279097696841474905764348965194744e-1-.12039871099548782129394906995027821e-1*(-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y; + return -.84279097696841474905764348965194744e-1 - .12039871099548782129394906995027821e-1 * (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y; } // number 58 inline double jacobi_f58(double x, double y) { double y2 = y*y; - return .12039871099548782129394906995027821e-1*(x + y)*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); + return .12039871099548782129394906995027821e-1 * (x + y)*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); } inline double jacobi_f58_dx(double x, double y) { double y2 = y*y; - return .12039871099548782129394906995027821e-1*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); + return .12039871099548782129394906995027821e-1 * (7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); } inline double jacobi_f58_dy(double x, double y) { - return .84279097696841474905764348965194744e-1 + .12039871099548782129394906995027821e-1*(14. + (-924. + (-1232. + (10010. + (12012. + (-28028. + (-32032. + (21879. + 24310.*y)*y)*y)*y)*y)*y)*y)*y)*y + .12039871099548782129394906995027821e-1*(7. + (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y)*x; + return .84279097696841474905764348965194744e-1 + .12039871099548782129394906995027821e-1 * (14. + (-924. + (-1232. + (10010. + (12012. + (-28028. + (-32032. + (21879. + 24310.*y)*y)*y)*y)*y)*y)*y)*y)*y + .12039871099548782129394906995027821e-1 * (7. + (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y)*x; } inline double jacobi_f58_dxx(double x, double y) @@ -3303,12 +3303,12 @@ namespace Hermes inline double jacobi_f58_dyy(double x, double y) { - return .16855819539368294981152869793038949 + .24079742199097564258789813990055641e-1*(-924. + (-1848. + (20020. + (30030. + (-84084. + (-112112. + (87516. + 109395.*y)*y)*y)*y)*y)*y)*y)*y + .24079742199097564258789813990055641e-1*(-308. + (-924. + (12012. + (20020. + (-60060. + (-84084. + (68068. + 87516.*y)*y)*y)*y)*y)*y)*y)*x; + return .16855819539368294981152869793038949 + .24079742199097564258789813990055641e-1 * (-924. + (-1848. + (20020. + (30030. + (-84084. + (-112112. + (87516. + 109395.*y)*y)*y)*y)*y)*y)*y)*y + .24079742199097564258789813990055641e-1 * (-308. + (-924. + (12012. + (20020. + (-60060. + (-84084. + (68068. + 87516.*y)*y)*y)*y)*y)*y)*y)*x; } inline double jacobi_f58_dxy(double x, double y) { - return .84279097696841474905764348965194744e-1 + .12039871099548782129394906995027821e-1*(-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y; + return .84279097696841474905764348965194744e-1 + .12039871099548782129394906995027821e-1 * (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y; } // Bubble functions, order 10 @@ -3317,11 +3317,11 @@ namespace Hermes inline double jacobi_f59(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double y2 = y*y; - return 1.8781826691835577799972514353411927*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(-.54687500000000000000000000000000000e-1 + (-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y); + return 1.8781826691835577799972514353411927*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(-.54687500000000000000000000000000000e-1 + (-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y); } inline double jacobi_f59_dx(double x, double y) @@ -3334,9 +3334,9 @@ namespace Hermes inline double jacobi_f59_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; - return (-.12579736047917105779922212472129016 + 2.3002945916191279140429188520464486*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y-1.1501472958095639570214594260232243*(-.65625000000000000000000000000000000 + (2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y)*b)*b + (-.12579736047917105779922212472129016 + 2.3002945916191279140429188520464486*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y + 1.1501472958095639570214594260232243*(-.65625000000000000000000000000000000 + (2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y)*a)*a; + return (-.12579736047917105779922212472129016 + 2.3002945916191279140429188520464486*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y - 1.1501472958095639570214594260232243*(-.65625000000000000000000000000000000 + (2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y)*b)*b + (-.12579736047917105779922212472129016 + 2.3002945916191279140429188520464486*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y + 1.1501472958095639570214594260232243*(-.65625000000000000000000000000000000 + (2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y)*a)*a; } inline double jacobi_f59_dxx(double x, double y) @@ -3348,9 +3348,9 @@ namespace Hermes inline double jacobi_f59_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; - return (-3.0191366515001053871813309933109638 + 4.6005891832382558280858377040928971*(2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y-1.1501472958095639570214594260232243*(2.4062500000000000000000000000000000 + (57.750000000000000000000000000000000 + (-625.62500000000000000000000000000000 + (-469.21875000000000000000000000000000 + (1126.1250000000000000000000000000000 + 1063.5625000000000000000000000000000*y)*y)*y)*y2)*y)*b)*b + (-3.0191366515001053871813309933109638 + 4.6005891832382558280858377040928971*(2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y + 1.1501472958095639570214594260232243*(2.4062500000000000000000000000000000 + (57.750000000000000000000000000000000 + (-625.62500000000000000000000000000000 + (-469.21875000000000000000000000000000 + (1126.1250000000000000000000000000000 + 1063.5625000000000000000000000000000*y)*y)*y)*y2)*y)*a)*a; + return (-3.0191366515001053871813309933109638 + 4.6005891832382558280858377040928971*(2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y - 1.1501472958095639570214594260232243*(2.4062500000000000000000000000000000 + (57.750000000000000000000000000000000 + (-625.62500000000000000000000000000000 + (-469.21875000000000000000000000000000 + (1126.1250000000000000000000000000000 + 1063.5625000000000000000000000000000*y)*y)*y)*y2)*y)*b)*b + (-3.0191366515001053871813309933109638 + 4.6005891832382558280858377040928971*(2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y + 1.1501472958095639570214594260232243*(2.4062500000000000000000000000000000 + (57.750000000000000000000000000000000 + (-625.62500000000000000000000000000000 + (-469.21875000000000000000000000000000 + (1126.1250000000000000000000000000000 + 1063.5625000000000000000000000000000*y)*y)*y)*y2)*y)*a)*a; } inline double jacobi_f59_dxy(double x, double y) @@ -3364,7 +3364,7 @@ namespace Hermes inline double jacobi_f60(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return 1.7465387901340515412774319981019878*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); @@ -3373,18 +3373,18 @@ namespace Hermes inline double jacobi_f60_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.7465387901340515412774319981019878*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); + return 1.7465387901340515412774319981019878*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); } inline double jacobi_f60_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; - return -1.3807601496646051572657795977932815*b2*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y) + ((.17259501870807564465822244972416018 + 2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y-1.3807601496646051572657795977932815*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (.25889252806211346698733367458624028 + 4.1422804489938154717973387933798444*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 1.3807601496646051572657795977932815*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a)*a; + return -1.3807601496646051572657795977932815*b2*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y) + ((.17259501870807564465822244972416018 + 2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y - 1.3807601496646051572657795977932815*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (.25889252806211346698733367458624028 + 4.1422804489938154717973387933798444*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 1.3807601496646051572657795977932815*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a)*a; } inline double jacobi_f60_dxx(double x, double y) @@ -3396,22 +3396,22 @@ namespace Hermes inline double jacobi_f60_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y-2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + (8.6297509354037822329111224862080092 + 5.5230405986584206290631183911731259*(3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y-1.3807601496646051572657795977932815*(3. + (-97.500000000000000000000000000000000 + (-341.25000000000000000000000000000000 + (341.25000000000000000000000000000000 + (1706.2500000000000000000000000000000 + 1160.2500000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (12.944626403105673349366683729312014 + 8.2845608979876309435946775867596891*(3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.3807601496646051572657795977932815*(3. + (-97.500000000000000000000000000000000 + (-341.25000000000000000000000000000000 + (341.25000000000000000000000000000000 + (1706.2500000000000000000000000000000 + 1160.2500000000000000000000000000000*y)*y)*y)*y)*y)*a)*a)*a; + double b = 1.0 - y; + return (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y - 2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + (8.6297509354037822329111224862080092 + 5.5230405986584206290631183911731259*(3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y - 1.3807601496646051572657795977932815*(3. + (-97.500000000000000000000000000000000 + (-341.25000000000000000000000000000000 + (341.25000000000000000000000000000000 + (1706.2500000000000000000000000000000 + 1160.2500000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (12.944626403105673349366683729312014 + 8.2845608979876309435946775867596891*(3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.3807601496646051572657795977932815*(3. + (-97.500000000000000000000000000000000 + (-341.25000000000000000000000000000000 + (341.25000000000000000000000000000000 + (1706.2500000000000000000000000000000 + 1160.2500000000000000000000000000000*y)*y)*y)*y)*y)*a)*a)*a; } inline double jacobi_f60_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y-2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (1.0355701122484538679493346983449611 + 16.569121795975261887189355173519378*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 8.2845608979876309435946775867596891*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y - 2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (1.0355701122484538679493346983449611 + 16.569121795975261887189355173519378*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 8.2845608979876309435946775867596891*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a; } // number 61 inline double jacobi_f61(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -3422,7 +3422,7 @@ namespace Hermes inline double jacobi_f61_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double y2 = y*y; @@ -3432,47 +3432,47 @@ namespace Hermes inline double jacobi_f61_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double y2 = y*y; - return (-.86306134878487797796370546040008498e-1-1.0356736185418535735564465524801020*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + .25891840463546339338911163812002550*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b3 + (-3.1070208556255607206693396574403060*b2*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y) + ((.25891840463546339338911163812002550 + 3.1070208556255607206693396574403060*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y-1.5535104278127803603346698287201530*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (.43153067439243898898185273020004250 + 5.1783680927092678677822327624005100*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + 1.2945920231773169669455581906001275*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*a)*a)*a)*a; + return (-.86306134878487797796370546040008498e-1 - 1.0356736185418535735564465524801020*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + .25891840463546339338911163812002550*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b3 + (-3.1070208556255607206693396574403060*b2*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y) + ((.25891840463546339338911163812002550 + 3.1070208556255607206693396574403060*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y - 1.5535104278127803603346698287201530*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (.43153067439243898898185273020004250 + 5.1783680927092678677822327624005100*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + 1.2945920231773169669455581906001275*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*a)*a)*a)*a; } inline double jacobi_f61_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double y2 = y*y; - return 1.1071816700297210425642255794583961*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y); + return 1.1071816700297210425642255794583961*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y); } inline double jacobi_f61_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double y2 = y*y; - return (5.4372864973447312611713444005205354-2.0713472370837071471128931049602040*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y + .25891840463546339338911163812002550*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*b)*b3 + ((1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y-6.2140417112511214413386793148806119*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + (-16.311859492034193783514033201561606 + 6.2140417112511214413386793148806119*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y-1.5535104278127803603346698287201530*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*b)*b + (-27.186432486723656305856722002602676 + 10.356736185418535735564465524801020*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y + 1.2945920231773169669455581906001275*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*a)*a)*a)*a; + return (5.4372864973447312611713444005205354 - 2.0713472370837071471128931049602040*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y + .25891840463546339338911163812002550*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*b)*b3 + ((1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y - 6.2140417112511214413386793148806119*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + (-16.311859492034193783514033201561606 + 6.2140417112511214413386793148806119*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y - 1.5535104278127803603346698287201530*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*b)*b + (-27.186432486723656305856722002602676 + 10.356736185418535735564465524801020*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y + 1.2945920231773169669455581906001275*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*a)*a)*a)*a; } inline double jacobi_f61_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double y2 = y*y; - return -6.2140417112511214413386793148806119*b2*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y) + ((1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y-6.2140417112511214413386793148806119*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (2.5891840463546339338911163812002550 + 31.070208556255607206693396574403060*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + 10.356736185418535735564465524801020*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*a)*a)*a; + return -6.2140417112511214413386793148806119*b2*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y) + ((1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y - 6.2140417112511214413386793148806119*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (2.5891840463546339338911163812002550 + 31.070208556255607206693396574403060*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + 10.356736185418535735564465524801020*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*a)*a)*a; } // number 62 inline double jacobi_f62(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -3482,7 +3482,7 @@ namespace Hermes inline double jacobi_f62_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3493,17 +3493,17 @@ namespace Hermes inline double jacobi_f62_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .48127746299266741539338459887275870*b4*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((1.4438323889780022461801537966182761-1.9251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .48127746299266741539338459887275870*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-4.8127746299266741539338459887275870*b2*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((-2.4063873149633370769669229943637935 + 3.2085164199511161026225639924850580*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y-1.6042582099755580513112819962425290*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-4.2111778011858398846921152401366384 + 5.6149037349144531795894869868488513*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + 1.1229807469828906359178973973697703*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a)*a; + return .48127746299266741539338459887275870*b4*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((1.4438323889780022461801537966182761 - 1.9251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .48127746299266741539338459887275870*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-4.8127746299266741539338459887275870*b2*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((-2.4063873149633370769669229943637935 + 3.2085164199511161026225639924850580*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y - 1.6042582099755580513112819962425290*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-4.2111778011858398846921152401366384 + 5.6149037349144531795894869868488513*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + 1.1229807469828906359178973973697703*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a)*a; } inline double jacobi_f62_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .60500365815888498128641266942176687*(-63.639610306789277196075992589436414*b2 + 148.49242404917498012417731604201830*a2)*a*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y); @@ -3512,26 +3512,26 @@ namespace Hermes inline double jacobi_f62_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (2.8876647779560044923603075932365521-3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .96255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + ((2.8876647779560044923603075932365521-3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + (2.8876647779560044923603075932365521-3.8502197039413393231470767909820695*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y + .48127746299266741539338459887275870*(42. + (420. + (945. + 595.*y)*y)*y)*b)*b)*b2 + ((-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y-9.6255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + (-4.8127746299266741539338459887275868 + 6.4170328399022322052451279849701158*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y-1.6042582099755580513112819962425290*(42. + (420. + (945. + 595.*y)*y)*y)*b)*b + (-8.4223556023716797693842304802732771 + 11.229807469828906359178973973697703*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y + 1.1229807469828906359178973973697703*(42. + (420. + (945. + 595.*y)*y)*y)*a)*a)*a)*a)*a; + return (2.8876647779560044923603075932365521 - 3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .96255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + ((2.8876647779560044923603075932365521 - 3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + (2.8876647779560044923603075932365521 - 3.8502197039413393231470767909820695*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y + .48127746299266741539338459887275870*(42. + (420. + (945. + 595.*y)*y)*y)*b)*b)*b2 + ((-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y - 9.6255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + (-4.8127746299266741539338459887275868 + 6.4170328399022322052451279849701158*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y - 1.6042582099755580513112819962425290*(42. + (420. + (945. + 595.*y)*y)*y)*b)*b + (-8.4223556023716797693842304802732771 + 11.229807469828906359178973973697703*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y + 1.1229807469828906359178973973697703*(42. + (420. + (945. + 595.*y)*y)*y)*a)*a)*a)*a)*a; } inline double jacobi_f62_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; - return (2.8876647779560044923603075932365521-3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .96255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-19.251098519706696615735383954910348*b2*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y-9.6255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-33.689422409486719077536921921093108 + 44.919229879315625436715895894790810*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + 11.229807469828906359178973973697703*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a; + return (2.8876647779560044923603075932365521 - 3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .96255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-19.251098519706696615735383954910348*b2*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y - 9.6255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-33.689422409486719077536921921093108 + 44.919229879315625436715895894790810*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + 11.229807469828906359178973973697703*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a; } // number 63 inline double jacobi_f63(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -3542,7 +3542,7 @@ namespace Hermes inline double jacobi_f63_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3553,18 +3553,18 @@ namespace Hermes inline double jacobi_f63_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.40274574277309068430839343011964242 + .26849716184872712287226228674642828*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y-.44749526974787853812043714457738048e-1*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b5 + (1.3424858092436356143613114337321414*b4*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((-4.0274574277309068430839343011964242-2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + .67124290462181780718065571686607068*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + (-6.2649337764702995336861200240833266*b2*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((4.6987003323527246502645900180624949 + 3.1324668882351497668430600120416633*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y-1.5662334441175748834215300060208316*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (8.4576605982349043704762620325124910 + 5.6384403988232695803175080216749940*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + .93974006647054493005291800361249898*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*a)*a)*a)*a)*a)*a; + return (.40274574277309068430839343011964242 + .26849716184872712287226228674642828*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y - .44749526974787853812043714457738048e-1 * (16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b5 + (1.3424858092436356143613114337321414*b4*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((-4.0274574277309068430839343011964242 - 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + .67124290462181780718065571686607068*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + (-6.2649337764702995336861200240833266*b2*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((4.6987003323527246502645900180624949 + 3.1324668882351497668430600120416633*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y - 1.5662334441175748834215300060208316*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (8.4576605982349043704762620325124910 + 5.6384403988232695803175080216749940*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + .93974006647054493005291800361249898*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*a)*a)*a)*a)*a)*a; } inline double jacobi_f63_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3575,29 +3575,29 @@ namespace Hermes inline double jacobi_f63_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (8.8604063410079950547846554626321332 + .53699432369745424574452457349285655*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y-.44749526974787853812043714457738048e-1*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b5 + ((-16.109829710923627372335737204785697-10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + ((-16.109829710923627372335737204785697-10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + (-88.604063410079950547846554626321332-5.3699432369745424574452457349285655*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y + .67124290462181780718065571686607068*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b)*b2 + ((37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y-12.529867552940599067372240048166653*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + (103.37140731175994230582098039737489 + 6.2649337764702995336861200240833266*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y-1.5662334441175748834215300060208316*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b + (186.06853316116789615047776471527480 + 11.276880797646539160635016043349988*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y + .93974006647054493005291800361249898*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*a)*a)*a)*a)*a)*a; + return (8.8604063410079950547846554626321332 + .53699432369745424574452457349285655*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y - .44749526974787853812043714457738048e-1 * (97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b5 + ((-16.109829710923627372335737204785697 - 10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + ((-16.109829710923627372335737204785697 - 10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + (-88.604063410079950547846554626321332 - 5.3699432369745424574452457349285655*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y + .67124290462181780718065571686607068*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b)*b2 + ((37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y - 12.529867552940599067372240048166653*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + (103.37140731175994230582098039737489 + 6.2649337764702995336861200240833266*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y - 1.5662334441175748834215300060208316*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b + (186.06853316116789615047776471527480 + 11.276880797646539160635016043349988*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y + .93974006647054493005291800361249898*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*a)*a)*a)*a)*a)*a; } inline double jacobi_f63_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return 2.6849716184872712287226228674642828*b4*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((-16.109829710923627372335737204785697-10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + (-37.589602658821797202116720144499958*b2*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y-12.529867552940599067372240048166653*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (84.576605982349043704762620325124910 + 56.384403988232695803175080216749940*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 11.276880797646539160635016043349988*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*a)*a)*a)*a)*a; + return 2.6849716184872712287226228674642828*b4*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((-16.109829710923627372335737204785697 - 10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + (-37.589602658821797202116720144499958*b2*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y - 12.529867552940599067372240048166653*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (84.576605982349043704762620325124910 + 56.384403988232695803175080216749940*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 11.276880797646539160635016043349988*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*a)*a)*a)*a)*a; } // number 64 inline double jacobi_f64(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -3608,7 +3608,7 @@ namespace Hermes inline double jacobi_f64_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3621,19 +3621,19 @@ namespace Hermes inline double jacobi_f64_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.11754826450890581801454183188941421*b6*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((3.0562548772315512683780876291247695 + .70528958705343490808725099133648527*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-.11754826450890581801454183188941421*(19. + (52. + 34.*y)*y)*b)*b5 + (2.4685135546870221783053784696776984*b4*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((-14.262522760413905919097742269248924-3.2913514062493629044071712929035978*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + .82283785156234072610179282322589947*(19. + (52. + 34.*y)*y)*b)*b3 + (-7.4055406640610665349161354090330953*b2*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((12.836270484372515327187968042324031 + 2.9622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-1.4811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (23.533162554682944766511274744260725 + 5.4307298203114487922718326332909365*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + .77581854575877839889597609047013379*(19. + (52. + 34.*y)*y)*a)*a)*a)*a)*a)*a)*a; + return -.11754826450890581801454183188941421*b6*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((3.0562548772315512683780876291247695 + .70528958705343490808725099133648527*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - .11754826450890581801454183188941421*(19. + (52. + 34.*y)*y)*b)*b5 + (2.4685135546870221783053784696776984*b4*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((-14.262522760413905919097742269248924 - 3.2913514062493629044071712929035978*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + .82283785156234072610179282322589947*(19. + (52. + 34.*y)*y)*b)*b3 + (-7.4055406640610665349161354090330953*b2*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((12.836270484372515327187968042324031 + 2.9622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - 1.4811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (23.533162554682944766511274744260725 + 5.4307298203114487922718326332909365*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + .77581854575877839889597609047013379*(19. + (52. + 34.*y)*y)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f64_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3644,119 +3644,119 @@ namespace Hermes inline double jacobi_f64_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-.23509652901781163602908366377882842*(19. + (52. + 34.*y)*y)*b)*b5 + ((6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (26.801004308030526507315537670786440 + 1.4105791741068698161745019826729705*(52. + 34.*y)*y-.11754826450890581801454183188941421*(68.*y + 52.)*b)*b)*b4 + ((-85.575136562483435514586453615493545-19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 4.9370271093740443566107569393553969*(19. + (52. + 34.*y)*y)*b)*b3 + ((-85.575136562483435514586453615493545-19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (-125.07135343747579036747250913033672-6.5827028124987258088143425858071959*(52. + 34.*y)*y + .82283785156234072610179282322589947*(68.*y + 52.)*b)*b)*b2 + ((128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-14.811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (112.56421809372821133072525821730305 + 5.9244325312488532279329083272264761*(52. + 34.*y)*y-1.4811081328122133069832270818066191*(68.*y + 52.)*b)*b + (206.36773317183505410632964006505559 + 10.861459640622897584543665266581873*(52. + 34.*y)*y + .77581854575877839889597609047013379*(68.*y + 52.)*a)*a)*a)*a)*a)*a)*a; + return (6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - .23509652901781163602908366377882842*(19. + (52. + 34.*y)*y)*b)*b5 + ((6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (26.801004308030526507315537670786440 + 1.4105791741068698161745019826729705*(52. + 34.*y)*y - .11754826450890581801454183188941421*(68.*y + 52.)*b)*b)*b4 + ((-85.575136562483435514586453615493545 - 19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 4.9370271093740443566107569393553969*(19. + (52. + 34.*y)*y)*b)*b3 + ((-85.575136562483435514586453615493545 - 19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (-125.07135343747579036747250913033672 - 6.5827028124987258088143425858071959*(52. + 34.*y)*y + .82283785156234072610179282322589947*(68.*y + 52.)*b)*b)*b2 + ((128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - 14.811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (112.56421809372821133072525821730305 + 5.9244325312488532279329083272264761*(52. + 34.*y)*y - 1.4811081328122133069832270818066191*(68.*y + 52.)*b)*b + (206.36773317183505410632964006505559 + 10.861459640622897584543665266581873*(52. + 34.*y)*y + .77581854575877839889597609047013379*(68.*y + 52.)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f64_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-.23509652901781163602908366377882842*(19. + (52. + 34.*y)*y)*b)*b5 + (9.8740542187480887132215138787107937*b4*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((-85.575136562483435514586453615493545-19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 4.9370271093740443566107569393553969*(19. + (52. + 34.*y)*y)*b)*b3 + (-59.244325312488532279329083272264761*b2*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-14.811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (282.39795065619533719813529693112870 + 65.168757843737385507261991599491238*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 10.861459640622897584543665266581873*(19. + (52. + 34.*y)*y)*a)*a)*a)*a)*a)*a; + return (6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - .23509652901781163602908366377882842*(19. + (52. + 34.*y)*y)*b)*b5 + (9.8740542187480887132215138787107937*b4*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((-85.575136562483435514586453615493545 - 19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 4.9370271093740443566107569393553969*(19. + (52. + 34.*y)*y)*b)*b3 + (-59.244325312488532279329083272264761*b2*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - 14.811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (282.39795065619533719813529693112870 + 65.168757843737385507261991599491238*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 10.861459640622897584543665266581873*(19. + (52. + 34.*y)*y)*a)*a)*a)*a)*a)*a; } // number 65 inline double jacobi_f65(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return .69728750379731214109841784629056465e-1*(.10697706201272775653456441070328167*b8 + (-2.9953577363563771829678034996918866*b6 + (13.479109813603697323355115748613490*b4 + (-19.769361059952089407587503097966452*b2 + 9.1786319206920415106656264383415669*a2)*a2)*a2)*a2)*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); + return .69728750379731214109841784629056465e-1 * (.10697706201272775653456441070328167*b8 + (-2.9953577363563771829678034996918866*b6 + (13.479109813603697323355115748613490*b4 + (-19.769361059952089407587503097966452*b2 + 9.1786319206920415106656264383415669*a2)*a2)*a2)*a2)*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); } inline double jacobi_f65_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return .69728750379731214109841784629056465e-1*(-11.981430945425508731871213998767547*b6 + (107.83287850882957858684092598890792*b4 + (-237.23233271942507289105003717559742*b2 + 146.85811073107266417065002301346507*a2)*a2)*a2)*a*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); + return .69728750379731214109841784629056465e-1 * (-11.981430945425508731871213998767547*b6 + (107.83287850882957858684092598890792*b4 + (-237.23233271942507289105003717559742*b2 + 146.85811073107266417065002301346507*a2)*a2)*a2)*a*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); } inline double jacobi_f65_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-.19394379818950552502986780397515149-.59675014827540161547651631992354305e-1*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .74593768534425201934564539990442882e-2*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b7 + (-.41772510379278113083356142394648014*b6*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((4.0728197619796160256272238834781813 + 1.2531753113783433925006842718394404*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-.20886255189639056541678071197324007*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + (3.7595259341350301775020528155183212*b4*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((-12.218459285938848076881671650434544-3.7595259341350301775020528155183212*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .93988148353375754437551320387958031*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + (-8.2709570550970663905045161941403067*b2*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((8.9602034763551552563798925436519989 + 2.7569856850323554635015053980467689*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-1.3784928425161777317507526990233844*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (16.640377884659574047562657581067998 + 5.1201162722029458607885100249439995*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .64001453402536823259856375311799993*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a)*a; + return (-.19394379818950552502986780397515149 - .59675014827540161547651631992354305e-1 * (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .74593768534425201934564539990442882e-2 * (8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b7 + (-.41772510379278113083356142394648014*b6*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((4.0728197619796160256272238834781813 + 1.2531753113783433925006842718394404*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - .20886255189639056541678071197324007*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + (3.7595259341350301775020528155183212*b4*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((-12.218459285938848076881671650434544 - 3.7595259341350301775020528155183212*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .93988148353375754437551320387958031*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + (-8.2709570550970663905045161941403067*b2*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((8.9602034763551552563798925436519989 + 2.7569856850323554635015053980467689*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - 1.3784928425161777317507526990233844*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (16.640377884659574047562657581067998 + 5.1201162722029458607885100249439995*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .64001453402536823259856375311799993*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f65_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return .69728750379731214109841784629056465e-1*(-23.962861890851017463742427997535093*b6 + (646.99727105297747152104555593344752*b4 + (-2372.3233271942507289105003717559742*b2 + 2056.0135502350172983891003221885110*a2)*a2)*a2)*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); + return .69728750379731214109841784629056465e-1 * (-23.962861890851017463742427997535093*b6 + (646.99727105297747152104555593344752*b4 + (-2372.3233271942507289105003717559742*b2 + 2056.0135502350172983891003221885110*a2)*a2)*a2)*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); } inline double jacobi_f65_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-1.0144752520681827463100777438700232*y-.89512522241310242321477447988531460 + .63404703254261421644379858991876449e-1*b)*b7 + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-.83545020758556226166712284789296028*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (21.303980293431837672511632621270488*y + 18.797629670675150887510264077591607-1.7753316911193198060426360517725406*b)*b)*b4 + ((-97.747674287510784615053373203476350-30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 7.5190518682700603550041056310366424*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + ((-97.747674287510784615053373203476350-30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (-63.911940880295513017534897863811461*y-56.392889012025452662530792232774819 + 7.9889926100369391271918622329764326*b)*b)*b2 + ((107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-16.541914110194132781009032388280613*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (46.868756645550042879525591766795072*y + 41.354785275485331952522580970701534-11.717189161387510719881397941698768*b)*b + (87.041976627450079633404670424047990*y + 76.801744083044187911827650374159992 + 5.4401235392156299770877919015029993*a)*a)*a)*a)*a)*a)*a)*a; + return (-1.0144752520681827463100777438700232*y - .89512522241310242321477447988531460 + .63404703254261421644379858991876449e-1 * b)*b7 + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - .83545020758556226166712284789296028*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (21.303980293431837672511632621270488*y + 18.797629670675150887510264077591607 - 1.7753316911193198060426360517725406*b)*b)*b4 + ((-97.747674287510784615053373203476350 - 30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 7.5190518682700603550041056310366424*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + ((-97.747674287510784615053373203476350 - 30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (-63.911940880295513017534897863811461*y - 56.392889012025452662530792232774819 + 7.9889926100369391271918622329764326*b)*b)*b2 + ((107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - 16.541914110194132781009032388280613*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (46.868756645550042879525591766795072*y + 41.354785275485331952522580970701534 - 11.717189161387510719881397941698768*b)*b + (87.041976627450079633404670424047990*y + 76.801744083044187911827650374159992 + 5.4401235392156299770877919015029993*a)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f65_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.83545020758556226166712284789296028*b6*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-.83545020758556226166712284789296028*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + (22.557155604810181065012316893109926*b4*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((-97.747674287510784615053373203476350-30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 7.5190518682700603550041056310366424*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + (-82.709570550970663905045161941403067*b2*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-16.541914110194132781009032388280613*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (232.96529038523403666587720613495197 + 71.681627810841242051039140349215992*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 10.240232544405891721577020049887999*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a; + return -.83545020758556226166712284789296028*b6*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - .83545020758556226166712284789296028*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + (22.557155604810181065012316893109926*b4*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((-97.747674287510784615053373203476350 - 30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 7.5190518682700603550041056310366424*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + (-82.709570550970663905045161941403067*b2*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - 16.541914110194132781009032388280613*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (232.96529038523403666587720613495197 + 71.681627810841242051039140349215992*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 10.240232544405891721577020049887999*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a; } // number 66 inline double jacobi_f66(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return .32612178450642258898018265094570013e-1*(.79720045437338092375232558872693519*b8 + (-9.5664054524805710850279070647232223*b6 + (31.569137993185884580592093313586634*b4 + (-39.085599420134904718828306007297737*b2 + 16.285666425056210299511794169707390*a2)*a2)*a2)*a2)*a*(1. + y); + return .32612178450642258898018265094570013e-1 * (.79720045437338092375232558872693519*b8 + (-9.5664054524805710850279070647232223*b6 + (31.569137993185884580592093313586634*b4 + (-39.085599420134904718828306007297737*b2 + 16.285666425056210299511794169707390*a2)*a2)*a2)*a2)*a*(1. + y); } inline double jacobi_f66_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -3765,13 +3765,13 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .32612178450642258898018265094570013e-1*(1.5944009087467618475046511774538704*b8 + (-57.398432714883426510167442388339334*b6 + (315.69137993185884580592093313586634*b4 + (-547.19839188188866606359628410216831*b2 + 293.14199565101178539121229505473303*a2)*a2)*a2)*a2)*(1. + y); + return .32612178450642258898018265094570013e-1 * (1.5944009087467618475046511774538704*b8 + (-57.398432714883426510167442388339334*b6 + (315.69137993185884580592093313586634*b4 + (-547.19839188188866606359628410216831*b2 + 293.14199565101178539121229505473303*a2)*a2)*a2)*a2)*(1. + y); } inline double jacobi_f66_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; @@ -3779,153 +3779,153 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .25998443478957790700562193556377897e-1*b8*(1. + y) + ((-.20798754783166232560449754845102318-.20798754783166232560449754845102318*y + .25998443478957790700562193556377897e-1*b)*b7 + (-.93594396524248046522023896802960429*b6*(1. + y) + ((1.8718879304849609304404779360592086 + 1.8718879304849609304404779360592086*y-.31198132174749348840674632267653476*b)*b5 + (5.1476918088336425587113143241628238*b4*(1. + y) + ((-4.1181534470669140469690514593302588-4.1181534470669140469690514593302588*y + 1.0295383617667285117422628648325647*b)*b3 + (-8.9226658019783137684329448285488942*b2*(1. + y) + ((2.5493330862795182195522699510139698 + 2.5493330862795182195522699510139698*y-1.2746665431397591097761349755069849*b)*b + (4.7799995367740966616605061581511934 + 4.7799995367740966616605061581511934*y + .53111105964156629574005623979457703*a)*a)*a)*a)*a)*a)*a)*a)*a; + return .25998443478957790700562193556377897e-1 * b8*(1. + y) + ((-.20798754783166232560449754845102318 - .20798754783166232560449754845102318*y + .25998443478957790700562193556377897e-1 * b)*b7 + (-.93594396524248046522023896802960429*b6*(1. + y) + ((1.8718879304849609304404779360592086 + 1.8718879304849609304404779360592086*y - .31198132174749348840674632267653476*b)*b5 + (5.1476918088336425587113143241628238*b4*(1. + y) + ((-4.1181534470669140469690514593302588 - 4.1181534470669140469690514593302588*y + 1.0295383617667285117422628648325647*b)*b3 + (-8.9226658019783137684329448285488942*b2*(1. + y) + ((2.5493330862795182195522699510139698 + 2.5493330862795182195522699510139698*y - 1.2746665431397591097761349755069849*b)*b + (4.7799995367740966616605061581511934 + 4.7799995367740966616605061581511934*y + .53111105964156629574005623979457703*a)*a)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f66_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return .32612178450642258898018265094570013e-1*(-229.59373085953370604066976955335733*b6 + (2525.5310394548707664473674650869307*b4 + (-6566.3807025826639927631554092260198*b2 + 4690.2719304161885662593967208757284*a2)*a2)*a2)*a*(1. + y); + return .32612178450642258898018265094570013e-1 * (-229.59373085953370604066976955335733*b6 + (2525.5310394548707664473674650869307*b4 + (-6566.3807025826639927631554092260198*b2 + 4690.2719304161885662593967208757284*a2)*a2)*a2)*a*(1. + y); } inline double jacobi_f66_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-.41597509566332465120899509690204634-.41597509566332465120899509690204634*y + .51996886957915581401124387112755795e-1*b)*b7 + ((-.41597509566332465120899509690204634-.41597509566332465120899509690204634*y-.41597509566332465120899509690204634*b)*b6 + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y-1.8718879304849609304404779360592086*b)*b5 + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y + 3.7437758609699218608809558721184173*b)*b4 + ((-41.181534470669140469690514593302588-41.181534470669140469690514593302588*y + 10.295383617667285117422628648325647*b)*b3 + ((-41.181534470669140469690514593302588-41.181534470669140469690514593302588*y-8.2363068941338280939381029186605177*b)*b2 + ((35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y-17.845331603956627536865889657097789*b)*b + (35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y + 5.0986661725590364391045399020279395*b + 9.5599990735481933233210123163023868*a)*a)*a)*a)*a)*a)*a)*a; + return (-.41597509566332465120899509690204634 - .41597509566332465120899509690204634*y + .51996886957915581401124387112755795e-1 * b)*b7 + ((-.41597509566332465120899509690204634 - .41597509566332465120899509690204634*y - .41597509566332465120899509690204634*b)*b6 + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y - 1.8718879304849609304404779360592086*b)*b5 + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y + 3.7437758609699218608809558721184173*b)*b4 + ((-41.181534470669140469690514593302588 - 41.181534470669140469690514593302588*y + 10.295383617667285117422628648325647*b)*b3 + ((-41.181534470669140469690514593302588 - 41.181534470669140469690514593302588*y - 8.2363068941338280939381029186605177*b)*b2 + ((35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y - 17.845331603956627536865889657097789*b)*b + (35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y + 5.0986661725590364391045399020279395*b + 9.5599990735481933233210123163023868*a)*a)*a)*a)*a)*a)*a)*a; } inline double jacobi_f66_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-.41597509566332465120899509690204634-.41597509566332465120899509690204634*y + .51996886957915581401124387112755795e-1*b)*b7+ - (-3.7437758609699218608809558721184173*b6*(1. + y) + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y- - 1.8718879304849609304404779360592086*b)*b5 + (41.181534470669140469690514593302588*b4*(1. + y) + ((-41.181534470669140469690514593302588- - 41.181534470669140469690514593302588*y + 10.295383617667285117422628648325647*b)*b3 + (-107.07198962373976522119533794258673*b2*(1. + y)+ - ((35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y-17.845331603956627536865889657097789*b)*b+ - (76.479992588385546586568098530419093 + 76.479992588385546586568098530419093*y+ - 9.5599990735481933233210123163023868*a)*a)*a)*a)*a)*a)*a)*a; + return (-.41597509566332465120899509690204634 - .41597509566332465120899509690204634*y + .51996886957915581401124387112755795e-1 * b)*b7 + + (-3.7437758609699218608809558721184173*b6*(1. + y) + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y - + 1.8718879304849609304404779360592086*b)*b5 + (41.181534470669140469690514593302588*b4*(1. + y) + ((-41.181534470669140469690514593302588 - + 41.181534470669140469690514593302588*y + 10.295383617667285117422628648325647*b)*b3 + (-107.07198962373976522119533794258673*b2*(1. + y) + + ((35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y - 17.845331603956627536865889657097789*b)*b + + (76.479992588385546586568098530419093 + 76.479992588385546586568098530419093*y + + 9.5599990735481933233210123163023868*a)*a)*a)*a)*a)*a)*a)*a; } //////////////////////////////////////////////////////////////////////////////////////////////////// static Shapeset::shape_fn_t jacobi_tri_fn[] = { - jacobi_f1, jacobi_f2, jacobi_f3, jacobi_f4, jacobi_f5, jacobi_f6, jacobi_f7_0, - jacobi_f7_1, jacobi_f8_0, jacobi_f8_1, jacobi_f9_0, jacobi_f9_1, jacobi_f10, jacobi_f11, - jacobi_f12, jacobi_f13, jacobi_f14, jacobi_f15, jacobi_f16_0, jacobi_f16_1, jacobi_f17_0, - jacobi_f17_1, jacobi_f18_0, jacobi_f18_1, jacobi_f19, jacobi_f20, jacobi_f21, jacobi_f22, - jacobi_f23, jacobi_f24, jacobi_f25, jacobi_f26, jacobi_f27, jacobi_f28, jacobi_f29_0, - jacobi_f29_1, jacobi_f30_0, jacobi_f30_1, jacobi_f31_0, jacobi_f31_1, jacobi_f32, jacobi_f33, - jacobi_f34, jacobi_f35, jacobi_f36, jacobi_f37, jacobi_f38, jacobi_f39, jacobi_f40, - jacobi_f41, jacobi_f42, jacobi_f43, jacobi_f44, jacobi_f45, jacobi_f46_0, jacobi_f46_1, - jacobi_f47_0, jacobi_f47_1, jacobi_f48_0, jacobi_f48_1, jacobi_f49, jacobi_f50, jacobi_f51, - jacobi_f52, jacobi_f53, jacobi_f54, jacobi_f55, jacobi_f56, jacobi_f57, jacobi_f58, - jacobi_f59, jacobi_f60, jacobi_f61, jacobi_f62, jacobi_f63, jacobi_f64, jacobi_f65, + jacobi_f1, jacobi_f2, jacobi_f3, jacobi_f4, jacobi_f5, jacobi_f6, jacobi_f7_0, + jacobi_f7_1, jacobi_f8_0, jacobi_f8_1, jacobi_f9_0, jacobi_f9_1, jacobi_f10, jacobi_f11, + jacobi_f12, jacobi_f13, jacobi_f14, jacobi_f15, jacobi_f16_0, jacobi_f16_1, jacobi_f17_0, + jacobi_f17_1, jacobi_f18_0, jacobi_f18_1, jacobi_f19, jacobi_f20, jacobi_f21, jacobi_f22, + jacobi_f23, jacobi_f24, jacobi_f25, jacobi_f26, jacobi_f27, jacobi_f28, jacobi_f29_0, + jacobi_f29_1, jacobi_f30_0, jacobi_f30_1, jacobi_f31_0, jacobi_f31_1, jacobi_f32, jacobi_f33, + jacobi_f34, jacobi_f35, jacobi_f36, jacobi_f37, jacobi_f38, jacobi_f39, jacobi_f40, + jacobi_f41, jacobi_f42, jacobi_f43, jacobi_f44, jacobi_f45, jacobi_f46_0, jacobi_f46_1, + jacobi_f47_0, jacobi_f47_1, jacobi_f48_0, jacobi_f48_1, jacobi_f49, jacobi_f50, jacobi_f51, + jacobi_f52, jacobi_f53, jacobi_f54, jacobi_f55, jacobi_f56, jacobi_f57, jacobi_f58, + jacobi_f59, jacobi_f60, jacobi_f61, jacobi_f62, jacobi_f63, jacobi_f64, jacobi_f65, jacobi_f66 }; static Shapeset::shape_fn_t jacobi_tri_fn_dx[] = { - jacobi_f1_dx, jacobi_f2_dx, jacobi_f3_dx, jacobi_f4_dx, jacobi_f5_dx, jacobi_f6_dx, jacobi_f7_dx_0, - jacobi_f7_dx_1, jacobi_f8_dx_0, jacobi_f8_dx_1, jacobi_f9_dx_0, jacobi_f9_dx_1, jacobi_f10_dx, jacobi_f11_dx, - jacobi_f12_dx, jacobi_f13_dx, jacobi_f14_dx, jacobi_f15_dx, jacobi_f16_dx_0, jacobi_f16_dx_1, jacobi_f17_dx_0, - jacobi_f17_dx_1, jacobi_f18_dx_0, jacobi_f18_dx_1, jacobi_f19_dx, jacobi_f20_dx, jacobi_f21_dx, jacobi_f22_dx, - jacobi_f23_dx, jacobi_f24_dx, jacobi_f25_dx, jacobi_f26_dx, jacobi_f27_dx, jacobi_f28_dx, jacobi_f29_dx_0, - jacobi_f29_dx_1, jacobi_f30_dx_0, jacobi_f30_dx_1, jacobi_f31_dx_0, jacobi_f31_dx_1, jacobi_f32_dx, jacobi_f33_dx, - jacobi_f34_dx, jacobi_f35_dx, jacobi_f36_dx, jacobi_f37_dx, jacobi_f38_dx, jacobi_f39_dx, jacobi_f40_dx, - jacobi_f41_dx, jacobi_f42_dx, jacobi_f43_dx, jacobi_f44_dx, jacobi_f45_dx, jacobi_f46_dx_0, jacobi_f46_dx_1, - jacobi_f47_dx_0, jacobi_f47_dx_1, jacobi_f48_dx_0, jacobi_f48_dx_1, jacobi_f49_dx, jacobi_f50_dx, jacobi_f51_dx, - jacobi_f52_dx, jacobi_f53_dx, jacobi_f54_dx, jacobi_f55_dx, jacobi_f56_dx, jacobi_f57_dx, jacobi_f58_dx, - jacobi_f59_dx, jacobi_f60_dx, jacobi_f61_dx, jacobi_f62_dx, jacobi_f63_dx, jacobi_f64_dx, jacobi_f65_dx, + jacobi_f1_dx, jacobi_f2_dx, jacobi_f3_dx, jacobi_f4_dx, jacobi_f5_dx, jacobi_f6_dx, jacobi_f7_dx_0, + jacobi_f7_dx_1, jacobi_f8_dx_0, jacobi_f8_dx_1, jacobi_f9_dx_0, jacobi_f9_dx_1, jacobi_f10_dx, jacobi_f11_dx, + jacobi_f12_dx, jacobi_f13_dx, jacobi_f14_dx, jacobi_f15_dx, jacobi_f16_dx_0, jacobi_f16_dx_1, jacobi_f17_dx_0, + jacobi_f17_dx_1, jacobi_f18_dx_0, jacobi_f18_dx_1, jacobi_f19_dx, jacobi_f20_dx, jacobi_f21_dx, jacobi_f22_dx, + jacobi_f23_dx, jacobi_f24_dx, jacobi_f25_dx, jacobi_f26_dx, jacobi_f27_dx, jacobi_f28_dx, jacobi_f29_dx_0, + jacobi_f29_dx_1, jacobi_f30_dx_0, jacobi_f30_dx_1, jacobi_f31_dx_0, jacobi_f31_dx_1, jacobi_f32_dx, jacobi_f33_dx, + jacobi_f34_dx, jacobi_f35_dx, jacobi_f36_dx, jacobi_f37_dx, jacobi_f38_dx, jacobi_f39_dx, jacobi_f40_dx, + jacobi_f41_dx, jacobi_f42_dx, jacobi_f43_dx, jacobi_f44_dx, jacobi_f45_dx, jacobi_f46_dx_0, jacobi_f46_dx_1, + jacobi_f47_dx_0, jacobi_f47_dx_1, jacobi_f48_dx_0, jacobi_f48_dx_1, jacobi_f49_dx, jacobi_f50_dx, jacobi_f51_dx, + jacobi_f52_dx, jacobi_f53_dx, jacobi_f54_dx, jacobi_f55_dx, jacobi_f56_dx, jacobi_f57_dx, jacobi_f58_dx, + jacobi_f59_dx, jacobi_f60_dx, jacobi_f61_dx, jacobi_f62_dx, jacobi_f63_dx, jacobi_f64_dx, jacobi_f65_dx, jacobi_f66_dx }; static Shapeset::shape_fn_t jacobi_tri_fn_dy[] = { - jacobi_f1_dy, jacobi_f2_dy, jacobi_f3_dy, jacobi_f4_dy, jacobi_f5_dy, jacobi_f6_dy, jacobi_f7_dy_0, - jacobi_f7_dy_1, jacobi_f8_dy_0, jacobi_f8_dy_1, jacobi_f9_dy_0, jacobi_f9_dy_1, jacobi_f10_dy, jacobi_f11_dy, - jacobi_f12_dy, jacobi_f13_dy, jacobi_f14_dy, jacobi_f15_dy, jacobi_f16_dy_0, jacobi_f16_dy_1, jacobi_f17_dy_0, - jacobi_f17_dy_1, jacobi_f18_dy_0, jacobi_f18_dy_1, jacobi_f19_dy, jacobi_f20_dy, jacobi_f21_dy, jacobi_f22_dy, - jacobi_f23_dy, jacobi_f24_dy, jacobi_f25_dy, jacobi_f26_dy, jacobi_f27_dy, jacobi_f28_dy, jacobi_f29_dy_0, - jacobi_f29_dy_1, jacobi_f30_dy_0, jacobi_f30_dy_1, jacobi_f31_dy_0, jacobi_f31_dy_1, jacobi_f32_dy, jacobi_f33_dy, - jacobi_f34_dy, jacobi_f35_dy, jacobi_f36_dy, jacobi_f37_dy, jacobi_f38_dy, jacobi_f39_dy, jacobi_f40_dy, - jacobi_f41_dy, jacobi_f42_dy, jacobi_f43_dy, jacobi_f44_dy, jacobi_f45_dy, jacobi_f46_dy_0, jacobi_f46_dy_1, - jacobi_f47_dy_0, jacobi_f47_dy_1, jacobi_f48_dy_0, jacobi_f48_dy_1, jacobi_f49_dy, jacobi_f50_dy, jacobi_f51_dy, - jacobi_f52_dy, jacobi_f53_dy, jacobi_f54_dy, jacobi_f55_dy, jacobi_f56_dy, jacobi_f57_dy, jacobi_f58_dy, - jacobi_f59_dy, jacobi_f60_dy, jacobi_f61_dy, jacobi_f62_dy, jacobi_f63_dy, jacobi_f64_dy, jacobi_f65_dy, + jacobi_f1_dy, jacobi_f2_dy, jacobi_f3_dy, jacobi_f4_dy, jacobi_f5_dy, jacobi_f6_dy, jacobi_f7_dy_0, + jacobi_f7_dy_1, jacobi_f8_dy_0, jacobi_f8_dy_1, jacobi_f9_dy_0, jacobi_f9_dy_1, jacobi_f10_dy, jacobi_f11_dy, + jacobi_f12_dy, jacobi_f13_dy, jacobi_f14_dy, jacobi_f15_dy, jacobi_f16_dy_0, jacobi_f16_dy_1, jacobi_f17_dy_0, + jacobi_f17_dy_1, jacobi_f18_dy_0, jacobi_f18_dy_1, jacobi_f19_dy, jacobi_f20_dy, jacobi_f21_dy, jacobi_f22_dy, + jacobi_f23_dy, jacobi_f24_dy, jacobi_f25_dy, jacobi_f26_dy, jacobi_f27_dy, jacobi_f28_dy, jacobi_f29_dy_0, + jacobi_f29_dy_1, jacobi_f30_dy_0, jacobi_f30_dy_1, jacobi_f31_dy_0, jacobi_f31_dy_1, jacobi_f32_dy, jacobi_f33_dy, + jacobi_f34_dy, jacobi_f35_dy, jacobi_f36_dy, jacobi_f37_dy, jacobi_f38_dy, jacobi_f39_dy, jacobi_f40_dy, + jacobi_f41_dy, jacobi_f42_dy, jacobi_f43_dy, jacobi_f44_dy, jacobi_f45_dy, jacobi_f46_dy_0, jacobi_f46_dy_1, + jacobi_f47_dy_0, jacobi_f47_dy_1, jacobi_f48_dy_0, jacobi_f48_dy_1, jacobi_f49_dy, jacobi_f50_dy, jacobi_f51_dy, + jacobi_f52_dy, jacobi_f53_dy, jacobi_f54_dy, jacobi_f55_dy, jacobi_f56_dy, jacobi_f57_dy, jacobi_f58_dy, + jacobi_f59_dy, jacobi_f60_dy, jacobi_f61_dy, jacobi_f62_dy, jacobi_f63_dy, jacobi_f64_dy, jacobi_f65_dy, jacobi_f66_dy }; static Shapeset::shape_fn_t jacobi_tri_fn_dxx[] = { - jacobi_f1_dxx, jacobi_f2_dxx, jacobi_f3_dxx, jacobi_f4_dxx, jacobi_f5_dxx, jacobi_f6_dxx, jacobi_f7_dxx_0, - jacobi_f7_dxx_1, jacobi_f8_dxx_0, jacobi_f8_dxx_1, jacobi_f9_dxx_0, jacobi_f9_dxx_1, jacobi_f10_dxx, jacobi_f11_dxx, - jacobi_f12_dxx, jacobi_f13_dxx, jacobi_f14_dxx, jacobi_f15_dxx, jacobi_f16_dxx_0, jacobi_f16_dxx_1, jacobi_f17_dxx_0, - jacobi_f17_dxx_1, jacobi_f18_dxx_0, jacobi_f18_dxx_1, jacobi_f19_dxx, jacobi_f20_dxx, jacobi_f21_dxx, jacobi_f22_dxx, - jacobi_f23_dxx, jacobi_f24_dxx, jacobi_f25_dxx, jacobi_f26_dxx, jacobi_f27_dxx, jacobi_f28_dxx, jacobi_f29_dxx_0, - jacobi_f29_dxx_1, jacobi_f30_dxx_0, jacobi_f30_dxx_1, jacobi_f31_dxx_0, jacobi_f31_dxx_1, jacobi_f32_dxx, jacobi_f33_dxx, - jacobi_f34_dxx, jacobi_f35_dxx, jacobi_f36_dxx, jacobi_f37_dxx, jacobi_f38_dxx, jacobi_f39_dxx, jacobi_f40_dxx, - jacobi_f41_dxx, jacobi_f42_dxx, jacobi_f43_dxx, jacobi_f44_dxx, jacobi_f45_dxx, jacobi_f46_dxx_0, jacobi_f46_dxx_1, - jacobi_f47_dxx_0, jacobi_f47_dxx_1, jacobi_f48_dxx_0, jacobi_f48_dxx_1, jacobi_f49_dxx, jacobi_f50_dxx, jacobi_f51_dxx, - jacobi_f52_dxx, jacobi_f53_dxx, jacobi_f54_dxx, jacobi_f55_dxx, jacobi_f56_dxx, jacobi_f57_dxx, jacobi_f58_dxx, - jacobi_f59_dxx, jacobi_f60_dxx, jacobi_f61_dxx, jacobi_f62_dxx, jacobi_f63_dxx, jacobi_f64_dxx, jacobi_f65_dxx, + jacobi_f1_dxx, jacobi_f2_dxx, jacobi_f3_dxx, jacobi_f4_dxx, jacobi_f5_dxx, jacobi_f6_dxx, jacobi_f7_dxx_0, + jacobi_f7_dxx_1, jacobi_f8_dxx_0, jacobi_f8_dxx_1, jacobi_f9_dxx_0, jacobi_f9_dxx_1, jacobi_f10_dxx, jacobi_f11_dxx, + jacobi_f12_dxx, jacobi_f13_dxx, jacobi_f14_dxx, jacobi_f15_dxx, jacobi_f16_dxx_0, jacobi_f16_dxx_1, jacobi_f17_dxx_0, + jacobi_f17_dxx_1, jacobi_f18_dxx_0, jacobi_f18_dxx_1, jacobi_f19_dxx, jacobi_f20_dxx, jacobi_f21_dxx, jacobi_f22_dxx, + jacobi_f23_dxx, jacobi_f24_dxx, jacobi_f25_dxx, jacobi_f26_dxx, jacobi_f27_dxx, jacobi_f28_dxx, jacobi_f29_dxx_0, + jacobi_f29_dxx_1, jacobi_f30_dxx_0, jacobi_f30_dxx_1, jacobi_f31_dxx_0, jacobi_f31_dxx_1, jacobi_f32_dxx, jacobi_f33_dxx, + jacobi_f34_dxx, jacobi_f35_dxx, jacobi_f36_dxx, jacobi_f37_dxx, jacobi_f38_dxx, jacobi_f39_dxx, jacobi_f40_dxx, + jacobi_f41_dxx, jacobi_f42_dxx, jacobi_f43_dxx, jacobi_f44_dxx, jacobi_f45_dxx, jacobi_f46_dxx_0, jacobi_f46_dxx_1, + jacobi_f47_dxx_0, jacobi_f47_dxx_1, jacobi_f48_dxx_0, jacobi_f48_dxx_1, jacobi_f49_dxx, jacobi_f50_dxx, jacobi_f51_dxx, + jacobi_f52_dxx, jacobi_f53_dxx, jacobi_f54_dxx, jacobi_f55_dxx, jacobi_f56_dxx, jacobi_f57_dxx, jacobi_f58_dxx, + jacobi_f59_dxx, jacobi_f60_dxx, jacobi_f61_dxx, jacobi_f62_dxx, jacobi_f63_dxx, jacobi_f64_dxx, jacobi_f65_dxx, jacobi_f66_dxx }; static Shapeset::shape_fn_t jacobi_tri_fn_dyy[] = { - jacobi_f1_dyy, jacobi_f2_dyy, jacobi_f3_dyy, jacobi_f4_dyy, jacobi_f5_dyy, jacobi_f6_dyy, jacobi_f7_dyy_0, - jacobi_f7_dyy_1, jacobi_f8_dyy_0, jacobi_f8_dyy_1, jacobi_f9_dyy_0, jacobi_f9_dyy_1, jacobi_f10_dyy, jacobi_f11_dyy, - jacobi_f12_dyy, jacobi_f13_dyy, jacobi_f14_dyy, jacobi_f15_dyy, jacobi_f16_dyy_0, jacobi_f16_dyy_1, jacobi_f17_dyy_0, - jacobi_f17_dyy_1, jacobi_f18_dyy_0, jacobi_f18_dyy_1, jacobi_f19_dyy, jacobi_f20_dyy, jacobi_f21_dyy, jacobi_f22_dyy, - jacobi_f23_dyy, jacobi_f24_dyy, jacobi_f25_dyy, jacobi_f26_dyy, jacobi_f27_dyy, jacobi_f28_dyy, jacobi_f29_dyy_0, - jacobi_f29_dyy_1, jacobi_f30_dyy_0, jacobi_f30_dyy_1, jacobi_f31_dyy_0, jacobi_f31_dyy_1, jacobi_f32_dyy, jacobi_f33_dyy, - jacobi_f34_dyy, jacobi_f35_dyy, jacobi_f36_dyy, jacobi_f37_dyy, jacobi_f38_dyy, jacobi_f39_dyy, jacobi_f40_dyy, - jacobi_f41_dyy, jacobi_f42_dyy, jacobi_f43_dyy, jacobi_f44_dyy, jacobi_f45_dyy, jacobi_f46_dyy_0, jacobi_f46_dyy_1, - jacobi_f47_dyy_0, jacobi_f47_dyy_1, jacobi_f48_dyy_0, jacobi_f48_dyy_1, jacobi_f49_dyy, jacobi_f50_dyy, jacobi_f51_dyy, - jacobi_f52_dyy, jacobi_f53_dyy, jacobi_f54_dyy, jacobi_f55_dyy, jacobi_f56_dyy, jacobi_f57_dyy, jacobi_f58_dyy, - jacobi_f59_dyy, jacobi_f60_dyy, jacobi_f61_dyy, jacobi_f62_dyy, jacobi_f63_dyy, jacobi_f64_dyy, jacobi_f65_dyy, + jacobi_f1_dyy, jacobi_f2_dyy, jacobi_f3_dyy, jacobi_f4_dyy, jacobi_f5_dyy, jacobi_f6_dyy, jacobi_f7_dyy_0, + jacobi_f7_dyy_1, jacobi_f8_dyy_0, jacobi_f8_dyy_1, jacobi_f9_dyy_0, jacobi_f9_dyy_1, jacobi_f10_dyy, jacobi_f11_dyy, + jacobi_f12_dyy, jacobi_f13_dyy, jacobi_f14_dyy, jacobi_f15_dyy, jacobi_f16_dyy_0, jacobi_f16_dyy_1, jacobi_f17_dyy_0, + jacobi_f17_dyy_1, jacobi_f18_dyy_0, jacobi_f18_dyy_1, jacobi_f19_dyy, jacobi_f20_dyy, jacobi_f21_dyy, jacobi_f22_dyy, + jacobi_f23_dyy, jacobi_f24_dyy, jacobi_f25_dyy, jacobi_f26_dyy, jacobi_f27_dyy, jacobi_f28_dyy, jacobi_f29_dyy_0, + jacobi_f29_dyy_1, jacobi_f30_dyy_0, jacobi_f30_dyy_1, jacobi_f31_dyy_0, jacobi_f31_dyy_1, jacobi_f32_dyy, jacobi_f33_dyy, + jacobi_f34_dyy, jacobi_f35_dyy, jacobi_f36_dyy, jacobi_f37_dyy, jacobi_f38_dyy, jacobi_f39_dyy, jacobi_f40_dyy, + jacobi_f41_dyy, jacobi_f42_dyy, jacobi_f43_dyy, jacobi_f44_dyy, jacobi_f45_dyy, jacobi_f46_dyy_0, jacobi_f46_dyy_1, + jacobi_f47_dyy_0, jacobi_f47_dyy_1, jacobi_f48_dyy_0, jacobi_f48_dyy_1, jacobi_f49_dyy, jacobi_f50_dyy, jacobi_f51_dyy, + jacobi_f52_dyy, jacobi_f53_dyy, jacobi_f54_dyy, jacobi_f55_dyy, jacobi_f56_dyy, jacobi_f57_dyy, jacobi_f58_dyy, + jacobi_f59_dyy, jacobi_f60_dyy, jacobi_f61_dyy, jacobi_f62_dyy, jacobi_f63_dyy, jacobi_f64_dyy, jacobi_f65_dyy, jacobi_f66_dyy }; static Shapeset::shape_fn_t jacobi_tri_fn_dxy[] = { - jacobi_f1_dxy, jacobi_f2_dxy, jacobi_f3_dxy, jacobi_f4_dxy, jacobi_f5_dxy, jacobi_f6_dxy, jacobi_f7_dxy_0, - jacobi_f7_dxy_1, jacobi_f8_dxy_0, jacobi_f8_dxy_1, jacobi_f9_dxy_0, jacobi_f9_dxy_1, jacobi_f10_dxy, jacobi_f11_dxy, - jacobi_f12_dxy, jacobi_f13_dxy, jacobi_f14_dxy, jacobi_f15_dxy, jacobi_f16_dxy_0, jacobi_f16_dxy_1, jacobi_f17_dxy_0, - jacobi_f17_dxy_1, jacobi_f18_dxy_0, jacobi_f18_dxy_1, jacobi_f19_dxy, jacobi_f20_dxy, jacobi_f21_dxy, jacobi_f22_dxy, - jacobi_f23_dxy, jacobi_f24_dxy, jacobi_f25_dxy, jacobi_f26_dxy, jacobi_f27_dxy, jacobi_f28_dxy, jacobi_f29_dxy_0, - jacobi_f29_dxy_1, jacobi_f30_dxy_0, jacobi_f30_dxy_1, jacobi_f31_dxy_0, jacobi_f31_dxy_1, jacobi_f32_dxy, jacobi_f33_dxy, - jacobi_f34_dxy, jacobi_f35_dxy, jacobi_f36_dxy, jacobi_f37_dxy, jacobi_f38_dxy, jacobi_f39_dxy, jacobi_f40_dxy, - jacobi_f41_dxy, jacobi_f42_dxy, jacobi_f43_dxy, jacobi_f44_dxy, jacobi_f45_dxy, jacobi_f46_dxy_0, jacobi_f46_dxy_1, - jacobi_f47_dxy_0, jacobi_f47_dxy_1, jacobi_f48_dxy_0, jacobi_f48_dxy_1, jacobi_f49_dxy, jacobi_f50_dxy, jacobi_f51_dxy, - jacobi_f52_dxy, jacobi_f53_dxy, jacobi_f54_dxy, jacobi_f55_dxy, jacobi_f56_dxy, jacobi_f57_dxy, jacobi_f58_dxy, - jacobi_f59_dxy, jacobi_f60_dxy, jacobi_f61_dxy, jacobi_f62_dxy, jacobi_f63_dxy, jacobi_f64_dxy, jacobi_f65_dxy, + jacobi_f1_dxy, jacobi_f2_dxy, jacobi_f3_dxy, jacobi_f4_dxy, jacobi_f5_dxy, jacobi_f6_dxy, jacobi_f7_dxy_0, + jacobi_f7_dxy_1, jacobi_f8_dxy_0, jacobi_f8_dxy_1, jacobi_f9_dxy_0, jacobi_f9_dxy_1, jacobi_f10_dxy, jacobi_f11_dxy, + jacobi_f12_dxy, jacobi_f13_dxy, jacobi_f14_dxy, jacobi_f15_dxy, jacobi_f16_dxy_0, jacobi_f16_dxy_1, jacobi_f17_dxy_0, + jacobi_f17_dxy_1, jacobi_f18_dxy_0, jacobi_f18_dxy_1, jacobi_f19_dxy, jacobi_f20_dxy, jacobi_f21_dxy, jacobi_f22_dxy, + jacobi_f23_dxy, jacobi_f24_dxy, jacobi_f25_dxy, jacobi_f26_dxy, jacobi_f27_dxy, jacobi_f28_dxy, jacobi_f29_dxy_0, + jacobi_f29_dxy_1, jacobi_f30_dxy_0, jacobi_f30_dxy_1, jacobi_f31_dxy_0, jacobi_f31_dxy_1, jacobi_f32_dxy, jacobi_f33_dxy, + jacobi_f34_dxy, jacobi_f35_dxy, jacobi_f36_dxy, jacobi_f37_dxy, jacobi_f38_dxy, jacobi_f39_dxy, jacobi_f40_dxy, + jacobi_f41_dxy, jacobi_f42_dxy, jacobi_f43_dxy, jacobi_f44_dxy, jacobi_f45_dxy, jacobi_f46_dxy_0, jacobi_f46_dxy_1, + jacobi_f47_dxy_0, jacobi_f47_dxy_1, jacobi_f48_dxy_0, jacobi_f48_dxy_1, jacobi_f49_dxy, jacobi_f50_dxy, jacobi_f51_dxy, + jacobi_f52_dxy, jacobi_f53_dxy, jacobi_f54_dxy, jacobi_f55_dxy, jacobi_f56_dxy, jacobi_f57_dxy, jacobi_f58_dxy, + jacobi_f59_dxy, jacobi_f60_dxy, jacobi_f61_dxy, jacobi_f62_dxy, jacobi_f63_dxy, jacobi_f64_dxy, jacobi_f65_dxy, jacobi_f66_dxy }; - static int jacobi_tri_bubble_indices_all_orders[] = + static short jacobi_tri_bubble_indices_all_orders[] = { 12, 16, 17, @@ -3937,7 +3937,7 @@ namespace Hermes 70, 71, 72, 73, 74, 75, 76, 77 }; - static int* jacobi_tri_bubble_indices[11] = + static short* jacobi_tri_bubble_indices[11] = { nullptr, nullptr, nullptr, jacobi_tri_bubble_indices_all_orders, @@ -3950,22 +3950,22 @@ namespace Hermes jacobi_tri_bubble_indices_all_orders }; - static int jacobi_tri_bubble_count[11] = { 0, 0, 0, 1, 3, 6, 10, 15, 21, 28, 36 }; + static unsigned short jacobi_tri_bubble_count[11] = { 0, 0, 0, 1, 3, 6, 10, 15, 21, 28, 36 }; - static int jacobi_tri_edge_indices_0[22] = { 0, 1, 1, 0, 3, 3, 6, 7, 13, 13, 18, 19, 27, 27, 34, 35, 45, 45, 54, 55, 67, 67 }; - static int jacobi_tri_edge_indices_1[22] = { 1, 2, 2, 1, 4, 4, 8, 9, 14, 14, 20, 21, 28, 28, 36, 37, 46, 46, 56, 57, 68, 68 }; - static int jacobi_tri_edge_indices_2[22] = { 2, 0, 0, 2, 5, 5, 10, 11, 15, 15, 22, 23, 29, 29, 38, 39, 47, 47, 58, 59, 69, 69 }; + static short jacobi_tri_edge_indices_0[22] = { 0, 1, 1, 0, 3, 3, 6, 7, 13, 13, 18, 19, 27, 27, 34, 35, 45, 45, 54, 55, 67, 67 }; + static short jacobi_tri_edge_indices_1[22] = { 1, 2, 2, 1, 4, 4, 8, 9, 14, 14, 20, 21, 28, 28, 36, 37, 46, 46, 56, 57, 68, 68 }; + static short jacobi_tri_edge_indices_2[22] = { 2, 0, 0, 2, 5, 5, 10, 11, 15, 15, 22, 23, 29, 29, 38, 39, 47, 47, 58, 59, 69, 69 }; - static int* jacobi_tri_edge_indices[3] = + static short* jacobi_tri_edge_indices[3] = { jacobi_tri_edge_indices_0, jacobi_tri_edge_indices_1, jacobi_tri_edge_indices_2 }; - static int jacobi_tri_vertex_indices[3] = { 0, 1, 2 }; + static short jacobi_tri_vertex_indices[3] = { 0, 1, 2 }; - static int jacobi_tri_index_to_order[78] = + static unsigned short jacobi_tri_index_to_order[78] = { 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, @@ -4004,7 +4004,7 @@ namespace Hermes //// triangle and quad tables and class constructor /////////////////////////////////////////////// - #include "shapeset_h1_quad.h" +#include "shapeset_h1_quad.h" static Shapeset::shape_fn_t** jacobi_shape_fn_table[2] = { @@ -4042,37 +4042,37 @@ namespace Hermes simple_quad_shape_fn_table_dxy }; - static int* jacobi_vertex_indices[2] = + static short* jacobi_vertex_indices[2] = { jacobi_tri_vertex_indices, simple_quad_vertex_indices }; - static int** jacobi_edge_indices[2] = + static short** jacobi_edge_indices[2] = { jacobi_tri_edge_indices, simple_quad_edge_indices }; - static int** jacobi_bubble_indices[2] = + static short** jacobi_bubble_indices[2] = { jacobi_tri_bubble_indices, simple_quad_bubble_indices }; - static int* jacobi_bubble_count[2] = + static unsigned short* jacobi_bubble_count[2] = { jacobi_tri_bubble_count, simple_quad_bubble_count }; - static int* jacobi_index_to_order[2] = + static unsigned short* jacobi_index_to_order[2] = { jacobi_tri_index_to_order, simple_quad_index_to_order }; - int H1ShapesetJacobi::get_max_index(ElementMode2D mode) const { return max_index[mode]; } + unsigned short H1ShapesetJacobi::get_max_index(ElementMode2D mode) const { return max_index[mode]; } H1ShapesetJacobi::H1ShapesetJacobi() { @@ -4091,19 +4091,19 @@ namespace Hermes ref_vert[0][0][0] = -1.0; ref_vert[0][0][1] = -1.0; - ref_vert[0][1][0] = 1.0; + ref_vert[0][1][0] = 1.0; ref_vert[0][1][1] = -1.0; ref_vert[0][2][0] = -1.0; - ref_vert[0][2][1] = 1.0; + ref_vert[0][2][1] = 1.0; ref_vert[1][0][0] = -1.0; ref_vert[1][0][1] = -1.0; - ref_vert[1][1][0] = 1.0; + ref_vert[1][1][0] = 1.0; ref_vert[1][1][1] = -1.0; - ref_vert[1][2][0] = 1.0; - ref_vert[1][2][1] = 1.0; + ref_vert[1][2][0] = 1.0; + ref_vert[1][2][1] = 1.0; ref_vert[1][3][0] = -1.0; - ref_vert[1][3][1] = 1.0; + ref_vert[1][3][1] = 1.0; max_order = 10; min_order = 1; @@ -4113,6 +4113,6 @@ namespace Hermes comb_table = nullptr; } - const int H1ShapesetJacobi::max_index[2] = { 77, 136 }; + const unsigned short H1ShapesetJacobi::max_index[2] = { 77, 136 }; } } \ No newline at end of file diff --git a/hermes2d/src/shapeset/shapeset_h1_quad.cpp b/hermes2d/src/shapeset/shapeset_h1_quad.cpp index 9ef7829850..71ad18ab13 100644 --- a/hermes2d/src/shapeset/shapeset_h1_quad.cpp +++ b/hermes2d/src/shapeset/shapeset_h1_quad.cpp @@ -114,62 +114,62 @@ namespace Hermes static double simple_quad_l0_l3_0(double x, double y) { - return - l0(x) * l3(y); + return -l0(x) * l3(y); } static double simple_quad_l0_l3x_0(double x, double y) { - return - dl0(x) * l3(y); + return -dl0(x) * l3(y); } static double simple_quad_l0_l3y_0(double x, double y) { - return - l0(x) * dl3(y); + return -l0(x) * dl3(y); } static double simple_quad_l0_l3xx_0(double x, double y) { - return - d2l0(x) * l3(y); + return -d2l0(x) * l3(y); } static double simple_quad_l0_l3xy_0(double x, double y) { - return - dl0(x) * dl3(y); + return -dl0(x) * dl3(y); } static double simple_quad_l0_l3yy_0(double x, double y) { - return - l0(x) * d2l3(y); + return -l0(x) * d2l3(y); } static double simple_quad_l0_l3_1(double x, double y) { - return -(- l0(x) * l3(y)); + return -(-l0(x) * l3(y)); } static double simple_quad_l0_l3x_1(double x, double y) { - return -(- dl0(x) * l3(y)); + return -(-dl0(x) * l3(y)); } static double simple_quad_l0_l3y_1(double x, double y) { - return -(- l0(x) * dl3(y)); + return -(-l0(x) * dl3(y)); } static double simple_quad_l0_l3xx_1(double x, double y) { - return -(- d2l0(x) * l3(y)); + return -(-d2l0(x) * l3(y)); } static double simple_quad_l0_l3xy_1(double x, double y) { - return -(- dl0(x) * dl3(y)); + return -(-dl0(x) * dl3(y)); } static double simple_quad_l0_l3yy_1(double x, double y) { - return -(- l0(x) * d2l3(y)); + return -(-l0(x) * d2l3(y)); } static double simple_quad_l0_l4(double x, double y) @@ -204,62 +204,62 @@ namespace Hermes static double simple_quad_l0_l5_0(double x, double y) { - return - l0(x) * l5(y); + return -l0(x) * l5(y); } static double simple_quad_l0_l5x_0(double x, double y) { - return - dl0(x) * l5(y); + return -dl0(x) * l5(y); } static double simple_quad_l0_l5y_0(double x, double y) { - return - l0(x) * dl5(y); + return -l0(x) * dl5(y); } static double simple_quad_l0_l5xx_0(double x, double y) { - return - d2l0(x) * l5(y); + return -d2l0(x) * l5(y); } static double simple_quad_l0_l5xy_0(double x, double y) { - return - dl0(x) * dl5(y); + return -dl0(x) * dl5(y); } static double simple_quad_l0_l5yy_0(double x, double y) { - return - l0(x) * d2l5(y); + return -l0(x) * d2l5(y); } static double simple_quad_l0_l5_1(double x, double y) { - return -(- l0(x) * l5(y)); + return -(-l0(x) * l5(y)); } static double simple_quad_l0_l5x_1(double x, double y) { - return -(- dl0(x) * l5(y)); + return -(-dl0(x) * l5(y)); } static double simple_quad_l0_l5y_1(double x, double y) { - return -(- l0(x) * dl5(y)); + return -(-l0(x) * dl5(y)); } static double simple_quad_l0_l5xx_1(double x, double y) { - return -(- d2l0(x) * l5(y)); + return -(-d2l0(x) * l5(y)); } static double simple_quad_l0_l5xy_1(double x, double y) { - return -(- dl0(x) * dl5(y)); + return -(-dl0(x) * dl5(y)); } static double simple_quad_l0_l5yy_1(double x, double y) { - return -(- l0(x) * d2l5(y)); + return -(-l0(x) * d2l5(y)); } static double simple_quad_l0_l6(double x, double y) @@ -294,62 +294,62 @@ namespace Hermes static double simple_quad_l0_l7_0(double x, double y) { - return - l0(x) * l7(y); + return -l0(x) * l7(y); } static double simple_quad_l0_l7x_0(double x, double y) { - return - dl0(x) * l7(y); + return -dl0(x) * l7(y); } static double simple_quad_l0_l7y_0(double x, double y) { - return - l0(x) * dl7(y); + return -l0(x) * dl7(y); } static double simple_quad_l0_l7xx_0(double x, double y) { - return - d2l0(x) * l7(y); + return -d2l0(x) * l7(y); } static double simple_quad_l0_l7xy_0(double x, double y) { - return - dl0(x) * dl7(y); + return -dl0(x) * dl7(y); } static double simple_quad_l0_l7yy_0(double x, double y) { - return - l0(x) * d2l7(y); + return -l0(x) * d2l7(y); } static double simple_quad_l0_l7_1(double x, double y) { - return -(- l0(x) * l7(y)); + return -(-l0(x) * l7(y)); } static double simple_quad_l0_l7x_1(double x, double y) { - return -(- dl0(x) * l7(y)); + return -(-dl0(x) * l7(y)); } static double simple_quad_l0_l7y_1(double x, double y) { - return -(- l0(x) * dl7(y)); + return -(-l0(x) * dl7(y)); } static double simple_quad_l0_l7xx_1(double x, double y) { - return -(- d2l0(x) * l7(y)); + return -(-d2l0(x) * l7(y)); } static double simple_quad_l0_l7xy_1(double x, double y) { - return -(- dl0(x) * dl7(y)); + return -(-dl0(x) * dl7(y)); } static double simple_quad_l0_l7yy_1(double x, double y) { - return -(- l0(x) * d2l7(y)); + return -(-l0(x) * d2l7(y)); } static double simple_quad_l0_l8(double x, double y) @@ -384,62 +384,62 @@ namespace Hermes static double simple_quad_l0_l9_0(double x, double y) { - return - l0(x) * l9(y); + return -l0(x) * l9(y); } static double simple_quad_l0_l9x_0(double x, double y) { - return - dl0(x) * l9(y); + return -dl0(x) * l9(y); } static double simple_quad_l0_l9y_0(double x, double y) { - return - l0(x) * dl9(y); + return -l0(x) * dl9(y); } static double simple_quad_l0_l9xx_0(double x, double y) { - return - d2l0(x) * l9(y); + return -d2l0(x) * l9(y); } static double simple_quad_l0_l9xy_0(double x, double y) { - return - dl0(x) * dl9(y); + return -dl0(x) * dl9(y); } static double simple_quad_l0_l9yy_0(double x, double y) { - return - l0(x) * d2l9(y); + return -l0(x) * d2l9(y); } static double simple_quad_l0_l9_1(double x, double y) { - return -(- l0(x) * l9(y)); + return -(-l0(x) * l9(y)); } static double simple_quad_l0_l9x_1(double x, double y) { - return -(- dl0(x) * l9(y)); + return -(-dl0(x) * l9(y)); } static double simple_quad_l0_l9y_1(double x, double y) { - return -(- l0(x) * dl9(y)); + return -(-l0(x) * dl9(y)); } static double simple_quad_l0_l9xx_1(double x, double y) { - return -(- d2l0(x) * l9(y)); + return -(-d2l0(x) * l9(y)); } static double simple_quad_l0_l9xy_1(double x, double y) { - return -(- dl0(x) * dl9(y)); + return -(-dl0(x) * dl9(y)); } static double simple_quad_l0_l9yy_1(double x, double y) { - return -(- l0(x) * d2l9(y)); + return -(-l0(x) * d2l9(y)); } static double simple_quad_l0_l10(double x, double y) @@ -594,32 +594,32 @@ namespace Hermes static double simple_quad_l1_l3_1(double x, double y) { - return -( l1(x) * l3(y)); + return -(l1(x) * l3(y)); } static double simple_quad_l1_l3x_1(double x, double y) { - return -( dl1(x) * l3(y)); + return -(dl1(x) * l3(y)); } static double simple_quad_l1_l3y_1(double x, double y) { - return -( l1(x) * dl3(y)); + return -(l1(x) * dl3(y)); } static double simple_quad_l1_l3xx_1(double x, double y) { - return -( d2l1(x) * l3(y)); + return -(d2l1(x) * l3(y)); } static double simple_quad_l1_l3xy_1(double x, double y) { - return -( dl1(x) * dl3(y)); + return -(dl1(x) * dl3(y)); } static double simple_quad_l1_l3yy_1(double x, double y) { - return -( l1(x) * d2l3(y)); + return -(l1(x) * d2l3(y)); } static double simple_quad_l1_l4(double x, double y) @@ -684,32 +684,32 @@ namespace Hermes static double simple_quad_l1_l5_1(double x, double y) { - return -( l1(x) * l5(y)); + return -(l1(x) * l5(y)); } static double simple_quad_l1_l5x_1(double x, double y) { - return -( dl1(x) * l5(y)); + return -(dl1(x) * l5(y)); } static double simple_quad_l1_l5y_1(double x, double y) { - return -( l1(x) * dl5(y)); + return -(l1(x) * dl5(y)); } static double simple_quad_l1_l5xx_1(double x, double y) { - return -( d2l1(x) * l5(y)); + return -(d2l1(x) * l5(y)); } static double simple_quad_l1_l5xy_1(double x, double y) { - return -( dl1(x) * dl5(y)); + return -(dl1(x) * dl5(y)); } static double simple_quad_l1_l5yy_1(double x, double y) { - return -( l1(x) * d2l5(y)); + return -(l1(x) * d2l5(y)); } static double simple_quad_l1_l6(double x, double y) @@ -774,32 +774,32 @@ namespace Hermes static double simple_quad_l1_l7_1(double x, double y) { - return -( l1(x) * l7(y)); + return -(l1(x) * l7(y)); } static double simple_quad_l1_l7x_1(double x, double y) { - return -( dl1(x) * l7(y)); + return -(dl1(x) * l7(y)); } static double simple_quad_l1_l7y_1(double x, double y) { - return -( l1(x) * dl7(y)); + return -(l1(x) * dl7(y)); } static double simple_quad_l1_l7xx_1(double x, double y) { - return -( d2l1(x) * l7(y)); + return -(d2l1(x) * l7(y)); } static double simple_quad_l1_l7xy_1(double x, double y) { - return -( dl1(x) * dl7(y)); + return -(dl1(x) * dl7(y)); } static double simple_quad_l1_l7yy_1(double x, double y) { - return -( l1(x) * d2l7(y)); + return -(l1(x) * d2l7(y)); } static double simple_quad_l1_l8(double x, double y) @@ -864,32 +864,32 @@ namespace Hermes static double simple_quad_l1_l9_1(double x, double y) { - return -( l1(x) * l9(y)); + return -(l1(x) * l9(y)); } static double simple_quad_l1_l9x_1(double x, double y) { - return -( dl1(x) * l9(y)); + return -(dl1(x) * l9(y)); } static double simple_quad_l1_l9y_1(double x, double y) { - return -( l1(x) * dl9(y)); + return -(l1(x) * dl9(y)); } static double simple_quad_l1_l9xx_1(double x, double y) { - return -( d2l1(x) * l9(y)); + return -(d2l1(x) * l9(y)); } static double simple_quad_l1_l9xy_1(double x, double y) { - return -( dl1(x) * dl9(y)); + return -(dl1(x) * dl9(y)); } static double simple_quad_l1_l9yy_1(double x, double y) { - return -( l1(x) * d2l9(y)); + return -(l1(x) * d2l9(y)); } static double simple_quad_l1_l10(double x, double y) @@ -1284,92 +1284,92 @@ namespace Hermes static double simple_quad_l3_l0_1(double x, double y) { - return -( l3(x) * l0(y)); + return -(l3(x) * l0(y)); } static double simple_quad_l3_l0x_1(double x, double y) { - return -( dl3(x) * l0(y)); + return -(dl3(x) * l0(y)); } static double simple_quad_l3_l0y_1(double x, double y) { - return -( l3(x) * dl0(y)); + return -(l3(x) * dl0(y)); } static double simple_quad_l3_l0xx_1(double x, double y) { - return -( d2l3(x) * l0(y)); + return -(d2l3(x) * l0(y)); } static double simple_quad_l3_l0xy_1(double x, double y) { - return -( dl3(x) * dl0(y)); + return -(dl3(x) * dl0(y)); } static double simple_quad_l3_l0yy_1(double x, double y) { - return -( l3(x) * d2l0(y)); + return -(l3(x) * d2l0(y)); } static double simple_quad_l3_l1_0(double x, double y) { - return - l3(x) * l1(y); + return -l3(x) * l1(y); } static double simple_quad_l3_l1x_0(double x, double y) { - return - dl3(x) * l1(y); + return -dl3(x) * l1(y); } static double simple_quad_l3_l1y_0(double x, double y) { - return - l3(x) * dl1(y); + return -l3(x) * dl1(y); } static double simple_quad_l3_l1xx_0(double x, double y) { - return - d2l3(x) * l1(y); + return -d2l3(x) * l1(y); } static double simple_quad_l3_l1xy_0(double x, double y) { - return - dl3(x) * dl1(y); + return -dl3(x) * dl1(y); } static double simple_quad_l3_l1yy_0(double x, double y) { - return - l3(x) * d2l1(y); + return -l3(x) * d2l1(y); } static double simple_quad_l3_l1_1(double x, double y) { - return -(- l3(x) * l1(y)); + return -(-l3(x) * l1(y)); } static double simple_quad_l3_l1x_1(double x, double y) { - return -(- dl3(x) * l1(y)); + return -(-dl3(x) * l1(y)); } static double simple_quad_l3_l1y_1(double x, double y) { - return -(- l3(x) * dl1(y)); + return -(-l3(x) * dl1(y)); } static double simple_quad_l3_l1xx_1(double x, double y) { - return -(- d2l3(x) * l1(y)); + return -(-d2l3(x) * l1(y)); } static double simple_quad_l3_l1xy_1(double x, double y) { - return -(- dl3(x) * dl1(y)); + return -(-dl3(x) * dl1(y)); } static double simple_quad_l3_l1yy_1(double x, double y) { - return -(- l3(x) * d2l1(y)); + return -(-l3(x) * d2l1(y)); } static double simple_quad_l3_l2(double x, double y) @@ -2004,92 +2004,92 @@ namespace Hermes static double simple_quad_l5_l0_1(double x, double y) { - return -( l5(x) * l0(y)); + return -(l5(x) * l0(y)); } static double simple_quad_l5_l0x_1(double x, double y) { - return -( dl5(x) * l0(y)); + return -(dl5(x) * l0(y)); } static double simple_quad_l5_l0y_1(double x, double y) { - return -( l5(x) * dl0(y)); + return -(l5(x) * dl0(y)); } static double simple_quad_l5_l0xx_1(double x, double y) { - return -( d2l5(x) * l0(y)); + return -(d2l5(x) * l0(y)); } static double simple_quad_l5_l0xy_1(double x, double y) { - return -( dl5(x) * dl0(y)); + return -(dl5(x) * dl0(y)); } static double simple_quad_l5_l0yy_1(double x, double y) { - return -( l5(x) * d2l0(y)); + return -(l5(x) * d2l0(y)); } static double simple_quad_l5_l1_0(double x, double y) { - return - l5(x) * l1(y); + return -l5(x) * l1(y); } static double simple_quad_l5_l1x_0(double x, double y) { - return - dl5(x) * l1(y); + return -dl5(x) * l1(y); } static double simple_quad_l5_l1y_0(double x, double y) { - return - l5(x) * dl1(y); + return -l5(x) * dl1(y); } static double simple_quad_l5_l1xx_0(double x, double y) { - return - d2l5(x) * l1(y); + return -d2l5(x) * l1(y); } static double simple_quad_l5_l1xy_0(double x, double y) { - return - dl5(x) * dl1(y); + return -dl5(x) * dl1(y); } static double simple_quad_l5_l1yy_0(double x, double y) { - return - l5(x) * d2l1(y); + return -l5(x) * d2l1(y); } static double simple_quad_l5_l1_1(double x, double y) { - return -(- l5(x) * l1(y)); + return -(-l5(x) * l1(y)); } static double simple_quad_l5_l1x_1(double x, double y) { - return -(- dl5(x) * l1(y)); + return -(-dl5(x) * l1(y)); } static double simple_quad_l5_l1y_1(double x, double y) { - return -(- l5(x) * dl1(y)); + return -(-l5(x) * dl1(y)); } static double simple_quad_l5_l1xx_1(double x, double y) { - return -(- d2l5(x) * l1(y)); + return -(-d2l5(x) * l1(y)); } static double simple_quad_l5_l1xy_1(double x, double y) { - return -(- dl5(x) * dl1(y)); + return -(-dl5(x) * dl1(y)); } static double simple_quad_l5_l1yy_1(double x, double y) { - return -(- l5(x) * d2l1(y)); + return -(-l5(x) * d2l1(y)); } static double simple_quad_l5_l2(double x, double y) @@ -2724,92 +2724,92 @@ namespace Hermes static double simple_quad_l7_l0_1(double x, double y) { - return -( l7(x) * l0(y)); + return -(l7(x) * l0(y)); } static double simple_quad_l7_l0x_1(double x, double y) { - return -( dl7(x) * l0(y)); + return -(dl7(x) * l0(y)); } static double simple_quad_l7_l0y_1(double x, double y) { - return -( l7(x) * dl0(y)); + return -(l7(x) * dl0(y)); } static double simple_quad_l7_l0xx_1(double x, double y) { - return -( d2l7(x) * l0(y)); + return -(d2l7(x) * l0(y)); } static double simple_quad_l7_l0xy_1(double x, double y) { - return -( dl7(x) * dl0(y)); + return -(dl7(x) * dl0(y)); } static double simple_quad_l7_l0yy_1(double x, double y) { - return -( l7(x) * d2l0(y)); + return -(l7(x) * d2l0(y)); } static double simple_quad_l7_l1_0(double x, double y) { - return - l7(x) * l1(y); + return -l7(x) * l1(y); } static double simple_quad_l7_l1x_0(double x, double y) { - return - dl7(x) * l1(y); + return -dl7(x) * l1(y); } static double simple_quad_l7_l1y_0(double x, double y) { - return - l7(x) * dl1(y); + return -l7(x) * dl1(y); } static double simple_quad_l7_l1xx_0(double x, double y) { - return - d2l7(x) * l1(y); + return -d2l7(x) * l1(y); } static double simple_quad_l7_l1xy_0(double x, double y) { - return - dl7(x) * dl1(y); + return -dl7(x) * dl1(y); } static double simple_quad_l7_l1yy_0(double x, double y) { - return - l7(x) * d2l1(y); + return -l7(x) * d2l1(y); } static double simple_quad_l7_l1_1(double x, double y) { - return -(- l7(x) * l1(y)); + return -(-l7(x) * l1(y)); } static double simple_quad_l7_l1x_1(double x, double y) { - return -(- dl7(x) * l1(y)); + return -(-dl7(x) * l1(y)); } static double simple_quad_l7_l1y_1(double x, double y) { - return -(- l7(x) * dl1(y)); + return -(-l7(x) * dl1(y)); } static double simple_quad_l7_l1xx_1(double x, double y) { - return -(- d2l7(x) * l1(y)); + return -(-d2l7(x) * l1(y)); } static double simple_quad_l7_l1xy_1(double x, double y) { - return -(- dl7(x) * dl1(y)); + return -(-dl7(x) * dl1(y)); } static double simple_quad_l7_l1yy_1(double x, double y) { - return -(- l7(x) * d2l1(y)); + return -(-l7(x) * d2l1(y)); } static double simple_quad_l7_l2(double x, double y) @@ -3444,92 +3444,92 @@ namespace Hermes static double simple_quad_l9_l0_1(double x, double y) { - return -( l9(x) * l0(y)); + return -(l9(x) * l0(y)); } static double simple_quad_l9_l0x_1(double x, double y) { - return -( dl9(x) * l0(y)); + return -(dl9(x) * l0(y)); } static double simple_quad_l9_l0y_1(double x, double y) { - return -( l9(x) * dl0(y)); + return -(l9(x) * dl0(y)); } static double simple_quad_l9_l0xx_1(double x, double y) { - return -( d2l9(x) * l0(y)); + return -(d2l9(x) * l0(y)); } static double simple_quad_l9_l0xy_1(double x, double y) { - return -( dl9(x) * dl0(y)); + return -(dl9(x) * dl0(y)); } static double simple_quad_l9_l0yy_1(double x, double y) { - return -( l9(x) * d2l0(y)); + return -(l9(x) * d2l0(y)); } static double simple_quad_l9_l1_0(double x, double y) { - return - l9(x) * l1(y); + return -l9(x) * l1(y); } static double simple_quad_l9_l1x_0(double x, double y) { - return - dl9(x) * l1(y); + return -dl9(x) * l1(y); } static double simple_quad_l9_l1y_0(double x, double y) { - return - l9(x) * dl1(y); + return -l9(x) * dl1(y); } static double simple_quad_l9_l1xx_0(double x, double y) { - return - d2l9(x) * l1(y); + return -d2l9(x) * l1(y); } static double simple_quad_l9_l1xy_0(double x, double y) { - return - dl9(x) * dl1(y); + return -dl9(x) * dl1(y); } static double simple_quad_l9_l1yy_0(double x, double y) { - return - l9(x) * d2l1(y); + return -l9(x) * d2l1(y); } static double simple_quad_l9_l1_1(double x, double y) { - return -(- l9(x) * l1(y)); + return -(-l9(x) * l1(y)); } static double simple_quad_l9_l1x_1(double x, double y) { - return -(- dl9(x) * l1(y)); + return -(-dl9(x) * l1(y)); } static double simple_quad_l9_l1y_1(double x, double y) { - return -(- l9(x) * dl1(y)); + return -(-l9(x) * dl1(y)); } static double simple_quad_l9_l1xx_1(double x, double y) { - return -(- d2l9(x) * l1(y)); + return -(-d2l9(x) * l1(y)); } static double simple_quad_l9_l1xy_1(double x, double y) { - return -(- dl9(x) * dl1(y)); + return -(-dl9(x) * dl1(y)); } static double simple_quad_l9_l1yy_1(double x, double y) { - return -(- l9(x) * d2l1(y)); + return -(-l9(x) * d2l1(y)); } static double simple_quad_l9_l2(double x, double y) @@ -4134,321 +4134,321 @@ namespace Hermes static Shapeset::shape_fn_t simple_quad_fn[] = { - simple_quad_l0_l0, simple_quad_l0_l1, simple_quad_l0_l2, simple_quad_l0_l3_0, simple_quad_l0_l3_1, - simple_quad_l0_l4, simple_quad_l0_l5_0, simple_quad_l0_l5_1, simple_quad_l0_l6, simple_quad_l0_l7_0, - simple_quad_l0_l7_1, simple_quad_l0_l8, simple_quad_l0_l9_0, simple_quad_l0_l9_1, simple_quad_l0_l10, - simple_quad_l1_l0, simple_quad_l1_l1, simple_quad_l1_l2, simple_quad_l1_l3_0, simple_quad_l1_l3_1, - simple_quad_l1_l4, simple_quad_l1_l5_0, simple_quad_l1_l5_1, simple_quad_l1_l6, simple_quad_l1_l7_0, - simple_quad_l1_l7_1, simple_quad_l1_l8, simple_quad_l1_l9_0, simple_quad_l1_l9_1, simple_quad_l1_l10, - simple_quad_l2_l0, simple_quad_l2_l1, simple_quad_l2_l2, simple_quad_l2_l3, simple_quad_l2_l4, - simple_quad_l2_l5, simple_quad_l2_l6, simple_quad_l2_l7, simple_quad_l2_l8, simple_quad_l2_l9, - simple_quad_l2_l10, simple_quad_l3_l0_0, simple_quad_l3_l0_1, simple_quad_l3_l1_0, simple_quad_l3_l1_1, - simple_quad_l3_l2, simple_quad_l3_l3, simple_quad_l3_l4, simple_quad_l3_l5, simple_quad_l3_l6, - simple_quad_l3_l7, simple_quad_l3_l8, simple_quad_l3_l9, simple_quad_l3_l10, simple_quad_l4_l0, - simple_quad_l4_l1, simple_quad_l4_l2, simple_quad_l4_l3, simple_quad_l4_l4, simple_quad_l4_l5, - simple_quad_l4_l6, simple_quad_l4_l7, simple_quad_l4_l8, simple_quad_l4_l9, simple_quad_l4_l10, + simple_quad_l0_l0, simple_quad_l0_l1, simple_quad_l0_l2, simple_quad_l0_l3_0, simple_quad_l0_l3_1, + simple_quad_l0_l4, simple_quad_l0_l5_0, simple_quad_l0_l5_1, simple_quad_l0_l6, simple_quad_l0_l7_0, + simple_quad_l0_l7_1, simple_quad_l0_l8, simple_quad_l0_l9_0, simple_quad_l0_l9_1, simple_quad_l0_l10, + simple_quad_l1_l0, simple_quad_l1_l1, simple_quad_l1_l2, simple_quad_l1_l3_0, simple_quad_l1_l3_1, + simple_quad_l1_l4, simple_quad_l1_l5_0, simple_quad_l1_l5_1, simple_quad_l1_l6, simple_quad_l1_l7_0, + simple_quad_l1_l7_1, simple_quad_l1_l8, simple_quad_l1_l9_0, simple_quad_l1_l9_1, simple_quad_l1_l10, + simple_quad_l2_l0, simple_quad_l2_l1, simple_quad_l2_l2, simple_quad_l2_l3, simple_quad_l2_l4, + simple_quad_l2_l5, simple_quad_l2_l6, simple_quad_l2_l7, simple_quad_l2_l8, simple_quad_l2_l9, + simple_quad_l2_l10, simple_quad_l3_l0_0, simple_quad_l3_l0_1, simple_quad_l3_l1_0, simple_quad_l3_l1_1, + simple_quad_l3_l2, simple_quad_l3_l3, simple_quad_l3_l4, simple_quad_l3_l5, simple_quad_l3_l6, + simple_quad_l3_l7, simple_quad_l3_l8, simple_quad_l3_l9, simple_quad_l3_l10, simple_quad_l4_l0, + simple_quad_l4_l1, simple_quad_l4_l2, simple_quad_l4_l3, simple_quad_l4_l4, simple_quad_l4_l5, + simple_quad_l4_l6, simple_quad_l4_l7, simple_quad_l4_l8, simple_quad_l4_l9, simple_quad_l4_l10, simple_quad_l5_l0_0, simple_quad_l5_l0_1, simple_quad_l5_l1_0, simple_quad_l5_l1_1, simple_quad_l5_l2, - simple_quad_l5_l3, simple_quad_l5_l4, simple_quad_l5_l5, simple_quad_l5_l6, simple_quad_l5_l7, - simple_quad_l5_l8, simple_quad_l5_l9, simple_quad_l5_l10, simple_quad_l6_l0, simple_quad_l6_l1, - simple_quad_l6_l2, simple_quad_l6_l3, simple_quad_l6_l4, simple_quad_l6_l5, simple_quad_l6_l6, - simple_quad_l6_l7, simple_quad_l6_l8, simple_quad_l6_l9, simple_quad_l6_l10, simple_quad_l7_l0_0, - simple_quad_l7_l0_1, simple_quad_l7_l1_0, simple_quad_l7_l1_1, simple_quad_l7_l2, simple_quad_l7_l3, - simple_quad_l7_l4, simple_quad_l7_l5, simple_quad_l7_l6, simple_quad_l7_l7, simple_quad_l7_l8, - simple_quad_l7_l9, simple_quad_l7_l10, simple_quad_l8_l0, simple_quad_l8_l1, simple_quad_l8_l2, - simple_quad_l8_l3, simple_quad_l8_l4, simple_quad_l8_l5, simple_quad_l8_l6, simple_quad_l8_l7, - simple_quad_l8_l8, simple_quad_l8_l9, simple_quad_l8_l10, simple_quad_l9_l0_0, simple_quad_l9_l0_1, - simple_quad_l9_l1_0, simple_quad_l9_l1_1, simple_quad_l9_l2, simple_quad_l9_l3, simple_quad_l9_l4, - simple_quad_l9_l5, simple_quad_l9_l6, simple_quad_l9_l7, simple_quad_l9_l8, simple_quad_l9_l9, - simple_quad_l9_l10, simple_quad_l10_l0, simple_quad_l10_l1, simple_quad_l10_l2, simple_quad_l10_l3, - simple_quad_l10_l4, simple_quad_l10_l5, simple_quad_l10_l6, simple_quad_l10_l7, simple_quad_l10_l8, - simple_quad_l10_l9, simple_quad_l10_l10, + simple_quad_l5_l3, simple_quad_l5_l4, simple_quad_l5_l5, simple_quad_l5_l6, simple_quad_l5_l7, + simple_quad_l5_l8, simple_quad_l5_l9, simple_quad_l5_l10, simple_quad_l6_l0, simple_quad_l6_l1, + simple_quad_l6_l2, simple_quad_l6_l3, simple_quad_l6_l4, simple_quad_l6_l5, simple_quad_l6_l6, + simple_quad_l6_l7, simple_quad_l6_l8, simple_quad_l6_l9, simple_quad_l6_l10, simple_quad_l7_l0_0, + simple_quad_l7_l0_1, simple_quad_l7_l1_0, simple_quad_l7_l1_1, simple_quad_l7_l2, simple_quad_l7_l3, + simple_quad_l7_l4, simple_quad_l7_l5, simple_quad_l7_l6, simple_quad_l7_l7, simple_quad_l7_l8, + simple_quad_l7_l9, simple_quad_l7_l10, simple_quad_l8_l0, simple_quad_l8_l1, simple_quad_l8_l2, + simple_quad_l8_l3, simple_quad_l8_l4, simple_quad_l8_l5, simple_quad_l8_l6, simple_quad_l8_l7, + simple_quad_l8_l8, simple_quad_l8_l9, simple_quad_l8_l10, simple_quad_l9_l0_0, simple_quad_l9_l0_1, + simple_quad_l9_l1_0, simple_quad_l9_l1_1, simple_quad_l9_l2, simple_quad_l9_l3, simple_quad_l9_l4, + simple_quad_l9_l5, simple_quad_l9_l6, simple_quad_l9_l7, simple_quad_l9_l8, simple_quad_l9_l9, + simple_quad_l9_l10, simple_quad_l10_l0, simple_quad_l10_l1, simple_quad_l10_l2, simple_quad_l10_l3, + simple_quad_l10_l4, simple_quad_l10_l5, simple_quad_l10_l6, simple_quad_l10_l7, simple_quad_l10_l8, + simple_quad_l10_l9, simple_quad_l10_l10, }; static Shapeset::shape_fn_t simple_quad_fn_dx[] = { - simple_quad_l0_l0x, simple_quad_l0_l1x, simple_quad_l0_l2x, simple_quad_l0_l3x_0, simple_quad_l0_l3x_1, - simple_quad_l0_l4x, simple_quad_l0_l5x_0, simple_quad_l0_l5x_1, simple_quad_l0_l6x, simple_quad_l0_l7x_0, - simple_quad_l0_l7x_1, simple_quad_l0_l8x, simple_quad_l0_l9x_0, simple_quad_l0_l9x_1, simple_quad_l0_l10x, - simple_quad_l1_l0x, simple_quad_l1_l1x, simple_quad_l1_l2x, simple_quad_l1_l3x_0, simple_quad_l1_l3x_1, - simple_quad_l1_l4x, simple_quad_l1_l5x_0, simple_quad_l1_l5x_1, simple_quad_l1_l6x, simple_quad_l1_l7x_0, - simple_quad_l1_l7x_1, simple_quad_l1_l8x, simple_quad_l1_l9x_0, simple_quad_l1_l9x_1, simple_quad_l1_l10x, - simple_quad_l2_l0x, simple_quad_l2_l1x, simple_quad_l2_l2x, simple_quad_l2_l3x, simple_quad_l2_l4x, - simple_quad_l2_l5x, simple_quad_l2_l6x, simple_quad_l2_l7x, simple_quad_l2_l8x, simple_quad_l2_l9x, - simple_quad_l2_l10x, simple_quad_l3_l0x_0, simple_quad_l3_l0x_1, simple_quad_l3_l1x_0, simple_quad_l3_l1x_1, - simple_quad_l3_l2x, simple_quad_l3_l3x, simple_quad_l3_l4x, simple_quad_l3_l5x, simple_quad_l3_l6x, - simple_quad_l3_l7x, simple_quad_l3_l8x, simple_quad_l3_l9x, simple_quad_l3_l10x, simple_quad_l4_l0x, - simple_quad_l4_l1x, simple_quad_l4_l2x, simple_quad_l4_l3x, simple_quad_l4_l4x, simple_quad_l4_l5x, - simple_quad_l4_l6x, simple_quad_l4_l7x, simple_quad_l4_l8x, simple_quad_l4_l9x, simple_quad_l4_l10x, + simple_quad_l0_l0x, simple_quad_l0_l1x, simple_quad_l0_l2x, simple_quad_l0_l3x_0, simple_quad_l0_l3x_1, + simple_quad_l0_l4x, simple_quad_l0_l5x_0, simple_quad_l0_l5x_1, simple_quad_l0_l6x, simple_quad_l0_l7x_0, + simple_quad_l0_l7x_1, simple_quad_l0_l8x, simple_quad_l0_l9x_0, simple_quad_l0_l9x_1, simple_quad_l0_l10x, + simple_quad_l1_l0x, simple_quad_l1_l1x, simple_quad_l1_l2x, simple_quad_l1_l3x_0, simple_quad_l1_l3x_1, + simple_quad_l1_l4x, simple_quad_l1_l5x_0, simple_quad_l1_l5x_1, simple_quad_l1_l6x, simple_quad_l1_l7x_0, + simple_quad_l1_l7x_1, simple_quad_l1_l8x, simple_quad_l1_l9x_0, simple_quad_l1_l9x_1, simple_quad_l1_l10x, + simple_quad_l2_l0x, simple_quad_l2_l1x, simple_quad_l2_l2x, simple_quad_l2_l3x, simple_quad_l2_l4x, + simple_quad_l2_l5x, simple_quad_l2_l6x, simple_quad_l2_l7x, simple_quad_l2_l8x, simple_quad_l2_l9x, + simple_quad_l2_l10x, simple_quad_l3_l0x_0, simple_quad_l3_l0x_1, simple_quad_l3_l1x_0, simple_quad_l3_l1x_1, + simple_quad_l3_l2x, simple_quad_l3_l3x, simple_quad_l3_l4x, simple_quad_l3_l5x, simple_quad_l3_l6x, + simple_quad_l3_l7x, simple_quad_l3_l8x, simple_quad_l3_l9x, simple_quad_l3_l10x, simple_quad_l4_l0x, + simple_quad_l4_l1x, simple_quad_l4_l2x, simple_quad_l4_l3x, simple_quad_l4_l4x, simple_quad_l4_l5x, + simple_quad_l4_l6x, simple_quad_l4_l7x, simple_quad_l4_l8x, simple_quad_l4_l9x, simple_quad_l4_l10x, simple_quad_l5_l0x_0, simple_quad_l5_l0x_1, simple_quad_l5_l1x_0, simple_quad_l5_l1x_1, simple_quad_l5_l2x, - simple_quad_l5_l3x, simple_quad_l5_l4x, simple_quad_l5_l5x, simple_quad_l5_l6x, simple_quad_l5_l7x, - simple_quad_l5_l8x, simple_quad_l5_l9x, simple_quad_l5_l10x, simple_quad_l6_l0x, simple_quad_l6_l1x, - simple_quad_l6_l2x, simple_quad_l6_l3x, simple_quad_l6_l4x, simple_quad_l6_l5x, simple_quad_l6_l6x, - simple_quad_l6_l7x, simple_quad_l6_l8x, simple_quad_l6_l9x, simple_quad_l6_l10x, simple_quad_l7_l0x_0, - simple_quad_l7_l0x_1, simple_quad_l7_l1x_0, simple_quad_l7_l1x_1, simple_quad_l7_l2x, simple_quad_l7_l3x, - simple_quad_l7_l4x, simple_quad_l7_l5x, simple_quad_l7_l6x, simple_quad_l7_l7x, simple_quad_l7_l8x, - simple_quad_l7_l9x, simple_quad_l7_l10x, simple_quad_l8_l0x, simple_quad_l8_l1x, simple_quad_l8_l2x, - simple_quad_l8_l3x, simple_quad_l8_l4x, simple_quad_l8_l5x, simple_quad_l8_l6x, simple_quad_l8_l7x, - simple_quad_l8_l8x, simple_quad_l8_l9x, simple_quad_l8_l10x, simple_quad_l9_l0x_0, simple_quad_l9_l0x_1, - simple_quad_l9_l1x_0, simple_quad_l9_l1x_1, simple_quad_l9_l2x, simple_quad_l9_l3x, simple_quad_l9_l4x, - simple_quad_l9_l5x, simple_quad_l9_l6x, simple_quad_l9_l7x, simple_quad_l9_l8x, simple_quad_l9_l9x, - simple_quad_l9_l10x, simple_quad_l10_l0x, simple_quad_l10_l1x, simple_quad_l10_l2x, simple_quad_l10_l3x, - simple_quad_l10_l4x, simple_quad_l10_l5x, simple_quad_l10_l6x, simple_quad_l10_l7x, simple_quad_l10_l8x, - simple_quad_l10_l9x, simple_quad_l10_l10x, + simple_quad_l5_l3x, simple_quad_l5_l4x, simple_quad_l5_l5x, simple_quad_l5_l6x, simple_quad_l5_l7x, + simple_quad_l5_l8x, simple_quad_l5_l9x, simple_quad_l5_l10x, simple_quad_l6_l0x, simple_quad_l6_l1x, + simple_quad_l6_l2x, simple_quad_l6_l3x, simple_quad_l6_l4x, simple_quad_l6_l5x, simple_quad_l6_l6x, + simple_quad_l6_l7x, simple_quad_l6_l8x, simple_quad_l6_l9x, simple_quad_l6_l10x, simple_quad_l7_l0x_0, + simple_quad_l7_l0x_1, simple_quad_l7_l1x_0, simple_quad_l7_l1x_1, simple_quad_l7_l2x, simple_quad_l7_l3x, + simple_quad_l7_l4x, simple_quad_l7_l5x, simple_quad_l7_l6x, simple_quad_l7_l7x, simple_quad_l7_l8x, + simple_quad_l7_l9x, simple_quad_l7_l10x, simple_quad_l8_l0x, simple_quad_l8_l1x, simple_quad_l8_l2x, + simple_quad_l8_l3x, simple_quad_l8_l4x, simple_quad_l8_l5x, simple_quad_l8_l6x, simple_quad_l8_l7x, + simple_quad_l8_l8x, simple_quad_l8_l9x, simple_quad_l8_l10x, simple_quad_l9_l0x_0, simple_quad_l9_l0x_1, + simple_quad_l9_l1x_0, simple_quad_l9_l1x_1, simple_quad_l9_l2x, simple_quad_l9_l3x, simple_quad_l9_l4x, + simple_quad_l9_l5x, simple_quad_l9_l6x, simple_quad_l9_l7x, simple_quad_l9_l8x, simple_quad_l9_l9x, + simple_quad_l9_l10x, simple_quad_l10_l0x, simple_quad_l10_l1x, simple_quad_l10_l2x, simple_quad_l10_l3x, + simple_quad_l10_l4x, simple_quad_l10_l5x, simple_quad_l10_l6x, simple_quad_l10_l7x, simple_quad_l10_l8x, + simple_quad_l10_l9x, simple_quad_l10_l10x, }; static Shapeset::shape_fn_t simple_quad_fn_dy[] = { - simple_quad_l0_l0y, simple_quad_l0_l1y, simple_quad_l0_l2y, simple_quad_l0_l3y_0, simple_quad_l0_l3y_1, - simple_quad_l0_l4y, simple_quad_l0_l5y_0, simple_quad_l0_l5y_1, simple_quad_l0_l6y, simple_quad_l0_l7y_0, - simple_quad_l0_l7y_1, simple_quad_l0_l8y, simple_quad_l0_l9y_0, simple_quad_l0_l9y_1, simple_quad_l0_l10y, - simple_quad_l1_l0y, simple_quad_l1_l1y, simple_quad_l1_l2y, simple_quad_l1_l3y_0, simple_quad_l1_l3y_1, - simple_quad_l1_l4y, simple_quad_l1_l5y_0, simple_quad_l1_l5y_1, simple_quad_l1_l6y, simple_quad_l1_l7y_0, - simple_quad_l1_l7y_1, simple_quad_l1_l8y, simple_quad_l1_l9y_0, simple_quad_l1_l9y_1, simple_quad_l1_l10y, - simple_quad_l2_l0y, simple_quad_l2_l1y, simple_quad_l2_l2y, simple_quad_l2_l3y, simple_quad_l2_l4y, - simple_quad_l2_l5y, simple_quad_l2_l6y, simple_quad_l2_l7y, simple_quad_l2_l8y, simple_quad_l2_l9y, - simple_quad_l2_l10y, simple_quad_l3_l0y_0, simple_quad_l3_l0y_1, simple_quad_l3_l1y_0, simple_quad_l3_l1y_1, - simple_quad_l3_l2y, simple_quad_l3_l3y, simple_quad_l3_l4y, simple_quad_l3_l5y, simple_quad_l3_l6y, - simple_quad_l3_l7y, simple_quad_l3_l8y, simple_quad_l3_l9y, simple_quad_l3_l10y, simple_quad_l4_l0y, - simple_quad_l4_l1y, simple_quad_l4_l2y, simple_quad_l4_l3y, simple_quad_l4_l4y, simple_quad_l4_l5y, - simple_quad_l4_l6y, simple_quad_l4_l7y, simple_quad_l4_l8y, simple_quad_l4_l9y, simple_quad_l4_l10y, + simple_quad_l0_l0y, simple_quad_l0_l1y, simple_quad_l0_l2y, simple_quad_l0_l3y_0, simple_quad_l0_l3y_1, + simple_quad_l0_l4y, simple_quad_l0_l5y_0, simple_quad_l0_l5y_1, simple_quad_l0_l6y, simple_quad_l0_l7y_0, + simple_quad_l0_l7y_1, simple_quad_l0_l8y, simple_quad_l0_l9y_0, simple_quad_l0_l9y_1, simple_quad_l0_l10y, + simple_quad_l1_l0y, simple_quad_l1_l1y, simple_quad_l1_l2y, simple_quad_l1_l3y_0, simple_quad_l1_l3y_1, + simple_quad_l1_l4y, simple_quad_l1_l5y_0, simple_quad_l1_l5y_1, simple_quad_l1_l6y, simple_quad_l1_l7y_0, + simple_quad_l1_l7y_1, simple_quad_l1_l8y, simple_quad_l1_l9y_0, simple_quad_l1_l9y_1, simple_quad_l1_l10y, + simple_quad_l2_l0y, simple_quad_l2_l1y, simple_quad_l2_l2y, simple_quad_l2_l3y, simple_quad_l2_l4y, + simple_quad_l2_l5y, simple_quad_l2_l6y, simple_quad_l2_l7y, simple_quad_l2_l8y, simple_quad_l2_l9y, + simple_quad_l2_l10y, simple_quad_l3_l0y_0, simple_quad_l3_l0y_1, simple_quad_l3_l1y_0, simple_quad_l3_l1y_1, + simple_quad_l3_l2y, simple_quad_l3_l3y, simple_quad_l3_l4y, simple_quad_l3_l5y, simple_quad_l3_l6y, + simple_quad_l3_l7y, simple_quad_l3_l8y, simple_quad_l3_l9y, simple_quad_l3_l10y, simple_quad_l4_l0y, + simple_quad_l4_l1y, simple_quad_l4_l2y, simple_quad_l4_l3y, simple_quad_l4_l4y, simple_quad_l4_l5y, + simple_quad_l4_l6y, simple_quad_l4_l7y, simple_quad_l4_l8y, simple_quad_l4_l9y, simple_quad_l4_l10y, simple_quad_l5_l0y_0, simple_quad_l5_l0y_1, simple_quad_l5_l1y_0, simple_quad_l5_l1y_1, simple_quad_l5_l2y, - simple_quad_l5_l3y, simple_quad_l5_l4y, simple_quad_l5_l5y, simple_quad_l5_l6y, simple_quad_l5_l7y, - simple_quad_l5_l8y, simple_quad_l5_l9y, simple_quad_l5_l10y, simple_quad_l6_l0y, simple_quad_l6_l1y, - simple_quad_l6_l2y, simple_quad_l6_l3y, simple_quad_l6_l4y, simple_quad_l6_l5y, simple_quad_l6_l6y, - simple_quad_l6_l7y, simple_quad_l6_l8y, simple_quad_l6_l9y, simple_quad_l6_l10y, simple_quad_l7_l0y_0, - simple_quad_l7_l0y_1, simple_quad_l7_l1y_0, simple_quad_l7_l1y_1, simple_quad_l7_l2y, simple_quad_l7_l3y, - simple_quad_l7_l4y, simple_quad_l7_l5y, simple_quad_l7_l6y, simple_quad_l7_l7y, simple_quad_l7_l8y, - simple_quad_l7_l9y, simple_quad_l7_l10y, simple_quad_l8_l0y, simple_quad_l8_l1y, simple_quad_l8_l2y, - simple_quad_l8_l3y, simple_quad_l8_l4y, simple_quad_l8_l5y, simple_quad_l8_l6y, simple_quad_l8_l7y, - simple_quad_l8_l8y, simple_quad_l8_l9y, simple_quad_l8_l10y, simple_quad_l9_l0y_0, simple_quad_l9_l0y_1, - simple_quad_l9_l1y_0, simple_quad_l9_l1y_1, simple_quad_l9_l2y, simple_quad_l9_l3y, simple_quad_l9_l4y, - simple_quad_l9_l5y, simple_quad_l9_l6y, simple_quad_l9_l7y, simple_quad_l9_l8y, simple_quad_l9_l9y, - simple_quad_l9_l10y, simple_quad_l10_l0y, simple_quad_l10_l1y, simple_quad_l10_l2y, simple_quad_l10_l3y, - simple_quad_l10_l4y, simple_quad_l10_l5y, simple_quad_l10_l6y, simple_quad_l10_l7y, simple_quad_l10_l8y, - simple_quad_l10_l9y, simple_quad_l10_l10y, + simple_quad_l5_l3y, simple_quad_l5_l4y, simple_quad_l5_l5y, simple_quad_l5_l6y, simple_quad_l5_l7y, + simple_quad_l5_l8y, simple_quad_l5_l9y, simple_quad_l5_l10y, simple_quad_l6_l0y, simple_quad_l6_l1y, + simple_quad_l6_l2y, simple_quad_l6_l3y, simple_quad_l6_l4y, simple_quad_l6_l5y, simple_quad_l6_l6y, + simple_quad_l6_l7y, simple_quad_l6_l8y, simple_quad_l6_l9y, simple_quad_l6_l10y, simple_quad_l7_l0y_0, + simple_quad_l7_l0y_1, simple_quad_l7_l1y_0, simple_quad_l7_l1y_1, simple_quad_l7_l2y, simple_quad_l7_l3y, + simple_quad_l7_l4y, simple_quad_l7_l5y, simple_quad_l7_l6y, simple_quad_l7_l7y, simple_quad_l7_l8y, + simple_quad_l7_l9y, simple_quad_l7_l10y, simple_quad_l8_l0y, simple_quad_l8_l1y, simple_quad_l8_l2y, + simple_quad_l8_l3y, simple_quad_l8_l4y, simple_quad_l8_l5y, simple_quad_l8_l6y, simple_quad_l8_l7y, + simple_quad_l8_l8y, simple_quad_l8_l9y, simple_quad_l8_l10y, simple_quad_l9_l0y_0, simple_quad_l9_l0y_1, + simple_quad_l9_l1y_0, simple_quad_l9_l1y_1, simple_quad_l9_l2y, simple_quad_l9_l3y, simple_quad_l9_l4y, + simple_quad_l9_l5y, simple_quad_l9_l6y, simple_quad_l9_l7y, simple_quad_l9_l8y, simple_quad_l9_l9y, + simple_quad_l9_l10y, simple_quad_l10_l0y, simple_quad_l10_l1y, simple_quad_l10_l2y, simple_quad_l10_l3y, + simple_quad_l10_l4y, simple_quad_l10_l5y, simple_quad_l10_l6y, simple_quad_l10_l7y, simple_quad_l10_l8y, + simple_quad_l10_l9y, simple_quad_l10_l10y, }; static Shapeset::shape_fn_t simple_quad_fn_dxx[] = { - simple_quad_l0_l0xx, simple_quad_l0_l1xx, simple_quad_l0_l2xx, simple_quad_l0_l3xx_0, simple_quad_l0_l3xx_1, - simple_quad_l0_l4xx, simple_quad_l0_l5xx_0, simple_quad_l0_l5xx_1, simple_quad_l0_l6xx, simple_quad_l0_l7xx_0, - simple_quad_l0_l7xx_1, simple_quad_l0_l8xx, simple_quad_l0_l9xx_0, simple_quad_l0_l9xx_1, simple_quad_l0_l10xx, - simple_quad_l1_l0xx, simple_quad_l1_l1xx, simple_quad_l1_l2xx, simple_quad_l1_l3xx_0, simple_quad_l1_l3xx_1, - simple_quad_l1_l4xx, simple_quad_l1_l5xx_0, simple_quad_l1_l5xx_1, simple_quad_l1_l6xx, simple_quad_l1_l7xx_0, - simple_quad_l1_l7xx_1, simple_quad_l1_l8xx, simple_quad_l1_l9xx_0, simple_quad_l1_l9xx_1, simple_quad_l1_l10xx, - simple_quad_l2_l0xx, simple_quad_l2_l1xx, simple_quad_l2_l2xx, simple_quad_l2_l3xx, simple_quad_l2_l4xx, - simple_quad_l2_l5xx, simple_quad_l2_l6xx, simple_quad_l2_l7xx, simple_quad_l2_l8xx, simple_quad_l2_l9xx, - simple_quad_l2_l10xx, simple_quad_l3_l0xx_0, simple_quad_l3_l0xx_1, simple_quad_l3_l1xx_0, simple_quad_l3_l1xx_1, - simple_quad_l3_l2xx, simple_quad_l3_l3xx, simple_quad_l3_l4xx, simple_quad_l3_l5xx, simple_quad_l3_l6xx, - simple_quad_l3_l7xx, simple_quad_l3_l8xx, simple_quad_l3_l9xx, simple_quad_l3_l10xx, simple_quad_l4_l0xx, - simple_quad_l4_l1xx, simple_quad_l4_l2xx, simple_quad_l4_l3xx, simple_quad_l4_l4xx, simple_quad_l4_l5xx, - simple_quad_l4_l6xx, simple_quad_l4_l7xx, simple_quad_l4_l8xx, simple_quad_l4_l9xx, simple_quad_l4_l10xx, + simple_quad_l0_l0xx, simple_quad_l0_l1xx, simple_quad_l0_l2xx, simple_quad_l0_l3xx_0, simple_quad_l0_l3xx_1, + simple_quad_l0_l4xx, simple_quad_l0_l5xx_0, simple_quad_l0_l5xx_1, simple_quad_l0_l6xx, simple_quad_l0_l7xx_0, + simple_quad_l0_l7xx_1, simple_quad_l0_l8xx, simple_quad_l0_l9xx_0, simple_quad_l0_l9xx_1, simple_quad_l0_l10xx, + simple_quad_l1_l0xx, simple_quad_l1_l1xx, simple_quad_l1_l2xx, simple_quad_l1_l3xx_0, simple_quad_l1_l3xx_1, + simple_quad_l1_l4xx, simple_quad_l1_l5xx_0, simple_quad_l1_l5xx_1, simple_quad_l1_l6xx, simple_quad_l1_l7xx_0, + simple_quad_l1_l7xx_1, simple_quad_l1_l8xx, simple_quad_l1_l9xx_0, simple_quad_l1_l9xx_1, simple_quad_l1_l10xx, + simple_quad_l2_l0xx, simple_quad_l2_l1xx, simple_quad_l2_l2xx, simple_quad_l2_l3xx, simple_quad_l2_l4xx, + simple_quad_l2_l5xx, simple_quad_l2_l6xx, simple_quad_l2_l7xx, simple_quad_l2_l8xx, simple_quad_l2_l9xx, + simple_quad_l2_l10xx, simple_quad_l3_l0xx_0, simple_quad_l3_l0xx_1, simple_quad_l3_l1xx_0, simple_quad_l3_l1xx_1, + simple_quad_l3_l2xx, simple_quad_l3_l3xx, simple_quad_l3_l4xx, simple_quad_l3_l5xx, simple_quad_l3_l6xx, + simple_quad_l3_l7xx, simple_quad_l3_l8xx, simple_quad_l3_l9xx, simple_quad_l3_l10xx, simple_quad_l4_l0xx, + simple_quad_l4_l1xx, simple_quad_l4_l2xx, simple_quad_l4_l3xx, simple_quad_l4_l4xx, simple_quad_l4_l5xx, + simple_quad_l4_l6xx, simple_quad_l4_l7xx, simple_quad_l4_l8xx, simple_quad_l4_l9xx, simple_quad_l4_l10xx, simple_quad_l5_l0xx_0, simple_quad_l5_l0xx_1, simple_quad_l5_l1xx_0, simple_quad_l5_l1xx_1, simple_quad_l5_l2xx, - simple_quad_l5_l3xx, simple_quad_l5_l4xx, simple_quad_l5_l5xx, simple_quad_l5_l6xx, simple_quad_l5_l7xx, - simple_quad_l5_l8xx, simple_quad_l5_l9xx, simple_quad_l5_l10xx, simple_quad_l6_l0xx, simple_quad_l6_l1xx, - simple_quad_l6_l2xx, simple_quad_l6_l3xx, simple_quad_l6_l4xx, simple_quad_l6_l5xx, simple_quad_l6_l6xx, - simple_quad_l6_l7xx, simple_quad_l6_l8xx, simple_quad_l6_l9xx, simple_quad_l6_l10xx, simple_quad_l7_l0xx_0, - simple_quad_l7_l0xx_1, simple_quad_l7_l1xx_0, simple_quad_l7_l1xx_1, simple_quad_l7_l2xx, simple_quad_l7_l3xx, - simple_quad_l7_l4xx, simple_quad_l7_l5xx, simple_quad_l7_l6xx, simple_quad_l7_l7xx, simple_quad_l7_l8xx, - simple_quad_l7_l9xx, simple_quad_l7_l10xx, simple_quad_l8_l0xx, simple_quad_l8_l1xx, simple_quad_l8_l2xx, - simple_quad_l8_l3xx, simple_quad_l8_l4xx, simple_quad_l8_l5xx, simple_quad_l8_l6xx, simple_quad_l8_l7xx, - simple_quad_l8_l8xx, simple_quad_l8_l9xx, simple_quad_l8_l10xx, simple_quad_l9_l0xx_0, simple_quad_l9_l0xx_1, - simple_quad_l9_l1xx_0, simple_quad_l9_l1xx_1, simple_quad_l9_l2xx, simple_quad_l9_l3xx, simple_quad_l9_l4xx, - simple_quad_l9_l5xx, simple_quad_l9_l6xx, simple_quad_l9_l7xx, simple_quad_l9_l8xx, simple_quad_l9_l9xx, - simple_quad_l9_l10xx, simple_quad_l10_l0xx, simple_quad_l10_l1xx, simple_quad_l10_l2xx, simple_quad_l10_l3xx, - simple_quad_l10_l4xx, simple_quad_l10_l5xx, simple_quad_l10_l6xx, simple_quad_l10_l7xx, simple_quad_l10_l8xx, - simple_quad_l10_l9xx, simple_quad_l10_l10xx, + simple_quad_l5_l3xx, simple_quad_l5_l4xx, simple_quad_l5_l5xx, simple_quad_l5_l6xx, simple_quad_l5_l7xx, + simple_quad_l5_l8xx, simple_quad_l5_l9xx, simple_quad_l5_l10xx, simple_quad_l6_l0xx, simple_quad_l6_l1xx, + simple_quad_l6_l2xx, simple_quad_l6_l3xx, simple_quad_l6_l4xx, simple_quad_l6_l5xx, simple_quad_l6_l6xx, + simple_quad_l6_l7xx, simple_quad_l6_l8xx, simple_quad_l6_l9xx, simple_quad_l6_l10xx, simple_quad_l7_l0xx_0, + simple_quad_l7_l0xx_1, simple_quad_l7_l1xx_0, simple_quad_l7_l1xx_1, simple_quad_l7_l2xx, simple_quad_l7_l3xx, + simple_quad_l7_l4xx, simple_quad_l7_l5xx, simple_quad_l7_l6xx, simple_quad_l7_l7xx, simple_quad_l7_l8xx, + simple_quad_l7_l9xx, simple_quad_l7_l10xx, simple_quad_l8_l0xx, simple_quad_l8_l1xx, simple_quad_l8_l2xx, + simple_quad_l8_l3xx, simple_quad_l8_l4xx, simple_quad_l8_l5xx, simple_quad_l8_l6xx, simple_quad_l8_l7xx, + simple_quad_l8_l8xx, simple_quad_l8_l9xx, simple_quad_l8_l10xx, simple_quad_l9_l0xx_0, simple_quad_l9_l0xx_1, + simple_quad_l9_l1xx_0, simple_quad_l9_l1xx_1, simple_quad_l9_l2xx, simple_quad_l9_l3xx, simple_quad_l9_l4xx, + simple_quad_l9_l5xx, simple_quad_l9_l6xx, simple_quad_l9_l7xx, simple_quad_l9_l8xx, simple_quad_l9_l9xx, + simple_quad_l9_l10xx, simple_quad_l10_l0xx, simple_quad_l10_l1xx, simple_quad_l10_l2xx, simple_quad_l10_l3xx, + simple_quad_l10_l4xx, simple_quad_l10_l5xx, simple_quad_l10_l6xx, simple_quad_l10_l7xx, simple_quad_l10_l8xx, + simple_quad_l10_l9xx, simple_quad_l10_l10xx, }; static Shapeset::shape_fn_t simple_quad_fn_dxy[] = { - simple_quad_l0_l0xy, simple_quad_l0_l1xy, simple_quad_l0_l2xy, simple_quad_l0_l3xy_0, simple_quad_l0_l3xy_1, - simple_quad_l0_l4xy, simple_quad_l0_l5xy_0, simple_quad_l0_l5xy_1, simple_quad_l0_l6xy, simple_quad_l0_l7xy_0, - simple_quad_l0_l7xy_1, simple_quad_l0_l8xy, simple_quad_l0_l9xy_0, simple_quad_l0_l9xy_1, simple_quad_l0_l10xy, - simple_quad_l1_l0xy, simple_quad_l1_l1xy, simple_quad_l1_l2xy, simple_quad_l1_l3xy_0, simple_quad_l1_l3xy_1, - simple_quad_l1_l4xy, simple_quad_l1_l5xy_0, simple_quad_l1_l5xy_1, simple_quad_l1_l6xy, simple_quad_l1_l7xy_0, - simple_quad_l1_l7xy_1, simple_quad_l1_l8xy, simple_quad_l1_l9xy_0, simple_quad_l1_l9xy_1, simple_quad_l1_l10xy, - simple_quad_l2_l0xy, simple_quad_l2_l1xy, simple_quad_l2_l2xy, simple_quad_l2_l3xy, simple_quad_l2_l4xy, - simple_quad_l2_l5xy, simple_quad_l2_l6xy, simple_quad_l2_l7xy, simple_quad_l2_l8xy, simple_quad_l2_l9xy, - simple_quad_l2_l10xy, simple_quad_l3_l0xy_0, simple_quad_l3_l0xy_1, simple_quad_l3_l1xy_0, simple_quad_l3_l1xy_1, - simple_quad_l3_l2xy, simple_quad_l3_l3xy, simple_quad_l3_l4xy, simple_quad_l3_l5xy, simple_quad_l3_l6xy, - simple_quad_l3_l7xy, simple_quad_l3_l8xy, simple_quad_l3_l9xy, simple_quad_l3_l10xy, simple_quad_l4_l0xy, - simple_quad_l4_l1xy, simple_quad_l4_l2xy, simple_quad_l4_l3xy, simple_quad_l4_l4xy, simple_quad_l4_l5xy, - simple_quad_l4_l6xy, simple_quad_l4_l7xy, simple_quad_l4_l8xy, simple_quad_l4_l9xy, simple_quad_l4_l10xy, + simple_quad_l0_l0xy, simple_quad_l0_l1xy, simple_quad_l0_l2xy, simple_quad_l0_l3xy_0, simple_quad_l0_l3xy_1, + simple_quad_l0_l4xy, simple_quad_l0_l5xy_0, simple_quad_l0_l5xy_1, simple_quad_l0_l6xy, simple_quad_l0_l7xy_0, + simple_quad_l0_l7xy_1, simple_quad_l0_l8xy, simple_quad_l0_l9xy_0, simple_quad_l0_l9xy_1, simple_quad_l0_l10xy, + simple_quad_l1_l0xy, simple_quad_l1_l1xy, simple_quad_l1_l2xy, simple_quad_l1_l3xy_0, simple_quad_l1_l3xy_1, + simple_quad_l1_l4xy, simple_quad_l1_l5xy_0, simple_quad_l1_l5xy_1, simple_quad_l1_l6xy, simple_quad_l1_l7xy_0, + simple_quad_l1_l7xy_1, simple_quad_l1_l8xy, simple_quad_l1_l9xy_0, simple_quad_l1_l9xy_1, simple_quad_l1_l10xy, + simple_quad_l2_l0xy, simple_quad_l2_l1xy, simple_quad_l2_l2xy, simple_quad_l2_l3xy, simple_quad_l2_l4xy, + simple_quad_l2_l5xy, simple_quad_l2_l6xy, simple_quad_l2_l7xy, simple_quad_l2_l8xy, simple_quad_l2_l9xy, + simple_quad_l2_l10xy, simple_quad_l3_l0xy_0, simple_quad_l3_l0xy_1, simple_quad_l3_l1xy_0, simple_quad_l3_l1xy_1, + simple_quad_l3_l2xy, simple_quad_l3_l3xy, simple_quad_l3_l4xy, simple_quad_l3_l5xy, simple_quad_l3_l6xy, + simple_quad_l3_l7xy, simple_quad_l3_l8xy, simple_quad_l3_l9xy, simple_quad_l3_l10xy, simple_quad_l4_l0xy, + simple_quad_l4_l1xy, simple_quad_l4_l2xy, simple_quad_l4_l3xy, simple_quad_l4_l4xy, simple_quad_l4_l5xy, + simple_quad_l4_l6xy, simple_quad_l4_l7xy, simple_quad_l4_l8xy, simple_quad_l4_l9xy, simple_quad_l4_l10xy, simple_quad_l5_l0xy_0, simple_quad_l5_l0xy_1, simple_quad_l5_l1xy_0, simple_quad_l5_l1xy_1, simple_quad_l5_l2xy, - simple_quad_l5_l3xy, simple_quad_l5_l4xy, simple_quad_l5_l5xy, simple_quad_l5_l6xy, simple_quad_l5_l7xy, - simple_quad_l5_l8xy, simple_quad_l5_l9xy, simple_quad_l5_l10xy, simple_quad_l6_l0xy, simple_quad_l6_l1xy, - simple_quad_l6_l2xy, simple_quad_l6_l3xy, simple_quad_l6_l4xy, simple_quad_l6_l5xy, simple_quad_l6_l6xy, - simple_quad_l6_l7xy, simple_quad_l6_l8xy, simple_quad_l6_l9xy, simple_quad_l6_l10xy, simple_quad_l7_l0xy_0, - simple_quad_l7_l0xy_1, simple_quad_l7_l1xy_0, simple_quad_l7_l1xy_1, simple_quad_l7_l2xy, simple_quad_l7_l3xy, - simple_quad_l7_l4xy, simple_quad_l7_l5xy, simple_quad_l7_l6xy, simple_quad_l7_l7xy, simple_quad_l7_l8xy, - simple_quad_l7_l9xy, simple_quad_l7_l10xy, simple_quad_l8_l0xy, simple_quad_l8_l1xy, simple_quad_l8_l2xy, - simple_quad_l8_l3xy, simple_quad_l8_l4xy, simple_quad_l8_l5xy, simple_quad_l8_l6xy, simple_quad_l8_l7xy, - simple_quad_l8_l8xy, simple_quad_l8_l9xy, simple_quad_l8_l10xy, simple_quad_l9_l0xy_0, simple_quad_l9_l0xy_1, - simple_quad_l9_l1xy_0, simple_quad_l9_l1xy_1, simple_quad_l9_l2xy, simple_quad_l9_l3xy, simple_quad_l9_l4xy, - simple_quad_l9_l5xy, simple_quad_l9_l6xy, simple_quad_l9_l7xy, simple_quad_l9_l8xy, simple_quad_l9_l9xy, - simple_quad_l9_l10xy, simple_quad_l10_l0xy, simple_quad_l10_l1xy, simple_quad_l10_l2xy, simple_quad_l10_l3xy, - simple_quad_l10_l4xy, simple_quad_l10_l5xy, simple_quad_l10_l6xy, simple_quad_l10_l7xy, simple_quad_l10_l8xy, - simple_quad_l10_l9xy, simple_quad_l10_l10xy, + simple_quad_l5_l3xy, simple_quad_l5_l4xy, simple_quad_l5_l5xy, simple_quad_l5_l6xy, simple_quad_l5_l7xy, + simple_quad_l5_l8xy, simple_quad_l5_l9xy, simple_quad_l5_l10xy, simple_quad_l6_l0xy, simple_quad_l6_l1xy, + simple_quad_l6_l2xy, simple_quad_l6_l3xy, simple_quad_l6_l4xy, simple_quad_l6_l5xy, simple_quad_l6_l6xy, + simple_quad_l6_l7xy, simple_quad_l6_l8xy, simple_quad_l6_l9xy, simple_quad_l6_l10xy, simple_quad_l7_l0xy_0, + simple_quad_l7_l0xy_1, simple_quad_l7_l1xy_0, simple_quad_l7_l1xy_1, simple_quad_l7_l2xy, simple_quad_l7_l3xy, + simple_quad_l7_l4xy, simple_quad_l7_l5xy, simple_quad_l7_l6xy, simple_quad_l7_l7xy, simple_quad_l7_l8xy, + simple_quad_l7_l9xy, simple_quad_l7_l10xy, simple_quad_l8_l0xy, simple_quad_l8_l1xy, simple_quad_l8_l2xy, + simple_quad_l8_l3xy, simple_quad_l8_l4xy, simple_quad_l8_l5xy, simple_quad_l8_l6xy, simple_quad_l8_l7xy, + simple_quad_l8_l8xy, simple_quad_l8_l9xy, simple_quad_l8_l10xy, simple_quad_l9_l0xy_0, simple_quad_l9_l0xy_1, + simple_quad_l9_l1xy_0, simple_quad_l9_l1xy_1, simple_quad_l9_l2xy, simple_quad_l9_l3xy, simple_quad_l9_l4xy, + simple_quad_l9_l5xy, simple_quad_l9_l6xy, simple_quad_l9_l7xy, simple_quad_l9_l8xy, simple_quad_l9_l9xy, + simple_quad_l9_l10xy, simple_quad_l10_l0xy, simple_quad_l10_l1xy, simple_quad_l10_l2xy, simple_quad_l10_l3xy, + simple_quad_l10_l4xy, simple_quad_l10_l5xy, simple_quad_l10_l6xy, simple_quad_l10_l7xy, simple_quad_l10_l8xy, + simple_quad_l10_l9xy, simple_quad_l10_l10xy, }; static Shapeset::shape_fn_t simple_quad_fn_dyy[] = { - simple_quad_l0_l0yy, simple_quad_l0_l1yy, simple_quad_l0_l2yy, simple_quad_l0_l3yy_0, simple_quad_l0_l3yy_1, - simple_quad_l0_l4yy, simple_quad_l0_l5yy_0, simple_quad_l0_l5yy_1, simple_quad_l0_l6yy, simple_quad_l0_l7yy_0, - simple_quad_l0_l7yy_1, simple_quad_l0_l8yy, simple_quad_l0_l9yy_0, simple_quad_l0_l9yy_1, simple_quad_l0_l10yy, - simple_quad_l1_l0yy, simple_quad_l1_l1yy, simple_quad_l1_l2yy, simple_quad_l1_l3yy_0, simple_quad_l1_l3yy_1, - simple_quad_l1_l4yy, simple_quad_l1_l5yy_0, simple_quad_l1_l5yy_1, simple_quad_l1_l6yy, simple_quad_l1_l7yy_0, - simple_quad_l1_l7yy_1, simple_quad_l1_l8yy, simple_quad_l1_l9yy_0, simple_quad_l1_l9yy_1, simple_quad_l1_l10yy, - simple_quad_l2_l0yy, simple_quad_l2_l1yy, simple_quad_l2_l2yy, simple_quad_l2_l3yy, simple_quad_l2_l4yy, - simple_quad_l2_l5yy, simple_quad_l2_l6yy, simple_quad_l2_l7yy, simple_quad_l2_l8yy, simple_quad_l2_l9yy, - simple_quad_l2_l10yy, simple_quad_l3_l0yy_0, simple_quad_l3_l0yy_1, simple_quad_l3_l1yy_0, simple_quad_l3_l1yy_1, - simple_quad_l3_l2yy, simple_quad_l3_l3yy, simple_quad_l3_l4yy, simple_quad_l3_l5yy, simple_quad_l3_l6yy, - simple_quad_l3_l7yy, simple_quad_l3_l8yy, simple_quad_l3_l9yy, simple_quad_l3_l10yy, simple_quad_l4_l0yy, - simple_quad_l4_l1yy, simple_quad_l4_l2yy, simple_quad_l4_l3yy, simple_quad_l4_l4yy, simple_quad_l4_l5yy, - simple_quad_l4_l6yy, simple_quad_l4_l7yy, simple_quad_l4_l8yy, simple_quad_l4_l9yy, simple_quad_l4_l10yy, + simple_quad_l0_l0yy, simple_quad_l0_l1yy, simple_quad_l0_l2yy, simple_quad_l0_l3yy_0, simple_quad_l0_l3yy_1, + simple_quad_l0_l4yy, simple_quad_l0_l5yy_0, simple_quad_l0_l5yy_1, simple_quad_l0_l6yy, simple_quad_l0_l7yy_0, + simple_quad_l0_l7yy_1, simple_quad_l0_l8yy, simple_quad_l0_l9yy_0, simple_quad_l0_l9yy_1, simple_quad_l0_l10yy, + simple_quad_l1_l0yy, simple_quad_l1_l1yy, simple_quad_l1_l2yy, simple_quad_l1_l3yy_0, simple_quad_l1_l3yy_1, + simple_quad_l1_l4yy, simple_quad_l1_l5yy_0, simple_quad_l1_l5yy_1, simple_quad_l1_l6yy, simple_quad_l1_l7yy_0, + simple_quad_l1_l7yy_1, simple_quad_l1_l8yy, simple_quad_l1_l9yy_0, simple_quad_l1_l9yy_1, simple_quad_l1_l10yy, + simple_quad_l2_l0yy, simple_quad_l2_l1yy, simple_quad_l2_l2yy, simple_quad_l2_l3yy, simple_quad_l2_l4yy, + simple_quad_l2_l5yy, simple_quad_l2_l6yy, simple_quad_l2_l7yy, simple_quad_l2_l8yy, simple_quad_l2_l9yy, + simple_quad_l2_l10yy, simple_quad_l3_l0yy_0, simple_quad_l3_l0yy_1, simple_quad_l3_l1yy_0, simple_quad_l3_l1yy_1, + simple_quad_l3_l2yy, simple_quad_l3_l3yy, simple_quad_l3_l4yy, simple_quad_l3_l5yy, simple_quad_l3_l6yy, + simple_quad_l3_l7yy, simple_quad_l3_l8yy, simple_quad_l3_l9yy, simple_quad_l3_l10yy, simple_quad_l4_l0yy, + simple_quad_l4_l1yy, simple_quad_l4_l2yy, simple_quad_l4_l3yy, simple_quad_l4_l4yy, simple_quad_l4_l5yy, + simple_quad_l4_l6yy, simple_quad_l4_l7yy, simple_quad_l4_l8yy, simple_quad_l4_l9yy, simple_quad_l4_l10yy, simple_quad_l5_l0yy_0, simple_quad_l5_l0yy_1, simple_quad_l5_l1yy_0, simple_quad_l5_l1yy_1, simple_quad_l5_l2yy, - simple_quad_l5_l3yy, simple_quad_l5_l4yy, simple_quad_l5_l5yy, simple_quad_l5_l6yy, simple_quad_l5_l7yy, - simple_quad_l5_l8yy, simple_quad_l5_l9yy, simple_quad_l5_l10yy, simple_quad_l6_l0yy, simple_quad_l6_l1yy, - simple_quad_l6_l2yy, simple_quad_l6_l3yy, simple_quad_l6_l4yy, simple_quad_l6_l5yy, simple_quad_l6_l6yy, - simple_quad_l6_l7yy, simple_quad_l6_l8yy, simple_quad_l6_l9yy, simple_quad_l6_l10yy, simple_quad_l7_l0yy_0, - simple_quad_l7_l0yy_1, simple_quad_l7_l1yy_0, simple_quad_l7_l1yy_1, simple_quad_l7_l2yy, simple_quad_l7_l3yy, - simple_quad_l7_l4yy, simple_quad_l7_l5yy, simple_quad_l7_l6yy, simple_quad_l7_l7yy, simple_quad_l7_l8yy, - simple_quad_l7_l9yy, simple_quad_l7_l10yy, simple_quad_l8_l0yy, simple_quad_l8_l1yy, simple_quad_l8_l2yy, - simple_quad_l8_l3yy, simple_quad_l8_l4yy, simple_quad_l8_l5yy, simple_quad_l8_l6yy, simple_quad_l8_l7yy, - simple_quad_l8_l8yy, simple_quad_l8_l9yy, simple_quad_l8_l10yy, simple_quad_l9_l0yy_0, simple_quad_l9_l0yy_1, - simple_quad_l9_l1yy_0, simple_quad_l9_l1yy_1, simple_quad_l9_l2yy, simple_quad_l9_l3yy, simple_quad_l9_l4yy, - simple_quad_l9_l5yy, simple_quad_l9_l6yy, simple_quad_l9_l7yy, simple_quad_l9_l8yy, simple_quad_l9_l9yy, - simple_quad_l9_l10yy, simple_quad_l10_l0yy, simple_quad_l10_l1yy, simple_quad_l10_l2yy, simple_quad_l10_l3yy, - simple_quad_l10_l4yy, simple_quad_l10_l5yy, simple_quad_l10_l6yy, simple_quad_l10_l7yy, simple_quad_l10_l8yy, - simple_quad_l10_l9yy, simple_quad_l10_l10yy, + simple_quad_l5_l3yy, simple_quad_l5_l4yy, simple_quad_l5_l5yy, simple_quad_l5_l6yy, simple_quad_l5_l7yy, + simple_quad_l5_l8yy, simple_quad_l5_l9yy, simple_quad_l5_l10yy, simple_quad_l6_l0yy, simple_quad_l6_l1yy, + simple_quad_l6_l2yy, simple_quad_l6_l3yy, simple_quad_l6_l4yy, simple_quad_l6_l5yy, simple_quad_l6_l6yy, + simple_quad_l6_l7yy, simple_quad_l6_l8yy, simple_quad_l6_l9yy, simple_quad_l6_l10yy, simple_quad_l7_l0yy_0, + simple_quad_l7_l0yy_1, simple_quad_l7_l1yy_0, simple_quad_l7_l1yy_1, simple_quad_l7_l2yy, simple_quad_l7_l3yy, + simple_quad_l7_l4yy, simple_quad_l7_l5yy, simple_quad_l7_l6yy, simple_quad_l7_l7yy, simple_quad_l7_l8yy, + simple_quad_l7_l9yy, simple_quad_l7_l10yy, simple_quad_l8_l0yy, simple_quad_l8_l1yy, simple_quad_l8_l2yy, + simple_quad_l8_l3yy, simple_quad_l8_l4yy, simple_quad_l8_l5yy, simple_quad_l8_l6yy, simple_quad_l8_l7yy, + simple_quad_l8_l8yy, simple_quad_l8_l9yy, simple_quad_l8_l10yy, simple_quad_l9_l0yy_0, simple_quad_l9_l0yy_1, + simple_quad_l9_l1yy_0, simple_quad_l9_l1yy_1, simple_quad_l9_l2yy, simple_quad_l9_l3yy, simple_quad_l9_l4yy, + simple_quad_l9_l5yy, simple_quad_l9_l6yy, simple_quad_l9_l7yy, simple_quad_l9_l8yy, simple_quad_l9_l9yy, + simple_quad_l9_l10yy, simple_quad_l10_l0yy, simple_quad_l10_l1yy, simple_quad_l10_l2yy, simple_quad_l10_l3yy, + simple_quad_l10_l4yy, simple_quad_l10_l5yy, simple_quad_l10_l6yy, simple_quad_l10_l7yy, simple_quad_l10_l8yy, + simple_quad_l10_l9yy, simple_quad_l10_l10yy, }; - Shapeset::shape_fn_t* simple_quad_shape_fn_table[1] = { simple_quad_fn }; - Shapeset::shape_fn_t* simple_quad_shape_fn_table_dx[1] = { simple_quad_fn_dx }; - Shapeset::shape_fn_t* simple_quad_shape_fn_table_dy[1] = { simple_quad_fn_dy }; + Shapeset::shape_fn_t* simple_quad_shape_fn_table[1] = { simple_quad_fn }; + Shapeset::shape_fn_t* simple_quad_shape_fn_table_dx[1] = { simple_quad_fn_dx }; + Shapeset::shape_fn_t* simple_quad_shape_fn_table_dy[1] = { simple_quad_fn_dy }; Shapeset::shape_fn_t* simple_quad_shape_fn_table_dxx[1] = { simple_quad_fn_dxx }; Shapeset::shape_fn_t* simple_quad_shape_fn_table_dxy[1] = { simple_quad_fn_dxy }; Shapeset::shape_fn_t* simple_quad_shape_fn_table_dyy[1] = { simple_quad_fn_dyy }; - static int qb_2_2[] = { 32, }; - static int qb_2_3[] = { 32, 33, }; - static int qb_2_4[] = { 32, 33, 34, }; - static int qb_2_5[] = { 32, 33, 34, 35, }; - static int qb_2_6[] = { 32, 33, 34, 35, 36, }; - static int qb_2_7[] = { 32, 33, 34, 35, 36, 37, }; - static int qb_2_8[] = { 32, 33, 34, 35, 36, 37, 38, }; - static int qb_2_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, }; - static int qb_2_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, }; - static int qb_3_2[] = { 32, 45, }; - static int qb_3_3[] = { 32, 33, 45, 46, }; - static int qb_3_4[] = { 32, 33, 34, 45, 46, 47, }; - static int qb_3_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, }; - static int qb_3_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, }; - static int qb_3_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, }; - static int qb_3_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, }; - static int qb_3_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, }; - static int qb_3_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, }; - static int qb_4_2[] = { 32, 45, 56, }; - static int qb_4_3[] = { 32, 33, 45, 46, 56, 57, }; - static int qb_4_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, }; - static int qb_4_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, }; - static int qb_4_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, }; - static int qb_4_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, }; - static int qb_4_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, }; - static int qb_4_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, }; - static int qb_4_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, }; - static int qb_5_2[] = { 32, 45, 56, 69, }; - static int qb_5_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, }; - static int qb_5_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, }; - static int qb_5_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, }; - static int qb_5_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, }; - static int qb_5_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, }; - static int qb_5_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, }; - static int qb_5_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, }; - static int qb_5_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, }; - static int qb_6_2[] = { 32, 45, 56, 69, 80, }; - static int qb_6_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, }; - static int qb_6_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, }; - static int qb_6_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, }; - static int qb_6_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, }; - static int qb_6_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, }; - static int qb_6_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, }; - static int qb_6_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, }; - static int qb_6_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, }; - static int qb_7_2[] = { 32, 45, 56, 69, 80, 93, }; - static int qb_7_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, 93, 94, }; - static int qb_7_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, 93, 94, 95, }; - static int qb_7_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, 93, 94, 95, 96, }; - static int qb_7_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 93, 94, 95, 96, 97, }; - static int qb_7_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, 93, 94, 95, 96, 97, 98, }; - static int qb_7_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, 93, 94, 95, 96, 97, 98, 99, }; - static int qb_7_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, 93, 94, 95, 96, 97, 98, 99, 100, }; - static int qb_7_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 93, 94, 95, 96, 97, 98, 99, 100, 101, }; - static int qb_8_2[] = { 32, 45, 56, 69, 80, 93, 104, }; - static int qb_8_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, 93, 94, 104, 105, }; - static int qb_8_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, 93, 94, 95, 104, 105, 106, }; - static int qb_8_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, 93, 94, 95, 96, 104, 105, 106, 107, }; - static int qb_8_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 93, 94, 95, 96, 97, 104, 105, 106, 107, 108, }; - static int qb_8_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, 93, 94, 95, 96, 97, 98, 104, 105, 106, 107, 108, 109, }; - static int qb_8_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, 93, 94, 95, 96, 97, 98, 99, 104, 105, 106, 107, 108, 109, 110, }; - static int qb_8_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, 93, 94, 95, 96, 97, 98, 99, 100, 104, 105, 106, 107, 108, 109, 110, 111, }; - static int qb_8_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 93, 94, 95, 96, 97, 98, 99, 100, 101, 104, 105, 106, 107, 108, 109, 110, 111, 112, }; - static int qb_9_2[] = { 32, 45, 56, 69, 80, 93, 104, 117, }; - static int qb_9_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, 93, 94, 104, 105, 117, 118, }; - static int qb_9_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, 93, 94, 95, 104, 105, 106, 117, 118, 119, }; - static int qb_9_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, 93, 94, 95, 96, 104, 105, 106, 107, 117, 118, 119, 120, }; - static int qb_9_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 93, 94, 95, 96, 97, 104, 105, 106, 107, 108, 117, 118, 119, 120, 121, }; - static int qb_9_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, 93, 94, 95, 96, 97, 98, 104, 105, 106, 107, 108, 109, 117, 118, 119, 120, 121, 122, }; - static int qb_9_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, 93, 94, 95, 96, 97, 98, 99, 104, 105, 106, 107, 108, 109, 110, 117, 118, 119, 120, 121, 122, 123, }; - static int qb_9_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, 93, 94, 95, 96, 97, 98, 99, 100, 104, 105, 106, 107, 108, 109, 110, 111, 117, 118, 119, 120, 121, 122, 123, 124, }; - static int qb_9_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 93, 94, 95, 96, 97, 98, 99, 100, 101, 104, 105, 106, 107, 108, 109, 110, 111, 112, 117, 118, 119, 120, 121, 122, 123, 124, 125, }; - static int qb_10_2[] = { 32, 45, 56, 69, 80, 93, 104, 117, 128, }; - static int qb_10_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, 93, 94, 104, 105, 117, 118, 128, 129, }; - static int qb_10_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, 93, 94, 95, 104, 105, 106, 117, 118, 119, 128, 129, 130, }; - static int qb_10_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, 93, 94, 95, 96, 104, 105, 106, 107, 117, 118, 119, 120, 128, 129, 130, 131, }; - static int qb_10_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 93, 94, 95, 96, 97, 104, 105, 106, 107, 108, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, }; - static int qb_10_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, 93, 94, 95, 96, 97, 98, 104, 105, 106, 107, 108, 109, 117, 118, 119, 120, 121, 122, 128, 129, 130, 131, 132, 133, }; - static int qb_10_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, 93, 94, 95, 96, 97, 98, 99, 104, 105, 106, 107, 108, 109, 110, 117, 118, 119, 120, 121, 122, 123, 128, 129, 130, 131, 132, 133, 134, }; - static int qb_10_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, 93, 94, 95, 96, 97, 98, 99, 100, 104, 105, 106, 107, 108, 109, 110, 111, 117, 118, 119, 120, 121, 122, 123, 124, 128, 129, 130, 131, 132, 133, 134, 135, }; - static int qb_10_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 93, 94, 95, 96, 97, 98, 99, 100, 101, 104, 105, 106, 107, 108, 109, 110, 111, 112, 117, 118, 119, 120, 121, 122, 123, 124, 125, 128, 129, 130, 131, 132, 133, 134, 135, 136, }; + static short qb_2_2[] = { 32, }; + static short qb_2_3[] = { 32, 33, }; + static short qb_2_4[] = { 32, 33, 34, }; + static short qb_2_5[] = { 32, 33, 34, 35, }; + static short qb_2_6[] = { 32, 33, 34, 35, 36, }; + static short qb_2_7[] = { 32, 33, 34, 35, 36, 37, }; + static short qb_2_8[] = { 32, 33, 34, 35, 36, 37, 38, }; + static short qb_2_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, }; + static short qb_2_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, }; + static short qb_3_2[] = { 32, 45, }; + static short qb_3_3[] = { 32, 33, 45, 46, }; + static short qb_3_4[] = { 32, 33, 34, 45, 46, 47, }; + static short qb_3_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, }; + static short qb_3_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, }; + static short qb_3_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, }; + static short qb_3_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, }; + static short qb_3_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, }; + static short qb_3_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, }; + static short qb_4_2[] = { 32, 45, 56, }; + static short qb_4_3[] = { 32, 33, 45, 46, 56, 57, }; + static short qb_4_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, }; + static short qb_4_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, }; + static short qb_4_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, }; + static short qb_4_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, }; + static short qb_4_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, }; + static short qb_4_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, }; + static short qb_4_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, }; + static short qb_5_2[] = { 32, 45, 56, 69, }; + static short qb_5_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, }; + static short qb_5_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, }; + static short qb_5_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, }; + static short qb_5_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, }; + static short qb_5_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, }; + static short qb_5_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, }; + static short qb_5_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, }; + static short qb_5_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, }; + static short qb_6_2[] = { 32, 45, 56, 69, 80, }; + static short qb_6_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, }; + static short qb_6_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, }; + static short qb_6_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, }; + static short qb_6_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, }; + static short qb_6_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, }; + static short qb_6_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, }; + static short qb_6_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, }; + static short qb_6_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, }; + static short qb_7_2[] = { 32, 45, 56, 69, 80, 93, }; + static short qb_7_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, 93, 94, }; + static short qb_7_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, 93, 94, 95, }; + static short qb_7_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, 93, 94, 95, 96, }; + static short qb_7_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 93, 94, 95, 96, 97, }; + static short qb_7_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, 93, 94, 95, 96, 97, 98, }; + static short qb_7_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, 93, 94, 95, 96, 97, 98, 99, }; + static short qb_7_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, 93, 94, 95, 96, 97, 98, 99, 100, }; + static short qb_7_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 93, 94, 95, 96, 97, 98, 99, 100, 101, }; + static short qb_8_2[] = { 32, 45, 56, 69, 80, 93, 104, }; + static short qb_8_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, 93, 94, 104, 105, }; + static short qb_8_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, 93, 94, 95, 104, 105, 106, }; + static short qb_8_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, 93, 94, 95, 96, 104, 105, 106, 107, }; + static short qb_8_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 93, 94, 95, 96, 97, 104, 105, 106, 107, 108, }; + static short qb_8_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, 93, 94, 95, 96, 97, 98, 104, 105, 106, 107, 108, 109, }; + static short qb_8_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, 93, 94, 95, 96, 97, 98, 99, 104, 105, 106, 107, 108, 109, 110, }; + static short qb_8_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, 93, 94, 95, 96, 97, 98, 99, 100, 104, 105, 106, 107, 108, 109, 110, 111, }; + static short qb_8_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 93, 94, 95, 96, 97, 98, 99, 100, 101, 104, 105, 106, 107, 108, 109, 110, 111, 112, }; + static short qb_9_2[] = { 32, 45, 56, 69, 80, 93, 104, 117, }; + static short qb_9_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, 93, 94, 104, 105, 117, 118, }; + static short qb_9_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, 93, 94, 95, 104, 105, 106, 117, 118, 119, }; + static short qb_9_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, 93, 94, 95, 96, 104, 105, 106, 107, 117, 118, 119, 120, }; + static short qb_9_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 93, 94, 95, 96, 97, 104, 105, 106, 107, 108, 117, 118, 119, 120, 121, }; + static short qb_9_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, 93, 94, 95, 96, 97, 98, 104, 105, 106, 107, 108, 109, 117, 118, 119, 120, 121, 122, }; + static short qb_9_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, 93, 94, 95, 96, 97, 98, 99, 104, 105, 106, 107, 108, 109, 110, 117, 118, 119, 120, 121, 122, 123, }; + static short qb_9_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, 93, 94, 95, 96, 97, 98, 99, 100, 104, 105, 106, 107, 108, 109, 110, 111, 117, 118, 119, 120, 121, 122, 123, 124, }; + static short qb_9_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 93, 94, 95, 96, 97, 98, 99, 100, 101, 104, 105, 106, 107, 108, 109, 110, 111, 112, 117, 118, 119, 120, 121, 122, 123, 124, 125, }; + static short qb_10_2[] = { 32, 45, 56, 69, 80, 93, 104, 117, 128, }; + static short qb_10_3[] = { 32, 33, 45, 46, 56, 57, 69, 70, 80, 81, 93, 94, 104, 105, 117, 118, 128, 129, }; + static short qb_10_4[] = { 32, 33, 34, 45, 46, 47, 56, 57, 58, 69, 70, 71, 80, 81, 82, 93, 94, 95, 104, 105, 106, 117, 118, 119, 128, 129, 130, }; + static short qb_10_5[] = { 32, 33, 34, 35, 45, 46, 47, 48, 56, 57, 58, 59, 69, 70, 71, 72, 80, 81, 82, 83, 93, 94, 95, 96, 104, 105, 106, 107, 117, 118, 119, 120, 128, 129, 130, 131, }; + static short qb_10_6[] = { 32, 33, 34, 35, 36, 45, 46, 47, 48, 49, 56, 57, 58, 59, 60, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 93, 94, 95, 96, 97, 104, 105, 106, 107, 108, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, }; + static short qb_10_7[] = { 32, 33, 34, 35, 36, 37, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 61, 69, 70, 71, 72, 73, 74, 80, 81, 82, 83, 84, 85, 93, 94, 95, 96, 97, 98, 104, 105, 106, 107, 108, 109, 117, 118, 119, 120, 121, 122, 128, 129, 130, 131, 132, 133, }; + static short qb_10_8[] = { 32, 33, 34, 35, 36, 37, 38, 45, 46, 47, 48, 49, 50, 51, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, 85, 86, 93, 94, 95, 96, 97, 98, 99, 104, 105, 106, 107, 108, 109, 110, 117, 118, 119, 120, 121, 122, 123, 128, 129, 130, 131, 132, 133, 134, }; + static short qb_10_9[] = { 32, 33, 34, 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, 52, 56, 57, 58, 59, 60, 61, 62, 63, 69, 70, 71, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 87, 93, 94, 95, 96, 97, 98, 99, 100, 104, 105, 106, 107, 108, 109, 110, 111, 117, 118, 119, 120, 121, 122, 123, 124, 128, 129, 130, 131, 132, 133, 134, 135, }; + static short qb_10_10[] = { 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 93, 94, 95, 96, 97, 98, 99, 100, 101, 104, 105, 106, 107, 108, 109, 110, 111, 112, 117, 118, 119, 120, 121, 122, 123, 124, 125, 128, 129, 130, 131, 132, 133, 134, 135, 136, }; #define nullptr16 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr - int* simple_quad_bubble_indices[] = - { - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, qb_2_2, qb_2_3, qb_2_4, qb_2_5, qb_2_6, qb_2_7, qb_2_8, qb_2_9, qb_2_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, qb_3_2, qb_3_3, qb_3_4, qb_3_5, qb_3_6, qb_3_7, qb_3_8, qb_3_9, qb_3_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, qb_4_2, qb_4_3, qb_4_4, qb_4_5, qb_4_6, qb_4_7, qb_4_8, qb_4_9, qb_4_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, qb_5_2, qb_5_3, qb_5_4, qb_5_5, qb_5_6, qb_5_7, qb_5_8, qb_5_9, qb_5_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, qb_6_2, qb_6_3, qb_6_4, qb_6_5, qb_6_6, qb_6_7, qb_6_8, qb_6_9, qb_6_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, qb_7_2, qb_7_3, qb_7_4, qb_7_5, qb_7_6, qb_7_7, qb_7_8, qb_7_9, qb_7_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, qb_8_2, qb_8_3, qb_8_4, qb_8_5, qb_8_6, qb_8_7, qb_8_8, qb_8_9, qb_8_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, qb_9_2, qb_9_3, qb_9_4, qb_9_5, qb_9_6, qb_9_7, qb_9_8, qb_9_9, qb_9_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - nullptr, nullptr, qb_10_2, qb_10_3, qb_10_4, qb_10_5, qb_10_6, qb_10_7, qb_10_8, qb_10_9, qb_10_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + short* simple_quad_bubble_indices[] = + { + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, qb_2_2, qb_2_3, qb_2_4, qb_2_5, qb_2_6, qb_2_7, qb_2_8, qb_2_9, qb_2_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, qb_3_2, qb_3_3, qb_3_4, qb_3_5, qb_3_6, qb_3_7, qb_3_8, qb_3_9, qb_3_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, qb_4_2, qb_4_3, qb_4_4, qb_4_5, qb_4_6, qb_4_7, qb_4_8, qb_4_9, qb_4_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, qb_5_2, qb_5_3, qb_5_4, qb_5_5, qb_5_6, qb_5_7, qb_5_8, qb_5_9, qb_5_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, qb_6_2, qb_6_3, qb_6_4, qb_6_5, qb_6_6, qb_6_7, qb_6_8, qb_6_9, qb_6_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, qb_7_2, qb_7_3, qb_7_4, qb_7_5, qb_7_6, qb_7_7, qb_7_8, qb_7_9, qb_7_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, qb_8_2, qb_8_3, qb_8_4, qb_8_5, qb_8_6, qb_8_7, qb_8_8, qb_8_9, qb_8_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, qb_9_2, qb_9_3, qb_9_4, qb_9_5, qb_9_6, qb_9_7, qb_9_8, qb_9_9, qb_9_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + nullptr, nullptr, qb_10_2, qb_10_3, qb_10_4, qb_10_5, qb_10_6, qb_10_7, qb_10_8, qb_10_9, qb_10_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, }; #define zero16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - int simple_quad_bubble_count[] = - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, zero16, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, zero16, - 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, zero16, - 0, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 0, 0, 0, 0, zero16, - 0, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 0, 0, 0, 0, zero16, - 0, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 0, 0, 0, 0, zero16, - 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 0, 0, 0, 0, zero16, - 0, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 0, 0, 0, 0, zero16, - 0, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0, 0, 0, 0, 0, zero16, - 0, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 0, 0, 0, 0, 0, zero16, - 0, 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 0, 0, 0, 0, 0, zero16, + unsigned short simple_quad_bubble_count[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, zero16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, zero16, + 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, zero16, + 0, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 0, 0, 0, 0, zero16, + 0, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 0, 0, 0, 0, zero16, + 0, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 0, 0, 0, 0, zero16, + 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 0, 0, 0, 0, zero16, + 0, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 0, 0, 0, 0, zero16, + 0, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0, 0, 0, 0, 0, zero16, + 0, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 0, 0, 0, 0, 0, zero16, + 0, 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 0, 0, 0, 0, 0, zero16, }; - int simple_quad_vertex_indices[4] = { 0, 15, 16, 1 }; + short simple_quad_vertex_indices[4] = { 0, 15, 16, 1 }; - static int simple_quad_edge_indices_0[22] = { 0, 15, 15, 0, 30, 30, 41, 42, 54, 54, 65, 66, 78, 78, 89, 90, 102, 102, 113, 114, 126, 126 }; - static int simple_quad_edge_indices_1[22] = { 15, 16, 16, 15, 17, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 29 }; - static int simple_quad_edge_indices_2[22] = { 16, 1, 1, 16, 31, 31, 43, 44, 55, 55, 67, 68, 79, 79, 91, 92, 103, 103, 115, 116, 127, 127 }; - static int simple_quad_edge_indices_3[22] = { 1, 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 14 }; + static short simple_quad_edge_indices_0[22] = { 0, 15, 15, 0, 30, 30, 41, 42, 54, 54, 65, 66, 78, 78, 89, 90, 102, 102, 113, 114, 126, 126 }; + static short simple_quad_edge_indices_1[22] = { 15, 16, 16, 15, 17, 17, 18, 19, 20, 20, 21, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 29 }; + static short simple_quad_edge_indices_2[22] = { 16, 1, 1, 16, 31, 31, 43, 44, 55, 55, 67, 68, 79, 79, 91, 92, 103, 103, 115, 116, 127, 127 }; + static short simple_quad_edge_indices_3[22] = { 1, 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 14 }; - int* simple_quad_edge_indices[4] = + short* simple_quad_edge_indices[4] = { simple_quad_edge_indices_0, simple_quad_edge_indices_1, @@ -4459,19 +4459,19 @@ namespace Hermes #define oo H2D_MAKE_QUAD_ORDER #define XX(a, b) oo(a, b), oo(a, b) - int simple_quad_index_to_order[] = - { - oo(1, 1), oo(1, 1), oo(1, 2), XX(1, 3), oo(1, 4), XX(1, 5), oo(1, 6), XX(1, 7), oo(1, 8), XX(1, 9), oo(1, 10), - oo(1, 1), oo(1, 1), oo(1, 2), XX(1, 3), oo(1, 4), XX(1, 5), oo(1, 6), XX(1, 7), oo(1, 8), XX(1, 9), oo(1, 10), - oo(2, 1), oo(2, 1), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), - XX(3, 1), XX(3, 1), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), - oo(4, 1), oo(4, 1), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), - XX(5, 1), XX(5, 1), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), - oo(6, 1), oo(6, 1), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), - XX(7, 1), XX(7, 1), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), - oo(8, 1), oo(8, 1), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), - XX(9, 1), XX(9, 1), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), - oo(10, 1), oo(10, 1), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), + unsigned short simple_quad_index_to_order[] = + { + oo(1, 1), oo(1, 1), oo(1, 2), XX(1, 3), oo(1, 4), XX(1, 5), oo(1, 6), XX(1, 7), oo(1, 8), XX(1, 9), oo(1, 10), + oo(1, 1), oo(1, 1), oo(1, 2), XX(1, 3), oo(1, 4), XX(1, 5), oo(1, 6), XX(1, 7), oo(1, 8), XX(1, 9), oo(1, 10), + oo(2, 1), oo(2, 1), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), + XX(3, 1), XX(3, 1), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), + oo(4, 1), oo(4, 1), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), + XX(5, 1), XX(5, 1), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), + oo(6, 1), oo(6, 1), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), + XX(7, 1), XX(7, 1), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), + oo(8, 1), oo(8, 1), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), + XX(9, 1), XX(9, 1), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), + oo(10, 1), oo(10, 1), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), }; } } \ No newline at end of file diff --git a/hermes2d/src/shapeset/shapeset_hc_gradleg.cpp b/hermes2d/src/shapeset/shapeset_hc_gradleg.cpp index 87c01abc48..976b3ba468 100644 --- a/hermes2d/src/shapeset/shapeset_hc_gradleg.cpp +++ b/hermes2d/src/shapeset/shapeset_hc_gradleg.cpp @@ -218,6537 +218,6537 @@ namespace Hermes /* EDGE FUNCTIONS - order 1*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p1_e1_a(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi0(l3 - l2) + l3 * l2x * phi0(l3 - l2) + l3 * l2 * phi0x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi0(l3 - l2) + l3 * l2x * phi0(l3 - l2) + l3 * l2 * phi0x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p1_e1_b(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi0(l3 - l2) + l3 * l2y * phi0(l3 - l2) + l3 * l2 * phi0x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi0(l3 - l2) + l3 * l2y * phi0(l3 - l2) + l3 * l2 * phi0x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p1_e1_ax(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi0(l3 - l2); kerx = phi0x(l3 - l2) * (l3x - l2x); kerxx = phi0xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi0(l3 - l2); kerx = phi0x(l3 - l2) * (l3x - l2x); kerxx = phi0xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p1_e1_ay(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi0(l3 - l2); kerx = phi0x(l3 - l2) * (l3x - l2x); - kery = phi0x(l3 - l2) * (l3y - l2y); kerxy = phi0xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi0(l3 - l2); kerx = phi0x(l3 - l2) * (l3x - l2x); + kery = phi0x(l3 - l2) * (l3y - l2y); kerxy = phi0xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p1_e1_bx(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi0(l3 - l2); kerx = phi0x(l3 - l2) * (l3x - l2x); - kery = phi0x(l3 - l2) * (l3y - l2y); kerxy = phi0xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi0(l3 - l2); kerx = phi0x(l3 - l2) * (l3x - l2x); + kery = phi0x(l3 - l2) * (l3y - l2y); kerxy = phi0xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p1_e1_by(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi0(l3 - l2); kery = phi0x(l3 - l2) * (l3y - l2y); keryy = phi0xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi0(l3 - l2); kery = phi0x(l3 - l2) * (l3y - l2y); keryy = phi0xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p1_e2_a(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi0(l1 - l3) + l1 * l3x * phi0(l1 - l3) + l1 * l3 * phi0x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi0(l1 - l3) + l1 * l3x * phi0(l1 - l3) + l1 * l3 * phi0x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p1_e2_b(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi0(l1 - l3) + l1 * l3y * phi0(l1 - l3) + l1 * l3 * phi0x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi0(l1 - l3) + l1 * l3y * phi0(l1 - l3) + l1 * l3 * phi0x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p1_e2_ax(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi0(l1 - l3); kerx = phi0x(l1 - l3) * (l1x - l3x); kerxx = phi0xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi0(l1 - l3); kerx = phi0x(l1 - l3) * (l1x - l3x); kerxx = phi0xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p1_e2_ay(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi0(l1 - l3); kerx = phi0x(l1 - l3) * (l1x - l3x); - kery = phi0x(l1 - l3) * (l1y - l3y); kerxy = phi0xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi0(l1 - l3); kerx = phi0x(l1 - l3) * (l1x - l3x); + kery = phi0x(l1 - l3) * (l1y - l3y); kerxy = phi0xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p1_e2_bx(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi0(l1 - l3); kerx = phi0x(l1 - l3) * (l1x - l3x); - kery = phi0x(l1 - l3) * (l1y - l3y); kerxy = phi0xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi0(l1 - l3); kerx = phi0x(l1 - l3) * (l1x - l3x); + kery = phi0x(l1 - l3) * (l1y - l3y); kerxy = phi0xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p1_e2_by(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi0(l1 - l3); kery = phi0x(l1 - l3) * (l1y - l3y); keryy = phi0xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi0(l1 - l3); kery = phi0x(l1 - l3) * (l1y - l3y); keryy = phi0xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p1_e3_a(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi0(l2 - l1) + l2 * l1x * phi0(l2 - l1) + l2 * l1 * phi0x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi0(l2 - l1) + l2 * l1x * phi0(l2 - l1) + l2 * l1 * phi0x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p1_e3_b(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi0(l2 - l1) + l2 * l1y * phi0(l2 - l1) + l2 * l1 * phi0x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi0(l2 - l1) + l2 * l1y * phi0(l2 - l1) + l2 * l1 * phi0x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p1_e3_ax(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi0(l2 - l1); kerx = phi0x(l2 - l1) * (l2x - l1x); kerxx = phi0xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi0(l2 - l1); kerx = phi0x(l2 - l1) * (l2x - l1x); kerxx = phi0xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p1_e3_ay(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi0(l2 - l1); kerx = phi0x(l2 - l1) * (l2x - l1x); - kery = phi0x(l2 - l1) * (l2y - l1y); kerxy = phi0xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi0(l2 - l1); kerx = phi0x(l2 - l1) * (l2x - l1x); + kery = phi0x(l2 - l1) * (l2y - l1y); kerxy = phi0xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p1_e3_bx(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi0(l2 - l1); kerx = phi0x(l2 - l1) * (l2x - l1x); - kery = phi0x(l2 - l1) * (l2y - l1y); kerxy = phi0xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi0(l2 - l1); kerx = phi0x(l2 - l1) * (l2x - l1x); + kery = phi0x(l2 - l1) * (l2y - l1y); kerxy = phi0xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p1_e3_by(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi0(l2 - l1); kery = phi0x(l2 - l1) * (l2y - l1y); keryy = phi0xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi0(l2 - l1); kery = phi0x(l2 - l1) * (l2y - l1y); keryy = phi0xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } ///////////////////////////////// ORDER 2 ////////////////////////////////// /* EDGE FUNCTIONS - order 2*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p2_e1_a_0(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi1(l3 - l2) + l3 * l2x * phi1(l3 - l2) + l3 * l2 * phi1x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi1(l3 - l2) + l3 * l2x * phi1(l3 - l2) + l3 * l2 * phi1x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p2_e1_a_1(double x, double y) { - return -(gradleg_tri_p2_e1_a_0(x, y)); + return -(gradleg_tri_p2_e1_a_0(x, y)); } static double gradleg_tri_p2_e1_b_0(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi1(l3 - l2) + l3 * l2y * phi1(l3 - l2) + l3 * l2 * phi1x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi1(l3 - l2) + l3 * l2y * phi1(l3 - l2) + l3 * l2 * phi1x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p2_e1_b_1(double x, double y) { - return -(gradleg_tri_p2_e1_b_0(x, y)); + return -(gradleg_tri_p2_e1_b_0(x, y)); } static double gradleg_tri_p2_e1_ax_0(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi1(l3 - l2); kerx = phi1x(l3 - l2) * (l3x - l2x); kerxx = phi1xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi1(l3 - l2); kerx = phi1x(l3 - l2) * (l3x - l2x); kerxx = phi1xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p2_e1_ax_1(double x, double y) { - return -(gradleg_tri_p2_e1_ax_0(x, y)); + return -(gradleg_tri_p2_e1_ax_0(x, y)); } static double gradleg_tri_p2_e1_ay_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi1(l3 - l2); kerx = phi1x(l3 - l2) * (l3x - l2x); - kery = phi1x(l3 - l2) * (l3y - l2y); kerxy = phi1xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi1(l3 - l2); kerx = phi1x(l3 - l2) * (l3x - l2x); + kery = phi1x(l3 - l2) * (l3y - l2y); kerxy = phi1xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p2_e1_ay_1(double x, double y) { - return -(gradleg_tri_p2_e1_ay_0(x, y)); + return -(gradleg_tri_p2_e1_ay_0(x, y)); } static double gradleg_tri_p2_e1_bx_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi1(l3 - l2); kerx = phi1x(l3 - l2) * (l3x - l2x); - kery = phi1x(l3 - l2) * (l3y - l2y); kerxy = phi1xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi1(l3 - l2); kerx = phi1x(l3 - l2) * (l3x - l2x); + kery = phi1x(l3 - l2) * (l3y - l2y); kerxy = phi1xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p2_e1_bx_1(double x, double y) { - return -(gradleg_tri_p2_e1_bx_0(x, y)); + return -(gradleg_tri_p2_e1_bx_0(x, y)); } static double gradleg_tri_p2_e1_by_0(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi1(l3 - l2); kery = phi1x(l3 - l2) * (l3y - l2y); keryy = phi1xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi1(l3 - l2); kery = phi1x(l3 - l2) * (l3y - l2y); keryy = phi1xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } static double gradleg_tri_p2_e1_by_1(double x, double y) { - return -(gradleg_tri_p2_e1_by_0(x, y)); + return -(gradleg_tri_p2_e1_by_0(x, y)); } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p2_e2_a_0(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi1(l1 - l3) + l1 * l3x * phi1(l1 - l3) + l1 * l3 * phi1x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi1(l1 - l3) + l1 * l3x * phi1(l1 - l3) + l1 * l3 * phi1x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p2_e2_a_1(double x, double y) { - return -(gradleg_tri_p2_e2_a_0(x, y)); + return -(gradleg_tri_p2_e2_a_0(x, y)); } static double gradleg_tri_p2_e2_b_0(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi1(l1 - l3) + l1 * l3y * phi1(l1 - l3) + l1 * l3 * phi1x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi1(l1 - l3) + l1 * l3y * phi1(l1 - l3) + l1 * l3 * phi1x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p2_e2_b_1(double x, double y) { - return -(gradleg_tri_p2_e2_b_0(x, y)); + return -(gradleg_tri_p2_e2_b_0(x, y)); } static double gradleg_tri_p2_e2_ax_0(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi1(l1 - l3); kerx = phi1x(l1 - l3) * (l1x - l3x); kerxx = phi1xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi1(l1 - l3); kerx = phi1x(l1 - l3) * (l1x - l3x); kerxx = phi1xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p2_e2_ax_1(double x, double y) { - return -(gradleg_tri_p2_e2_ax_0(x, y)); + return -(gradleg_tri_p2_e2_ax_0(x, y)); } static double gradleg_tri_p2_e2_ay_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi1(l1 - l3); kerx = phi1x(l1 - l3) * (l1x - l3x); - kery = phi1x(l1 - l3) * (l1y - l3y); kerxy = phi1xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi1(l1 - l3); kerx = phi1x(l1 - l3) * (l1x - l3x); + kery = phi1x(l1 - l3) * (l1y - l3y); kerxy = phi1xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p2_e2_ay_1(double x, double y) { - return -(gradleg_tri_p2_e2_ay_0(x, y)); + return -(gradleg_tri_p2_e2_ay_0(x, y)); } static double gradleg_tri_p2_e2_bx_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi1(l1 - l3); kerx = phi1x(l1 - l3) * (l1x - l3x); - kery = phi1x(l1 - l3) * (l1y - l3y); kerxy = phi1xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi1(l1 - l3); kerx = phi1x(l1 - l3) * (l1x - l3x); + kery = phi1x(l1 - l3) * (l1y - l3y); kerxy = phi1xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p2_e2_bx_1(double x, double y) { - return -(gradleg_tri_p2_e2_bx_0(x, y)); + return -(gradleg_tri_p2_e2_bx_0(x, y)); } static double gradleg_tri_p2_e2_by_0(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi1(l1 - l3); kery = phi1x(l1 - l3) * (l1y - l3y); keryy = phi1xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi1(l1 - l3); kery = phi1x(l1 - l3) * (l1y - l3y); keryy = phi1xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } static double gradleg_tri_p2_e2_by_1(double x, double y) { - return -(gradleg_tri_p2_e2_by_0(x, y)); + return -(gradleg_tri_p2_e2_by_0(x, y)); } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p2_e3_a_0(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi1(l2 - l1) + l2 * l1x * phi1(l2 - l1) + l2 * l1 * phi1x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi1(l2 - l1) + l2 * l1x * phi1(l2 - l1) + l2 * l1 * phi1x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p2_e3_a_1(double x, double y) { - return -(gradleg_tri_p2_e3_a_0(x, y)); + return -(gradleg_tri_p2_e3_a_0(x, y)); } static double gradleg_tri_p2_e3_b_0(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi1(l2 - l1) + l2 * l1y * phi1(l2 - l1) + l2 * l1 * phi1x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi1(l2 - l1) + l2 * l1y * phi1(l2 - l1) + l2 * l1 * phi1x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p2_e3_b_1(double x, double y) { - return -(gradleg_tri_p2_e3_b_0(x, y)); + return -(gradleg_tri_p2_e3_b_0(x, y)); } static double gradleg_tri_p2_e3_ax_0(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi1(l2 - l1); kerx = phi1x(l2 - l1) * (l2x - l1x); kerxx = phi1xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi1(l2 - l1); kerx = phi1x(l2 - l1) * (l2x - l1x); kerxx = phi1xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p2_e3_ax_1(double x, double y) { - return -(gradleg_tri_p2_e3_ax_0(x, y)); + return -(gradleg_tri_p2_e3_ax_0(x, y)); } static double gradleg_tri_p2_e3_ay_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi1(l2 - l1); kerx = phi1x(l2 - l1) * (l2x - l1x); - kery = phi1x(l2 - l1) * (l2y - l1y); kerxy = phi1xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi1(l2 - l1); kerx = phi1x(l2 - l1) * (l2x - l1x); + kery = phi1x(l2 - l1) * (l2y - l1y); kerxy = phi1xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p2_e3_ay_1(double x, double y) { - return -(gradleg_tri_p2_e3_ay_0(x, y)); + return -(gradleg_tri_p2_e3_ay_0(x, y)); } static double gradleg_tri_p2_e3_bx_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi1(l2 - l1); kerx = phi1x(l2 - l1) * (l2x - l1x); - kery = phi1x(l2 - l1) * (l2y - l1y); kerxy = phi1xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi1(l2 - l1); kerx = phi1x(l2 - l1) * (l2x - l1x); + kery = phi1x(l2 - l1) * (l2y - l1y); kerxy = phi1xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p2_e3_bx_1(double x, double y) { - return -(gradleg_tri_p2_e3_bx_0(x, y)); + return -(gradleg_tri_p2_e3_bx_0(x, y)); } static double gradleg_tri_p2_e3_by_0(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi1(l2 - l1); kery = phi1x(l2 - l1) * (l2y - l1y); keryy = phi1xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi1(l2 - l1); kery = phi1x(l2 - l1) * (l2y - l1y); keryy = phi1xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } static double gradleg_tri_p2_e3_by_1(double x, double y) { - return -(gradleg_tri_p2_e3_by_0(x, y)); + return -(gradleg_tri_p2_e3_by_0(x, y)); } /* BUBBLE */ /* Edge-based BUBBLE - order 2 */ - // EDGE 1 + // EDGE 1 static double gradleg_tri_p2_b1_a(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n11 * (l3 * l2 * Legendre0(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n11 * (l3 * l2 * Legendre0(l3 - l2)); } static double gradleg_tri_p2_b1_b(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n12 * (l3 * l2 * Legendre0(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n12 * (l3 * l2 * Legendre0(l3 - l2)); } static double gradleg_tri_p2_b1_ax(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n11 * (l3x * l2 * Legendre0(l3 - l2) + l3 * l2x * Legendre0(l3 - l2) + l3 * l2 * Legendre0x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n11 * (l3x * l2 * Legendre0(l3 - l2) + l3 * l2x * Legendre0(l3 - l2) + l3 * l2 * Legendre0x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p2_b1_bx(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n12 * (l3x * l2 * Legendre0(l3 - l2) + l3 * l2x * Legendre0(l3 - l2) + l3 * l2 * Legendre0x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n12 * (l3x * l2 * Legendre0(l3 - l2) + l3 * l2x * Legendre0(l3 - l2) + l3 * l2 * Legendre0x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p2_b1_ay(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n11 * (l3y * l2 * Legendre0(l3 - l2) + l3 * l2y * Legendre0(l3 - l2) + l3 * l2 * Legendre0x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n11 * (l3y * l2 * Legendre0(l3 - l2) + l3 * l2y * Legendre0(l3 - l2) + l3 * l2 * Legendre0x(l3 - l2) * (l3y - l2y)); } static double gradleg_tri_p2_b1_by(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n12 * (l3y * l2 * Legendre0(l3 - l2) + l3 * l2y * Legendre0(l3 - l2) + l3 * l2 * Legendre0x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n12 * (l3y * l2 * Legendre0(l3 - l2) + l3 * l2y * Legendre0(l3 - l2) + l3 * l2 * Legendre0x(l3 - l2) * (l3y - l2y)); } - // EDGE 2 + // EDGE 2 static double gradleg_tri_p2_b2_a(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n21 * (l1 * l3 * Legendre0(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n21 * (l1 * l3 * Legendre0(l1 - l3)); } static double gradleg_tri_p2_b2_b(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n22 * (l1 * l3 * Legendre0(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n22 * (l1 * l3 * Legendre0(l1 - l3)); } static double gradleg_tri_p2_b2_ax(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n21 * (l1x * l3 * Legendre0(l1 - l3) + l1 * l3x * Legendre0(l1 - l3) + l1 * l3 * Legendre0x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n21 * (l1x * l3 * Legendre0(l1 - l3) + l1 * l3x * Legendre0(l1 - l3) + l1 * l3 * Legendre0x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p2_b2_bx(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n22 * (l1x * l3 * Legendre0(l1 - l3) + l1 * l3x * Legendre0(l1 - l3) + l1 * l3 * Legendre0x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n22 * (l1x * l3 * Legendre0(l1 - l3) + l1 * l3x * Legendre0(l1 - l3) + l1 * l3 * Legendre0x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p2_b2_ay(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n21 * (l1y * l3 * Legendre0(l1 - l3) + l1 * l3y * Legendre0(l1 - l3) + l1 * l3 * Legendre0x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n21 * (l1y * l3 * Legendre0(l1 - l3) + l1 * l3y * Legendre0(l1 - l3) + l1 * l3 * Legendre0x(l1 - l3) * (l1y - l3y)); } static double gradleg_tri_p2_b2_by(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n22 * (l1y * l3 * Legendre0(l1 - l3) + l1 * l3y * Legendre0(l1 - l3) + l1 * l3 * Legendre0x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n22 * (l1y * l3 * Legendre0(l1 - l3) + l1 * l3y * Legendre0(l1 - l3) + l1 * l3 * Legendre0x(l1 - l3) * (l1y - l3y)); } - // EDGE 3 + // EDGE 3 static double gradleg_tri_p2_b3_a(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n31 * (l2 * l1 * Legendre0(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n31 * (l2 * l1 * Legendre0(l2 - l1)); } static double gradleg_tri_p2_b3_b(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n32 * (l2 * l1 * Legendre0(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n32 * (l2 * l1 * Legendre0(l2 - l1)); } static double gradleg_tri_p2_b3_ax(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n31 * (l2x * l1 * Legendre0(l2 - l1) + l2 * l1x * Legendre0(l2 - l1) + l2 * l1 * Legendre0x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n31 * (l2x * l1 * Legendre0(l2 - l1) + l2 * l1x * Legendre0(l2 - l1) + l2 * l1 * Legendre0x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p2_b3_bx(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n32 * (l2x * l1 * Legendre0(l2 - l1) + l2 * l1x * Legendre0(l2 - l1) + l2 * l1 * Legendre0x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n32 * (l2x * l1 * Legendre0(l2 - l1) + l2 * l1x * Legendre0(l2 - l1) + l2 * l1 * Legendre0x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p2_b3_ay(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n31 * (l2y * l1 * Legendre0(l2 - l1) + l2 * l1y * Legendre0(l2 - l1) + l2 * l1 * Legendre0x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n31 * (l2y * l1 * Legendre0(l2 - l1) + l2 * l1y * Legendre0(l2 - l1) + l2 * l1 * Legendre0x(l2 - l1) * (l2y - l1y)); } static double gradleg_tri_p2_b3_by(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n32 * (l2y * l1 * Legendre0(l2 - l1) + l2 * l1y * Legendre0(l2 - l1) + l2 * l1 * Legendre0x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n32 * (l2y * l1 * Legendre0(l2 - l1) + l2 * l1y * Legendre0(l2 - l1) + l2 * l1 * Legendre0x(l2 - l1) * (l2y - l1y)); } ///////////////////////////////// ORDER 3 ////////////////////////////////// /* EDGE FUNCTIONS - order 3*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p3_e1_a(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi2(l3 - l2) + l3 * l2x * phi2(l3 - l2) + l3 * l2 * phi2x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi2(l3 - l2) + l3 * l2x * phi2(l3 - l2) + l3 * l2 * phi2x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p3_e1_b(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi2(l3 - l2) + l3 * l2y * phi2(l3 - l2) + l3 * l2 * phi2x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi2(l3 - l2) + l3 * l2y * phi2(l3 - l2) + l3 * l2 * phi2x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p3_e1_ax(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi2(l3 - l2); kerx = phi2x(l3 - l2) * (l3x - l2x); kerxx = phi2xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi2(l3 - l2); kerx = phi2x(l3 - l2) * (l3x - l2x); kerxx = phi2xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p3_e1_ay(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi2(l3 - l2); kerx = phi2x(l3 - l2) * (l3x - l2x); - kery = phi2x(l3 - l2) * (l3y - l2y); kerxy = phi2xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi2(l3 - l2); kerx = phi2x(l3 - l2) * (l3x - l2x); + kery = phi2x(l3 - l2) * (l3y - l2y); kerxy = phi2xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p3_e1_bx(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi2(l3 - l2); kerx = phi2x(l3 - l2) * (l3x - l2x); - kery = phi2x(l3 - l2) * (l3y - l2y); kerxy = phi2xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi2(l3 - l2); kerx = phi2x(l3 - l2) * (l3x - l2x); + kery = phi2x(l3 - l2) * (l3y - l2y); kerxy = phi2xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p3_e1_by(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi2(l3 - l2); kery = phi2x(l3 - l2) * (l3y - l2y); keryy = phi2xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi2(l3 - l2); kery = phi2x(l3 - l2) * (l3y - l2y); keryy = phi2xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p3_e2_a(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi2(l1 - l3) + l1 * l3x * phi2(l1 - l3) + l1 * l3 * phi2x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi2(l1 - l3) + l1 * l3x * phi2(l1 - l3) + l1 * l3 * phi2x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p3_e2_b(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi2(l1 - l3) + l1 * l3y * phi2(l1 - l3) + l1 * l3 * phi2x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi2(l1 - l3) + l1 * l3y * phi2(l1 - l3) + l1 * l3 * phi2x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p3_e2_ax(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi2(l1 - l3); kerx = phi2x(l1 - l3) * (l1x - l3x); kerxx = phi2xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi2(l1 - l3); kerx = phi2x(l1 - l3) * (l1x - l3x); kerxx = phi2xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p3_e2_ay(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi2(l1 - l3); kerx = phi2x(l1 - l3) * (l1x - l3x); - kery = phi2x(l1 - l3) * (l1y - l3y); kerxy = phi2xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi2(l1 - l3); kerx = phi2x(l1 - l3) * (l1x - l3x); + kery = phi2x(l1 - l3) * (l1y - l3y); kerxy = phi2xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p3_e2_bx(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi2(l1 - l3); kerx = phi2x(l1 - l3) * (l1x - l3x); - kery = phi2x(l1 - l3) * (l1y - l3y); kerxy = phi2xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi2(l1 - l3); kerx = phi2x(l1 - l3) * (l1x - l3x); + kery = phi2x(l1 - l3) * (l1y - l3y); kerxy = phi2xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p3_e2_by(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi2(l1 - l3); kery = phi2x(l1 - l3) * (l1y - l3y); keryy = phi2xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi2(l1 - l3); kery = phi2x(l1 - l3) * (l1y - l3y); keryy = phi2xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p3_e3_a(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi2(l2 - l1) + l2 * l1x * phi2(l2 - l1) + l2 * l1 * phi2x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi2(l2 - l1) + l2 * l1x * phi2(l2 - l1) + l2 * l1 * phi2x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p3_e3_b(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi2(l2 - l1) + l2 * l1y * phi2(l2 - l1) + l2 * l1 * phi2x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi2(l2 - l1) + l2 * l1y * phi2(l2 - l1) + l2 * l1 * phi2x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p3_e3_ax(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi2(l2 - l1); kerx = phi2x(l2 - l1) * (l2x - l1x); kerxx = phi2xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi2(l2 - l1); kerx = phi2x(l2 - l1) * (l2x - l1x); kerxx = phi2xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p3_e3_ay(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi2(l2 - l1); kerx = phi2x(l2 - l1) * (l2x - l1x); - kery = phi2x(l2 - l1) * (l2y - l1y); kerxy = phi2xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi2(l2 - l1); kerx = phi2x(l2 - l1) * (l2x - l1x); + kery = phi2x(l2 - l1) * (l2y - l1y); kerxy = phi2xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p3_e3_bx(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi2(l2 - l1); kerx = phi2x(l2 - l1) * (l2x - l1x); - kery = phi2x(l2 - l1) * (l2y - l1y); kerxy = phi2xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi2(l2 - l1); kerx = phi2x(l2 - l1) * (l2x - l1x); + kery = phi2x(l2 - l1) * (l2y - l1y); kerxy = phi2xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p3_e3_by(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi2(l2 - l1); kery = phi2x(l2 - l1) * (l2y - l1y); keryy = phi2xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi2(l2 - l1); kery = phi2x(l2 - l1) * (l2y - l1y); keryy = phi2xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } /* BUBBLE */ /* Edge-based BUBBLE - order 3 */ - // EDGE 1 + // EDGE 1 static double gradleg_tri_p3_b1_a(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n11 * (l3 * l2 * Legendre1(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n11 * (l3 * l2 * Legendre1(l3 - l2)); } static double gradleg_tri_p3_b1_b(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n12 * (l3 * l2 * Legendre1(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n12 * (l3 * l2 * Legendre1(l3 - l2)); } static double gradleg_tri_p3_b1_ax(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n11 * (l3x * l2 * Legendre1(l3 - l2) + l3 * l2x * Legendre1(l3 - l2) + l3 * l2 * Legendre1x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n11 * (l3x * l2 * Legendre1(l3 - l2) + l3 * l2x * Legendre1(l3 - l2) + l3 * l2 * Legendre1x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p3_b1_bx(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n12 * (l3x * l2 * Legendre1(l3 - l2) + l3 * l2x * Legendre1(l3 - l2) + l3 * l2 * Legendre1x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n12 * (l3x * l2 * Legendre1(l3 - l2) + l3 * l2x * Legendre1(l3 - l2) + l3 * l2 * Legendre1x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p3_b1_ay(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n11 * (l3y * l2 * Legendre1(l3 - l2) + l3 * l2y * Legendre1(l3 - l2) + l3 * l2 * Legendre1x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n11 * (l3y * l2 * Legendre1(l3 - l2) + l3 * l2y * Legendre1(l3 - l2) + l3 * l2 * Legendre1x(l3 - l2) * (l3y - l2y)); } static double gradleg_tri_p3_b1_by(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n12 * (l3y * l2 * Legendre1(l3 - l2) + l3 * l2y * Legendre1(l3 - l2) + l3 * l2 * Legendre1x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n12 * (l3y * l2 * Legendre1(l3 - l2) + l3 * l2y * Legendre1(l3 - l2) + l3 * l2 * Legendre1x(l3 - l2) * (l3y - l2y)); } - // EDGE 2 + // EDGE 2 static double gradleg_tri_p3_b2_a(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n21 * (l1 * l3 * Legendre1(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n21 * (l1 * l3 * Legendre1(l1 - l3)); } static double gradleg_tri_p3_b2_b(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n22 * (l1 * l3 * Legendre1(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n22 * (l1 * l3 * Legendre1(l1 - l3)); } static double gradleg_tri_p3_b2_ax(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n21 * (l1x * l3 * Legendre1(l1 - l3) + l1 * l3x * Legendre1(l1 - l3) + l1 * l3 * Legendre1x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n21 * (l1x * l3 * Legendre1(l1 - l3) + l1 * l3x * Legendre1(l1 - l3) + l1 * l3 * Legendre1x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p3_b2_bx(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n22 * (l1x * l3 * Legendre1(l1 - l3) + l1 * l3x * Legendre1(l1 - l3) + l1 * l3 * Legendre1x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n22 * (l1x * l3 * Legendre1(l1 - l3) + l1 * l3x * Legendre1(l1 - l3) + l1 * l3 * Legendre1x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p3_b2_ay(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n21 * (l1y * l3 * Legendre1(l1 - l3) + l1 * l3y * Legendre1(l1 - l3) + l1 * l3 * Legendre1x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n21 * (l1y * l3 * Legendre1(l1 - l3) + l1 * l3y * Legendre1(l1 - l3) + l1 * l3 * Legendre1x(l1 - l3) * (l1y - l3y)); } static double gradleg_tri_p3_b2_by(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n22 * (l1y * l3 * Legendre1(l1 - l3) + l1 * l3y * Legendre1(l1 - l3) + l1 * l3 * Legendre1x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n22 * (l1y * l3 * Legendre1(l1 - l3) + l1 * l3y * Legendre1(l1 - l3) + l1 * l3 * Legendre1x(l1 - l3) * (l1y - l3y)); } - // EDGE 3 + // EDGE 3 static double gradleg_tri_p3_b3_a(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n31 * (l2 * l1 * Legendre1(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n31 * (l2 * l1 * Legendre1(l2 - l1)); } static double gradleg_tri_p3_b3_b(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n32 * (l2 * l1 * Legendre1(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n32 * (l2 * l1 * Legendre1(l2 - l1)); } static double gradleg_tri_p3_b3_ax(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n31 * (l2x * l1 * Legendre1(l2 - l1) + l2 * l1x * Legendre1(l2 - l1) + l2 * l1 * Legendre1x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n31 * (l2x * l1 * Legendre1(l2 - l1) + l2 * l1x * Legendre1(l2 - l1) + l2 * l1 * Legendre1x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p3_b3_bx(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n32 * (l2x * l1 * Legendre1(l2 - l1) + l2 * l1x * Legendre1(l2 - l1) + l2 * l1 * Legendre1x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n32 * (l2x * l1 * Legendre1(l2 - l1) + l2 * l1x * Legendre1(l2 - l1) + l2 * l1 * Legendre1x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p3_b3_ay(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n31 * (l2y * l1 * Legendre1(l2 - l1) + l2 * l1y * Legendre1(l2 - l1) + l2 * l1 * Legendre1x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n31 * (l2y * l1 * Legendre1(l2 - l1) + l2 * l1y * Legendre1(l2 - l1) + l2 * l1 * Legendre1x(l2 - l1) * (l2y - l1y)); } static double gradleg_tri_p3_b3_by(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n32 * (l2y * l1 * Legendre1(l2 - l1) + l2 * l1y * Legendre1(l2 - l1) + l2 * l1 * Legendre1x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n32 * (l2y * l1 * Legendre1(l2 - l1) + l2 * l1y * Legendre1(l2 - l1) + l2 * l1 * Legendre1x(l2 - l1) * (l2y - l1y)); } /* Genuine BUBBLE - order 3 */ static double gradleg_tri_b1_b1_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b1_b1_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b1_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b1_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b1_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b1_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b1_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b1_b1_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b1_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b1_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b1_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b1_2_ay(double x, double y) { - return 0.0; + return 0.0; } ///////////////////////////////// ORDER 4 ////////////////////////////////// /* EDGE FUNCTIONS - order 4*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p4_e1_a_0(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi3(l3 - l2) + l3 * l2x * phi3(l3 - l2) + l3 * l2 * phi3x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi3(l3 - l2) + l3 * l2x * phi3(l3 - l2) + l3 * l2 * phi3x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p4_e1_a_1(double x, double y) { - return -(gradleg_tri_p4_e1_a_0(x, y)); + return -(gradleg_tri_p4_e1_a_0(x, y)); } static double gradleg_tri_p4_e1_b_0(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi3(l3 - l2) + l3 * l2y * phi3(l3 - l2) + l3 * l2 * phi3x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi3(l3 - l2) + l3 * l2y * phi3(l3 - l2) + l3 * l2 * phi3x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p4_e1_b_1(double x, double y) { - return -(gradleg_tri_p4_e1_b_0(x, y)); + return -(gradleg_tri_p4_e1_b_0(x, y)); } static double gradleg_tri_p4_e1_ax_0(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi3(l3 - l2); kerx = phi3x(l3 - l2) * (l3x - l2x); kerxx = phi3xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi3(l3 - l2); kerx = phi3x(l3 - l2) * (l3x - l2x); kerxx = phi3xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p4_e1_ax_1(double x, double y) { - return -(gradleg_tri_p4_e1_ax_0(x, y)); + return -(gradleg_tri_p4_e1_ax_0(x, y)); } static double gradleg_tri_p4_e1_ay_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi3(l3 - l2); kerx = phi3x(l3 - l2) * (l3x - l2x); - kery = phi3x(l3 - l2) * (l3y - l2y); kerxy = phi3xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi3(l3 - l2); kerx = phi3x(l3 - l2) * (l3x - l2x); + kery = phi3x(l3 - l2) * (l3y - l2y); kerxy = phi3xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p4_e1_ay_1(double x, double y) { - return -(gradleg_tri_p4_e1_ay_0(x, y)); + return -(gradleg_tri_p4_e1_ay_0(x, y)); } static double gradleg_tri_p4_e1_bx_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi3(l3 - l2); kerx = phi3x(l3 - l2) * (l3x - l2x); - kery = phi3x(l3 - l2) * (l3y - l2y); kerxy = phi3xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi3(l3 - l2); kerx = phi3x(l3 - l2) * (l3x - l2x); + kery = phi3x(l3 - l2) * (l3y - l2y); kerxy = phi3xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p4_e1_bx_1(double x, double y) { - return -(gradleg_tri_p4_e1_bx_0(x, y)); + return -(gradleg_tri_p4_e1_bx_0(x, y)); } static double gradleg_tri_p4_e1_by_0(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi3(l3 - l2); kery = phi3x(l3 - l2) * (l3y - l2y); keryy = phi3xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi3(l3 - l2); kery = phi3x(l3 - l2) * (l3y - l2y); keryy = phi3xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } static double gradleg_tri_p4_e1_by_1(double x, double y) { - return -(gradleg_tri_p4_e1_by_0(x, y)); + return -(gradleg_tri_p4_e1_by_0(x, y)); } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p4_e2_a_0(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi3(l1 - l3) + l1 * l3x * phi3(l1 - l3) + l1 * l3 * phi3x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi3(l1 - l3) + l1 * l3x * phi3(l1 - l3) + l1 * l3 * phi3x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p4_e2_a_1(double x, double y) { - return -(gradleg_tri_p4_e2_a_0(x, y)); + return -(gradleg_tri_p4_e2_a_0(x, y)); } static double gradleg_tri_p4_e2_b_0(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi3(l1 - l3) + l1 * l3y * phi3(l1 - l3) + l1 * l3 * phi3x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi3(l1 - l3) + l1 * l3y * phi3(l1 - l3) + l1 * l3 * phi3x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p4_e2_b_1(double x, double y) { - return -(gradleg_tri_p4_e2_b_0(x, y)); + return -(gradleg_tri_p4_e2_b_0(x, y)); } static double gradleg_tri_p4_e2_ax_0(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi3(l1 - l3); kerx = phi3x(l1 - l3) * (l1x - l3x); kerxx = phi3xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi3(l1 - l3); kerx = phi3x(l1 - l3) * (l1x - l3x); kerxx = phi3xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p4_e2_ax_1(double x, double y) { - return -(gradleg_tri_p4_e2_ax_0(x, y)); + return -(gradleg_tri_p4_e2_ax_0(x, y)); } static double gradleg_tri_p4_e2_ay_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi3(l1 - l3); kerx = phi3x(l1 - l3) * (l1x - l3x); - kery = phi3x(l1 - l3) * (l1y - l3y); kerxy = phi3xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi3(l1 - l3); kerx = phi3x(l1 - l3) * (l1x - l3x); + kery = phi3x(l1 - l3) * (l1y - l3y); kerxy = phi3xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p4_e2_ay_1(double x, double y) { - return -(gradleg_tri_p4_e2_ay_0(x, y)); + return -(gradleg_tri_p4_e2_ay_0(x, y)); } static double gradleg_tri_p4_e2_bx_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi3(l1 - l3); kerx = phi3x(l1 - l3) * (l1x - l3x); - kery = phi3x(l1 - l3) * (l1y - l3y); kerxy = phi3xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi3(l1 - l3); kerx = phi3x(l1 - l3) * (l1x - l3x); + kery = phi3x(l1 - l3) * (l1y - l3y); kerxy = phi3xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p4_e2_bx_1(double x, double y) { - return -(gradleg_tri_p4_e2_bx_0(x, y)); + return -(gradleg_tri_p4_e2_bx_0(x, y)); } static double gradleg_tri_p4_e2_by_0(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi3(l1 - l3); kery = phi3x(l1 - l3) * (l1y - l3y); keryy = phi3xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi3(l1 - l3); kery = phi3x(l1 - l3) * (l1y - l3y); keryy = phi3xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } static double gradleg_tri_p4_e2_by_1(double x, double y) { - return -(gradleg_tri_p4_e2_by_0(x, y)); + return -(gradleg_tri_p4_e2_by_0(x, y)); } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p4_e3_a_0(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi3(l2 - l1) + l2 * l1x * phi3(l2 - l1) + l2 * l1 * phi3x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi3(l2 - l1) + l2 * l1x * phi3(l2 - l1) + l2 * l1 * phi3x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p4_e3_a_1(double x, double y) { - return -(gradleg_tri_p4_e3_a_0(x, y)); + return -(gradleg_tri_p4_e3_a_0(x, y)); } static double gradleg_tri_p4_e3_b_0(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi3(l2 - l1) + l2 * l1y * phi3(l2 - l1) + l2 * l1 * phi3x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi3(l2 - l1) + l2 * l1y * phi3(l2 - l1) + l2 * l1 * phi3x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p4_e3_b_1(double x, double y) { - return -(gradleg_tri_p4_e3_b_0(x, y)); + return -(gradleg_tri_p4_e3_b_0(x, y)); } static double gradleg_tri_p4_e3_ax_0(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi3(l2 - l1); kerx = phi3x(l2 - l1) * (l2x - l1x); kerxx = phi3xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi3(l2 - l1); kerx = phi3x(l2 - l1) * (l2x - l1x); kerxx = phi3xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p4_e3_ax_1(double x, double y) { - return -(gradleg_tri_p4_e3_ax_0(x, y)); + return -(gradleg_tri_p4_e3_ax_0(x, y)); } static double gradleg_tri_p4_e3_ay_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi3(l2 - l1); kerx = phi3x(l2 - l1) * (l2x - l1x); - kery = phi3x(l2 - l1) * (l2y - l1y); kerxy = phi3xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi3(l2 - l1); kerx = phi3x(l2 - l1) * (l2x - l1x); + kery = phi3x(l2 - l1) * (l2y - l1y); kerxy = phi3xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p4_e3_ay_1(double x, double y) { - return -(gradleg_tri_p4_e3_ay_0(x, y)); + return -(gradleg_tri_p4_e3_ay_0(x, y)); } static double gradleg_tri_p4_e3_bx_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi3(l2 - l1); kerx = phi3x(l2 - l1) * (l2x - l1x); - kery = phi3x(l2 - l1) * (l2y - l1y); kerxy = phi3xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi3(l2 - l1); kerx = phi3x(l2 - l1) * (l2x - l1x); + kery = phi3x(l2 - l1) * (l2y - l1y); kerxy = phi3xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p4_e3_bx_1(double x, double y) { - return -(gradleg_tri_p4_e3_bx_0(x, y)); + return -(gradleg_tri_p4_e3_bx_0(x, y)); } static double gradleg_tri_p4_e3_by_0(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi3(l2 - l1); kery = phi3x(l2 - l1) * (l2y - l1y); keryy = phi3xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi3(l2 - l1); kery = phi3x(l2 - l1) * (l2y - l1y); keryy = phi3xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } static double gradleg_tri_p4_e3_by_1(double x, double y) { - return -(gradleg_tri_p4_e3_by_0(x, y)); + return -(gradleg_tri_p4_e3_by_0(x, y)); } /* BUBBLE */ /* Edge-based BUBBLE - order 4 */ - // EDGE 1 + // EDGE 1 static double gradleg_tri_p4_b1_a(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n11 * (l3 * l2 * Legendre2(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n11 * (l3 * l2 * Legendre2(l3 - l2)); } static double gradleg_tri_p4_b1_b(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n12 * (l3 * l2 * Legendre2(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n12 * (l3 * l2 * Legendre2(l3 - l2)); } static double gradleg_tri_p4_b1_ax(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n11 * (l3x * l2 * Legendre2(l3 - l2) + l3 * l2x * Legendre2(l3 - l2) + l3 * l2 * Legendre2x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n11 * (l3x * l2 * Legendre2(l3 - l2) + l3 * l2x * Legendre2(l3 - l2) + l3 * l2 * Legendre2x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p4_b1_bx(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n12 * (l3x * l2 * Legendre2(l3 - l2) + l3 * l2x * Legendre2(l3 - l2) + l3 * l2 * Legendre2x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n12 * (l3x * l2 * Legendre2(l3 - l2) + l3 * l2x * Legendre2(l3 - l2) + l3 * l2 * Legendre2x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p4_b1_ay(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n11 * (l3y * l2 * Legendre2(l3 - l2) + l3 * l2y * Legendre2(l3 - l2) + l3 * l2 * Legendre2x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n11 * (l3y * l2 * Legendre2(l3 - l2) + l3 * l2y * Legendre2(l3 - l2) + l3 * l2 * Legendre2x(l3 - l2) * (l3y - l2y)); } static double gradleg_tri_p4_b1_by(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n12 * (l3y * l2 * Legendre2(l3 - l2) + l3 * l2y * Legendre2(l3 - l2) + l3 * l2 * Legendre2x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n12 * (l3y * l2 * Legendre2(l3 - l2) + l3 * l2y * Legendre2(l3 - l2) + l3 * l2 * Legendre2x(l3 - l2) * (l3y - l2y)); } - // EDGE 2 + // EDGE 2 static double gradleg_tri_p4_b2_a(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n21 * (l1 * l3 * Legendre2(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n21 * (l1 * l3 * Legendre2(l1 - l3)); } static double gradleg_tri_p4_b2_b(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n22 * (l1 * l3 * Legendre2(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n22 * (l1 * l3 * Legendre2(l1 - l3)); } static double gradleg_tri_p4_b2_ax(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n21 * (l1x * l3 * Legendre2(l1 - l3) + l1 * l3x * Legendre2(l1 - l3) + l1 * l3 * Legendre2x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n21 * (l1x * l3 * Legendre2(l1 - l3) + l1 * l3x * Legendre2(l1 - l3) + l1 * l3 * Legendre2x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p4_b2_bx(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n22 * (l1x * l3 * Legendre2(l1 - l3) + l1 * l3x * Legendre2(l1 - l3) + l1 * l3 * Legendre2x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n22 * (l1x * l3 * Legendre2(l1 - l3) + l1 * l3x * Legendre2(l1 - l3) + l1 * l3 * Legendre2x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p4_b2_ay(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n21 * (l1y * l3 * Legendre2(l1 - l3) + l1 * l3y * Legendre2(l1 - l3) + l1 * l3 * Legendre2x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n21 * (l1y * l3 * Legendre2(l1 - l3) + l1 * l3y * Legendre2(l1 - l3) + l1 * l3 * Legendre2x(l1 - l3) * (l1y - l3y)); } static double gradleg_tri_p4_b2_by(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n22 * (l1y * l3 * Legendre2(l1 - l3) + l1 * l3y * Legendre2(l1 - l3) + l1 * l3 * Legendre2x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n22 * (l1y * l3 * Legendre2(l1 - l3) + l1 * l3y * Legendre2(l1 - l3) + l1 * l3 * Legendre2x(l1 - l3) * (l1y - l3y)); } - // EDGE 3 + // EDGE 3 static double gradleg_tri_p4_b3_a(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n31 * (l2 * l1 * Legendre2(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n31 * (l2 * l1 * Legendre2(l2 - l1)); } static double gradleg_tri_p4_b3_b(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n32 * (l2 * l1 * Legendre2(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n32 * (l2 * l1 * Legendre2(l2 - l1)); } static double gradleg_tri_p4_b3_ax(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n31 * (l2x * l1 * Legendre2(l2 - l1) + l2 * l1x * Legendre2(l2 - l1) + l2 * l1 * Legendre2x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n31 * (l2x * l1 * Legendre2(l2 - l1) + l2 * l1x * Legendre2(l2 - l1) + l2 * l1 * Legendre2x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p4_b3_bx(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n32 * (l2x * l1 * Legendre2(l2 - l1) + l2 * l1x * Legendre2(l2 - l1) + l2 * l1 * Legendre2x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n32 * (l2x * l1 * Legendre2(l2 - l1) + l2 * l1x * Legendre2(l2 - l1) + l2 * l1 * Legendre2x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p4_b3_ay(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n31 * (l2y * l1 * Legendre2(l2 - l1) + l2 * l1y * Legendre2(l2 - l1) + l2 * l1 * Legendre2x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n31 * (l2y * l1 * Legendre2(l2 - l1) + l2 * l1y * Legendre2(l2 - l1) + l2 * l1 * Legendre2x(l2 - l1) * (l2y - l1y)); } static double gradleg_tri_p4_b3_by(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n32 * (l2y * l1 * Legendre2(l2 - l1) + l2 * l1y * Legendre2(l2 - l1) + l2 * l1 * Legendre2x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n32 * (l2y * l1 * Legendre2(l2 - l1) + l2 * l1y * Legendre2(l2 - l1) + l2 * l1 * Legendre2x(l2 - l1) * (l2y - l1y)); } /* Genuine BUBBLE - order 4 */ static double gradleg_tri_b1_b2_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b1_b2_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b2_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b2_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b2_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b2_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b2_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b1_b2_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b2_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b2_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b2_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b2_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b1_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b2_b1_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b1_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b1_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b1_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b1_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b1_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b2_b1_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b1_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b1_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b1_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b1_2_ay(double x, double y) { - return 0.0; + return 0.0; } ///////////////////////////////// ORDER 5 ////////////////////////////////// /* EDGE FUNCTIONS - order 5*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p5_e1_a(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi4(l3 - l2) + l3 * l2x * phi4(l3 - l2) + l3 * l2 * phi4x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi4(l3 - l2) + l3 * l2x * phi4(l3 - l2) + l3 * l2 * phi4x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p5_e1_b(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi4(l3 - l2) + l3 * l2y * phi4(l3 - l2) + l3 * l2 * phi4x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi4(l3 - l2) + l3 * l2y * phi4(l3 - l2) + l3 * l2 * phi4x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p5_e1_ax(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi4(l3 - l2); kerx = phi4x(l3 - l2) * (l3x - l2x); kerxx = phi4xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi4(l3 - l2); kerx = phi4x(l3 - l2) * (l3x - l2x); kerxx = phi4xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p5_e1_ay(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi4(l3 - l2); kerx = phi4x(l3 - l2) * (l3x - l2x); - kery = phi4x(l3 - l2) * (l3y - l2y); kerxy = phi4xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi4(l3 - l2); kerx = phi4x(l3 - l2) * (l3x - l2x); + kery = phi4x(l3 - l2) * (l3y - l2y); kerxy = phi4xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p5_e1_bx(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi4(l3 - l2); kerx = phi4x(l3 - l2) * (l3x - l2x); - kery = phi4x(l3 - l2) * (l3y - l2y); kerxy = phi4xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi4(l3 - l2); kerx = phi4x(l3 - l2) * (l3x - l2x); + kery = phi4x(l3 - l2) * (l3y - l2y); kerxy = phi4xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p5_e1_by(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi4(l3 - l2); kery = phi4x(l3 - l2) * (l3y - l2y); keryy = phi4xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi4(l3 - l2); kery = phi4x(l3 - l2) * (l3y - l2y); keryy = phi4xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p5_e2_a(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi4(l1 - l3) + l1 * l3x * phi4(l1 - l3) + l1 * l3 * phi4x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi4(l1 - l3) + l1 * l3x * phi4(l1 - l3) + l1 * l3 * phi4x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p5_e2_b(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi4(l1 - l3) + l1 * l3y * phi4(l1 - l3) + l1 * l3 * phi4x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi4(l1 - l3) + l1 * l3y * phi4(l1 - l3) + l1 * l3 * phi4x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p5_e2_ax(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi4(l1 - l3); kerx = phi4x(l1 - l3) * (l1x - l3x); kerxx = phi4xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi4(l1 - l3); kerx = phi4x(l1 - l3) * (l1x - l3x); kerxx = phi4xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p5_e2_ay(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi4(l1 - l3); kerx = phi4x(l1 - l3) * (l1x - l3x); - kery = phi4x(l1 - l3) * (l1y - l3y); kerxy = phi4xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi4(l1 - l3); kerx = phi4x(l1 - l3) * (l1x - l3x); + kery = phi4x(l1 - l3) * (l1y - l3y); kerxy = phi4xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p5_e2_bx(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi4(l1 - l3); kerx = phi4x(l1 - l3) * (l1x - l3x); - kery = phi4x(l1 - l3) * (l1y - l3y); kerxy = phi4xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi4(l1 - l3); kerx = phi4x(l1 - l3) * (l1x - l3x); + kery = phi4x(l1 - l3) * (l1y - l3y); kerxy = phi4xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p5_e2_by(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi4(l1 - l3); kery = phi4x(l1 - l3) * (l1y - l3y); keryy = phi4xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi4(l1 - l3); kery = phi4x(l1 - l3) * (l1y - l3y); keryy = phi4xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p5_e3_a(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi4(l2 - l1) + l2 * l1x * phi4(l2 - l1) + l2 * l1 * phi4x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi4(l2 - l1) + l2 * l1x * phi4(l2 - l1) + l2 * l1 * phi4x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p5_e3_b(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi4(l2 - l1) + l2 * l1y * phi4(l2 - l1) + l2 * l1 * phi4x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi4(l2 - l1) + l2 * l1y * phi4(l2 - l1) + l2 * l1 * phi4x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p5_e3_ax(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi4(l2 - l1); kerx = phi4x(l2 - l1) * (l2x - l1x); kerxx = phi4xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi4(l2 - l1); kerx = phi4x(l2 - l1) * (l2x - l1x); kerxx = phi4xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p5_e3_ay(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi4(l2 - l1); kerx = phi4x(l2 - l1) * (l2x - l1x); - kery = phi4x(l2 - l1) * (l2y - l1y); kerxy = phi4xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi4(l2 - l1); kerx = phi4x(l2 - l1) * (l2x - l1x); + kery = phi4x(l2 - l1) * (l2y - l1y); kerxy = phi4xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p5_e3_bx(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi4(l2 - l1); kerx = phi4x(l2 - l1) * (l2x - l1x); - kery = phi4x(l2 - l1) * (l2y - l1y); kerxy = phi4xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi4(l2 - l1); kerx = phi4x(l2 - l1) * (l2x - l1x); + kery = phi4x(l2 - l1) * (l2y - l1y); kerxy = phi4xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p5_e3_by(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi4(l2 - l1); kery = phi4x(l2 - l1) * (l2y - l1y); keryy = phi4xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi4(l2 - l1); kery = phi4x(l2 - l1) * (l2y - l1y); keryy = phi4xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } /* BUBBLE */ /* Edge-based BUBBLE - order 5 */ - // EDGE 1 + // EDGE 1 static double gradleg_tri_p5_b1_a(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n11 * (l3 * l2 * Legendre3(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n11 * (l3 * l2 * Legendre3(l3 - l2)); } static double gradleg_tri_p5_b1_b(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n12 * (l3 * l2 * Legendre3(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n12 * (l3 * l2 * Legendre3(l3 - l2)); } static double gradleg_tri_p5_b1_ax(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n11 * (l3x * l2 * Legendre3(l3 - l2) + l3 * l2x * Legendre3(l3 - l2) + l3 * l2 * Legendre3x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n11 * (l3x * l2 * Legendre3(l3 - l2) + l3 * l2x * Legendre3(l3 - l2) + l3 * l2 * Legendre3x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p5_b1_bx(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n12 * (l3x * l2 * Legendre3(l3 - l2) + l3 * l2x * Legendre3(l3 - l2) + l3 * l2 * Legendre3x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n12 * (l3x * l2 * Legendre3(l3 - l2) + l3 * l2x * Legendre3(l3 - l2) + l3 * l2 * Legendre3x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p5_b1_ay(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n11 * (l3y * l2 * Legendre3(l3 - l2) + l3 * l2y * Legendre3(l3 - l2) + l3 * l2 * Legendre3x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n11 * (l3y * l2 * Legendre3(l3 - l2) + l3 * l2y * Legendre3(l3 - l2) + l3 * l2 * Legendre3x(l3 - l2) * (l3y - l2y)); } static double gradleg_tri_p5_b1_by(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n12 * (l3y * l2 * Legendre3(l3 - l2) + l3 * l2y * Legendre3(l3 - l2) + l3 * l2 * Legendre3x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n12 * (l3y * l2 * Legendre3(l3 - l2) + l3 * l2y * Legendre3(l3 - l2) + l3 * l2 * Legendre3x(l3 - l2) * (l3y - l2y)); } - // EDGE 2 + // EDGE 2 static double gradleg_tri_p5_b2_a(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n21 * (l1 * l3 * Legendre3(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n21 * (l1 * l3 * Legendre3(l1 - l3)); } static double gradleg_tri_p5_b2_b(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n22 * (l1 * l3 * Legendre3(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n22 * (l1 * l3 * Legendre3(l1 - l3)); } static double gradleg_tri_p5_b2_ax(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n21 * (l1x * l3 * Legendre3(l1 - l3) + l1 * l3x * Legendre3(l1 - l3) + l1 * l3 * Legendre3x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n21 * (l1x * l3 * Legendre3(l1 - l3) + l1 * l3x * Legendre3(l1 - l3) + l1 * l3 * Legendre3x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p5_b2_bx(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n22 * (l1x * l3 * Legendre3(l1 - l3) + l1 * l3x * Legendre3(l1 - l3) + l1 * l3 * Legendre3x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n22 * (l1x * l3 * Legendre3(l1 - l3) + l1 * l3x * Legendre3(l1 - l3) + l1 * l3 * Legendre3x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p5_b2_ay(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n21 * (l1y * l3 * Legendre3(l1 - l3) + l1 * l3y * Legendre3(l1 - l3) + l1 * l3 * Legendre3x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n21 * (l1y * l3 * Legendre3(l1 - l3) + l1 * l3y * Legendre3(l1 - l3) + l1 * l3 * Legendre3x(l1 - l3) * (l1y - l3y)); } static double gradleg_tri_p5_b2_by(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n22 * (l1y * l3 * Legendre3(l1 - l3) + l1 * l3y * Legendre3(l1 - l3) + l1 * l3 * Legendre3x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n22 * (l1y * l3 * Legendre3(l1 - l3) + l1 * l3y * Legendre3(l1 - l3) + l1 * l3 * Legendre3x(l1 - l3) * (l1y - l3y)); } - // EDGE 3 + // EDGE 3 static double gradleg_tri_p5_b3_a(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n31 * (l2 * l1 * Legendre3(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n31 * (l2 * l1 * Legendre3(l2 - l1)); } static double gradleg_tri_p5_b3_b(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n32 * (l2 * l1 * Legendre3(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n32 * (l2 * l1 * Legendre3(l2 - l1)); } static double gradleg_tri_p5_b3_ax(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n31 * (l2x * l1 * Legendre3(l2 - l1) + l2 * l1x * Legendre3(l2 - l1) + l2 * l1 * Legendre3x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n31 * (l2x * l1 * Legendre3(l2 - l1) + l2 * l1x * Legendre3(l2 - l1) + l2 * l1 * Legendre3x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p5_b3_bx(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n32 * (l2x * l1 * Legendre3(l2 - l1) + l2 * l1x * Legendre3(l2 - l1) + l2 * l1 * Legendre3x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n32 * (l2x * l1 * Legendre3(l2 - l1) + l2 * l1x * Legendre3(l2 - l1) + l2 * l1 * Legendre3x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p5_b3_ay(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n31 * (l2y * l1 * Legendre3(l2 - l1) + l2 * l1y * Legendre3(l2 - l1) + l2 * l1 * Legendre3x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n31 * (l2y * l1 * Legendre3(l2 - l1) + l2 * l1y * Legendre3(l2 - l1) + l2 * l1 * Legendre3x(l2 - l1) * (l2y - l1y)); } static double gradleg_tri_p5_b3_by(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n32 * (l2y * l1 * Legendre3(l2 - l1) + l2 * l1y * Legendre3(l2 - l1) + l2 * l1 * Legendre3x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n32 * (l2y * l1 * Legendre3(l2 - l1) + l2 * l1y * Legendre3(l2 - l1) + l2 * l1 * Legendre3x(l2 - l1) * (l2y - l1y)); } /* Genuine BUBBLE - order 5 */ static double gradleg_tri_b1_b3_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b1_b3_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b3_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b3_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b3_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b3_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b3_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b1_b3_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b3_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b3_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b3_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b3_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b2_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b2_b2_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b2_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b2_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b2_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b2_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b2_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b2_b2_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b2_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b2_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b2_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b2_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b1_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b3_b1_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b1_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b1_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b1_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b1_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b1_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b3_b1_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b1_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b1_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b1_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b1_2_ay(double x, double y) { - return 0.0; + return 0.0; } ///////////////////////////////// ORDER 6 ////////////////////////////////// /* EDGE FUNCTIONS - order 6*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p6_e1_a_0(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi5(l3 - l2) + l3 * l2x * phi5(l3 - l2) + l3 * l2 * phi5x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi5(l3 - l2) + l3 * l2x * phi5(l3 - l2) + l3 * l2 * phi5x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p6_e1_a_1(double x, double y) { - return -(gradleg_tri_p6_e1_a_0(x, y)); + return -(gradleg_tri_p6_e1_a_0(x, y)); } static double gradleg_tri_p6_e1_b_0(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi5(l3 - l2) + l3 * l2y * phi5(l3 - l2) + l3 * l2 * phi5x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi5(l3 - l2) + l3 * l2y * phi5(l3 - l2) + l3 * l2 * phi5x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p6_e1_b_1(double x, double y) { - return -(gradleg_tri_p6_e1_b_0(x, y)); + return -(gradleg_tri_p6_e1_b_0(x, y)); } static double gradleg_tri_p6_e1_ax_0(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi5(l3 - l2); kerx = phi5x(l3 - l2) * (l3x - l2x); kerxx = phi5xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi5(l3 - l2); kerx = phi5x(l3 - l2) * (l3x - l2x); kerxx = phi5xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p6_e1_ax_1(double x, double y) { - return -(gradleg_tri_p6_e1_ax_0(x, y)); + return -(gradleg_tri_p6_e1_ax_0(x, y)); } static double gradleg_tri_p6_e1_ay_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi5(l3 - l2); kerx = phi5x(l3 - l2) * (l3x - l2x); - kery = phi5x(l3 - l2) * (l3y - l2y); kerxy = phi5xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi5(l3 - l2); kerx = phi5x(l3 - l2) * (l3x - l2x); + kery = phi5x(l3 - l2) * (l3y - l2y); kerxy = phi5xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p6_e1_ay_1(double x, double y) { - return -(gradleg_tri_p6_e1_ay_0(x, y)); + return -(gradleg_tri_p6_e1_ay_0(x, y)); } static double gradleg_tri_p6_e1_bx_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi5(l3 - l2); kerx = phi5x(l3 - l2) * (l3x - l2x); - kery = phi5x(l3 - l2) * (l3y - l2y); kerxy = phi5xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi5(l3 - l2); kerx = phi5x(l3 - l2) * (l3x - l2x); + kery = phi5x(l3 - l2) * (l3y - l2y); kerxy = phi5xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p6_e1_bx_1(double x, double y) { - return -(gradleg_tri_p6_e1_bx_0(x, y)); + return -(gradleg_tri_p6_e1_bx_0(x, y)); } static double gradleg_tri_p6_e1_by_0(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi5(l3 - l2); kery = phi5x(l3 - l2) * (l3y - l2y); keryy = phi5xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi5(l3 - l2); kery = phi5x(l3 - l2) * (l3y - l2y); keryy = phi5xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } static double gradleg_tri_p6_e1_by_1(double x, double y) { - return -(gradleg_tri_p6_e1_by_0(x, y)); + return -(gradleg_tri_p6_e1_by_0(x, y)); } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p6_e2_a_0(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi5(l1 - l3) + l1 * l3x * phi5(l1 - l3) + l1 * l3 * phi5x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi5(l1 - l3) + l1 * l3x * phi5(l1 - l3) + l1 * l3 * phi5x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p6_e2_a_1(double x, double y) { - return -(gradleg_tri_p6_e2_a_0(x, y)); + return -(gradleg_tri_p6_e2_a_0(x, y)); } static double gradleg_tri_p6_e2_b_0(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi5(l1 - l3) + l1 * l3y * phi5(l1 - l3) + l1 * l3 * phi5x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi5(l1 - l3) + l1 * l3y * phi5(l1 - l3) + l1 * l3 * phi5x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p6_e2_b_1(double x, double y) { - return -(gradleg_tri_p6_e2_b_0(x, y)); + return -(gradleg_tri_p6_e2_b_0(x, y)); } static double gradleg_tri_p6_e2_ax_0(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi5(l1 - l3); kerx = phi5x(l1 - l3) * (l1x - l3x); kerxx = phi5xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi5(l1 - l3); kerx = phi5x(l1 - l3) * (l1x - l3x); kerxx = phi5xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p6_e2_ax_1(double x, double y) { - return -(gradleg_tri_p6_e2_ax_0(x, y)); + return -(gradleg_tri_p6_e2_ax_0(x, y)); } static double gradleg_tri_p6_e2_ay_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi5(l1 - l3); kerx = phi5x(l1 - l3) * (l1x - l3x); - kery = phi5x(l1 - l3) * (l1y - l3y); kerxy = phi5xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi5(l1 - l3); kerx = phi5x(l1 - l3) * (l1x - l3x); + kery = phi5x(l1 - l3) * (l1y - l3y); kerxy = phi5xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p6_e2_ay_1(double x, double y) { - return -(gradleg_tri_p6_e2_ay_0(x, y)); + return -(gradleg_tri_p6_e2_ay_0(x, y)); } static double gradleg_tri_p6_e2_bx_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi5(l1 - l3); kerx = phi5x(l1 - l3) * (l1x - l3x); - kery = phi5x(l1 - l3) * (l1y - l3y); kerxy = phi5xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi5(l1 - l3); kerx = phi5x(l1 - l3) * (l1x - l3x); + kery = phi5x(l1 - l3) * (l1y - l3y); kerxy = phi5xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p6_e2_bx_1(double x, double y) { - return -(gradleg_tri_p6_e2_bx_0(x, y)); + return -(gradleg_tri_p6_e2_bx_0(x, y)); } static double gradleg_tri_p6_e2_by_0(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi5(l1 - l3); kery = phi5x(l1 - l3) * (l1y - l3y); keryy = phi5xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi5(l1 - l3); kery = phi5x(l1 - l3) * (l1y - l3y); keryy = phi5xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } static double gradleg_tri_p6_e2_by_1(double x, double y) { - return -(gradleg_tri_p6_e2_by_0(x, y)); + return -(gradleg_tri_p6_e2_by_0(x, y)); } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p6_e3_a_0(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi5(l2 - l1) + l2 * l1x * phi5(l2 - l1) + l2 * l1 * phi5x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi5(l2 - l1) + l2 * l1x * phi5(l2 - l1) + l2 * l1 * phi5x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p6_e3_a_1(double x, double y) { - return -(gradleg_tri_p6_e3_a_0(x, y)); + return -(gradleg_tri_p6_e3_a_0(x, y)); } static double gradleg_tri_p6_e3_b_0(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi5(l2 - l1) + l2 * l1y * phi5(l2 - l1) + l2 * l1 * phi5x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi5(l2 - l1) + l2 * l1y * phi5(l2 - l1) + l2 * l1 * phi5x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p6_e3_b_1(double x, double y) { - return -(gradleg_tri_p6_e3_b_0(x, y)); + return -(gradleg_tri_p6_e3_b_0(x, y)); } static double gradleg_tri_p6_e3_ax_0(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi5(l2 - l1); kerx = phi5x(l2 - l1) * (l2x - l1x); kerxx = phi5xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi5(l2 - l1); kerx = phi5x(l2 - l1) * (l2x - l1x); kerxx = phi5xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p6_e3_ax_1(double x, double y) { - return -(gradleg_tri_p6_e3_ax_0(x, y)); + return -(gradleg_tri_p6_e3_ax_0(x, y)); } static double gradleg_tri_p6_e3_ay_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi5(l2 - l1); kerx = phi5x(l2 - l1) * (l2x - l1x); - kery = phi5x(l2 - l1) * (l2y - l1y); kerxy = phi5xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi5(l2 - l1); kerx = phi5x(l2 - l1) * (l2x - l1x); + kery = phi5x(l2 - l1) * (l2y - l1y); kerxy = phi5xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p6_e3_ay_1(double x, double y) { - return -(gradleg_tri_p6_e3_ay_0(x, y)); + return -(gradleg_tri_p6_e3_ay_0(x, y)); } static double gradleg_tri_p6_e3_bx_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi5(l2 - l1); kerx = phi5x(l2 - l1) * (l2x - l1x); - kery = phi5x(l2 - l1) * (l2y - l1y); kerxy = phi5xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi5(l2 - l1); kerx = phi5x(l2 - l1) * (l2x - l1x); + kery = phi5x(l2 - l1) * (l2y - l1y); kerxy = phi5xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p6_e3_bx_1(double x, double y) { - return -(gradleg_tri_p6_e3_bx_0(x, y)); + return -(gradleg_tri_p6_e3_bx_0(x, y)); } static double gradleg_tri_p6_e3_by_0(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi5(l2 - l1); kery = phi5x(l2 - l1) * (l2y - l1y); keryy = phi5xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi5(l2 - l1); kery = phi5x(l2 - l1) * (l2y - l1y); keryy = phi5xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } static double gradleg_tri_p6_e3_by_1(double x, double y) { - return -(gradleg_tri_p6_e3_by_0(x, y)); + return -(gradleg_tri_p6_e3_by_0(x, y)); } /* BUBBLE */ /* Edge-based BUBBLE - order 6 */ - // EDGE 1 + // EDGE 1 static double gradleg_tri_p6_b1_a(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n11 * (l3 * l2 * Legendre4(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n11 * (l3 * l2 * Legendre4(l3 - l2)); } static double gradleg_tri_p6_b1_b(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n12 * (l3 * l2 * Legendre4(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n12 * (l3 * l2 * Legendre4(l3 - l2)); } static double gradleg_tri_p6_b1_ax(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n11 * (l3x * l2 * Legendre4(l3 - l2) + l3 * l2x * Legendre4(l3 - l2) + l3 * l2 * Legendre4x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n11 * (l3x * l2 * Legendre4(l3 - l2) + l3 * l2x * Legendre4(l3 - l2) + l3 * l2 * Legendre4x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p6_b1_bx(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n12 * (l3x * l2 * Legendre4(l3 - l2) + l3 * l2x * Legendre4(l3 - l2) + l3 * l2 * Legendre4x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n12 * (l3x * l2 * Legendre4(l3 - l2) + l3 * l2x * Legendre4(l3 - l2) + l3 * l2 * Legendre4x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p6_b1_ay(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n11 * (l3y * l2 * Legendre4(l3 - l2) + l3 * l2y * Legendre4(l3 - l2) + l3 * l2 * Legendre4x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n11 * (l3y * l2 * Legendre4(l3 - l2) + l3 * l2y * Legendre4(l3 - l2) + l3 * l2 * Legendre4x(l3 - l2) * (l3y - l2y)); } static double gradleg_tri_p6_b1_by(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n12 * (l3y * l2 * Legendre4(l3 - l2) + l3 * l2y * Legendre4(l3 - l2) + l3 * l2 * Legendre4x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n12 * (l3y * l2 * Legendre4(l3 - l2) + l3 * l2y * Legendre4(l3 - l2) + l3 * l2 * Legendre4x(l3 - l2) * (l3y - l2y)); } - // EDGE 2 + // EDGE 2 static double gradleg_tri_p6_b2_a(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n21 * (l1 * l3 * Legendre4(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n21 * (l1 * l3 * Legendre4(l1 - l3)); } static double gradleg_tri_p6_b2_b(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n22 * (l1 * l3 * Legendre4(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n22 * (l1 * l3 * Legendre4(l1 - l3)); } static double gradleg_tri_p6_b2_ax(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n21 * (l1x * l3 * Legendre4(l1 - l3) + l1 * l3x * Legendre4(l1 - l3) + l1 * l3 * Legendre4x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n21 * (l1x * l3 * Legendre4(l1 - l3) + l1 * l3x * Legendre4(l1 - l3) + l1 * l3 * Legendre4x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p6_b2_bx(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n22 * (l1x * l3 * Legendre4(l1 - l3) + l1 * l3x * Legendre4(l1 - l3) + l1 * l3 * Legendre4x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n22 * (l1x * l3 * Legendre4(l1 - l3) + l1 * l3x * Legendre4(l1 - l3) + l1 * l3 * Legendre4x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p6_b2_ay(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n21 * (l1y * l3 * Legendre4(l1 - l3) + l1 * l3y * Legendre4(l1 - l3) + l1 * l3 * Legendre4x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n21 * (l1y * l3 * Legendre4(l1 - l3) + l1 * l3y * Legendre4(l1 - l3) + l1 * l3 * Legendre4x(l1 - l3) * (l1y - l3y)); } static double gradleg_tri_p6_b2_by(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n22 * (l1y * l3 * Legendre4(l1 - l3) + l1 * l3y * Legendre4(l1 - l3) + l1 * l3 * Legendre4x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n22 * (l1y * l3 * Legendre4(l1 - l3) + l1 * l3y * Legendre4(l1 - l3) + l1 * l3 * Legendre4x(l1 - l3) * (l1y - l3y)); } - // EDGE 3 + // EDGE 3 static double gradleg_tri_p6_b3_a(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n31 * (l2 * l1 * Legendre4(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n31 * (l2 * l1 * Legendre4(l2 - l1)); } static double gradleg_tri_p6_b3_b(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n32 * (l2 * l1 * Legendre4(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n32 * (l2 * l1 * Legendre4(l2 - l1)); } static double gradleg_tri_p6_b3_ax(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n31 * (l2x * l1 * Legendre4(l2 - l1) + l2 * l1x * Legendre4(l2 - l1) + l2 * l1 * Legendre4x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n31 * (l2x * l1 * Legendre4(l2 - l1) + l2 * l1x * Legendre4(l2 - l1) + l2 * l1 * Legendre4x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p6_b3_bx(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n32 * (l2x * l1 * Legendre4(l2 - l1) + l2 * l1x * Legendre4(l2 - l1) + l2 * l1 * Legendre4x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n32 * (l2x * l1 * Legendre4(l2 - l1) + l2 * l1x * Legendre4(l2 - l1) + l2 * l1 * Legendre4x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p6_b3_ay(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n31 * (l2y * l1 * Legendre4(l2 - l1) + l2 * l1y * Legendre4(l2 - l1) + l2 * l1 * Legendre4x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n31 * (l2y * l1 * Legendre4(l2 - l1) + l2 * l1y * Legendre4(l2 - l1) + l2 * l1 * Legendre4x(l2 - l1) * (l2y - l1y)); } static double gradleg_tri_p6_b3_by(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n32 * (l2y * l1 * Legendre4(l2 - l1) + l2 * l1y * Legendre4(l2 - l1) + l2 * l1 * Legendre4x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n32 * (l2y * l1 * Legendre4(l2 - l1) + l2 * l1y * Legendre4(l2 - l1) + l2 * l1 * Legendre4x(l2 - l1) * (l2y - l1y)); } /* Genuine BUBBLE - order 6 */ static double gradleg_tri_b1_b4_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b1_b4_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b4_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b4_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b4_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b4_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b4_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b1_b4_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b4_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b4_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b4_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b4_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b3_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b2_b3_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b3_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b3_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b3_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b3_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b3_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b2_b3_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b3_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b3_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b3_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b3_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b2_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b3_b2_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b2_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b2_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b2_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b2_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b2_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b3_b2_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b2_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b2_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b2_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b2_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b1_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b4_b1_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b1_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b1_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b1_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b1_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b1_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b4_b1_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b1_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b1_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b1_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b1_2_ay(double x, double y) { - return 0.0; + return 0.0; } ///////////////////////////////// ORDER 7 ////////////////////////////////// /* EDGE FUNCTIONS - order 7*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p7_e1_a(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi6(l3 - l2) + l3 * l2x * phi6(l3 - l2) + l3 * l2 * phi6x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi6(l3 - l2) + l3 * l2x * phi6(l3 - l2) + l3 * l2 * phi6x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p7_e1_b(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi6(l3 - l2) + l3 * l2y * phi6(l3 - l2) + l3 * l2 * phi6x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi6(l3 - l2) + l3 * l2y * phi6(l3 - l2) + l3 * l2 * phi6x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p7_e1_ax(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi6(l3 - l2); kerx = phi6x(l3 - l2) * (l3x - l2x); kerxx = phi6xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi6(l3 - l2); kerx = phi6x(l3 - l2) * (l3x - l2x); kerxx = phi6xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p7_e1_ay(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi6(l3 - l2); kerx = phi6x(l3 - l2) * (l3x - l2x); - kery = phi6x(l3 - l2) * (l3y - l2y); kerxy = phi6xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi6(l3 - l2); kerx = phi6x(l3 - l2) * (l3x - l2x); + kery = phi6x(l3 - l2) * (l3y - l2y); kerxy = phi6xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p7_e1_bx(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi6(l3 - l2); kerx = phi6x(l3 - l2) * (l3x - l2x); - kery = phi6x(l3 - l2) * (l3y - l2y); kerxy = phi6xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi6(l3 - l2); kerx = phi6x(l3 - l2) * (l3x - l2x); + kery = phi6x(l3 - l2) * (l3y - l2y); kerxy = phi6xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p7_e1_by(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi6(l3 - l2); kery = phi6x(l3 - l2) * (l3y - l2y); keryy = phi6xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi6(l3 - l2); kery = phi6x(l3 - l2) * (l3y - l2y); keryy = phi6xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p7_e2_a(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi6(l1 - l3) + l1 * l3x * phi6(l1 - l3) + l1 * l3 * phi6x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi6(l1 - l3) + l1 * l3x * phi6(l1 - l3) + l1 * l3 * phi6x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p7_e2_b(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi6(l1 - l3) + l1 * l3y * phi6(l1 - l3) + l1 * l3 * phi6x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi6(l1 - l3) + l1 * l3y * phi6(l1 - l3) + l1 * l3 * phi6x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p7_e2_ax(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi6(l1 - l3); kerx = phi6x(l1 - l3) * (l1x - l3x); kerxx = phi6xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi6(l1 - l3); kerx = phi6x(l1 - l3) * (l1x - l3x); kerxx = phi6xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p7_e2_ay(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi6(l1 - l3); kerx = phi6x(l1 - l3) * (l1x - l3x); - kery = phi6x(l1 - l3) * (l1y - l3y); kerxy = phi6xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi6(l1 - l3); kerx = phi6x(l1 - l3) * (l1x - l3x); + kery = phi6x(l1 - l3) * (l1y - l3y); kerxy = phi6xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p7_e2_bx(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi6(l1 - l3); kerx = phi6x(l1 - l3) * (l1x - l3x); - kery = phi6x(l1 - l3) * (l1y - l3y); kerxy = phi6xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi6(l1 - l3); kerx = phi6x(l1 - l3) * (l1x - l3x); + kery = phi6x(l1 - l3) * (l1y - l3y); kerxy = phi6xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p7_e2_by(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi6(l1 - l3); kery = phi6x(l1 - l3) * (l1y - l3y); keryy = phi6xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi6(l1 - l3); kery = phi6x(l1 - l3) * (l1y - l3y); keryy = phi6xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p7_e3_a(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi6(l2 - l1) + l2 * l1x * phi6(l2 - l1) + l2 * l1 * phi6x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi6(l2 - l1) + l2 * l1x * phi6(l2 - l1) + l2 * l1 * phi6x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p7_e3_b(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi6(l2 - l1) + l2 * l1y * phi6(l2 - l1) + l2 * l1 * phi6x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi6(l2 - l1) + l2 * l1y * phi6(l2 - l1) + l2 * l1 * phi6x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p7_e3_ax(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi6(l2 - l1); kerx = phi6x(l2 - l1) * (l2x - l1x); kerxx = phi6xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi6(l2 - l1); kerx = phi6x(l2 - l1) * (l2x - l1x); kerxx = phi6xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p7_e3_ay(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi6(l2 - l1); kerx = phi6x(l2 - l1) * (l2x - l1x); - kery = phi6x(l2 - l1) * (l2y - l1y); kerxy = phi6xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi6(l2 - l1); kerx = phi6x(l2 - l1) * (l2x - l1x); + kery = phi6x(l2 - l1) * (l2y - l1y); kerxy = phi6xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p7_e3_bx(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi6(l2 - l1); kerx = phi6x(l2 - l1) * (l2x - l1x); - kery = phi6x(l2 - l1) * (l2y - l1y); kerxy = phi6xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi6(l2 - l1); kerx = phi6x(l2 - l1) * (l2x - l1x); + kery = phi6x(l2 - l1) * (l2y - l1y); kerxy = phi6xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p7_e3_by(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi6(l2 - l1); kery = phi6x(l2 - l1) * (l2y - l1y); keryy = phi6xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi6(l2 - l1); kery = phi6x(l2 - l1) * (l2y - l1y); keryy = phi6xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } /* BUBBLE */ /* Edge-based BUBBLE - order 7 */ - // EDGE 1 + // EDGE 1 static double gradleg_tri_p7_b1_a(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n11 * (l3 * l2 * Legendre5(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n11 * (l3 * l2 * Legendre5(l3 - l2)); } static double gradleg_tri_p7_b1_b(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n12 * (l3 * l2 * Legendre5(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n12 * (l3 * l2 * Legendre5(l3 - l2)); } static double gradleg_tri_p7_b1_ax(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n11 * (l3x * l2 * Legendre5(l3 - l2) + l3 * l2x * Legendre5(l3 - l2) + l3 * l2 * Legendre5x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n11 * (l3x * l2 * Legendre5(l3 - l2) + l3 * l2x * Legendre5(l3 - l2) + l3 * l2 * Legendre5x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p7_b1_bx(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n12 * (l3x * l2 * Legendre5(l3 - l2) + l3 * l2x * Legendre5(l3 - l2) + l3 * l2 * Legendre5x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n12 * (l3x * l2 * Legendre5(l3 - l2) + l3 * l2x * Legendre5(l3 - l2) + l3 * l2 * Legendre5x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p7_b1_ay(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n11 * (l3y * l2 * Legendre5(l3 - l2) + l3 * l2y * Legendre5(l3 - l2) + l3 * l2 * Legendre5x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n11 * (l3y * l2 * Legendre5(l3 - l2) + l3 * l2y * Legendre5(l3 - l2) + l3 * l2 * Legendre5x(l3 - l2) * (l3y - l2y)); } static double gradleg_tri_p7_b1_by(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n12 * (l3y * l2 * Legendre5(l3 - l2) + l3 * l2y * Legendre5(l3 - l2) + l3 * l2 * Legendre5x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n12 * (l3y * l2 * Legendre5(l3 - l2) + l3 * l2y * Legendre5(l3 - l2) + l3 * l2 * Legendre5x(l3 - l2) * (l3y - l2y)); } - // EDGE 2 + // EDGE 2 static double gradleg_tri_p7_b2_a(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n21 * (l1 * l3 * Legendre5(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n21 * (l1 * l3 * Legendre5(l1 - l3)); } static double gradleg_tri_p7_b2_b(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n22 * (l1 * l3 * Legendre5(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n22 * (l1 * l3 * Legendre5(l1 - l3)); } static double gradleg_tri_p7_b2_ax(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n21 * (l1x * l3 * Legendre5(l1 - l3) + l1 * l3x * Legendre5(l1 - l3) + l1 * l3 * Legendre5x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n21 * (l1x * l3 * Legendre5(l1 - l3) + l1 * l3x * Legendre5(l1 - l3) + l1 * l3 * Legendre5x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p7_b2_bx(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n22 * (l1x * l3 * Legendre5(l1 - l3) + l1 * l3x * Legendre5(l1 - l3) + l1 * l3 * Legendre5x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n22 * (l1x * l3 * Legendre5(l1 - l3) + l1 * l3x * Legendre5(l1 - l3) + l1 * l3 * Legendre5x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p7_b2_ay(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n21 * (l1y * l3 * Legendre5(l1 - l3) + l1 * l3y * Legendre5(l1 - l3) + l1 * l3 * Legendre5x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n21 * (l1y * l3 * Legendre5(l1 - l3) + l1 * l3y * Legendre5(l1 - l3) + l1 * l3 * Legendre5x(l1 - l3) * (l1y - l3y)); } static double gradleg_tri_p7_b2_by(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n22 * (l1y * l3 * Legendre5(l1 - l3) + l1 * l3y * Legendre5(l1 - l3) + l1 * l3 * Legendre5x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n22 * (l1y * l3 * Legendre5(l1 - l3) + l1 * l3y * Legendre5(l1 - l3) + l1 * l3 * Legendre5x(l1 - l3) * (l1y - l3y)); } - // EDGE 3 + // EDGE 3 static double gradleg_tri_p7_b3_a(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n31 * (l2 * l1 * Legendre5(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n31 * (l2 * l1 * Legendre5(l2 - l1)); } static double gradleg_tri_p7_b3_b(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n32 * (l2 * l1 * Legendre5(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n32 * (l2 * l1 * Legendre5(l2 - l1)); } static double gradleg_tri_p7_b3_ax(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n31 * (l2x * l1 * Legendre5(l2 - l1) + l2 * l1x * Legendre5(l2 - l1) + l2 * l1 * Legendre5x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n31 * (l2x * l1 * Legendre5(l2 - l1) + l2 * l1x * Legendre5(l2 - l1) + l2 * l1 * Legendre5x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p7_b3_bx(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n32 * (l2x * l1 * Legendre5(l2 - l1) + l2 * l1x * Legendre5(l2 - l1) + l2 * l1 * Legendre5x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n32 * (l2x * l1 * Legendre5(l2 - l1) + l2 * l1x * Legendre5(l2 - l1) + l2 * l1 * Legendre5x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p7_b3_ay(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n31 * (l2y * l1 * Legendre5(l2 - l1) + l2 * l1y * Legendre5(l2 - l1) + l2 * l1 * Legendre5x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n31 * (l2y * l1 * Legendre5(l2 - l1) + l2 * l1y * Legendre5(l2 - l1) + l2 * l1 * Legendre5x(l2 - l1) * (l2y - l1y)); } static double gradleg_tri_p7_b3_by(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n32 * (l2y * l1 * Legendre5(l2 - l1) + l2 * l1y * Legendre5(l2 - l1) + l2 * l1 * Legendre5x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n32 * (l2y * l1 * Legendre5(l2 - l1) + l2 * l1y * Legendre5(l2 - l1) + l2 * l1 * Legendre5x(l2 - l1) * (l2y - l1y)); } /* Genuine BUBBLE - order 7 */ static double gradleg_tri_b1_b5_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre4(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre4(l2 - l1); } static double gradleg_tri_b1_b5_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b5_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre4(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre4(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b5_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b5_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre4(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre4(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b5_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b5_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre4(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre4(l2 - l1); } static double gradleg_tri_b1_b5_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b5_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre4(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre4(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b5_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b5_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre4(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre4(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b5_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b4_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b2_b4_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b4_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b4_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b4_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b4_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b4_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b2_b4_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b4_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b4_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b4_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b4_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b3_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b3_b3_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b3_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b3_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b3_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b3_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b3_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b3_b3_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b3_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b3_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b3_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b3_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b2_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b4_b2_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b2_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b2_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b2_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b2_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b2_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b4_b2_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b2_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b2_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b2_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b2_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b1_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b5_b1_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b1_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b5_b1_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b1_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b5_b1_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b1_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b5_b1_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b1_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b5_b1_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b1_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b5_b1_2_ay(double x, double y) { - return 0.0; + return 0.0; } ///////////////////////////////// ORDER 8 ////////////////////////////////// /* EDGE FUNCTIONS - order 8*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p8_e1_a_0(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi7(l3 - l2) + l3 * l2x * phi7(l3 - l2) + l3 * l2 * phi7x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi7(l3 - l2) + l3 * l2x * phi7(l3 - l2) + l3 * l2 * phi7x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p8_e1_a_1(double x, double y) { - return -(gradleg_tri_p8_e1_a_0(x, y)); + return -(gradleg_tri_p8_e1_a_0(x, y)); } static double gradleg_tri_p8_e1_b_0(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi7(l3 - l2) + l3 * l2y * phi7(l3 - l2) + l3 * l2 * phi7x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi7(l3 - l2) + l3 * l2y * phi7(l3 - l2) + l3 * l2 * phi7x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p8_e1_b_1(double x, double y) { - return -(gradleg_tri_p8_e1_b_0(x, y)); + return -(gradleg_tri_p8_e1_b_0(x, y)); } static double gradleg_tri_p8_e1_ax_0(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi7(l3 - l2); kerx = phi7x(l3 - l2) * (l3x - l2x); kerxx = phi7xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi7(l3 - l2); kerx = phi7x(l3 - l2) * (l3x - l2x); kerxx = phi7xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p8_e1_ax_1(double x, double y) { - return -(gradleg_tri_p8_e1_ax_0(x, y)); + return -(gradleg_tri_p8_e1_ax_0(x, y)); } static double gradleg_tri_p8_e1_ay_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi7(l3 - l2); kerx = phi7x(l3 - l2) * (l3x - l2x); - kery = phi7x(l3 - l2) * (l3y - l2y); kerxy = phi7xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi7(l3 - l2); kerx = phi7x(l3 - l2) * (l3x - l2x); + kery = phi7x(l3 - l2) * (l3y - l2y); kerxy = phi7xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p8_e1_ay_1(double x, double y) { - return -(gradleg_tri_p8_e1_ay_0(x, y)); + return -(gradleg_tri_p8_e1_ay_0(x, y)); } static double gradleg_tri_p8_e1_bx_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi7(l3 - l2); kerx = phi7x(l3 - l2) * (l3x - l2x); - kery = phi7x(l3 - l2) * (l3y - l2y); kerxy = phi7xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi7(l3 - l2); kerx = phi7x(l3 - l2) * (l3x - l2x); + kery = phi7x(l3 - l2) * (l3y - l2y); kerxy = phi7xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p8_e1_bx_1(double x, double y) { - return -(gradleg_tri_p8_e1_bx_0(x, y)); + return -(gradleg_tri_p8_e1_bx_0(x, y)); } static double gradleg_tri_p8_e1_by_0(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi7(l3 - l2); kery = phi7x(l3 - l2) * (l3y - l2y); keryy = phi7xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi7(l3 - l2); kery = phi7x(l3 - l2) * (l3y - l2y); keryy = phi7xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } static double gradleg_tri_p8_e1_by_1(double x, double y) { - return -(gradleg_tri_p8_e1_by_0(x, y)); + return -(gradleg_tri_p8_e1_by_0(x, y)); } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p8_e2_a_0(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi7(l1 - l3) + l1 * l3x * phi7(l1 - l3) + l1 * l3 * phi7x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi7(l1 - l3) + l1 * l3x * phi7(l1 - l3) + l1 * l3 * phi7x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p8_e2_a_1(double x, double y) { - return -(gradleg_tri_p8_e2_a_0(x, y)); + return -(gradleg_tri_p8_e2_a_0(x, y)); } static double gradleg_tri_p8_e2_b_0(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi7(l1 - l3) + l1 * l3y * phi7(l1 - l3) + l1 * l3 * phi7x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi7(l1 - l3) + l1 * l3y * phi7(l1 - l3) + l1 * l3 * phi7x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p8_e2_b_1(double x, double y) { - return -(gradleg_tri_p8_e2_b_0(x, y)); + return -(gradleg_tri_p8_e2_b_0(x, y)); } static double gradleg_tri_p8_e2_ax_0(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi7(l1 - l3); kerx = phi7x(l1 - l3) * (l1x - l3x); kerxx = phi7xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi7(l1 - l3); kerx = phi7x(l1 - l3) * (l1x - l3x); kerxx = phi7xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p8_e2_ax_1(double x, double y) { - return -(gradleg_tri_p8_e2_ax_0(x, y)); + return -(gradleg_tri_p8_e2_ax_0(x, y)); } static double gradleg_tri_p8_e2_ay_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi7(l1 - l3); kerx = phi7x(l1 - l3) * (l1x - l3x); - kery = phi7x(l1 - l3) * (l1y - l3y); kerxy = phi7xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi7(l1 - l3); kerx = phi7x(l1 - l3) * (l1x - l3x); + kery = phi7x(l1 - l3) * (l1y - l3y); kerxy = phi7xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p8_e2_ay_1(double x, double y) { - return -(gradleg_tri_p8_e2_ay_0(x, y)); + return -(gradleg_tri_p8_e2_ay_0(x, y)); } static double gradleg_tri_p8_e2_bx_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi7(l1 - l3); kerx = phi7x(l1 - l3) * (l1x - l3x); - kery = phi7x(l1 - l3) * (l1y - l3y); kerxy = phi7xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi7(l1 - l3); kerx = phi7x(l1 - l3) * (l1x - l3x); + kery = phi7x(l1 - l3) * (l1y - l3y); kerxy = phi7xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p8_e2_bx_1(double x, double y) { - return -(gradleg_tri_p8_e2_bx_0(x, y)); + return -(gradleg_tri_p8_e2_bx_0(x, y)); } static double gradleg_tri_p8_e2_by_0(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi7(l1 - l3); kery = phi7x(l1 - l3) * (l1y - l3y); keryy = phi7xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi7(l1 - l3); kery = phi7x(l1 - l3) * (l1y - l3y); keryy = phi7xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } static double gradleg_tri_p8_e2_by_1(double x, double y) { - return -(gradleg_tri_p8_e2_by_0(x, y)); + return -(gradleg_tri_p8_e2_by_0(x, y)); } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p8_e3_a_0(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi7(l2 - l1) + l2 * l1x * phi7(l2 - l1) + l2 * l1 * phi7x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi7(l2 - l1) + l2 * l1x * phi7(l2 - l1) + l2 * l1 * phi7x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p8_e3_a_1(double x, double y) { - return -(gradleg_tri_p8_e3_a_0(x, y)); + return -(gradleg_tri_p8_e3_a_0(x, y)); } static double gradleg_tri_p8_e3_b_0(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi7(l2 - l1) + l2 * l1y * phi7(l2 - l1) + l2 * l1 * phi7x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi7(l2 - l1) + l2 * l1y * phi7(l2 - l1) + l2 * l1 * phi7x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p8_e3_b_1(double x, double y) { - return -(gradleg_tri_p8_e3_b_0(x, y)); + return -(gradleg_tri_p8_e3_b_0(x, y)); } static double gradleg_tri_p8_e3_ax_0(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi7(l2 - l1); kerx = phi7x(l2 - l1) * (l2x - l1x); kerxx = phi7xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi7(l2 - l1); kerx = phi7x(l2 - l1) * (l2x - l1x); kerxx = phi7xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p8_e3_ax_1(double x, double y) { - return -(gradleg_tri_p8_e3_ax_0(x, y)); + return -(gradleg_tri_p8_e3_ax_0(x, y)); } static double gradleg_tri_p8_e3_ay_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi7(l2 - l1); kerx = phi7x(l2 - l1) * (l2x - l1x); - kery = phi7x(l2 - l1) * (l2y - l1y); kerxy = phi7xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi7(l2 - l1); kerx = phi7x(l2 - l1) * (l2x - l1x); + kery = phi7x(l2 - l1) * (l2y - l1y); kerxy = phi7xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p8_e3_ay_1(double x, double y) { - return -(gradleg_tri_p8_e3_ay_0(x, y)); + return -(gradleg_tri_p8_e3_ay_0(x, y)); } static double gradleg_tri_p8_e3_bx_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi7(l2 - l1); kerx = phi7x(l2 - l1) * (l2x - l1x); - kery = phi7x(l2 - l1) * (l2y - l1y); kerxy = phi7xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi7(l2 - l1); kerx = phi7x(l2 - l1) * (l2x - l1x); + kery = phi7x(l2 - l1) * (l2y - l1y); kerxy = phi7xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p8_e3_bx_1(double x, double y) { - return -(gradleg_tri_p8_e3_bx_0(x, y)); + return -(gradleg_tri_p8_e3_bx_0(x, y)); } static double gradleg_tri_p8_e3_by_0(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi7(l2 - l1); kery = phi7x(l2 - l1) * (l2y - l1y); keryy = phi7xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi7(l2 - l1); kery = phi7x(l2 - l1) * (l2y - l1y); keryy = phi7xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } static double gradleg_tri_p8_e3_by_1(double x, double y) { - return -(gradleg_tri_p8_e3_by_0(x, y)); + return -(gradleg_tri_p8_e3_by_0(x, y)); } /* BUBBLE */ /* Edge-based BUBBLE - order 8 */ - // EDGE 1 + // EDGE 1 static double gradleg_tri_p8_b1_a(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n11 * (l3 * l2 * Legendre6(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n11 * (l3 * l2 * Legendre6(l3 - l2)); } static double gradleg_tri_p8_b1_b(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n12 * (l3 * l2 * Legendre6(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n12 * (l3 * l2 * Legendre6(l3 - l2)); } static double gradleg_tri_p8_b1_ax(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n11 * (l3x * l2 * Legendre6(l3 - l2) + l3 * l2x * Legendre6(l3 - l2) + l3 * l2 * Legendre6x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n11 * (l3x * l2 * Legendre6(l3 - l2) + l3 * l2x * Legendre6(l3 - l2) + l3 * l2 * Legendre6x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p8_b1_bx(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n12 * (l3x * l2 * Legendre6(l3 - l2) + l3 * l2x * Legendre6(l3 - l2) + l3 * l2 * Legendre6x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n12 * (l3x * l2 * Legendre6(l3 - l2) + l3 * l2x * Legendre6(l3 - l2) + l3 * l2 * Legendre6x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p8_b1_ay(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n11 * (l3y * l2 * Legendre6(l3 - l2) + l3 * l2y * Legendre6(l3 - l2) + l3 * l2 * Legendre6x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n11 * (l3y * l2 * Legendre6(l3 - l2) + l3 * l2y * Legendre6(l3 - l2) + l3 * l2 * Legendre6x(l3 - l2) * (l3y - l2y)); } static double gradleg_tri_p8_b1_by(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n12 * (l3y * l2 * Legendre6(l3 - l2) + l3 * l2y * Legendre6(l3 - l2) + l3 * l2 * Legendre6x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n12 * (l3y * l2 * Legendre6(l3 - l2) + l3 * l2y * Legendre6(l3 - l2) + l3 * l2 * Legendre6x(l3 - l2) * (l3y - l2y)); } - // EDGE 2 + // EDGE 2 static double gradleg_tri_p8_b2_a(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n21 * (l1 * l3 * Legendre6(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n21 * (l1 * l3 * Legendre6(l1 - l3)); } static double gradleg_tri_p8_b2_b(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n22 * (l1 * l3 * Legendre6(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n22 * (l1 * l3 * Legendre6(l1 - l3)); } static double gradleg_tri_p8_b2_ax(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n21 * (l1x * l3 * Legendre6(l1 - l3) + l1 * l3x * Legendre6(l1 - l3) + l1 * l3 * Legendre6x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n21 * (l1x * l3 * Legendre6(l1 - l3) + l1 * l3x * Legendre6(l1 - l3) + l1 * l3 * Legendre6x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p8_b2_bx(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n22 * (l1x * l3 * Legendre6(l1 - l3) + l1 * l3x * Legendre6(l1 - l3) + l1 * l3 * Legendre6x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n22 * (l1x * l3 * Legendre6(l1 - l3) + l1 * l3x * Legendre6(l1 - l3) + l1 * l3 * Legendre6x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p8_b2_ay(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n21 * (l1y * l3 * Legendre6(l1 - l3) + l1 * l3y * Legendre6(l1 - l3) + l1 * l3 * Legendre6x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n21 * (l1y * l3 * Legendre6(l1 - l3) + l1 * l3y * Legendre6(l1 - l3) + l1 * l3 * Legendre6x(l1 - l3) * (l1y - l3y)); } static double gradleg_tri_p8_b2_by(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n22 * (l1y * l3 * Legendre6(l1 - l3) + l1 * l3y * Legendre6(l1 - l3) + l1 * l3 * Legendre6x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n22 * (l1y * l3 * Legendre6(l1 - l3) + l1 * l3y * Legendre6(l1 - l3) + l1 * l3 * Legendre6x(l1 - l3) * (l1y - l3y)); } - // EDGE 3 + // EDGE 3 static double gradleg_tri_p8_b3_a(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n31 * (l2 * l1 * Legendre6(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n31 * (l2 * l1 * Legendre6(l2 - l1)); } static double gradleg_tri_p8_b3_b(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n32 * (l2 * l1 * Legendre6(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n32 * (l2 * l1 * Legendre6(l2 - l1)); } static double gradleg_tri_p8_b3_ax(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n31 * (l2x * l1 * Legendre6(l2 - l1) + l2 * l1x * Legendre6(l2 - l1) + l2 * l1 * Legendre6x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n31 * (l2x * l1 * Legendre6(l2 - l1) + l2 * l1x * Legendre6(l2 - l1) + l2 * l1 * Legendre6x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p8_b3_bx(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n32 * (l2x * l1 * Legendre6(l2 - l1) + l2 * l1x * Legendre6(l2 - l1) + l2 * l1 * Legendre6x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n32 * (l2x * l1 * Legendre6(l2 - l1) + l2 * l1x * Legendre6(l2 - l1) + l2 * l1 * Legendre6x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p8_b3_ay(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n31 * (l2y * l1 * Legendre6(l2 - l1) + l2 * l1y * Legendre6(l2 - l1) + l2 * l1 * Legendre6x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n31 * (l2y * l1 * Legendre6(l2 - l1) + l2 * l1y * Legendre6(l2 - l1) + l2 * l1 * Legendre6x(l2 - l1) * (l2y - l1y)); } static double gradleg_tri_p8_b3_by(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n32 * (l2y * l1 * Legendre6(l2 - l1) + l2 * l1y * Legendre6(l2 - l1) + l2 * l1 * Legendre6x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n32 * (l2y * l1 * Legendre6(l2 - l1) + l2 * l1y * Legendre6(l2 - l1) + l2 * l1 * Legendre6x(l2 - l1) * (l2y - l1y)); } /* Genuine BUBBLE - order 8 */ static double gradleg_tri_b1_b6_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre5(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre5(l2 - l1); } static double gradleg_tri_b1_b6_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b6_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre5(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre5(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b6_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b6_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre5(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre5(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b6_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b6_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre5(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre5(l2 - l1); } static double gradleg_tri_b1_b6_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b6_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre5(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre5(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b6_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b6_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre5(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre5(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b6_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b5_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre4(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre4(l2 - l1); } static double gradleg_tri_b2_b5_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b5_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre4(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre4(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b5_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b5_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre4(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre4(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b5_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b5_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre4(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre4(l2 - l1); } static double gradleg_tri_b2_b5_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b5_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre4(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre4(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b5_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b5_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre4(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre4(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b5_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b4_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b3_b4_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b4_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b4_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b4_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b4_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b4_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b3_b4_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b4_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b4_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b4_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b4_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b3_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b4_b3_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b3_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b3_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b3_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b3_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b3_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b4_b3_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b3_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b3_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b3_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b3_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b2_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b5_b2_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b2_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b5_b2_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b2_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b5_b2_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b2_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b5_b2_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b2_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b5_b2_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b2_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b5_b2_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b1_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b6_b1_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b1_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b6_b1_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b1_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b6_b1_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b1_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b6_b1_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b1_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b6_b1_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b1_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b6_b1_2_ay(double x, double y) { - return 0.0; + return 0.0; } ///////////////////////////////// ORDER 9 ////////////////////////////////// /* EDGE FUNCTIONS - order 9*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p9_e1_a(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi8(l3 - l2) + l3 * l2x * phi8(l3 - l2) + l3 * l2 * phi8x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi8(l3 - l2) + l3 * l2x * phi8(l3 - l2) + l3 * l2 * phi8x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p9_e1_b(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi8(l3 - l2) + l3 * l2y * phi8(l3 - l2) + l3 * l2 * phi8x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi8(l3 - l2) + l3 * l2y * phi8(l3 - l2) + l3 * l2 * phi8x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p9_e1_ax(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi8(l3 - l2); kerx = phi8x(l3 - l2) * (l3x - l2x); kerxx = phi8xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi8(l3 - l2); kerx = phi8x(l3 - l2) * (l3x - l2x); kerxx = phi8xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p9_e1_ay(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi8(l3 - l2); kerx = phi8x(l3 - l2) * (l3x - l2x); - kery = phi8x(l3 - l2) * (l3y - l2y); kerxy = phi8xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi8(l3 - l2); kerx = phi8x(l3 - l2) * (l3x - l2x); + kery = phi8x(l3 - l2) * (l3y - l2y); kerxy = phi8xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p9_e1_bx(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi8(l3 - l2); kerx = phi8x(l3 - l2) * (l3x - l2x); - kery = phi8x(l3 - l2) * (l3y - l2y); kerxy = phi8xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi8(l3 - l2); kerx = phi8x(l3 - l2) * (l3x - l2x); + kery = phi8x(l3 - l2) * (l3y - l2y); kerxy = phi8xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p9_e1_by(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi8(l3 - l2); kery = phi8x(l3 - l2) * (l3y - l2y); keryy = phi8xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi8(l3 - l2); kery = phi8x(l3 - l2) * (l3y - l2y); keryy = phi8xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p9_e2_a(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi8(l1 - l3) + l1 * l3x * phi8(l1 - l3) + l1 * l3 * phi8x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi8(l1 - l3) + l1 * l3x * phi8(l1 - l3) + l1 * l3 * phi8x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p9_e2_b(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi8(l1 - l3) + l1 * l3y * phi8(l1 - l3) + l1 * l3 * phi8x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi8(l1 - l3) + l1 * l3y * phi8(l1 - l3) + l1 * l3 * phi8x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p9_e2_ax(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi8(l1 - l3); kerx = phi8x(l1 - l3) * (l1x - l3x); kerxx = phi8xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi8(l1 - l3); kerx = phi8x(l1 - l3) * (l1x - l3x); kerxx = phi8xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p9_e2_ay(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi8(l1 - l3); kerx = phi8x(l1 - l3) * (l1x - l3x); - kery = phi8x(l1 - l3) * (l1y - l3y); kerxy = phi8xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi8(l1 - l3); kerx = phi8x(l1 - l3) * (l1x - l3x); + kery = phi8x(l1 - l3) * (l1y - l3y); kerxy = phi8xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p9_e2_bx(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi8(l1 - l3); kerx = phi8x(l1 - l3) * (l1x - l3x); - kery = phi8x(l1 - l3) * (l1y - l3y); kerxy = phi8xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi8(l1 - l3); kerx = phi8x(l1 - l3) * (l1x - l3x); + kery = phi8x(l1 - l3) * (l1y - l3y); kerxy = phi8xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p9_e2_by(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi8(l1 - l3); kery = phi8x(l1 - l3) * (l1y - l3y); keryy = phi8xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi8(l1 - l3); kery = phi8x(l1 - l3) * (l1y - l3y); keryy = phi8xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p9_e3_a(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi8(l2 - l1) + l2 * l1x * phi8(l2 - l1) + l2 * l1 * phi8x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi8(l2 - l1) + l2 * l1x * phi8(l2 - l1) + l2 * l1 * phi8x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p9_e3_b(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi8(l2 - l1) + l2 * l1y * phi8(l2 - l1) + l2 * l1 * phi8x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi8(l2 - l1) + l2 * l1y * phi8(l2 - l1) + l2 * l1 * phi8x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p9_e3_ax(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi8(l2 - l1); kerx = phi8x(l2 - l1) * (l2x - l1x); kerxx = phi8xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi8(l2 - l1); kerx = phi8x(l2 - l1) * (l2x - l1x); kerxx = phi8xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p9_e3_ay(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi8(l2 - l1); kerx = phi8x(l2 - l1) * (l2x - l1x); - kery = phi8x(l2 - l1) * (l2y - l1y); kerxy = phi8xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi8(l2 - l1); kerx = phi8x(l2 - l1) * (l2x - l1x); + kery = phi8x(l2 - l1) * (l2y - l1y); kerxy = phi8xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p9_e3_bx(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi8(l2 - l1); kerx = phi8x(l2 - l1) * (l2x - l1x); - kery = phi8x(l2 - l1) * (l2y - l1y); kerxy = phi8xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi8(l2 - l1); kerx = phi8x(l2 - l1) * (l2x - l1x); + kery = phi8x(l2 - l1) * (l2y - l1y); kerxy = phi8xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p9_e3_by(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi8(l2 - l1); kery = phi8x(l2 - l1) * (l2y - l1y); keryy = phi8xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi8(l2 - l1); kery = phi8x(l2 - l1) * (l2y - l1y); keryy = phi8xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } /* BUBBLE */ /* Edge-based BUBBLE - order 9 */ - // EDGE 1 + // EDGE 1 static double gradleg_tri_p9_b1_a(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n11 * (l3 * l2 * Legendre7(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n11 * (l3 * l2 * Legendre7(l3 - l2)); } static double gradleg_tri_p9_b1_b(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n12 * (l3 * l2 * Legendre7(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n12 * (l3 * l2 * Legendre7(l3 - l2)); } static double gradleg_tri_p9_b1_ax(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n11 * (l3x * l2 * Legendre7(l3 - l2) + l3 * l2x * Legendre7(l3 - l2) + l3 * l2 * Legendre7x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n11 * (l3x * l2 * Legendre7(l3 - l2) + l3 * l2x * Legendre7(l3 - l2) + l3 * l2 * Legendre7x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p9_b1_bx(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n12 * (l3x * l2 * Legendre7(l3 - l2) + l3 * l2x * Legendre7(l3 - l2) + l3 * l2 * Legendre7x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n12 * (l3x * l2 * Legendre7(l3 - l2) + l3 * l2x * Legendre7(l3 - l2) + l3 * l2 * Legendre7x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p9_b1_ay(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n11 * (l3y * l2 * Legendre7(l3 - l2) + l3 * l2y * Legendre7(l3 - l2) + l3 * l2 * Legendre7x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n11 * (l3y * l2 * Legendre7(l3 - l2) + l3 * l2y * Legendre7(l3 - l2) + l3 * l2 * Legendre7x(l3 - l2) * (l3y - l2y)); } static double gradleg_tri_p9_b1_by(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n12 * (l3y * l2 * Legendre7(l3 - l2) + l3 * l2y * Legendre7(l3 - l2) + l3 * l2 * Legendre7x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n12 * (l3y * l2 * Legendre7(l3 - l2) + l3 * l2y * Legendre7(l3 - l2) + l3 * l2 * Legendre7x(l3 - l2) * (l3y - l2y)); } - // EDGE 2 + // EDGE 2 static double gradleg_tri_p9_b2_a(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n21 * (l1 * l3 * Legendre7(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n21 * (l1 * l3 * Legendre7(l1 - l3)); } static double gradleg_tri_p9_b2_b(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n22 * (l1 * l3 * Legendre7(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n22 * (l1 * l3 * Legendre7(l1 - l3)); } static double gradleg_tri_p9_b2_ax(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n21 * (l1x * l3 * Legendre7(l1 - l3) + l1 * l3x * Legendre7(l1 - l3) + l1 * l3 * Legendre7x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n21 * (l1x * l3 * Legendre7(l1 - l3) + l1 * l3x * Legendre7(l1 - l3) + l1 * l3 * Legendre7x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p9_b2_bx(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n22 * (l1x * l3 * Legendre7(l1 - l3) + l1 * l3x * Legendre7(l1 - l3) + l1 * l3 * Legendre7x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n22 * (l1x * l3 * Legendre7(l1 - l3) + l1 * l3x * Legendre7(l1 - l3) + l1 * l3 * Legendre7x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p9_b2_ay(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n21 * (l1y * l3 * Legendre7(l1 - l3) + l1 * l3y * Legendre7(l1 - l3) + l1 * l3 * Legendre7x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n21 * (l1y * l3 * Legendre7(l1 - l3) + l1 * l3y * Legendre7(l1 - l3) + l1 * l3 * Legendre7x(l1 - l3) * (l1y - l3y)); } static double gradleg_tri_p9_b2_by(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n22 * (l1y * l3 * Legendre7(l1 - l3) + l1 * l3y * Legendre7(l1 - l3) + l1 * l3 * Legendre7x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n22 * (l1y * l3 * Legendre7(l1 - l3) + l1 * l3y * Legendre7(l1 - l3) + l1 * l3 * Legendre7x(l1 - l3) * (l1y - l3y)); } - // EDGE 3 + // EDGE 3 static double gradleg_tri_p9_b3_a(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n31 * (l2 * l1 * Legendre7(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n31 * (l2 * l1 * Legendre7(l2 - l1)); } static double gradleg_tri_p9_b3_b(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n32 * (l2 * l1 * Legendre7(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n32 * (l2 * l1 * Legendre7(l2 - l1)); } static double gradleg_tri_p9_b3_ax(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n31 * (l2x * l1 * Legendre7(l2 - l1) + l2 * l1x * Legendre7(l2 - l1) + l2 * l1 * Legendre7x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n31 * (l2x * l1 * Legendre7(l2 - l1) + l2 * l1x * Legendre7(l2 - l1) + l2 * l1 * Legendre7x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p9_b3_bx(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n32 * (l2x * l1 * Legendre7(l2 - l1) + l2 * l1x * Legendre7(l2 - l1) + l2 * l1 * Legendre7x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n32 * (l2x * l1 * Legendre7(l2 - l1) + l2 * l1x * Legendre7(l2 - l1) + l2 * l1 * Legendre7x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p9_b3_ay(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n31 * (l2y * l1 * Legendre7(l2 - l1) + l2 * l1y * Legendre7(l2 - l1) + l2 * l1 * Legendre7x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n31 * (l2y * l1 * Legendre7(l2 - l1) + l2 * l1y * Legendre7(l2 - l1) + l2 * l1 * Legendre7x(l2 - l1) * (l2y - l1y)); } static double gradleg_tri_p9_b3_by(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n32 * (l2y * l1 * Legendre7(l2 - l1) + l2 * l1y * Legendre7(l2 - l1) + l2 * l1 * Legendre7x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n32 * (l2y * l1 * Legendre7(l2 - l1) + l2 * l1y * Legendre7(l2 - l1) + l2 * l1 * Legendre7x(l2 - l1) * (l2y - l1y)); } /* Genuine BUBBLE - order 9 */ static double gradleg_tri_b1_b7_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre6(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre6(l2 - l1); } static double gradleg_tri_b1_b7_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b7_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre6(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre6x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre6(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre6x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b7_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b7_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre6(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre6x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre6(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre6x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b7_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b7_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre6(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre6(l2 - l1); } static double gradleg_tri_b1_b7_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b7_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre6(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre6x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre6(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre6x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b7_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b7_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre6(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre6x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre6(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre6x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b7_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b6_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre5(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre5(l2 - l1); } static double gradleg_tri_b2_b6_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b6_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre5(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre5(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b6_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b6_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre5(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre5(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b6_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b6_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre5(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre5(l2 - l1); } static double gradleg_tri_b2_b6_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b6_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre5(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre5(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b6_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b6_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre5(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre5(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b6_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b5_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre4(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre4(l2 - l1); } static double gradleg_tri_b3_b5_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b5_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre4(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre4(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b5_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b5_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre4(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre4(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b5_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b5_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre4(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre4(l2 - l1); } static double gradleg_tri_b3_b5_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b5_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre4(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre4(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b5_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b5_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre4(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre4(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b5_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b4_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b4_b4_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b4_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b4_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b4_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b4_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b4_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b4_b4_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b4_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b4_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b4_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b4_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b3_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b5_b3_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b3_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b5_b3_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b3_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b5_b3_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b3_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b5_b3_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b3_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b5_b3_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b3_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b5_b3_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b2_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b6_b2_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b2_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b6_b2_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b2_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b6_b2_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b2_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b6_b2_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b2_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b6_b2_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b2_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b6_b2_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b1_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre6(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre6(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b7_b1_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b1_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre6(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre6x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre6(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre6x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b7_b1_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b1_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre6(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre6x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre6(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre6x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b7_b1_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b1_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre6(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre6(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b7_b1_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b1_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre6(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre6x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre6(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre6x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b7_b1_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b1_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre6(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre6x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre6(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre6x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b7_b1_2_ay(double x, double y) { - return 0.0; + return 0.0; } ///////////////////////////////// ORDER 10 ////////////////////////////////// /* EDGE FUNCTIONS - order 10*/ - /* EDGE 1 */ + /* EDGE 1 */ static double gradleg_tri_p10_e1_a_0(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return (l3x * l2 * phi9(l3 - l2) + l3 * l2x * phi9(l3 - l2) + l3 * l2 * phi9x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return (l3x * l2 * phi9(l3 - l2) + l3 * l2x * phi9(l3 - l2) + l3 * l2 * phi9x(l3 - l2) * (l3x - l2x)) / 1.0000000000000; } static double gradleg_tri_p10_e1_a_1(double x, double y) { - return -(gradleg_tri_p10_e1_a_0(x, y)); + return -(gradleg_tri_p10_e1_a_0(x, y)); } static double gradleg_tri_p10_e1_b_0(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return (l3y * l2 * phi9(l3 - l2) + l3 * l2y * phi9(l3 - l2) + l3 * l2 * phi9x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return (l3y * l2 * phi9(l3 - l2) + l3 * l2y * phi9(l3 - l2) + l3 * l2 * phi9x(l3 - l2) * (l3y - l2y)) / 1.0000000000000; } static double gradleg_tri_p10_e1_b_1(double x, double y) { - return -(gradleg_tri_p10_e1_b_0(x, y)); + return -(gradleg_tri_p10_e1_b_0(x, y)); } static double gradleg_tri_p10_e1_ax_0(double x, double y) { - double l3, l3x, l2, l2x; - double ker, kerx, kerxx; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - ker = phi9(l3 - l2); kerx = phi9x(l3 - l2) * (l3x - l2x); kerxx = phi9xx(l3 - l2) * sqr(l3x - l2x); - return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; + double l3, l3x, l2, l2x; + double ker, kerx, kerxx; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + ker = phi9(l3 - l2); kerx = phi9x(l3 - l2) * (l3x - l2x); kerxx = phi9xx(l3 - l2) * sqr(l3x - l2x); + return (2.0 * l3x * l2x * ker + 2.0 * l3x * l2 * kerx + 2.0 * l3 * l2x * kerx + l3 * l2 * kerxx) / 1.0000000000000; } static double gradleg_tri_p10_e1_ax_1(double x, double y) { - return -(gradleg_tri_p10_e1_ax_0(x, y)); + return -(gradleg_tri_p10_e1_ax_0(x, y)); } static double gradleg_tri_p10_e1_ay_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi9(l3 - l2); kerx = phi9x(l3 - l2) * (l3x - l2x); - kery = phi9x(l3 - l2) * (l3y - l2y); kerxy = phi9xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi9(l3 - l2); kerx = phi9x(l3 - l2) * (l3x - l2x); + kery = phi9x(l3 - l2) * (l3y - l2y); kerxy = phi9xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p10_e1_ay_1(double x, double y) { - return -(gradleg_tri_p10_e1_ay_0(x, y)); + return -(gradleg_tri_p10_e1_ay_0(x, y)); } static double gradleg_tri_p10_e1_bx_0(double x, double y) { - double l3, l3x, l3y, l2, l2x, l2y; - double ker, kerx, kery, kerxy; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); + double l3, l3x, l3y, l2, l2x, l2y; + double ker, kerx, kery, kerxy; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); - ker = phi9(l3 - l2); kerx = phi9x(l3 - l2) * (l3x - l2x); - kery = phi9x(l3 - l2) * (l3y - l2y); kerxy = phi9xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); - return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; + ker = phi9(l3 - l2); kerx = phi9x(l3 - l2) * (l3x - l2x); + kery = phi9x(l3 - l2) * (l3y - l2y); kerxy = phi9xx(l3 - l2) * (l3x - l2x) * (l3y - l2y); + return (l3x * l2y * ker + l3y * l2x * ker + l3x * l2 * kery + l3 * l2x * kery + l3y * l2 * kerx + l3 * l2y * kerx + l3 * l2 * kerxy) / 1.0000000000000; } static double gradleg_tri_p10_e1_bx_1(double x, double y) { - return -(gradleg_tri_p10_e1_bx_0(x, y)); + return -(gradleg_tri_p10_e1_bx_0(x, y)); } static double gradleg_tri_p10_e1_by_0(double x, double y) { - double l3, l3y, l2, l2y; - double ker, kery, keryy; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - ker = phi9(l3 - l2); kery = phi9x(l3 - l2) * (l3y - l2y); keryy = phi9xx(l3 - l2) * sqr(l3y - l2y); - return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; + double l3, l3y, l2, l2y; + double ker, kery, keryy; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + ker = phi9(l3 - l2); kery = phi9x(l3 - l2) * (l3y - l2y); keryy = phi9xx(l3 - l2) * sqr(l3y - l2y); + return (2.0 * l3y * l2y * ker + 2.0 * l3y * l2 * kery + 2.0 * l3 * l2y * kery + l3 * l2 * keryy) / 1.0000000000000; } static double gradleg_tri_p10_e1_by_1(double x, double y) { - return -(gradleg_tri_p10_e1_by_0(x, y)); + return -(gradleg_tri_p10_e1_by_0(x, y)); } - /* EDGE 2 */ + /* EDGE 2 */ static double gradleg_tri_p10_e2_a_0(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return (l1x * l3 * phi9(l1 - l3) + l1 * l3x * phi9(l1 - l3) + l1 * l3 * phi9x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return (l1x * l3 * phi9(l1 - l3) + l1 * l3x * phi9(l1 - l3) + l1 * l3 * phi9x(l1 - l3) * (l1x - l3x)) / 1.0000000000000; } static double gradleg_tri_p10_e2_a_1(double x, double y) { - return -(gradleg_tri_p10_e2_a_0(x, y)); + return -(gradleg_tri_p10_e2_a_0(x, y)); } static double gradleg_tri_p10_e2_b_0(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return (l1y * l3 * phi9(l1 - l3) + l1 * l3y * phi9(l1 - l3) + l1 * l3 * phi9x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return (l1y * l3 * phi9(l1 - l3) + l1 * l3y * phi9(l1 - l3) + l1 * l3 * phi9x(l1 - l3) * (l1y - l3y)) / 1.0000000000000; } static double gradleg_tri_p10_e2_b_1(double x, double y) { - return -(gradleg_tri_p10_e2_b_0(x, y)); + return -(gradleg_tri_p10_e2_b_0(x, y)); } static double gradleg_tri_p10_e2_ax_0(double x, double y) { - double l1, l1x, l3, l3x; - double ker, kerx, kerxx; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - ker = phi9(l1 - l3); kerx = phi9x(l1 - l3) * (l1x - l3x); kerxx = phi9xx(l1 - l3) * sqr(l1x - l3x); - return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; + double l1, l1x, l3, l3x; + double ker, kerx, kerxx; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + ker = phi9(l1 - l3); kerx = phi9x(l1 - l3) * (l1x - l3x); kerxx = phi9xx(l1 - l3) * sqr(l1x - l3x); + return (2.0 * l1x * l3x * ker + 2.0 * l1x * l3 * kerx + 2.0 * l1 * l3x * kerx + l1 * l3 * kerxx) / 1.0000000000000; } static double gradleg_tri_p10_e2_ax_1(double x, double y) { - return -(gradleg_tri_p10_e2_ax_0(x, y)); + return -(gradleg_tri_p10_e2_ax_0(x, y)); } static double gradleg_tri_p10_e2_ay_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi9(l1 - l3); kerx = phi9x(l1 - l3) * (l1x - l3x); - kery = phi9x(l1 - l3) * (l1y - l3y); kerxy = phi9xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi9(l1 - l3); kerx = phi9x(l1 - l3) * (l1x - l3x); + kery = phi9x(l1 - l3) * (l1y - l3y); kerxy = phi9xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p10_e2_ay_1(double x, double y) { - return -(gradleg_tri_p10_e2_ay_0(x, y)); + return -(gradleg_tri_p10_e2_ay_0(x, y)); } static double gradleg_tri_p10_e2_bx_0(double x, double y) { - double l1, l1x, l1y, l3, l3x, l3y; - double ker, kerx, kery, kerxy; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); + double l1, l1x, l1y, l3, l3x, l3y; + double ker, kerx, kery, kerxy; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); l3y = lambda3y(x, y); - ker = phi9(l1 - l3); kerx = phi9x(l1 - l3) * (l1x - l3x); - kery = phi9x(l1 - l3) * (l1y - l3y); kerxy = phi9xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); - return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; + ker = phi9(l1 - l3); kerx = phi9x(l1 - l3) * (l1x - l3x); + kery = phi9x(l1 - l3) * (l1y - l3y); kerxy = phi9xx(l1 - l3) * (l1x - l3x) * (l1y - l3y); + return (l1x * l3y * ker + l1y * l3x * ker + l1x * l3 * kery + l1 * l3x * kery + l1y * l3 * kerx + l1 * l3y * kerx + l1 * l3 * kerxy) / 1.0000000000000; } static double gradleg_tri_p10_e2_bx_1(double x, double y) { - return -(gradleg_tri_p10_e2_bx_0(x, y)); + return -(gradleg_tri_p10_e2_bx_0(x, y)); } static double gradleg_tri_p10_e2_by_0(double x, double y) { - double l1, l1y, l3, l3y; - double ker, kery, keryy; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - ker = phi9(l1 - l3); kery = phi9x(l1 - l3) * (l1y - l3y); keryy = phi9xx(l1 - l3) * sqr(l1y - l3y); - return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; + double l1, l1y, l3, l3y; + double ker, kery, keryy; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + ker = phi9(l1 - l3); kery = phi9x(l1 - l3) * (l1y - l3y); keryy = phi9xx(l1 - l3) * sqr(l1y - l3y); + return (2.0 * l1y * l3y * ker + 2.0 * l1y * l3 * kery + 2.0 * l1 * l3y * kery + l1 * l3 * keryy) / 1.0000000000000; } static double gradleg_tri_p10_e2_by_1(double x, double y) { - return -(gradleg_tri_p10_e2_by_0(x, y)); + return -(gradleg_tri_p10_e2_by_0(x, y)); } - /* EDGE 3 */ + /* EDGE 3 */ static double gradleg_tri_p10_e3_a_0(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return (l2x * l1 * phi9(l2 - l1) + l2 * l1x * phi9(l2 - l1) + l2 * l1 * phi9x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return (l2x * l1 * phi9(l2 - l1) + l2 * l1x * phi9(l2 - l1) + l2 * l1 * phi9x(l2 - l1) * (l2x - l1x)) / 1.0000000000000; } static double gradleg_tri_p10_e3_a_1(double x, double y) { - return -(gradleg_tri_p10_e3_a_0(x, y)); + return -(gradleg_tri_p10_e3_a_0(x, y)); } static double gradleg_tri_p10_e3_b_0(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return (l2y * l1 * phi9(l2 - l1) + l2 * l1y * phi9(l2 - l1) + l2 * l1 * phi9x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return (l2y * l1 * phi9(l2 - l1) + l2 * l1y * phi9(l2 - l1) + l2 * l1 * phi9x(l2 - l1) * (l2y - l1y)) / 1.0000000000000; } static double gradleg_tri_p10_e3_b_1(double x, double y) { - return -(gradleg_tri_p10_e3_b_0(x, y)); + return -(gradleg_tri_p10_e3_b_0(x, y)); } static double gradleg_tri_p10_e3_ax_0(double x, double y) { - double l2, l2x, l1, l1x; - double ker, kerx, kerxx; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - ker = phi9(l2 - l1); kerx = phi9x(l2 - l1) * (l2x - l1x); kerxx = phi9xx(l2 - l1) * sqr(l2x - l1x); - return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; + double l2, l2x, l1, l1x; + double ker, kerx, kerxx; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + ker = phi9(l2 - l1); kerx = phi9x(l2 - l1) * (l2x - l1x); kerxx = phi9xx(l2 - l1) * sqr(l2x - l1x); + return (2.0 * l2x * l1x * ker + 2.0 * l2x * l1 * kerx + 2.0 * l2 * l1x * kerx + l2 * l1 * kerxx) / 1.0000000000000; } static double gradleg_tri_p10_e3_ax_1(double x, double y) { - return -(gradleg_tri_p10_e3_ax_0(x, y)); + return -(gradleg_tri_p10_e3_ax_0(x, y)); } static double gradleg_tri_p10_e3_ay_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi9(l2 - l1); kerx = phi9x(l2 - l1) * (l2x - l1x); - kery = phi9x(l2 - l1) * (l2y - l1y); kerxy = phi9xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi9(l2 - l1); kerx = phi9x(l2 - l1) * (l2x - l1x); + kery = phi9x(l2 - l1) * (l2y - l1y); kerxy = phi9xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p10_e3_ay_1(double x, double y) { - return -(gradleg_tri_p10_e3_ay_0(x, y)); + return -(gradleg_tri_p10_e3_ay_0(x, y)); } static double gradleg_tri_p10_e3_bx_0(double x, double y) { - double l2, l2x, l2y, l1, l1x, l1y; - double ker, kerx, kery, kerxy; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); + double l2, l2x, l2y, l1, l1x, l1y; + double ker, kerx, kery, kerxy; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); l1y = lambda1y(x, y); - ker = phi9(l2 - l1); kerx = phi9x(l2 - l1) * (l2x - l1x); - kery = phi9x(l2 - l1) * (l2y - l1y); kerxy = phi9xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); - return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; + ker = phi9(l2 - l1); kerx = phi9x(l2 - l1) * (l2x - l1x); + kery = phi9x(l2 - l1) * (l2y - l1y); kerxy = phi9xx(l2 - l1) * (l2x - l1x) * (l2y - l1y); + return (l2x * l1y * ker + l2y * l1x * ker + l2x * l1 * kery + l2 * l1x * kery + l2y * l1 * kerx + l2 * l1y * kerx + l2 * l1 * kerxy) / 1.0000000000000; } static double gradleg_tri_p10_e3_bx_1(double x, double y) { - return -(gradleg_tri_p10_e3_bx_0(x, y)); + return -(gradleg_tri_p10_e3_bx_0(x, y)); } static double gradleg_tri_p10_e3_by_0(double x, double y) { - double l2, l2y, l1, l1y; - double ker, kery, keryy; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - ker = phi9(l2 - l1); kery = phi9x(l2 - l1) * (l2y - l1y); keryy = phi9xx(l2 - l1) * sqr(l2y - l1y); - return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; + double l2, l2y, l1, l1y; + double ker, kery, keryy; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + ker = phi9(l2 - l1); kery = phi9x(l2 - l1) * (l2y - l1y); keryy = phi9xx(l2 - l1) * sqr(l2y - l1y); + return (2.0 * l2y * l1y * ker + 2.0 * l2y * l1 * kery + 2.0 * l2 * l1y * kery + l2 * l1 * keryy) / 1.0000000000000; } static double gradleg_tri_p10_e3_by_1(double x, double y) { - return -(gradleg_tri_p10_e3_by_0(x, y)); + return -(gradleg_tri_p10_e3_by_0(x, y)); } /* BUBBLE */ /* Edge-based BUBBLE - order 10 */ - // EDGE 1 + // EDGE 1 static double gradleg_tri_p10_b1_a(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n11 * (l3 * l2 * Legendre8(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n11 * (l3 * l2 * Legendre8(l3 - l2)); } static double gradleg_tri_p10_b1_b(double x, double y) { - double l3, l2; - l3 = lambda3(x, y); l2 = lambda2(x, y); - return n12 * (l3 * l2 * Legendre8(l3 - l2)); + double l3, l2; + l3 = lambda3(x, y); l2 = lambda2(x, y); + return n12 * (l3 * l2 * Legendre8(l3 - l2)); } static double gradleg_tri_p10_b1_ax(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n11 * (l3x * l2 * Legendre8(l3 - l2) + l3 * l2x * Legendre8(l3 - l2) + l3 * l2 * Legendre8x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n11 * (l3x * l2 * Legendre8(l3 - l2) + l3 * l2x * Legendre8(l3 - l2) + l3 * l2 * Legendre8x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p10_b1_bx(double x, double y) { - double l3, l3x, l2, l2x; - l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); - return n12 * (l3x * l2 * Legendre8(l3 - l2) + l3 * l2x * Legendre8(l3 - l2) + l3 * l2 * Legendre8x(l3 - l2) * (l3x - l2x)); + double l3, l3x, l2, l2x; + l3 = lambda3(x, y); l3x = lambda3x(x, y); l2 = lambda2(x, y); l2x = lambda2x(x, y); + return n12 * (l3x * l2 * Legendre8(l3 - l2) + l3 * l2x * Legendre8(l3 - l2) + l3 * l2 * Legendre8x(l3 - l2) * (l3x - l2x)); } static double gradleg_tri_p10_b1_ay(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n11 * (l3y * l2 * Legendre8(l3 - l2) + l3 * l2y * Legendre8(l3 - l2) + l3 * l2 * Legendre8x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n11 * (l3y * l2 * Legendre8(l3 - l2) + l3 * l2y * Legendre8(l3 - l2) + l3 * l2 * Legendre8x(l3 - l2) * (l3y - l2y)); } static double gradleg_tri_p10_b1_by(double x, double y) { - double l3, l3y, l2, l2y; - l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); - return n12 * (l3y * l2 * Legendre8(l3 - l2) + l3 * l2y * Legendre8(l3 - l2) + l3 * l2 * Legendre8x(l3 - l2) * (l3y - l2y)); + double l3, l3y, l2, l2y; + l3 = lambda3(x, y); l3y = lambda3y(x, y); l2 = lambda2(x, y); l2y = lambda2y(x, y); + return n12 * (l3y * l2 * Legendre8(l3 - l2) + l3 * l2y * Legendre8(l3 - l2) + l3 * l2 * Legendre8x(l3 - l2) * (l3y - l2y)); } - // EDGE 2 + // EDGE 2 static double gradleg_tri_p10_b2_a(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n21 * (l1 * l3 * Legendre8(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n21 * (l1 * l3 * Legendre8(l1 - l3)); } static double gradleg_tri_p10_b2_b(double x, double y) { - double l1, l3; - l1 = lambda1(x, y); l3 = lambda3(x, y); - return n22 * (l1 * l3 * Legendre8(l1 - l3)); + double l1, l3; + l1 = lambda1(x, y); l3 = lambda3(x, y); + return n22 * (l1 * l3 * Legendre8(l1 - l3)); } static double gradleg_tri_p10_b2_ax(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n21 * (l1x * l3 * Legendre8(l1 - l3) + l1 * l3x * Legendre8(l1 - l3) + l1 * l3 * Legendre8x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n21 * (l1x * l3 * Legendre8(l1 - l3) + l1 * l3x * Legendre8(l1 - l3) + l1 * l3 * Legendre8x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p10_b2_bx(double x, double y) { - double l1, l1x, l3, l3x; - l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); - return n22 * (l1x * l3 * Legendre8(l1 - l3) + l1 * l3x * Legendre8(l1 - l3) + l1 * l3 * Legendre8x(l1 - l3) * (l1x - l3x)); + double l1, l1x, l3, l3x; + l1 = lambda1(x, y); l1x = lambda1x(x, y); l3 = lambda3(x, y); l3x = lambda3x(x, y); + return n22 * (l1x * l3 * Legendre8(l1 - l3) + l1 * l3x * Legendre8(l1 - l3) + l1 * l3 * Legendre8x(l1 - l3) * (l1x - l3x)); } static double gradleg_tri_p10_b2_ay(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n21 * (l1y * l3 * Legendre8(l1 - l3) + l1 * l3y * Legendre8(l1 - l3) + l1 * l3 * Legendre8x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n21 * (l1y * l3 * Legendre8(l1 - l3) + l1 * l3y * Legendre8(l1 - l3) + l1 * l3 * Legendre8x(l1 - l3) * (l1y - l3y)); } static double gradleg_tri_p10_b2_by(double x, double y) { - double l1, l1y, l3, l3y; - l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); - return n22 * (l1y * l3 * Legendre8(l1 - l3) + l1 * l3y * Legendre8(l1 - l3) + l1 * l3 * Legendre8x(l1 - l3) * (l1y - l3y)); + double l1, l1y, l3, l3y; + l1 = lambda1(x, y); l1y = lambda1y(x, y); l3 = lambda3(x, y); l3y = lambda3y(x, y); + return n22 * (l1y * l3 * Legendre8(l1 - l3) + l1 * l3y * Legendre8(l1 - l3) + l1 * l3 * Legendre8x(l1 - l3) * (l1y - l3y)); } - // EDGE 3 + // EDGE 3 static double gradleg_tri_p10_b3_a(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n31 * (l2 * l1 * Legendre8(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n31 * (l2 * l1 * Legendre8(l2 - l1)); } static double gradleg_tri_p10_b3_b(double x, double y) { - double l2, l1; - l2 = lambda2(x, y); l1 = lambda1(x, y); - return n32 * (l2 * l1 * Legendre8(l2 - l1)); + double l2, l1; + l2 = lambda2(x, y); l1 = lambda1(x, y); + return n32 * (l2 * l1 * Legendre8(l2 - l1)); } static double gradleg_tri_p10_b3_ax(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n31 * (l2x * l1 * Legendre8(l2 - l1) + l2 * l1x * Legendre8(l2 - l1) + l2 * l1 * Legendre8x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n31 * (l2x * l1 * Legendre8(l2 - l1) + l2 * l1x * Legendre8(l2 - l1) + l2 * l1 * Legendre8x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p10_b3_bx(double x, double y) { - double l2, l2x, l1, l1x; - l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); - return n32 * (l2x * l1 * Legendre8(l2 - l1) + l2 * l1x * Legendre8(l2 - l1) + l2 * l1 * Legendre8x(l2 - l1) * (l2x - l1x)); + double l2, l2x, l1, l1x; + l2 = lambda2(x, y); l2x = lambda2x(x, y); l1 = lambda1(x, y); l1x = lambda1x(x, y); + return n32 * (l2x * l1 * Legendre8(l2 - l1) + l2 * l1x * Legendre8(l2 - l1) + l2 * l1 * Legendre8x(l2 - l1) * (l2x - l1x)); } static double gradleg_tri_p10_b3_ay(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n31 * (l2y * l1 * Legendre8(l2 - l1) + l2 * l1y * Legendre8(l2 - l1) + l2 * l1 * Legendre8x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n31 * (l2y * l1 * Legendre8(l2 - l1) + l2 * l1y * Legendre8(l2 - l1) + l2 * l1 * Legendre8x(l2 - l1) * (l2y - l1y)); } static double gradleg_tri_p10_b3_by(double x, double y) { - double l2, l2y, l1, l1y; - l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); - return n32 * (l2y * l1 * Legendre8(l2 - l1) + l2 * l1y * Legendre8(l2 - l1) + l2 * l1 * Legendre8x(l2 - l1) * (l2y - l1y)); + double l2, l2y, l1, l1y; + l2 = lambda2(x, y); l2y = lambda2y(x, y); l1 = lambda1(x, y); l1y = lambda1y(x, y); + return n32 * (l2y * l1 * Legendre8(l2 - l1) + l2 * l1y * Legendre8(l2 - l1) + l2 * l1 * Legendre8x(l2 - l1) * (l2y - l1y)); } /* Genuine BUBBLE - order 10 */ static double gradleg_tri_b1_b8_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre7(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre7(l2 - l1); } static double gradleg_tri_b1_b8_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b8_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre7(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre7x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre7(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre7x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b8_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b8_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre7(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre7x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre7(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre7x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b8_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b8_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre7(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre0(l3 - l2) * Legendre7(l2 - l1); } static double gradleg_tri_b1_b8_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b8_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre7(l2 - l1); - L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre7x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre7(l2 - l1); + L1x = Legendre0x(l3 - l2) * (l3x - l2x); L2x = Legendre7x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b1_b8_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b1_b8_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre0(l3 - l2); L2 = Legendre7(l2 - l1); - L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre7x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre0(l3 - l2); L2 = Legendre7(l2 - l1); + L1y = Legendre0x(l3 - l2) * (l3y - l2y); L2y = Legendre7x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b1_b8_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b7_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre6(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre6(l2 - l1); } static double gradleg_tri_b2_b7_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b7_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre6(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre6x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre6(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre6x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b7_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b7_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre6(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre6x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre6(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre6x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b7_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b7_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre6(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre1(l3 - l2) * Legendre6(l2 - l1); } static double gradleg_tri_b2_b7_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b7_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre6(l2 - l1); - L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre6x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre6(l2 - l1); + L1x = Legendre1x(l3 - l2) * (l3x - l2x); L2x = Legendre6x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b2_b7_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b2_b7_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre1(l3 - l2); L2 = Legendre6(l2 - l1); - L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre6x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre1(l3 - l2); L2 = Legendre6(l2 - l1); + L1y = Legendre1x(l3 - l2) * (l3y - l2y); L2y = Legendre6x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b2_b7_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b6_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre5(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre5(l2 - l1); } static double gradleg_tri_b3_b6_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b6_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre5(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre5(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b6_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b6_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre5(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre5(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b6_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b6_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre5(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre2(l3 - l2) * Legendre5(l2 - l1); } static double gradleg_tri_b3_b6_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b6_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre5(l2 - l1); - L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre5(l2 - l1); + L1x = Legendre2x(l3 - l2) * (l3x - l2x); L2x = Legendre5x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b3_b6_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b3_b6_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre2(l3 - l2); L2 = Legendre5(l2 - l1); - L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre2(l3 - l2); L2 = Legendre5(l2 - l1); + L1y = Legendre2x(l3 - l2) * (l3y - l2y); L2y = Legendre5x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b3_b6_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b5_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre4(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre4(l2 - l1); } static double gradleg_tri_b4_b5_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b5_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre4(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre4(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b5_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b5_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre4(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre4(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b5_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b5_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre4(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre3(l3 - l2) * Legendre4(l2 - l1); } static double gradleg_tri_b4_b5_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b5_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre4(l2 - l1); - L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre4(l2 - l1); + L1x = Legendre3x(l3 - l2) * (l3x - l2x); L2x = Legendre4x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b4_b5_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b4_b5_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre3(l3 - l2); L2 = Legendre4(l2 - l1); - L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre3(l3 - l2); L2 = Legendre4(l2 - l1); + L1y = Legendre3x(l3 - l2) * (l3y - l2y); L2y = Legendre4x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b4_b5_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b4_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b5_b4_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b4_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b5_b4_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b4_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b5_b4_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b4_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre3(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre4(l3 - l2) * Legendre3(l2 - l1); } static double gradleg_tri_b5_b4_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b4_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre3(l2 - l1); - L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre3(l2 - l1); + L1x = Legendre4x(l3 - l2) * (l3x - l2x); L2x = Legendre3x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b5_b4_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b5_b4_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre4(l3 - l2); L2 = Legendre3(l2 - l1); - L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre4(l3 - l2); L2 = Legendre3(l2 - l1); + L1y = Legendre4x(l3 - l2) * (l3y - l2y); L2y = Legendre3x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b5_b4_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b3_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b6_b3_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b3_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b6_b3_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b3_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b6_b3_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b3_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre2(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre5(l3 - l2) * Legendre2(l2 - l1); } static double gradleg_tri_b6_b3_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b3_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre2(l2 - l1); - L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre2(l2 - l1); + L1x = Legendre5x(l3 - l2) * (l3x - l2x); L2x = Legendre2x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b6_b3_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b6_b3_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre5(l3 - l2); L2 = Legendre2(l2 - l1); - L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre5(l3 - l2); L2 = Legendre2(l2 - l1); + L1y = Legendre5x(l3 - l2) * (l3y - l2y); L2y = Legendre2x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b6_b3_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b2_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre6(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre6(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b7_b2_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b2_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre6(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre6x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre6(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre6x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b7_b2_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b2_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre6(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre6x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre6(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre6x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b7_b2_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b2_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre6(l3 - l2) * Legendre1(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre6(l3 - l2) * Legendre1(l2 - l1); } static double gradleg_tri_b7_b2_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b2_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre6(l3 - l2); L2 = Legendre1(l2 - l1); - L1x = Legendre6x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre6(l3 - l2); L2 = Legendre1(l2 - l1); + L1x = Legendre6x(l3 - l2) * (l3x - l2x); L2x = Legendre1x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b7_b2_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b7_b2_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre6(l3 - l2); L2 = Legendre1(l2 - l1); - L1y = Legendre6x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre6(l3 - l2); L2 = Legendre1(l2 - l1); + L1y = Legendre6x(l3 - l2) * (l3y - l2y); L2y = Legendre1x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b7_b2_2_ay(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b8_b1_1_a(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre7(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre7(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b8_b1_1_b(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b8_b1_1_ax(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre7(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre7x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre7(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre7x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b8_b1_1_bx(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b8_b1_1_ay(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre7(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre7x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre7(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre7x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b8_b1_1_by(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b8_b1_2_b(double x, double y) { - double l1, l2, l3; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - return l1 * l2 * l3 * Legendre7(l3 - l2) * Legendre0(l2 - l1); + double l1, l2, l3; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + return l1 * l2 * l3 * Legendre7(l3 - l2) * Legendre0(l2 - l1); } static double gradleg_tri_b8_b1_2_a(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b8_b1_2_bx(double x, double y) { - double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); - L1 = Legendre7(l3 - l2); L2 = Legendre0(l2 - l1); - L1x = Legendre7x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); - return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; + double l1, l2, l3, l1x, l2x, l3x, L1, L2, L1x, L2x; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1x = lambda1x(x, y); l2x = lambda2x(x, y); l3x = lambda3x(x, y); + L1 = Legendre7(l3 - l2); L2 = Legendre0(l2 - l1); + L1x = Legendre7x(l3 - l2) * (l3x - l2x); L2x = Legendre0x(l2 - l1) * (l2x - l1x); + return l1x * l2 * l3 * L1 * L2 + l1 * l2x * l3 * L1 * L2 + l1 * l2 * l3x * L1 * L2 + l1 * l2 * l3 * L1x * L2 + l1 * l2 * l3 * L1 * L2x; } static double gradleg_tri_b8_b1_2_ax(double x, double y) { - return 0.0; + return 0.0; } static double gradleg_tri_b8_b1_2_by(double x, double y) { - double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; - l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); - l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); - L1 = Legendre7(l3 - l2); L2 = Legendre0(l2 - l1); - L1y = Legendre7x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); - return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; + double l1, l2, l3, l1y, l2y, l3y, L1, L2, L1y, L2y; + l1 = lambda1(x, y); l2 = lambda2(x, y); l3 = lambda3(x, y); + l1y = lambda1y(x, y); l2y = lambda2y(x, y); l3y = lambda3y(x, y); + L1 = Legendre7(l3 - l2); L2 = Legendre0(l2 - l1); + L1y = Legendre7x(l3 - l2) * (l3y - l2y); L2y = Legendre0x(l2 - l1) * (l2y - l1y); + return l1y * l2 * l3 * L1 * L2 + l1 * l2y * l3 * L1 * L2 + l1 * l2 * l3y * L1 * L2 + l1 * l2 * l3 * L1y * L2 + l1 * l2 * l3 * L1 * L2y; } static double gradleg_tri_b8_b1_2_ay(double x, double y) { - return 0.0; + return 0.0; } static Shapeset::shape_fn_t gradleg_tri_fn_a[] = { - gradleg_tri_p0_e1_a_0, gradleg_tri_p0_e1_a_1, gradleg_tri_p0_e2_a_0, gradleg_tri_p0_e2_a_1, gradleg_tri_p0_e3_a_0, gradleg_tri_p0_e3_a_1, - gradleg_tri_p1_e1_a, gradleg_tri_p1_e1_a, gradleg_tri_p1_e2_a, gradleg_tri_p1_e2_a, gradleg_tri_p1_e3_a, gradleg_tri_p1_e3_a, - gradleg_tri_p2_e1_a_0, gradleg_tri_p2_e1_a_1, gradleg_tri_p2_e2_a_0, gradleg_tri_p2_e2_a_1, gradleg_tri_p2_e3_a_0, gradleg_tri_p2_e3_a_1, - gradleg_tri_p3_e1_a, gradleg_tri_p3_e1_a, gradleg_tri_p3_e2_a, gradleg_tri_p3_e2_a, gradleg_tri_p3_e3_a, gradleg_tri_p3_e3_a, - gradleg_tri_p4_e1_a_0, gradleg_tri_p4_e1_a_1, gradleg_tri_p4_e2_a_0, gradleg_tri_p4_e2_a_1, gradleg_tri_p4_e3_a_0, gradleg_tri_p4_e3_a_1, - gradleg_tri_p5_e1_a, gradleg_tri_p5_e1_a, gradleg_tri_p5_e2_a, gradleg_tri_p5_e2_a, gradleg_tri_p5_e3_a, gradleg_tri_p5_e3_a, - gradleg_tri_p6_e1_a_0, gradleg_tri_p6_e1_a_1, gradleg_tri_p6_e2_a_0, gradleg_tri_p6_e2_a_1, gradleg_tri_p6_e3_a_0, gradleg_tri_p6_e3_a_1, - gradleg_tri_p7_e1_a, gradleg_tri_p7_e1_a, gradleg_tri_p7_e2_a, gradleg_tri_p7_e2_a, gradleg_tri_p7_e3_a, gradleg_tri_p7_e3_a, - gradleg_tri_p8_e1_a_0, gradleg_tri_p8_e1_a_1, gradleg_tri_p8_e2_a_0, gradleg_tri_p8_e2_a_1, gradleg_tri_p8_e3_a_0, gradleg_tri_p8_e3_a_1, - gradleg_tri_p9_e1_a, gradleg_tri_p9_e1_a, gradleg_tri_p9_e2_a, gradleg_tri_p9_e2_a, gradleg_tri_p9_e3_a, gradleg_tri_p9_e3_a, - gradleg_tri_p10_e1_a_0, gradleg_tri_p10_e1_a_1, gradleg_tri_p10_e2_a_0, gradleg_tri_p10_e2_a_1, gradleg_tri_p10_e3_a_0, gradleg_tri_p10_e3_a_1, - - gradleg_tri_p2_b1_a, gradleg_tri_p2_b2_a, gradleg_tri_p2_b3_a, gradleg_tri_p3_b1_a, gradleg_tri_p3_b2_a, gradleg_tri_p3_b3_a, gradleg_tri_p4_b1_a, gradleg_tri_p4_b2_a, gradleg_tri_p4_b3_a, gradleg_tri_p5_b1_a, gradleg_tri_p5_b2_a, gradleg_tri_p5_b3_a, gradleg_tri_p6_b1_a, gradleg_tri_p6_b2_a, gradleg_tri_p6_b3_a, gradleg_tri_p7_b1_a, gradleg_tri_p7_b2_a, gradleg_tri_p7_b3_a, gradleg_tri_p8_b1_a, gradleg_tri_p8_b2_a, gradleg_tri_p8_b3_a, gradleg_tri_p9_b1_a, gradleg_tri_p9_b2_a, gradleg_tri_p9_b3_a, gradleg_tri_p10_b1_a, gradleg_tri_p10_b2_a, gradleg_tri_p10_b3_a, - - gradleg_tri_b1_b1_1_a, gradleg_tri_b1_b1_2_a, gradleg_tri_b1_b2_1_a, gradleg_tri_b1_b2_2_a, gradleg_tri_b2_b1_1_a, gradleg_tri_b2_b1_2_a, gradleg_tri_b1_b3_1_a, gradleg_tri_b1_b3_2_a, gradleg_tri_b2_b2_1_a, gradleg_tri_b2_b2_2_a, gradleg_tri_b3_b1_1_a, gradleg_tri_b3_b1_2_a, gradleg_tri_b1_b4_1_a, gradleg_tri_b1_b4_2_a, gradleg_tri_b2_b3_1_a, gradleg_tri_b2_b3_2_a, gradleg_tri_b3_b2_1_a, gradleg_tri_b3_b2_2_a, gradleg_tri_b4_b1_1_a, gradleg_tri_b4_b1_2_a, gradleg_tri_b1_b5_1_a, gradleg_tri_b1_b5_2_a, gradleg_tri_b2_b4_1_a, gradleg_tri_b2_b4_2_a, gradleg_tri_b3_b3_1_a, gradleg_tri_b3_b3_2_a, gradleg_tri_b4_b2_1_a, gradleg_tri_b4_b2_2_a, gradleg_tri_b5_b1_1_a, gradleg_tri_b5_b1_2_a, gradleg_tri_b1_b6_1_a, gradleg_tri_b1_b6_2_a, gradleg_tri_b2_b5_1_a, gradleg_tri_b2_b5_2_a, gradleg_tri_b3_b4_1_a, gradleg_tri_b3_b4_2_a, gradleg_tri_b4_b3_1_a, gradleg_tri_b4_b3_2_a, gradleg_tri_b5_b2_1_a, gradleg_tri_b5_b2_2_a, gradleg_tri_b6_b1_1_a, gradleg_tri_b6_b1_2_a, gradleg_tri_b1_b7_1_a, gradleg_tri_b1_b7_2_a, gradleg_tri_b2_b6_1_a, gradleg_tri_b2_b6_2_a, gradleg_tri_b3_b5_1_a, gradleg_tri_b3_b5_2_a, gradleg_tri_b4_b4_1_a, gradleg_tri_b4_b4_2_a, gradleg_tri_b5_b3_1_a, gradleg_tri_b5_b3_2_a, gradleg_tri_b6_b2_1_a, gradleg_tri_b6_b2_2_a, gradleg_tri_b7_b1_1_a, gradleg_tri_b7_b1_2_a, gradleg_tri_b1_b8_1_a, gradleg_tri_b1_b8_2_a, gradleg_tri_b2_b7_1_a, gradleg_tri_b2_b7_2_a, gradleg_tri_b3_b6_1_a, gradleg_tri_b3_b6_2_a, gradleg_tri_b4_b5_1_a, gradleg_tri_b4_b5_2_a, gradleg_tri_b5_b4_1_a, gradleg_tri_b5_b4_2_a, gradleg_tri_b6_b3_1_a, gradleg_tri_b6_b3_2_a, gradleg_tri_b7_b2_1_a, gradleg_tri_b7_b2_2_a, gradleg_tri_b8_b1_1_a, gradleg_tri_b8_b1_2_a, + gradleg_tri_p0_e1_a_0, gradleg_tri_p0_e1_a_1, gradleg_tri_p0_e2_a_0, gradleg_tri_p0_e2_a_1, gradleg_tri_p0_e3_a_0, gradleg_tri_p0_e3_a_1, + gradleg_tri_p1_e1_a, gradleg_tri_p1_e1_a, gradleg_tri_p1_e2_a, gradleg_tri_p1_e2_a, gradleg_tri_p1_e3_a, gradleg_tri_p1_e3_a, + gradleg_tri_p2_e1_a_0, gradleg_tri_p2_e1_a_1, gradleg_tri_p2_e2_a_0, gradleg_tri_p2_e2_a_1, gradleg_tri_p2_e3_a_0, gradleg_tri_p2_e3_a_1, + gradleg_tri_p3_e1_a, gradleg_tri_p3_e1_a, gradleg_tri_p3_e2_a, gradleg_tri_p3_e2_a, gradleg_tri_p3_e3_a, gradleg_tri_p3_e3_a, + gradleg_tri_p4_e1_a_0, gradleg_tri_p4_e1_a_1, gradleg_tri_p4_e2_a_0, gradleg_tri_p4_e2_a_1, gradleg_tri_p4_e3_a_0, gradleg_tri_p4_e3_a_1, + gradleg_tri_p5_e1_a, gradleg_tri_p5_e1_a, gradleg_tri_p5_e2_a, gradleg_tri_p5_e2_a, gradleg_tri_p5_e3_a, gradleg_tri_p5_e3_a, + gradleg_tri_p6_e1_a_0, gradleg_tri_p6_e1_a_1, gradleg_tri_p6_e2_a_0, gradleg_tri_p6_e2_a_1, gradleg_tri_p6_e3_a_0, gradleg_tri_p6_e3_a_1, + gradleg_tri_p7_e1_a, gradleg_tri_p7_e1_a, gradleg_tri_p7_e2_a, gradleg_tri_p7_e2_a, gradleg_tri_p7_e3_a, gradleg_tri_p7_e3_a, + gradleg_tri_p8_e1_a_0, gradleg_tri_p8_e1_a_1, gradleg_tri_p8_e2_a_0, gradleg_tri_p8_e2_a_1, gradleg_tri_p8_e3_a_0, gradleg_tri_p8_e3_a_1, + gradleg_tri_p9_e1_a, gradleg_tri_p9_e1_a, gradleg_tri_p9_e2_a, gradleg_tri_p9_e2_a, gradleg_tri_p9_e3_a, gradleg_tri_p9_e3_a, + gradleg_tri_p10_e1_a_0, gradleg_tri_p10_e1_a_1, gradleg_tri_p10_e2_a_0, gradleg_tri_p10_e2_a_1, gradleg_tri_p10_e3_a_0, gradleg_tri_p10_e3_a_1, + + gradleg_tri_p2_b1_a, gradleg_tri_p2_b2_a, gradleg_tri_p2_b3_a, gradleg_tri_p3_b1_a, gradleg_tri_p3_b2_a, gradleg_tri_p3_b3_a, gradleg_tri_p4_b1_a, gradleg_tri_p4_b2_a, gradleg_tri_p4_b3_a, gradleg_tri_p5_b1_a, gradleg_tri_p5_b2_a, gradleg_tri_p5_b3_a, gradleg_tri_p6_b1_a, gradleg_tri_p6_b2_a, gradleg_tri_p6_b3_a, gradleg_tri_p7_b1_a, gradleg_tri_p7_b2_a, gradleg_tri_p7_b3_a, gradleg_tri_p8_b1_a, gradleg_tri_p8_b2_a, gradleg_tri_p8_b3_a, gradleg_tri_p9_b1_a, gradleg_tri_p9_b2_a, gradleg_tri_p9_b3_a, gradleg_tri_p10_b1_a, gradleg_tri_p10_b2_a, gradleg_tri_p10_b3_a, + + gradleg_tri_b1_b1_1_a, gradleg_tri_b1_b1_2_a, gradleg_tri_b1_b2_1_a, gradleg_tri_b1_b2_2_a, gradleg_tri_b2_b1_1_a, gradleg_tri_b2_b1_2_a, gradleg_tri_b1_b3_1_a, gradleg_tri_b1_b3_2_a, gradleg_tri_b2_b2_1_a, gradleg_tri_b2_b2_2_a, gradleg_tri_b3_b1_1_a, gradleg_tri_b3_b1_2_a, gradleg_tri_b1_b4_1_a, gradleg_tri_b1_b4_2_a, gradleg_tri_b2_b3_1_a, gradleg_tri_b2_b3_2_a, gradleg_tri_b3_b2_1_a, gradleg_tri_b3_b2_2_a, gradleg_tri_b4_b1_1_a, gradleg_tri_b4_b1_2_a, gradleg_tri_b1_b5_1_a, gradleg_tri_b1_b5_2_a, gradleg_tri_b2_b4_1_a, gradleg_tri_b2_b4_2_a, gradleg_tri_b3_b3_1_a, gradleg_tri_b3_b3_2_a, gradleg_tri_b4_b2_1_a, gradleg_tri_b4_b2_2_a, gradleg_tri_b5_b1_1_a, gradleg_tri_b5_b1_2_a, gradleg_tri_b1_b6_1_a, gradleg_tri_b1_b6_2_a, gradleg_tri_b2_b5_1_a, gradleg_tri_b2_b5_2_a, gradleg_tri_b3_b4_1_a, gradleg_tri_b3_b4_2_a, gradleg_tri_b4_b3_1_a, gradleg_tri_b4_b3_2_a, gradleg_tri_b5_b2_1_a, gradleg_tri_b5_b2_2_a, gradleg_tri_b6_b1_1_a, gradleg_tri_b6_b1_2_a, gradleg_tri_b1_b7_1_a, gradleg_tri_b1_b7_2_a, gradleg_tri_b2_b6_1_a, gradleg_tri_b2_b6_2_a, gradleg_tri_b3_b5_1_a, gradleg_tri_b3_b5_2_a, gradleg_tri_b4_b4_1_a, gradleg_tri_b4_b4_2_a, gradleg_tri_b5_b3_1_a, gradleg_tri_b5_b3_2_a, gradleg_tri_b6_b2_1_a, gradleg_tri_b6_b2_2_a, gradleg_tri_b7_b1_1_a, gradleg_tri_b7_b1_2_a, gradleg_tri_b1_b8_1_a, gradleg_tri_b1_b8_2_a, gradleg_tri_b2_b7_1_a, gradleg_tri_b2_b7_2_a, gradleg_tri_b3_b6_1_a, gradleg_tri_b3_b6_2_a, gradleg_tri_b4_b5_1_a, gradleg_tri_b4_b5_2_a, gradleg_tri_b5_b4_1_a, gradleg_tri_b5_b4_2_a, gradleg_tri_b6_b3_1_a, gradleg_tri_b6_b3_2_a, gradleg_tri_b7_b2_1_a, gradleg_tri_b7_b2_2_a, gradleg_tri_b8_b1_1_a, gradleg_tri_b8_b1_2_a, }; static Shapeset::shape_fn_t gradleg_tri_fn_b[] = { - gradleg_tri_p0_e1_b_0, gradleg_tri_p0_e1_b_1, gradleg_tri_p0_e2_b_0, gradleg_tri_p0_e2_b_1, gradleg_tri_p0_e3_b_0, gradleg_tri_p0_e3_b_1, - gradleg_tri_p1_e1_b, gradleg_tri_p1_e1_b, gradleg_tri_p1_e2_b, gradleg_tri_p1_e2_b, gradleg_tri_p1_e3_b, gradleg_tri_p1_e3_b, - gradleg_tri_p2_e1_b_0, gradleg_tri_p2_e1_b_1, gradleg_tri_p2_e2_b_0, gradleg_tri_p2_e2_b_1, gradleg_tri_p2_e3_b_0, gradleg_tri_p2_e3_b_1, - gradleg_tri_p3_e1_b, gradleg_tri_p3_e1_b, gradleg_tri_p3_e2_b, gradleg_tri_p3_e2_b, gradleg_tri_p3_e3_b, gradleg_tri_p3_e3_b, - gradleg_tri_p4_e1_b_0, gradleg_tri_p4_e1_b_1, gradleg_tri_p4_e2_b_0, gradleg_tri_p4_e2_b_1, gradleg_tri_p4_e3_b_0, gradleg_tri_p4_e3_b_1, - gradleg_tri_p5_e1_b, gradleg_tri_p5_e1_b, gradleg_tri_p5_e2_b, gradleg_tri_p5_e2_b, gradleg_tri_p5_e3_b, gradleg_tri_p5_e3_b, - gradleg_tri_p6_e1_b_0, gradleg_tri_p6_e1_b_1, gradleg_tri_p6_e2_b_0, gradleg_tri_p6_e2_b_1, gradleg_tri_p6_e3_b_0, gradleg_tri_p6_e3_b_1, - gradleg_tri_p7_e1_b, gradleg_tri_p7_e1_b, gradleg_tri_p7_e2_b, gradleg_tri_p7_e2_b, gradleg_tri_p7_e3_b, gradleg_tri_p7_e3_b, - gradleg_tri_p8_e1_b_0, gradleg_tri_p8_e1_b_1, gradleg_tri_p8_e2_b_0, gradleg_tri_p8_e2_b_1, gradleg_tri_p8_e3_b_0, gradleg_tri_p8_e3_b_1, - gradleg_tri_p9_e1_b, gradleg_tri_p9_e1_b, gradleg_tri_p9_e2_b, gradleg_tri_p9_e2_b, gradleg_tri_p9_e3_b, gradleg_tri_p9_e3_b, - gradleg_tri_p10_e1_b_0, gradleg_tri_p10_e1_b_1, gradleg_tri_p10_e2_b_0, gradleg_tri_p10_e2_b_1, gradleg_tri_p10_e3_b_0, gradleg_tri_p10_e3_b_1, - - gradleg_tri_p2_b1_b, gradleg_tri_p2_b2_b, gradleg_tri_p2_b3_b, gradleg_tri_p3_b1_b, gradleg_tri_p3_b2_b, gradleg_tri_p3_b3_b, gradleg_tri_p4_b1_b, gradleg_tri_p4_b2_b, gradleg_tri_p4_b3_b, gradleg_tri_p5_b1_b, gradleg_tri_p5_b2_b, gradleg_tri_p5_b3_b, gradleg_tri_p6_b1_b, gradleg_tri_p6_b2_b, gradleg_tri_p6_b3_b, gradleg_tri_p7_b1_b, gradleg_tri_p7_b2_b, gradleg_tri_p7_b3_b, gradleg_tri_p8_b1_b, gradleg_tri_p8_b2_b, gradleg_tri_p8_b3_b, gradleg_tri_p9_b1_b, gradleg_tri_p9_b2_b, gradleg_tri_p9_b3_b, gradleg_tri_p10_b1_b, gradleg_tri_p10_b2_b, gradleg_tri_p10_b3_b, - - gradleg_tri_b1_b1_1_b, gradleg_tri_b1_b1_2_b, gradleg_tri_b1_b2_1_b, gradleg_tri_b1_b2_2_b, gradleg_tri_b2_b1_1_b, gradleg_tri_b2_b1_2_b, gradleg_tri_b1_b3_1_b, gradleg_tri_b1_b3_2_b, gradleg_tri_b2_b2_1_b, gradleg_tri_b2_b2_2_b, gradleg_tri_b3_b1_1_b, gradleg_tri_b3_b1_2_b, gradleg_tri_b1_b4_1_b, gradleg_tri_b1_b4_2_b, gradleg_tri_b2_b3_1_b, gradleg_tri_b2_b3_2_b, gradleg_tri_b3_b2_1_b, gradleg_tri_b3_b2_2_b, gradleg_tri_b4_b1_1_b, gradleg_tri_b4_b1_2_b, gradleg_tri_b1_b5_1_b, gradleg_tri_b1_b5_2_b, gradleg_tri_b2_b4_1_b, gradleg_tri_b2_b4_2_b, gradleg_tri_b3_b3_1_b, gradleg_tri_b3_b3_2_b, gradleg_tri_b4_b2_1_b, gradleg_tri_b4_b2_2_b, gradleg_tri_b5_b1_1_b, gradleg_tri_b5_b1_2_b, gradleg_tri_b1_b6_1_b, gradleg_tri_b1_b6_2_b, gradleg_tri_b2_b5_1_b, gradleg_tri_b2_b5_2_b, gradleg_tri_b3_b4_1_b, gradleg_tri_b3_b4_2_b, gradleg_tri_b4_b3_1_b, gradleg_tri_b4_b3_2_b, gradleg_tri_b5_b2_1_b, gradleg_tri_b5_b2_2_b, gradleg_tri_b6_b1_1_b, gradleg_tri_b6_b1_2_b, gradleg_tri_b1_b7_1_b, gradleg_tri_b1_b7_2_b, gradleg_tri_b2_b6_1_b, gradleg_tri_b2_b6_2_b, gradleg_tri_b3_b5_1_b, gradleg_tri_b3_b5_2_b, gradleg_tri_b4_b4_1_b, gradleg_tri_b4_b4_2_b, gradleg_tri_b5_b3_1_b, gradleg_tri_b5_b3_2_b, gradleg_tri_b6_b2_1_b, gradleg_tri_b6_b2_2_b, gradleg_tri_b7_b1_1_b, gradleg_tri_b7_b1_2_b, gradleg_tri_b1_b8_1_b, gradleg_tri_b1_b8_2_b, gradleg_tri_b2_b7_1_b, gradleg_tri_b2_b7_2_b, gradleg_tri_b3_b6_1_b, gradleg_tri_b3_b6_2_b, gradleg_tri_b4_b5_1_b, gradleg_tri_b4_b5_2_b, gradleg_tri_b5_b4_1_b, gradleg_tri_b5_b4_2_b, gradleg_tri_b6_b3_1_b, gradleg_tri_b6_b3_2_b, gradleg_tri_b7_b2_1_b, gradleg_tri_b7_b2_2_b, gradleg_tri_b8_b1_1_b, gradleg_tri_b8_b1_2_b, + gradleg_tri_p0_e1_b_0, gradleg_tri_p0_e1_b_1, gradleg_tri_p0_e2_b_0, gradleg_tri_p0_e2_b_1, gradleg_tri_p0_e3_b_0, gradleg_tri_p0_e3_b_1, + gradleg_tri_p1_e1_b, gradleg_tri_p1_e1_b, gradleg_tri_p1_e2_b, gradleg_tri_p1_e2_b, gradleg_tri_p1_e3_b, gradleg_tri_p1_e3_b, + gradleg_tri_p2_e1_b_0, gradleg_tri_p2_e1_b_1, gradleg_tri_p2_e2_b_0, gradleg_tri_p2_e2_b_1, gradleg_tri_p2_e3_b_0, gradleg_tri_p2_e3_b_1, + gradleg_tri_p3_e1_b, gradleg_tri_p3_e1_b, gradleg_tri_p3_e2_b, gradleg_tri_p3_e2_b, gradleg_tri_p3_e3_b, gradleg_tri_p3_e3_b, + gradleg_tri_p4_e1_b_0, gradleg_tri_p4_e1_b_1, gradleg_tri_p4_e2_b_0, gradleg_tri_p4_e2_b_1, gradleg_tri_p4_e3_b_0, gradleg_tri_p4_e3_b_1, + gradleg_tri_p5_e1_b, gradleg_tri_p5_e1_b, gradleg_tri_p5_e2_b, gradleg_tri_p5_e2_b, gradleg_tri_p5_e3_b, gradleg_tri_p5_e3_b, + gradleg_tri_p6_e1_b_0, gradleg_tri_p6_e1_b_1, gradleg_tri_p6_e2_b_0, gradleg_tri_p6_e2_b_1, gradleg_tri_p6_e3_b_0, gradleg_tri_p6_e3_b_1, + gradleg_tri_p7_e1_b, gradleg_tri_p7_e1_b, gradleg_tri_p7_e2_b, gradleg_tri_p7_e2_b, gradleg_tri_p7_e3_b, gradleg_tri_p7_e3_b, + gradleg_tri_p8_e1_b_0, gradleg_tri_p8_e1_b_1, gradleg_tri_p8_e2_b_0, gradleg_tri_p8_e2_b_1, gradleg_tri_p8_e3_b_0, gradleg_tri_p8_e3_b_1, + gradleg_tri_p9_e1_b, gradleg_tri_p9_e1_b, gradleg_tri_p9_e2_b, gradleg_tri_p9_e2_b, gradleg_tri_p9_e3_b, gradleg_tri_p9_e3_b, + gradleg_tri_p10_e1_b_0, gradleg_tri_p10_e1_b_1, gradleg_tri_p10_e2_b_0, gradleg_tri_p10_e2_b_1, gradleg_tri_p10_e3_b_0, gradleg_tri_p10_e3_b_1, + + gradleg_tri_p2_b1_b, gradleg_tri_p2_b2_b, gradleg_tri_p2_b3_b, gradleg_tri_p3_b1_b, gradleg_tri_p3_b2_b, gradleg_tri_p3_b3_b, gradleg_tri_p4_b1_b, gradleg_tri_p4_b2_b, gradleg_tri_p4_b3_b, gradleg_tri_p5_b1_b, gradleg_tri_p5_b2_b, gradleg_tri_p5_b3_b, gradleg_tri_p6_b1_b, gradleg_tri_p6_b2_b, gradleg_tri_p6_b3_b, gradleg_tri_p7_b1_b, gradleg_tri_p7_b2_b, gradleg_tri_p7_b3_b, gradleg_tri_p8_b1_b, gradleg_tri_p8_b2_b, gradleg_tri_p8_b3_b, gradleg_tri_p9_b1_b, gradleg_tri_p9_b2_b, gradleg_tri_p9_b3_b, gradleg_tri_p10_b1_b, gradleg_tri_p10_b2_b, gradleg_tri_p10_b3_b, + + gradleg_tri_b1_b1_1_b, gradleg_tri_b1_b1_2_b, gradleg_tri_b1_b2_1_b, gradleg_tri_b1_b2_2_b, gradleg_tri_b2_b1_1_b, gradleg_tri_b2_b1_2_b, gradleg_tri_b1_b3_1_b, gradleg_tri_b1_b3_2_b, gradleg_tri_b2_b2_1_b, gradleg_tri_b2_b2_2_b, gradleg_tri_b3_b1_1_b, gradleg_tri_b3_b1_2_b, gradleg_tri_b1_b4_1_b, gradleg_tri_b1_b4_2_b, gradleg_tri_b2_b3_1_b, gradleg_tri_b2_b3_2_b, gradleg_tri_b3_b2_1_b, gradleg_tri_b3_b2_2_b, gradleg_tri_b4_b1_1_b, gradleg_tri_b4_b1_2_b, gradleg_tri_b1_b5_1_b, gradleg_tri_b1_b5_2_b, gradleg_tri_b2_b4_1_b, gradleg_tri_b2_b4_2_b, gradleg_tri_b3_b3_1_b, gradleg_tri_b3_b3_2_b, gradleg_tri_b4_b2_1_b, gradleg_tri_b4_b2_2_b, gradleg_tri_b5_b1_1_b, gradleg_tri_b5_b1_2_b, gradleg_tri_b1_b6_1_b, gradleg_tri_b1_b6_2_b, gradleg_tri_b2_b5_1_b, gradleg_tri_b2_b5_2_b, gradleg_tri_b3_b4_1_b, gradleg_tri_b3_b4_2_b, gradleg_tri_b4_b3_1_b, gradleg_tri_b4_b3_2_b, gradleg_tri_b5_b2_1_b, gradleg_tri_b5_b2_2_b, gradleg_tri_b6_b1_1_b, gradleg_tri_b6_b1_2_b, gradleg_tri_b1_b7_1_b, gradleg_tri_b1_b7_2_b, gradleg_tri_b2_b6_1_b, gradleg_tri_b2_b6_2_b, gradleg_tri_b3_b5_1_b, gradleg_tri_b3_b5_2_b, gradleg_tri_b4_b4_1_b, gradleg_tri_b4_b4_2_b, gradleg_tri_b5_b3_1_b, gradleg_tri_b5_b3_2_b, gradleg_tri_b6_b2_1_b, gradleg_tri_b6_b2_2_b, gradleg_tri_b7_b1_1_b, gradleg_tri_b7_b1_2_b, gradleg_tri_b1_b8_1_b, gradleg_tri_b1_b8_2_b, gradleg_tri_b2_b7_1_b, gradleg_tri_b2_b7_2_b, gradleg_tri_b3_b6_1_b, gradleg_tri_b3_b6_2_b, gradleg_tri_b4_b5_1_b, gradleg_tri_b4_b5_2_b, gradleg_tri_b5_b4_1_b, gradleg_tri_b5_b4_2_b, gradleg_tri_b6_b3_1_b, gradleg_tri_b6_b3_2_b, gradleg_tri_b7_b2_1_b, gradleg_tri_b7_b2_2_b, gradleg_tri_b8_b1_1_b, gradleg_tri_b8_b1_2_b, }; static Shapeset::shape_fn_t gradleg_tri_fn_ax[] = { - gradleg_tri_p0_e1_ax_0, gradleg_tri_p0_e1_ax_1, gradleg_tri_p0_e2_ax_0, gradleg_tri_p0_e2_ax_1, gradleg_tri_p0_e3_ax_0, gradleg_tri_p0_e3_ax_1, - gradleg_tri_p1_e1_ax, gradleg_tri_p1_e1_ax, gradleg_tri_p1_e2_ax, gradleg_tri_p1_e2_ax, gradleg_tri_p1_e3_ax, gradleg_tri_p1_e3_ax, - gradleg_tri_p2_e1_ax_0, gradleg_tri_p2_e1_ax_1, gradleg_tri_p2_e2_ax_0, gradleg_tri_p2_e2_ax_1, gradleg_tri_p2_e3_ax_0, gradleg_tri_p2_e3_ax_1, - gradleg_tri_p3_e1_ax, gradleg_tri_p3_e1_ax, gradleg_tri_p3_e2_ax, gradleg_tri_p3_e2_ax, gradleg_tri_p3_e3_ax, gradleg_tri_p3_e3_ax, - gradleg_tri_p4_e1_ax_0, gradleg_tri_p4_e1_ax_1, gradleg_tri_p4_e2_ax_0, gradleg_tri_p4_e2_ax_1, gradleg_tri_p4_e3_ax_0, gradleg_tri_p4_e3_ax_1, - gradleg_tri_p5_e1_ax, gradleg_tri_p5_e1_ax, gradleg_tri_p5_e2_ax, gradleg_tri_p5_e2_ax, gradleg_tri_p5_e3_ax, gradleg_tri_p5_e3_ax, - gradleg_tri_p6_e1_ax_0, gradleg_tri_p6_e1_ax_1, gradleg_tri_p6_e2_ax_0, gradleg_tri_p6_e2_ax_1, gradleg_tri_p6_e3_ax_0, gradleg_tri_p6_e3_ax_1, - gradleg_tri_p7_e1_ax, gradleg_tri_p7_e1_ax, gradleg_tri_p7_e2_ax, gradleg_tri_p7_e2_ax, gradleg_tri_p7_e3_ax, gradleg_tri_p7_e3_ax, - gradleg_tri_p8_e1_ax_0, gradleg_tri_p8_e1_ax_1, gradleg_tri_p8_e2_ax_0, gradleg_tri_p8_e2_ax_1, gradleg_tri_p8_e3_ax_0, gradleg_tri_p8_e3_ax_1, - gradleg_tri_p9_e1_ax, gradleg_tri_p9_e1_ax, gradleg_tri_p9_e2_ax, gradleg_tri_p9_e2_ax, gradleg_tri_p9_e3_ax, gradleg_tri_p9_e3_ax, - gradleg_tri_p10_e1_ax_0, gradleg_tri_p10_e1_ax_1, gradleg_tri_p10_e2_ax_0, gradleg_tri_p10_e2_ax_1, gradleg_tri_p10_e3_ax_0, gradleg_tri_p10_e3_ax_1, - - gradleg_tri_p2_b1_ax, gradleg_tri_p2_b2_ax, gradleg_tri_p2_b3_ax, gradleg_tri_p3_b1_ax, gradleg_tri_p3_b2_ax, gradleg_tri_p3_b3_ax, gradleg_tri_p4_b1_ax, gradleg_tri_p4_b2_ax, gradleg_tri_p4_b3_ax, gradleg_tri_p5_b1_ax, gradleg_tri_p5_b2_ax, gradleg_tri_p5_b3_ax, gradleg_tri_p6_b1_ax, gradleg_tri_p6_b2_ax, gradleg_tri_p6_b3_ax, gradleg_tri_p7_b1_ax, gradleg_tri_p7_b2_ax, gradleg_tri_p7_b3_ax, gradleg_tri_p8_b1_ax, gradleg_tri_p8_b2_ax, gradleg_tri_p8_b3_ax, gradleg_tri_p9_b1_ax, gradleg_tri_p9_b2_ax, gradleg_tri_p9_b3_ax, gradleg_tri_p10_b1_ax, gradleg_tri_p10_b2_ax, gradleg_tri_p10_b3_ax, - - gradleg_tri_b1_b1_1_ax, gradleg_tri_b1_b1_2_ax, gradleg_tri_b1_b2_1_ax, gradleg_tri_b1_b2_2_ax, gradleg_tri_b2_b1_1_ax, gradleg_tri_b2_b1_2_ax, gradleg_tri_b1_b3_1_ax, gradleg_tri_b1_b3_2_ax, gradleg_tri_b2_b2_1_ax, gradleg_tri_b2_b2_2_ax, gradleg_tri_b3_b1_1_ax, gradleg_tri_b3_b1_2_ax, gradleg_tri_b1_b4_1_ax, gradleg_tri_b1_b4_2_ax, gradleg_tri_b2_b3_1_ax, gradleg_tri_b2_b3_2_ax, gradleg_tri_b3_b2_1_ax, gradleg_tri_b3_b2_2_ax, gradleg_tri_b4_b1_1_ax, gradleg_tri_b4_b1_2_ax, gradleg_tri_b1_b5_1_ax, gradleg_tri_b1_b5_2_ax, gradleg_tri_b2_b4_1_ax, gradleg_tri_b2_b4_2_ax, gradleg_tri_b3_b3_1_ax, gradleg_tri_b3_b3_2_ax, gradleg_tri_b4_b2_1_ax, gradleg_tri_b4_b2_2_ax, gradleg_tri_b5_b1_1_ax, gradleg_tri_b5_b1_2_ax, gradleg_tri_b1_b6_1_ax, gradleg_tri_b1_b6_2_ax, gradleg_tri_b2_b5_1_ax, gradleg_tri_b2_b5_2_ax, gradleg_tri_b3_b4_1_ax, gradleg_tri_b3_b4_2_ax, gradleg_tri_b4_b3_1_ax, gradleg_tri_b4_b3_2_ax, gradleg_tri_b5_b2_1_ax, gradleg_tri_b5_b2_2_ax, gradleg_tri_b6_b1_1_ax, gradleg_tri_b6_b1_2_ax, gradleg_tri_b1_b7_1_ax, gradleg_tri_b1_b7_2_ax, gradleg_tri_b2_b6_1_ax, gradleg_tri_b2_b6_2_ax, gradleg_tri_b3_b5_1_ax, gradleg_tri_b3_b5_2_ax, gradleg_tri_b4_b4_1_ax, gradleg_tri_b4_b4_2_ax, gradleg_tri_b5_b3_1_ax, gradleg_tri_b5_b3_2_ax, gradleg_tri_b6_b2_1_ax, gradleg_tri_b6_b2_2_ax, gradleg_tri_b7_b1_1_ax, gradleg_tri_b7_b1_2_ax, gradleg_tri_b1_b8_1_ax, gradleg_tri_b1_b8_2_ax, gradleg_tri_b2_b7_1_ax, gradleg_tri_b2_b7_2_ax, gradleg_tri_b3_b6_1_ax, gradleg_tri_b3_b6_2_ax, gradleg_tri_b4_b5_1_ax, gradleg_tri_b4_b5_2_ax, gradleg_tri_b5_b4_1_ax, gradleg_tri_b5_b4_2_ax, gradleg_tri_b6_b3_1_ax, gradleg_tri_b6_b3_2_ax, gradleg_tri_b7_b2_1_ax, gradleg_tri_b7_b2_2_ax, gradleg_tri_b8_b1_1_ax, gradleg_tri_b8_b1_2_ax, + gradleg_tri_p0_e1_ax_0, gradleg_tri_p0_e1_ax_1, gradleg_tri_p0_e2_ax_0, gradleg_tri_p0_e2_ax_1, gradleg_tri_p0_e3_ax_0, gradleg_tri_p0_e3_ax_1, + gradleg_tri_p1_e1_ax, gradleg_tri_p1_e1_ax, gradleg_tri_p1_e2_ax, gradleg_tri_p1_e2_ax, gradleg_tri_p1_e3_ax, gradleg_tri_p1_e3_ax, + gradleg_tri_p2_e1_ax_0, gradleg_tri_p2_e1_ax_1, gradleg_tri_p2_e2_ax_0, gradleg_tri_p2_e2_ax_1, gradleg_tri_p2_e3_ax_0, gradleg_tri_p2_e3_ax_1, + gradleg_tri_p3_e1_ax, gradleg_tri_p3_e1_ax, gradleg_tri_p3_e2_ax, gradleg_tri_p3_e2_ax, gradleg_tri_p3_e3_ax, gradleg_tri_p3_e3_ax, + gradleg_tri_p4_e1_ax_0, gradleg_tri_p4_e1_ax_1, gradleg_tri_p4_e2_ax_0, gradleg_tri_p4_e2_ax_1, gradleg_tri_p4_e3_ax_0, gradleg_tri_p4_e3_ax_1, + gradleg_tri_p5_e1_ax, gradleg_tri_p5_e1_ax, gradleg_tri_p5_e2_ax, gradleg_tri_p5_e2_ax, gradleg_tri_p5_e3_ax, gradleg_tri_p5_e3_ax, + gradleg_tri_p6_e1_ax_0, gradleg_tri_p6_e1_ax_1, gradleg_tri_p6_e2_ax_0, gradleg_tri_p6_e2_ax_1, gradleg_tri_p6_e3_ax_0, gradleg_tri_p6_e3_ax_1, + gradleg_tri_p7_e1_ax, gradleg_tri_p7_e1_ax, gradleg_tri_p7_e2_ax, gradleg_tri_p7_e2_ax, gradleg_tri_p7_e3_ax, gradleg_tri_p7_e3_ax, + gradleg_tri_p8_e1_ax_0, gradleg_tri_p8_e1_ax_1, gradleg_tri_p8_e2_ax_0, gradleg_tri_p8_e2_ax_1, gradleg_tri_p8_e3_ax_0, gradleg_tri_p8_e3_ax_1, + gradleg_tri_p9_e1_ax, gradleg_tri_p9_e1_ax, gradleg_tri_p9_e2_ax, gradleg_tri_p9_e2_ax, gradleg_tri_p9_e3_ax, gradleg_tri_p9_e3_ax, + gradleg_tri_p10_e1_ax_0, gradleg_tri_p10_e1_ax_1, gradleg_tri_p10_e2_ax_0, gradleg_tri_p10_e2_ax_1, gradleg_tri_p10_e3_ax_0, gradleg_tri_p10_e3_ax_1, + + gradleg_tri_p2_b1_ax, gradleg_tri_p2_b2_ax, gradleg_tri_p2_b3_ax, gradleg_tri_p3_b1_ax, gradleg_tri_p3_b2_ax, gradleg_tri_p3_b3_ax, gradleg_tri_p4_b1_ax, gradleg_tri_p4_b2_ax, gradleg_tri_p4_b3_ax, gradleg_tri_p5_b1_ax, gradleg_tri_p5_b2_ax, gradleg_tri_p5_b3_ax, gradleg_tri_p6_b1_ax, gradleg_tri_p6_b2_ax, gradleg_tri_p6_b3_ax, gradleg_tri_p7_b1_ax, gradleg_tri_p7_b2_ax, gradleg_tri_p7_b3_ax, gradleg_tri_p8_b1_ax, gradleg_tri_p8_b2_ax, gradleg_tri_p8_b3_ax, gradleg_tri_p9_b1_ax, gradleg_tri_p9_b2_ax, gradleg_tri_p9_b3_ax, gradleg_tri_p10_b1_ax, gradleg_tri_p10_b2_ax, gradleg_tri_p10_b3_ax, + + gradleg_tri_b1_b1_1_ax, gradleg_tri_b1_b1_2_ax, gradleg_tri_b1_b2_1_ax, gradleg_tri_b1_b2_2_ax, gradleg_tri_b2_b1_1_ax, gradleg_tri_b2_b1_2_ax, gradleg_tri_b1_b3_1_ax, gradleg_tri_b1_b3_2_ax, gradleg_tri_b2_b2_1_ax, gradleg_tri_b2_b2_2_ax, gradleg_tri_b3_b1_1_ax, gradleg_tri_b3_b1_2_ax, gradleg_tri_b1_b4_1_ax, gradleg_tri_b1_b4_2_ax, gradleg_tri_b2_b3_1_ax, gradleg_tri_b2_b3_2_ax, gradleg_tri_b3_b2_1_ax, gradleg_tri_b3_b2_2_ax, gradleg_tri_b4_b1_1_ax, gradleg_tri_b4_b1_2_ax, gradleg_tri_b1_b5_1_ax, gradleg_tri_b1_b5_2_ax, gradleg_tri_b2_b4_1_ax, gradleg_tri_b2_b4_2_ax, gradleg_tri_b3_b3_1_ax, gradleg_tri_b3_b3_2_ax, gradleg_tri_b4_b2_1_ax, gradleg_tri_b4_b2_2_ax, gradleg_tri_b5_b1_1_ax, gradleg_tri_b5_b1_2_ax, gradleg_tri_b1_b6_1_ax, gradleg_tri_b1_b6_2_ax, gradleg_tri_b2_b5_1_ax, gradleg_tri_b2_b5_2_ax, gradleg_tri_b3_b4_1_ax, gradleg_tri_b3_b4_2_ax, gradleg_tri_b4_b3_1_ax, gradleg_tri_b4_b3_2_ax, gradleg_tri_b5_b2_1_ax, gradleg_tri_b5_b2_2_ax, gradleg_tri_b6_b1_1_ax, gradleg_tri_b6_b1_2_ax, gradleg_tri_b1_b7_1_ax, gradleg_tri_b1_b7_2_ax, gradleg_tri_b2_b6_1_ax, gradleg_tri_b2_b6_2_ax, gradleg_tri_b3_b5_1_ax, gradleg_tri_b3_b5_2_ax, gradleg_tri_b4_b4_1_ax, gradleg_tri_b4_b4_2_ax, gradleg_tri_b5_b3_1_ax, gradleg_tri_b5_b3_2_ax, gradleg_tri_b6_b2_1_ax, gradleg_tri_b6_b2_2_ax, gradleg_tri_b7_b1_1_ax, gradleg_tri_b7_b1_2_ax, gradleg_tri_b1_b8_1_ax, gradleg_tri_b1_b8_2_ax, gradleg_tri_b2_b7_1_ax, gradleg_tri_b2_b7_2_ax, gradleg_tri_b3_b6_1_ax, gradleg_tri_b3_b6_2_ax, gradleg_tri_b4_b5_1_ax, gradleg_tri_b4_b5_2_ax, gradleg_tri_b5_b4_1_ax, gradleg_tri_b5_b4_2_ax, gradleg_tri_b6_b3_1_ax, gradleg_tri_b6_b3_2_ax, gradleg_tri_b7_b2_1_ax, gradleg_tri_b7_b2_2_ax, gradleg_tri_b8_b1_1_ax, gradleg_tri_b8_b1_2_ax, }; static Shapeset::shape_fn_t gradleg_tri_fn_bx[] = { - gradleg_tri_p0_e1_bx_0, gradleg_tri_p0_e1_bx_1, gradleg_tri_p0_e2_bx_0, gradleg_tri_p0_e2_bx_1, gradleg_tri_p0_e3_bx_0, gradleg_tri_p0_e3_bx_1, - gradleg_tri_p1_e1_bx, gradleg_tri_p1_e1_bx, gradleg_tri_p1_e2_bx, gradleg_tri_p1_e2_bx, gradleg_tri_p1_e3_bx, gradleg_tri_p1_e3_bx, - gradleg_tri_p2_e1_bx_0, gradleg_tri_p2_e1_bx_1, gradleg_tri_p2_e2_bx_0, gradleg_tri_p2_e2_bx_1, gradleg_tri_p2_e3_bx_0, gradleg_tri_p2_e3_bx_1, - gradleg_tri_p3_e1_bx, gradleg_tri_p3_e1_bx, gradleg_tri_p3_e2_bx, gradleg_tri_p3_e2_bx, gradleg_tri_p3_e3_bx, gradleg_tri_p3_e3_bx, - gradleg_tri_p4_e1_bx_0, gradleg_tri_p4_e1_bx_1, gradleg_tri_p4_e2_bx_0, gradleg_tri_p4_e2_bx_1, gradleg_tri_p4_e3_bx_0, gradleg_tri_p4_e3_bx_1, - gradleg_tri_p5_e1_bx, gradleg_tri_p5_e1_bx, gradleg_tri_p5_e2_bx, gradleg_tri_p5_e2_bx, gradleg_tri_p5_e3_bx, gradleg_tri_p5_e3_bx, - gradleg_tri_p6_e1_bx_0, gradleg_tri_p6_e1_bx_1, gradleg_tri_p6_e2_bx_0, gradleg_tri_p6_e2_bx_1, gradleg_tri_p6_e3_bx_0, gradleg_tri_p6_e3_bx_1, - gradleg_tri_p7_e1_bx, gradleg_tri_p7_e1_bx, gradleg_tri_p7_e2_bx, gradleg_tri_p7_e2_bx, gradleg_tri_p7_e3_bx, gradleg_tri_p7_e3_bx, - gradleg_tri_p8_e1_bx_0, gradleg_tri_p8_e1_bx_1, gradleg_tri_p8_e2_bx_0, gradleg_tri_p8_e2_bx_1, gradleg_tri_p8_e3_bx_0, gradleg_tri_p8_e3_bx_1, - gradleg_tri_p9_e1_bx, gradleg_tri_p9_e1_bx, gradleg_tri_p9_e2_bx, gradleg_tri_p9_e2_bx, gradleg_tri_p9_e3_bx, gradleg_tri_p9_e3_bx, - gradleg_tri_p10_e1_bx_0, gradleg_tri_p10_e1_bx_1, gradleg_tri_p10_e2_bx_0, gradleg_tri_p10_e2_bx_1, gradleg_tri_p10_e3_bx_0, gradleg_tri_p10_e3_bx_1, - - gradleg_tri_p2_b1_bx, gradleg_tri_p2_b2_bx, gradleg_tri_p2_b3_bx, gradleg_tri_p3_b1_bx, gradleg_tri_p3_b2_bx, gradleg_tri_p3_b3_bx, gradleg_tri_p4_b1_bx, gradleg_tri_p4_b2_bx, gradleg_tri_p4_b3_bx, gradleg_tri_p5_b1_bx, gradleg_tri_p5_b2_bx, gradleg_tri_p5_b3_bx, gradleg_tri_p6_b1_bx, gradleg_tri_p6_b2_bx, gradleg_tri_p6_b3_bx, gradleg_tri_p7_b1_bx, gradleg_tri_p7_b2_bx, gradleg_tri_p7_b3_bx, gradleg_tri_p8_b1_bx, gradleg_tri_p8_b2_bx, gradleg_tri_p8_b3_bx, gradleg_tri_p9_b1_bx, gradleg_tri_p9_b2_bx, gradleg_tri_p9_b3_bx, gradleg_tri_p10_b1_bx, gradleg_tri_p10_b2_bx, gradleg_tri_p10_b3_bx, - - gradleg_tri_b1_b1_1_bx, gradleg_tri_b1_b1_2_bx, gradleg_tri_b1_b2_1_bx, gradleg_tri_b1_b2_2_bx, gradleg_tri_b2_b1_1_bx, gradleg_tri_b2_b1_2_bx, gradleg_tri_b1_b3_1_bx, gradleg_tri_b1_b3_2_bx, gradleg_tri_b2_b2_1_bx, gradleg_tri_b2_b2_2_bx, gradleg_tri_b3_b1_1_bx, gradleg_tri_b3_b1_2_bx, gradleg_tri_b1_b4_1_bx, gradleg_tri_b1_b4_2_bx, gradleg_tri_b2_b3_1_bx, gradleg_tri_b2_b3_2_bx, gradleg_tri_b3_b2_1_bx, gradleg_tri_b3_b2_2_bx, gradleg_tri_b4_b1_1_bx, gradleg_tri_b4_b1_2_bx, gradleg_tri_b1_b5_1_bx, gradleg_tri_b1_b5_2_bx, gradleg_tri_b2_b4_1_bx, gradleg_tri_b2_b4_2_bx, gradleg_tri_b3_b3_1_bx, gradleg_tri_b3_b3_2_bx, gradleg_tri_b4_b2_1_bx, gradleg_tri_b4_b2_2_bx, gradleg_tri_b5_b1_1_bx, gradleg_tri_b5_b1_2_bx, gradleg_tri_b1_b6_1_bx, gradleg_tri_b1_b6_2_bx, gradleg_tri_b2_b5_1_bx, gradleg_tri_b2_b5_2_bx, gradleg_tri_b3_b4_1_bx, gradleg_tri_b3_b4_2_bx, gradleg_tri_b4_b3_1_bx, gradleg_tri_b4_b3_2_bx, gradleg_tri_b5_b2_1_bx, gradleg_tri_b5_b2_2_bx, gradleg_tri_b6_b1_1_bx, gradleg_tri_b6_b1_2_bx, gradleg_tri_b1_b7_1_bx, gradleg_tri_b1_b7_2_bx, gradleg_tri_b2_b6_1_bx, gradleg_tri_b2_b6_2_bx, gradleg_tri_b3_b5_1_bx, gradleg_tri_b3_b5_2_bx, gradleg_tri_b4_b4_1_bx, gradleg_tri_b4_b4_2_bx, gradleg_tri_b5_b3_1_bx, gradleg_tri_b5_b3_2_bx, gradleg_tri_b6_b2_1_bx, gradleg_tri_b6_b2_2_bx, gradleg_tri_b7_b1_1_bx, gradleg_tri_b7_b1_2_bx, gradleg_tri_b1_b8_1_bx, gradleg_tri_b1_b8_2_bx, gradleg_tri_b2_b7_1_bx, gradleg_tri_b2_b7_2_bx, gradleg_tri_b3_b6_1_bx, gradleg_tri_b3_b6_2_bx, gradleg_tri_b4_b5_1_bx, gradleg_tri_b4_b5_2_bx, gradleg_tri_b5_b4_1_bx, gradleg_tri_b5_b4_2_bx, gradleg_tri_b6_b3_1_bx, gradleg_tri_b6_b3_2_bx, gradleg_tri_b7_b2_1_bx, gradleg_tri_b7_b2_2_bx, gradleg_tri_b8_b1_1_bx, gradleg_tri_b8_b1_2_bx, + gradleg_tri_p0_e1_bx_0, gradleg_tri_p0_e1_bx_1, gradleg_tri_p0_e2_bx_0, gradleg_tri_p0_e2_bx_1, gradleg_tri_p0_e3_bx_0, gradleg_tri_p0_e3_bx_1, + gradleg_tri_p1_e1_bx, gradleg_tri_p1_e1_bx, gradleg_tri_p1_e2_bx, gradleg_tri_p1_e2_bx, gradleg_tri_p1_e3_bx, gradleg_tri_p1_e3_bx, + gradleg_tri_p2_e1_bx_0, gradleg_tri_p2_e1_bx_1, gradleg_tri_p2_e2_bx_0, gradleg_tri_p2_e2_bx_1, gradleg_tri_p2_e3_bx_0, gradleg_tri_p2_e3_bx_1, + gradleg_tri_p3_e1_bx, gradleg_tri_p3_e1_bx, gradleg_tri_p3_e2_bx, gradleg_tri_p3_e2_bx, gradleg_tri_p3_e3_bx, gradleg_tri_p3_e3_bx, + gradleg_tri_p4_e1_bx_0, gradleg_tri_p4_e1_bx_1, gradleg_tri_p4_e2_bx_0, gradleg_tri_p4_e2_bx_1, gradleg_tri_p4_e3_bx_0, gradleg_tri_p4_e3_bx_1, + gradleg_tri_p5_e1_bx, gradleg_tri_p5_e1_bx, gradleg_tri_p5_e2_bx, gradleg_tri_p5_e2_bx, gradleg_tri_p5_e3_bx, gradleg_tri_p5_e3_bx, + gradleg_tri_p6_e1_bx_0, gradleg_tri_p6_e1_bx_1, gradleg_tri_p6_e2_bx_0, gradleg_tri_p6_e2_bx_1, gradleg_tri_p6_e3_bx_0, gradleg_tri_p6_e3_bx_1, + gradleg_tri_p7_e1_bx, gradleg_tri_p7_e1_bx, gradleg_tri_p7_e2_bx, gradleg_tri_p7_e2_bx, gradleg_tri_p7_e3_bx, gradleg_tri_p7_e3_bx, + gradleg_tri_p8_e1_bx_0, gradleg_tri_p8_e1_bx_1, gradleg_tri_p8_e2_bx_0, gradleg_tri_p8_e2_bx_1, gradleg_tri_p8_e3_bx_0, gradleg_tri_p8_e3_bx_1, + gradleg_tri_p9_e1_bx, gradleg_tri_p9_e1_bx, gradleg_tri_p9_e2_bx, gradleg_tri_p9_e2_bx, gradleg_tri_p9_e3_bx, gradleg_tri_p9_e3_bx, + gradleg_tri_p10_e1_bx_0, gradleg_tri_p10_e1_bx_1, gradleg_tri_p10_e2_bx_0, gradleg_tri_p10_e2_bx_1, gradleg_tri_p10_e3_bx_0, gradleg_tri_p10_e3_bx_1, + + gradleg_tri_p2_b1_bx, gradleg_tri_p2_b2_bx, gradleg_tri_p2_b3_bx, gradleg_tri_p3_b1_bx, gradleg_tri_p3_b2_bx, gradleg_tri_p3_b3_bx, gradleg_tri_p4_b1_bx, gradleg_tri_p4_b2_bx, gradleg_tri_p4_b3_bx, gradleg_tri_p5_b1_bx, gradleg_tri_p5_b2_bx, gradleg_tri_p5_b3_bx, gradleg_tri_p6_b1_bx, gradleg_tri_p6_b2_bx, gradleg_tri_p6_b3_bx, gradleg_tri_p7_b1_bx, gradleg_tri_p7_b2_bx, gradleg_tri_p7_b3_bx, gradleg_tri_p8_b1_bx, gradleg_tri_p8_b2_bx, gradleg_tri_p8_b3_bx, gradleg_tri_p9_b1_bx, gradleg_tri_p9_b2_bx, gradleg_tri_p9_b3_bx, gradleg_tri_p10_b1_bx, gradleg_tri_p10_b2_bx, gradleg_tri_p10_b3_bx, + + gradleg_tri_b1_b1_1_bx, gradleg_tri_b1_b1_2_bx, gradleg_tri_b1_b2_1_bx, gradleg_tri_b1_b2_2_bx, gradleg_tri_b2_b1_1_bx, gradleg_tri_b2_b1_2_bx, gradleg_tri_b1_b3_1_bx, gradleg_tri_b1_b3_2_bx, gradleg_tri_b2_b2_1_bx, gradleg_tri_b2_b2_2_bx, gradleg_tri_b3_b1_1_bx, gradleg_tri_b3_b1_2_bx, gradleg_tri_b1_b4_1_bx, gradleg_tri_b1_b4_2_bx, gradleg_tri_b2_b3_1_bx, gradleg_tri_b2_b3_2_bx, gradleg_tri_b3_b2_1_bx, gradleg_tri_b3_b2_2_bx, gradleg_tri_b4_b1_1_bx, gradleg_tri_b4_b1_2_bx, gradleg_tri_b1_b5_1_bx, gradleg_tri_b1_b5_2_bx, gradleg_tri_b2_b4_1_bx, gradleg_tri_b2_b4_2_bx, gradleg_tri_b3_b3_1_bx, gradleg_tri_b3_b3_2_bx, gradleg_tri_b4_b2_1_bx, gradleg_tri_b4_b2_2_bx, gradleg_tri_b5_b1_1_bx, gradleg_tri_b5_b1_2_bx, gradleg_tri_b1_b6_1_bx, gradleg_tri_b1_b6_2_bx, gradleg_tri_b2_b5_1_bx, gradleg_tri_b2_b5_2_bx, gradleg_tri_b3_b4_1_bx, gradleg_tri_b3_b4_2_bx, gradleg_tri_b4_b3_1_bx, gradleg_tri_b4_b3_2_bx, gradleg_tri_b5_b2_1_bx, gradleg_tri_b5_b2_2_bx, gradleg_tri_b6_b1_1_bx, gradleg_tri_b6_b1_2_bx, gradleg_tri_b1_b7_1_bx, gradleg_tri_b1_b7_2_bx, gradleg_tri_b2_b6_1_bx, gradleg_tri_b2_b6_2_bx, gradleg_tri_b3_b5_1_bx, gradleg_tri_b3_b5_2_bx, gradleg_tri_b4_b4_1_bx, gradleg_tri_b4_b4_2_bx, gradleg_tri_b5_b3_1_bx, gradleg_tri_b5_b3_2_bx, gradleg_tri_b6_b2_1_bx, gradleg_tri_b6_b2_2_bx, gradleg_tri_b7_b1_1_bx, gradleg_tri_b7_b1_2_bx, gradleg_tri_b1_b8_1_bx, gradleg_tri_b1_b8_2_bx, gradleg_tri_b2_b7_1_bx, gradleg_tri_b2_b7_2_bx, gradleg_tri_b3_b6_1_bx, gradleg_tri_b3_b6_2_bx, gradleg_tri_b4_b5_1_bx, gradleg_tri_b4_b5_2_bx, gradleg_tri_b5_b4_1_bx, gradleg_tri_b5_b4_2_bx, gradleg_tri_b6_b3_1_bx, gradleg_tri_b6_b3_2_bx, gradleg_tri_b7_b2_1_bx, gradleg_tri_b7_b2_2_bx, gradleg_tri_b8_b1_1_bx, gradleg_tri_b8_b1_2_bx, }; static Shapeset::shape_fn_t gradleg_tri_fn_ay[] = { - gradleg_tri_p0_e1_ay_0, gradleg_tri_p0_e1_ay_1, gradleg_tri_p0_e2_ay_0, gradleg_tri_p0_e2_ay_1, gradleg_tri_p0_e3_ay_0, gradleg_tri_p0_e3_ay_1, - gradleg_tri_p1_e1_ay, gradleg_tri_p1_e1_ay, gradleg_tri_p1_e2_ay, gradleg_tri_p1_e2_ay, gradleg_tri_p1_e3_ay, gradleg_tri_p1_e3_ay, - gradleg_tri_p2_e1_ay_0, gradleg_tri_p2_e1_ay_1, gradleg_tri_p2_e2_ay_0, gradleg_tri_p2_e2_ay_1, gradleg_tri_p2_e3_ay_0, gradleg_tri_p2_e3_ay_1, - gradleg_tri_p3_e1_ay, gradleg_tri_p3_e1_ay, gradleg_tri_p3_e2_ay, gradleg_tri_p3_e2_ay, gradleg_tri_p3_e3_ay, gradleg_tri_p3_e3_ay, - gradleg_tri_p4_e1_ay_0, gradleg_tri_p4_e1_ay_1, gradleg_tri_p4_e2_ay_0, gradleg_tri_p4_e2_ay_1, gradleg_tri_p4_e3_ay_0, gradleg_tri_p4_e3_ay_1, - gradleg_tri_p5_e1_ay, gradleg_tri_p5_e1_ay, gradleg_tri_p5_e2_ay, gradleg_tri_p5_e2_ay, gradleg_tri_p5_e3_ay, gradleg_tri_p5_e3_ay, - gradleg_tri_p6_e1_ay_0, gradleg_tri_p6_e1_ay_1, gradleg_tri_p6_e2_ay_0, gradleg_tri_p6_e2_ay_1, gradleg_tri_p6_e3_ay_0, gradleg_tri_p6_e3_ay_1, - gradleg_tri_p7_e1_ay, gradleg_tri_p7_e1_ay, gradleg_tri_p7_e2_ay, gradleg_tri_p7_e2_ay, gradleg_tri_p7_e3_ay, gradleg_tri_p7_e3_ay, - gradleg_tri_p8_e1_ay_0, gradleg_tri_p8_e1_ay_1, gradleg_tri_p8_e2_ay_0, gradleg_tri_p8_e2_ay_1, gradleg_tri_p8_e3_ay_0, gradleg_tri_p8_e3_ay_1, - gradleg_tri_p9_e1_ay, gradleg_tri_p9_e1_ay, gradleg_tri_p9_e2_ay, gradleg_tri_p9_e2_ay, gradleg_tri_p9_e3_ay, gradleg_tri_p9_e3_ay, - gradleg_tri_p10_e1_ay_0, gradleg_tri_p10_e1_ay_1, gradleg_tri_p10_e2_ay_0, gradleg_tri_p10_e2_ay_1, gradleg_tri_p10_e3_ay_0, gradleg_tri_p10_e3_ay_1, - - gradleg_tri_p2_b1_ay, gradleg_tri_p2_b2_ay, gradleg_tri_p2_b3_ay, gradleg_tri_p3_b1_ay, gradleg_tri_p3_b2_ay, gradleg_tri_p3_b3_ay, gradleg_tri_p4_b1_ay, gradleg_tri_p4_b2_ay, gradleg_tri_p4_b3_ay, gradleg_tri_p5_b1_ay, gradleg_tri_p5_b2_ay, gradleg_tri_p5_b3_ay, gradleg_tri_p6_b1_ay, gradleg_tri_p6_b2_ay, gradleg_tri_p6_b3_ay, gradleg_tri_p7_b1_ay, gradleg_tri_p7_b2_ay, gradleg_tri_p7_b3_ay, gradleg_tri_p8_b1_ay, gradleg_tri_p8_b2_ay, gradleg_tri_p8_b3_ay, gradleg_tri_p9_b1_ay, gradleg_tri_p9_b2_ay, gradleg_tri_p9_b3_ay, gradleg_tri_p10_b1_ay, gradleg_tri_p10_b2_ay, gradleg_tri_p10_b3_ay, - - gradleg_tri_b1_b1_1_ay, gradleg_tri_b1_b1_2_ay, gradleg_tri_b1_b2_1_ay, gradleg_tri_b1_b2_2_ay, gradleg_tri_b2_b1_1_ay, gradleg_tri_b2_b1_2_ay, gradleg_tri_b1_b3_1_ay, gradleg_tri_b1_b3_2_ay, gradleg_tri_b2_b2_1_ay, gradleg_tri_b2_b2_2_ay, gradleg_tri_b3_b1_1_ay, gradleg_tri_b3_b1_2_ay, gradleg_tri_b1_b4_1_ay, gradleg_tri_b1_b4_2_ay, gradleg_tri_b2_b3_1_ay, gradleg_tri_b2_b3_2_ay, gradleg_tri_b3_b2_1_ay, gradleg_tri_b3_b2_2_ay, gradleg_tri_b4_b1_1_ay, gradleg_tri_b4_b1_2_ay, gradleg_tri_b1_b5_1_ay, gradleg_tri_b1_b5_2_ay, gradleg_tri_b2_b4_1_ay, gradleg_tri_b2_b4_2_ay, gradleg_tri_b3_b3_1_ay, gradleg_tri_b3_b3_2_ay, gradleg_tri_b4_b2_1_ay, gradleg_tri_b4_b2_2_ay, gradleg_tri_b5_b1_1_ay, gradleg_tri_b5_b1_2_ay, gradleg_tri_b1_b6_1_ay, gradleg_tri_b1_b6_2_ay, gradleg_tri_b2_b5_1_ay, gradleg_tri_b2_b5_2_ay, gradleg_tri_b3_b4_1_ay, gradleg_tri_b3_b4_2_ay, gradleg_tri_b4_b3_1_ay, gradleg_tri_b4_b3_2_ay, gradleg_tri_b5_b2_1_ay, gradleg_tri_b5_b2_2_ay, gradleg_tri_b6_b1_1_ay, gradleg_tri_b6_b1_2_ay, gradleg_tri_b1_b7_1_ay, gradleg_tri_b1_b7_2_ay, gradleg_tri_b2_b6_1_ay, gradleg_tri_b2_b6_2_ay, gradleg_tri_b3_b5_1_ay, gradleg_tri_b3_b5_2_ay, gradleg_tri_b4_b4_1_ay, gradleg_tri_b4_b4_2_ay, gradleg_tri_b5_b3_1_ay, gradleg_tri_b5_b3_2_ay, gradleg_tri_b6_b2_1_ay, gradleg_tri_b6_b2_2_ay, gradleg_tri_b7_b1_1_ay, gradleg_tri_b7_b1_2_ay, gradleg_tri_b1_b8_1_ay, gradleg_tri_b1_b8_2_ay, gradleg_tri_b2_b7_1_ay, gradleg_tri_b2_b7_2_ay, gradleg_tri_b3_b6_1_ay, gradleg_tri_b3_b6_2_ay, gradleg_tri_b4_b5_1_ay, gradleg_tri_b4_b5_2_ay, gradleg_tri_b5_b4_1_ay, gradleg_tri_b5_b4_2_ay, gradleg_tri_b6_b3_1_ay, gradleg_tri_b6_b3_2_ay, gradleg_tri_b7_b2_1_ay, gradleg_tri_b7_b2_2_ay, gradleg_tri_b8_b1_1_ay, gradleg_tri_b8_b1_2_ay, + gradleg_tri_p0_e1_ay_0, gradleg_tri_p0_e1_ay_1, gradleg_tri_p0_e2_ay_0, gradleg_tri_p0_e2_ay_1, gradleg_tri_p0_e3_ay_0, gradleg_tri_p0_e3_ay_1, + gradleg_tri_p1_e1_ay, gradleg_tri_p1_e1_ay, gradleg_tri_p1_e2_ay, gradleg_tri_p1_e2_ay, gradleg_tri_p1_e3_ay, gradleg_tri_p1_e3_ay, + gradleg_tri_p2_e1_ay_0, gradleg_tri_p2_e1_ay_1, gradleg_tri_p2_e2_ay_0, gradleg_tri_p2_e2_ay_1, gradleg_tri_p2_e3_ay_0, gradleg_tri_p2_e3_ay_1, + gradleg_tri_p3_e1_ay, gradleg_tri_p3_e1_ay, gradleg_tri_p3_e2_ay, gradleg_tri_p3_e2_ay, gradleg_tri_p3_e3_ay, gradleg_tri_p3_e3_ay, + gradleg_tri_p4_e1_ay_0, gradleg_tri_p4_e1_ay_1, gradleg_tri_p4_e2_ay_0, gradleg_tri_p4_e2_ay_1, gradleg_tri_p4_e3_ay_0, gradleg_tri_p4_e3_ay_1, + gradleg_tri_p5_e1_ay, gradleg_tri_p5_e1_ay, gradleg_tri_p5_e2_ay, gradleg_tri_p5_e2_ay, gradleg_tri_p5_e3_ay, gradleg_tri_p5_e3_ay, + gradleg_tri_p6_e1_ay_0, gradleg_tri_p6_e1_ay_1, gradleg_tri_p6_e2_ay_0, gradleg_tri_p6_e2_ay_1, gradleg_tri_p6_e3_ay_0, gradleg_tri_p6_e3_ay_1, + gradleg_tri_p7_e1_ay, gradleg_tri_p7_e1_ay, gradleg_tri_p7_e2_ay, gradleg_tri_p7_e2_ay, gradleg_tri_p7_e3_ay, gradleg_tri_p7_e3_ay, + gradleg_tri_p8_e1_ay_0, gradleg_tri_p8_e1_ay_1, gradleg_tri_p8_e2_ay_0, gradleg_tri_p8_e2_ay_1, gradleg_tri_p8_e3_ay_0, gradleg_tri_p8_e3_ay_1, + gradleg_tri_p9_e1_ay, gradleg_tri_p9_e1_ay, gradleg_tri_p9_e2_ay, gradleg_tri_p9_e2_ay, gradleg_tri_p9_e3_ay, gradleg_tri_p9_e3_ay, + gradleg_tri_p10_e1_ay_0, gradleg_tri_p10_e1_ay_1, gradleg_tri_p10_e2_ay_0, gradleg_tri_p10_e2_ay_1, gradleg_tri_p10_e3_ay_0, gradleg_tri_p10_e3_ay_1, + + gradleg_tri_p2_b1_ay, gradleg_tri_p2_b2_ay, gradleg_tri_p2_b3_ay, gradleg_tri_p3_b1_ay, gradleg_tri_p3_b2_ay, gradleg_tri_p3_b3_ay, gradleg_tri_p4_b1_ay, gradleg_tri_p4_b2_ay, gradleg_tri_p4_b3_ay, gradleg_tri_p5_b1_ay, gradleg_tri_p5_b2_ay, gradleg_tri_p5_b3_ay, gradleg_tri_p6_b1_ay, gradleg_tri_p6_b2_ay, gradleg_tri_p6_b3_ay, gradleg_tri_p7_b1_ay, gradleg_tri_p7_b2_ay, gradleg_tri_p7_b3_ay, gradleg_tri_p8_b1_ay, gradleg_tri_p8_b2_ay, gradleg_tri_p8_b3_ay, gradleg_tri_p9_b1_ay, gradleg_tri_p9_b2_ay, gradleg_tri_p9_b3_ay, gradleg_tri_p10_b1_ay, gradleg_tri_p10_b2_ay, gradleg_tri_p10_b3_ay, + + gradleg_tri_b1_b1_1_ay, gradleg_tri_b1_b1_2_ay, gradleg_tri_b1_b2_1_ay, gradleg_tri_b1_b2_2_ay, gradleg_tri_b2_b1_1_ay, gradleg_tri_b2_b1_2_ay, gradleg_tri_b1_b3_1_ay, gradleg_tri_b1_b3_2_ay, gradleg_tri_b2_b2_1_ay, gradleg_tri_b2_b2_2_ay, gradleg_tri_b3_b1_1_ay, gradleg_tri_b3_b1_2_ay, gradleg_tri_b1_b4_1_ay, gradleg_tri_b1_b4_2_ay, gradleg_tri_b2_b3_1_ay, gradleg_tri_b2_b3_2_ay, gradleg_tri_b3_b2_1_ay, gradleg_tri_b3_b2_2_ay, gradleg_tri_b4_b1_1_ay, gradleg_tri_b4_b1_2_ay, gradleg_tri_b1_b5_1_ay, gradleg_tri_b1_b5_2_ay, gradleg_tri_b2_b4_1_ay, gradleg_tri_b2_b4_2_ay, gradleg_tri_b3_b3_1_ay, gradleg_tri_b3_b3_2_ay, gradleg_tri_b4_b2_1_ay, gradleg_tri_b4_b2_2_ay, gradleg_tri_b5_b1_1_ay, gradleg_tri_b5_b1_2_ay, gradleg_tri_b1_b6_1_ay, gradleg_tri_b1_b6_2_ay, gradleg_tri_b2_b5_1_ay, gradleg_tri_b2_b5_2_ay, gradleg_tri_b3_b4_1_ay, gradleg_tri_b3_b4_2_ay, gradleg_tri_b4_b3_1_ay, gradleg_tri_b4_b3_2_ay, gradleg_tri_b5_b2_1_ay, gradleg_tri_b5_b2_2_ay, gradleg_tri_b6_b1_1_ay, gradleg_tri_b6_b1_2_ay, gradleg_tri_b1_b7_1_ay, gradleg_tri_b1_b7_2_ay, gradleg_tri_b2_b6_1_ay, gradleg_tri_b2_b6_2_ay, gradleg_tri_b3_b5_1_ay, gradleg_tri_b3_b5_2_ay, gradleg_tri_b4_b4_1_ay, gradleg_tri_b4_b4_2_ay, gradleg_tri_b5_b3_1_ay, gradleg_tri_b5_b3_2_ay, gradleg_tri_b6_b2_1_ay, gradleg_tri_b6_b2_2_ay, gradleg_tri_b7_b1_1_ay, gradleg_tri_b7_b1_2_ay, gradleg_tri_b1_b8_1_ay, gradleg_tri_b1_b8_2_ay, gradleg_tri_b2_b7_1_ay, gradleg_tri_b2_b7_2_ay, gradleg_tri_b3_b6_1_ay, gradleg_tri_b3_b6_2_ay, gradleg_tri_b4_b5_1_ay, gradleg_tri_b4_b5_2_ay, gradleg_tri_b5_b4_1_ay, gradleg_tri_b5_b4_2_ay, gradleg_tri_b6_b3_1_ay, gradleg_tri_b6_b3_2_ay, gradleg_tri_b7_b2_1_ay, gradleg_tri_b7_b2_2_ay, gradleg_tri_b8_b1_1_ay, gradleg_tri_b8_b1_2_ay, }; static Shapeset::shape_fn_t gradleg_tri_fn_by[] = { - gradleg_tri_p0_e1_by_0, gradleg_tri_p0_e1_by_1, gradleg_tri_p0_e2_by_0, gradleg_tri_p0_e2_by_1, gradleg_tri_p0_e3_by_0, gradleg_tri_p0_e3_by_1, - gradleg_tri_p1_e1_by, gradleg_tri_p1_e1_by, gradleg_tri_p1_e2_by, gradleg_tri_p1_e2_by, gradleg_tri_p1_e3_by, gradleg_tri_p1_e3_by, - gradleg_tri_p2_e1_by_0, gradleg_tri_p2_e1_by_1, gradleg_tri_p2_e2_by_0, gradleg_tri_p2_e2_by_1, gradleg_tri_p2_e3_by_0, gradleg_tri_p2_e3_by_1, - gradleg_tri_p3_e1_by, gradleg_tri_p3_e1_by, gradleg_tri_p3_e2_by, gradleg_tri_p3_e2_by, gradleg_tri_p3_e3_by, gradleg_tri_p3_e3_by, - gradleg_tri_p4_e1_by_0, gradleg_tri_p4_e1_by_1, gradleg_tri_p4_e2_by_0, gradleg_tri_p4_e2_by_1, gradleg_tri_p4_e3_by_0, gradleg_tri_p4_e3_by_1, - gradleg_tri_p5_e1_by, gradleg_tri_p5_e1_by, gradleg_tri_p5_e2_by, gradleg_tri_p5_e2_by, gradleg_tri_p5_e3_by, gradleg_tri_p5_e3_by, - gradleg_tri_p6_e1_by_0, gradleg_tri_p6_e1_by_1, gradleg_tri_p6_e2_by_0, gradleg_tri_p6_e2_by_1, gradleg_tri_p6_e3_by_0, gradleg_tri_p6_e3_by_1, - gradleg_tri_p7_e1_by, gradleg_tri_p7_e1_by, gradleg_tri_p7_e2_by, gradleg_tri_p7_e2_by, gradleg_tri_p7_e3_by, gradleg_tri_p7_e3_by, - gradleg_tri_p8_e1_by_0, gradleg_tri_p8_e1_by_1, gradleg_tri_p8_e2_by_0, gradleg_tri_p8_e2_by_1, gradleg_tri_p8_e3_by_0, gradleg_tri_p8_e3_by_1, - gradleg_tri_p9_e1_by, gradleg_tri_p9_e1_by, gradleg_tri_p9_e2_by, gradleg_tri_p9_e2_by, gradleg_tri_p9_e3_by, gradleg_tri_p9_e3_by, - gradleg_tri_p10_e1_by_0, gradleg_tri_p10_e1_by_1, gradleg_tri_p10_e2_by_0, gradleg_tri_p10_e2_by_1, gradleg_tri_p10_e3_by_0, gradleg_tri_p10_e3_by_1, - - gradleg_tri_p2_b1_by, gradleg_tri_p2_b2_by, gradleg_tri_p2_b3_by, gradleg_tri_p3_b1_by, gradleg_tri_p3_b2_by, gradleg_tri_p3_b3_by, gradleg_tri_p4_b1_by, gradleg_tri_p4_b2_by, gradleg_tri_p4_b3_by, gradleg_tri_p5_b1_by, gradleg_tri_p5_b2_by, gradleg_tri_p5_b3_by, gradleg_tri_p6_b1_by, gradleg_tri_p6_b2_by, gradleg_tri_p6_b3_by, gradleg_tri_p7_b1_by, gradleg_tri_p7_b2_by, gradleg_tri_p7_b3_by, gradleg_tri_p8_b1_by, gradleg_tri_p8_b2_by, gradleg_tri_p8_b3_by, gradleg_tri_p9_b1_by, gradleg_tri_p9_b2_by, gradleg_tri_p9_b3_by, gradleg_tri_p10_b1_by, gradleg_tri_p10_b2_by, gradleg_tri_p10_b3_by, - - gradleg_tri_b1_b1_1_by, gradleg_tri_b1_b1_2_by, gradleg_tri_b1_b2_1_by, gradleg_tri_b1_b2_2_by, gradleg_tri_b2_b1_1_by, gradleg_tri_b2_b1_2_by, gradleg_tri_b1_b3_1_by, gradleg_tri_b1_b3_2_by, gradleg_tri_b2_b2_1_by, gradleg_tri_b2_b2_2_by, gradleg_tri_b3_b1_1_by, gradleg_tri_b3_b1_2_by, gradleg_tri_b1_b4_1_by, gradleg_tri_b1_b4_2_by, gradleg_tri_b2_b3_1_by, gradleg_tri_b2_b3_2_by, gradleg_tri_b3_b2_1_by, gradleg_tri_b3_b2_2_by, gradleg_tri_b4_b1_1_by, gradleg_tri_b4_b1_2_by, gradleg_tri_b1_b5_1_by, gradleg_tri_b1_b5_2_by, gradleg_tri_b2_b4_1_by, gradleg_tri_b2_b4_2_by, gradleg_tri_b3_b3_1_by, gradleg_tri_b3_b3_2_by, gradleg_tri_b4_b2_1_by, gradleg_tri_b4_b2_2_by, gradleg_tri_b5_b1_1_by, gradleg_tri_b5_b1_2_by, gradleg_tri_b1_b6_1_by, gradleg_tri_b1_b6_2_by, gradleg_tri_b2_b5_1_by, gradleg_tri_b2_b5_2_by, gradleg_tri_b3_b4_1_by, gradleg_tri_b3_b4_2_by, gradleg_tri_b4_b3_1_by, gradleg_tri_b4_b3_2_by, gradleg_tri_b5_b2_1_by, gradleg_tri_b5_b2_2_by, gradleg_tri_b6_b1_1_by, gradleg_tri_b6_b1_2_by, gradleg_tri_b1_b7_1_by, gradleg_tri_b1_b7_2_by, gradleg_tri_b2_b6_1_by, gradleg_tri_b2_b6_2_by, gradleg_tri_b3_b5_1_by, gradleg_tri_b3_b5_2_by, gradleg_tri_b4_b4_1_by, gradleg_tri_b4_b4_2_by, gradleg_tri_b5_b3_1_by, gradleg_tri_b5_b3_2_by, gradleg_tri_b6_b2_1_by, gradleg_tri_b6_b2_2_by, gradleg_tri_b7_b1_1_by, gradleg_tri_b7_b1_2_by, gradleg_tri_b1_b8_1_by, gradleg_tri_b1_b8_2_by, gradleg_tri_b2_b7_1_by, gradleg_tri_b2_b7_2_by, gradleg_tri_b3_b6_1_by, gradleg_tri_b3_b6_2_by, gradleg_tri_b4_b5_1_by, gradleg_tri_b4_b5_2_by, gradleg_tri_b5_b4_1_by, gradleg_tri_b5_b4_2_by, gradleg_tri_b6_b3_1_by, gradleg_tri_b6_b3_2_by, gradleg_tri_b7_b2_1_by, gradleg_tri_b7_b2_2_by, gradleg_tri_b8_b1_1_by, gradleg_tri_b8_b1_2_by, + gradleg_tri_p0_e1_by_0, gradleg_tri_p0_e1_by_1, gradleg_tri_p0_e2_by_0, gradleg_tri_p0_e2_by_1, gradleg_tri_p0_e3_by_0, gradleg_tri_p0_e3_by_1, + gradleg_tri_p1_e1_by, gradleg_tri_p1_e1_by, gradleg_tri_p1_e2_by, gradleg_tri_p1_e2_by, gradleg_tri_p1_e3_by, gradleg_tri_p1_e3_by, + gradleg_tri_p2_e1_by_0, gradleg_tri_p2_e1_by_1, gradleg_tri_p2_e2_by_0, gradleg_tri_p2_e2_by_1, gradleg_tri_p2_e3_by_0, gradleg_tri_p2_e3_by_1, + gradleg_tri_p3_e1_by, gradleg_tri_p3_e1_by, gradleg_tri_p3_e2_by, gradleg_tri_p3_e2_by, gradleg_tri_p3_e3_by, gradleg_tri_p3_e3_by, + gradleg_tri_p4_e1_by_0, gradleg_tri_p4_e1_by_1, gradleg_tri_p4_e2_by_0, gradleg_tri_p4_e2_by_1, gradleg_tri_p4_e3_by_0, gradleg_tri_p4_e3_by_1, + gradleg_tri_p5_e1_by, gradleg_tri_p5_e1_by, gradleg_tri_p5_e2_by, gradleg_tri_p5_e2_by, gradleg_tri_p5_e3_by, gradleg_tri_p5_e3_by, + gradleg_tri_p6_e1_by_0, gradleg_tri_p6_e1_by_1, gradleg_tri_p6_e2_by_0, gradleg_tri_p6_e2_by_1, gradleg_tri_p6_e3_by_0, gradleg_tri_p6_e3_by_1, + gradleg_tri_p7_e1_by, gradleg_tri_p7_e1_by, gradleg_tri_p7_e2_by, gradleg_tri_p7_e2_by, gradleg_tri_p7_e3_by, gradleg_tri_p7_e3_by, + gradleg_tri_p8_e1_by_0, gradleg_tri_p8_e1_by_1, gradleg_tri_p8_e2_by_0, gradleg_tri_p8_e2_by_1, gradleg_tri_p8_e3_by_0, gradleg_tri_p8_e3_by_1, + gradleg_tri_p9_e1_by, gradleg_tri_p9_e1_by, gradleg_tri_p9_e2_by, gradleg_tri_p9_e2_by, gradleg_tri_p9_e3_by, gradleg_tri_p9_e3_by, + gradleg_tri_p10_e1_by_0, gradleg_tri_p10_e1_by_1, gradleg_tri_p10_e2_by_0, gradleg_tri_p10_e2_by_1, gradleg_tri_p10_e3_by_0, gradleg_tri_p10_e3_by_1, + + gradleg_tri_p2_b1_by, gradleg_tri_p2_b2_by, gradleg_tri_p2_b3_by, gradleg_tri_p3_b1_by, gradleg_tri_p3_b2_by, gradleg_tri_p3_b3_by, gradleg_tri_p4_b1_by, gradleg_tri_p4_b2_by, gradleg_tri_p4_b3_by, gradleg_tri_p5_b1_by, gradleg_tri_p5_b2_by, gradleg_tri_p5_b3_by, gradleg_tri_p6_b1_by, gradleg_tri_p6_b2_by, gradleg_tri_p6_b3_by, gradleg_tri_p7_b1_by, gradleg_tri_p7_b2_by, gradleg_tri_p7_b3_by, gradleg_tri_p8_b1_by, gradleg_tri_p8_b2_by, gradleg_tri_p8_b3_by, gradleg_tri_p9_b1_by, gradleg_tri_p9_b2_by, gradleg_tri_p9_b3_by, gradleg_tri_p10_b1_by, gradleg_tri_p10_b2_by, gradleg_tri_p10_b3_by, + + gradleg_tri_b1_b1_1_by, gradleg_tri_b1_b1_2_by, gradleg_tri_b1_b2_1_by, gradleg_tri_b1_b2_2_by, gradleg_tri_b2_b1_1_by, gradleg_tri_b2_b1_2_by, gradleg_tri_b1_b3_1_by, gradleg_tri_b1_b3_2_by, gradleg_tri_b2_b2_1_by, gradleg_tri_b2_b2_2_by, gradleg_tri_b3_b1_1_by, gradleg_tri_b3_b1_2_by, gradleg_tri_b1_b4_1_by, gradleg_tri_b1_b4_2_by, gradleg_tri_b2_b3_1_by, gradleg_tri_b2_b3_2_by, gradleg_tri_b3_b2_1_by, gradleg_tri_b3_b2_2_by, gradleg_tri_b4_b1_1_by, gradleg_tri_b4_b1_2_by, gradleg_tri_b1_b5_1_by, gradleg_tri_b1_b5_2_by, gradleg_tri_b2_b4_1_by, gradleg_tri_b2_b4_2_by, gradleg_tri_b3_b3_1_by, gradleg_tri_b3_b3_2_by, gradleg_tri_b4_b2_1_by, gradleg_tri_b4_b2_2_by, gradleg_tri_b5_b1_1_by, gradleg_tri_b5_b1_2_by, gradleg_tri_b1_b6_1_by, gradleg_tri_b1_b6_2_by, gradleg_tri_b2_b5_1_by, gradleg_tri_b2_b5_2_by, gradleg_tri_b3_b4_1_by, gradleg_tri_b3_b4_2_by, gradleg_tri_b4_b3_1_by, gradleg_tri_b4_b3_2_by, gradleg_tri_b5_b2_1_by, gradleg_tri_b5_b2_2_by, gradleg_tri_b6_b1_1_by, gradleg_tri_b6_b1_2_by, gradleg_tri_b1_b7_1_by, gradleg_tri_b1_b7_2_by, gradleg_tri_b2_b6_1_by, gradleg_tri_b2_b6_2_by, gradleg_tri_b3_b5_1_by, gradleg_tri_b3_b5_2_by, gradleg_tri_b4_b4_1_by, gradleg_tri_b4_b4_2_by, gradleg_tri_b5_b3_1_by, gradleg_tri_b5_b3_2_by, gradleg_tri_b6_b2_1_by, gradleg_tri_b6_b2_2_by, gradleg_tri_b7_b1_1_by, gradleg_tri_b7_b1_2_by, gradleg_tri_b1_b8_1_by, gradleg_tri_b1_b8_2_by, gradleg_tri_b2_b7_1_by, gradleg_tri_b2_b7_2_by, gradleg_tri_b3_b6_1_by, gradleg_tri_b3_b6_2_by, gradleg_tri_b4_b5_1_by, gradleg_tri_b4_b5_2_by, gradleg_tri_b5_b4_1_by, gradleg_tri_b5_b4_2_by, gradleg_tri_b6_b3_1_by, gradleg_tri_b6_b3_2_by, gradleg_tri_b7_b2_1_by, gradleg_tri_b7_b2_2_by, gradleg_tri_b8_b1_1_by, gradleg_tri_b8_b1_2_by, }; - static int gradleg_tri_bubble_indices_all_orders[] = - { - 66, 67, 68, - 69, 70, 71, 93, 94, - 72, 73, 74, 95, 96, 97, 98, - 75, 76, 77, 99, 100, 101, 102, 103, 104, - 78, 79, 80, 105, 106, 107, 108, 109, 110, 111, 112, - 81, 82, 83, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 84, 85, 86, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 87, 88, 89, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 90, 91, 92, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + static short gradleg_tri_bubble_indices_all_orders[] = + { + 66, 67, 68, + 69, 70, 71, 93, 94, + 72, 73, 74, 95, 96, 97, 98, + 75, 76, 77, 99, 100, 101, 102, 103, 104, + 78, 79, 80, 105, 106, 107, 108, 109, 110, 111, 112, + 81, 82, 83, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 84, 85, 86, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 87, 88, 89, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 90, 91, 92, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, }; - static int* gradleg_tri_bubble_indices[11] = + static short* gradleg_tri_bubble_indices[11] = { nullptr, nullptr, gradleg_tri_bubble_indices_all_orders, @@ -6762,51 +6762,51 @@ namespace Hermes gradleg_tri_bubble_indices_all_orders }; - static int gradleg_tri_bubble_count[11] = { 0, 0, 3, 8, 15, 24, 35, 48, 63, 80, 99, }; + static unsigned short gradleg_tri_bubble_count[11] = { 0, 0, 3, 8, 15, 24, 35, 48, 63, 80, 99, }; - static int gradleg_tri_edge_indices_0[22] = { 0, 1, 6, 7, 12, 13, 18, 19, 24, 25, 30, 31, 36, 37, 42, 43, 48, 49, 54, 55, 60, 61, }; - static int gradleg_tri_edge_indices_1[22] = { 2, 3, 8, 9, 14, 15, 20, 21, 26, 27, 32, 33, 38, 39, 44, 45, 50, 51, 56, 57, 62, 63, }; - static int gradleg_tri_edge_indices_2[22] = { 4, 5, 10, 11, 16, 17, 22, 23, 28, 29, 34, 35, 40, 41, 46, 47, 52, 53, 58, 59, 64, 65, }; + static short gradleg_tri_edge_indices_0[22] = { 0, 1, 6, 7, 12, 13, 18, 19, 24, 25, 30, 31, 36, 37, 42, 43, 48, 49, 54, 55, 60, 61, }; + static short gradleg_tri_edge_indices_1[22] = { 2, 3, 8, 9, 14, 15, 20, 21, 26, 27, 32, 33, 38, 39, 44, 45, 50, 51, 56, 57, 62, 63, }; + static short gradleg_tri_edge_indices_2[22] = { 4, 5, 10, 11, 16, 17, 22, 23, 28, 29, 34, 35, 40, 41, 46, 47, 52, 53, 58, 59, 64, 65, }; - static int* gradleg_tri_edge_indices[3] = + static short* gradleg_tri_edge_indices[3] = { gradleg_tri_edge_indices_0, gradleg_tri_edge_indices_1, gradleg_tri_edge_indices_2, }; - static int gradleg_tri_vertex_indices[3] = { -1, -1, -1 }; - - static int gradleg_tri_index_to_order[] = - { - 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 9, - 10, 10, 10, 10, 10, 10, - 2, 2, 2, - 3, 3, 3, - 4, 4, 4, - 5, 5, 5, - 6, 6, 6, - 7, 7, 7, - 8, 8, 8, - 9, 9, 9, - 10, 10, 10, - 3, 3, - 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + static short gradleg_tri_vertex_indices[3] = { -1, -1, -1 }; + + static unsigned short gradleg_tri_index_to_order[] = + { + 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, + 10, 10, 10, 10, 10, 10, + 2, 2, 2, + 3, 3, 3, + 4, 4, 4, + 5, 5, 5, + 6, 6, 6, + 7, 7, 7, + 8, 8, 8, + 9, 9, 9, + 10, 10, 10, + 3, 3, + 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, }; static Shapeset::shape_fn_t* gradleg_tri_shape_fn_table[2] = @@ -7017,1802 +7017,1802 @@ namespace Hermes static double gradleg_quad_l0_l2_a(double x, double y) { - return dl0(x) * l2(y); + return dl0(x) * l2(y); } static double gradleg_quad_l0_l2_b(double x, double y) { - return l0(x) * dl2(y); + return l0(x) * dl2(y); } static double gradleg_quad_l0_l2_ax(double x, double y) { - return d2l0(x) * l2(y); + return d2l0(x) * l2(y); } static double gradleg_quad_l0_l2_bx(double x, double y) { - return dl0(x) * dl2(y); + return dl0(x) * dl2(y); } static double gradleg_quad_l0_l2_ay(double x, double y) { - return dl0(x) * dl2(y); + return dl0(x) * dl2(y); } static double gradleg_quad_l0_l2_by(double x, double y) { - return l0(x) * d2l2(y); + return l0(x) * d2l2(y); } static double gradleg_quad_l0_l3_a_0(double x, double y) { - return -dl0(x) * l3(y); + return -dl0(x) * l3(y); } static double gradleg_quad_l0_l3_a_1(double x, double y) { - return dl0(x) * l3(y); + return dl0(x) * l3(y); } static double gradleg_quad_l0_l3_b_0(double x, double y) { - return -l0(x) * dl3(y); + return -l0(x) * dl3(y); } static double gradleg_quad_l0_l3_b_1(double x, double y) { - return l0(x) * dl3(y); + return l0(x) * dl3(y); } static double gradleg_quad_l0_l3_ax_0(double x, double y) { - return -d2l0(x) * l3(y); + return -d2l0(x) * l3(y); } static double gradleg_quad_l0_l3_ax_1(double x, double y) { - return d2l0(x) * l3(y); + return d2l0(x) * l3(y); } static double gradleg_quad_l0_l3_bx_0(double x, double y) { - return -dl0(x) * dl3(y); + return -dl0(x) * dl3(y); } static double gradleg_quad_l0_l3_bx_1(double x, double y) { - return dl0(x) * dl3(y); + return dl0(x) * dl3(y); } static double gradleg_quad_l0_l3_ay_0(double x, double y) { - return -dl0(x) * dl3(y); + return -dl0(x) * dl3(y); } static double gradleg_quad_l0_l3_ay_1(double x, double y) { - return dl0(x) * dl3(y); + return dl0(x) * dl3(y); } static double gradleg_quad_l0_l3_by_0(double x, double y) { - return -l0(x) * d2l3(y); + return -l0(x) * d2l3(y); } static double gradleg_quad_l0_l3_by_1(double x, double y) { - return l0(x) * d2l3(y); + return l0(x) * d2l3(y); } static double gradleg_quad_l0_l4_a(double x, double y) { - return dl0(x) * l4(y); + return dl0(x) * l4(y); } static double gradleg_quad_l0_l4_b(double x, double y) { - return l0(x) * dl4(y); + return l0(x) * dl4(y); } static double gradleg_quad_l0_l4_ax(double x, double y) { - return d2l0(x) * l4(y); + return d2l0(x) * l4(y); } static double gradleg_quad_l0_l4_bx(double x, double y) { - return dl0(x) * dl4(y); + return dl0(x) * dl4(y); } static double gradleg_quad_l0_l4_ay(double x, double y) { - return dl0(x) * dl4(y); + return dl0(x) * dl4(y); } static double gradleg_quad_l0_l4_by(double x, double y) { - return l0(x) * d2l4(y); + return l0(x) * d2l4(y); } static double gradleg_quad_l0_l5_a_0(double x, double y) { - return -dl0(x) * l5(y); + return -dl0(x) * l5(y); } static double gradleg_quad_l0_l5_a_1(double x, double y) { - return dl0(x) * l5(y); + return dl0(x) * l5(y); } static double gradleg_quad_l0_l5_b_0(double x, double y) { - return -l0(x) * dl5(y); + return -l0(x) * dl5(y); } static double gradleg_quad_l0_l5_b_1(double x, double y) { - return l0(x) * dl5(y); + return l0(x) * dl5(y); } static double gradleg_quad_l0_l5_ax_0(double x, double y) { - return -d2l0(x) * l5(y); + return -d2l0(x) * l5(y); } static double gradleg_quad_l0_l5_ax_1(double x, double y) { - return d2l0(x) * l5(y); + return d2l0(x) * l5(y); } static double gradleg_quad_l0_l5_bx_0(double x, double y) { - return -dl0(x) * dl5(y); + return -dl0(x) * dl5(y); } static double gradleg_quad_l0_l5_bx_1(double x, double y) { - return dl0(x) * dl5(y); + return dl0(x) * dl5(y); } static double gradleg_quad_l0_l5_ay_0(double x, double y) { - return -dl0(x) * dl5(y); + return -dl0(x) * dl5(y); } static double gradleg_quad_l0_l5_ay_1(double x, double y) { - return dl0(x) * dl5(y); + return dl0(x) * dl5(y); } static double gradleg_quad_l0_l5_by_0(double x, double y) { - return -l0(x) * d2l5(y); + return -l0(x) * d2l5(y); } static double gradleg_quad_l0_l5_by_1(double x, double y) { - return l0(x) * d2l5(y); + return l0(x) * d2l5(y); } static double gradleg_quad_l0_l6_a(double x, double y) { - return dl0(x) * l6(y); + return dl0(x) * l6(y); } static double gradleg_quad_l0_l6_b(double x, double y) { - return l0(x) * dl6(y); + return l0(x) * dl6(y); } static double gradleg_quad_l0_l6_ax(double x, double y) { - return d2l0(x) * l6(y); + return d2l0(x) * l6(y); } static double gradleg_quad_l0_l6_bx(double x, double y) { - return dl0(x) * dl6(y); + return dl0(x) * dl6(y); } static double gradleg_quad_l0_l6_ay(double x, double y) { - return dl0(x) * dl6(y); + return dl0(x) * dl6(y); } static double gradleg_quad_l0_l6_by(double x, double y) { - return l0(x) * d2l6(y); + return l0(x) * d2l6(y); } static double gradleg_quad_l0_l7_a_0(double x, double y) { - return -dl0(x) * l7(y); + return -dl0(x) * l7(y); } static double gradleg_quad_l0_l7_a_1(double x, double y) { - return dl0(x) * l7(y); + return dl0(x) * l7(y); } static double gradleg_quad_l0_l7_b_0(double x, double y) { - return -l0(x) * dl7(y); + return -l0(x) * dl7(y); } static double gradleg_quad_l0_l7_b_1(double x, double y) { - return l0(x) * dl7(y); + return l0(x) * dl7(y); } static double gradleg_quad_l0_l7_ax_0(double x, double y) { - return -d2l0(x) * l7(y); + return -d2l0(x) * l7(y); } static double gradleg_quad_l0_l7_ax_1(double x, double y) { - return d2l0(x) * l7(y); + return d2l0(x) * l7(y); } static double gradleg_quad_l0_l7_bx_0(double x, double y) { - return -dl0(x) * dl7(y); + return -dl0(x) * dl7(y); } static double gradleg_quad_l0_l7_bx_1(double x, double y) { - return dl0(x) * dl7(y); + return dl0(x) * dl7(y); } static double gradleg_quad_l0_l7_ay_0(double x, double y) { - return -dl0(x) * dl7(y); + return -dl0(x) * dl7(y); } static double gradleg_quad_l0_l7_ay_1(double x, double y) { - return dl0(x) * dl7(y); + return dl0(x) * dl7(y); } static double gradleg_quad_l0_l7_by_0(double x, double y) { - return -l0(x) * d2l7(y); + return -l0(x) * d2l7(y); } static double gradleg_quad_l0_l7_by_1(double x, double y) { - return l0(x) * d2l7(y); + return l0(x) * d2l7(y); } static double gradleg_quad_l0_l8_a(double x, double y) { - return dl0(x) * l8(y); + return dl0(x) * l8(y); } static double gradleg_quad_l0_l8_b(double x, double y) { - return l0(x) * dl8(y); + return l0(x) * dl8(y); } static double gradleg_quad_l0_l8_ax(double x, double y) { - return d2l0(x) * l8(y); + return d2l0(x) * l8(y); } static double gradleg_quad_l0_l8_bx(double x, double y) { - return dl0(x) * dl8(y); + return dl0(x) * dl8(y); } static double gradleg_quad_l0_l8_ay(double x, double y) { - return dl0(x) * dl8(y); + return dl0(x) * dl8(y); } static double gradleg_quad_l0_l8_by(double x, double y) { - return l0(x) * d2l8(y); + return l0(x) * d2l8(y); } static double gradleg_quad_l0_l9_a_0(double x, double y) { - return -dl0(x) * l9(y); + return -dl0(x) * l9(y); } static double gradleg_quad_l0_l9_a_1(double x, double y) { - return dl0(x) * l9(y); + return dl0(x) * l9(y); } static double gradleg_quad_l0_l9_b_0(double x, double y) { - return -l0(x) * dl9(y); + return -l0(x) * dl9(y); } static double gradleg_quad_l0_l9_b_1(double x, double y) { - return l0(x) * dl9(y); + return l0(x) * dl9(y); } static double gradleg_quad_l0_l9_ax_0(double x, double y) { - return -d2l0(x) * l9(y); + return -d2l0(x) * l9(y); } static double gradleg_quad_l0_l9_ax_1(double x, double y) { - return d2l0(x) * l9(y); + return d2l0(x) * l9(y); } static double gradleg_quad_l0_l9_bx_0(double x, double y) { - return -dl0(x) * dl9(y); + return -dl0(x) * dl9(y); } static double gradleg_quad_l0_l9_bx_1(double x, double y) { - return dl0(x) * dl9(y); + return dl0(x) * dl9(y); } static double gradleg_quad_l0_l9_ay_0(double x, double y) { - return -dl0(x) * dl9(y); + return -dl0(x) * dl9(y); } static double gradleg_quad_l0_l9_ay_1(double x, double y) { - return dl0(x) * dl9(y); + return dl0(x) * dl9(y); } static double gradleg_quad_l0_l9_by_0(double x, double y) { - return -l0(x) * d2l9(y); + return -l0(x) * d2l9(y); } static double gradleg_quad_l0_l9_by_1(double x, double y) { - return l0(x) * d2l9(y); + return l0(x) * d2l9(y); } static double gradleg_quad_l0_l10_a(double x, double y) { - return dl0(x) * l10(y); + return dl0(x) * l10(y); } static double gradleg_quad_l0_l10_b(double x, double y) { - return l0(x) * dl10(y); + return l0(x) * dl10(y); } static double gradleg_quad_l0_l10_ax(double x, double y) { - return d2l0(x) * l10(y); + return d2l0(x) * l10(y); } static double gradleg_quad_l0_l10_bx(double x, double y) { - return dl0(x) * dl10(y); + return dl0(x) * dl10(y); } static double gradleg_quad_l0_l10_ay(double x, double y) { - return dl0(x) * dl10(y); + return dl0(x) * dl10(y); } static double gradleg_quad_l0_l10_by(double x, double y) { - return l0(x) * d2l10(y); + return l0(x) * d2l10(y); } static double gradleg_quad_l0_l11_a_0(double x, double y) { - return -dl0(x) * l11(y); + return -dl0(x) * l11(y); } static double gradleg_quad_l0_l11_a_1(double x, double y) { - return dl0(x) * l11(y); + return dl0(x) * l11(y); } static double gradleg_quad_l0_l11_b_0(double x, double y) { - return -l0(x) * dl11(y); + return -l0(x) * dl11(y); } static double gradleg_quad_l0_l11_b_1(double x, double y) { - return l0(x) * dl11(y); + return l0(x) * dl11(y); } static double gradleg_quad_l0_l11_ax_0(double x, double y) { - return -d2l0(x) * l11(y); + return -d2l0(x) * l11(y); } static double gradleg_quad_l0_l11_ax_1(double x, double y) { - return d2l0(x) * l11(y); + return d2l0(x) * l11(y); } static double gradleg_quad_l0_l11_bx_0(double x, double y) { - return -dl0(x) * dl11(y); + return -dl0(x) * dl11(y); } static double gradleg_quad_l0_l11_bx_1(double x, double y) { - return dl0(x) * dl11(y); + return dl0(x) * dl11(y); } static double gradleg_quad_l0_l11_ay_0(double x, double y) { - return -dl0(x) * dl11(y); + return -dl0(x) * dl11(y); } static double gradleg_quad_l0_l11_ay_1(double x, double y) { - return dl0(x) * dl11(y); + return dl0(x) * dl11(y); } static double gradleg_quad_l0_l11_by_0(double x, double y) { - return -l0(x) * d2l11(y); + return -l0(x) * d2l11(y); } static double gradleg_quad_l0_l11_by_1(double x, double y) { - return l0(x) * d2l11(y); + return l0(x) * d2l11(y); } static double gradleg_quad_l1_l2_a(double x, double y) { - return dl1(x) * l2(y); + return dl1(x) * l2(y); } static double gradleg_quad_l1_l2_b(double x, double y) { - return l1(x) * dl2(y); + return l1(x) * dl2(y); } static double gradleg_quad_l1_l2_ax(double x, double y) { - return d2l1(x) * l2(y); + return d2l1(x) * l2(y); } static double gradleg_quad_l1_l2_bx(double x, double y) { - return dl1(x) * dl2(y); + return dl1(x) * dl2(y); } static double gradleg_quad_l1_l2_ay(double x, double y) { - return dl1(x) * dl2(y); + return dl1(x) * dl2(y); } static double gradleg_quad_l1_l2_by(double x, double y) { - return l1(x) * d2l2(y); + return l1(x) * d2l2(y); } static double gradleg_quad_l1_l3_a_0(double x, double y) { - return dl1(x) * l3(y); + return dl1(x) * l3(y); } static double gradleg_quad_l1_l3_a_1(double x, double y) { - return -dl1(x) * l3(y); + return -dl1(x) * l3(y); } static double gradleg_quad_l1_l3_b_0(double x, double y) { - return l1(x) * dl3(y); + return l1(x) * dl3(y); } static double gradleg_quad_l1_l3_b_1(double x, double y) { - return -l1(x) * dl3(y); + return -l1(x) * dl3(y); } static double gradleg_quad_l1_l3_ax_0(double x, double y) { - return d2l1(x) * l3(y); + return d2l1(x) * l3(y); } static double gradleg_quad_l1_l3_ax_1(double x, double y) { - return -d2l1(x) * l3(y); + return -d2l1(x) * l3(y); } static double gradleg_quad_l1_l3_bx_0(double x, double y) { - return dl1(x) * dl3(y); + return dl1(x) * dl3(y); } static double gradleg_quad_l1_l3_bx_1(double x, double y) { - return -dl1(x) * dl3(y); + return -dl1(x) * dl3(y); } static double gradleg_quad_l1_l3_ay_0(double x, double y) { - return dl1(x) * dl3(y); + return dl1(x) * dl3(y); } static double gradleg_quad_l1_l3_ay_1(double x, double y) { - return -dl1(x) * dl3(y); + return -dl1(x) * dl3(y); } static double gradleg_quad_l1_l3_by_0(double x, double y) { - return l1(x) * d2l3(y); + return l1(x) * d2l3(y); } static double gradleg_quad_l1_l3_by_1(double x, double y) { - return -l1(x) * d2l3(y); + return -l1(x) * d2l3(y); } static double gradleg_quad_l1_l4_a(double x, double y) { - return dl1(x) * l4(y); + return dl1(x) * l4(y); } static double gradleg_quad_l1_l4_b(double x, double y) { - return l1(x) * dl4(y); + return l1(x) * dl4(y); } static double gradleg_quad_l1_l4_ax(double x, double y) { - return d2l1(x) * l4(y); + return d2l1(x) * l4(y); } static double gradleg_quad_l1_l4_bx(double x, double y) { - return dl1(x) * dl4(y); + return dl1(x) * dl4(y); } static double gradleg_quad_l1_l4_ay(double x, double y) { - return dl1(x) * dl4(y); + return dl1(x) * dl4(y); } static double gradleg_quad_l1_l4_by(double x, double y) { - return l1(x) * d2l4(y); + return l1(x) * d2l4(y); } static double gradleg_quad_l1_l5_a_0(double x, double y) { - return dl1(x) * l5(y); + return dl1(x) * l5(y); } static double gradleg_quad_l1_l5_a_1(double x, double y) { - return -dl1(x) * l5(y); + return -dl1(x) * l5(y); } static double gradleg_quad_l1_l5_b_0(double x, double y) { - return l1(x) * dl5(y); + return l1(x) * dl5(y); } static double gradleg_quad_l1_l5_b_1(double x, double y) { - return -l1(x) * dl5(y); + return -l1(x) * dl5(y); } static double gradleg_quad_l1_l5_ax_0(double x, double y) { - return d2l1(x) * l5(y); + return d2l1(x) * l5(y); } static double gradleg_quad_l1_l5_ax_1(double x, double y) { - return -d2l1(x) * l5(y); + return -d2l1(x) * l5(y); } static double gradleg_quad_l1_l5_bx_0(double x, double y) { - return dl1(x) * dl5(y); + return dl1(x) * dl5(y); } static double gradleg_quad_l1_l5_bx_1(double x, double y) { - return -dl1(x) * dl5(y); + return -dl1(x) * dl5(y); } static double gradleg_quad_l1_l5_ay_0(double x, double y) { - return dl1(x) * dl5(y); + return dl1(x) * dl5(y); } static double gradleg_quad_l1_l5_ay_1(double x, double y) { - return -dl1(x) * dl5(y); + return -dl1(x) * dl5(y); } static double gradleg_quad_l1_l5_by_0(double x, double y) { - return l1(x) * d2l5(y); + return l1(x) * d2l5(y); } static double gradleg_quad_l1_l5_by_1(double x, double y) { - return -l1(x) * d2l5(y); + return -l1(x) * d2l5(y); } static double gradleg_quad_l1_l6_a(double x, double y) { - return dl1(x) * l6(y); + return dl1(x) * l6(y); } static double gradleg_quad_l1_l6_b(double x, double y) { - return l1(x) * dl6(y); + return l1(x) * dl6(y); } static double gradleg_quad_l1_l6_ax(double x, double y) { - return d2l1(x) * l6(y); + return d2l1(x) * l6(y); } static double gradleg_quad_l1_l6_bx(double x, double y) { - return dl1(x) * dl6(y); + return dl1(x) * dl6(y); } static double gradleg_quad_l1_l6_ay(double x, double y) { - return dl1(x) * dl6(y); + return dl1(x) * dl6(y); } static double gradleg_quad_l1_l6_by(double x, double y) { - return l1(x) * d2l6(y); + return l1(x) * d2l6(y); } static double gradleg_quad_l1_l7_a_0(double x, double y) { - return dl1(x) * l7(y); + return dl1(x) * l7(y); } static double gradleg_quad_l1_l7_a_1(double x, double y) { - return -dl1(x) * l7(y); + return -dl1(x) * l7(y); } static double gradleg_quad_l1_l7_b_0(double x, double y) { - return l1(x) * dl7(y); + return l1(x) * dl7(y); } static double gradleg_quad_l1_l7_b_1(double x, double y) { - return -l1(x) * dl7(y); + return -l1(x) * dl7(y); } static double gradleg_quad_l1_l7_ax_0(double x, double y) { - return d2l1(x) * l7(y); + return d2l1(x) * l7(y); } static double gradleg_quad_l1_l7_ax_1(double x, double y) { - return -d2l1(x) * l7(y); + return -d2l1(x) * l7(y); } static double gradleg_quad_l1_l7_bx_0(double x, double y) { - return dl1(x) * dl7(y); + return dl1(x) * dl7(y); } static double gradleg_quad_l1_l7_bx_1(double x, double y) { - return -dl1(x) * dl7(y); + return -dl1(x) * dl7(y); } static double gradleg_quad_l1_l7_ay_0(double x, double y) { - return dl1(x) * dl7(y); + return dl1(x) * dl7(y); } static double gradleg_quad_l1_l7_ay_1(double x, double y) { - return -dl1(x) * dl7(y); + return -dl1(x) * dl7(y); } static double gradleg_quad_l1_l7_by_0(double x, double y) { - return l1(x) * d2l7(y); + return l1(x) * d2l7(y); } static double gradleg_quad_l1_l7_by_1(double x, double y) { - return -l1(x) * d2l7(y); + return -l1(x) * d2l7(y); } static double gradleg_quad_l1_l8_a(double x, double y) { - return dl1(x) * l8(y); + return dl1(x) * l8(y); } static double gradleg_quad_l1_l8_b(double x, double y) { - return l1(x) * dl8(y); + return l1(x) * dl8(y); } static double gradleg_quad_l1_l8_ax(double x, double y) { - return d2l1(x) * l8(y); + return d2l1(x) * l8(y); } static double gradleg_quad_l1_l8_bx(double x, double y) { - return dl1(x) * dl8(y); + return dl1(x) * dl8(y); } static double gradleg_quad_l1_l8_ay(double x, double y) { - return dl1(x) * dl8(y); + return dl1(x) * dl8(y); } static double gradleg_quad_l1_l8_by(double x, double y) { - return l1(x) * d2l8(y); + return l1(x) * d2l8(y); } static double gradleg_quad_l1_l9_a_0(double x, double y) { - return dl1(x) * l9(y); + return dl1(x) * l9(y); } static double gradleg_quad_l1_l9_a_1(double x, double y) { - return -dl1(x) * l9(y); + return -dl1(x) * l9(y); } static double gradleg_quad_l1_l9_b_0(double x, double y) { - return l1(x) * dl9(y); + return l1(x) * dl9(y); } static double gradleg_quad_l1_l9_b_1(double x, double y) { - return -l1(x) * dl9(y); + return -l1(x) * dl9(y); } static double gradleg_quad_l1_l9_ax_0(double x, double y) { - return d2l1(x) * l9(y); + return d2l1(x) * l9(y); } static double gradleg_quad_l1_l9_ax_1(double x, double y) { - return -d2l1(x) * l9(y); + return -d2l1(x) * l9(y); } static double gradleg_quad_l1_l9_bx_0(double x, double y) { - return dl1(x) * dl9(y); + return dl1(x) * dl9(y); } static double gradleg_quad_l1_l9_bx_1(double x, double y) { - return -dl1(x) * dl9(y); + return -dl1(x) * dl9(y); } static double gradleg_quad_l1_l9_ay_0(double x, double y) { - return dl1(x) * dl9(y); + return dl1(x) * dl9(y); } static double gradleg_quad_l1_l9_ay_1(double x, double y) { - return -dl1(x) * dl9(y); + return -dl1(x) * dl9(y); } static double gradleg_quad_l1_l9_by_0(double x, double y) { - return l1(x) * d2l9(y); + return l1(x) * d2l9(y); } static double gradleg_quad_l1_l9_by_1(double x, double y) { - return -l1(x) * d2l9(y); + return -l1(x) * d2l9(y); } static double gradleg_quad_l1_l10_a(double x, double y) { - return dl1(x) * l10(y); + return dl1(x) * l10(y); } static double gradleg_quad_l1_l10_b(double x, double y) { - return l1(x) * dl10(y); + return l1(x) * dl10(y); } static double gradleg_quad_l1_l10_ax(double x, double y) { - return d2l1(x) * l10(y); + return d2l1(x) * l10(y); } static double gradleg_quad_l1_l10_bx(double x, double y) { - return dl1(x) * dl10(y); + return dl1(x) * dl10(y); } static double gradleg_quad_l1_l10_ay(double x, double y) { - return dl1(x) * dl10(y); + return dl1(x) * dl10(y); } static double gradleg_quad_l1_l10_by(double x, double y) { - return l1(x) * d2l10(y); + return l1(x) * d2l10(y); } static double gradleg_quad_l1_l11_a_0(double x, double y) { - return dl1(x) * l11(y); + return dl1(x) * l11(y); } static double gradleg_quad_l1_l11_a_1(double x, double y) { - return -dl1(x) * l11(y); + return -dl1(x) * l11(y); } static double gradleg_quad_l1_l11_b_0(double x, double y) { - return l1(x) * dl11(y); + return l1(x) * dl11(y); } static double gradleg_quad_l1_l11_b_1(double x, double y) { - return -l1(x) * dl11(y); + return -l1(x) * dl11(y); } static double gradleg_quad_l1_l11_ax_0(double x, double y) { - return d2l1(x) * l11(y); + return d2l1(x) * l11(y); } static double gradleg_quad_l1_l11_ax_1(double x, double y) { - return -d2l1(x) * l11(y); + return -d2l1(x) * l11(y); } static double gradleg_quad_l1_l11_bx_0(double x, double y) { - return dl1(x) * dl11(y); + return dl1(x) * dl11(y); } static double gradleg_quad_l1_l11_bx_1(double x, double y) { - return -dl1(x) * dl11(y); + return -dl1(x) * dl11(y); } static double gradleg_quad_l1_l11_ay_0(double x, double y) { - return dl1(x) * dl11(y); + return dl1(x) * dl11(y); } static double gradleg_quad_l1_l11_ay_1(double x, double y) { - return -dl1(x) * dl11(y); + return -dl1(x) * dl11(y); } static double gradleg_quad_l1_l11_by_0(double x, double y) { - return l1(x) * d2l11(y); + return l1(x) * d2l11(y); } static double gradleg_quad_l1_l11_by_1(double x, double y) { - return -l1(x) * d2l11(y); + return -l1(x) * d2l11(y); } static double gradleg_quad_l2_l0_a(double x, double y) { - return dl2(x) * l0(y); + return dl2(x) * l0(y); } static double gradleg_quad_l2_l0_b(double x, double y) { - return l2(x) * dl0(y); + return l2(x) * dl0(y); } static double gradleg_quad_l2_l0_ax(double x, double y) { - return d2l2(x) * l0(y); + return d2l2(x) * l0(y); } static double gradleg_quad_l2_l0_bx(double x, double y) { - return dl2(x) * dl0(y); + return dl2(x) * dl0(y); } static double gradleg_quad_l2_l0_ay(double x, double y) { - return dl2(x) * dl0(y); + return dl2(x) * dl0(y); } static double gradleg_quad_l2_l0_by(double x, double y) { - return l2(x) * d2l0(y); + return l2(x) * d2l0(y); } static double gradleg_quad_l3_l0_a_0(double x, double y) { - return dl3(x) * l0(y); + return dl3(x) * l0(y); } static double gradleg_quad_l3_l0_a_1(double x, double y) { - return -dl3(x) * l0(y); + return -dl3(x) * l0(y); } static double gradleg_quad_l3_l0_b_0(double x, double y) { - return l3(x) * dl0(y); + return l3(x) * dl0(y); } static double gradleg_quad_l3_l0_b_1(double x, double y) { - return -l3(x) * dl0(y); + return -l3(x) * dl0(y); } static double gradleg_quad_l3_l0_ax_0(double x, double y) { - return d2l3(x) * l0(y); + return d2l3(x) * l0(y); } static double gradleg_quad_l3_l0_ax_1(double x, double y) { - return -d2l3(x) * l0(y); + return -d2l3(x) * l0(y); } static double gradleg_quad_l3_l0_bx_0(double x, double y) { - return dl3(x) * dl0(y); + return dl3(x) * dl0(y); } static double gradleg_quad_l3_l0_bx_1(double x, double y) { - return -dl3(x) * dl0(y); + return -dl3(x) * dl0(y); } static double gradleg_quad_l3_l0_ay_0(double x, double y) { - return dl3(x) * dl0(y); + return dl3(x) * dl0(y); } static double gradleg_quad_l3_l0_ay_1(double x, double y) { - return -dl3(x) * dl0(y); + return -dl3(x) * dl0(y); } static double gradleg_quad_l3_l0_by_0(double x, double y) { - return l3(x) * d2l0(y); + return l3(x) * d2l0(y); } static double gradleg_quad_l3_l0_by_1(double x, double y) { - return -l3(x) * d2l0(y); + return -l3(x) * d2l0(y); } static double gradleg_quad_l4_l0_a(double x, double y) { - return dl4(x) * l0(y); + return dl4(x) * l0(y); } static double gradleg_quad_l4_l0_b(double x, double y) { - return l4(x) * dl0(y); + return l4(x) * dl0(y); } static double gradleg_quad_l4_l0_ax(double x, double y) { - return d2l4(x) * l0(y); + return d2l4(x) * l0(y); } static double gradleg_quad_l4_l0_bx(double x, double y) { - return dl4(x) * dl0(y); + return dl4(x) * dl0(y); } static double gradleg_quad_l4_l0_ay(double x, double y) { - return dl4(x) * dl0(y); + return dl4(x) * dl0(y); } static double gradleg_quad_l4_l0_by(double x, double y) { - return l4(x) * d2l0(y); + return l4(x) * d2l0(y); } static double gradleg_quad_l5_l0_a_0(double x, double y) { - return dl5(x) * l0(y); + return dl5(x) * l0(y); } static double gradleg_quad_l5_l0_a_1(double x, double y) { - return -dl5(x) * l0(y); + return -dl5(x) * l0(y); } static double gradleg_quad_l5_l0_b_0(double x, double y) { - return l5(x) * dl0(y); + return l5(x) * dl0(y); } static double gradleg_quad_l5_l0_b_1(double x, double y) { - return -l5(x) * dl0(y); + return -l5(x) * dl0(y); } static double gradleg_quad_l5_l0_ax_0(double x, double y) { - return d2l5(x) * l0(y); + return d2l5(x) * l0(y); } static double gradleg_quad_l5_l0_ax_1(double x, double y) { - return -d2l5(x) * l0(y); + return -d2l5(x) * l0(y); } static double gradleg_quad_l5_l0_bx_0(double x, double y) { - return dl5(x) * dl0(y); + return dl5(x) * dl0(y); } static double gradleg_quad_l5_l0_bx_1(double x, double y) { - return -dl5(x) * dl0(y); + return -dl5(x) * dl0(y); } static double gradleg_quad_l5_l0_ay_0(double x, double y) { - return dl5(x) * dl0(y); + return dl5(x) * dl0(y); } static double gradleg_quad_l5_l0_ay_1(double x, double y) { - return -dl5(x) * dl0(y); + return -dl5(x) * dl0(y); } static double gradleg_quad_l5_l0_by_0(double x, double y) { - return l5(x) * d2l0(y); + return l5(x) * d2l0(y); } static double gradleg_quad_l5_l0_by_1(double x, double y) { - return -l5(x) * d2l0(y); + return -l5(x) * d2l0(y); } static double gradleg_quad_l6_l0_a(double x, double y) { - return dl6(x) * l0(y); + return dl6(x) * l0(y); } static double gradleg_quad_l6_l0_b(double x, double y) { - return l6(x) * dl0(y); + return l6(x) * dl0(y); } static double gradleg_quad_l6_l0_ax(double x, double y) { - return d2l6(x) * l0(y); + return d2l6(x) * l0(y); } static double gradleg_quad_l6_l0_bx(double x, double y) { - return dl6(x) * dl0(y); + return dl6(x) * dl0(y); } static double gradleg_quad_l6_l0_ay(double x, double y) { - return dl6(x) * dl0(y); + return dl6(x) * dl0(y); } static double gradleg_quad_l6_l0_by(double x, double y) { - return l6(x) * d2l0(y); + return l6(x) * d2l0(y); } static double gradleg_quad_l7_l0_a_0(double x, double y) { - return dl7(x) * l0(y); + return dl7(x) * l0(y); } static double gradleg_quad_l7_l0_a_1(double x, double y) { - return -dl7(x) * l0(y); + return -dl7(x) * l0(y); } static double gradleg_quad_l7_l0_b_0(double x, double y) { - return l7(x) * dl0(y); + return l7(x) * dl0(y); } static double gradleg_quad_l7_l0_b_1(double x, double y) { - return -l7(x) * dl0(y); + return -l7(x) * dl0(y); } static double gradleg_quad_l7_l0_ax_0(double x, double y) { - return d2l7(x) * l0(y); + return d2l7(x) * l0(y); } static double gradleg_quad_l7_l0_ax_1(double x, double y) { - return -d2l7(x) * l0(y); + return -d2l7(x) * l0(y); } static double gradleg_quad_l7_l0_bx_0(double x, double y) { - return dl7(x) * dl0(y); + return dl7(x) * dl0(y); } static double gradleg_quad_l7_l0_bx_1(double x, double y) { - return -dl7(x) * dl0(y); + return -dl7(x) * dl0(y); } static double gradleg_quad_l7_l0_ay_0(double x, double y) { - return dl7(x) * dl0(y); + return dl7(x) * dl0(y); } static double gradleg_quad_l7_l0_ay_1(double x, double y) { - return -dl7(x) * dl0(y); + return -dl7(x) * dl0(y); } static double gradleg_quad_l7_l0_by_0(double x, double y) { - return l7(x) * d2l0(y); + return l7(x) * d2l0(y); } static double gradleg_quad_l7_l0_by_1(double x, double y) { - return -l7(x) * d2l0(y); + return -l7(x) * d2l0(y); } static double gradleg_quad_l8_l0_a(double x, double y) { - return dl8(x) * l0(y); + return dl8(x) * l0(y); } static double gradleg_quad_l8_l0_b(double x, double y) { - return l8(x) * dl0(y); + return l8(x) * dl0(y); } static double gradleg_quad_l8_l0_ax(double x, double y) { - return d2l8(x) * l0(y); + return d2l8(x) * l0(y); } static double gradleg_quad_l8_l0_bx(double x, double y) { - return dl8(x) * dl0(y); + return dl8(x) * dl0(y); } static double gradleg_quad_l8_l0_ay(double x, double y) { - return dl8(x) * dl0(y); + return dl8(x) * dl0(y); } static double gradleg_quad_l8_l0_by(double x, double y) { - return l8(x) * d2l0(y); + return l8(x) * d2l0(y); } static double gradleg_quad_l9_l0_a_0(double x, double y) { - return dl9(x) * l0(y); + return dl9(x) * l0(y); } static double gradleg_quad_l9_l0_a_1(double x, double y) { - return -dl9(x) * l0(y); + return -dl9(x) * l0(y); } static double gradleg_quad_l9_l0_b_0(double x, double y) { - return l9(x) * dl0(y); + return l9(x) * dl0(y); } static double gradleg_quad_l9_l0_b_1(double x, double y) { - return -l9(x) * dl0(y); + return -l9(x) * dl0(y); } static double gradleg_quad_l9_l0_ax_0(double x, double y) { - return d2l9(x) * l0(y); + return d2l9(x) * l0(y); } static double gradleg_quad_l9_l0_ax_1(double x, double y) { - return -d2l9(x) * l0(y); + return -d2l9(x) * l0(y); } static double gradleg_quad_l9_l0_bx_0(double x, double y) { - return dl9(x) * dl0(y); + return dl9(x) * dl0(y); } static double gradleg_quad_l9_l0_bx_1(double x, double y) { - return -dl9(x) * dl0(y); + return -dl9(x) * dl0(y); } static double gradleg_quad_l9_l0_ay_0(double x, double y) { - return dl9(x) * dl0(y); + return dl9(x) * dl0(y); } static double gradleg_quad_l9_l0_ay_1(double x, double y) { - return -dl9(x) * dl0(y); + return -dl9(x) * dl0(y); } static double gradleg_quad_l9_l0_by_0(double x, double y) { - return l9(x) * d2l0(y); + return l9(x) * d2l0(y); } static double gradleg_quad_l9_l0_by_1(double x, double y) { - return -l9(x) * d2l0(y); + return -l9(x) * d2l0(y); } static double gradleg_quad_l10_l0_a(double x, double y) { - return dl10(x) * l0(y); + return dl10(x) * l0(y); } static double gradleg_quad_l10_l0_b(double x, double y) { - return l10(x) * dl0(y); + return l10(x) * dl0(y); } static double gradleg_quad_l10_l0_ax(double x, double y) { - return d2l10(x) * l0(y); + return d2l10(x) * l0(y); } static double gradleg_quad_l10_l0_bx(double x, double y) { - return dl10(x) * dl0(y); + return dl10(x) * dl0(y); } static double gradleg_quad_l10_l0_ay(double x, double y) { - return dl10(x) * dl0(y); + return dl10(x) * dl0(y); } static double gradleg_quad_l10_l0_by(double x, double y) { - return l10(x) * d2l0(y); + return l10(x) * d2l0(y); } static double gradleg_quad_l11_l0_a_0(double x, double y) { - return dl11(x) * l0(y); + return dl11(x) * l0(y); } static double gradleg_quad_l11_l0_a_1(double x, double y) { - return -dl11(x) * l0(y); + return -dl11(x) * l0(y); } static double gradleg_quad_l11_l0_b_0(double x, double y) { - return l11(x) * dl0(y); + return l11(x) * dl0(y); } static double gradleg_quad_l11_l0_b_1(double x, double y) { - return -l11(x) * dl0(y); + return -l11(x) * dl0(y); } static double gradleg_quad_l11_l0_ax_0(double x, double y) { - return d2l11(x) * l0(y); + return d2l11(x) * l0(y); } static double gradleg_quad_l11_l0_ax_1(double x, double y) { - return -d2l11(x) * l0(y); + return -d2l11(x) * l0(y); } static double gradleg_quad_l11_l0_bx_0(double x, double y) { - return dl11(x) * dl0(y); + return dl11(x) * dl0(y); } static double gradleg_quad_l11_l0_bx_1(double x, double y) { - return -dl11(x) * dl0(y); + return -dl11(x) * dl0(y); } static double gradleg_quad_l11_l0_ay_0(double x, double y) { - return dl11(x) * dl0(y); + return dl11(x) * dl0(y); } static double gradleg_quad_l11_l0_ay_1(double x, double y) { - return -dl11(x) * dl0(y); + return -dl11(x) * dl0(y); } static double gradleg_quad_l11_l0_by_0(double x, double y) { - return l11(x) * d2l0(y); + return l11(x) * d2l0(y); } static double gradleg_quad_l11_l0_by_1(double x, double y) { - return -l11(x) * d2l0(y); + return -l11(x) * d2l0(y); } static double gradleg_quad_l2_l1_a(double x, double y) { - return dl2(x) * l1(y); + return dl2(x) * l1(y); } static double gradleg_quad_l2_l1_b(double x, double y) { - return l2(x) * dl1(y); + return l2(x) * dl1(y); } static double gradleg_quad_l2_l1_ax(double x, double y) { - return d2l2(x) * l1(y); + return d2l2(x) * l1(y); } static double gradleg_quad_l2_l1_bx(double x, double y) { - return dl2(x) * dl1(y); + return dl2(x) * dl1(y); } static double gradleg_quad_l2_l1_ay(double x, double y) { - return dl2(x) * dl1(y); + return dl2(x) * dl1(y); } static double gradleg_quad_l2_l1_by(double x, double y) { - return l2(x) * d2l1(y); + return l2(x) * d2l1(y); } static double gradleg_quad_l3_l1_a_0(double x, double y) { - return -dl3(x) * l1(y); + return -dl3(x) * l1(y); } static double gradleg_quad_l3_l1_a_1(double x, double y) { - return dl3(x) * l1(y); + return dl3(x) * l1(y); } static double gradleg_quad_l3_l1_b_0(double x, double y) { - return -l3(x) * dl1(y); + return -l3(x) * dl1(y); } static double gradleg_quad_l3_l1_b_1(double x, double y) { - return l3(x) * dl1(y); + return l3(x) * dl1(y); } static double gradleg_quad_l3_l1_ax_0(double x, double y) { - return -d2l3(x) * l1(y); + return -d2l3(x) * l1(y); } static double gradleg_quad_l3_l1_ax_1(double x, double y) { - return d2l3(x) * l1(y); + return d2l3(x) * l1(y); } static double gradleg_quad_l3_l1_bx_0(double x, double y) { - return -dl3(x) * dl1(y); + return -dl3(x) * dl1(y); } static double gradleg_quad_l3_l1_bx_1(double x, double y) { - return dl3(x) * dl1(y); + return dl3(x) * dl1(y); } static double gradleg_quad_l3_l1_ay_0(double x, double y) { - return -dl3(x) * dl1(y); + return -dl3(x) * dl1(y); } static double gradleg_quad_l3_l1_ay_1(double x, double y) { - return dl3(x) * dl1(y); + return dl3(x) * dl1(y); } static double gradleg_quad_l3_l1_by_0(double x, double y) { - return -l3(x) * d2l1(y); + return -l3(x) * d2l1(y); } static double gradleg_quad_l3_l1_by_1(double x, double y) { - return l3(x) * d2l1(y); + return l3(x) * d2l1(y); } static double gradleg_quad_l4_l1_a(double x, double y) { - return dl4(x) * l1(y); + return dl4(x) * l1(y); } static double gradleg_quad_l4_l1_b(double x, double y) { - return l4(x) * dl1(y); + return l4(x) * dl1(y); } static double gradleg_quad_l4_l1_ax(double x, double y) { - return d2l4(x) * l1(y); + return d2l4(x) * l1(y); } static double gradleg_quad_l4_l1_bx(double x, double y) { - return dl4(x) * dl1(y); + return dl4(x) * dl1(y); } static double gradleg_quad_l4_l1_ay(double x, double y) { - return dl4(x) * dl1(y); + return dl4(x) * dl1(y); } static double gradleg_quad_l4_l1_by(double x, double y) { - return l4(x) * d2l1(y); + return l4(x) * d2l1(y); } static double gradleg_quad_l5_l1_a_0(double x, double y) { - return -dl5(x) * l1(y); + return -dl5(x) * l1(y); } static double gradleg_quad_l5_l1_a_1(double x, double y) { - return dl5(x) * l1(y); + return dl5(x) * l1(y); } static double gradleg_quad_l5_l1_b_0(double x, double y) { - return -l5(x) * dl1(y); + return -l5(x) * dl1(y); } static double gradleg_quad_l5_l1_b_1(double x, double y) { - return l5(x) * dl1(y); + return l5(x) * dl1(y); } static double gradleg_quad_l5_l1_ax_0(double x, double y) { - return -d2l5(x) * l1(y); + return -d2l5(x) * l1(y); } static double gradleg_quad_l5_l1_ax_1(double x, double y) { - return d2l5(x) * l1(y); + return d2l5(x) * l1(y); } static double gradleg_quad_l5_l1_bx_0(double x, double y) { - return -dl5(x) * dl1(y); + return -dl5(x) * dl1(y); } static double gradleg_quad_l5_l1_bx_1(double x, double y) { - return dl5(x) * dl1(y); + return dl5(x) * dl1(y); } static double gradleg_quad_l5_l1_ay_0(double x, double y) { - return -dl5(x) * dl1(y); + return -dl5(x) * dl1(y); } static double gradleg_quad_l5_l1_ay_1(double x, double y) { - return dl5(x) * dl1(y); + return dl5(x) * dl1(y); } static double gradleg_quad_l5_l1_by_0(double x, double y) { - return -l5(x) * d2l1(y); + return -l5(x) * d2l1(y); } static double gradleg_quad_l5_l1_by_1(double x, double y) { - return l5(x) * d2l1(y); + return l5(x) * d2l1(y); } static double gradleg_quad_l6_l1_a(double x, double y) { - return dl6(x) * l1(y); + return dl6(x) * l1(y); } static double gradleg_quad_l6_l1_b(double x, double y) { - return l6(x) * dl1(y); + return l6(x) * dl1(y); } static double gradleg_quad_l6_l1_ax(double x, double y) { - return d2l6(x) * l1(y); + return d2l6(x) * l1(y); } static double gradleg_quad_l6_l1_bx(double x, double y) { - return dl6(x) * dl1(y); + return dl6(x) * dl1(y); } static double gradleg_quad_l6_l1_ay(double x, double y) { - return dl6(x) * dl1(y); + return dl6(x) * dl1(y); } static double gradleg_quad_l6_l1_by(double x, double y) { - return l6(x) * d2l1(y); + return l6(x) * d2l1(y); } static double gradleg_quad_l7_l1_a_0(double x, double y) { - return -dl7(x) * l1(y); + return -dl7(x) * l1(y); } static double gradleg_quad_l7_l1_a_1(double x, double y) { - return dl7(x) * l1(y); + return dl7(x) * l1(y); } static double gradleg_quad_l7_l1_b_0(double x, double y) { - return -l7(x) * dl1(y); + return -l7(x) * dl1(y); } static double gradleg_quad_l7_l1_b_1(double x, double y) { - return l7(x) * dl1(y); + return l7(x) * dl1(y); } static double gradleg_quad_l7_l1_ax_0(double x, double y) { - return -d2l7(x) * l1(y); + return -d2l7(x) * l1(y); } static double gradleg_quad_l7_l1_ax_1(double x, double y) { - return d2l7(x) * l1(y); + return d2l7(x) * l1(y); } static double gradleg_quad_l7_l1_bx_0(double x, double y) { - return -dl7(x) * dl1(y); + return -dl7(x) * dl1(y); } static double gradleg_quad_l7_l1_bx_1(double x, double y) { - return dl7(x) * dl1(y); + return dl7(x) * dl1(y); } static double gradleg_quad_l7_l1_ay_0(double x, double y) { - return -dl7(x) * dl1(y); + return -dl7(x) * dl1(y); } static double gradleg_quad_l7_l1_ay_1(double x, double y) { - return dl7(x) * dl1(y); + return dl7(x) * dl1(y); } static double gradleg_quad_l7_l1_by_0(double x, double y) { - return -l7(x) * d2l1(y); + return -l7(x) * d2l1(y); } static double gradleg_quad_l7_l1_by_1(double x, double y) { - return l7(x) * d2l1(y); + return l7(x) * d2l1(y); } static double gradleg_quad_l8_l1_a(double x, double y) { - return dl8(x) * l1(y); + return dl8(x) * l1(y); } static double gradleg_quad_l8_l1_b(double x, double y) { - return l8(x) * dl1(y); + return l8(x) * dl1(y); } static double gradleg_quad_l8_l1_ax(double x, double y) { - return d2l8(x) * l1(y); + return d2l8(x) * l1(y); } static double gradleg_quad_l8_l1_bx(double x, double y) { - return dl8(x) * dl1(y); + return dl8(x) * dl1(y); } static double gradleg_quad_l8_l1_ay(double x, double y) { - return dl8(x) * dl1(y); + return dl8(x) * dl1(y); } static double gradleg_quad_l8_l1_by(double x, double y) { - return l8(x) * d2l1(y); + return l8(x) * d2l1(y); } static double gradleg_quad_l9_l1_a_0(double x, double y) { - return -dl9(x) * l1(y); + return -dl9(x) * l1(y); } static double gradleg_quad_l9_l1_a_1(double x, double y) { - return dl9(x) * l1(y); + return dl9(x) * l1(y); } static double gradleg_quad_l9_l1_b_0(double x, double y) { - return -l9(x) * dl1(y); + return -l9(x) * dl1(y); } static double gradleg_quad_l9_l1_b_1(double x, double y) { - return l9(x) * dl1(y); + return l9(x) * dl1(y); } static double gradleg_quad_l9_l1_ax_0(double x, double y) { - return -d2l9(x) * l1(y); + return -d2l9(x) * l1(y); } static double gradleg_quad_l9_l1_ax_1(double x, double y) { - return d2l9(x) * l1(y); + return d2l9(x) * l1(y); } static double gradleg_quad_l9_l1_bx_0(double x, double y) { - return -dl9(x) * dl1(y); + return -dl9(x) * dl1(y); } static double gradleg_quad_l9_l1_bx_1(double x, double y) { - return dl9(x) * dl1(y); + return dl9(x) * dl1(y); } static double gradleg_quad_l9_l1_ay_0(double x, double y) { - return -dl9(x) * dl1(y); + return -dl9(x) * dl1(y); } static double gradleg_quad_l9_l1_ay_1(double x, double y) { - return dl9(x) * dl1(y); + return dl9(x) * dl1(y); } static double gradleg_quad_l9_l1_by_0(double x, double y) { - return -l9(x) * d2l1(y); + return -l9(x) * d2l1(y); } static double gradleg_quad_l9_l1_by_1(double x, double y) { - return l9(x) * d2l1(y); + return l9(x) * d2l1(y); } static double gradleg_quad_l10_l1_a(double x, double y) { - return dl10(x) * l1(y); + return dl10(x) * l1(y); } static double gradleg_quad_l10_l1_b(double x, double y) { - return l10(x) * dl1(y); + return l10(x) * dl1(y); } static double gradleg_quad_l10_l1_ax(double x, double y) { - return d2l10(x) * l1(y); + return d2l10(x) * l1(y); } static double gradleg_quad_l10_l1_bx(double x, double y) { - return dl10(x) * dl1(y); + return dl10(x) * dl1(y); } static double gradleg_quad_l10_l1_ay(double x, double y) { - return dl10(x) * dl1(y); + return dl10(x) * dl1(y); } static double gradleg_quad_l10_l1_by(double x, double y) { - return l10(x) * d2l1(y); + return l10(x) * d2l1(y); } static double gradleg_quad_l11_l1_a_0(double x, double y) { - return -dl11(x) * l1(y); + return -dl11(x) * l1(y); } static double gradleg_quad_l11_l1_a_1(double x, double y) { - return dl11(x) * l1(y); + return dl11(x) * l1(y); } static double gradleg_quad_l11_l1_b_0(double x, double y) { - return -l11(x) * dl1(y); + return -l11(x) * dl1(y); } static double gradleg_quad_l11_l1_b_1(double x, double y) { - return l11(x) * dl1(y); + return l11(x) * dl1(y); } static double gradleg_quad_l11_l1_ax_0(double x, double y) { - return -d2l11(x) * l1(y); + return -d2l11(x) * l1(y); } static double gradleg_quad_l11_l1_ax_1(double x, double y) { - return d2l11(x) * l1(y); + return d2l11(x) * l1(y); } static double gradleg_quad_l11_l1_bx_0(double x, double y) { - return -dl11(x) * dl1(y); + return -dl11(x) * dl1(y); } static double gradleg_quad_l11_l1_bx_1(double x, double y) { - return dl11(x) * dl1(y); + return dl11(x) * dl1(y); } static double gradleg_quad_l11_l1_ay_0(double x, double y) { - return -dl11(x) * dl1(y); + return -dl11(x) * dl1(y); } static double gradleg_quad_l11_l1_ay_1(double x, double y) { - return dl11(x) * dl1(y); + return dl11(x) * dl1(y); } static double gradleg_quad_l11_l1_by_0(double x, double y) { - return -l11(x) * d2l1(y); + return -l11(x) * d2l1(y); } static double gradleg_quad_l11_l1_by_1(double x, double y) { - return l11(x) * d2l1(y); + return l11(x) * d2l1(y); } /* BUBBLE */ @@ -15425,264 +15425,264 @@ namespace Hermes { gradleg_quad_p0_e1_a_0, gradleg_quad_p0_e1_a_1, gradleg_quad_p0_e2_a, gradleg_quad_p0_e2_a, gradleg_quad_p0_e3_a_0, gradleg_quad_p0_e3_a_1, gradleg_quad_p0_e4_a, gradleg_quad_p0_e4_a, gradleg_quad_l2_l0_a, gradleg_quad_l2_l0_a, gradleg_quad_l1_l2_a, gradleg_quad_l1_l2_a, gradleg_quad_l2_l1_a, gradleg_quad_l2_l1_a, gradleg_quad_l0_l2_a, gradleg_quad_l0_l2_a, - gradleg_quad_l3_l0_a_0, gradleg_quad_l3_l0_a_1, gradleg_quad_l1_l3_a_0, gradleg_quad_l1_l3_a_1, gradleg_quad_l3_l1_a_0, gradleg_quad_l3_l1_a_1, gradleg_quad_l0_l3_a_0, gradleg_quad_l0_l3_a_1, + gradleg_quad_l3_l0_a_0, gradleg_quad_l3_l0_a_1, gradleg_quad_l1_l3_a_0, gradleg_quad_l1_l3_a_1, gradleg_quad_l3_l1_a_0, gradleg_quad_l3_l1_a_1, gradleg_quad_l0_l3_a_0, gradleg_quad_l0_l3_a_1, gradleg_quad_l4_l0_a, gradleg_quad_l4_l0_a, gradleg_quad_l1_l4_a, gradleg_quad_l1_l4_a, gradleg_quad_l4_l1_a, gradleg_quad_l4_l1_a, gradleg_quad_l0_l4_a, gradleg_quad_l0_l4_a, - gradleg_quad_l5_l0_a_0, gradleg_quad_l5_l0_a_1, gradleg_quad_l1_l5_a_0, gradleg_quad_l1_l5_a_1, gradleg_quad_l5_l1_a_0, gradleg_quad_l5_l1_a_1, gradleg_quad_l0_l5_a_0, gradleg_quad_l0_l5_a_1, + gradleg_quad_l5_l0_a_0, gradleg_quad_l5_l0_a_1, gradleg_quad_l1_l5_a_0, gradleg_quad_l1_l5_a_1, gradleg_quad_l5_l1_a_0, gradleg_quad_l5_l1_a_1, gradleg_quad_l0_l5_a_0, gradleg_quad_l0_l5_a_1, gradleg_quad_l6_l0_a, gradleg_quad_l6_l0_a, gradleg_quad_l1_l6_a, gradleg_quad_l1_l6_a, gradleg_quad_l6_l1_a, gradleg_quad_l6_l1_a, gradleg_quad_l0_l6_a, gradleg_quad_l0_l6_a, - gradleg_quad_l7_l0_a_0, gradleg_quad_l7_l0_a_1, gradleg_quad_l1_l7_a_0, gradleg_quad_l1_l7_a_1, gradleg_quad_l7_l1_a_0, gradleg_quad_l7_l1_a_1, gradleg_quad_l0_l7_a_0, gradleg_quad_l0_l7_a_1, + gradleg_quad_l7_l0_a_0, gradleg_quad_l7_l0_a_1, gradleg_quad_l1_l7_a_0, gradleg_quad_l1_l7_a_1, gradleg_quad_l7_l1_a_0, gradleg_quad_l7_l1_a_1, gradleg_quad_l0_l7_a_0, gradleg_quad_l0_l7_a_1, gradleg_quad_l8_l0_a, gradleg_quad_l8_l0_a, gradleg_quad_l1_l8_a, gradleg_quad_l1_l8_a, gradleg_quad_l8_l1_a, gradleg_quad_l8_l1_a, gradleg_quad_l0_l8_a, gradleg_quad_l0_l8_a, - gradleg_quad_l9_l0_a_0, gradleg_quad_l9_l0_a_1, gradleg_quad_l1_l9_a_0, gradleg_quad_l1_l9_a_1, gradleg_quad_l9_l1_a_0, gradleg_quad_l9_l1_a_1, gradleg_quad_l0_l9_a_0, gradleg_quad_l0_l9_a_1, + gradleg_quad_l9_l0_a_0, gradleg_quad_l9_l0_a_1, gradleg_quad_l1_l9_a_0, gradleg_quad_l1_l9_a_1, gradleg_quad_l9_l1_a_0, gradleg_quad_l9_l1_a_1, gradleg_quad_l0_l9_a_0, gradleg_quad_l0_l9_a_1, gradleg_quad_l10_l0_a, gradleg_quad_l10_l0_a, gradleg_quad_l1_l10_a, gradleg_quad_l1_l10_a, gradleg_quad_l10_l1_a, gradleg_quad_l10_l1_a, gradleg_quad_l0_l10_a, gradleg_quad_l0_l10_a, - gradleg_quad_l11_l0_a_0, gradleg_quad_l11_l0_a_1, gradleg_quad_l1_l11_a_0, gradleg_quad_l1_l11_a_1, gradleg_quad_l11_l1_a_0, gradleg_quad_l11_l1_a_1, gradleg_quad_l0_l11_a_0, gradleg_quad_l0_l11_a_1, + gradleg_quad_l11_l0_a_0, gradleg_quad_l11_l0_a_1, gradleg_quad_l1_l11_a_0, gradleg_quad_l1_l11_a_1, gradleg_quad_l11_l1_a_0, gradleg_quad_l11_l1_a_1, gradleg_quad_l0_l11_a_0, gradleg_quad_l0_l11_a_1, - gradleg_quad_p0p2_b1_a, gradleg_quad_p0p3_b1_a, gradleg_quad_p0p4_b1_a, gradleg_quad_p0p5_b1_a, gradleg_quad_p0p6_b1_a, gradleg_quad_p0p7_b1_a, gradleg_quad_p0p8_b1_a, gradleg_quad_p0p9_b1_a, gradleg_quad_p0p10_b1_a, gradleg_quad_p0p11_b1_a, gradleg_quad_p1p2_b1_a, gradleg_quad_p1p3_b1_a, gradleg_quad_p1p4_b1_a, gradleg_quad_p1p5_b1_a, gradleg_quad_p1p6_b1_a, gradleg_quad_p1p7_b1_a, gradleg_quad_p1p8_b1_a, gradleg_quad_p1p9_b1_a, gradleg_quad_p1p10_b1_a, gradleg_quad_p1p11_b1_a, gradleg_quad_p2p2_b1_a, gradleg_quad_p2p3_b1_a, gradleg_quad_p2p4_b1_a, gradleg_quad_p2p5_b1_a, gradleg_quad_p2p6_b1_a, gradleg_quad_p2p7_b1_a, gradleg_quad_p2p8_b1_a, gradleg_quad_p2p9_b1_a, gradleg_quad_p2p10_b1_a, gradleg_quad_p2p11_b1_a, gradleg_quad_p3p2_b1_a, gradleg_quad_p3p3_b1_a, gradleg_quad_p3p4_b1_a, gradleg_quad_p3p5_b1_a, gradleg_quad_p3p6_b1_a, gradleg_quad_p3p7_b1_a, gradleg_quad_p3p8_b1_a, gradleg_quad_p3p9_b1_a, gradleg_quad_p3p10_b1_a, gradleg_quad_p3p11_b1_a, gradleg_quad_p4p2_b1_a, gradleg_quad_p4p3_b1_a, gradleg_quad_p4p4_b1_a, gradleg_quad_p4p5_b1_a, gradleg_quad_p4p6_b1_a, gradleg_quad_p4p7_b1_a, gradleg_quad_p4p8_b1_a, gradleg_quad_p4p9_b1_a, gradleg_quad_p4p10_b1_a, gradleg_quad_p4p11_b1_a, gradleg_quad_p5p2_b1_a, gradleg_quad_p5p3_b1_a, gradleg_quad_p5p4_b1_a, gradleg_quad_p5p5_b1_a, gradleg_quad_p5p6_b1_a, gradleg_quad_p5p7_b1_a, gradleg_quad_p5p8_b1_a, gradleg_quad_p5p9_b1_a, gradleg_quad_p5p10_b1_a, gradleg_quad_p5p11_b1_a, gradleg_quad_p6p2_b1_a, gradleg_quad_p6p3_b1_a, gradleg_quad_p6p4_b1_a, gradleg_quad_p6p5_b1_a, gradleg_quad_p6p6_b1_a, gradleg_quad_p6p7_b1_a, gradleg_quad_p6p8_b1_a, gradleg_quad_p6p9_b1_a, gradleg_quad_p6p10_b1_a, gradleg_quad_p6p11_b1_a, gradleg_quad_p7p2_b1_a, gradleg_quad_p7p3_b1_a, gradleg_quad_p7p4_b1_a, gradleg_quad_p7p5_b1_a, gradleg_quad_p7p6_b1_a, gradleg_quad_p7p7_b1_a, gradleg_quad_p7p8_b1_a, gradleg_quad_p7p9_b1_a, gradleg_quad_p7p10_b1_a, gradleg_quad_p7p11_b1_a, gradleg_quad_p8p2_b1_a, gradleg_quad_p8p3_b1_a, gradleg_quad_p8p4_b1_a, gradleg_quad_p8p5_b1_a, gradleg_quad_p8p6_b1_a, gradleg_quad_p8p7_b1_a, gradleg_quad_p8p8_b1_a, gradleg_quad_p8p9_b1_a, gradleg_quad_p8p10_b1_a, gradleg_quad_p8p11_b1_a, gradleg_quad_p9p2_b1_a, gradleg_quad_p9p3_b1_a, gradleg_quad_p9p4_b1_a, gradleg_quad_p9p5_b1_a, gradleg_quad_p9p6_b1_a, gradleg_quad_p9p7_b1_a, gradleg_quad_p9p8_b1_a, gradleg_quad_p9p9_b1_a, gradleg_quad_p9p10_b1_a, gradleg_quad_p9p11_b1_a, gradleg_quad_p10p2_b1_a, gradleg_quad_p10p3_b1_a, gradleg_quad_p10p4_b1_a, gradleg_quad_p10p5_b1_a, gradleg_quad_p10p6_b1_a, gradleg_quad_p10p7_b1_a, gradleg_quad_p10p8_b1_a, gradleg_quad_p10p9_b1_a, gradleg_quad_p10p10_b1_a, gradleg_quad_p10p11_b1_a, gradleg_quad_p2p0_b2_a, gradleg_quad_p2p1_b2_a, gradleg_quad_p2p2_b2_a, gradleg_quad_p2p3_b2_a, gradleg_quad_p2p4_b2_a, gradleg_quad_p2p5_b2_a, gradleg_quad_p2p6_b2_a, gradleg_quad_p2p7_b2_a, gradleg_quad_p2p8_b2_a, gradleg_quad_p2p9_b2_a, gradleg_quad_p2p10_b2_a, gradleg_quad_p3p0_b2_a, gradleg_quad_p3p1_b2_a, gradleg_quad_p3p2_b2_a, gradleg_quad_p3p3_b2_a, gradleg_quad_p3p4_b2_a, gradleg_quad_p3p5_b2_a, gradleg_quad_p3p6_b2_a, gradleg_quad_p3p7_b2_a, gradleg_quad_p3p8_b2_a, gradleg_quad_p3p9_b2_a, gradleg_quad_p3p10_b2_a, gradleg_quad_p4p0_b2_a, gradleg_quad_p4p1_b2_a, gradleg_quad_p4p2_b2_a, gradleg_quad_p4p3_b2_a, gradleg_quad_p4p4_b2_a, gradleg_quad_p4p5_b2_a, gradleg_quad_p4p6_b2_a, gradleg_quad_p4p7_b2_a, gradleg_quad_p4p8_b2_a, gradleg_quad_p4p9_b2_a, gradleg_quad_p4p10_b2_a, gradleg_quad_p5p0_b2_a, gradleg_quad_p5p1_b2_a, gradleg_quad_p5p2_b2_a, gradleg_quad_p5p3_b2_a, gradleg_quad_p5p4_b2_a, gradleg_quad_p5p5_b2_a, gradleg_quad_p5p6_b2_a, gradleg_quad_p5p7_b2_a, gradleg_quad_p5p8_b2_a, gradleg_quad_p5p9_b2_a, gradleg_quad_p5p10_b2_a, gradleg_quad_p6p0_b2_a, gradleg_quad_p6p1_b2_a, gradleg_quad_p6p2_b2_a, gradleg_quad_p6p3_b2_a, gradleg_quad_p6p4_b2_a, gradleg_quad_p6p5_b2_a, gradleg_quad_p6p6_b2_a, gradleg_quad_p6p7_b2_a, gradleg_quad_p6p8_b2_a, gradleg_quad_p6p9_b2_a, gradleg_quad_p6p10_b2_a, gradleg_quad_p7p0_b2_a, gradleg_quad_p7p1_b2_a, gradleg_quad_p7p2_b2_a, gradleg_quad_p7p3_b2_a, gradleg_quad_p7p4_b2_a, gradleg_quad_p7p5_b2_a, gradleg_quad_p7p6_b2_a, gradleg_quad_p7p7_b2_a, gradleg_quad_p7p8_b2_a, gradleg_quad_p7p9_b2_a, gradleg_quad_p7p10_b2_a, gradleg_quad_p8p0_b2_a, gradleg_quad_p8p1_b2_a, gradleg_quad_p8p2_b2_a, gradleg_quad_p8p3_b2_a, gradleg_quad_p8p4_b2_a, gradleg_quad_p8p5_b2_a, gradleg_quad_p8p6_b2_a, gradleg_quad_p8p7_b2_a, gradleg_quad_p8p8_b2_a, gradleg_quad_p8p9_b2_a, gradleg_quad_p8p10_b2_a, gradleg_quad_p9p0_b2_a, gradleg_quad_p9p1_b2_a, gradleg_quad_p9p2_b2_a, gradleg_quad_p9p3_b2_a, gradleg_quad_p9p4_b2_a, gradleg_quad_p9p5_b2_a, gradleg_quad_p9p6_b2_a, gradleg_quad_p9p7_b2_a, gradleg_quad_p9p8_b2_a, gradleg_quad_p9p9_b2_a, gradleg_quad_p9p10_b2_a, gradleg_quad_p10p0_b2_a, gradleg_quad_p10p1_b2_a, gradleg_quad_p10p2_b2_a, gradleg_quad_p10p3_b2_a, gradleg_quad_p10p4_b2_a, gradleg_quad_p10p5_b2_a, gradleg_quad_p10p6_b2_a, gradleg_quad_p10p7_b2_a, gradleg_quad_p10p8_b2_a, gradleg_quad_p10p9_b2_a, gradleg_quad_p10p10_b2_a, gradleg_quad_p11p0_b2_a, gradleg_quad_p11p1_b2_a, gradleg_quad_p11p2_b2_a, gradleg_quad_p11p3_b2_a, gradleg_quad_p11p4_b2_a, gradleg_quad_p11p5_b2_a, gradleg_quad_p11p6_b2_a, gradleg_quad_p11p7_b2_a, gradleg_quad_p11p8_b2_a, gradleg_quad_p11p9_b2_a, gradleg_quad_p11p10_b2_a, }; + gradleg_quad_p0p2_b1_a, gradleg_quad_p0p3_b1_a, gradleg_quad_p0p4_b1_a, gradleg_quad_p0p5_b1_a, gradleg_quad_p0p6_b1_a, gradleg_quad_p0p7_b1_a, gradleg_quad_p0p8_b1_a, gradleg_quad_p0p9_b1_a, gradleg_quad_p0p10_b1_a, gradleg_quad_p0p11_b1_a, gradleg_quad_p1p2_b1_a, gradleg_quad_p1p3_b1_a, gradleg_quad_p1p4_b1_a, gradleg_quad_p1p5_b1_a, gradleg_quad_p1p6_b1_a, gradleg_quad_p1p7_b1_a, gradleg_quad_p1p8_b1_a, gradleg_quad_p1p9_b1_a, gradleg_quad_p1p10_b1_a, gradleg_quad_p1p11_b1_a, gradleg_quad_p2p2_b1_a, gradleg_quad_p2p3_b1_a, gradleg_quad_p2p4_b1_a, gradleg_quad_p2p5_b1_a, gradleg_quad_p2p6_b1_a, gradleg_quad_p2p7_b1_a, gradleg_quad_p2p8_b1_a, gradleg_quad_p2p9_b1_a, gradleg_quad_p2p10_b1_a, gradleg_quad_p2p11_b1_a, gradleg_quad_p3p2_b1_a, gradleg_quad_p3p3_b1_a, gradleg_quad_p3p4_b1_a, gradleg_quad_p3p5_b1_a, gradleg_quad_p3p6_b1_a, gradleg_quad_p3p7_b1_a, gradleg_quad_p3p8_b1_a, gradleg_quad_p3p9_b1_a, gradleg_quad_p3p10_b1_a, gradleg_quad_p3p11_b1_a, gradleg_quad_p4p2_b1_a, gradleg_quad_p4p3_b1_a, gradleg_quad_p4p4_b1_a, gradleg_quad_p4p5_b1_a, gradleg_quad_p4p6_b1_a, gradleg_quad_p4p7_b1_a, gradleg_quad_p4p8_b1_a, gradleg_quad_p4p9_b1_a, gradleg_quad_p4p10_b1_a, gradleg_quad_p4p11_b1_a, gradleg_quad_p5p2_b1_a, gradleg_quad_p5p3_b1_a, gradleg_quad_p5p4_b1_a, gradleg_quad_p5p5_b1_a, gradleg_quad_p5p6_b1_a, gradleg_quad_p5p7_b1_a, gradleg_quad_p5p8_b1_a, gradleg_quad_p5p9_b1_a, gradleg_quad_p5p10_b1_a, gradleg_quad_p5p11_b1_a, gradleg_quad_p6p2_b1_a, gradleg_quad_p6p3_b1_a, gradleg_quad_p6p4_b1_a, gradleg_quad_p6p5_b1_a, gradleg_quad_p6p6_b1_a, gradleg_quad_p6p7_b1_a, gradleg_quad_p6p8_b1_a, gradleg_quad_p6p9_b1_a, gradleg_quad_p6p10_b1_a, gradleg_quad_p6p11_b1_a, gradleg_quad_p7p2_b1_a, gradleg_quad_p7p3_b1_a, gradleg_quad_p7p4_b1_a, gradleg_quad_p7p5_b1_a, gradleg_quad_p7p6_b1_a, gradleg_quad_p7p7_b1_a, gradleg_quad_p7p8_b1_a, gradleg_quad_p7p9_b1_a, gradleg_quad_p7p10_b1_a, gradleg_quad_p7p11_b1_a, gradleg_quad_p8p2_b1_a, gradleg_quad_p8p3_b1_a, gradleg_quad_p8p4_b1_a, gradleg_quad_p8p5_b1_a, gradleg_quad_p8p6_b1_a, gradleg_quad_p8p7_b1_a, gradleg_quad_p8p8_b1_a, gradleg_quad_p8p9_b1_a, gradleg_quad_p8p10_b1_a, gradleg_quad_p8p11_b1_a, gradleg_quad_p9p2_b1_a, gradleg_quad_p9p3_b1_a, gradleg_quad_p9p4_b1_a, gradleg_quad_p9p5_b1_a, gradleg_quad_p9p6_b1_a, gradleg_quad_p9p7_b1_a, gradleg_quad_p9p8_b1_a, gradleg_quad_p9p9_b1_a, gradleg_quad_p9p10_b1_a, gradleg_quad_p9p11_b1_a, gradleg_quad_p10p2_b1_a, gradleg_quad_p10p3_b1_a, gradleg_quad_p10p4_b1_a, gradleg_quad_p10p5_b1_a, gradleg_quad_p10p6_b1_a, gradleg_quad_p10p7_b1_a, gradleg_quad_p10p8_b1_a, gradleg_quad_p10p9_b1_a, gradleg_quad_p10p10_b1_a, gradleg_quad_p10p11_b1_a, gradleg_quad_p2p0_b2_a, gradleg_quad_p2p1_b2_a, gradleg_quad_p2p2_b2_a, gradleg_quad_p2p3_b2_a, gradleg_quad_p2p4_b2_a, gradleg_quad_p2p5_b2_a, gradleg_quad_p2p6_b2_a, gradleg_quad_p2p7_b2_a, gradleg_quad_p2p8_b2_a, gradleg_quad_p2p9_b2_a, gradleg_quad_p2p10_b2_a, gradleg_quad_p3p0_b2_a, gradleg_quad_p3p1_b2_a, gradleg_quad_p3p2_b2_a, gradleg_quad_p3p3_b2_a, gradleg_quad_p3p4_b2_a, gradleg_quad_p3p5_b2_a, gradleg_quad_p3p6_b2_a, gradleg_quad_p3p7_b2_a, gradleg_quad_p3p8_b2_a, gradleg_quad_p3p9_b2_a, gradleg_quad_p3p10_b2_a, gradleg_quad_p4p0_b2_a, gradleg_quad_p4p1_b2_a, gradleg_quad_p4p2_b2_a, gradleg_quad_p4p3_b2_a, gradleg_quad_p4p4_b2_a, gradleg_quad_p4p5_b2_a, gradleg_quad_p4p6_b2_a, gradleg_quad_p4p7_b2_a, gradleg_quad_p4p8_b2_a, gradleg_quad_p4p9_b2_a, gradleg_quad_p4p10_b2_a, gradleg_quad_p5p0_b2_a, gradleg_quad_p5p1_b2_a, gradleg_quad_p5p2_b2_a, gradleg_quad_p5p3_b2_a, gradleg_quad_p5p4_b2_a, gradleg_quad_p5p5_b2_a, gradleg_quad_p5p6_b2_a, gradleg_quad_p5p7_b2_a, gradleg_quad_p5p8_b2_a, gradleg_quad_p5p9_b2_a, gradleg_quad_p5p10_b2_a, gradleg_quad_p6p0_b2_a, gradleg_quad_p6p1_b2_a, gradleg_quad_p6p2_b2_a, gradleg_quad_p6p3_b2_a, gradleg_quad_p6p4_b2_a, gradleg_quad_p6p5_b2_a, gradleg_quad_p6p6_b2_a, gradleg_quad_p6p7_b2_a, gradleg_quad_p6p8_b2_a, gradleg_quad_p6p9_b2_a, gradleg_quad_p6p10_b2_a, gradleg_quad_p7p0_b2_a, gradleg_quad_p7p1_b2_a, gradleg_quad_p7p2_b2_a, gradleg_quad_p7p3_b2_a, gradleg_quad_p7p4_b2_a, gradleg_quad_p7p5_b2_a, gradleg_quad_p7p6_b2_a, gradleg_quad_p7p7_b2_a, gradleg_quad_p7p8_b2_a, gradleg_quad_p7p9_b2_a, gradleg_quad_p7p10_b2_a, gradleg_quad_p8p0_b2_a, gradleg_quad_p8p1_b2_a, gradleg_quad_p8p2_b2_a, gradleg_quad_p8p3_b2_a, gradleg_quad_p8p4_b2_a, gradleg_quad_p8p5_b2_a, gradleg_quad_p8p6_b2_a, gradleg_quad_p8p7_b2_a, gradleg_quad_p8p8_b2_a, gradleg_quad_p8p9_b2_a, gradleg_quad_p8p10_b2_a, gradleg_quad_p9p0_b2_a, gradleg_quad_p9p1_b2_a, gradleg_quad_p9p2_b2_a, gradleg_quad_p9p3_b2_a, gradleg_quad_p9p4_b2_a, gradleg_quad_p9p5_b2_a, gradleg_quad_p9p6_b2_a, gradleg_quad_p9p7_b2_a, gradleg_quad_p9p8_b2_a, gradleg_quad_p9p9_b2_a, gradleg_quad_p9p10_b2_a, gradleg_quad_p10p0_b2_a, gradleg_quad_p10p1_b2_a, gradleg_quad_p10p2_b2_a, gradleg_quad_p10p3_b2_a, gradleg_quad_p10p4_b2_a, gradleg_quad_p10p5_b2_a, gradleg_quad_p10p6_b2_a, gradleg_quad_p10p7_b2_a, gradleg_quad_p10p8_b2_a, gradleg_quad_p10p9_b2_a, gradleg_quad_p10p10_b2_a, gradleg_quad_p11p0_b2_a, gradleg_quad_p11p1_b2_a, gradleg_quad_p11p2_b2_a, gradleg_quad_p11p3_b2_a, gradleg_quad_p11p4_b2_a, gradleg_quad_p11p5_b2_a, gradleg_quad_p11p6_b2_a, gradleg_quad_p11p7_b2_a, gradleg_quad_p11p8_b2_a, gradleg_quad_p11p9_b2_a, gradleg_quad_p11p10_b2_a, }; static Shapeset::shape_fn_t gradleg_quad_fn_b[] = { - gradleg_quad_p0_e1_b, gradleg_quad_p0_e1_b, gradleg_quad_p0_e2_b_0, gradleg_quad_p0_e2_b_1, gradleg_quad_p0_e3_b, gradleg_quad_p0_e3_b, gradleg_quad_p0_e4_b_0, gradleg_quad_p0_e4_b_1, - gradleg_quad_l2_l0_b, gradleg_quad_l2_l0_b, gradleg_quad_l1_l2_b, gradleg_quad_l1_l2_b, gradleg_quad_l2_l1_b, gradleg_quad_l2_l1_b, gradleg_quad_l0_l2_b, gradleg_quad_l0_l2_b, + gradleg_quad_p0_e1_b, gradleg_quad_p0_e1_b, gradleg_quad_p0_e2_b_0, gradleg_quad_p0_e2_b_1, gradleg_quad_p0_e3_b, gradleg_quad_p0_e3_b, gradleg_quad_p0_e4_b_0, gradleg_quad_p0_e4_b_1, + gradleg_quad_l2_l0_b, gradleg_quad_l2_l0_b, gradleg_quad_l1_l2_b, gradleg_quad_l1_l2_b, gradleg_quad_l2_l1_b, gradleg_quad_l2_l1_b, gradleg_quad_l0_l2_b, gradleg_quad_l0_l2_b, gradleg_quad_l3_l0_b_0, gradleg_quad_l3_l0_b_1, gradleg_quad_l1_l3_b_0, gradleg_quad_l1_l3_b_1, gradleg_quad_l3_l1_b_0, gradleg_quad_l3_l1_b_1, gradleg_quad_l0_l3_b_0, gradleg_quad_l0_l3_b_1, - gradleg_quad_l4_l0_b, gradleg_quad_l4_l0_b, gradleg_quad_l1_l4_b, gradleg_quad_l1_l4_b, gradleg_quad_l4_l1_b, gradleg_quad_l4_l1_b, gradleg_quad_l0_l4_b, gradleg_quad_l0_l4_b, + gradleg_quad_l4_l0_b, gradleg_quad_l4_l0_b, gradleg_quad_l1_l4_b, gradleg_quad_l1_l4_b, gradleg_quad_l4_l1_b, gradleg_quad_l4_l1_b, gradleg_quad_l0_l4_b, gradleg_quad_l0_l4_b, gradleg_quad_l5_l0_b_0, gradleg_quad_l5_l0_b_1, gradleg_quad_l1_l5_b_0, gradleg_quad_l1_l5_b_1, gradleg_quad_l5_l1_b_0, gradleg_quad_l5_l1_b_1, gradleg_quad_l0_l5_b_0, gradleg_quad_l0_l5_b_1, - gradleg_quad_l6_l0_b, gradleg_quad_l6_l0_b, gradleg_quad_l1_l6_b, gradleg_quad_l1_l6_b, gradleg_quad_l6_l1_b, gradleg_quad_l6_l1_b, gradleg_quad_l0_l6_b, gradleg_quad_l0_l6_b, + gradleg_quad_l6_l0_b, gradleg_quad_l6_l0_b, gradleg_quad_l1_l6_b, gradleg_quad_l1_l6_b, gradleg_quad_l6_l1_b, gradleg_quad_l6_l1_b, gradleg_quad_l0_l6_b, gradleg_quad_l0_l6_b, gradleg_quad_l7_l0_b_0, gradleg_quad_l7_l0_b_1, gradleg_quad_l1_l7_b_0, gradleg_quad_l1_l7_b_1, gradleg_quad_l7_l1_b_0, gradleg_quad_l7_l1_b_1, gradleg_quad_l0_l7_b_0, gradleg_quad_l0_l7_b_1, - gradleg_quad_l8_l0_b, gradleg_quad_l8_l0_b, gradleg_quad_l1_l8_b, gradleg_quad_l1_l8_b, gradleg_quad_l8_l1_b, gradleg_quad_l8_l1_b, gradleg_quad_l0_l8_b, gradleg_quad_l0_l8_b, + gradleg_quad_l8_l0_b, gradleg_quad_l8_l0_b, gradleg_quad_l1_l8_b, gradleg_quad_l1_l8_b, gradleg_quad_l8_l1_b, gradleg_quad_l8_l1_b, gradleg_quad_l0_l8_b, gradleg_quad_l0_l8_b, gradleg_quad_l9_l0_b_0, gradleg_quad_l9_l0_b_1, gradleg_quad_l1_l9_b_0, gradleg_quad_l1_l9_b_1, gradleg_quad_l9_l1_b_0, gradleg_quad_l9_l1_b_1, gradleg_quad_l0_l9_b_0, gradleg_quad_l0_l9_b_1, - gradleg_quad_l10_l0_b, gradleg_quad_l10_l0_b, gradleg_quad_l1_l10_b, gradleg_quad_l1_l10_b, gradleg_quad_l10_l1_b, gradleg_quad_l10_l1_b, gradleg_quad_l0_l10_b, gradleg_quad_l0_l10_b, + gradleg_quad_l10_l0_b, gradleg_quad_l10_l0_b, gradleg_quad_l1_l10_b, gradleg_quad_l1_l10_b, gradleg_quad_l10_l1_b, gradleg_quad_l10_l1_b, gradleg_quad_l0_l10_b, gradleg_quad_l0_l10_b, gradleg_quad_l11_l0_b_0, gradleg_quad_l11_l0_b_1, gradleg_quad_l1_l11_b_0, gradleg_quad_l1_l11_b_1, gradleg_quad_l11_l1_b_0, gradleg_quad_l11_l1_b_1, gradleg_quad_l0_l11_b_0, gradleg_quad_l0_l11_b_1, - gradleg_quad_p0p2_b1_b, gradleg_quad_p0p3_b1_b, gradleg_quad_p0p4_b1_b, gradleg_quad_p0p5_b1_b, gradleg_quad_p0p6_b1_b, gradleg_quad_p0p7_b1_b, gradleg_quad_p0p8_b1_b, gradleg_quad_p0p9_b1_b, gradleg_quad_p0p10_b1_b, gradleg_quad_p0p11_b1_b, gradleg_quad_p1p2_b1_b, gradleg_quad_p1p3_b1_b, gradleg_quad_p1p4_b1_b, gradleg_quad_p1p5_b1_b, gradleg_quad_p1p6_b1_b, gradleg_quad_p1p7_b1_b, gradleg_quad_p1p8_b1_b, gradleg_quad_p1p9_b1_b, gradleg_quad_p1p10_b1_b, gradleg_quad_p1p11_b1_b, gradleg_quad_p2p2_b1_b, gradleg_quad_p2p3_b1_b, gradleg_quad_p2p4_b1_b, gradleg_quad_p2p5_b1_b, gradleg_quad_p2p6_b1_b, gradleg_quad_p2p7_b1_b, gradleg_quad_p2p8_b1_b, gradleg_quad_p2p9_b1_b, gradleg_quad_p2p10_b1_b, gradleg_quad_p2p11_b1_b, gradleg_quad_p3p2_b1_b, gradleg_quad_p3p3_b1_b, gradleg_quad_p3p4_b1_b, gradleg_quad_p3p5_b1_b, gradleg_quad_p3p6_b1_b, gradleg_quad_p3p7_b1_b, gradleg_quad_p3p8_b1_b, gradleg_quad_p3p9_b1_b, gradleg_quad_p3p10_b1_b, gradleg_quad_p3p11_b1_b, gradleg_quad_p4p2_b1_b, gradleg_quad_p4p3_b1_b, gradleg_quad_p4p4_b1_b, gradleg_quad_p4p5_b1_b, gradleg_quad_p4p6_b1_b, gradleg_quad_p4p7_b1_b, gradleg_quad_p4p8_b1_b, gradleg_quad_p4p9_b1_b, gradleg_quad_p4p10_b1_b, gradleg_quad_p4p11_b1_b, gradleg_quad_p5p2_b1_b, gradleg_quad_p5p3_b1_b, gradleg_quad_p5p4_b1_b, gradleg_quad_p5p5_b1_b, gradleg_quad_p5p6_b1_b, gradleg_quad_p5p7_b1_b, gradleg_quad_p5p8_b1_b, gradleg_quad_p5p9_b1_b, gradleg_quad_p5p10_b1_b, gradleg_quad_p5p11_b1_b, gradleg_quad_p6p2_b1_b, gradleg_quad_p6p3_b1_b, gradleg_quad_p6p4_b1_b, gradleg_quad_p6p5_b1_b, gradleg_quad_p6p6_b1_b, gradleg_quad_p6p7_b1_b, gradleg_quad_p6p8_b1_b, gradleg_quad_p6p9_b1_b, gradleg_quad_p6p10_b1_b, gradleg_quad_p6p11_b1_b, gradleg_quad_p7p2_b1_b, gradleg_quad_p7p3_b1_b, gradleg_quad_p7p4_b1_b, gradleg_quad_p7p5_b1_b, gradleg_quad_p7p6_b1_b, gradleg_quad_p7p7_b1_b, gradleg_quad_p7p8_b1_b, gradleg_quad_p7p9_b1_b, gradleg_quad_p7p10_b1_b, gradleg_quad_p7p11_b1_b, gradleg_quad_p8p2_b1_b, gradleg_quad_p8p3_b1_b, gradleg_quad_p8p4_b1_b, gradleg_quad_p8p5_b1_b, gradleg_quad_p8p6_b1_b, gradleg_quad_p8p7_b1_b, gradleg_quad_p8p8_b1_b, gradleg_quad_p8p9_b1_b, gradleg_quad_p8p10_b1_b, gradleg_quad_p8p11_b1_b, gradleg_quad_p9p2_b1_b, gradleg_quad_p9p3_b1_b, gradleg_quad_p9p4_b1_b, gradleg_quad_p9p5_b1_b, gradleg_quad_p9p6_b1_b, gradleg_quad_p9p7_b1_b, gradleg_quad_p9p8_b1_b, gradleg_quad_p9p9_b1_b, gradleg_quad_p9p10_b1_b, gradleg_quad_p9p11_b1_b, gradleg_quad_p10p2_b1_b, gradleg_quad_p10p3_b1_b, gradleg_quad_p10p4_b1_b, gradleg_quad_p10p5_b1_b, gradleg_quad_p10p6_b1_b, gradleg_quad_p10p7_b1_b, gradleg_quad_p10p8_b1_b, gradleg_quad_p10p9_b1_b, gradleg_quad_p10p10_b1_b, gradleg_quad_p10p11_b1_b, gradleg_quad_p2p0_b2_b, gradleg_quad_p2p1_b2_b, gradleg_quad_p2p2_b2_b, gradleg_quad_p2p3_b2_b, gradleg_quad_p2p4_b2_b, gradleg_quad_p2p5_b2_b, gradleg_quad_p2p6_b2_b, gradleg_quad_p2p7_b2_b, gradleg_quad_p2p8_b2_b, gradleg_quad_p2p9_b2_b, gradleg_quad_p2p10_b2_b, gradleg_quad_p3p0_b2_b, gradleg_quad_p3p1_b2_b, gradleg_quad_p3p2_b2_b, gradleg_quad_p3p3_b2_b, gradleg_quad_p3p4_b2_b, gradleg_quad_p3p5_b2_b, gradleg_quad_p3p6_b2_b, gradleg_quad_p3p7_b2_b, gradleg_quad_p3p8_b2_b, gradleg_quad_p3p9_b2_b, gradleg_quad_p3p10_b2_b, gradleg_quad_p4p0_b2_b, gradleg_quad_p4p1_b2_b, gradleg_quad_p4p2_b2_b, gradleg_quad_p4p3_b2_b, gradleg_quad_p4p4_b2_b, gradleg_quad_p4p5_b2_b, gradleg_quad_p4p6_b2_b, gradleg_quad_p4p7_b2_b, gradleg_quad_p4p8_b2_b, gradleg_quad_p4p9_b2_b, gradleg_quad_p4p10_b2_b, gradleg_quad_p5p0_b2_b, gradleg_quad_p5p1_b2_b, gradleg_quad_p5p2_b2_b, gradleg_quad_p5p3_b2_b, gradleg_quad_p5p4_b2_b, gradleg_quad_p5p5_b2_b, gradleg_quad_p5p6_b2_b, gradleg_quad_p5p7_b2_b, gradleg_quad_p5p8_b2_b, gradleg_quad_p5p9_b2_b, gradleg_quad_p5p10_b2_b, gradleg_quad_p6p0_b2_b, gradleg_quad_p6p1_b2_b, gradleg_quad_p6p2_b2_b, gradleg_quad_p6p3_b2_b, gradleg_quad_p6p4_b2_b, gradleg_quad_p6p5_b2_b, gradleg_quad_p6p6_b2_b, gradleg_quad_p6p7_b2_b, gradleg_quad_p6p8_b2_b, gradleg_quad_p6p9_b2_b, gradleg_quad_p6p10_b2_b, gradleg_quad_p7p0_b2_b, gradleg_quad_p7p1_b2_b, gradleg_quad_p7p2_b2_b, gradleg_quad_p7p3_b2_b, gradleg_quad_p7p4_b2_b, gradleg_quad_p7p5_b2_b, gradleg_quad_p7p6_b2_b, gradleg_quad_p7p7_b2_b, gradleg_quad_p7p8_b2_b, gradleg_quad_p7p9_b2_b, gradleg_quad_p7p10_b2_b, gradleg_quad_p8p0_b2_b, gradleg_quad_p8p1_b2_b, gradleg_quad_p8p2_b2_b, gradleg_quad_p8p3_b2_b, gradleg_quad_p8p4_b2_b, gradleg_quad_p8p5_b2_b, gradleg_quad_p8p6_b2_b, gradleg_quad_p8p7_b2_b, gradleg_quad_p8p8_b2_b, gradleg_quad_p8p9_b2_b, gradleg_quad_p8p10_b2_b, gradleg_quad_p9p0_b2_b, gradleg_quad_p9p1_b2_b, gradleg_quad_p9p2_b2_b, gradleg_quad_p9p3_b2_b, gradleg_quad_p9p4_b2_b, gradleg_quad_p9p5_b2_b, gradleg_quad_p9p6_b2_b, gradleg_quad_p9p7_b2_b, gradleg_quad_p9p8_b2_b, gradleg_quad_p9p9_b2_b, gradleg_quad_p9p10_b2_b, gradleg_quad_p10p0_b2_b, gradleg_quad_p10p1_b2_b, gradleg_quad_p10p2_b2_b, gradleg_quad_p10p3_b2_b, gradleg_quad_p10p4_b2_b, gradleg_quad_p10p5_b2_b, gradleg_quad_p10p6_b2_b, gradleg_quad_p10p7_b2_b, gradleg_quad_p10p8_b2_b, gradleg_quad_p10p9_b2_b, gradleg_quad_p10p10_b2_b, gradleg_quad_p11p0_b2_b, gradleg_quad_p11p1_b2_b, gradleg_quad_p11p2_b2_b, gradleg_quad_p11p3_b2_b, gradleg_quad_p11p4_b2_b, gradleg_quad_p11p5_b2_b, gradleg_quad_p11p6_b2_b, gradleg_quad_p11p7_b2_b, gradleg_quad_p11p8_b2_b, gradleg_quad_p11p9_b2_b, gradleg_quad_p11p10_b2_b, }; + gradleg_quad_p0p2_b1_b, gradleg_quad_p0p3_b1_b, gradleg_quad_p0p4_b1_b, gradleg_quad_p0p5_b1_b, gradleg_quad_p0p6_b1_b, gradleg_quad_p0p7_b1_b, gradleg_quad_p0p8_b1_b, gradleg_quad_p0p9_b1_b, gradleg_quad_p0p10_b1_b, gradleg_quad_p0p11_b1_b, gradleg_quad_p1p2_b1_b, gradleg_quad_p1p3_b1_b, gradleg_quad_p1p4_b1_b, gradleg_quad_p1p5_b1_b, gradleg_quad_p1p6_b1_b, gradleg_quad_p1p7_b1_b, gradleg_quad_p1p8_b1_b, gradleg_quad_p1p9_b1_b, gradleg_quad_p1p10_b1_b, gradleg_quad_p1p11_b1_b, gradleg_quad_p2p2_b1_b, gradleg_quad_p2p3_b1_b, gradleg_quad_p2p4_b1_b, gradleg_quad_p2p5_b1_b, gradleg_quad_p2p6_b1_b, gradleg_quad_p2p7_b1_b, gradleg_quad_p2p8_b1_b, gradleg_quad_p2p9_b1_b, gradleg_quad_p2p10_b1_b, gradleg_quad_p2p11_b1_b, gradleg_quad_p3p2_b1_b, gradleg_quad_p3p3_b1_b, gradleg_quad_p3p4_b1_b, gradleg_quad_p3p5_b1_b, gradleg_quad_p3p6_b1_b, gradleg_quad_p3p7_b1_b, gradleg_quad_p3p8_b1_b, gradleg_quad_p3p9_b1_b, gradleg_quad_p3p10_b1_b, gradleg_quad_p3p11_b1_b, gradleg_quad_p4p2_b1_b, gradleg_quad_p4p3_b1_b, gradleg_quad_p4p4_b1_b, gradleg_quad_p4p5_b1_b, gradleg_quad_p4p6_b1_b, gradleg_quad_p4p7_b1_b, gradleg_quad_p4p8_b1_b, gradleg_quad_p4p9_b1_b, gradleg_quad_p4p10_b1_b, gradleg_quad_p4p11_b1_b, gradleg_quad_p5p2_b1_b, gradleg_quad_p5p3_b1_b, gradleg_quad_p5p4_b1_b, gradleg_quad_p5p5_b1_b, gradleg_quad_p5p6_b1_b, gradleg_quad_p5p7_b1_b, gradleg_quad_p5p8_b1_b, gradleg_quad_p5p9_b1_b, gradleg_quad_p5p10_b1_b, gradleg_quad_p5p11_b1_b, gradleg_quad_p6p2_b1_b, gradleg_quad_p6p3_b1_b, gradleg_quad_p6p4_b1_b, gradleg_quad_p6p5_b1_b, gradleg_quad_p6p6_b1_b, gradleg_quad_p6p7_b1_b, gradleg_quad_p6p8_b1_b, gradleg_quad_p6p9_b1_b, gradleg_quad_p6p10_b1_b, gradleg_quad_p6p11_b1_b, gradleg_quad_p7p2_b1_b, gradleg_quad_p7p3_b1_b, gradleg_quad_p7p4_b1_b, gradleg_quad_p7p5_b1_b, gradleg_quad_p7p6_b1_b, gradleg_quad_p7p7_b1_b, gradleg_quad_p7p8_b1_b, gradleg_quad_p7p9_b1_b, gradleg_quad_p7p10_b1_b, gradleg_quad_p7p11_b1_b, gradleg_quad_p8p2_b1_b, gradleg_quad_p8p3_b1_b, gradleg_quad_p8p4_b1_b, gradleg_quad_p8p5_b1_b, gradleg_quad_p8p6_b1_b, gradleg_quad_p8p7_b1_b, gradleg_quad_p8p8_b1_b, gradleg_quad_p8p9_b1_b, gradleg_quad_p8p10_b1_b, gradleg_quad_p8p11_b1_b, gradleg_quad_p9p2_b1_b, gradleg_quad_p9p3_b1_b, gradleg_quad_p9p4_b1_b, gradleg_quad_p9p5_b1_b, gradleg_quad_p9p6_b1_b, gradleg_quad_p9p7_b1_b, gradleg_quad_p9p8_b1_b, gradleg_quad_p9p9_b1_b, gradleg_quad_p9p10_b1_b, gradleg_quad_p9p11_b1_b, gradleg_quad_p10p2_b1_b, gradleg_quad_p10p3_b1_b, gradleg_quad_p10p4_b1_b, gradleg_quad_p10p5_b1_b, gradleg_quad_p10p6_b1_b, gradleg_quad_p10p7_b1_b, gradleg_quad_p10p8_b1_b, gradleg_quad_p10p9_b1_b, gradleg_quad_p10p10_b1_b, gradleg_quad_p10p11_b1_b, gradleg_quad_p2p0_b2_b, gradleg_quad_p2p1_b2_b, gradleg_quad_p2p2_b2_b, gradleg_quad_p2p3_b2_b, gradleg_quad_p2p4_b2_b, gradleg_quad_p2p5_b2_b, gradleg_quad_p2p6_b2_b, gradleg_quad_p2p7_b2_b, gradleg_quad_p2p8_b2_b, gradleg_quad_p2p9_b2_b, gradleg_quad_p2p10_b2_b, gradleg_quad_p3p0_b2_b, gradleg_quad_p3p1_b2_b, gradleg_quad_p3p2_b2_b, gradleg_quad_p3p3_b2_b, gradleg_quad_p3p4_b2_b, gradleg_quad_p3p5_b2_b, gradleg_quad_p3p6_b2_b, gradleg_quad_p3p7_b2_b, gradleg_quad_p3p8_b2_b, gradleg_quad_p3p9_b2_b, gradleg_quad_p3p10_b2_b, gradleg_quad_p4p0_b2_b, gradleg_quad_p4p1_b2_b, gradleg_quad_p4p2_b2_b, gradleg_quad_p4p3_b2_b, gradleg_quad_p4p4_b2_b, gradleg_quad_p4p5_b2_b, gradleg_quad_p4p6_b2_b, gradleg_quad_p4p7_b2_b, gradleg_quad_p4p8_b2_b, gradleg_quad_p4p9_b2_b, gradleg_quad_p4p10_b2_b, gradleg_quad_p5p0_b2_b, gradleg_quad_p5p1_b2_b, gradleg_quad_p5p2_b2_b, gradleg_quad_p5p3_b2_b, gradleg_quad_p5p4_b2_b, gradleg_quad_p5p5_b2_b, gradleg_quad_p5p6_b2_b, gradleg_quad_p5p7_b2_b, gradleg_quad_p5p8_b2_b, gradleg_quad_p5p9_b2_b, gradleg_quad_p5p10_b2_b, gradleg_quad_p6p0_b2_b, gradleg_quad_p6p1_b2_b, gradleg_quad_p6p2_b2_b, gradleg_quad_p6p3_b2_b, gradleg_quad_p6p4_b2_b, gradleg_quad_p6p5_b2_b, gradleg_quad_p6p6_b2_b, gradleg_quad_p6p7_b2_b, gradleg_quad_p6p8_b2_b, gradleg_quad_p6p9_b2_b, gradleg_quad_p6p10_b2_b, gradleg_quad_p7p0_b2_b, gradleg_quad_p7p1_b2_b, gradleg_quad_p7p2_b2_b, gradleg_quad_p7p3_b2_b, gradleg_quad_p7p4_b2_b, gradleg_quad_p7p5_b2_b, gradleg_quad_p7p6_b2_b, gradleg_quad_p7p7_b2_b, gradleg_quad_p7p8_b2_b, gradleg_quad_p7p9_b2_b, gradleg_quad_p7p10_b2_b, gradleg_quad_p8p0_b2_b, gradleg_quad_p8p1_b2_b, gradleg_quad_p8p2_b2_b, gradleg_quad_p8p3_b2_b, gradleg_quad_p8p4_b2_b, gradleg_quad_p8p5_b2_b, gradleg_quad_p8p6_b2_b, gradleg_quad_p8p7_b2_b, gradleg_quad_p8p8_b2_b, gradleg_quad_p8p9_b2_b, gradleg_quad_p8p10_b2_b, gradleg_quad_p9p0_b2_b, gradleg_quad_p9p1_b2_b, gradleg_quad_p9p2_b2_b, gradleg_quad_p9p3_b2_b, gradleg_quad_p9p4_b2_b, gradleg_quad_p9p5_b2_b, gradleg_quad_p9p6_b2_b, gradleg_quad_p9p7_b2_b, gradleg_quad_p9p8_b2_b, gradleg_quad_p9p9_b2_b, gradleg_quad_p9p10_b2_b, gradleg_quad_p10p0_b2_b, gradleg_quad_p10p1_b2_b, gradleg_quad_p10p2_b2_b, gradleg_quad_p10p3_b2_b, gradleg_quad_p10p4_b2_b, gradleg_quad_p10p5_b2_b, gradleg_quad_p10p6_b2_b, gradleg_quad_p10p7_b2_b, gradleg_quad_p10p8_b2_b, gradleg_quad_p10p9_b2_b, gradleg_quad_p10p10_b2_b, gradleg_quad_p11p0_b2_b, gradleg_quad_p11p1_b2_b, gradleg_quad_p11p2_b2_b, gradleg_quad_p11p3_b2_b, gradleg_quad_p11p4_b2_b, gradleg_quad_p11p5_b2_b, gradleg_quad_p11p6_b2_b, gradleg_quad_p11p7_b2_b, gradleg_quad_p11p8_b2_b, gradleg_quad_p11p9_b2_b, gradleg_quad_p11p10_b2_b, }; static Shapeset::shape_fn_t gradleg_quad_fn_ax[] = { gradleg_quad_p0_e1_ax_0, gradleg_quad_p0_e1_ax_1, gradleg_quad_p0_e2_ax, gradleg_quad_p0_e2_ax, gradleg_quad_p0_e3_ax_0, gradleg_quad_p0_e3_ax_1, gradleg_quad_p0_e4_ax, gradleg_quad_p0_e4_ax, gradleg_quad_l2_l0_ax, gradleg_quad_l2_l0_ax, gradleg_quad_l1_l2_ax, gradleg_quad_l1_l2_ax, gradleg_quad_l2_l1_ax, gradleg_quad_l2_l1_ax, gradleg_quad_l0_l2_ax, gradleg_quad_l0_l2_ax, - gradleg_quad_l3_l0_ax_0, gradleg_quad_l3_l0_ax_1, gradleg_quad_l1_l3_ax_0, gradleg_quad_l1_l3_ax_1, gradleg_quad_l3_l1_ax_0, gradleg_quad_l3_l1_ax_1, gradleg_quad_l0_l3_ax_0, gradleg_quad_l0_l3_ax_1, + gradleg_quad_l3_l0_ax_0, gradleg_quad_l3_l0_ax_1, gradleg_quad_l1_l3_ax_0, gradleg_quad_l1_l3_ax_1, gradleg_quad_l3_l1_ax_0, gradleg_quad_l3_l1_ax_1, gradleg_quad_l0_l3_ax_0, gradleg_quad_l0_l3_ax_1, gradleg_quad_l4_l0_ax, gradleg_quad_l4_l0_ax, gradleg_quad_l1_l4_ax, gradleg_quad_l1_l4_ax, gradleg_quad_l4_l1_ax, gradleg_quad_l4_l1_ax, gradleg_quad_l0_l4_ax, gradleg_quad_l0_l4_ax, - gradleg_quad_l5_l0_ax_0, gradleg_quad_l5_l0_ax_1, gradleg_quad_l1_l5_ax_0, gradleg_quad_l1_l5_ax_1, gradleg_quad_l5_l1_ax_0, gradleg_quad_l5_l1_ax_1, gradleg_quad_l0_l5_ax_0, gradleg_quad_l0_l5_ax_1, + gradleg_quad_l5_l0_ax_0, gradleg_quad_l5_l0_ax_1, gradleg_quad_l1_l5_ax_0, gradleg_quad_l1_l5_ax_1, gradleg_quad_l5_l1_ax_0, gradleg_quad_l5_l1_ax_1, gradleg_quad_l0_l5_ax_0, gradleg_quad_l0_l5_ax_1, gradleg_quad_l6_l0_ax, gradleg_quad_l6_l0_ax, gradleg_quad_l1_l6_ax, gradleg_quad_l1_l6_ax, gradleg_quad_l6_l1_ax, gradleg_quad_l6_l1_ax, gradleg_quad_l0_l6_ax, gradleg_quad_l0_l6_ax, - gradleg_quad_l7_l0_ax_0, gradleg_quad_l7_l0_ax_1, gradleg_quad_l1_l7_ax_0, gradleg_quad_l1_l7_ax_1, gradleg_quad_l7_l1_ax_0, gradleg_quad_l7_l1_ax_1, gradleg_quad_l0_l7_ax_0, gradleg_quad_l0_l7_ax_1, + gradleg_quad_l7_l0_ax_0, gradleg_quad_l7_l0_ax_1, gradleg_quad_l1_l7_ax_0, gradleg_quad_l1_l7_ax_1, gradleg_quad_l7_l1_ax_0, gradleg_quad_l7_l1_ax_1, gradleg_quad_l0_l7_ax_0, gradleg_quad_l0_l7_ax_1, gradleg_quad_l8_l0_ax, gradleg_quad_l8_l0_ax, gradleg_quad_l1_l8_ax, gradleg_quad_l1_l8_ax, gradleg_quad_l8_l1_ax, gradleg_quad_l8_l1_ax, gradleg_quad_l0_l8_ax, gradleg_quad_l0_l8_ax, - gradleg_quad_l9_l0_ax_0, gradleg_quad_l9_l0_ax_1, gradleg_quad_l1_l9_ax_0, gradleg_quad_l1_l9_ax_1, gradleg_quad_l9_l1_ax_0, gradleg_quad_l9_l1_ax_1, gradleg_quad_l0_l9_ax_0, gradleg_quad_l0_l9_ax_1, + gradleg_quad_l9_l0_ax_0, gradleg_quad_l9_l0_ax_1, gradleg_quad_l1_l9_ax_0, gradleg_quad_l1_l9_ax_1, gradleg_quad_l9_l1_ax_0, gradleg_quad_l9_l1_ax_1, gradleg_quad_l0_l9_ax_0, gradleg_quad_l0_l9_ax_1, gradleg_quad_l10_l0_ax, gradleg_quad_l10_l0_ax, gradleg_quad_l1_l10_ax, gradleg_quad_l1_l10_ax, gradleg_quad_l10_l1_ax, gradleg_quad_l10_l1_ax, gradleg_quad_l0_l10_ax, gradleg_quad_l0_l10_ax, - gradleg_quad_l11_l0_ax_0, gradleg_quad_l11_l0_ax_1, gradleg_quad_l1_l11_ax_0, gradleg_quad_l1_l11_ax_1, gradleg_quad_l11_l1_ax_0, gradleg_quad_l11_l1_ax_1, gradleg_quad_l0_l11_ax_0, gradleg_quad_l0_l11_ax_1, + gradleg_quad_l11_l0_ax_0, gradleg_quad_l11_l0_ax_1, gradleg_quad_l1_l11_ax_0, gradleg_quad_l1_l11_ax_1, gradleg_quad_l11_l1_ax_0, gradleg_quad_l11_l1_ax_1, gradleg_quad_l0_l11_ax_0, gradleg_quad_l0_l11_ax_1, - gradleg_quad_p0p2_b1_ax, gradleg_quad_p0p3_b1_ax, gradleg_quad_p0p4_b1_ax, gradleg_quad_p0p5_b1_ax, gradleg_quad_p0p6_b1_ax, gradleg_quad_p0p7_b1_ax, gradleg_quad_p0p8_b1_ax, gradleg_quad_p0p9_b1_ax, gradleg_quad_p0p10_b1_ax, gradleg_quad_p0p11_b1_ax, gradleg_quad_p1p2_b1_ax, gradleg_quad_p1p3_b1_ax, gradleg_quad_p1p4_b1_ax, gradleg_quad_p1p5_b1_ax, gradleg_quad_p1p6_b1_ax, gradleg_quad_p1p7_b1_ax, gradleg_quad_p1p8_b1_ax, gradleg_quad_p1p9_b1_ax, gradleg_quad_p1p10_b1_ax, gradleg_quad_p1p11_b1_ax, gradleg_quad_p2p2_b1_ax, gradleg_quad_p2p3_b1_ax, gradleg_quad_p2p4_b1_ax, gradleg_quad_p2p5_b1_ax, gradleg_quad_p2p6_b1_ax, gradleg_quad_p2p7_b1_ax, gradleg_quad_p2p8_b1_ax, gradleg_quad_p2p9_b1_ax, gradleg_quad_p2p10_b1_ax, gradleg_quad_p2p11_b1_ax, gradleg_quad_p3p2_b1_ax, gradleg_quad_p3p3_b1_ax, gradleg_quad_p3p4_b1_ax, gradleg_quad_p3p5_b1_ax, gradleg_quad_p3p6_b1_ax, gradleg_quad_p3p7_b1_ax, gradleg_quad_p3p8_b1_ax, gradleg_quad_p3p9_b1_ax, gradleg_quad_p3p10_b1_ax, gradleg_quad_p3p11_b1_ax, gradleg_quad_p4p2_b1_ax, gradleg_quad_p4p3_b1_ax, gradleg_quad_p4p4_b1_ax, gradleg_quad_p4p5_b1_ax, gradleg_quad_p4p6_b1_ax, gradleg_quad_p4p7_b1_ax, gradleg_quad_p4p8_b1_ax, gradleg_quad_p4p9_b1_ax, gradleg_quad_p4p10_b1_ax, gradleg_quad_p4p11_b1_ax, gradleg_quad_p5p2_b1_ax, gradleg_quad_p5p3_b1_ax, gradleg_quad_p5p4_b1_ax, gradleg_quad_p5p5_b1_ax, gradleg_quad_p5p6_b1_ax, gradleg_quad_p5p7_b1_ax, gradleg_quad_p5p8_b1_ax, gradleg_quad_p5p9_b1_ax, gradleg_quad_p5p10_b1_ax, gradleg_quad_p5p11_b1_ax, gradleg_quad_p6p2_b1_ax, gradleg_quad_p6p3_b1_ax, gradleg_quad_p6p4_b1_ax, gradleg_quad_p6p5_b1_ax, gradleg_quad_p6p6_b1_ax, gradleg_quad_p6p7_b1_ax, gradleg_quad_p6p8_b1_ax, gradleg_quad_p6p9_b1_ax, gradleg_quad_p6p10_b1_ax, gradleg_quad_p6p11_b1_ax, gradleg_quad_p7p2_b1_ax, gradleg_quad_p7p3_b1_ax, gradleg_quad_p7p4_b1_ax, gradleg_quad_p7p5_b1_ax, gradleg_quad_p7p6_b1_ax, gradleg_quad_p7p7_b1_ax, gradleg_quad_p7p8_b1_ax, gradleg_quad_p7p9_b1_ax, gradleg_quad_p7p10_b1_ax, gradleg_quad_p7p11_b1_ax, gradleg_quad_p8p2_b1_ax, gradleg_quad_p8p3_b1_ax, gradleg_quad_p8p4_b1_ax, gradleg_quad_p8p5_b1_ax, gradleg_quad_p8p6_b1_ax, gradleg_quad_p8p7_b1_ax, gradleg_quad_p8p8_b1_ax, gradleg_quad_p8p9_b1_ax, gradleg_quad_p8p10_b1_ax, gradleg_quad_p8p11_b1_ax, gradleg_quad_p9p2_b1_ax, gradleg_quad_p9p3_b1_ax, gradleg_quad_p9p4_b1_ax, gradleg_quad_p9p5_b1_ax, gradleg_quad_p9p6_b1_ax, gradleg_quad_p9p7_b1_ax, gradleg_quad_p9p8_b1_ax, gradleg_quad_p9p9_b1_ax, gradleg_quad_p9p10_b1_ax, gradleg_quad_p9p11_b1_ax, gradleg_quad_p10p2_b1_ax, gradleg_quad_p10p3_b1_ax, gradleg_quad_p10p4_b1_ax, gradleg_quad_p10p5_b1_ax, gradleg_quad_p10p6_b1_ax, gradleg_quad_p10p7_b1_ax, gradleg_quad_p10p8_b1_ax, gradleg_quad_p10p9_b1_ax, gradleg_quad_p10p10_b1_ax, gradleg_quad_p10p11_b1_ax, gradleg_quad_p2p0_b2_ax, gradleg_quad_p2p1_b2_ax, gradleg_quad_p2p2_b2_ax, gradleg_quad_p2p3_b2_ax, gradleg_quad_p2p4_b2_ax, gradleg_quad_p2p5_b2_ax, gradleg_quad_p2p6_b2_ax, gradleg_quad_p2p7_b2_ax, gradleg_quad_p2p8_b2_ax, gradleg_quad_p2p9_b2_ax, gradleg_quad_p2p10_b2_ax, gradleg_quad_p3p0_b2_ax, gradleg_quad_p3p1_b2_ax, gradleg_quad_p3p2_b2_ax, gradleg_quad_p3p3_b2_ax, gradleg_quad_p3p4_b2_ax, gradleg_quad_p3p5_b2_ax, gradleg_quad_p3p6_b2_ax, gradleg_quad_p3p7_b2_ax, gradleg_quad_p3p8_b2_ax, gradleg_quad_p3p9_b2_ax, gradleg_quad_p3p10_b2_ax, gradleg_quad_p4p0_b2_ax, gradleg_quad_p4p1_b2_ax, gradleg_quad_p4p2_b2_ax, gradleg_quad_p4p3_b2_ax, gradleg_quad_p4p4_b2_ax, gradleg_quad_p4p5_b2_ax, gradleg_quad_p4p6_b2_ax, gradleg_quad_p4p7_b2_ax, gradleg_quad_p4p8_b2_ax, gradleg_quad_p4p9_b2_ax, gradleg_quad_p4p10_b2_ax, gradleg_quad_p5p0_b2_ax, gradleg_quad_p5p1_b2_ax, gradleg_quad_p5p2_b2_ax, gradleg_quad_p5p3_b2_ax, gradleg_quad_p5p4_b2_ax, gradleg_quad_p5p5_b2_ax, gradleg_quad_p5p6_b2_ax, gradleg_quad_p5p7_b2_ax, gradleg_quad_p5p8_b2_ax, gradleg_quad_p5p9_b2_ax, gradleg_quad_p5p10_b2_ax, gradleg_quad_p6p0_b2_ax, gradleg_quad_p6p1_b2_ax, gradleg_quad_p6p2_b2_ax, gradleg_quad_p6p3_b2_ax, gradleg_quad_p6p4_b2_ax, gradleg_quad_p6p5_b2_ax, gradleg_quad_p6p6_b2_ax, gradleg_quad_p6p7_b2_ax, gradleg_quad_p6p8_b2_ax, gradleg_quad_p6p9_b2_ax, gradleg_quad_p6p10_b2_ax, gradleg_quad_p7p0_b2_ax, gradleg_quad_p7p1_b2_ax, gradleg_quad_p7p2_b2_ax, gradleg_quad_p7p3_b2_ax, gradleg_quad_p7p4_b2_ax, gradleg_quad_p7p5_b2_ax, gradleg_quad_p7p6_b2_ax, gradleg_quad_p7p7_b2_ax, gradleg_quad_p7p8_b2_ax, gradleg_quad_p7p9_b2_ax, gradleg_quad_p7p10_b2_ax, gradleg_quad_p8p0_b2_ax, gradleg_quad_p8p1_b2_ax, gradleg_quad_p8p2_b2_ax, gradleg_quad_p8p3_b2_ax, gradleg_quad_p8p4_b2_ax, gradleg_quad_p8p5_b2_ax, gradleg_quad_p8p6_b2_ax, gradleg_quad_p8p7_b2_ax, gradleg_quad_p8p8_b2_ax, gradleg_quad_p8p9_b2_ax, gradleg_quad_p8p10_b2_ax, gradleg_quad_p9p0_b2_ax, gradleg_quad_p9p1_b2_ax, gradleg_quad_p9p2_b2_ax, gradleg_quad_p9p3_b2_ax, gradleg_quad_p9p4_b2_ax, gradleg_quad_p9p5_b2_ax, gradleg_quad_p9p6_b2_ax, gradleg_quad_p9p7_b2_ax, gradleg_quad_p9p8_b2_ax, gradleg_quad_p9p9_b2_ax, gradleg_quad_p9p10_b2_ax, gradleg_quad_p10p0_b2_ax, gradleg_quad_p10p1_b2_ax, gradleg_quad_p10p2_b2_ax, gradleg_quad_p10p3_b2_ax, gradleg_quad_p10p4_b2_ax, gradleg_quad_p10p5_b2_ax, gradleg_quad_p10p6_b2_ax, gradleg_quad_p10p7_b2_ax, gradleg_quad_p10p8_b2_ax, gradleg_quad_p10p9_b2_ax, gradleg_quad_p10p10_b2_ax, gradleg_quad_p11p0_b2_ax, gradleg_quad_p11p1_b2_ax, gradleg_quad_p11p2_b2_ax, gradleg_quad_p11p3_b2_ax, gradleg_quad_p11p4_b2_ax, gradleg_quad_p11p5_b2_ax, gradleg_quad_p11p6_b2_ax, gradleg_quad_p11p7_b2_ax, gradleg_quad_p11p8_b2_ax, gradleg_quad_p11p9_b2_ax, gradleg_quad_p11p10_b2_ax, }; + gradleg_quad_p0p2_b1_ax, gradleg_quad_p0p3_b1_ax, gradleg_quad_p0p4_b1_ax, gradleg_quad_p0p5_b1_ax, gradleg_quad_p0p6_b1_ax, gradleg_quad_p0p7_b1_ax, gradleg_quad_p0p8_b1_ax, gradleg_quad_p0p9_b1_ax, gradleg_quad_p0p10_b1_ax, gradleg_quad_p0p11_b1_ax, gradleg_quad_p1p2_b1_ax, gradleg_quad_p1p3_b1_ax, gradleg_quad_p1p4_b1_ax, gradleg_quad_p1p5_b1_ax, gradleg_quad_p1p6_b1_ax, gradleg_quad_p1p7_b1_ax, gradleg_quad_p1p8_b1_ax, gradleg_quad_p1p9_b1_ax, gradleg_quad_p1p10_b1_ax, gradleg_quad_p1p11_b1_ax, gradleg_quad_p2p2_b1_ax, gradleg_quad_p2p3_b1_ax, gradleg_quad_p2p4_b1_ax, gradleg_quad_p2p5_b1_ax, gradleg_quad_p2p6_b1_ax, gradleg_quad_p2p7_b1_ax, gradleg_quad_p2p8_b1_ax, gradleg_quad_p2p9_b1_ax, gradleg_quad_p2p10_b1_ax, gradleg_quad_p2p11_b1_ax, gradleg_quad_p3p2_b1_ax, gradleg_quad_p3p3_b1_ax, gradleg_quad_p3p4_b1_ax, gradleg_quad_p3p5_b1_ax, gradleg_quad_p3p6_b1_ax, gradleg_quad_p3p7_b1_ax, gradleg_quad_p3p8_b1_ax, gradleg_quad_p3p9_b1_ax, gradleg_quad_p3p10_b1_ax, gradleg_quad_p3p11_b1_ax, gradleg_quad_p4p2_b1_ax, gradleg_quad_p4p3_b1_ax, gradleg_quad_p4p4_b1_ax, gradleg_quad_p4p5_b1_ax, gradleg_quad_p4p6_b1_ax, gradleg_quad_p4p7_b1_ax, gradleg_quad_p4p8_b1_ax, gradleg_quad_p4p9_b1_ax, gradleg_quad_p4p10_b1_ax, gradleg_quad_p4p11_b1_ax, gradleg_quad_p5p2_b1_ax, gradleg_quad_p5p3_b1_ax, gradleg_quad_p5p4_b1_ax, gradleg_quad_p5p5_b1_ax, gradleg_quad_p5p6_b1_ax, gradleg_quad_p5p7_b1_ax, gradleg_quad_p5p8_b1_ax, gradleg_quad_p5p9_b1_ax, gradleg_quad_p5p10_b1_ax, gradleg_quad_p5p11_b1_ax, gradleg_quad_p6p2_b1_ax, gradleg_quad_p6p3_b1_ax, gradleg_quad_p6p4_b1_ax, gradleg_quad_p6p5_b1_ax, gradleg_quad_p6p6_b1_ax, gradleg_quad_p6p7_b1_ax, gradleg_quad_p6p8_b1_ax, gradleg_quad_p6p9_b1_ax, gradleg_quad_p6p10_b1_ax, gradleg_quad_p6p11_b1_ax, gradleg_quad_p7p2_b1_ax, gradleg_quad_p7p3_b1_ax, gradleg_quad_p7p4_b1_ax, gradleg_quad_p7p5_b1_ax, gradleg_quad_p7p6_b1_ax, gradleg_quad_p7p7_b1_ax, gradleg_quad_p7p8_b1_ax, gradleg_quad_p7p9_b1_ax, gradleg_quad_p7p10_b1_ax, gradleg_quad_p7p11_b1_ax, gradleg_quad_p8p2_b1_ax, gradleg_quad_p8p3_b1_ax, gradleg_quad_p8p4_b1_ax, gradleg_quad_p8p5_b1_ax, gradleg_quad_p8p6_b1_ax, gradleg_quad_p8p7_b1_ax, gradleg_quad_p8p8_b1_ax, gradleg_quad_p8p9_b1_ax, gradleg_quad_p8p10_b1_ax, gradleg_quad_p8p11_b1_ax, gradleg_quad_p9p2_b1_ax, gradleg_quad_p9p3_b1_ax, gradleg_quad_p9p4_b1_ax, gradleg_quad_p9p5_b1_ax, gradleg_quad_p9p6_b1_ax, gradleg_quad_p9p7_b1_ax, gradleg_quad_p9p8_b1_ax, gradleg_quad_p9p9_b1_ax, gradleg_quad_p9p10_b1_ax, gradleg_quad_p9p11_b1_ax, gradleg_quad_p10p2_b1_ax, gradleg_quad_p10p3_b1_ax, gradleg_quad_p10p4_b1_ax, gradleg_quad_p10p5_b1_ax, gradleg_quad_p10p6_b1_ax, gradleg_quad_p10p7_b1_ax, gradleg_quad_p10p8_b1_ax, gradleg_quad_p10p9_b1_ax, gradleg_quad_p10p10_b1_ax, gradleg_quad_p10p11_b1_ax, gradleg_quad_p2p0_b2_ax, gradleg_quad_p2p1_b2_ax, gradleg_quad_p2p2_b2_ax, gradleg_quad_p2p3_b2_ax, gradleg_quad_p2p4_b2_ax, gradleg_quad_p2p5_b2_ax, gradleg_quad_p2p6_b2_ax, gradleg_quad_p2p7_b2_ax, gradleg_quad_p2p8_b2_ax, gradleg_quad_p2p9_b2_ax, gradleg_quad_p2p10_b2_ax, gradleg_quad_p3p0_b2_ax, gradleg_quad_p3p1_b2_ax, gradleg_quad_p3p2_b2_ax, gradleg_quad_p3p3_b2_ax, gradleg_quad_p3p4_b2_ax, gradleg_quad_p3p5_b2_ax, gradleg_quad_p3p6_b2_ax, gradleg_quad_p3p7_b2_ax, gradleg_quad_p3p8_b2_ax, gradleg_quad_p3p9_b2_ax, gradleg_quad_p3p10_b2_ax, gradleg_quad_p4p0_b2_ax, gradleg_quad_p4p1_b2_ax, gradleg_quad_p4p2_b2_ax, gradleg_quad_p4p3_b2_ax, gradleg_quad_p4p4_b2_ax, gradleg_quad_p4p5_b2_ax, gradleg_quad_p4p6_b2_ax, gradleg_quad_p4p7_b2_ax, gradleg_quad_p4p8_b2_ax, gradleg_quad_p4p9_b2_ax, gradleg_quad_p4p10_b2_ax, gradleg_quad_p5p0_b2_ax, gradleg_quad_p5p1_b2_ax, gradleg_quad_p5p2_b2_ax, gradleg_quad_p5p3_b2_ax, gradleg_quad_p5p4_b2_ax, gradleg_quad_p5p5_b2_ax, gradleg_quad_p5p6_b2_ax, gradleg_quad_p5p7_b2_ax, gradleg_quad_p5p8_b2_ax, gradleg_quad_p5p9_b2_ax, gradleg_quad_p5p10_b2_ax, gradleg_quad_p6p0_b2_ax, gradleg_quad_p6p1_b2_ax, gradleg_quad_p6p2_b2_ax, gradleg_quad_p6p3_b2_ax, gradleg_quad_p6p4_b2_ax, gradleg_quad_p6p5_b2_ax, gradleg_quad_p6p6_b2_ax, gradleg_quad_p6p7_b2_ax, gradleg_quad_p6p8_b2_ax, gradleg_quad_p6p9_b2_ax, gradleg_quad_p6p10_b2_ax, gradleg_quad_p7p0_b2_ax, gradleg_quad_p7p1_b2_ax, gradleg_quad_p7p2_b2_ax, gradleg_quad_p7p3_b2_ax, gradleg_quad_p7p4_b2_ax, gradleg_quad_p7p5_b2_ax, gradleg_quad_p7p6_b2_ax, gradleg_quad_p7p7_b2_ax, gradleg_quad_p7p8_b2_ax, gradleg_quad_p7p9_b2_ax, gradleg_quad_p7p10_b2_ax, gradleg_quad_p8p0_b2_ax, gradleg_quad_p8p1_b2_ax, gradleg_quad_p8p2_b2_ax, gradleg_quad_p8p3_b2_ax, gradleg_quad_p8p4_b2_ax, gradleg_quad_p8p5_b2_ax, gradleg_quad_p8p6_b2_ax, gradleg_quad_p8p7_b2_ax, gradleg_quad_p8p8_b2_ax, gradleg_quad_p8p9_b2_ax, gradleg_quad_p8p10_b2_ax, gradleg_quad_p9p0_b2_ax, gradleg_quad_p9p1_b2_ax, gradleg_quad_p9p2_b2_ax, gradleg_quad_p9p3_b2_ax, gradleg_quad_p9p4_b2_ax, gradleg_quad_p9p5_b2_ax, gradleg_quad_p9p6_b2_ax, gradleg_quad_p9p7_b2_ax, gradleg_quad_p9p8_b2_ax, gradleg_quad_p9p9_b2_ax, gradleg_quad_p9p10_b2_ax, gradleg_quad_p10p0_b2_ax, gradleg_quad_p10p1_b2_ax, gradleg_quad_p10p2_b2_ax, gradleg_quad_p10p3_b2_ax, gradleg_quad_p10p4_b2_ax, gradleg_quad_p10p5_b2_ax, gradleg_quad_p10p6_b2_ax, gradleg_quad_p10p7_b2_ax, gradleg_quad_p10p8_b2_ax, gradleg_quad_p10p9_b2_ax, gradleg_quad_p10p10_b2_ax, gradleg_quad_p11p0_b2_ax, gradleg_quad_p11p1_b2_ax, gradleg_quad_p11p2_b2_ax, gradleg_quad_p11p3_b2_ax, gradleg_quad_p11p4_b2_ax, gradleg_quad_p11p5_b2_ax, gradleg_quad_p11p6_b2_ax, gradleg_quad_p11p7_b2_ax, gradleg_quad_p11p8_b2_ax, gradleg_quad_p11p9_b2_ax, gradleg_quad_p11p10_b2_ax, }; static Shapeset::shape_fn_t gradleg_quad_fn_bx[] = { - gradleg_quad_p0_e1_bx, gradleg_quad_p0_e1_bx, gradleg_quad_p0_e2_bx_0, gradleg_quad_p0_e2_bx_1, gradleg_quad_p0_e3_bx, gradleg_quad_p0_e3_bx, gradleg_quad_p0_e4_bx_0, gradleg_quad_p0_e4_bx_1, - gradleg_quad_l2_l0_bx, gradleg_quad_l2_l0_bx, gradleg_quad_l1_l2_bx, gradleg_quad_l1_l2_bx, gradleg_quad_l2_l1_bx, gradleg_quad_l2_l1_bx, gradleg_quad_l0_l2_bx, gradleg_quad_l0_l2_bx, + gradleg_quad_p0_e1_bx, gradleg_quad_p0_e1_bx, gradleg_quad_p0_e2_bx_0, gradleg_quad_p0_e2_bx_1, gradleg_quad_p0_e3_bx, gradleg_quad_p0_e3_bx, gradleg_quad_p0_e4_bx_0, gradleg_quad_p0_e4_bx_1, + gradleg_quad_l2_l0_bx, gradleg_quad_l2_l0_bx, gradleg_quad_l1_l2_bx, gradleg_quad_l1_l2_bx, gradleg_quad_l2_l1_bx, gradleg_quad_l2_l1_bx, gradleg_quad_l0_l2_bx, gradleg_quad_l0_l2_bx, gradleg_quad_l3_l0_bx_0, gradleg_quad_l3_l0_bx_1, gradleg_quad_l1_l3_bx_0, gradleg_quad_l1_l3_bx_1, gradleg_quad_l3_l1_bx_0, gradleg_quad_l3_l1_bx_1, gradleg_quad_l0_l3_bx_0, gradleg_quad_l0_l3_bx_1, - gradleg_quad_l4_l0_bx, gradleg_quad_l4_l0_bx, gradleg_quad_l1_l4_bx, gradleg_quad_l1_l4_bx, gradleg_quad_l4_l1_bx, gradleg_quad_l4_l1_bx, gradleg_quad_l0_l4_bx, gradleg_quad_l0_l4_bx, + gradleg_quad_l4_l0_bx, gradleg_quad_l4_l0_bx, gradleg_quad_l1_l4_bx, gradleg_quad_l1_l4_bx, gradleg_quad_l4_l1_bx, gradleg_quad_l4_l1_bx, gradleg_quad_l0_l4_bx, gradleg_quad_l0_l4_bx, gradleg_quad_l5_l0_bx_0, gradleg_quad_l5_l0_bx_1, gradleg_quad_l1_l5_bx_0, gradleg_quad_l1_l5_bx_1, gradleg_quad_l5_l1_bx_0, gradleg_quad_l5_l1_bx_1, gradleg_quad_l0_l5_bx_0, gradleg_quad_l0_l5_bx_1, - gradleg_quad_l6_l0_bx, gradleg_quad_l6_l0_bx, gradleg_quad_l1_l6_bx, gradleg_quad_l1_l6_bx, gradleg_quad_l6_l1_bx, gradleg_quad_l6_l1_bx, gradleg_quad_l0_l6_bx, gradleg_quad_l0_l6_bx, + gradleg_quad_l6_l0_bx, gradleg_quad_l6_l0_bx, gradleg_quad_l1_l6_bx, gradleg_quad_l1_l6_bx, gradleg_quad_l6_l1_bx, gradleg_quad_l6_l1_bx, gradleg_quad_l0_l6_bx, gradleg_quad_l0_l6_bx, gradleg_quad_l7_l0_bx_0, gradleg_quad_l7_l0_bx_1, gradleg_quad_l1_l7_bx_0, gradleg_quad_l1_l7_bx_1, gradleg_quad_l7_l1_bx_0, gradleg_quad_l7_l1_bx_1, gradleg_quad_l0_l7_bx_0, gradleg_quad_l0_l7_bx_1, - gradleg_quad_l8_l0_bx, gradleg_quad_l8_l0_bx, gradleg_quad_l1_l8_bx, gradleg_quad_l1_l8_bx, gradleg_quad_l8_l1_bx, gradleg_quad_l8_l1_bx, gradleg_quad_l0_l8_bx, gradleg_quad_l0_l8_bx, + gradleg_quad_l8_l0_bx, gradleg_quad_l8_l0_bx, gradleg_quad_l1_l8_bx, gradleg_quad_l1_l8_bx, gradleg_quad_l8_l1_bx, gradleg_quad_l8_l1_bx, gradleg_quad_l0_l8_bx, gradleg_quad_l0_l8_bx, gradleg_quad_l9_l0_bx_0, gradleg_quad_l9_l0_bx_1, gradleg_quad_l1_l9_bx_0, gradleg_quad_l1_l9_bx_1, gradleg_quad_l9_l1_bx_0, gradleg_quad_l9_l1_bx_1, gradleg_quad_l0_l9_bx_0, gradleg_quad_l0_l9_bx_1, - gradleg_quad_l10_l0_bx, gradleg_quad_l10_l0_bx, gradleg_quad_l1_l10_bx, gradleg_quad_l1_l10_bx, gradleg_quad_l10_l1_bx, gradleg_quad_l10_l1_bx, gradleg_quad_l0_l10_bx, gradleg_quad_l0_l10_bx, + gradleg_quad_l10_l0_bx, gradleg_quad_l10_l0_bx, gradleg_quad_l1_l10_bx, gradleg_quad_l1_l10_bx, gradleg_quad_l10_l1_bx, gradleg_quad_l10_l1_bx, gradleg_quad_l0_l10_bx, gradleg_quad_l0_l10_bx, gradleg_quad_l11_l0_bx_0, gradleg_quad_l11_l0_bx_1, gradleg_quad_l1_l11_bx_0, gradleg_quad_l1_l11_bx_1, gradleg_quad_l11_l1_bx_0, gradleg_quad_l11_l1_bx_1, gradleg_quad_l0_l11_bx_0, gradleg_quad_l0_l11_bx_1, - gradleg_quad_p0p2_b1_bx, gradleg_quad_p0p3_b1_bx, gradleg_quad_p0p4_b1_bx, gradleg_quad_p0p5_b1_bx, gradleg_quad_p0p6_b1_bx, gradleg_quad_p0p7_b1_bx, gradleg_quad_p0p8_b1_bx, gradleg_quad_p0p9_b1_bx, gradleg_quad_p0p10_b1_bx, gradleg_quad_p0p11_b1_bx, gradleg_quad_p1p2_b1_bx, gradleg_quad_p1p3_b1_bx, gradleg_quad_p1p4_b1_bx, gradleg_quad_p1p5_b1_bx, gradleg_quad_p1p6_b1_bx, gradleg_quad_p1p7_b1_bx, gradleg_quad_p1p8_b1_bx, gradleg_quad_p1p9_b1_bx, gradleg_quad_p1p10_b1_bx, gradleg_quad_p1p11_b1_bx, gradleg_quad_p2p2_b1_bx, gradleg_quad_p2p3_b1_bx, gradleg_quad_p2p4_b1_bx, gradleg_quad_p2p5_b1_bx, gradleg_quad_p2p6_b1_bx, gradleg_quad_p2p7_b1_bx, gradleg_quad_p2p8_b1_bx, gradleg_quad_p2p9_b1_bx, gradleg_quad_p2p10_b1_bx, gradleg_quad_p2p11_b1_bx, gradleg_quad_p3p2_b1_bx, gradleg_quad_p3p3_b1_bx, gradleg_quad_p3p4_b1_bx, gradleg_quad_p3p5_b1_bx, gradleg_quad_p3p6_b1_bx, gradleg_quad_p3p7_b1_bx, gradleg_quad_p3p8_b1_bx, gradleg_quad_p3p9_b1_bx, gradleg_quad_p3p10_b1_bx, gradleg_quad_p3p11_b1_bx, gradleg_quad_p4p2_b1_bx, gradleg_quad_p4p3_b1_bx, gradleg_quad_p4p4_b1_bx, gradleg_quad_p4p5_b1_bx, gradleg_quad_p4p6_b1_bx, gradleg_quad_p4p7_b1_bx, gradleg_quad_p4p8_b1_bx, gradleg_quad_p4p9_b1_bx, gradleg_quad_p4p10_b1_bx, gradleg_quad_p4p11_b1_bx, gradleg_quad_p5p2_b1_bx, gradleg_quad_p5p3_b1_bx, gradleg_quad_p5p4_b1_bx, gradleg_quad_p5p5_b1_bx, gradleg_quad_p5p6_b1_bx, gradleg_quad_p5p7_b1_bx, gradleg_quad_p5p8_b1_bx, gradleg_quad_p5p9_b1_bx, gradleg_quad_p5p10_b1_bx, gradleg_quad_p5p11_b1_bx, gradleg_quad_p6p2_b1_bx, gradleg_quad_p6p3_b1_bx, gradleg_quad_p6p4_b1_bx, gradleg_quad_p6p5_b1_bx, gradleg_quad_p6p6_b1_bx, gradleg_quad_p6p7_b1_bx, gradleg_quad_p6p8_b1_bx, gradleg_quad_p6p9_b1_bx, gradleg_quad_p6p10_b1_bx, gradleg_quad_p6p11_b1_bx, gradleg_quad_p7p2_b1_bx, gradleg_quad_p7p3_b1_bx, gradleg_quad_p7p4_b1_bx, gradleg_quad_p7p5_b1_bx, gradleg_quad_p7p6_b1_bx, gradleg_quad_p7p7_b1_bx, gradleg_quad_p7p8_b1_bx, gradleg_quad_p7p9_b1_bx, gradleg_quad_p7p10_b1_bx, gradleg_quad_p7p11_b1_bx, gradleg_quad_p8p2_b1_bx, gradleg_quad_p8p3_b1_bx, gradleg_quad_p8p4_b1_bx, gradleg_quad_p8p5_b1_bx, gradleg_quad_p8p6_b1_bx, gradleg_quad_p8p7_b1_bx, gradleg_quad_p8p8_b1_bx, gradleg_quad_p8p9_b1_bx, gradleg_quad_p8p10_b1_bx, gradleg_quad_p8p11_b1_bx, gradleg_quad_p9p2_b1_bx, gradleg_quad_p9p3_b1_bx, gradleg_quad_p9p4_b1_bx, gradleg_quad_p9p5_b1_bx, gradleg_quad_p9p6_b1_bx, gradleg_quad_p9p7_b1_bx, gradleg_quad_p9p8_b1_bx, gradleg_quad_p9p9_b1_bx, gradleg_quad_p9p10_b1_bx, gradleg_quad_p9p11_b1_bx, gradleg_quad_p10p2_b1_bx, gradleg_quad_p10p3_b1_bx, gradleg_quad_p10p4_b1_bx, gradleg_quad_p10p5_b1_bx, gradleg_quad_p10p6_b1_bx, gradleg_quad_p10p7_b1_bx, gradleg_quad_p10p8_b1_bx, gradleg_quad_p10p9_b1_bx, gradleg_quad_p10p10_b1_bx, gradleg_quad_p10p11_b1_bx, gradleg_quad_p2p0_b2_bx, gradleg_quad_p2p1_b2_bx, gradleg_quad_p2p2_b2_bx, gradleg_quad_p2p3_b2_bx, gradleg_quad_p2p4_b2_bx, gradleg_quad_p2p5_b2_bx, gradleg_quad_p2p6_b2_bx, gradleg_quad_p2p7_b2_bx, gradleg_quad_p2p8_b2_bx, gradleg_quad_p2p9_b2_bx, gradleg_quad_p2p10_b2_bx, gradleg_quad_p3p0_b2_bx, gradleg_quad_p3p1_b2_bx, gradleg_quad_p3p2_b2_bx, gradleg_quad_p3p3_b2_bx, gradleg_quad_p3p4_b2_bx, gradleg_quad_p3p5_b2_bx, gradleg_quad_p3p6_b2_bx, gradleg_quad_p3p7_b2_bx, gradleg_quad_p3p8_b2_bx, gradleg_quad_p3p9_b2_bx, gradleg_quad_p3p10_b2_bx, gradleg_quad_p4p0_b2_bx, gradleg_quad_p4p1_b2_bx, gradleg_quad_p4p2_b2_bx, gradleg_quad_p4p3_b2_bx, gradleg_quad_p4p4_b2_bx, gradleg_quad_p4p5_b2_bx, gradleg_quad_p4p6_b2_bx, gradleg_quad_p4p7_b2_bx, gradleg_quad_p4p8_b2_bx, gradleg_quad_p4p9_b2_bx, gradleg_quad_p4p10_b2_bx, gradleg_quad_p5p0_b2_bx, gradleg_quad_p5p1_b2_bx, gradleg_quad_p5p2_b2_bx, gradleg_quad_p5p3_b2_bx, gradleg_quad_p5p4_b2_bx, gradleg_quad_p5p5_b2_bx, gradleg_quad_p5p6_b2_bx, gradleg_quad_p5p7_b2_bx, gradleg_quad_p5p8_b2_bx, gradleg_quad_p5p9_b2_bx, gradleg_quad_p5p10_b2_bx, gradleg_quad_p6p0_b2_bx, gradleg_quad_p6p1_b2_bx, gradleg_quad_p6p2_b2_bx, gradleg_quad_p6p3_b2_bx, gradleg_quad_p6p4_b2_bx, gradleg_quad_p6p5_b2_bx, gradleg_quad_p6p6_b2_bx, gradleg_quad_p6p7_b2_bx, gradleg_quad_p6p8_b2_bx, gradleg_quad_p6p9_b2_bx, gradleg_quad_p6p10_b2_bx, gradleg_quad_p7p0_b2_bx, gradleg_quad_p7p1_b2_bx, gradleg_quad_p7p2_b2_bx, gradleg_quad_p7p3_b2_bx, gradleg_quad_p7p4_b2_bx, gradleg_quad_p7p5_b2_bx, gradleg_quad_p7p6_b2_bx, gradleg_quad_p7p7_b2_bx, gradleg_quad_p7p8_b2_bx, gradleg_quad_p7p9_b2_bx, gradleg_quad_p7p10_b2_bx, gradleg_quad_p8p0_b2_bx, gradleg_quad_p8p1_b2_bx, gradleg_quad_p8p2_b2_bx, gradleg_quad_p8p3_b2_bx, gradleg_quad_p8p4_b2_bx, gradleg_quad_p8p5_b2_bx, gradleg_quad_p8p6_b2_bx, gradleg_quad_p8p7_b2_bx, gradleg_quad_p8p8_b2_bx, gradleg_quad_p8p9_b2_bx, gradleg_quad_p8p10_b2_bx, gradleg_quad_p9p0_b2_bx, gradleg_quad_p9p1_b2_bx, gradleg_quad_p9p2_b2_bx, gradleg_quad_p9p3_b2_bx, gradleg_quad_p9p4_b2_bx, gradleg_quad_p9p5_b2_bx, gradleg_quad_p9p6_b2_bx, gradleg_quad_p9p7_b2_bx, gradleg_quad_p9p8_b2_bx, gradleg_quad_p9p9_b2_bx, gradleg_quad_p9p10_b2_bx, gradleg_quad_p10p0_b2_bx, gradleg_quad_p10p1_b2_bx, gradleg_quad_p10p2_b2_bx, gradleg_quad_p10p3_b2_bx, gradleg_quad_p10p4_b2_bx, gradleg_quad_p10p5_b2_bx, gradleg_quad_p10p6_b2_bx, gradleg_quad_p10p7_b2_bx, gradleg_quad_p10p8_b2_bx, gradleg_quad_p10p9_b2_bx, gradleg_quad_p10p10_b2_bx, gradleg_quad_p11p0_b2_bx, gradleg_quad_p11p1_b2_bx, gradleg_quad_p11p2_b2_bx, gradleg_quad_p11p3_b2_bx, gradleg_quad_p11p4_b2_bx, gradleg_quad_p11p5_b2_bx, gradleg_quad_p11p6_b2_bx, gradleg_quad_p11p7_b2_bx, gradleg_quad_p11p8_b2_bx, gradleg_quad_p11p9_b2_bx, gradleg_quad_p11p10_b2_bx, }; + gradleg_quad_p0p2_b1_bx, gradleg_quad_p0p3_b1_bx, gradleg_quad_p0p4_b1_bx, gradleg_quad_p0p5_b1_bx, gradleg_quad_p0p6_b1_bx, gradleg_quad_p0p7_b1_bx, gradleg_quad_p0p8_b1_bx, gradleg_quad_p0p9_b1_bx, gradleg_quad_p0p10_b1_bx, gradleg_quad_p0p11_b1_bx, gradleg_quad_p1p2_b1_bx, gradleg_quad_p1p3_b1_bx, gradleg_quad_p1p4_b1_bx, gradleg_quad_p1p5_b1_bx, gradleg_quad_p1p6_b1_bx, gradleg_quad_p1p7_b1_bx, gradleg_quad_p1p8_b1_bx, gradleg_quad_p1p9_b1_bx, gradleg_quad_p1p10_b1_bx, gradleg_quad_p1p11_b1_bx, gradleg_quad_p2p2_b1_bx, gradleg_quad_p2p3_b1_bx, gradleg_quad_p2p4_b1_bx, gradleg_quad_p2p5_b1_bx, gradleg_quad_p2p6_b1_bx, gradleg_quad_p2p7_b1_bx, gradleg_quad_p2p8_b1_bx, gradleg_quad_p2p9_b1_bx, gradleg_quad_p2p10_b1_bx, gradleg_quad_p2p11_b1_bx, gradleg_quad_p3p2_b1_bx, gradleg_quad_p3p3_b1_bx, gradleg_quad_p3p4_b1_bx, gradleg_quad_p3p5_b1_bx, gradleg_quad_p3p6_b1_bx, gradleg_quad_p3p7_b1_bx, gradleg_quad_p3p8_b1_bx, gradleg_quad_p3p9_b1_bx, gradleg_quad_p3p10_b1_bx, gradleg_quad_p3p11_b1_bx, gradleg_quad_p4p2_b1_bx, gradleg_quad_p4p3_b1_bx, gradleg_quad_p4p4_b1_bx, gradleg_quad_p4p5_b1_bx, gradleg_quad_p4p6_b1_bx, gradleg_quad_p4p7_b1_bx, gradleg_quad_p4p8_b1_bx, gradleg_quad_p4p9_b1_bx, gradleg_quad_p4p10_b1_bx, gradleg_quad_p4p11_b1_bx, gradleg_quad_p5p2_b1_bx, gradleg_quad_p5p3_b1_bx, gradleg_quad_p5p4_b1_bx, gradleg_quad_p5p5_b1_bx, gradleg_quad_p5p6_b1_bx, gradleg_quad_p5p7_b1_bx, gradleg_quad_p5p8_b1_bx, gradleg_quad_p5p9_b1_bx, gradleg_quad_p5p10_b1_bx, gradleg_quad_p5p11_b1_bx, gradleg_quad_p6p2_b1_bx, gradleg_quad_p6p3_b1_bx, gradleg_quad_p6p4_b1_bx, gradleg_quad_p6p5_b1_bx, gradleg_quad_p6p6_b1_bx, gradleg_quad_p6p7_b1_bx, gradleg_quad_p6p8_b1_bx, gradleg_quad_p6p9_b1_bx, gradleg_quad_p6p10_b1_bx, gradleg_quad_p6p11_b1_bx, gradleg_quad_p7p2_b1_bx, gradleg_quad_p7p3_b1_bx, gradleg_quad_p7p4_b1_bx, gradleg_quad_p7p5_b1_bx, gradleg_quad_p7p6_b1_bx, gradleg_quad_p7p7_b1_bx, gradleg_quad_p7p8_b1_bx, gradleg_quad_p7p9_b1_bx, gradleg_quad_p7p10_b1_bx, gradleg_quad_p7p11_b1_bx, gradleg_quad_p8p2_b1_bx, gradleg_quad_p8p3_b1_bx, gradleg_quad_p8p4_b1_bx, gradleg_quad_p8p5_b1_bx, gradleg_quad_p8p6_b1_bx, gradleg_quad_p8p7_b1_bx, gradleg_quad_p8p8_b1_bx, gradleg_quad_p8p9_b1_bx, gradleg_quad_p8p10_b1_bx, gradleg_quad_p8p11_b1_bx, gradleg_quad_p9p2_b1_bx, gradleg_quad_p9p3_b1_bx, gradleg_quad_p9p4_b1_bx, gradleg_quad_p9p5_b1_bx, gradleg_quad_p9p6_b1_bx, gradleg_quad_p9p7_b1_bx, gradleg_quad_p9p8_b1_bx, gradleg_quad_p9p9_b1_bx, gradleg_quad_p9p10_b1_bx, gradleg_quad_p9p11_b1_bx, gradleg_quad_p10p2_b1_bx, gradleg_quad_p10p3_b1_bx, gradleg_quad_p10p4_b1_bx, gradleg_quad_p10p5_b1_bx, gradleg_quad_p10p6_b1_bx, gradleg_quad_p10p7_b1_bx, gradleg_quad_p10p8_b1_bx, gradleg_quad_p10p9_b1_bx, gradleg_quad_p10p10_b1_bx, gradleg_quad_p10p11_b1_bx, gradleg_quad_p2p0_b2_bx, gradleg_quad_p2p1_b2_bx, gradleg_quad_p2p2_b2_bx, gradleg_quad_p2p3_b2_bx, gradleg_quad_p2p4_b2_bx, gradleg_quad_p2p5_b2_bx, gradleg_quad_p2p6_b2_bx, gradleg_quad_p2p7_b2_bx, gradleg_quad_p2p8_b2_bx, gradleg_quad_p2p9_b2_bx, gradleg_quad_p2p10_b2_bx, gradleg_quad_p3p0_b2_bx, gradleg_quad_p3p1_b2_bx, gradleg_quad_p3p2_b2_bx, gradleg_quad_p3p3_b2_bx, gradleg_quad_p3p4_b2_bx, gradleg_quad_p3p5_b2_bx, gradleg_quad_p3p6_b2_bx, gradleg_quad_p3p7_b2_bx, gradleg_quad_p3p8_b2_bx, gradleg_quad_p3p9_b2_bx, gradleg_quad_p3p10_b2_bx, gradleg_quad_p4p0_b2_bx, gradleg_quad_p4p1_b2_bx, gradleg_quad_p4p2_b2_bx, gradleg_quad_p4p3_b2_bx, gradleg_quad_p4p4_b2_bx, gradleg_quad_p4p5_b2_bx, gradleg_quad_p4p6_b2_bx, gradleg_quad_p4p7_b2_bx, gradleg_quad_p4p8_b2_bx, gradleg_quad_p4p9_b2_bx, gradleg_quad_p4p10_b2_bx, gradleg_quad_p5p0_b2_bx, gradleg_quad_p5p1_b2_bx, gradleg_quad_p5p2_b2_bx, gradleg_quad_p5p3_b2_bx, gradleg_quad_p5p4_b2_bx, gradleg_quad_p5p5_b2_bx, gradleg_quad_p5p6_b2_bx, gradleg_quad_p5p7_b2_bx, gradleg_quad_p5p8_b2_bx, gradleg_quad_p5p9_b2_bx, gradleg_quad_p5p10_b2_bx, gradleg_quad_p6p0_b2_bx, gradleg_quad_p6p1_b2_bx, gradleg_quad_p6p2_b2_bx, gradleg_quad_p6p3_b2_bx, gradleg_quad_p6p4_b2_bx, gradleg_quad_p6p5_b2_bx, gradleg_quad_p6p6_b2_bx, gradleg_quad_p6p7_b2_bx, gradleg_quad_p6p8_b2_bx, gradleg_quad_p6p9_b2_bx, gradleg_quad_p6p10_b2_bx, gradleg_quad_p7p0_b2_bx, gradleg_quad_p7p1_b2_bx, gradleg_quad_p7p2_b2_bx, gradleg_quad_p7p3_b2_bx, gradleg_quad_p7p4_b2_bx, gradleg_quad_p7p5_b2_bx, gradleg_quad_p7p6_b2_bx, gradleg_quad_p7p7_b2_bx, gradleg_quad_p7p8_b2_bx, gradleg_quad_p7p9_b2_bx, gradleg_quad_p7p10_b2_bx, gradleg_quad_p8p0_b2_bx, gradleg_quad_p8p1_b2_bx, gradleg_quad_p8p2_b2_bx, gradleg_quad_p8p3_b2_bx, gradleg_quad_p8p4_b2_bx, gradleg_quad_p8p5_b2_bx, gradleg_quad_p8p6_b2_bx, gradleg_quad_p8p7_b2_bx, gradleg_quad_p8p8_b2_bx, gradleg_quad_p8p9_b2_bx, gradleg_quad_p8p10_b2_bx, gradleg_quad_p9p0_b2_bx, gradleg_quad_p9p1_b2_bx, gradleg_quad_p9p2_b2_bx, gradleg_quad_p9p3_b2_bx, gradleg_quad_p9p4_b2_bx, gradleg_quad_p9p5_b2_bx, gradleg_quad_p9p6_b2_bx, gradleg_quad_p9p7_b2_bx, gradleg_quad_p9p8_b2_bx, gradleg_quad_p9p9_b2_bx, gradleg_quad_p9p10_b2_bx, gradleg_quad_p10p0_b2_bx, gradleg_quad_p10p1_b2_bx, gradleg_quad_p10p2_b2_bx, gradleg_quad_p10p3_b2_bx, gradleg_quad_p10p4_b2_bx, gradleg_quad_p10p5_b2_bx, gradleg_quad_p10p6_b2_bx, gradleg_quad_p10p7_b2_bx, gradleg_quad_p10p8_b2_bx, gradleg_quad_p10p9_b2_bx, gradleg_quad_p10p10_b2_bx, gradleg_quad_p11p0_b2_bx, gradleg_quad_p11p1_b2_bx, gradleg_quad_p11p2_b2_bx, gradleg_quad_p11p3_b2_bx, gradleg_quad_p11p4_b2_bx, gradleg_quad_p11p5_b2_bx, gradleg_quad_p11p6_b2_bx, gradleg_quad_p11p7_b2_bx, gradleg_quad_p11p8_b2_bx, gradleg_quad_p11p9_b2_bx, gradleg_quad_p11p10_b2_bx, }; static Shapeset::shape_fn_t gradleg_quad_fn_ay[] = { gradleg_quad_p0_e1_ay_0, gradleg_quad_p0_e1_ay_1, gradleg_quad_p0_e2_ay, gradleg_quad_p0_e2_ay, gradleg_quad_p0_e3_ay_0, gradleg_quad_p0_e3_ay_1, gradleg_quad_p0_e4_ay, gradleg_quad_p0_e4_ay, gradleg_quad_l2_l0_ay, gradleg_quad_l2_l0_ay, gradleg_quad_l1_l2_ay, gradleg_quad_l1_l2_ay, gradleg_quad_l2_l1_ay, gradleg_quad_l2_l1_ay, gradleg_quad_l0_l2_ay, gradleg_quad_l0_l2_ay, - gradleg_quad_l3_l0_ay_0, gradleg_quad_l3_l0_ay_1, gradleg_quad_l1_l3_ay_0, gradleg_quad_l1_l3_ay_1, gradleg_quad_l3_l1_ay_0, gradleg_quad_l3_l1_ay_1, gradleg_quad_l0_l3_ay_0, gradleg_quad_l0_l3_ay_1, + gradleg_quad_l3_l0_ay_0, gradleg_quad_l3_l0_ay_1, gradleg_quad_l1_l3_ay_0, gradleg_quad_l1_l3_ay_1, gradleg_quad_l3_l1_ay_0, gradleg_quad_l3_l1_ay_1, gradleg_quad_l0_l3_ay_0, gradleg_quad_l0_l3_ay_1, gradleg_quad_l4_l0_ay, gradleg_quad_l4_l0_ay, gradleg_quad_l1_l4_ay, gradleg_quad_l1_l4_ay, gradleg_quad_l4_l1_ay, gradleg_quad_l4_l1_ay, gradleg_quad_l0_l4_ay, gradleg_quad_l0_l4_ay, - gradleg_quad_l5_l0_ay_0, gradleg_quad_l5_l0_ay_1, gradleg_quad_l1_l5_ay_0, gradleg_quad_l1_l5_ay_1, gradleg_quad_l5_l1_ay_0, gradleg_quad_l5_l1_ay_1, gradleg_quad_l0_l5_ay_0, gradleg_quad_l0_l5_ay_1, + gradleg_quad_l5_l0_ay_0, gradleg_quad_l5_l0_ay_1, gradleg_quad_l1_l5_ay_0, gradleg_quad_l1_l5_ay_1, gradleg_quad_l5_l1_ay_0, gradleg_quad_l5_l1_ay_1, gradleg_quad_l0_l5_ay_0, gradleg_quad_l0_l5_ay_1, gradleg_quad_l6_l0_ay, gradleg_quad_l6_l0_ay, gradleg_quad_l1_l6_ay, gradleg_quad_l1_l6_ay, gradleg_quad_l6_l1_ay, gradleg_quad_l6_l1_ay, gradleg_quad_l0_l6_ay, gradleg_quad_l0_l6_ay, - gradleg_quad_l7_l0_ay_0, gradleg_quad_l7_l0_ay_1, gradleg_quad_l1_l7_ay_0, gradleg_quad_l1_l7_ay_1, gradleg_quad_l7_l1_ay_0, gradleg_quad_l7_l1_ay_1, gradleg_quad_l0_l7_ay_0, gradleg_quad_l0_l7_ay_1, + gradleg_quad_l7_l0_ay_0, gradleg_quad_l7_l0_ay_1, gradleg_quad_l1_l7_ay_0, gradleg_quad_l1_l7_ay_1, gradleg_quad_l7_l1_ay_0, gradleg_quad_l7_l1_ay_1, gradleg_quad_l0_l7_ay_0, gradleg_quad_l0_l7_ay_1, gradleg_quad_l8_l0_ay, gradleg_quad_l8_l0_ay, gradleg_quad_l1_l8_ay, gradleg_quad_l1_l8_ay, gradleg_quad_l8_l1_ay, gradleg_quad_l8_l1_ay, gradleg_quad_l0_l8_ay, gradleg_quad_l0_l8_ay, - gradleg_quad_l9_l0_ay_0, gradleg_quad_l9_l0_ay_1, gradleg_quad_l1_l9_ay_0, gradleg_quad_l1_l9_ay_1, gradleg_quad_l9_l1_ay_0, gradleg_quad_l9_l1_ay_1, gradleg_quad_l0_l9_ay_0, gradleg_quad_l0_l9_ay_1, + gradleg_quad_l9_l0_ay_0, gradleg_quad_l9_l0_ay_1, gradleg_quad_l1_l9_ay_0, gradleg_quad_l1_l9_ay_1, gradleg_quad_l9_l1_ay_0, gradleg_quad_l9_l1_ay_1, gradleg_quad_l0_l9_ay_0, gradleg_quad_l0_l9_ay_1, gradleg_quad_l10_l0_ay, gradleg_quad_l10_l0_ay, gradleg_quad_l1_l10_ay, gradleg_quad_l1_l10_ay, gradleg_quad_l10_l1_ay, gradleg_quad_l10_l1_ay, gradleg_quad_l0_l10_ay, gradleg_quad_l0_l10_ay, - gradleg_quad_l11_l0_ay_0, gradleg_quad_l11_l0_ay_1, gradleg_quad_l1_l11_ay_0, gradleg_quad_l1_l11_ay_1, gradleg_quad_l11_l1_ay_0, gradleg_quad_l11_l1_ay_1, gradleg_quad_l0_l11_ay_0, gradleg_quad_l0_l11_ay_1, + gradleg_quad_l11_l0_ay_0, gradleg_quad_l11_l0_ay_1, gradleg_quad_l1_l11_ay_0, gradleg_quad_l1_l11_ay_1, gradleg_quad_l11_l1_ay_0, gradleg_quad_l11_l1_ay_1, gradleg_quad_l0_l11_ay_0, gradleg_quad_l0_l11_ay_1, - gradleg_quad_p0p2_b1_ay, gradleg_quad_p0p3_b1_ay, gradleg_quad_p0p4_b1_ay, gradleg_quad_p0p5_b1_ay, gradleg_quad_p0p6_b1_ay, gradleg_quad_p0p7_b1_ay, gradleg_quad_p0p8_b1_ay, gradleg_quad_p0p9_b1_ay, gradleg_quad_p0p10_b1_ay, gradleg_quad_p0p11_b1_ay, gradleg_quad_p1p2_b1_ay, gradleg_quad_p1p3_b1_ay, gradleg_quad_p1p4_b1_ay, gradleg_quad_p1p5_b1_ay, gradleg_quad_p1p6_b1_ay, gradleg_quad_p1p7_b1_ay, gradleg_quad_p1p8_b1_ay, gradleg_quad_p1p9_b1_ay, gradleg_quad_p1p10_b1_ay, gradleg_quad_p1p11_b1_ay, gradleg_quad_p2p2_b1_ay, gradleg_quad_p2p3_b1_ay, gradleg_quad_p2p4_b1_ay, gradleg_quad_p2p5_b1_ay, gradleg_quad_p2p6_b1_ay, gradleg_quad_p2p7_b1_ay, gradleg_quad_p2p8_b1_ay, gradleg_quad_p2p9_b1_ay, gradleg_quad_p2p10_b1_ay, gradleg_quad_p2p11_b1_ay, gradleg_quad_p3p2_b1_ay, gradleg_quad_p3p3_b1_ay, gradleg_quad_p3p4_b1_ay, gradleg_quad_p3p5_b1_ay, gradleg_quad_p3p6_b1_ay, gradleg_quad_p3p7_b1_ay, gradleg_quad_p3p8_b1_ay, gradleg_quad_p3p9_b1_ay, gradleg_quad_p3p10_b1_ay, gradleg_quad_p3p11_b1_ay, gradleg_quad_p4p2_b1_ay, gradleg_quad_p4p3_b1_ay, gradleg_quad_p4p4_b1_ay, gradleg_quad_p4p5_b1_ay, gradleg_quad_p4p6_b1_ay, gradleg_quad_p4p7_b1_ay, gradleg_quad_p4p8_b1_ay, gradleg_quad_p4p9_b1_ay, gradleg_quad_p4p10_b1_ay, gradleg_quad_p4p11_b1_ay, gradleg_quad_p5p2_b1_ay, gradleg_quad_p5p3_b1_ay, gradleg_quad_p5p4_b1_ay, gradleg_quad_p5p5_b1_ay, gradleg_quad_p5p6_b1_ay, gradleg_quad_p5p7_b1_ay, gradleg_quad_p5p8_b1_ay, gradleg_quad_p5p9_b1_ay, gradleg_quad_p5p10_b1_ay, gradleg_quad_p5p11_b1_ay, gradleg_quad_p6p2_b1_ay, gradleg_quad_p6p3_b1_ay, gradleg_quad_p6p4_b1_ay, gradleg_quad_p6p5_b1_ay, gradleg_quad_p6p6_b1_ay, gradleg_quad_p6p7_b1_ay, gradleg_quad_p6p8_b1_ay, gradleg_quad_p6p9_b1_ay, gradleg_quad_p6p10_b1_ay, gradleg_quad_p6p11_b1_ay, gradleg_quad_p7p2_b1_ay, gradleg_quad_p7p3_b1_ay, gradleg_quad_p7p4_b1_ay, gradleg_quad_p7p5_b1_ay, gradleg_quad_p7p6_b1_ay, gradleg_quad_p7p7_b1_ay, gradleg_quad_p7p8_b1_ay, gradleg_quad_p7p9_b1_ay, gradleg_quad_p7p10_b1_ay, gradleg_quad_p7p11_b1_ay, gradleg_quad_p8p2_b1_ay, gradleg_quad_p8p3_b1_ay, gradleg_quad_p8p4_b1_ay, gradleg_quad_p8p5_b1_ay, gradleg_quad_p8p6_b1_ay, gradleg_quad_p8p7_b1_ay, gradleg_quad_p8p8_b1_ay, gradleg_quad_p8p9_b1_ay, gradleg_quad_p8p10_b1_ay, gradleg_quad_p8p11_b1_ay, gradleg_quad_p9p2_b1_ay, gradleg_quad_p9p3_b1_ay, gradleg_quad_p9p4_b1_ay, gradleg_quad_p9p5_b1_ay, gradleg_quad_p9p6_b1_ay, gradleg_quad_p9p7_b1_ay, gradleg_quad_p9p8_b1_ay, gradleg_quad_p9p9_b1_ay, gradleg_quad_p9p10_b1_ay, gradleg_quad_p9p11_b1_ay, gradleg_quad_p10p2_b1_ay, gradleg_quad_p10p3_b1_ay, gradleg_quad_p10p4_b1_ay, gradleg_quad_p10p5_b1_ay, gradleg_quad_p10p6_b1_ay, gradleg_quad_p10p7_b1_ay, gradleg_quad_p10p8_b1_ay, gradleg_quad_p10p9_b1_ay, gradleg_quad_p10p10_b1_ay, gradleg_quad_p10p11_b1_ay, gradleg_quad_p2p0_b2_ay, gradleg_quad_p2p1_b2_ay, gradleg_quad_p2p2_b2_ay, gradleg_quad_p2p3_b2_ay, gradleg_quad_p2p4_b2_ay, gradleg_quad_p2p5_b2_ay, gradleg_quad_p2p6_b2_ay, gradleg_quad_p2p7_b2_ay, gradleg_quad_p2p8_b2_ay, gradleg_quad_p2p9_b2_ay, gradleg_quad_p2p10_b2_ay, gradleg_quad_p3p0_b2_ay, gradleg_quad_p3p1_b2_ay, gradleg_quad_p3p2_b2_ay, gradleg_quad_p3p3_b2_ay, gradleg_quad_p3p4_b2_ay, gradleg_quad_p3p5_b2_ay, gradleg_quad_p3p6_b2_ay, gradleg_quad_p3p7_b2_ay, gradleg_quad_p3p8_b2_ay, gradleg_quad_p3p9_b2_ay, gradleg_quad_p3p10_b2_ay, gradleg_quad_p4p0_b2_ay, gradleg_quad_p4p1_b2_ay, gradleg_quad_p4p2_b2_ay, gradleg_quad_p4p3_b2_ay, gradleg_quad_p4p4_b2_ay, gradleg_quad_p4p5_b2_ay, gradleg_quad_p4p6_b2_ay, gradleg_quad_p4p7_b2_ay, gradleg_quad_p4p8_b2_ay, gradleg_quad_p4p9_b2_ay, gradleg_quad_p4p10_b2_ay, gradleg_quad_p5p0_b2_ay, gradleg_quad_p5p1_b2_ay, gradleg_quad_p5p2_b2_ay, gradleg_quad_p5p3_b2_ay, gradleg_quad_p5p4_b2_ay, gradleg_quad_p5p5_b2_ay, gradleg_quad_p5p6_b2_ay, gradleg_quad_p5p7_b2_ay, gradleg_quad_p5p8_b2_ay, gradleg_quad_p5p9_b2_ay, gradleg_quad_p5p10_b2_ay, gradleg_quad_p6p0_b2_ay, gradleg_quad_p6p1_b2_ay, gradleg_quad_p6p2_b2_ay, gradleg_quad_p6p3_b2_ay, gradleg_quad_p6p4_b2_ay, gradleg_quad_p6p5_b2_ay, gradleg_quad_p6p6_b2_ay, gradleg_quad_p6p7_b2_ay, gradleg_quad_p6p8_b2_ay, gradleg_quad_p6p9_b2_ay, gradleg_quad_p6p10_b2_ay, gradleg_quad_p7p0_b2_ay, gradleg_quad_p7p1_b2_ay, gradleg_quad_p7p2_b2_ay, gradleg_quad_p7p3_b2_ay, gradleg_quad_p7p4_b2_ay, gradleg_quad_p7p5_b2_ay, gradleg_quad_p7p6_b2_ay, gradleg_quad_p7p7_b2_ay, gradleg_quad_p7p8_b2_ay, gradleg_quad_p7p9_b2_ay, gradleg_quad_p7p10_b2_ay, gradleg_quad_p8p0_b2_ay, gradleg_quad_p8p1_b2_ay, gradleg_quad_p8p2_b2_ay, gradleg_quad_p8p3_b2_ay, gradleg_quad_p8p4_b2_ay, gradleg_quad_p8p5_b2_ay, gradleg_quad_p8p6_b2_ay, gradleg_quad_p8p7_b2_ay, gradleg_quad_p8p8_b2_ay, gradleg_quad_p8p9_b2_ay, gradleg_quad_p8p10_b2_ay, gradleg_quad_p9p0_b2_ay, gradleg_quad_p9p1_b2_ay, gradleg_quad_p9p2_b2_ay, gradleg_quad_p9p3_b2_ay, gradleg_quad_p9p4_b2_ay, gradleg_quad_p9p5_b2_ay, gradleg_quad_p9p6_b2_ay, gradleg_quad_p9p7_b2_ay, gradleg_quad_p9p8_b2_ay, gradleg_quad_p9p9_b2_ay, gradleg_quad_p9p10_b2_ay, gradleg_quad_p10p0_b2_ay, gradleg_quad_p10p1_b2_ay, gradleg_quad_p10p2_b2_ay, gradleg_quad_p10p3_b2_ay, gradleg_quad_p10p4_b2_ay, gradleg_quad_p10p5_b2_ay, gradleg_quad_p10p6_b2_ay, gradleg_quad_p10p7_b2_ay, gradleg_quad_p10p8_b2_ay, gradleg_quad_p10p9_b2_ay, gradleg_quad_p10p10_b2_ay, gradleg_quad_p11p0_b2_ay, gradleg_quad_p11p1_b2_ay, gradleg_quad_p11p2_b2_ay, gradleg_quad_p11p3_b2_ay, gradleg_quad_p11p4_b2_ay, gradleg_quad_p11p5_b2_ay, gradleg_quad_p11p6_b2_ay, gradleg_quad_p11p7_b2_ay, gradleg_quad_p11p8_b2_ay, gradleg_quad_p11p9_b2_ay, gradleg_quad_p11p10_b2_ay, }; + gradleg_quad_p0p2_b1_ay, gradleg_quad_p0p3_b1_ay, gradleg_quad_p0p4_b1_ay, gradleg_quad_p0p5_b1_ay, gradleg_quad_p0p6_b1_ay, gradleg_quad_p0p7_b1_ay, gradleg_quad_p0p8_b1_ay, gradleg_quad_p0p9_b1_ay, gradleg_quad_p0p10_b1_ay, gradleg_quad_p0p11_b1_ay, gradleg_quad_p1p2_b1_ay, gradleg_quad_p1p3_b1_ay, gradleg_quad_p1p4_b1_ay, gradleg_quad_p1p5_b1_ay, gradleg_quad_p1p6_b1_ay, gradleg_quad_p1p7_b1_ay, gradleg_quad_p1p8_b1_ay, gradleg_quad_p1p9_b1_ay, gradleg_quad_p1p10_b1_ay, gradleg_quad_p1p11_b1_ay, gradleg_quad_p2p2_b1_ay, gradleg_quad_p2p3_b1_ay, gradleg_quad_p2p4_b1_ay, gradleg_quad_p2p5_b1_ay, gradleg_quad_p2p6_b1_ay, gradleg_quad_p2p7_b1_ay, gradleg_quad_p2p8_b1_ay, gradleg_quad_p2p9_b1_ay, gradleg_quad_p2p10_b1_ay, gradleg_quad_p2p11_b1_ay, gradleg_quad_p3p2_b1_ay, gradleg_quad_p3p3_b1_ay, gradleg_quad_p3p4_b1_ay, gradleg_quad_p3p5_b1_ay, gradleg_quad_p3p6_b1_ay, gradleg_quad_p3p7_b1_ay, gradleg_quad_p3p8_b1_ay, gradleg_quad_p3p9_b1_ay, gradleg_quad_p3p10_b1_ay, gradleg_quad_p3p11_b1_ay, gradleg_quad_p4p2_b1_ay, gradleg_quad_p4p3_b1_ay, gradleg_quad_p4p4_b1_ay, gradleg_quad_p4p5_b1_ay, gradleg_quad_p4p6_b1_ay, gradleg_quad_p4p7_b1_ay, gradleg_quad_p4p8_b1_ay, gradleg_quad_p4p9_b1_ay, gradleg_quad_p4p10_b1_ay, gradleg_quad_p4p11_b1_ay, gradleg_quad_p5p2_b1_ay, gradleg_quad_p5p3_b1_ay, gradleg_quad_p5p4_b1_ay, gradleg_quad_p5p5_b1_ay, gradleg_quad_p5p6_b1_ay, gradleg_quad_p5p7_b1_ay, gradleg_quad_p5p8_b1_ay, gradleg_quad_p5p9_b1_ay, gradleg_quad_p5p10_b1_ay, gradleg_quad_p5p11_b1_ay, gradleg_quad_p6p2_b1_ay, gradleg_quad_p6p3_b1_ay, gradleg_quad_p6p4_b1_ay, gradleg_quad_p6p5_b1_ay, gradleg_quad_p6p6_b1_ay, gradleg_quad_p6p7_b1_ay, gradleg_quad_p6p8_b1_ay, gradleg_quad_p6p9_b1_ay, gradleg_quad_p6p10_b1_ay, gradleg_quad_p6p11_b1_ay, gradleg_quad_p7p2_b1_ay, gradleg_quad_p7p3_b1_ay, gradleg_quad_p7p4_b1_ay, gradleg_quad_p7p5_b1_ay, gradleg_quad_p7p6_b1_ay, gradleg_quad_p7p7_b1_ay, gradleg_quad_p7p8_b1_ay, gradleg_quad_p7p9_b1_ay, gradleg_quad_p7p10_b1_ay, gradleg_quad_p7p11_b1_ay, gradleg_quad_p8p2_b1_ay, gradleg_quad_p8p3_b1_ay, gradleg_quad_p8p4_b1_ay, gradleg_quad_p8p5_b1_ay, gradleg_quad_p8p6_b1_ay, gradleg_quad_p8p7_b1_ay, gradleg_quad_p8p8_b1_ay, gradleg_quad_p8p9_b1_ay, gradleg_quad_p8p10_b1_ay, gradleg_quad_p8p11_b1_ay, gradleg_quad_p9p2_b1_ay, gradleg_quad_p9p3_b1_ay, gradleg_quad_p9p4_b1_ay, gradleg_quad_p9p5_b1_ay, gradleg_quad_p9p6_b1_ay, gradleg_quad_p9p7_b1_ay, gradleg_quad_p9p8_b1_ay, gradleg_quad_p9p9_b1_ay, gradleg_quad_p9p10_b1_ay, gradleg_quad_p9p11_b1_ay, gradleg_quad_p10p2_b1_ay, gradleg_quad_p10p3_b1_ay, gradleg_quad_p10p4_b1_ay, gradleg_quad_p10p5_b1_ay, gradleg_quad_p10p6_b1_ay, gradleg_quad_p10p7_b1_ay, gradleg_quad_p10p8_b1_ay, gradleg_quad_p10p9_b1_ay, gradleg_quad_p10p10_b1_ay, gradleg_quad_p10p11_b1_ay, gradleg_quad_p2p0_b2_ay, gradleg_quad_p2p1_b2_ay, gradleg_quad_p2p2_b2_ay, gradleg_quad_p2p3_b2_ay, gradleg_quad_p2p4_b2_ay, gradleg_quad_p2p5_b2_ay, gradleg_quad_p2p6_b2_ay, gradleg_quad_p2p7_b2_ay, gradleg_quad_p2p8_b2_ay, gradleg_quad_p2p9_b2_ay, gradleg_quad_p2p10_b2_ay, gradleg_quad_p3p0_b2_ay, gradleg_quad_p3p1_b2_ay, gradleg_quad_p3p2_b2_ay, gradleg_quad_p3p3_b2_ay, gradleg_quad_p3p4_b2_ay, gradleg_quad_p3p5_b2_ay, gradleg_quad_p3p6_b2_ay, gradleg_quad_p3p7_b2_ay, gradleg_quad_p3p8_b2_ay, gradleg_quad_p3p9_b2_ay, gradleg_quad_p3p10_b2_ay, gradleg_quad_p4p0_b2_ay, gradleg_quad_p4p1_b2_ay, gradleg_quad_p4p2_b2_ay, gradleg_quad_p4p3_b2_ay, gradleg_quad_p4p4_b2_ay, gradleg_quad_p4p5_b2_ay, gradleg_quad_p4p6_b2_ay, gradleg_quad_p4p7_b2_ay, gradleg_quad_p4p8_b2_ay, gradleg_quad_p4p9_b2_ay, gradleg_quad_p4p10_b2_ay, gradleg_quad_p5p0_b2_ay, gradleg_quad_p5p1_b2_ay, gradleg_quad_p5p2_b2_ay, gradleg_quad_p5p3_b2_ay, gradleg_quad_p5p4_b2_ay, gradleg_quad_p5p5_b2_ay, gradleg_quad_p5p6_b2_ay, gradleg_quad_p5p7_b2_ay, gradleg_quad_p5p8_b2_ay, gradleg_quad_p5p9_b2_ay, gradleg_quad_p5p10_b2_ay, gradleg_quad_p6p0_b2_ay, gradleg_quad_p6p1_b2_ay, gradleg_quad_p6p2_b2_ay, gradleg_quad_p6p3_b2_ay, gradleg_quad_p6p4_b2_ay, gradleg_quad_p6p5_b2_ay, gradleg_quad_p6p6_b2_ay, gradleg_quad_p6p7_b2_ay, gradleg_quad_p6p8_b2_ay, gradleg_quad_p6p9_b2_ay, gradleg_quad_p6p10_b2_ay, gradleg_quad_p7p0_b2_ay, gradleg_quad_p7p1_b2_ay, gradleg_quad_p7p2_b2_ay, gradleg_quad_p7p3_b2_ay, gradleg_quad_p7p4_b2_ay, gradleg_quad_p7p5_b2_ay, gradleg_quad_p7p6_b2_ay, gradleg_quad_p7p7_b2_ay, gradleg_quad_p7p8_b2_ay, gradleg_quad_p7p9_b2_ay, gradleg_quad_p7p10_b2_ay, gradleg_quad_p8p0_b2_ay, gradleg_quad_p8p1_b2_ay, gradleg_quad_p8p2_b2_ay, gradleg_quad_p8p3_b2_ay, gradleg_quad_p8p4_b2_ay, gradleg_quad_p8p5_b2_ay, gradleg_quad_p8p6_b2_ay, gradleg_quad_p8p7_b2_ay, gradleg_quad_p8p8_b2_ay, gradleg_quad_p8p9_b2_ay, gradleg_quad_p8p10_b2_ay, gradleg_quad_p9p0_b2_ay, gradleg_quad_p9p1_b2_ay, gradleg_quad_p9p2_b2_ay, gradleg_quad_p9p3_b2_ay, gradleg_quad_p9p4_b2_ay, gradleg_quad_p9p5_b2_ay, gradleg_quad_p9p6_b2_ay, gradleg_quad_p9p7_b2_ay, gradleg_quad_p9p8_b2_ay, gradleg_quad_p9p9_b2_ay, gradleg_quad_p9p10_b2_ay, gradleg_quad_p10p0_b2_ay, gradleg_quad_p10p1_b2_ay, gradleg_quad_p10p2_b2_ay, gradleg_quad_p10p3_b2_ay, gradleg_quad_p10p4_b2_ay, gradleg_quad_p10p5_b2_ay, gradleg_quad_p10p6_b2_ay, gradleg_quad_p10p7_b2_ay, gradleg_quad_p10p8_b2_ay, gradleg_quad_p10p9_b2_ay, gradleg_quad_p10p10_b2_ay, gradleg_quad_p11p0_b2_ay, gradleg_quad_p11p1_b2_ay, gradleg_quad_p11p2_b2_ay, gradleg_quad_p11p3_b2_ay, gradleg_quad_p11p4_b2_ay, gradleg_quad_p11p5_b2_ay, gradleg_quad_p11p6_b2_ay, gradleg_quad_p11p7_b2_ay, gradleg_quad_p11p8_b2_ay, gradleg_quad_p11p9_b2_ay, gradleg_quad_p11p10_b2_ay, }; static Shapeset::shape_fn_t gradleg_quad_fn_by[] = { - gradleg_quad_p0_e1_by, gradleg_quad_p0_e1_by, gradleg_quad_p0_e2_by_0, gradleg_quad_p0_e2_by_1, gradleg_quad_p0_e3_by, gradleg_quad_p0_e3_by, gradleg_quad_p0_e4_by_0, gradleg_quad_p0_e4_by_1, - gradleg_quad_l2_l0_by, gradleg_quad_l2_l0_by, gradleg_quad_l1_l2_by, gradleg_quad_l1_l2_by, gradleg_quad_l2_l1_by, gradleg_quad_l2_l1_by, gradleg_quad_l0_l2_by, gradleg_quad_l0_l2_by, + gradleg_quad_p0_e1_by, gradleg_quad_p0_e1_by, gradleg_quad_p0_e2_by_0, gradleg_quad_p0_e2_by_1, gradleg_quad_p0_e3_by, gradleg_quad_p0_e3_by, gradleg_quad_p0_e4_by_0, gradleg_quad_p0_e4_by_1, + gradleg_quad_l2_l0_by, gradleg_quad_l2_l0_by, gradleg_quad_l1_l2_by, gradleg_quad_l1_l2_by, gradleg_quad_l2_l1_by, gradleg_quad_l2_l1_by, gradleg_quad_l0_l2_by, gradleg_quad_l0_l2_by, gradleg_quad_l3_l0_by_0, gradleg_quad_l3_l0_by_1, gradleg_quad_l1_l3_by_0, gradleg_quad_l1_l3_by_1, gradleg_quad_l3_l1_by_0, gradleg_quad_l3_l1_by_1, gradleg_quad_l0_l3_by_0, gradleg_quad_l0_l3_by_1, - gradleg_quad_l4_l0_by, gradleg_quad_l4_l0_by, gradleg_quad_l1_l4_by, gradleg_quad_l1_l4_by, gradleg_quad_l4_l1_by, gradleg_quad_l4_l1_by, gradleg_quad_l0_l4_by, gradleg_quad_l0_l4_by, + gradleg_quad_l4_l0_by, gradleg_quad_l4_l0_by, gradleg_quad_l1_l4_by, gradleg_quad_l1_l4_by, gradleg_quad_l4_l1_by, gradleg_quad_l4_l1_by, gradleg_quad_l0_l4_by, gradleg_quad_l0_l4_by, gradleg_quad_l5_l0_by_0, gradleg_quad_l5_l0_by_1, gradleg_quad_l1_l5_by_0, gradleg_quad_l1_l5_by_1, gradleg_quad_l5_l1_by_0, gradleg_quad_l5_l1_by_1, gradleg_quad_l0_l5_by_0, gradleg_quad_l0_l5_by_1, - gradleg_quad_l6_l0_by, gradleg_quad_l6_l0_by, gradleg_quad_l1_l6_by, gradleg_quad_l1_l6_by, gradleg_quad_l6_l1_by, gradleg_quad_l6_l1_by, gradleg_quad_l0_l6_by, gradleg_quad_l0_l6_by, + gradleg_quad_l6_l0_by, gradleg_quad_l6_l0_by, gradleg_quad_l1_l6_by, gradleg_quad_l1_l6_by, gradleg_quad_l6_l1_by, gradleg_quad_l6_l1_by, gradleg_quad_l0_l6_by, gradleg_quad_l0_l6_by, gradleg_quad_l7_l0_by_0, gradleg_quad_l7_l0_by_1, gradleg_quad_l1_l7_by_0, gradleg_quad_l1_l7_by_1, gradleg_quad_l7_l1_by_0, gradleg_quad_l7_l1_by_1, gradleg_quad_l0_l7_by_0, gradleg_quad_l0_l7_by_1, - gradleg_quad_l8_l0_by, gradleg_quad_l8_l0_by, gradleg_quad_l1_l8_by, gradleg_quad_l1_l8_by, gradleg_quad_l8_l1_by, gradleg_quad_l8_l1_by, gradleg_quad_l0_l8_by, gradleg_quad_l0_l8_by, + gradleg_quad_l8_l0_by, gradleg_quad_l8_l0_by, gradleg_quad_l1_l8_by, gradleg_quad_l1_l8_by, gradleg_quad_l8_l1_by, gradleg_quad_l8_l1_by, gradleg_quad_l0_l8_by, gradleg_quad_l0_l8_by, gradleg_quad_l9_l0_by_0, gradleg_quad_l9_l0_by_1, gradleg_quad_l1_l9_by_0, gradleg_quad_l1_l9_by_1, gradleg_quad_l9_l1_by_0, gradleg_quad_l9_l1_by_1, gradleg_quad_l0_l9_by_0, gradleg_quad_l0_l9_by_1, - gradleg_quad_l10_l0_by, gradleg_quad_l10_l0_by, gradleg_quad_l1_l10_by, gradleg_quad_l1_l10_by, gradleg_quad_l10_l1_by, gradleg_quad_l10_l1_by, gradleg_quad_l0_l10_by, gradleg_quad_l0_l10_by, + gradleg_quad_l10_l0_by, gradleg_quad_l10_l0_by, gradleg_quad_l1_l10_by, gradleg_quad_l1_l10_by, gradleg_quad_l10_l1_by, gradleg_quad_l10_l1_by, gradleg_quad_l0_l10_by, gradleg_quad_l0_l10_by, gradleg_quad_l11_l0_by_0, gradleg_quad_l11_l0_by_1, gradleg_quad_l1_l11_by_0, gradleg_quad_l1_l11_by_1, gradleg_quad_l11_l1_by_0, gradleg_quad_l11_l1_by_1, gradleg_quad_l0_l11_by_0, gradleg_quad_l0_l11_by_1, - gradleg_quad_p0p2_b1_by, gradleg_quad_p0p3_b1_by, gradleg_quad_p0p4_b1_by, gradleg_quad_p0p5_b1_by, gradleg_quad_p0p6_b1_by, gradleg_quad_p0p7_b1_by, gradleg_quad_p0p8_b1_by, gradleg_quad_p0p9_b1_by, gradleg_quad_p0p10_b1_by, gradleg_quad_p0p11_b1_by, gradleg_quad_p1p2_b1_by, gradleg_quad_p1p3_b1_by, gradleg_quad_p1p4_b1_by, gradleg_quad_p1p5_b1_by, gradleg_quad_p1p6_b1_by, gradleg_quad_p1p7_b1_by, gradleg_quad_p1p8_b1_by, gradleg_quad_p1p9_b1_by, gradleg_quad_p1p10_b1_by, gradleg_quad_p1p11_b1_by, gradleg_quad_p2p2_b1_by, gradleg_quad_p2p3_b1_by, gradleg_quad_p2p4_b1_by, gradleg_quad_p2p5_b1_by, gradleg_quad_p2p6_b1_by, gradleg_quad_p2p7_b1_by, gradleg_quad_p2p8_b1_by, gradleg_quad_p2p9_b1_by, gradleg_quad_p2p10_b1_by, gradleg_quad_p2p11_b1_by, gradleg_quad_p3p2_b1_by, gradleg_quad_p3p3_b1_by, gradleg_quad_p3p4_b1_by, gradleg_quad_p3p5_b1_by, gradleg_quad_p3p6_b1_by, gradleg_quad_p3p7_b1_by, gradleg_quad_p3p8_b1_by, gradleg_quad_p3p9_b1_by, gradleg_quad_p3p10_b1_by, gradleg_quad_p3p11_b1_by, gradleg_quad_p4p2_b1_by, gradleg_quad_p4p3_b1_by, gradleg_quad_p4p4_b1_by, gradleg_quad_p4p5_b1_by, gradleg_quad_p4p6_b1_by, gradleg_quad_p4p7_b1_by, gradleg_quad_p4p8_b1_by, gradleg_quad_p4p9_b1_by, gradleg_quad_p4p10_b1_by, gradleg_quad_p4p11_b1_by, gradleg_quad_p5p2_b1_by, gradleg_quad_p5p3_b1_by, gradleg_quad_p5p4_b1_by, gradleg_quad_p5p5_b1_by, gradleg_quad_p5p6_b1_by, gradleg_quad_p5p7_b1_by, gradleg_quad_p5p8_b1_by, gradleg_quad_p5p9_b1_by, gradleg_quad_p5p10_b1_by, gradleg_quad_p5p11_b1_by, gradleg_quad_p6p2_b1_by, gradleg_quad_p6p3_b1_by, gradleg_quad_p6p4_b1_by, gradleg_quad_p6p5_b1_by, gradleg_quad_p6p6_b1_by, gradleg_quad_p6p7_b1_by, gradleg_quad_p6p8_b1_by, gradleg_quad_p6p9_b1_by, gradleg_quad_p6p10_b1_by, gradleg_quad_p6p11_b1_by, gradleg_quad_p7p2_b1_by, gradleg_quad_p7p3_b1_by, gradleg_quad_p7p4_b1_by, gradleg_quad_p7p5_b1_by, gradleg_quad_p7p6_b1_by, gradleg_quad_p7p7_b1_by, gradleg_quad_p7p8_b1_by, gradleg_quad_p7p9_b1_by, gradleg_quad_p7p10_b1_by, gradleg_quad_p7p11_b1_by, gradleg_quad_p8p2_b1_by, gradleg_quad_p8p3_b1_by, gradleg_quad_p8p4_b1_by, gradleg_quad_p8p5_b1_by, gradleg_quad_p8p6_b1_by, gradleg_quad_p8p7_b1_by, gradleg_quad_p8p8_b1_by, gradleg_quad_p8p9_b1_by, gradleg_quad_p8p10_b1_by, gradleg_quad_p8p11_b1_by, gradleg_quad_p9p2_b1_by, gradleg_quad_p9p3_b1_by, gradleg_quad_p9p4_b1_by, gradleg_quad_p9p5_b1_by, gradleg_quad_p9p6_b1_by, gradleg_quad_p9p7_b1_by, gradleg_quad_p9p8_b1_by, gradleg_quad_p9p9_b1_by, gradleg_quad_p9p10_b1_by, gradleg_quad_p9p11_b1_by, gradleg_quad_p10p2_b1_by, gradleg_quad_p10p3_b1_by, gradleg_quad_p10p4_b1_by, gradleg_quad_p10p5_b1_by, gradleg_quad_p10p6_b1_by, gradleg_quad_p10p7_b1_by, gradleg_quad_p10p8_b1_by, gradleg_quad_p10p9_b1_by, gradleg_quad_p10p10_b1_by, gradleg_quad_p10p11_b1_by, gradleg_quad_p2p0_b2_by, gradleg_quad_p2p1_b2_by, gradleg_quad_p2p2_b2_by, gradleg_quad_p2p3_b2_by, gradleg_quad_p2p4_b2_by, gradleg_quad_p2p5_b2_by, gradleg_quad_p2p6_b2_by, gradleg_quad_p2p7_b2_by, gradleg_quad_p2p8_b2_by, gradleg_quad_p2p9_b2_by, gradleg_quad_p2p10_b2_by, gradleg_quad_p3p0_b2_by, gradleg_quad_p3p1_b2_by, gradleg_quad_p3p2_b2_by, gradleg_quad_p3p3_b2_by, gradleg_quad_p3p4_b2_by, gradleg_quad_p3p5_b2_by, gradleg_quad_p3p6_b2_by, gradleg_quad_p3p7_b2_by, gradleg_quad_p3p8_b2_by, gradleg_quad_p3p9_b2_by, gradleg_quad_p3p10_b2_by, gradleg_quad_p4p0_b2_by, gradleg_quad_p4p1_b2_by, gradleg_quad_p4p2_b2_by, gradleg_quad_p4p3_b2_by, gradleg_quad_p4p4_b2_by, gradleg_quad_p4p5_b2_by, gradleg_quad_p4p6_b2_by, gradleg_quad_p4p7_b2_by, gradleg_quad_p4p8_b2_by, gradleg_quad_p4p9_b2_by, gradleg_quad_p4p10_b2_by, gradleg_quad_p5p0_b2_by, gradleg_quad_p5p1_b2_by, gradleg_quad_p5p2_b2_by, gradleg_quad_p5p3_b2_by, gradleg_quad_p5p4_b2_by, gradleg_quad_p5p5_b2_by, gradleg_quad_p5p6_b2_by, gradleg_quad_p5p7_b2_by, gradleg_quad_p5p8_b2_by, gradleg_quad_p5p9_b2_by, gradleg_quad_p5p10_b2_by, gradleg_quad_p6p0_b2_by, gradleg_quad_p6p1_b2_by, gradleg_quad_p6p2_b2_by, gradleg_quad_p6p3_b2_by, gradleg_quad_p6p4_b2_by, gradleg_quad_p6p5_b2_by, gradleg_quad_p6p6_b2_by, gradleg_quad_p6p7_b2_by, gradleg_quad_p6p8_b2_by, gradleg_quad_p6p9_b2_by, gradleg_quad_p6p10_b2_by, gradleg_quad_p7p0_b2_by, gradleg_quad_p7p1_b2_by, gradleg_quad_p7p2_b2_by, gradleg_quad_p7p3_b2_by, gradleg_quad_p7p4_b2_by, gradleg_quad_p7p5_b2_by, gradleg_quad_p7p6_b2_by, gradleg_quad_p7p7_b2_by, gradleg_quad_p7p8_b2_by, gradleg_quad_p7p9_b2_by, gradleg_quad_p7p10_b2_by, gradleg_quad_p8p0_b2_by, gradleg_quad_p8p1_b2_by, gradleg_quad_p8p2_b2_by, gradleg_quad_p8p3_b2_by, gradleg_quad_p8p4_b2_by, gradleg_quad_p8p5_b2_by, gradleg_quad_p8p6_b2_by, gradleg_quad_p8p7_b2_by, gradleg_quad_p8p8_b2_by, gradleg_quad_p8p9_b2_by, gradleg_quad_p8p10_b2_by, gradleg_quad_p9p0_b2_by, gradleg_quad_p9p1_b2_by, gradleg_quad_p9p2_b2_by, gradleg_quad_p9p3_b2_by, gradleg_quad_p9p4_b2_by, gradleg_quad_p9p5_b2_by, gradleg_quad_p9p6_b2_by, gradleg_quad_p9p7_b2_by, gradleg_quad_p9p8_b2_by, gradleg_quad_p9p9_b2_by, gradleg_quad_p9p10_b2_by, gradleg_quad_p10p0_b2_by, gradleg_quad_p10p1_b2_by, gradleg_quad_p10p2_b2_by, gradleg_quad_p10p3_b2_by, gradleg_quad_p10p4_b2_by, gradleg_quad_p10p5_b2_by, gradleg_quad_p10p6_b2_by, gradleg_quad_p10p7_b2_by, gradleg_quad_p10p8_b2_by, gradleg_quad_p10p9_b2_by, gradleg_quad_p10p10_b2_by, gradleg_quad_p11p0_b2_by, gradleg_quad_p11p1_b2_by, gradleg_quad_p11p2_b2_by, gradleg_quad_p11p3_b2_by, gradleg_quad_p11p4_b2_by, gradleg_quad_p11p5_b2_by, gradleg_quad_p11p6_b2_by, gradleg_quad_p11p7_b2_by, gradleg_quad_p11p8_b2_by, gradleg_quad_p11p9_b2_by, gradleg_quad_p11p10_b2_by, }; - - static int qb_0_1[] = { 88, }; - static int qb_0_2[] = { 88, 89, }; - static int qb_0_3[] = { 88, 89, 90, }; - static int qb_0_4[] = { 88, 89, 90, 91, }; - static int qb_0_5[] = { 88, 89, 90, 91, 92, }; - static int qb_0_6[] = { 88, 89, 90, 91, 92, 93, }; - static int qb_0_7[] = { 88, 89, 90, 91, 92, 93, 94, }; - static int qb_0_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, }; - static int qb_0_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, }; - static int qb_0_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, }; - static int qb_1_0[] = { 198, }; - static int qb_1_1[] = { 88, 198, 98, 199, }; - static int qb_1_2[] = { 88, 89, 198, 98, 199, 99, 200, }; - static int qb_1_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, }; - static int qb_1_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, }; - static int qb_1_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, }; - static int qb_1_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, }; - static int qb_1_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, }; - static int qb_1_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, }; - static int qb_1_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, }; - static int qb_1_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, }; - static int qb_2_0[] = { 198, 209, }; - static int qb_2_1[] = { 88, 198, 98, 199, 209, 108, 210, }; - static int qb_2_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, }; - static int qb_2_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, }; - static int qb_2_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, }; - static int qb_2_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, }; - static int qb_2_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, }; - static int qb_2_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, }; - static int qb_2_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, }; - static int qb_2_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, }; - static int qb_2_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, }; - static int qb_3_0[] = { 198, 209, 220, }; - static int qb_3_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, }; - static int qb_3_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, }; - static int qb_3_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, }; - static int qb_3_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, }; - static int qb_3_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, }; - static int qb_3_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, }; - static int qb_3_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, }; - static int qb_3_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, }; - static int qb_3_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, }; - static int qb_3_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, }; - static int qb_4_0[] = { 198, 209, 220, 231, }; - static int qb_4_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, }; - static int qb_4_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, }; - static int qb_4_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, }; - static int qb_4_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, }; - static int qb_4_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, }; - static int qb_4_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, }; - static int qb_4_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, }; - static int qb_4_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, }; - static int qb_4_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, }; - static int qb_4_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, }; - static int qb_5_0[] = { 198, 209, 220, 231, 242, }; - static int qb_5_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, }; - static int qb_5_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, }; - static int qb_5_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, }; - static int qb_5_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, }; - static int qb_5_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, }; - static int qb_5_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, }; - static int qb_5_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, }; - static int qb_5_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, }; - static int qb_5_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, }; - static int qb_5_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, }; - static int qb_6_0[] = { 198, 209, 220, 231, 242, 253, }; - static int qb_6_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, }; - static int qb_6_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, }; - static int qb_6_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, }; - static int qb_6_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, }; - static int qb_6_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, }; - static int qb_6_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, }; - static int qb_6_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, }; - static int qb_6_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, }; - static int qb_6_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, }; - static int qb_6_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, }; - static int qb_7_0[] = { 198, 209, 220, 231, 242, 253, 264, }; - static int qb_7_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, }; - static int qb_7_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, }; - static int qb_7_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, }; - static int qb_7_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, }; - static int qb_7_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, }; - static int qb_7_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, }; - static int qb_7_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, }; - static int qb_7_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, }; - static int qb_7_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, }; - static int qb_7_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, }; - static int qb_8_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, }; - static int qb_8_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, }; - static int qb_8_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, }; - static int qb_8_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, }; - static int qb_8_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, }; - static int qb_8_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, }; - static int qb_8_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, }; - static int qb_8_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, }; - static int qb_8_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, }; - static int qb_8_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, }; - static int qb_8_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, }; - static int qb_9_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, 286, }; - static int qb_9_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, 286, 178, 287, }; - static int qb_9_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, 286, 178, 287, 179, 288, }; - static int qb_9_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, 286, 178, 287, 179, 288, 180, 289, }; - static int qb_9_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, 286, 178, 287, 179, 288, 180, 289, 181, 290, }; - static int qb_9_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, }; - static int qb_9_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, }; - static int qb_9_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, }; - static int qb_9_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, }; - static int qb_9_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, }; - static int qb_9_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 187, 296, }; - static int qb_10_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, }; - static int qb_10_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, 286, 178, 287, 297, 188, 298, }; - static int qb_10_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, 286, 178, 287, 179, 288, 297, 188, 298, 189, 299, }; - static int qb_10_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, 286, 178, 287, 179, 288, 180, 289, 297, 188, 298, 189, 299, 190, 300, }; - static int qb_10_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, 286, 178, 287, 179, 288, 180, 289, 181, 290, 297, 188, 298, 189, 299, 190, 300, 191, 301, }; - static int qb_10_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, }; - static int qb_10_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, }; - static int qb_10_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, }; - static int qb_10_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, }; - static int qb_10_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, 196, 306, }; - static int qb_10_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 187, 296, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, 196, 306, 197, 307, }; - - #define nullptr16 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - - static int* gradleg_quad_bubble_indices[] = - { - nullptr, qb_0_1, qb_0_2, qb_0_3, qb_0_4, qb_0_5, qb_0_6, qb_0_7, qb_0_8, qb_0_9, qb_0_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_1_0, qb_1_1, qb_1_2, qb_1_3, qb_1_4, qb_1_5, qb_1_6, qb_1_7, qb_1_8, qb_1_9, qb_1_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_2_0, qb_2_1, qb_2_2, qb_2_3, qb_2_4, qb_2_5, qb_2_6, qb_2_7, qb_2_8, qb_2_9, qb_2_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_3_0, qb_3_1, qb_3_2, qb_3_3, qb_3_4, qb_3_5, qb_3_6, qb_3_7, qb_3_8, qb_3_9, qb_3_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_4_0, qb_4_1, qb_4_2, qb_4_3, qb_4_4, qb_4_5, qb_4_6, qb_4_7, qb_4_8, qb_4_9, qb_4_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_5_0, qb_5_1, qb_5_2, qb_5_3, qb_5_4, qb_5_5, qb_5_6, qb_5_7, qb_5_8, qb_5_9, qb_5_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_6_0, qb_6_1, qb_6_2, qb_6_3, qb_6_4, qb_6_5, qb_6_6, qb_6_7, qb_6_8, qb_6_9, qb_6_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_7_0, qb_7_1, qb_7_2, qb_7_3, qb_7_4, qb_7_5, qb_7_6, qb_7_7, qb_7_8, qb_7_9, qb_7_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_8_0, qb_8_1, qb_8_2, qb_8_3, qb_8_4, qb_8_5, qb_8_6, qb_8_7, qb_8_8, qb_8_9, qb_8_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_9_0, qb_9_1, qb_9_2, qb_9_3, qb_9_4, qb_9_5, qb_9_6, qb_9_7, qb_9_8, qb_9_9, qb_9_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_10_0, qb_10_1, qb_10_2, qb_10_3, qb_10_4, qb_10_5, qb_10_6, qb_10_7, qb_10_8, qb_10_9, qb_10_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + gradleg_quad_p0p2_b1_by, gradleg_quad_p0p3_b1_by, gradleg_quad_p0p4_b1_by, gradleg_quad_p0p5_b1_by, gradleg_quad_p0p6_b1_by, gradleg_quad_p0p7_b1_by, gradleg_quad_p0p8_b1_by, gradleg_quad_p0p9_b1_by, gradleg_quad_p0p10_b1_by, gradleg_quad_p0p11_b1_by, gradleg_quad_p1p2_b1_by, gradleg_quad_p1p3_b1_by, gradleg_quad_p1p4_b1_by, gradleg_quad_p1p5_b1_by, gradleg_quad_p1p6_b1_by, gradleg_quad_p1p7_b1_by, gradleg_quad_p1p8_b1_by, gradleg_quad_p1p9_b1_by, gradleg_quad_p1p10_b1_by, gradleg_quad_p1p11_b1_by, gradleg_quad_p2p2_b1_by, gradleg_quad_p2p3_b1_by, gradleg_quad_p2p4_b1_by, gradleg_quad_p2p5_b1_by, gradleg_quad_p2p6_b1_by, gradleg_quad_p2p7_b1_by, gradleg_quad_p2p8_b1_by, gradleg_quad_p2p9_b1_by, gradleg_quad_p2p10_b1_by, gradleg_quad_p2p11_b1_by, gradleg_quad_p3p2_b1_by, gradleg_quad_p3p3_b1_by, gradleg_quad_p3p4_b1_by, gradleg_quad_p3p5_b1_by, gradleg_quad_p3p6_b1_by, gradleg_quad_p3p7_b1_by, gradleg_quad_p3p8_b1_by, gradleg_quad_p3p9_b1_by, gradleg_quad_p3p10_b1_by, gradleg_quad_p3p11_b1_by, gradleg_quad_p4p2_b1_by, gradleg_quad_p4p3_b1_by, gradleg_quad_p4p4_b1_by, gradleg_quad_p4p5_b1_by, gradleg_quad_p4p6_b1_by, gradleg_quad_p4p7_b1_by, gradleg_quad_p4p8_b1_by, gradleg_quad_p4p9_b1_by, gradleg_quad_p4p10_b1_by, gradleg_quad_p4p11_b1_by, gradleg_quad_p5p2_b1_by, gradleg_quad_p5p3_b1_by, gradleg_quad_p5p4_b1_by, gradleg_quad_p5p5_b1_by, gradleg_quad_p5p6_b1_by, gradleg_quad_p5p7_b1_by, gradleg_quad_p5p8_b1_by, gradleg_quad_p5p9_b1_by, gradleg_quad_p5p10_b1_by, gradleg_quad_p5p11_b1_by, gradleg_quad_p6p2_b1_by, gradleg_quad_p6p3_b1_by, gradleg_quad_p6p4_b1_by, gradleg_quad_p6p5_b1_by, gradleg_quad_p6p6_b1_by, gradleg_quad_p6p7_b1_by, gradleg_quad_p6p8_b1_by, gradleg_quad_p6p9_b1_by, gradleg_quad_p6p10_b1_by, gradleg_quad_p6p11_b1_by, gradleg_quad_p7p2_b1_by, gradleg_quad_p7p3_b1_by, gradleg_quad_p7p4_b1_by, gradleg_quad_p7p5_b1_by, gradleg_quad_p7p6_b1_by, gradleg_quad_p7p7_b1_by, gradleg_quad_p7p8_b1_by, gradleg_quad_p7p9_b1_by, gradleg_quad_p7p10_b1_by, gradleg_quad_p7p11_b1_by, gradleg_quad_p8p2_b1_by, gradleg_quad_p8p3_b1_by, gradleg_quad_p8p4_b1_by, gradleg_quad_p8p5_b1_by, gradleg_quad_p8p6_b1_by, gradleg_quad_p8p7_b1_by, gradleg_quad_p8p8_b1_by, gradleg_quad_p8p9_b1_by, gradleg_quad_p8p10_b1_by, gradleg_quad_p8p11_b1_by, gradleg_quad_p9p2_b1_by, gradleg_quad_p9p3_b1_by, gradleg_quad_p9p4_b1_by, gradleg_quad_p9p5_b1_by, gradleg_quad_p9p6_b1_by, gradleg_quad_p9p7_b1_by, gradleg_quad_p9p8_b1_by, gradleg_quad_p9p9_b1_by, gradleg_quad_p9p10_b1_by, gradleg_quad_p9p11_b1_by, gradleg_quad_p10p2_b1_by, gradleg_quad_p10p3_b1_by, gradleg_quad_p10p4_b1_by, gradleg_quad_p10p5_b1_by, gradleg_quad_p10p6_b1_by, gradleg_quad_p10p7_b1_by, gradleg_quad_p10p8_b1_by, gradleg_quad_p10p9_b1_by, gradleg_quad_p10p10_b1_by, gradleg_quad_p10p11_b1_by, gradleg_quad_p2p0_b2_by, gradleg_quad_p2p1_b2_by, gradleg_quad_p2p2_b2_by, gradleg_quad_p2p3_b2_by, gradleg_quad_p2p4_b2_by, gradleg_quad_p2p5_b2_by, gradleg_quad_p2p6_b2_by, gradleg_quad_p2p7_b2_by, gradleg_quad_p2p8_b2_by, gradleg_quad_p2p9_b2_by, gradleg_quad_p2p10_b2_by, gradleg_quad_p3p0_b2_by, gradleg_quad_p3p1_b2_by, gradleg_quad_p3p2_b2_by, gradleg_quad_p3p3_b2_by, gradleg_quad_p3p4_b2_by, gradleg_quad_p3p5_b2_by, gradleg_quad_p3p6_b2_by, gradleg_quad_p3p7_b2_by, gradleg_quad_p3p8_b2_by, gradleg_quad_p3p9_b2_by, gradleg_quad_p3p10_b2_by, gradleg_quad_p4p0_b2_by, gradleg_quad_p4p1_b2_by, gradleg_quad_p4p2_b2_by, gradleg_quad_p4p3_b2_by, gradleg_quad_p4p4_b2_by, gradleg_quad_p4p5_b2_by, gradleg_quad_p4p6_b2_by, gradleg_quad_p4p7_b2_by, gradleg_quad_p4p8_b2_by, gradleg_quad_p4p9_b2_by, gradleg_quad_p4p10_b2_by, gradleg_quad_p5p0_b2_by, gradleg_quad_p5p1_b2_by, gradleg_quad_p5p2_b2_by, gradleg_quad_p5p3_b2_by, gradleg_quad_p5p4_b2_by, gradleg_quad_p5p5_b2_by, gradleg_quad_p5p6_b2_by, gradleg_quad_p5p7_b2_by, gradleg_quad_p5p8_b2_by, gradleg_quad_p5p9_b2_by, gradleg_quad_p5p10_b2_by, gradleg_quad_p6p0_b2_by, gradleg_quad_p6p1_b2_by, gradleg_quad_p6p2_b2_by, gradleg_quad_p6p3_b2_by, gradleg_quad_p6p4_b2_by, gradleg_quad_p6p5_b2_by, gradleg_quad_p6p6_b2_by, gradleg_quad_p6p7_b2_by, gradleg_quad_p6p8_b2_by, gradleg_quad_p6p9_b2_by, gradleg_quad_p6p10_b2_by, gradleg_quad_p7p0_b2_by, gradleg_quad_p7p1_b2_by, gradleg_quad_p7p2_b2_by, gradleg_quad_p7p3_b2_by, gradleg_quad_p7p4_b2_by, gradleg_quad_p7p5_b2_by, gradleg_quad_p7p6_b2_by, gradleg_quad_p7p7_b2_by, gradleg_quad_p7p8_b2_by, gradleg_quad_p7p9_b2_by, gradleg_quad_p7p10_b2_by, gradleg_quad_p8p0_b2_by, gradleg_quad_p8p1_b2_by, gradleg_quad_p8p2_b2_by, gradleg_quad_p8p3_b2_by, gradleg_quad_p8p4_b2_by, gradleg_quad_p8p5_b2_by, gradleg_quad_p8p6_b2_by, gradleg_quad_p8p7_b2_by, gradleg_quad_p8p8_b2_by, gradleg_quad_p8p9_b2_by, gradleg_quad_p8p10_b2_by, gradleg_quad_p9p0_b2_by, gradleg_quad_p9p1_b2_by, gradleg_quad_p9p2_b2_by, gradleg_quad_p9p3_b2_by, gradleg_quad_p9p4_b2_by, gradleg_quad_p9p5_b2_by, gradleg_quad_p9p6_b2_by, gradleg_quad_p9p7_b2_by, gradleg_quad_p9p8_b2_by, gradleg_quad_p9p9_b2_by, gradleg_quad_p9p10_b2_by, gradleg_quad_p10p0_b2_by, gradleg_quad_p10p1_b2_by, gradleg_quad_p10p2_b2_by, gradleg_quad_p10p3_b2_by, gradleg_quad_p10p4_b2_by, gradleg_quad_p10p5_b2_by, gradleg_quad_p10p6_b2_by, gradleg_quad_p10p7_b2_by, gradleg_quad_p10p8_b2_by, gradleg_quad_p10p9_b2_by, gradleg_quad_p10p10_b2_by, gradleg_quad_p11p0_b2_by, gradleg_quad_p11p1_b2_by, gradleg_quad_p11p2_b2_by, gradleg_quad_p11p3_b2_by, gradleg_quad_p11p4_b2_by, gradleg_quad_p11p5_b2_by, gradleg_quad_p11p6_b2_by, gradleg_quad_p11p7_b2_by, gradleg_quad_p11p8_b2_by, gradleg_quad_p11p9_b2_by, gradleg_quad_p11p10_b2_by, }; + + static short qb_0_1[] = { 88, }; + static short qb_0_2[] = { 88, 89, }; + static short qb_0_3[] = { 88, 89, 90, }; + static short qb_0_4[] = { 88, 89, 90, 91, }; + static short qb_0_5[] = { 88, 89, 90, 91, 92, }; + static short qb_0_6[] = { 88, 89, 90, 91, 92, 93, }; + static short qb_0_7[] = { 88, 89, 90, 91, 92, 93, 94, }; + static short qb_0_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, }; + static short qb_0_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, }; + static short qb_0_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, }; + static short qb_1_0[] = { 198, }; + static short qb_1_1[] = { 88, 198, 98, 199, }; + static short qb_1_2[] = { 88, 89, 198, 98, 199, 99, 200, }; + static short qb_1_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, }; + static short qb_1_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, }; + static short qb_1_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, }; + static short qb_1_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, }; + static short qb_1_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, }; + static short qb_1_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, }; + static short qb_1_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, }; + static short qb_1_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, }; + static short qb_2_0[] = { 198, 209, }; + static short qb_2_1[] = { 88, 198, 98, 199, 209, 108, 210, }; + static short qb_2_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, }; + static short qb_2_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, }; + static short qb_2_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, }; + static short qb_2_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, }; + static short qb_2_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, }; + static short qb_2_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, }; + static short qb_2_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, }; + static short qb_2_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, }; + static short qb_2_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, }; + static short qb_3_0[] = { 198, 209, 220, }; + static short qb_3_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, }; + static short qb_3_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, }; + static short qb_3_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, }; + static short qb_3_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, }; + static short qb_3_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, }; + static short qb_3_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, }; + static short qb_3_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, }; + static short qb_3_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, }; + static short qb_3_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, }; + static short qb_3_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, }; + static short qb_4_0[] = { 198, 209, 220, 231, }; + static short qb_4_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, }; + static short qb_4_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, }; + static short qb_4_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, }; + static short qb_4_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, }; + static short qb_4_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, }; + static short qb_4_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, }; + static short qb_4_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, }; + static short qb_4_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, }; + static short qb_4_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, }; + static short qb_4_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, }; + static short qb_5_0[] = { 198, 209, 220, 231, 242, }; + static short qb_5_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, }; + static short qb_5_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, }; + static short qb_5_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, }; + static short qb_5_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, }; + static short qb_5_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, }; + static short qb_5_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, }; + static short qb_5_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, }; + static short qb_5_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, }; + static short qb_5_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, }; + static short qb_5_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, }; + static short qb_6_0[] = { 198, 209, 220, 231, 242, 253, }; + static short qb_6_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, }; + static short qb_6_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, }; + static short qb_6_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, }; + static short qb_6_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, }; + static short qb_6_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, }; + static short qb_6_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, }; + static short qb_6_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, }; + static short qb_6_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, }; + static short qb_6_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, }; + static short qb_6_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, }; + static short qb_7_0[] = { 198, 209, 220, 231, 242, 253, 264, }; + static short qb_7_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, }; + static short qb_7_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, }; + static short qb_7_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, }; + static short qb_7_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, }; + static short qb_7_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, }; + static short qb_7_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, }; + static short qb_7_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, }; + static short qb_7_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, }; + static short qb_7_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, }; + static short qb_7_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, }; + static short qb_8_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, }; + static short qb_8_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, }; + static short qb_8_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, }; + static short qb_8_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, }; + static short qb_8_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, }; + static short qb_8_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, }; + static short qb_8_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, }; + static short qb_8_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, }; + static short qb_8_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, }; + static short qb_8_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, }; + static short qb_8_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, }; + static short qb_9_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, 286, }; + static short qb_9_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, 286, 178, 287, }; + static short qb_9_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, 286, 178, 287, 179, 288, }; + static short qb_9_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, 286, 178, 287, 179, 288, 180, 289, }; + static short qb_9_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, 286, 178, 287, 179, 288, 180, 289, 181, 290, }; + static short qb_9_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, }; + static short qb_9_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, }; + static short qb_9_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, }; + static short qb_9_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, }; + static short qb_9_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, }; + static short qb_9_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 187, 296, }; + static short qb_10_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, }; + static short qb_10_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, 286, 178, 287, 297, 188, 298, }; + static short qb_10_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, 286, 178, 287, 179, 288, 297, 188, 298, 189, 299, }; + static short qb_10_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, 286, 178, 287, 179, 288, 180, 289, 297, 188, 298, 189, 299, 190, 300, }; + static short qb_10_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, 286, 178, 287, 179, 288, 180, 289, 181, 290, 297, 188, 298, 189, 299, 190, 300, 191, 301, }; + static short qb_10_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, }; + static short qb_10_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, }; + static short qb_10_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, }; + static short qb_10_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, }; + static short qb_10_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, 196, 306, }; + static short qb_10_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 187, 296, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, 196, 306, 197, 307, }; + +#define nullptr16 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + + static short* gradleg_quad_bubble_indices[] = + { + nullptr, qb_0_1, qb_0_2, qb_0_3, qb_0_4, qb_0_5, qb_0_6, qb_0_7, qb_0_8, qb_0_9, qb_0_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_1_0, qb_1_1, qb_1_2, qb_1_3, qb_1_4, qb_1_5, qb_1_6, qb_1_7, qb_1_8, qb_1_9, qb_1_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_2_0, qb_2_1, qb_2_2, qb_2_3, qb_2_4, qb_2_5, qb_2_6, qb_2_7, qb_2_8, qb_2_9, qb_2_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_3_0, qb_3_1, qb_3_2, qb_3_3, qb_3_4, qb_3_5, qb_3_6, qb_3_7, qb_3_8, qb_3_9, qb_3_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_4_0, qb_4_1, qb_4_2, qb_4_3, qb_4_4, qb_4_5, qb_4_6, qb_4_7, qb_4_8, qb_4_9, qb_4_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_5_0, qb_5_1, qb_5_2, qb_5_3, qb_5_4, qb_5_5, qb_5_6, qb_5_7, qb_5_8, qb_5_9, qb_5_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_6_0, qb_6_1, qb_6_2, qb_6_3, qb_6_4, qb_6_5, qb_6_6, qb_6_7, qb_6_8, qb_6_9, qb_6_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_7_0, qb_7_1, qb_7_2, qb_7_3, qb_7_4, qb_7_5, qb_7_6, qb_7_7, qb_7_8, qb_7_9, qb_7_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_8_0, qb_8_1, qb_8_2, qb_8_3, qb_8_4, qb_8_5, qb_8_6, qb_8_7, qb_8_8, qb_8_9, qb_8_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_9_0, qb_9_1, qb_9_2, qb_9_3, qb_9_4, qb_9_5, qb_9_6, qb_9_7, qb_9_8, qb_9_9, qb_9_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_10_0, qb_10_1, qb_10_2, qb_10_3, qb_10_4, qb_10_5, qb_10_6, qb_10_7, qb_10_8, qb_10_9, qb_10_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 }; - #define zero16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - static int gradleg_quad_bubble_count[] = - { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, zero16 - 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 0, 0, 0, 0, 0, zero16 - 2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 0, 0, 0, 0, 0, zero16 - 3, 10, 17, 24, 31, 38, 45, 52, 59, 66, 73, 0, 0, 0, 0, 0, zero16 - 4, 13, 22, 31, 40, 49, 58, 67, 76, 85, 94, 0, 0, 0, 0, 0, zero16 - 5, 16, 27, 38, 49, 60, 71, 82, 93, 104, 115, 0, 0, 0, 0, 0, zero16 - 6, 19, 32, 45, 58, 71, 84, 97, 110, 123, 136, 0, 0, 0, 0, 0, zero16 - 7, 22, 37, 52, 67, 82, 97, 112, 127, 142, 157, 0, 0, 0, 0, 0, zero16 - 8, 25, 42, 59, 76, 93, 110, 127, 144, 161, 178, 0, 0, 0, 0, 0, zero16 - 9, 28, 47, 66, 85, 104, 123, 142, 161, 180, 199, 0, 0, 0, 0, 0, zero16 - 10, 31, 52, 73, 94, 115, 136, 157, 178, 199, 220, 0, 0, 0, 0, 0, zero16 +#define zero16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + static unsigned short gradleg_quad_bubble_count[] = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, zero16 + 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 0, 0, 0, 0, 0, zero16 + 2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 0, 0, 0, 0, 0, zero16 + 3, 10, 17, 24, 31, 38, 45, 52, 59, 66, 73, 0, 0, 0, 0, 0, zero16 + 4, 13, 22, 31, 40, 49, 58, 67, 76, 85, 94, 0, 0, 0, 0, 0, zero16 + 5, 16, 27, 38, 49, 60, 71, 82, 93, 104, 115, 0, 0, 0, 0, 0, zero16 + 6, 19, 32, 45, 58, 71, 84, 97, 110, 123, 136, 0, 0, 0, 0, 0, zero16 + 7, 22, 37, 52, 67, 82, 97, 112, 127, 142, 157, 0, 0, 0, 0, 0, zero16 + 8, 25, 42, 59, 76, 93, 110, 127, 144, 161, 178, 0, 0, 0, 0, 0, zero16 + 9, 28, 47, 66, 85, 104, 123, 142, 161, 180, 199, 0, 0, 0, 0, 0, zero16 + 10, 31, 52, 73, 94, 115, 136, 157, 178, 199, 220, 0, 0, 0, 0, 0, zero16 }; - static int gradleg_quad_vertex_indices[4] ={-1, -1, -1, -1}; + static short gradleg_quad_vertex_indices[4] = { -1, -1, -1, -1 }; - static int gradleg_quad_edge_indices_0[] = { 0, 1, 8, 9, 16, 17, 24, 25, 32, 33, 40, 41, 48, 49, 56, 57, 64, 65, 72, 73, 80, 81, }; + static short gradleg_quad_edge_indices_0[] = { 0, 1, 8, 9, 16, 17, 24, 25, 32, 33, 40, 41, 48, 49, 56, 57, 64, 65, 72, 73, 80, 81, }; - static int gradleg_quad_edge_indices_1[] = { 2, 3, 10, 11, 18, 19, 26, 27, 34, 35, 42, 43, 50, 51, 58, 59, 66, 67, 74, 75, 82, 83, }; + static short gradleg_quad_edge_indices_1[] = { 2, 3, 10, 11, 18, 19, 26, 27, 34, 35, 42, 43, 50, 51, 58, 59, 66, 67, 74, 75, 82, 83, }; - static int gradleg_quad_edge_indices_2[] = { 4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, 52, 53, 60, 61, 68, 69, 76, 77, 84, 85, }; + static short gradleg_quad_edge_indices_2[] = { 4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, 52, 53, 60, 61, 68, 69, 76, 77, 84, 85, }; - static int gradleg_quad_edge_indices_3[] = { 6, 7, 14, 15, 22, 23, 30, 31, 38, 39, 46, 47, 54, 55, 62, 63, 70, 71, 78, 79, 86, 87, }; + static short gradleg_quad_edge_indices_3[] = { 6, 7, 14, 15, 22, 23, 30, 31, 38, 39, 46, 47, 54, 55, 62, 63, 70, 71, 78, 79, 86, 87, }; - static int* gradleg_quad_edge_indices[4] = + static short* gradleg_quad_edge_indices[4] = { gradleg_quad_edge_indices_0, gradleg_quad_edge_indices_1, @@ -15690,9 +15690,9 @@ namespace Hermes gradleg_quad_edge_indices_3, }; - #define oo H2D_MAKE_QUAD_ORDER +#define oo H2D_MAKE_QUAD_ORDER - static int gradleg_quad_index_to_order[] = + static unsigned short gradleg_quad_index_to_order[] = { oo(0, 1), oo(0, 1), oo(1, 0), oo(1, 0), oo(0, 1), oo(0, 1), oo(1, 0), oo(1, 0), oo(2, 1), oo(2, 1), oo(1, 2), oo(1, 2), oo(2, 1), oo(2, 1), oo(1, 2), oo(1, 2), @@ -15706,7 +15706,7 @@ namespace Hermes oo(10, 1), oo(10, 1), oo(1, 10), oo(1, 10), oo(10, 1), oo(10, 1), oo(1, 10), oo(1, 10), oo(11, 1), oo(11, 1), oo(1, 11), oo(1, 11), oo(11, 1), oo(11, 1), oo(1, 11), oo(1, 11), - oo(0, 2), oo(0, 3), oo(0, 4), oo(0, 5), oo(0, 6), oo(0, 7), oo(0, 8), oo(0, 9), oo(0, 10), oo(0, 11), oo(1, 2), oo(1, 3), oo(1, 4), oo(1, 5), oo(1, 6), oo(1, 7), oo(1, 8), oo(1, 9), oo(1, 10), oo(1, 11), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), oo(2, 11), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), oo(3, 11), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), oo(4, 11), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), oo(5, 11), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), oo(6, 11), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), oo(7, 11), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), oo(8, 11), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), oo(9, 11), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), oo(10, 11), oo(2, 0), oo(2, 1), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), oo(3, 0), oo(3, 1), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), oo(4, 0), oo(4, 1), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), oo(5, 0), oo(5, 1), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), oo(6, 0), oo(6, 1), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), oo(7, 0), oo(7, 1), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), oo(8, 0), oo(8, 1), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), oo(9, 0), oo(9, 1), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), oo(10, 0), oo(10, 1), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), oo(11, 0), oo(11, 1), oo(11, 2), oo(11, 3), oo(11, 4), oo(11, 5), oo(11, 6), oo(11, 7), oo(11, 8), oo(11, 9), oo(11, 10), + oo(0, 2), oo(0, 3), oo(0, 4), oo(0, 5), oo(0, 6), oo(0, 7), oo(0, 8), oo(0, 9), oo(0, 10), oo(0, 11), oo(1, 2), oo(1, 3), oo(1, 4), oo(1, 5), oo(1, 6), oo(1, 7), oo(1, 8), oo(1, 9), oo(1, 10), oo(1, 11), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), oo(2, 11), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), oo(3, 11), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), oo(4, 11), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), oo(5, 11), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), oo(6, 11), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), oo(7, 11), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), oo(8, 11), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), oo(9, 11), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), oo(10, 11), oo(2, 0), oo(2, 1), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), oo(3, 0), oo(3, 1), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), oo(4, 0), oo(4, 1), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), oo(5, 0), oo(5, 1), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), oo(6, 0), oo(6, 1), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), oo(7, 0), oo(7, 1), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), oo(8, 0), oo(8, 1), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), oo(9, 0), oo(9, 1), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), oo(10, 0), oo(10, 1), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), oo(11, 0), oo(11, 1), oo(11, 2), oo(11, 3), oo(11, 4), oo(11, 5), oo(11, 6), oo(11, 7), oo(11, 8), oo(11, 9), oo(11, 10), }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -15749,31 +15749,31 @@ namespace Hermes gradleg_quad_shape_fn_table_y }; - static int* gradleg_vertex_indices[2] = + static short* gradleg_vertex_indices[2] = { gradleg_tri_vertex_indices, gradleg_quad_vertex_indices }; - static int** gradleg_edge_indices[2] = + static short** gradleg_edge_indices[2] = { gradleg_tri_edge_indices, gradleg_quad_edge_indices }; - static int** gradleg_bubble_indices[2] = + static short** gradleg_bubble_indices[2] = { gradleg_tri_bubble_indices, gradleg_quad_bubble_indices }; - static int* gradleg_bubble_count[2] = + static unsigned short* gradleg_bubble_count[2] = { gradleg_tri_bubble_count, gradleg_quad_bubble_count }; - static int* gradleg_index_to_order[2] = + static unsigned short* gradleg_index_to_order[2] = { gradleg_tri_index_to_order, gradleg_quad_index_to_order @@ -15783,26 +15783,26 @@ namespace Hermes { for (int i = 1; i <= 10; i++) { - int nb = shapeset->get_num_bubbles(i, HERMES_MODE_TRIANGLE); - if(nb != 3*(i-1) + (i-1)*(i-2)) + unsigned short nb = shapeset->get_num_bubbles(i, HERMES_MODE_TRIANGLE); + if (nb != 3 * (i - 1) + (i - 1)*(i - 2)) throw Hermes::Exceptions::Exception("Wrong bubble count"); } - int size_a = sizeof(gradleg_tri_fn_a) / sizeof(Shapeset::shape_fn_t); - int size_b = sizeof(gradleg_tri_fn_b) / sizeof(Shapeset::shape_fn_t); - int size_ax = sizeof(gradleg_tri_fn_ax) / sizeof(Shapeset::shape_fn_t); - int size_bx = sizeof(gradleg_tri_fn_bx) / sizeof(Shapeset::shape_fn_t); - int size_ay = sizeof(gradleg_tri_fn_ay) / sizeof(Shapeset::shape_fn_t); - int size_by = sizeof(gradleg_tri_fn_by) / sizeof(Shapeset::shape_fn_t); + unsigned short size_a = sizeof(gradleg_tri_fn_a) / sizeof(Shapeset::shape_fn_t); + unsigned short size_b = sizeof(gradleg_tri_fn_b) / sizeof(Shapeset::shape_fn_t); + unsigned short size_ax = sizeof(gradleg_tri_fn_ax) / sizeof(Shapeset::shape_fn_t); + unsigned short size_bx = sizeof(gradleg_tri_fn_bx) / sizeof(Shapeset::shape_fn_t); + unsigned short size_ay = sizeof(gradleg_tri_fn_ay) / sizeof(Shapeset::shape_fn_t); + unsigned short size_by = sizeof(gradleg_tri_fn_by) / sizeof(Shapeset::shape_fn_t); - if(size_a != size_b || size_a != size_ax || size_a != size_bx || size_a != size_ay || size_a != size_by) + if (size_a != size_b || size_a != size_ax || size_a != size_bx || size_a != size_ay || size_a != size_by) throw Hermes::Exceptions::Exception("Function tables dont have equal length."); - if(size_a != gradleg_tri_bubble_indices[10][gradleg_tri_bubble_count[10]-1] + 1) + if (size_a != gradleg_tri_bubble_indices[10][gradleg_tri_bubble_count[10] - 1] + 1) throw Hermes::Exceptions::Exception("Bad index of last bubble"); } - int HcurlShapesetGradLeg::get_max_index(ElementMode2D mode) const { return max_index[mode]; } + unsigned short HcurlShapesetGradLeg::get_max_index(ElementMode2D mode) const { return max_index[mode]; } HcurlShapesetGradLeg::HcurlShapesetGradLeg() { @@ -15821,19 +15821,19 @@ namespace Hermes ref_vert[0][0][0] = -1.0; ref_vert[0][0][1] = -1.0; - ref_vert[0][1][0] = 1.0; + ref_vert[0][1][0] = 1.0; ref_vert[0][1][1] = -1.0; ref_vert[0][2][0] = -1.0; - ref_vert[0][2][1] = 1.0; + ref_vert[0][2][1] = 1.0; ref_vert[1][0][0] = -1.0; ref_vert[1][0][1] = -1.0; - ref_vert[1][1][0] = 1.0; + ref_vert[1][1][0] = 1.0; ref_vert[1][1][1] = -1.0; - ref_vert[1][2][0] = 1.0; - ref_vert[1][2][1] = 1.0; + ref_vert[1][2][0] = 1.0; + ref_vert[1][2][1] = 1.0; ref_vert[1][3][0] = -1.0; - ref_vert[1][3][1] = 1.0; + ref_vert[1][3][1] = 1.0; max_order = 10; min_order = 0; @@ -15846,6 +15846,6 @@ namespace Hermes check_gradleg_tri(this); } - const int HcurlShapesetGradLeg::max_index[2] = { 164, 307 }; + const unsigned short HcurlShapesetGradLeg::max_index[2] = { 164, 307 }; } } \ No newline at end of file diff --git a/hermes2d/src/shapeset/shapeset_hd_legendre.cpp b/hermes2d/src/shapeset/shapeset_hd_legendre.cpp index 085a310fc5..2f01caacce 100644 --- a/hermes2d/src/shapeset/shapeset_hd_legendre.cpp +++ b/hermes2d/src/shapeset/shapeset_hd_legendre.cpp @@ -8332,7 +8332,7 @@ namespace Hermes static Shapeset::shape_fn_t hdiv_leg_quad_fn_a[] = { - hdiv_leg_quad_p0_e1_a_0, hdiv_leg_quad_p0_e1_a_1, hdiv_leg_quad_p0_e2_a_0, hdiv_leg_quad_p0_e2_a_1, hdiv_leg_quad_p0_e3_a, hdiv_leg_quad_p0_e3_a, hdiv_leg_quad_p0_e4_a, hdiv_leg_quad_p0_e4_a, + hdiv_leg_quad_p0_e1_a_0, hdiv_leg_quad_p0_e1_a_1, hdiv_leg_quad_p0_e2_a_0, hdiv_leg_quad_p0_e2_a_1, hdiv_leg_quad_p0_e3_a, hdiv_leg_quad_p0_e3_a, hdiv_leg_quad_p0_e4_a, hdiv_leg_quad_p0_e4_a, hdiv_leg_quad_p1_e1_a, hdiv_leg_quad_p1_e1_a, hdiv_leg_quad_p1_e2_a, hdiv_leg_quad_p1_e2_a, hdiv_leg_quad_p1_e3_a, hdiv_leg_quad_p1_e3_a, hdiv_leg_quad_p1_e4_a, hdiv_leg_quad_p1_e4_a, hdiv_leg_quad_p2_e1_a_0, hdiv_leg_quad_p2_e1_a_1, hdiv_leg_quad_p2_e2_a_0, hdiv_leg_quad_p2_e2_a_1, hdiv_leg_quad_p2_e3_a, hdiv_leg_quad_p2_e3_a, hdiv_leg_quad_p2_e4_a, hdiv_leg_quad_p2_e4_a, hdiv_leg_quad_p3_e1_a, hdiv_leg_quad_p3_e1_a, hdiv_leg_quad_p3_e2_a, hdiv_leg_quad_p3_e2_a, hdiv_leg_quad_p3_e3_a, hdiv_leg_quad_p3_e3_a, hdiv_leg_quad_p3_e4_a, hdiv_leg_quad_p3_e4_a, @@ -8344,7 +8344,7 @@ namespace Hermes hdiv_leg_quad_p9_e1_a, hdiv_leg_quad_p9_e1_a, hdiv_leg_quad_p9_e2_a, hdiv_leg_quad_p9_e2_a, hdiv_leg_quad_p9_e3_a, hdiv_leg_quad_p9_e3_a, hdiv_leg_quad_p9_e4_a, hdiv_leg_quad_p9_e4_a, hdiv_leg_quad_p10_e1_a_0, hdiv_leg_quad_p10_e1_a_1, hdiv_leg_quad_p10_e2_a_0, hdiv_leg_quad_p10_e2_a_1, hdiv_leg_quad_p10_e3_a, hdiv_leg_quad_p10_e3_a, hdiv_leg_quad_p10_e4_a, hdiv_leg_quad_p10_e4_a, - hdiv_leg_quad_p0p2_b1_a, hdiv_leg_quad_p0p3_b1_a, hdiv_leg_quad_p0p4_b1_a, hdiv_leg_quad_p0p5_b1_a, hdiv_leg_quad_p0p6_b1_a, hdiv_leg_quad_p0p7_b1_a, hdiv_leg_quad_p0p8_b1_a, hdiv_leg_quad_p0p9_b1_a, hdiv_leg_quad_p0p10_b1_a, hdiv_leg_quad_p0p11_b1_a, hdiv_leg_quad_p1p2_b1_a, hdiv_leg_quad_p1p3_b1_a, hdiv_leg_quad_p1p4_b1_a, hdiv_leg_quad_p1p5_b1_a, hdiv_leg_quad_p1p6_b1_a, hdiv_leg_quad_p1p7_b1_a, hdiv_leg_quad_p1p8_b1_a, hdiv_leg_quad_p1p9_b1_a, hdiv_leg_quad_p1p10_b1_a, hdiv_leg_quad_p1p11_b1_a, hdiv_leg_quad_p2p2_b1_a, hdiv_leg_quad_p2p3_b1_a, hdiv_leg_quad_p2p4_b1_a, hdiv_leg_quad_p2p5_b1_a, hdiv_leg_quad_p2p6_b1_a, hdiv_leg_quad_p2p7_b1_a, hdiv_leg_quad_p2p8_b1_a, hdiv_leg_quad_p2p9_b1_a, hdiv_leg_quad_p2p10_b1_a, hdiv_leg_quad_p2p11_b1_a, hdiv_leg_quad_p3p2_b1_a, hdiv_leg_quad_p3p3_b1_a, hdiv_leg_quad_p3p4_b1_a, hdiv_leg_quad_p3p5_b1_a, hdiv_leg_quad_p3p6_b1_a, hdiv_leg_quad_p3p7_b1_a, hdiv_leg_quad_p3p8_b1_a, hdiv_leg_quad_p3p9_b1_a, hdiv_leg_quad_p3p10_b1_a, hdiv_leg_quad_p3p11_b1_a, hdiv_leg_quad_p4p2_b1_a, hdiv_leg_quad_p4p3_b1_a, hdiv_leg_quad_p4p4_b1_a, hdiv_leg_quad_p4p5_b1_a, hdiv_leg_quad_p4p6_b1_a, hdiv_leg_quad_p4p7_b1_a, hdiv_leg_quad_p4p8_b1_a, hdiv_leg_quad_p4p9_b1_a, hdiv_leg_quad_p4p10_b1_a, hdiv_leg_quad_p4p11_b1_a, hdiv_leg_quad_p5p2_b1_a, hdiv_leg_quad_p5p3_b1_a, hdiv_leg_quad_p5p4_b1_a, hdiv_leg_quad_p5p5_b1_a, hdiv_leg_quad_p5p6_b1_a, hdiv_leg_quad_p5p7_b1_a, hdiv_leg_quad_p5p8_b1_a, hdiv_leg_quad_p5p9_b1_a, hdiv_leg_quad_p5p10_b1_a, hdiv_leg_quad_p5p11_b1_a, hdiv_leg_quad_p6p2_b1_a, hdiv_leg_quad_p6p3_b1_a, hdiv_leg_quad_p6p4_b1_a, hdiv_leg_quad_p6p5_b1_a, hdiv_leg_quad_p6p6_b1_a, hdiv_leg_quad_p6p7_b1_a, hdiv_leg_quad_p6p8_b1_a, hdiv_leg_quad_p6p9_b1_a, hdiv_leg_quad_p6p10_b1_a, hdiv_leg_quad_p6p11_b1_a, hdiv_leg_quad_p7p2_b1_a, hdiv_leg_quad_p7p3_b1_a, hdiv_leg_quad_p7p4_b1_a, hdiv_leg_quad_p7p5_b1_a, hdiv_leg_quad_p7p6_b1_a, hdiv_leg_quad_p7p7_b1_a, hdiv_leg_quad_p7p8_b1_a, hdiv_leg_quad_p7p9_b1_a, hdiv_leg_quad_p7p10_b1_a, hdiv_leg_quad_p7p11_b1_a, hdiv_leg_quad_p8p2_b1_a, hdiv_leg_quad_p8p3_b1_a, hdiv_leg_quad_p8p4_b1_a, hdiv_leg_quad_p8p5_b1_a, hdiv_leg_quad_p8p6_b1_a, hdiv_leg_quad_p8p7_b1_a, hdiv_leg_quad_p8p8_b1_a, hdiv_leg_quad_p8p9_b1_a, hdiv_leg_quad_p8p10_b1_a, hdiv_leg_quad_p8p11_b1_a, hdiv_leg_quad_p9p2_b1_a, hdiv_leg_quad_p9p3_b1_a, hdiv_leg_quad_p9p4_b1_a, hdiv_leg_quad_p9p5_b1_a, hdiv_leg_quad_p9p6_b1_a, hdiv_leg_quad_p9p7_b1_a, hdiv_leg_quad_p9p8_b1_a, hdiv_leg_quad_p9p9_b1_a, hdiv_leg_quad_p9p10_b1_a, hdiv_leg_quad_p9p11_b1_a, hdiv_leg_quad_p10p2_b1_a, hdiv_leg_quad_p10p3_b1_a, hdiv_leg_quad_p10p4_b1_a, hdiv_leg_quad_p10p5_b1_a, hdiv_leg_quad_p10p6_b1_a, hdiv_leg_quad_p10p7_b1_a, hdiv_leg_quad_p10p8_b1_a, hdiv_leg_quad_p10p9_b1_a, hdiv_leg_quad_p10p10_b1_a, hdiv_leg_quad_p10p11_b1_a, hdiv_leg_quad_p2p0_b2_a, hdiv_leg_quad_p2p1_b2_a, hdiv_leg_quad_p2p2_b2_a, hdiv_leg_quad_p2p3_b2_a, hdiv_leg_quad_p2p4_b2_a, hdiv_leg_quad_p2p5_b2_a, hdiv_leg_quad_p2p6_b2_a, hdiv_leg_quad_p2p7_b2_a, hdiv_leg_quad_p2p8_b2_a, hdiv_leg_quad_p2p9_b2_a, hdiv_leg_quad_p2p10_b2_a, hdiv_leg_quad_p3p0_b2_a, hdiv_leg_quad_p3p1_b2_a, hdiv_leg_quad_p3p2_b2_a, hdiv_leg_quad_p3p3_b2_a, hdiv_leg_quad_p3p4_b2_a, hdiv_leg_quad_p3p5_b2_a, hdiv_leg_quad_p3p6_b2_a, hdiv_leg_quad_p3p7_b2_a, hdiv_leg_quad_p3p8_b2_a, hdiv_leg_quad_p3p9_b2_a, hdiv_leg_quad_p3p10_b2_a, hdiv_leg_quad_p4p0_b2_a, hdiv_leg_quad_p4p1_b2_a, hdiv_leg_quad_p4p2_b2_a, hdiv_leg_quad_p4p3_b2_a, hdiv_leg_quad_p4p4_b2_a, hdiv_leg_quad_p4p5_b2_a, hdiv_leg_quad_p4p6_b2_a, hdiv_leg_quad_p4p7_b2_a, hdiv_leg_quad_p4p8_b2_a, hdiv_leg_quad_p4p9_b2_a, hdiv_leg_quad_p4p10_b2_a, hdiv_leg_quad_p5p0_b2_a, hdiv_leg_quad_p5p1_b2_a, hdiv_leg_quad_p5p2_b2_a, hdiv_leg_quad_p5p3_b2_a, hdiv_leg_quad_p5p4_b2_a, hdiv_leg_quad_p5p5_b2_a, hdiv_leg_quad_p5p6_b2_a, hdiv_leg_quad_p5p7_b2_a, hdiv_leg_quad_p5p8_b2_a, hdiv_leg_quad_p5p9_b2_a, hdiv_leg_quad_p5p10_b2_a, hdiv_leg_quad_p6p0_b2_a, hdiv_leg_quad_p6p1_b2_a, hdiv_leg_quad_p6p2_b2_a, hdiv_leg_quad_p6p3_b2_a, hdiv_leg_quad_p6p4_b2_a, hdiv_leg_quad_p6p5_b2_a, hdiv_leg_quad_p6p6_b2_a, hdiv_leg_quad_p6p7_b2_a, hdiv_leg_quad_p6p8_b2_a, hdiv_leg_quad_p6p9_b2_a, hdiv_leg_quad_p6p10_b2_a, hdiv_leg_quad_p7p0_b2_a, hdiv_leg_quad_p7p1_b2_a, hdiv_leg_quad_p7p2_b2_a, hdiv_leg_quad_p7p3_b2_a, hdiv_leg_quad_p7p4_b2_a, hdiv_leg_quad_p7p5_b2_a, hdiv_leg_quad_p7p6_b2_a, hdiv_leg_quad_p7p7_b2_a, hdiv_leg_quad_p7p8_b2_a, hdiv_leg_quad_p7p9_b2_a, hdiv_leg_quad_p7p10_b2_a, hdiv_leg_quad_p8p0_b2_a, hdiv_leg_quad_p8p1_b2_a, hdiv_leg_quad_p8p2_b2_a, hdiv_leg_quad_p8p3_b2_a, hdiv_leg_quad_p8p4_b2_a, hdiv_leg_quad_p8p5_b2_a, hdiv_leg_quad_p8p6_b2_a, hdiv_leg_quad_p8p7_b2_a, hdiv_leg_quad_p8p8_b2_a, hdiv_leg_quad_p8p9_b2_a, hdiv_leg_quad_p8p10_b2_a, hdiv_leg_quad_p9p0_b2_a, hdiv_leg_quad_p9p1_b2_a, hdiv_leg_quad_p9p2_b2_a, hdiv_leg_quad_p9p3_b2_a, hdiv_leg_quad_p9p4_b2_a, hdiv_leg_quad_p9p5_b2_a, hdiv_leg_quad_p9p6_b2_a, hdiv_leg_quad_p9p7_b2_a, hdiv_leg_quad_p9p8_b2_a, hdiv_leg_quad_p9p9_b2_a, hdiv_leg_quad_p9p10_b2_a, hdiv_leg_quad_p10p0_b2_a, hdiv_leg_quad_p10p1_b2_a, hdiv_leg_quad_p10p2_b2_a, hdiv_leg_quad_p10p3_b2_a, hdiv_leg_quad_p10p4_b2_a, hdiv_leg_quad_p10p5_b2_a, hdiv_leg_quad_p10p6_b2_a, hdiv_leg_quad_p10p7_b2_a, hdiv_leg_quad_p10p8_b2_a, hdiv_leg_quad_p10p9_b2_a, hdiv_leg_quad_p10p10_b2_a, hdiv_leg_quad_p11p0_b2_a, hdiv_leg_quad_p11p1_b2_a, hdiv_leg_quad_p11p2_b2_a, hdiv_leg_quad_p11p3_b2_a, hdiv_leg_quad_p11p4_b2_a, hdiv_leg_quad_p11p5_b2_a, hdiv_leg_quad_p11p6_b2_a, hdiv_leg_quad_p11p7_b2_a, hdiv_leg_quad_p11p8_b2_a, hdiv_leg_quad_p11p9_b2_a, hdiv_leg_quad_p11p10_b2_a, }; + hdiv_leg_quad_p0p2_b1_a, hdiv_leg_quad_p0p3_b1_a, hdiv_leg_quad_p0p4_b1_a, hdiv_leg_quad_p0p5_b1_a, hdiv_leg_quad_p0p6_b1_a, hdiv_leg_quad_p0p7_b1_a, hdiv_leg_quad_p0p8_b1_a, hdiv_leg_quad_p0p9_b1_a, hdiv_leg_quad_p0p10_b1_a, hdiv_leg_quad_p0p11_b1_a, hdiv_leg_quad_p1p2_b1_a, hdiv_leg_quad_p1p3_b1_a, hdiv_leg_quad_p1p4_b1_a, hdiv_leg_quad_p1p5_b1_a, hdiv_leg_quad_p1p6_b1_a, hdiv_leg_quad_p1p7_b1_a, hdiv_leg_quad_p1p8_b1_a, hdiv_leg_quad_p1p9_b1_a, hdiv_leg_quad_p1p10_b1_a, hdiv_leg_quad_p1p11_b1_a, hdiv_leg_quad_p2p2_b1_a, hdiv_leg_quad_p2p3_b1_a, hdiv_leg_quad_p2p4_b1_a, hdiv_leg_quad_p2p5_b1_a, hdiv_leg_quad_p2p6_b1_a, hdiv_leg_quad_p2p7_b1_a, hdiv_leg_quad_p2p8_b1_a, hdiv_leg_quad_p2p9_b1_a, hdiv_leg_quad_p2p10_b1_a, hdiv_leg_quad_p2p11_b1_a, hdiv_leg_quad_p3p2_b1_a, hdiv_leg_quad_p3p3_b1_a, hdiv_leg_quad_p3p4_b1_a, hdiv_leg_quad_p3p5_b1_a, hdiv_leg_quad_p3p6_b1_a, hdiv_leg_quad_p3p7_b1_a, hdiv_leg_quad_p3p8_b1_a, hdiv_leg_quad_p3p9_b1_a, hdiv_leg_quad_p3p10_b1_a, hdiv_leg_quad_p3p11_b1_a, hdiv_leg_quad_p4p2_b1_a, hdiv_leg_quad_p4p3_b1_a, hdiv_leg_quad_p4p4_b1_a, hdiv_leg_quad_p4p5_b1_a, hdiv_leg_quad_p4p6_b1_a, hdiv_leg_quad_p4p7_b1_a, hdiv_leg_quad_p4p8_b1_a, hdiv_leg_quad_p4p9_b1_a, hdiv_leg_quad_p4p10_b1_a, hdiv_leg_quad_p4p11_b1_a, hdiv_leg_quad_p5p2_b1_a, hdiv_leg_quad_p5p3_b1_a, hdiv_leg_quad_p5p4_b1_a, hdiv_leg_quad_p5p5_b1_a, hdiv_leg_quad_p5p6_b1_a, hdiv_leg_quad_p5p7_b1_a, hdiv_leg_quad_p5p8_b1_a, hdiv_leg_quad_p5p9_b1_a, hdiv_leg_quad_p5p10_b1_a, hdiv_leg_quad_p5p11_b1_a, hdiv_leg_quad_p6p2_b1_a, hdiv_leg_quad_p6p3_b1_a, hdiv_leg_quad_p6p4_b1_a, hdiv_leg_quad_p6p5_b1_a, hdiv_leg_quad_p6p6_b1_a, hdiv_leg_quad_p6p7_b1_a, hdiv_leg_quad_p6p8_b1_a, hdiv_leg_quad_p6p9_b1_a, hdiv_leg_quad_p6p10_b1_a, hdiv_leg_quad_p6p11_b1_a, hdiv_leg_quad_p7p2_b1_a, hdiv_leg_quad_p7p3_b1_a, hdiv_leg_quad_p7p4_b1_a, hdiv_leg_quad_p7p5_b1_a, hdiv_leg_quad_p7p6_b1_a, hdiv_leg_quad_p7p7_b1_a, hdiv_leg_quad_p7p8_b1_a, hdiv_leg_quad_p7p9_b1_a, hdiv_leg_quad_p7p10_b1_a, hdiv_leg_quad_p7p11_b1_a, hdiv_leg_quad_p8p2_b1_a, hdiv_leg_quad_p8p3_b1_a, hdiv_leg_quad_p8p4_b1_a, hdiv_leg_quad_p8p5_b1_a, hdiv_leg_quad_p8p6_b1_a, hdiv_leg_quad_p8p7_b1_a, hdiv_leg_quad_p8p8_b1_a, hdiv_leg_quad_p8p9_b1_a, hdiv_leg_quad_p8p10_b1_a, hdiv_leg_quad_p8p11_b1_a, hdiv_leg_quad_p9p2_b1_a, hdiv_leg_quad_p9p3_b1_a, hdiv_leg_quad_p9p4_b1_a, hdiv_leg_quad_p9p5_b1_a, hdiv_leg_quad_p9p6_b1_a, hdiv_leg_quad_p9p7_b1_a, hdiv_leg_quad_p9p8_b1_a, hdiv_leg_quad_p9p9_b1_a, hdiv_leg_quad_p9p10_b1_a, hdiv_leg_quad_p9p11_b1_a, hdiv_leg_quad_p10p2_b1_a, hdiv_leg_quad_p10p3_b1_a, hdiv_leg_quad_p10p4_b1_a, hdiv_leg_quad_p10p5_b1_a, hdiv_leg_quad_p10p6_b1_a, hdiv_leg_quad_p10p7_b1_a, hdiv_leg_quad_p10p8_b1_a, hdiv_leg_quad_p10p9_b1_a, hdiv_leg_quad_p10p10_b1_a, hdiv_leg_quad_p10p11_b1_a, hdiv_leg_quad_p2p0_b2_a, hdiv_leg_quad_p2p1_b2_a, hdiv_leg_quad_p2p2_b2_a, hdiv_leg_quad_p2p3_b2_a, hdiv_leg_quad_p2p4_b2_a, hdiv_leg_quad_p2p5_b2_a, hdiv_leg_quad_p2p6_b2_a, hdiv_leg_quad_p2p7_b2_a, hdiv_leg_quad_p2p8_b2_a, hdiv_leg_quad_p2p9_b2_a, hdiv_leg_quad_p2p10_b2_a, hdiv_leg_quad_p3p0_b2_a, hdiv_leg_quad_p3p1_b2_a, hdiv_leg_quad_p3p2_b2_a, hdiv_leg_quad_p3p3_b2_a, hdiv_leg_quad_p3p4_b2_a, hdiv_leg_quad_p3p5_b2_a, hdiv_leg_quad_p3p6_b2_a, hdiv_leg_quad_p3p7_b2_a, hdiv_leg_quad_p3p8_b2_a, hdiv_leg_quad_p3p9_b2_a, hdiv_leg_quad_p3p10_b2_a, hdiv_leg_quad_p4p0_b2_a, hdiv_leg_quad_p4p1_b2_a, hdiv_leg_quad_p4p2_b2_a, hdiv_leg_quad_p4p3_b2_a, hdiv_leg_quad_p4p4_b2_a, hdiv_leg_quad_p4p5_b2_a, hdiv_leg_quad_p4p6_b2_a, hdiv_leg_quad_p4p7_b2_a, hdiv_leg_quad_p4p8_b2_a, hdiv_leg_quad_p4p9_b2_a, hdiv_leg_quad_p4p10_b2_a, hdiv_leg_quad_p5p0_b2_a, hdiv_leg_quad_p5p1_b2_a, hdiv_leg_quad_p5p2_b2_a, hdiv_leg_quad_p5p3_b2_a, hdiv_leg_quad_p5p4_b2_a, hdiv_leg_quad_p5p5_b2_a, hdiv_leg_quad_p5p6_b2_a, hdiv_leg_quad_p5p7_b2_a, hdiv_leg_quad_p5p8_b2_a, hdiv_leg_quad_p5p9_b2_a, hdiv_leg_quad_p5p10_b2_a, hdiv_leg_quad_p6p0_b2_a, hdiv_leg_quad_p6p1_b2_a, hdiv_leg_quad_p6p2_b2_a, hdiv_leg_quad_p6p3_b2_a, hdiv_leg_quad_p6p4_b2_a, hdiv_leg_quad_p6p5_b2_a, hdiv_leg_quad_p6p6_b2_a, hdiv_leg_quad_p6p7_b2_a, hdiv_leg_quad_p6p8_b2_a, hdiv_leg_quad_p6p9_b2_a, hdiv_leg_quad_p6p10_b2_a, hdiv_leg_quad_p7p0_b2_a, hdiv_leg_quad_p7p1_b2_a, hdiv_leg_quad_p7p2_b2_a, hdiv_leg_quad_p7p3_b2_a, hdiv_leg_quad_p7p4_b2_a, hdiv_leg_quad_p7p5_b2_a, hdiv_leg_quad_p7p6_b2_a, hdiv_leg_quad_p7p7_b2_a, hdiv_leg_quad_p7p8_b2_a, hdiv_leg_quad_p7p9_b2_a, hdiv_leg_quad_p7p10_b2_a, hdiv_leg_quad_p8p0_b2_a, hdiv_leg_quad_p8p1_b2_a, hdiv_leg_quad_p8p2_b2_a, hdiv_leg_quad_p8p3_b2_a, hdiv_leg_quad_p8p4_b2_a, hdiv_leg_quad_p8p5_b2_a, hdiv_leg_quad_p8p6_b2_a, hdiv_leg_quad_p8p7_b2_a, hdiv_leg_quad_p8p8_b2_a, hdiv_leg_quad_p8p9_b2_a, hdiv_leg_quad_p8p10_b2_a, hdiv_leg_quad_p9p0_b2_a, hdiv_leg_quad_p9p1_b2_a, hdiv_leg_quad_p9p2_b2_a, hdiv_leg_quad_p9p3_b2_a, hdiv_leg_quad_p9p4_b2_a, hdiv_leg_quad_p9p5_b2_a, hdiv_leg_quad_p9p6_b2_a, hdiv_leg_quad_p9p7_b2_a, hdiv_leg_quad_p9p8_b2_a, hdiv_leg_quad_p9p9_b2_a, hdiv_leg_quad_p9p10_b2_a, hdiv_leg_quad_p10p0_b2_a, hdiv_leg_quad_p10p1_b2_a, hdiv_leg_quad_p10p2_b2_a, hdiv_leg_quad_p10p3_b2_a, hdiv_leg_quad_p10p4_b2_a, hdiv_leg_quad_p10p5_b2_a, hdiv_leg_quad_p10p6_b2_a, hdiv_leg_quad_p10p7_b2_a, hdiv_leg_quad_p10p8_b2_a, hdiv_leg_quad_p10p9_b2_a, hdiv_leg_quad_p10p10_b2_a, hdiv_leg_quad_p11p0_b2_a, hdiv_leg_quad_p11p1_b2_a, hdiv_leg_quad_p11p2_b2_a, hdiv_leg_quad_p11p3_b2_a, hdiv_leg_quad_p11p4_b2_a, hdiv_leg_quad_p11p5_b2_a, hdiv_leg_quad_p11p6_b2_a, hdiv_leg_quad_p11p7_b2_a, hdiv_leg_quad_p11p8_b2_a, hdiv_leg_quad_p11p9_b2_a, hdiv_leg_quad_p11p10_b2_a, }; static Shapeset::shape_fn_t hdiv_leg_quad_fn_b[] = { @@ -8360,11 +8360,11 @@ namespace Hermes hdiv_leg_quad_p9_e1_b, hdiv_leg_quad_p9_e1_b, hdiv_leg_quad_p9_e2_b, hdiv_leg_quad_p9_e2_b, hdiv_leg_quad_p9_e3_b, hdiv_leg_quad_p9_e3_b, hdiv_leg_quad_p9_e4_b, hdiv_leg_quad_p9_e4_b, hdiv_leg_quad_p10_e1_b, hdiv_leg_quad_p10_e1_b, hdiv_leg_quad_p10_e2_b, hdiv_leg_quad_p10_e2_b, hdiv_leg_quad_p10_e3_b_0, hdiv_leg_quad_p10_e3_b_1, hdiv_leg_quad_p10_e4_b_0, hdiv_leg_quad_p10_e4_b_1, - hdiv_leg_quad_p0p2_b1_b, hdiv_leg_quad_p0p3_b1_b, hdiv_leg_quad_p0p4_b1_b, hdiv_leg_quad_p0p5_b1_b, hdiv_leg_quad_p0p6_b1_b, hdiv_leg_quad_p0p7_b1_b, hdiv_leg_quad_p0p8_b1_b, hdiv_leg_quad_p0p9_b1_b, hdiv_leg_quad_p0p10_b1_b, hdiv_leg_quad_p0p11_b1_b, hdiv_leg_quad_p1p2_b1_b, hdiv_leg_quad_p1p3_b1_b, hdiv_leg_quad_p1p4_b1_b, hdiv_leg_quad_p1p5_b1_b, hdiv_leg_quad_p1p6_b1_b, hdiv_leg_quad_p1p7_b1_b, hdiv_leg_quad_p1p8_b1_b, hdiv_leg_quad_p1p9_b1_b, hdiv_leg_quad_p1p10_b1_b, hdiv_leg_quad_p1p11_b1_b, hdiv_leg_quad_p2p2_b1_b, hdiv_leg_quad_p2p3_b1_b, hdiv_leg_quad_p2p4_b1_b, hdiv_leg_quad_p2p5_b1_b, hdiv_leg_quad_p2p6_b1_b, hdiv_leg_quad_p2p7_b1_b, hdiv_leg_quad_p2p8_b1_b, hdiv_leg_quad_p2p9_b1_b, hdiv_leg_quad_p2p10_b1_b, hdiv_leg_quad_p2p11_b1_b, hdiv_leg_quad_p3p2_b1_b, hdiv_leg_quad_p3p3_b1_b, hdiv_leg_quad_p3p4_b1_b, hdiv_leg_quad_p3p5_b1_b, hdiv_leg_quad_p3p6_b1_b, hdiv_leg_quad_p3p7_b1_b, hdiv_leg_quad_p3p8_b1_b, hdiv_leg_quad_p3p9_b1_b, hdiv_leg_quad_p3p10_b1_b, hdiv_leg_quad_p3p11_b1_b, hdiv_leg_quad_p4p2_b1_b, hdiv_leg_quad_p4p3_b1_b, hdiv_leg_quad_p4p4_b1_b, hdiv_leg_quad_p4p5_b1_b, hdiv_leg_quad_p4p6_b1_b, hdiv_leg_quad_p4p7_b1_b, hdiv_leg_quad_p4p8_b1_b, hdiv_leg_quad_p4p9_b1_b, hdiv_leg_quad_p4p10_b1_b, hdiv_leg_quad_p4p11_b1_b, hdiv_leg_quad_p5p2_b1_b, hdiv_leg_quad_p5p3_b1_b, hdiv_leg_quad_p5p4_b1_b, hdiv_leg_quad_p5p5_b1_b, hdiv_leg_quad_p5p6_b1_b, hdiv_leg_quad_p5p7_b1_b, hdiv_leg_quad_p5p8_b1_b, hdiv_leg_quad_p5p9_b1_b, hdiv_leg_quad_p5p10_b1_b, hdiv_leg_quad_p5p11_b1_b, hdiv_leg_quad_p6p2_b1_b, hdiv_leg_quad_p6p3_b1_b, hdiv_leg_quad_p6p4_b1_b, hdiv_leg_quad_p6p5_b1_b, hdiv_leg_quad_p6p6_b1_b, hdiv_leg_quad_p6p7_b1_b, hdiv_leg_quad_p6p8_b1_b, hdiv_leg_quad_p6p9_b1_b, hdiv_leg_quad_p6p10_b1_b, hdiv_leg_quad_p6p11_b1_b, hdiv_leg_quad_p7p2_b1_b, hdiv_leg_quad_p7p3_b1_b, hdiv_leg_quad_p7p4_b1_b, hdiv_leg_quad_p7p5_b1_b, hdiv_leg_quad_p7p6_b1_b, hdiv_leg_quad_p7p7_b1_b, hdiv_leg_quad_p7p8_b1_b, hdiv_leg_quad_p7p9_b1_b, hdiv_leg_quad_p7p10_b1_b, hdiv_leg_quad_p7p11_b1_b, hdiv_leg_quad_p8p2_b1_b, hdiv_leg_quad_p8p3_b1_b, hdiv_leg_quad_p8p4_b1_b, hdiv_leg_quad_p8p5_b1_b, hdiv_leg_quad_p8p6_b1_b, hdiv_leg_quad_p8p7_b1_b, hdiv_leg_quad_p8p8_b1_b, hdiv_leg_quad_p8p9_b1_b, hdiv_leg_quad_p8p10_b1_b, hdiv_leg_quad_p8p11_b1_b, hdiv_leg_quad_p9p2_b1_b, hdiv_leg_quad_p9p3_b1_b, hdiv_leg_quad_p9p4_b1_b, hdiv_leg_quad_p9p5_b1_b, hdiv_leg_quad_p9p6_b1_b, hdiv_leg_quad_p9p7_b1_b, hdiv_leg_quad_p9p8_b1_b, hdiv_leg_quad_p9p9_b1_b, hdiv_leg_quad_p9p10_b1_b, hdiv_leg_quad_p9p11_b1_b, hdiv_leg_quad_p10p2_b1_b, hdiv_leg_quad_p10p3_b1_b, hdiv_leg_quad_p10p4_b1_b, hdiv_leg_quad_p10p5_b1_b, hdiv_leg_quad_p10p6_b1_b, hdiv_leg_quad_p10p7_b1_b, hdiv_leg_quad_p10p8_b1_b, hdiv_leg_quad_p10p9_b1_b, hdiv_leg_quad_p10p10_b1_b, hdiv_leg_quad_p10p11_b1_b, hdiv_leg_quad_p2p0_b2_b, hdiv_leg_quad_p2p1_b2_b, hdiv_leg_quad_p2p2_b2_b, hdiv_leg_quad_p2p3_b2_b, hdiv_leg_quad_p2p4_b2_b, hdiv_leg_quad_p2p5_b2_b, hdiv_leg_quad_p2p6_b2_b, hdiv_leg_quad_p2p7_b2_b, hdiv_leg_quad_p2p8_b2_b, hdiv_leg_quad_p2p9_b2_b, hdiv_leg_quad_p2p10_b2_b, hdiv_leg_quad_p3p0_b2_b, hdiv_leg_quad_p3p1_b2_b, hdiv_leg_quad_p3p2_b2_b, hdiv_leg_quad_p3p3_b2_b, hdiv_leg_quad_p3p4_b2_b, hdiv_leg_quad_p3p5_b2_b, hdiv_leg_quad_p3p6_b2_b, hdiv_leg_quad_p3p7_b2_b, hdiv_leg_quad_p3p8_b2_b, hdiv_leg_quad_p3p9_b2_b, hdiv_leg_quad_p3p10_b2_b, hdiv_leg_quad_p4p0_b2_b, hdiv_leg_quad_p4p1_b2_b, hdiv_leg_quad_p4p2_b2_b, hdiv_leg_quad_p4p3_b2_b, hdiv_leg_quad_p4p4_b2_b, hdiv_leg_quad_p4p5_b2_b, hdiv_leg_quad_p4p6_b2_b, hdiv_leg_quad_p4p7_b2_b, hdiv_leg_quad_p4p8_b2_b, hdiv_leg_quad_p4p9_b2_b, hdiv_leg_quad_p4p10_b2_b, hdiv_leg_quad_p5p0_b2_b, hdiv_leg_quad_p5p1_b2_b, hdiv_leg_quad_p5p2_b2_b, hdiv_leg_quad_p5p3_b2_b, hdiv_leg_quad_p5p4_b2_b, hdiv_leg_quad_p5p5_b2_b, hdiv_leg_quad_p5p6_b2_b, hdiv_leg_quad_p5p7_b2_b, hdiv_leg_quad_p5p8_b2_b, hdiv_leg_quad_p5p9_b2_b, hdiv_leg_quad_p5p10_b2_b, hdiv_leg_quad_p6p0_b2_b, hdiv_leg_quad_p6p1_b2_b, hdiv_leg_quad_p6p2_b2_b, hdiv_leg_quad_p6p3_b2_b, hdiv_leg_quad_p6p4_b2_b, hdiv_leg_quad_p6p5_b2_b, hdiv_leg_quad_p6p6_b2_b, hdiv_leg_quad_p6p7_b2_b, hdiv_leg_quad_p6p8_b2_b, hdiv_leg_quad_p6p9_b2_b, hdiv_leg_quad_p6p10_b2_b, hdiv_leg_quad_p7p0_b2_b, hdiv_leg_quad_p7p1_b2_b, hdiv_leg_quad_p7p2_b2_b, hdiv_leg_quad_p7p3_b2_b, hdiv_leg_quad_p7p4_b2_b, hdiv_leg_quad_p7p5_b2_b, hdiv_leg_quad_p7p6_b2_b, hdiv_leg_quad_p7p7_b2_b, hdiv_leg_quad_p7p8_b2_b, hdiv_leg_quad_p7p9_b2_b, hdiv_leg_quad_p7p10_b2_b, hdiv_leg_quad_p8p0_b2_b, hdiv_leg_quad_p8p1_b2_b, hdiv_leg_quad_p8p2_b2_b, hdiv_leg_quad_p8p3_b2_b, hdiv_leg_quad_p8p4_b2_b, hdiv_leg_quad_p8p5_b2_b, hdiv_leg_quad_p8p6_b2_b, hdiv_leg_quad_p8p7_b2_b, hdiv_leg_quad_p8p8_b2_b, hdiv_leg_quad_p8p9_b2_b, hdiv_leg_quad_p8p10_b2_b, hdiv_leg_quad_p9p0_b2_b, hdiv_leg_quad_p9p1_b2_b, hdiv_leg_quad_p9p2_b2_b, hdiv_leg_quad_p9p3_b2_b, hdiv_leg_quad_p9p4_b2_b, hdiv_leg_quad_p9p5_b2_b, hdiv_leg_quad_p9p6_b2_b, hdiv_leg_quad_p9p7_b2_b, hdiv_leg_quad_p9p8_b2_b, hdiv_leg_quad_p9p9_b2_b, hdiv_leg_quad_p9p10_b2_b, hdiv_leg_quad_p10p0_b2_b, hdiv_leg_quad_p10p1_b2_b, hdiv_leg_quad_p10p2_b2_b, hdiv_leg_quad_p10p3_b2_b, hdiv_leg_quad_p10p4_b2_b, hdiv_leg_quad_p10p5_b2_b, hdiv_leg_quad_p10p6_b2_b, hdiv_leg_quad_p10p7_b2_b, hdiv_leg_quad_p10p8_b2_b, hdiv_leg_quad_p10p9_b2_b, hdiv_leg_quad_p10p10_b2_b, hdiv_leg_quad_p11p0_b2_b, hdiv_leg_quad_p11p1_b2_b, hdiv_leg_quad_p11p2_b2_b, hdiv_leg_quad_p11p3_b2_b, hdiv_leg_quad_p11p4_b2_b, hdiv_leg_quad_p11p5_b2_b, hdiv_leg_quad_p11p6_b2_b, hdiv_leg_quad_p11p7_b2_b, hdiv_leg_quad_p11p8_b2_b, hdiv_leg_quad_p11p9_b2_b, hdiv_leg_quad_p11p10_b2_b, }; + hdiv_leg_quad_p0p2_b1_b, hdiv_leg_quad_p0p3_b1_b, hdiv_leg_quad_p0p4_b1_b, hdiv_leg_quad_p0p5_b1_b, hdiv_leg_quad_p0p6_b1_b, hdiv_leg_quad_p0p7_b1_b, hdiv_leg_quad_p0p8_b1_b, hdiv_leg_quad_p0p9_b1_b, hdiv_leg_quad_p0p10_b1_b, hdiv_leg_quad_p0p11_b1_b, hdiv_leg_quad_p1p2_b1_b, hdiv_leg_quad_p1p3_b1_b, hdiv_leg_quad_p1p4_b1_b, hdiv_leg_quad_p1p5_b1_b, hdiv_leg_quad_p1p6_b1_b, hdiv_leg_quad_p1p7_b1_b, hdiv_leg_quad_p1p8_b1_b, hdiv_leg_quad_p1p9_b1_b, hdiv_leg_quad_p1p10_b1_b, hdiv_leg_quad_p1p11_b1_b, hdiv_leg_quad_p2p2_b1_b, hdiv_leg_quad_p2p3_b1_b, hdiv_leg_quad_p2p4_b1_b, hdiv_leg_quad_p2p5_b1_b, hdiv_leg_quad_p2p6_b1_b, hdiv_leg_quad_p2p7_b1_b, hdiv_leg_quad_p2p8_b1_b, hdiv_leg_quad_p2p9_b1_b, hdiv_leg_quad_p2p10_b1_b, hdiv_leg_quad_p2p11_b1_b, hdiv_leg_quad_p3p2_b1_b, hdiv_leg_quad_p3p3_b1_b, hdiv_leg_quad_p3p4_b1_b, hdiv_leg_quad_p3p5_b1_b, hdiv_leg_quad_p3p6_b1_b, hdiv_leg_quad_p3p7_b1_b, hdiv_leg_quad_p3p8_b1_b, hdiv_leg_quad_p3p9_b1_b, hdiv_leg_quad_p3p10_b1_b, hdiv_leg_quad_p3p11_b1_b, hdiv_leg_quad_p4p2_b1_b, hdiv_leg_quad_p4p3_b1_b, hdiv_leg_quad_p4p4_b1_b, hdiv_leg_quad_p4p5_b1_b, hdiv_leg_quad_p4p6_b1_b, hdiv_leg_quad_p4p7_b1_b, hdiv_leg_quad_p4p8_b1_b, hdiv_leg_quad_p4p9_b1_b, hdiv_leg_quad_p4p10_b1_b, hdiv_leg_quad_p4p11_b1_b, hdiv_leg_quad_p5p2_b1_b, hdiv_leg_quad_p5p3_b1_b, hdiv_leg_quad_p5p4_b1_b, hdiv_leg_quad_p5p5_b1_b, hdiv_leg_quad_p5p6_b1_b, hdiv_leg_quad_p5p7_b1_b, hdiv_leg_quad_p5p8_b1_b, hdiv_leg_quad_p5p9_b1_b, hdiv_leg_quad_p5p10_b1_b, hdiv_leg_quad_p5p11_b1_b, hdiv_leg_quad_p6p2_b1_b, hdiv_leg_quad_p6p3_b1_b, hdiv_leg_quad_p6p4_b1_b, hdiv_leg_quad_p6p5_b1_b, hdiv_leg_quad_p6p6_b1_b, hdiv_leg_quad_p6p7_b1_b, hdiv_leg_quad_p6p8_b1_b, hdiv_leg_quad_p6p9_b1_b, hdiv_leg_quad_p6p10_b1_b, hdiv_leg_quad_p6p11_b1_b, hdiv_leg_quad_p7p2_b1_b, hdiv_leg_quad_p7p3_b1_b, hdiv_leg_quad_p7p4_b1_b, hdiv_leg_quad_p7p5_b1_b, hdiv_leg_quad_p7p6_b1_b, hdiv_leg_quad_p7p7_b1_b, hdiv_leg_quad_p7p8_b1_b, hdiv_leg_quad_p7p9_b1_b, hdiv_leg_quad_p7p10_b1_b, hdiv_leg_quad_p7p11_b1_b, hdiv_leg_quad_p8p2_b1_b, hdiv_leg_quad_p8p3_b1_b, hdiv_leg_quad_p8p4_b1_b, hdiv_leg_quad_p8p5_b1_b, hdiv_leg_quad_p8p6_b1_b, hdiv_leg_quad_p8p7_b1_b, hdiv_leg_quad_p8p8_b1_b, hdiv_leg_quad_p8p9_b1_b, hdiv_leg_quad_p8p10_b1_b, hdiv_leg_quad_p8p11_b1_b, hdiv_leg_quad_p9p2_b1_b, hdiv_leg_quad_p9p3_b1_b, hdiv_leg_quad_p9p4_b1_b, hdiv_leg_quad_p9p5_b1_b, hdiv_leg_quad_p9p6_b1_b, hdiv_leg_quad_p9p7_b1_b, hdiv_leg_quad_p9p8_b1_b, hdiv_leg_quad_p9p9_b1_b, hdiv_leg_quad_p9p10_b1_b, hdiv_leg_quad_p9p11_b1_b, hdiv_leg_quad_p10p2_b1_b, hdiv_leg_quad_p10p3_b1_b, hdiv_leg_quad_p10p4_b1_b, hdiv_leg_quad_p10p5_b1_b, hdiv_leg_quad_p10p6_b1_b, hdiv_leg_quad_p10p7_b1_b, hdiv_leg_quad_p10p8_b1_b, hdiv_leg_quad_p10p9_b1_b, hdiv_leg_quad_p10p10_b1_b, hdiv_leg_quad_p10p11_b1_b, hdiv_leg_quad_p2p0_b2_b, hdiv_leg_quad_p2p1_b2_b, hdiv_leg_quad_p2p2_b2_b, hdiv_leg_quad_p2p3_b2_b, hdiv_leg_quad_p2p4_b2_b, hdiv_leg_quad_p2p5_b2_b, hdiv_leg_quad_p2p6_b2_b, hdiv_leg_quad_p2p7_b2_b, hdiv_leg_quad_p2p8_b2_b, hdiv_leg_quad_p2p9_b2_b, hdiv_leg_quad_p2p10_b2_b, hdiv_leg_quad_p3p0_b2_b, hdiv_leg_quad_p3p1_b2_b, hdiv_leg_quad_p3p2_b2_b, hdiv_leg_quad_p3p3_b2_b, hdiv_leg_quad_p3p4_b2_b, hdiv_leg_quad_p3p5_b2_b, hdiv_leg_quad_p3p6_b2_b, hdiv_leg_quad_p3p7_b2_b, hdiv_leg_quad_p3p8_b2_b, hdiv_leg_quad_p3p9_b2_b, hdiv_leg_quad_p3p10_b2_b, hdiv_leg_quad_p4p0_b2_b, hdiv_leg_quad_p4p1_b2_b, hdiv_leg_quad_p4p2_b2_b, hdiv_leg_quad_p4p3_b2_b, hdiv_leg_quad_p4p4_b2_b, hdiv_leg_quad_p4p5_b2_b, hdiv_leg_quad_p4p6_b2_b, hdiv_leg_quad_p4p7_b2_b, hdiv_leg_quad_p4p8_b2_b, hdiv_leg_quad_p4p9_b2_b, hdiv_leg_quad_p4p10_b2_b, hdiv_leg_quad_p5p0_b2_b, hdiv_leg_quad_p5p1_b2_b, hdiv_leg_quad_p5p2_b2_b, hdiv_leg_quad_p5p3_b2_b, hdiv_leg_quad_p5p4_b2_b, hdiv_leg_quad_p5p5_b2_b, hdiv_leg_quad_p5p6_b2_b, hdiv_leg_quad_p5p7_b2_b, hdiv_leg_quad_p5p8_b2_b, hdiv_leg_quad_p5p9_b2_b, hdiv_leg_quad_p5p10_b2_b, hdiv_leg_quad_p6p0_b2_b, hdiv_leg_quad_p6p1_b2_b, hdiv_leg_quad_p6p2_b2_b, hdiv_leg_quad_p6p3_b2_b, hdiv_leg_quad_p6p4_b2_b, hdiv_leg_quad_p6p5_b2_b, hdiv_leg_quad_p6p6_b2_b, hdiv_leg_quad_p6p7_b2_b, hdiv_leg_quad_p6p8_b2_b, hdiv_leg_quad_p6p9_b2_b, hdiv_leg_quad_p6p10_b2_b, hdiv_leg_quad_p7p0_b2_b, hdiv_leg_quad_p7p1_b2_b, hdiv_leg_quad_p7p2_b2_b, hdiv_leg_quad_p7p3_b2_b, hdiv_leg_quad_p7p4_b2_b, hdiv_leg_quad_p7p5_b2_b, hdiv_leg_quad_p7p6_b2_b, hdiv_leg_quad_p7p7_b2_b, hdiv_leg_quad_p7p8_b2_b, hdiv_leg_quad_p7p9_b2_b, hdiv_leg_quad_p7p10_b2_b, hdiv_leg_quad_p8p0_b2_b, hdiv_leg_quad_p8p1_b2_b, hdiv_leg_quad_p8p2_b2_b, hdiv_leg_quad_p8p3_b2_b, hdiv_leg_quad_p8p4_b2_b, hdiv_leg_quad_p8p5_b2_b, hdiv_leg_quad_p8p6_b2_b, hdiv_leg_quad_p8p7_b2_b, hdiv_leg_quad_p8p8_b2_b, hdiv_leg_quad_p8p9_b2_b, hdiv_leg_quad_p8p10_b2_b, hdiv_leg_quad_p9p0_b2_b, hdiv_leg_quad_p9p1_b2_b, hdiv_leg_quad_p9p2_b2_b, hdiv_leg_quad_p9p3_b2_b, hdiv_leg_quad_p9p4_b2_b, hdiv_leg_quad_p9p5_b2_b, hdiv_leg_quad_p9p6_b2_b, hdiv_leg_quad_p9p7_b2_b, hdiv_leg_quad_p9p8_b2_b, hdiv_leg_quad_p9p9_b2_b, hdiv_leg_quad_p9p10_b2_b, hdiv_leg_quad_p10p0_b2_b, hdiv_leg_quad_p10p1_b2_b, hdiv_leg_quad_p10p2_b2_b, hdiv_leg_quad_p10p3_b2_b, hdiv_leg_quad_p10p4_b2_b, hdiv_leg_quad_p10p5_b2_b, hdiv_leg_quad_p10p6_b2_b, hdiv_leg_quad_p10p7_b2_b, hdiv_leg_quad_p10p8_b2_b, hdiv_leg_quad_p10p9_b2_b, hdiv_leg_quad_p10p10_b2_b, hdiv_leg_quad_p11p0_b2_b, hdiv_leg_quad_p11p1_b2_b, hdiv_leg_quad_p11p2_b2_b, hdiv_leg_quad_p11p3_b2_b, hdiv_leg_quad_p11p4_b2_b, hdiv_leg_quad_p11p5_b2_b, hdiv_leg_quad_p11p6_b2_b, hdiv_leg_quad_p11p7_b2_b, hdiv_leg_quad_p11p8_b2_b, hdiv_leg_quad_p11p9_b2_b, hdiv_leg_quad_p11p10_b2_b, }; static Shapeset::shape_fn_t hdiv_leg_quad_fn_ax[] = { - hdiv_leg_quad_p0_e1_ax_0, hdiv_leg_quad_p0_e1_ax_1, hdiv_leg_quad_p0_e2_ax_0, hdiv_leg_quad_p0_e2_ax_1, hdiv_leg_quad_p0_e3_ax, hdiv_leg_quad_p0_e3_ax, hdiv_leg_quad_p0_e4_ax, hdiv_leg_quad_p0_e4_ax, + hdiv_leg_quad_p0_e1_ax_0, hdiv_leg_quad_p0_e1_ax_1, hdiv_leg_quad_p0_e2_ax_0, hdiv_leg_quad_p0_e2_ax_1, hdiv_leg_quad_p0_e3_ax, hdiv_leg_quad_p0_e3_ax, hdiv_leg_quad_p0_e4_ax, hdiv_leg_quad_p0_e4_ax, hdiv_leg_quad_p1_e1_ax, hdiv_leg_quad_p1_e1_ax, hdiv_leg_quad_p1_e2_ax, hdiv_leg_quad_p1_e2_ax, hdiv_leg_quad_p1_e3_ax, hdiv_leg_quad_p1_e3_ax, hdiv_leg_quad_p1_e4_ax, hdiv_leg_quad_p1_e4_ax, hdiv_leg_quad_p2_e1_ax_0, hdiv_leg_quad_p2_e1_ax_1, hdiv_leg_quad_p2_e2_ax_0, hdiv_leg_quad_p2_e2_ax_1, hdiv_leg_quad_p2_e3_ax, hdiv_leg_quad_p2_e3_ax, hdiv_leg_quad_p2_e4_ax, hdiv_leg_quad_p2_e4_ax, hdiv_leg_quad_p3_e1_ax, hdiv_leg_quad_p3_e1_ax, hdiv_leg_quad_p3_e2_ax, hdiv_leg_quad_p3_e2_ax, hdiv_leg_quad_p3_e3_ax, hdiv_leg_quad_p3_e3_ax, hdiv_leg_quad_p3_e4_ax, hdiv_leg_quad_p3_e4_ax, @@ -8376,7 +8376,7 @@ namespace Hermes hdiv_leg_quad_p9_e1_ax, hdiv_leg_quad_p9_e1_ax, hdiv_leg_quad_p9_e2_ax, hdiv_leg_quad_p9_e2_ax, hdiv_leg_quad_p9_e3_ax, hdiv_leg_quad_p9_e3_ax, hdiv_leg_quad_p9_e4_ax, hdiv_leg_quad_p9_e4_ax, hdiv_leg_quad_p10_e1_ax_0, hdiv_leg_quad_p10_e1_ax_1, hdiv_leg_quad_p10_e2_ax_0, hdiv_leg_quad_p10_e2_ax_1, hdiv_leg_quad_p10_e3_ax, hdiv_leg_quad_p10_e3_ax, hdiv_leg_quad_p10_e4_ax, hdiv_leg_quad_p10_e4_ax, - hdiv_leg_quad_p0p2_b1_ax, hdiv_leg_quad_p0p3_b1_ax, hdiv_leg_quad_p0p4_b1_ax, hdiv_leg_quad_p0p5_b1_ax, hdiv_leg_quad_p0p6_b1_ax, hdiv_leg_quad_p0p7_b1_ax, hdiv_leg_quad_p0p8_b1_ax, hdiv_leg_quad_p0p9_b1_ax, hdiv_leg_quad_p0p10_b1_ax, hdiv_leg_quad_p0p11_b1_ax, hdiv_leg_quad_p1p2_b1_ax, hdiv_leg_quad_p1p3_b1_ax, hdiv_leg_quad_p1p4_b1_ax, hdiv_leg_quad_p1p5_b1_ax, hdiv_leg_quad_p1p6_b1_ax, hdiv_leg_quad_p1p7_b1_ax, hdiv_leg_quad_p1p8_b1_ax, hdiv_leg_quad_p1p9_b1_ax, hdiv_leg_quad_p1p10_b1_ax, hdiv_leg_quad_p1p11_b1_ax, hdiv_leg_quad_p2p2_b1_ax, hdiv_leg_quad_p2p3_b1_ax, hdiv_leg_quad_p2p4_b1_ax, hdiv_leg_quad_p2p5_b1_ax, hdiv_leg_quad_p2p6_b1_ax, hdiv_leg_quad_p2p7_b1_ax, hdiv_leg_quad_p2p8_b1_ax, hdiv_leg_quad_p2p9_b1_ax, hdiv_leg_quad_p2p10_b1_ax, hdiv_leg_quad_p2p11_b1_ax, hdiv_leg_quad_p3p2_b1_ax, hdiv_leg_quad_p3p3_b1_ax, hdiv_leg_quad_p3p4_b1_ax, hdiv_leg_quad_p3p5_b1_ax, hdiv_leg_quad_p3p6_b1_ax, hdiv_leg_quad_p3p7_b1_ax, hdiv_leg_quad_p3p8_b1_ax, hdiv_leg_quad_p3p9_b1_ax, hdiv_leg_quad_p3p10_b1_ax, hdiv_leg_quad_p3p11_b1_ax, hdiv_leg_quad_p4p2_b1_ax, hdiv_leg_quad_p4p3_b1_ax, hdiv_leg_quad_p4p4_b1_ax, hdiv_leg_quad_p4p5_b1_ax, hdiv_leg_quad_p4p6_b1_ax, hdiv_leg_quad_p4p7_b1_ax, hdiv_leg_quad_p4p8_b1_ax, hdiv_leg_quad_p4p9_b1_ax, hdiv_leg_quad_p4p10_b1_ax, hdiv_leg_quad_p4p11_b1_ax, hdiv_leg_quad_p5p2_b1_ax, hdiv_leg_quad_p5p3_b1_ax, hdiv_leg_quad_p5p4_b1_ax, hdiv_leg_quad_p5p5_b1_ax, hdiv_leg_quad_p5p6_b1_ax, hdiv_leg_quad_p5p7_b1_ax, hdiv_leg_quad_p5p8_b1_ax, hdiv_leg_quad_p5p9_b1_ax, hdiv_leg_quad_p5p10_b1_ax, hdiv_leg_quad_p5p11_b1_ax, hdiv_leg_quad_p6p2_b1_ax, hdiv_leg_quad_p6p3_b1_ax, hdiv_leg_quad_p6p4_b1_ax, hdiv_leg_quad_p6p5_b1_ax, hdiv_leg_quad_p6p6_b1_ax, hdiv_leg_quad_p6p7_b1_ax, hdiv_leg_quad_p6p8_b1_ax, hdiv_leg_quad_p6p9_b1_ax, hdiv_leg_quad_p6p10_b1_ax, hdiv_leg_quad_p6p11_b1_ax, hdiv_leg_quad_p7p2_b1_ax, hdiv_leg_quad_p7p3_b1_ax, hdiv_leg_quad_p7p4_b1_ax, hdiv_leg_quad_p7p5_b1_ax, hdiv_leg_quad_p7p6_b1_ax, hdiv_leg_quad_p7p7_b1_ax, hdiv_leg_quad_p7p8_b1_ax, hdiv_leg_quad_p7p9_b1_ax, hdiv_leg_quad_p7p10_b1_ax, hdiv_leg_quad_p7p11_b1_ax, hdiv_leg_quad_p8p2_b1_ax, hdiv_leg_quad_p8p3_b1_ax, hdiv_leg_quad_p8p4_b1_ax, hdiv_leg_quad_p8p5_b1_ax, hdiv_leg_quad_p8p6_b1_ax, hdiv_leg_quad_p8p7_b1_ax, hdiv_leg_quad_p8p8_b1_ax, hdiv_leg_quad_p8p9_b1_ax, hdiv_leg_quad_p8p10_b1_ax, hdiv_leg_quad_p8p11_b1_ax, hdiv_leg_quad_p9p2_b1_ax, hdiv_leg_quad_p9p3_b1_ax, hdiv_leg_quad_p9p4_b1_ax, hdiv_leg_quad_p9p5_b1_ax, hdiv_leg_quad_p9p6_b1_ax, hdiv_leg_quad_p9p7_b1_ax, hdiv_leg_quad_p9p8_b1_ax, hdiv_leg_quad_p9p9_b1_ax, hdiv_leg_quad_p9p10_b1_ax, hdiv_leg_quad_p9p11_b1_ax, hdiv_leg_quad_p10p2_b1_ax, hdiv_leg_quad_p10p3_b1_ax, hdiv_leg_quad_p10p4_b1_ax, hdiv_leg_quad_p10p5_b1_ax, hdiv_leg_quad_p10p6_b1_ax, hdiv_leg_quad_p10p7_b1_ax, hdiv_leg_quad_p10p8_b1_ax, hdiv_leg_quad_p10p9_b1_ax, hdiv_leg_quad_p10p10_b1_ax, hdiv_leg_quad_p10p11_b1_ax, hdiv_leg_quad_p2p0_b2_ax, hdiv_leg_quad_p2p1_b2_ax, hdiv_leg_quad_p2p2_b2_ax, hdiv_leg_quad_p2p3_b2_ax, hdiv_leg_quad_p2p4_b2_ax, hdiv_leg_quad_p2p5_b2_ax, hdiv_leg_quad_p2p6_b2_ax, hdiv_leg_quad_p2p7_b2_ax, hdiv_leg_quad_p2p8_b2_ax, hdiv_leg_quad_p2p9_b2_ax, hdiv_leg_quad_p2p10_b2_ax, hdiv_leg_quad_p3p0_b2_ax, hdiv_leg_quad_p3p1_b2_ax, hdiv_leg_quad_p3p2_b2_ax, hdiv_leg_quad_p3p3_b2_ax, hdiv_leg_quad_p3p4_b2_ax, hdiv_leg_quad_p3p5_b2_ax, hdiv_leg_quad_p3p6_b2_ax, hdiv_leg_quad_p3p7_b2_ax, hdiv_leg_quad_p3p8_b2_ax, hdiv_leg_quad_p3p9_b2_ax, hdiv_leg_quad_p3p10_b2_ax, hdiv_leg_quad_p4p0_b2_ax, hdiv_leg_quad_p4p1_b2_ax, hdiv_leg_quad_p4p2_b2_ax, hdiv_leg_quad_p4p3_b2_ax, hdiv_leg_quad_p4p4_b2_ax, hdiv_leg_quad_p4p5_b2_ax, hdiv_leg_quad_p4p6_b2_ax, hdiv_leg_quad_p4p7_b2_ax, hdiv_leg_quad_p4p8_b2_ax, hdiv_leg_quad_p4p9_b2_ax, hdiv_leg_quad_p4p10_b2_ax, hdiv_leg_quad_p5p0_b2_ax, hdiv_leg_quad_p5p1_b2_ax, hdiv_leg_quad_p5p2_b2_ax, hdiv_leg_quad_p5p3_b2_ax, hdiv_leg_quad_p5p4_b2_ax, hdiv_leg_quad_p5p5_b2_ax, hdiv_leg_quad_p5p6_b2_ax, hdiv_leg_quad_p5p7_b2_ax, hdiv_leg_quad_p5p8_b2_ax, hdiv_leg_quad_p5p9_b2_ax, hdiv_leg_quad_p5p10_b2_ax, hdiv_leg_quad_p6p0_b2_ax, hdiv_leg_quad_p6p1_b2_ax, hdiv_leg_quad_p6p2_b2_ax, hdiv_leg_quad_p6p3_b2_ax, hdiv_leg_quad_p6p4_b2_ax, hdiv_leg_quad_p6p5_b2_ax, hdiv_leg_quad_p6p6_b2_ax, hdiv_leg_quad_p6p7_b2_ax, hdiv_leg_quad_p6p8_b2_ax, hdiv_leg_quad_p6p9_b2_ax, hdiv_leg_quad_p6p10_b2_ax, hdiv_leg_quad_p7p0_b2_ax, hdiv_leg_quad_p7p1_b2_ax, hdiv_leg_quad_p7p2_b2_ax, hdiv_leg_quad_p7p3_b2_ax, hdiv_leg_quad_p7p4_b2_ax, hdiv_leg_quad_p7p5_b2_ax, hdiv_leg_quad_p7p6_b2_ax, hdiv_leg_quad_p7p7_b2_ax, hdiv_leg_quad_p7p8_b2_ax, hdiv_leg_quad_p7p9_b2_ax, hdiv_leg_quad_p7p10_b2_ax, hdiv_leg_quad_p8p0_b2_ax, hdiv_leg_quad_p8p1_b2_ax, hdiv_leg_quad_p8p2_b2_ax, hdiv_leg_quad_p8p3_b2_ax, hdiv_leg_quad_p8p4_b2_ax, hdiv_leg_quad_p8p5_b2_ax, hdiv_leg_quad_p8p6_b2_ax, hdiv_leg_quad_p8p7_b2_ax, hdiv_leg_quad_p8p8_b2_ax, hdiv_leg_quad_p8p9_b2_ax, hdiv_leg_quad_p8p10_b2_ax, hdiv_leg_quad_p9p0_b2_ax, hdiv_leg_quad_p9p1_b2_ax, hdiv_leg_quad_p9p2_b2_ax, hdiv_leg_quad_p9p3_b2_ax, hdiv_leg_quad_p9p4_b2_ax, hdiv_leg_quad_p9p5_b2_ax, hdiv_leg_quad_p9p6_b2_ax, hdiv_leg_quad_p9p7_b2_ax, hdiv_leg_quad_p9p8_b2_ax, hdiv_leg_quad_p9p9_b2_ax, hdiv_leg_quad_p9p10_b2_ax, hdiv_leg_quad_p10p0_b2_ax, hdiv_leg_quad_p10p1_b2_ax, hdiv_leg_quad_p10p2_b2_ax, hdiv_leg_quad_p10p3_b2_ax, hdiv_leg_quad_p10p4_b2_ax, hdiv_leg_quad_p10p5_b2_ax, hdiv_leg_quad_p10p6_b2_ax, hdiv_leg_quad_p10p7_b2_ax, hdiv_leg_quad_p10p8_b2_ax, hdiv_leg_quad_p10p9_b2_ax, hdiv_leg_quad_p10p10_b2_ax, hdiv_leg_quad_p11p0_b2_ax, hdiv_leg_quad_p11p1_b2_ax, hdiv_leg_quad_p11p2_b2_ax, hdiv_leg_quad_p11p3_b2_ax, hdiv_leg_quad_p11p4_b2_ax, hdiv_leg_quad_p11p5_b2_ax, hdiv_leg_quad_p11p6_b2_ax, hdiv_leg_quad_p11p7_b2_ax, hdiv_leg_quad_p11p8_b2_ax, hdiv_leg_quad_p11p9_b2_ax, hdiv_leg_quad_p11p10_b2_ax, }; + hdiv_leg_quad_p0p2_b1_ax, hdiv_leg_quad_p0p3_b1_ax, hdiv_leg_quad_p0p4_b1_ax, hdiv_leg_quad_p0p5_b1_ax, hdiv_leg_quad_p0p6_b1_ax, hdiv_leg_quad_p0p7_b1_ax, hdiv_leg_quad_p0p8_b1_ax, hdiv_leg_quad_p0p9_b1_ax, hdiv_leg_quad_p0p10_b1_ax, hdiv_leg_quad_p0p11_b1_ax, hdiv_leg_quad_p1p2_b1_ax, hdiv_leg_quad_p1p3_b1_ax, hdiv_leg_quad_p1p4_b1_ax, hdiv_leg_quad_p1p5_b1_ax, hdiv_leg_quad_p1p6_b1_ax, hdiv_leg_quad_p1p7_b1_ax, hdiv_leg_quad_p1p8_b1_ax, hdiv_leg_quad_p1p9_b1_ax, hdiv_leg_quad_p1p10_b1_ax, hdiv_leg_quad_p1p11_b1_ax, hdiv_leg_quad_p2p2_b1_ax, hdiv_leg_quad_p2p3_b1_ax, hdiv_leg_quad_p2p4_b1_ax, hdiv_leg_quad_p2p5_b1_ax, hdiv_leg_quad_p2p6_b1_ax, hdiv_leg_quad_p2p7_b1_ax, hdiv_leg_quad_p2p8_b1_ax, hdiv_leg_quad_p2p9_b1_ax, hdiv_leg_quad_p2p10_b1_ax, hdiv_leg_quad_p2p11_b1_ax, hdiv_leg_quad_p3p2_b1_ax, hdiv_leg_quad_p3p3_b1_ax, hdiv_leg_quad_p3p4_b1_ax, hdiv_leg_quad_p3p5_b1_ax, hdiv_leg_quad_p3p6_b1_ax, hdiv_leg_quad_p3p7_b1_ax, hdiv_leg_quad_p3p8_b1_ax, hdiv_leg_quad_p3p9_b1_ax, hdiv_leg_quad_p3p10_b1_ax, hdiv_leg_quad_p3p11_b1_ax, hdiv_leg_quad_p4p2_b1_ax, hdiv_leg_quad_p4p3_b1_ax, hdiv_leg_quad_p4p4_b1_ax, hdiv_leg_quad_p4p5_b1_ax, hdiv_leg_quad_p4p6_b1_ax, hdiv_leg_quad_p4p7_b1_ax, hdiv_leg_quad_p4p8_b1_ax, hdiv_leg_quad_p4p9_b1_ax, hdiv_leg_quad_p4p10_b1_ax, hdiv_leg_quad_p4p11_b1_ax, hdiv_leg_quad_p5p2_b1_ax, hdiv_leg_quad_p5p3_b1_ax, hdiv_leg_quad_p5p4_b1_ax, hdiv_leg_quad_p5p5_b1_ax, hdiv_leg_quad_p5p6_b1_ax, hdiv_leg_quad_p5p7_b1_ax, hdiv_leg_quad_p5p8_b1_ax, hdiv_leg_quad_p5p9_b1_ax, hdiv_leg_quad_p5p10_b1_ax, hdiv_leg_quad_p5p11_b1_ax, hdiv_leg_quad_p6p2_b1_ax, hdiv_leg_quad_p6p3_b1_ax, hdiv_leg_quad_p6p4_b1_ax, hdiv_leg_quad_p6p5_b1_ax, hdiv_leg_quad_p6p6_b1_ax, hdiv_leg_quad_p6p7_b1_ax, hdiv_leg_quad_p6p8_b1_ax, hdiv_leg_quad_p6p9_b1_ax, hdiv_leg_quad_p6p10_b1_ax, hdiv_leg_quad_p6p11_b1_ax, hdiv_leg_quad_p7p2_b1_ax, hdiv_leg_quad_p7p3_b1_ax, hdiv_leg_quad_p7p4_b1_ax, hdiv_leg_quad_p7p5_b1_ax, hdiv_leg_quad_p7p6_b1_ax, hdiv_leg_quad_p7p7_b1_ax, hdiv_leg_quad_p7p8_b1_ax, hdiv_leg_quad_p7p9_b1_ax, hdiv_leg_quad_p7p10_b1_ax, hdiv_leg_quad_p7p11_b1_ax, hdiv_leg_quad_p8p2_b1_ax, hdiv_leg_quad_p8p3_b1_ax, hdiv_leg_quad_p8p4_b1_ax, hdiv_leg_quad_p8p5_b1_ax, hdiv_leg_quad_p8p6_b1_ax, hdiv_leg_quad_p8p7_b1_ax, hdiv_leg_quad_p8p8_b1_ax, hdiv_leg_quad_p8p9_b1_ax, hdiv_leg_quad_p8p10_b1_ax, hdiv_leg_quad_p8p11_b1_ax, hdiv_leg_quad_p9p2_b1_ax, hdiv_leg_quad_p9p3_b1_ax, hdiv_leg_quad_p9p4_b1_ax, hdiv_leg_quad_p9p5_b1_ax, hdiv_leg_quad_p9p6_b1_ax, hdiv_leg_quad_p9p7_b1_ax, hdiv_leg_quad_p9p8_b1_ax, hdiv_leg_quad_p9p9_b1_ax, hdiv_leg_quad_p9p10_b1_ax, hdiv_leg_quad_p9p11_b1_ax, hdiv_leg_quad_p10p2_b1_ax, hdiv_leg_quad_p10p3_b1_ax, hdiv_leg_quad_p10p4_b1_ax, hdiv_leg_quad_p10p5_b1_ax, hdiv_leg_quad_p10p6_b1_ax, hdiv_leg_quad_p10p7_b1_ax, hdiv_leg_quad_p10p8_b1_ax, hdiv_leg_quad_p10p9_b1_ax, hdiv_leg_quad_p10p10_b1_ax, hdiv_leg_quad_p10p11_b1_ax, hdiv_leg_quad_p2p0_b2_ax, hdiv_leg_quad_p2p1_b2_ax, hdiv_leg_quad_p2p2_b2_ax, hdiv_leg_quad_p2p3_b2_ax, hdiv_leg_quad_p2p4_b2_ax, hdiv_leg_quad_p2p5_b2_ax, hdiv_leg_quad_p2p6_b2_ax, hdiv_leg_quad_p2p7_b2_ax, hdiv_leg_quad_p2p8_b2_ax, hdiv_leg_quad_p2p9_b2_ax, hdiv_leg_quad_p2p10_b2_ax, hdiv_leg_quad_p3p0_b2_ax, hdiv_leg_quad_p3p1_b2_ax, hdiv_leg_quad_p3p2_b2_ax, hdiv_leg_quad_p3p3_b2_ax, hdiv_leg_quad_p3p4_b2_ax, hdiv_leg_quad_p3p5_b2_ax, hdiv_leg_quad_p3p6_b2_ax, hdiv_leg_quad_p3p7_b2_ax, hdiv_leg_quad_p3p8_b2_ax, hdiv_leg_quad_p3p9_b2_ax, hdiv_leg_quad_p3p10_b2_ax, hdiv_leg_quad_p4p0_b2_ax, hdiv_leg_quad_p4p1_b2_ax, hdiv_leg_quad_p4p2_b2_ax, hdiv_leg_quad_p4p3_b2_ax, hdiv_leg_quad_p4p4_b2_ax, hdiv_leg_quad_p4p5_b2_ax, hdiv_leg_quad_p4p6_b2_ax, hdiv_leg_quad_p4p7_b2_ax, hdiv_leg_quad_p4p8_b2_ax, hdiv_leg_quad_p4p9_b2_ax, hdiv_leg_quad_p4p10_b2_ax, hdiv_leg_quad_p5p0_b2_ax, hdiv_leg_quad_p5p1_b2_ax, hdiv_leg_quad_p5p2_b2_ax, hdiv_leg_quad_p5p3_b2_ax, hdiv_leg_quad_p5p4_b2_ax, hdiv_leg_quad_p5p5_b2_ax, hdiv_leg_quad_p5p6_b2_ax, hdiv_leg_quad_p5p7_b2_ax, hdiv_leg_quad_p5p8_b2_ax, hdiv_leg_quad_p5p9_b2_ax, hdiv_leg_quad_p5p10_b2_ax, hdiv_leg_quad_p6p0_b2_ax, hdiv_leg_quad_p6p1_b2_ax, hdiv_leg_quad_p6p2_b2_ax, hdiv_leg_quad_p6p3_b2_ax, hdiv_leg_quad_p6p4_b2_ax, hdiv_leg_quad_p6p5_b2_ax, hdiv_leg_quad_p6p6_b2_ax, hdiv_leg_quad_p6p7_b2_ax, hdiv_leg_quad_p6p8_b2_ax, hdiv_leg_quad_p6p9_b2_ax, hdiv_leg_quad_p6p10_b2_ax, hdiv_leg_quad_p7p0_b2_ax, hdiv_leg_quad_p7p1_b2_ax, hdiv_leg_quad_p7p2_b2_ax, hdiv_leg_quad_p7p3_b2_ax, hdiv_leg_quad_p7p4_b2_ax, hdiv_leg_quad_p7p5_b2_ax, hdiv_leg_quad_p7p6_b2_ax, hdiv_leg_quad_p7p7_b2_ax, hdiv_leg_quad_p7p8_b2_ax, hdiv_leg_quad_p7p9_b2_ax, hdiv_leg_quad_p7p10_b2_ax, hdiv_leg_quad_p8p0_b2_ax, hdiv_leg_quad_p8p1_b2_ax, hdiv_leg_quad_p8p2_b2_ax, hdiv_leg_quad_p8p3_b2_ax, hdiv_leg_quad_p8p4_b2_ax, hdiv_leg_quad_p8p5_b2_ax, hdiv_leg_quad_p8p6_b2_ax, hdiv_leg_quad_p8p7_b2_ax, hdiv_leg_quad_p8p8_b2_ax, hdiv_leg_quad_p8p9_b2_ax, hdiv_leg_quad_p8p10_b2_ax, hdiv_leg_quad_p9p0_b2_ax, hdiv_leg_quad_p9p1_b2_ax, hdiv_leg_quad_p9p2_b2_ax, hdiv_leg_quad_p9p3_b2_ax, hdiv_leg_quad_p9p4_b2_ax, hdiv_leg_quad_p9p5_b2_ax, hdiv_leg_quad_p9p6_b2_ax, hdiv_leg_quad_p9p7_b2_ax, hdiv_leg_quad_p9p8_b2_ax, hdiv_leg_quad_p9p9_b2_ax, hdiv_leg_quad_p9p10_b2_ax, hdiv_leg_quad_p10p0_b2_ax, hdiv_leg_quad_p10p1_b2_ax, hdiv_leg_quad_p10p2_b2_ax, hdiv_leg_quad_p10p3_b2_ax, hdiv_leg_quad_p10p4_b2_ax, hdiv_leg_quad_p10p5_b2_ax, hdiv_leg_quad_p10p6_b2_ax, hdiv_leg_quad_p10p7_b2_ax, hdiv_leg_quad_p10p8_b2_ax, hdiv_leg_quad_p10p9_b2_ax, hdiv_leg_quad_p10p10_b2_ax, hdiv_leg_quad_p11p0_b2_ax, hdiv_leg_quad_p11p1_b2_ax, hdiv_leg_quad_p11p2_b2_ax, hdiv_leg_quad_p11p3_b2_ax, hdiv_leg_quad_p11p4_b2_ax, hdiv_leg_quad_p11p5_b2_ax, hdiv_leg_quad_p11p6_b2_ax, hdiv_leg_quad_p11p7_b2_ax, hdiv_leg_quad_p11p8_b2_ax, hdiv_leg_quad_p11p9_b2_ax, hdiv_leg_quad_p11p10_b2_ax, }; static Shapeset::shape_fn_t hdiv_leg_quad_fn_bx[] = { @@ -8392,11 +8392,11 @@ namespace Hermes hdiv_leg_quad_p9_e1_bx, hdiv_leg_quad_p9_e1_bx, hdiv_leg_quad_p9_e2_bx, hdiv_leg_quad_p9_e2_bx, hdiv_leg_quad_p9_e3_bx, hdiv_leg_quad_p9_e3_bx, hdiv_leg_quad_p9_e4_bx, hdiv_leg_quad_p9_e4_bx, hdiv_leg_quad_p10_e1_bx, hdiv_leg_quad_p10_e1_bx, hdiv_leg_quad_p10_e2_bx, hdiv_leg_quad_p10_e2_bx, hdiv_leg_quad_p10_e3_bx_0, hdiv_leg_quad_p10_e3_bx_1, hdiv_leg_quad_p10_e4_bx_0, hdiv_leg_quad_p10_e4_bx_1, - hdiv_leg_quad_p0p2_b1_bx, hdiv_leg_quad_p0p3_b1_bx, hdiv_leg_quad_p0p4_b1_bx, hdiv_leg_quad_p0p5_b1_bx, hdiv_leg_quad_p0p6_b1_bx, hdiv_leg_quad_p0p7_b1_bx, hdiv_leg_quad_p0p8_b1_bx, hdiv_leg_quad_p0p9_b1_bx, hdiv_leg_quad_p0p10_b1_bx, hdiv_leg_quad_p0p11_b1_bx, hdiv_leg_quad_p1p2_b1_bx, hdiv_leg_quad_p1p3_b1_bx, hdiv_leg_quad_p1p4_b1_bx, hdiv_leg_quad_p1p5_b1_bx, hdiv_leg_quad_p1p6_b1_bx, hdiv_leg_quad_p1p7_b1_bx, hdiv_leg_quad_p1p8_b1_bx, hdiv_leg_quad_p1p9_b1_bx, hdiv_leg_quad_p1p10_b1_bx, hdiv_leg_quad_p1p11_b1_bx, hdiv_leg_quad_p2p2_b1_bx, hdiv_leg_quad_p2p3_b1_bx, hdiv_leg_quad_p2p4_b1_bx, hdiv_leg_quad_p2p5_b1_bx, hdiv_leg_quad_p2p6_b1_bx, hdiv_leg_quad_p2p7_b1_bx, hdiv_leg_quad_p2p8_b1_bx, hdiv_leg_quad_p2p9_b1_bx, hdiv_leg_quad_p2p10_b1_bx, hdiv_leg_quad_p2p11_b1_bx, hdiv_leg_quad_p3p2_b1_bx, hdiv_leg_quad_p3p3_b1_bx, hdiv_leg_quad_p3p4_b1_bx, hdiv_leg_quad_p3p5_b1_bx, hdiv_leg_quad_p3p6_b1_bx, hdiv_leg_quad_p3p7_b1_bx, hdiv_leg_quad_p3p8_b1_bx, hdiv_leg_quad_p3p9_b1_bx, hdiv_leg_quad_p3p10_b1_bx, hdiv_leg_quad_p3p11_b1_bx, hdiv_leg_quad_p4p2_b1_bx, hdiv_leg_quad_p4p3_b1_bx, hdiv_leg_quad_p4p4_b1_bx, hdiv_leg_quad_p4p5_b1_bx, hdiv_leg_quad_p4p6_b1_bx, hdiv_leg_quad_p4p7_b1_bx, hdiv_leg_quad_p4p8_b1_bx, hdiv_leg_quad_p4p9_b1_bx, hdiv_leg_quad_p4p10_b1_bx, hdiv_leg_quad_p4p11_b1_bx, hdiv_leg_quad_p5p2_b1_bx, hdiv_leg_quad_p5p3_b1_bx, hdiv_leg_quad_p5p4_b1_bx, hdiv_leg_quad_p5p5_b1_bx, hdiv_leg_quad_p5p6_b1_bx, hdiv_leg_quad_p5p7_b1_bx, hdiv_leg_quad_p5p8_b1_bx, hdiv_leg_quad_p5p9_b1_bx, hdiv_leg_quad_p5p10_b1_bx, hdiv_leg_quad_p5p11_b1_bx, hdiv_leg_quad_p6p2_b1_bx, hdiv_leg_quad_p6p3_b1_bx, hdiv_leg_quad_p6p4_b1_bx, hdiv_leg_quad_p6p5_b1_bx, hdiv_leg_quad_p6p6_b1_bx, hdiv_leg_quad_p6p7_b1_bx, hdiv_leg_quad_p6p8_b1_bx, hdiv_leg_quad_p6p9_b1_bx, hdiv_leg_quad_p6p10_b1_bx, hdiv_leg_quad_p6p11_b1_bx, hdiv_leg_quad_p7p2_b1_bx, hdiv_leg_quad_p7p3_b1_bx, hdiv_leg_quad_p7p4_b1_bx, hdiv_leg_quad_p7p5_b1_bx, hdiv_leg_quad_p7p6_b1_bx, hdiv_leg_quad_p7p7_b1_bx, hdiv_leg_quad_p7p8_b1_bx, hdiv_leg_quad_p7p9_b1_bx, hdiv_leg_quad_p7p10_b1_bx, hdiv_leg_quad_p7p11_b1_bx, hdiv_leg_quad_p8p2_b1_bx, hdiv_leg_quad_p8p3_b1_bx, hdiv_leg_quad_p8p4_b1_bx, hdiv_leg_quad_p8p5_b1_bx, hdiv_leg_quad_p8p6_b1_bx, hdiv_leg_quad_p8p7_b1_bx, hdiv_leg_quad_p8p8_b1_bx, hdiv_leg_quad_p8p9_b1_bx, hdiv_leg_quad_p8p10_b1_bx, hdiv_leg_quad_p8p11_b1_bx, hdiv_leg_quad_p9p2_b1_bx, hdiv_leg_quad_p9p3_b1_bx, hdiv_leg_quad_p9p4_b1_bx, hdiv_leg_quad_p9p5_b1_bx, hdiv_leg_quad_p9p6_b1_bx, hdiv_leg_quad_p9p7_b1_bx, hdiv_leg_quad_p9p8_b1_bx, hdiv_leg_quad_p9p9_b1_bx, hdiv_leg_quad_p9p10_b1_bx, hdiv_leg_quad_p9p11_b1_bx, hdiv_leg_quad_p10p2_b1_bx, hdiv_leg_quad_p10p3_b1_bx, hdiv_leg_quad_p10p4_b1_bx, hdiv_leg_quad_p10p5_b1_bx, hdiv_leg_quad_p10p6_b1_bx, hdiv_leg_quad_p10p7_b1_bx, hdiv_leg_quad_p10p8_b1_bx, hdiv_leg_quad_p10p9_b1_bx, hdiv_leg_quad_p10p10_b1_bx, hdiv_leg_quad_p10p11_b1_bx, hdiv_leg_quad_p2p0_b2_bx, hdiv_leg_quad_p2p1_b2_bx, hdiv_leg_quad_p2p2_b2_bx, hdiv_leg_quad_p2p3_b2_bx, hdiv_leg_quad_p2p4_b2_bx, hdiv_leg_quad_p2p5_b2_bx, hdiv_leg_quad_p2p6_b2_bx, hdiv_leg_quad_p2p7_b2_bx, hdiv_leg_quad_p2p8_b2_bx, hdiv_leg_quad_p2p9_b2_bx, hdiv_leg_quad_p2p10_b2_bx, hdiv_leg_quad_p3p0_b2_bx, hdiv_leg_quad_p3p1_b2_bx, hdiv_leg_quad_p3p2_b2_bx, hdiv_leg_quad_p3p3_b2_bx, hdiv_leg_quad_p3p4_b2_bx, hdiv_leg_quad_p3p5_b2_bx, hdiv_leg_quad_p3p6_b2_bx, hdiv_leg_quad_p3p7_b2_bx, hdiv_leg_quad_p3p8_b2_bx, hdiv_leg_quad_p3p9_b2_bx, hdiv_leg_quad_p3p10_b2_bx, hdiv_leg_quad_p4p0_b2_bx, hdiv_leg_quad_p4p1_b2_bx, hdiv_leg_quad_p4p2_b2_bx, hdiv_leg_quad_p4p3_b2_bx, hdiv_leg_quad_p4p4_b2_bx, hdiv_leg_quad_p4p5_b2_bx, hdiv_leg_quad_p4p6_b2_bx, hdiv_leg_quad_p4p7_b2_bx, hdiv_leg_quad_p4p8_b2_bx, hdiv_leg_quad_p4p9_b2_bx, hdiv_leg_quad_p4p10_b2_bx, hdiv_leg_quad_p5p0_b2_bx, hdiv_leg_quad_p5p1_b2_bx, hdiv_leg_quad_p5p2_b2_bx, hdiv_leg_quad_p5p3_b2_bx, hdiv_leg_quad_p5p4_b2_bx, hdiv_leg_quad_p5p5_b2_bx, hdiv_leg_quad_p5p6_b2_bx, hdiv_leg_quad_p5p7_b2_bx, hdiv_leg_quad_p5p8_b2_bx, hdiv_leg_quad_p5p9_b2_bx, hdiv_leg_quad_p5p10_b2_bx, hdiv_leg_quad_p6p0_b2_bx, hdiv_leg_quad_p6p1_b2_bx, hdiv_leg_quad_p6p2_b2_bx, hdiv_leg_quad_p6p3_b2_bx, hdiv_leg_quad_p6p4_b2_bx, hdiv_leg_quad_p6p5_b2_bx, hdiv_leg_quad_p6p6_b2_bx, hdiv_leg_quad_p6p7_b2_bx, hdiv_leg_quad_p6p8_b2_bx, hdiv_leg_quad_p6p9_b2_bx, hdiv_leg_quad_p6p10_b2_bx, hdiv_leg_quad_p7p0_b2_bx, hdiv_leg_quad_p7p1_b2_bx, hdiv_leg_quad_p7p2_b2_bx, hdiv_leg_quad_p7p3_b2_bx, hdiv_leg_quad_p7p4_b2_bx, hdiv_leg_quad_p7p5_b2_bx, hdiv_leg_quad_p7p6_b2_bx, hdiv_leg_quad_p7p7_b2_bx, hdiv_leg_quad_p7p8_b2_bx, hdiv_leg_quad_p7p9_b2_bx, hdiv_leg_quad_p7p10_b2_bx, hdiv_leg_quad_p8p0_b2_bx, hdiv_leg_quad_p8p1_b2_bx, hdiv_leg_quad_p8p2_b2_bx, hdiv_leg_quad_p8p3_b2_bx, hdiv_leg_quad_p8p4_b2_bx, hdiv_leg_quad_p8p5_b2_bx, hdiv_leg_quad_p8p6_b2_bx, hdiv_leg_quad_p8p7_b2_bx, hdiv_leg_quad_p8p8_b2_bx, hdiv_leg_quad_p8p9_b2_bx, hdiv_leg_quad_p8p10_b2_bx, hdiv_leg_quad_p9p0_b2_bx, hdiv_leg_quad_p9p1_b2_bx, hdiv_leg_quad_p9p2_b2_bx, hdiv_leg_quad_p9p3_b2_bx, hdiv_leg_quad_p9p4_b2_bx, hdiv_leg_quad_p9p5_b2_bx, hdiv_leg_quad_p9p6_b2_bx, hdiv_leg_quad_p9p7_b2_bx, hdiv_leg_quad_p9p8_b2_bx, hdiv_leg_quad_p9p9_b2_bx, hdiv_leg_quad_p9p10_b2_bx, hdiv_leg_quad_p10p0_b2_bx, hdiv_leg_quad_p10p1_b2_bx, hdiv_leg_quad_p10p2_b2_bx, hdiv_leg_quad_p10p3_b2_bx, hdiv_leg_quad_p10p4_b2_bx, hdiv_leg_quad_p10p5_b2_bx, hdiv_leg_quad_p10p6_b2_bx, hdiv_leg_quad_p10p7_b2_bx, hdiv_leg_quad_p10p8_b2_bx, hdiv_leg_quad_p10p9_b2_bx, hdiv_leg_quad_p10p10_b2_bx, hdiv_leg_quad_p11p0_b2_bx, hdiv_leg_quad_p11p1_b2_bx, hdiv_leg_quad_p11p2_b2_bx, hdiv_leg_quad_p11p3_b2_bx, hdiv_leg_quad_p11p4_b2_bx, hdiv_leg_quad_p11p5_b2_bx, hdiv_leg_quad_p11p6_b2_bx, hdiv_leg_quad_p11p7_b2_bx, hdiv_leg_quad_p11p8_b2_bx, hdiv_leg_quad_p11p9_b2_bx, hdiv_leg_quad_p11p10_b2_bx, }; + hdiv_leg_quad_p0p2_b1_bx, hdiv_leg_quad_p0p3_b1_bx, hdiv_leg_quad_p0p4_b1_bx, hdiv_leg_quad_p0p5_b1_bx, hdiv_leg_quad_p0p6_b1_bx, hdiv_leg_quad_p0p7_b1_bx, hdiv_leg_quad_p0p8_b1_bx, hdiv_leg_quad_p0p9_b1_bx, hdiv_leg_quad_p0p10_b1_bx, hdiv_leg_quad_p0p11_b1_bx, hdiv_leg_quad_p1p2_b1_bx, hdiv_leg_quad_p1p3_b1_bx, hdiv_leg_quad_p1p4_b1_bx, hdiv_leg_quad_p1p5_b1_bx, hdiv_leg_quad_p1p6_b1_bx, hdiv_leg_quad_p1p7_b1_bx, hdiv_leg_quad_p1p8_b1_bx, hdiv_leg_quad_p1p9_b1_bx, hdiv_leg_quad_p1p10_b1_bx, hdiv_leg_quad_p1p11_b1_bx, hdiv_leg_quad_p2p2_b1_bx, hdiv_leg_quad_p2p3_b1_bx, hdiv_leg_quad_p2p4_b1_bx, hdiv_leg_quad_p2p5_b1_bx, hdiv_leg_quad_p2p6_b1_bx, hdiv_leg_quad_p2p7_b1_bx, hdiv_leg_quad_p2p8_b1_bx, hdiv_leg_quad_p2p9_b1_bx, hdiv_leg_quad_p2p10_b1_bx, hdiv_leg_quad_p2p11_b1_bx, hdiv_leg_quad_p3p2_b1_bx, hdiv_leg_quad_p3p3_b1_bx, hdiv_leg_quad_p3p4_b1_bx, hdiv_leg_quad_p3p5_b1_bx, hdiv_leg_quad_p3p6_b1_bx, hdiv_leg_quad_p3p7_b1_bx, hdiv_leg_quad_p3p8_b1_bx, hdiv_leg_quad_p3p9_b1_bx, hdiv_leg_quad_p3p10_b1_bx, hdiv_leg_quad_p3p11_b1_bx, hdiv_leg_quad_p4p2_b1_bx, hdiv_leg_quad_p4p3_b1_bx, hdiv_leg_quad_p4p4_b1_bx, hdiv_leg_quad_p4p5_b1_bx, hdiv_leg_quad_p4p6_b1_bx, hdiv_leg_quad_p4p7_b1_bx, hdiv_leg_quad_p4p8_b1_bx, hdiv_leg_quad_p4p9_b1_bx, hdiv_leg_quad_p4p10_b1_bx, hdiv_leg_quad_p4p11_b1_bx, hdiv_leg_quad_p5p2_b1_bx, hdiv_leg_quad_p5p3_b1_bx, hdiv_leg_quad_p5p4_b1_bx, hdiv_leg_quad_p5p5_b1_bx, hdiv_leg_quad_p5p6_b1_bx, hdiv_leg_quad_p5p7_b1_bx, hdiv_leg_quad_p5p8_b1_bx, hdiv_leg_quad_p5p9_b1_bx, hdiv_leg_quad_p5p10_b1_bx, hdiv_leg_quad_p5p11_b1_bx, hdiv_leg_quad_p6p2_b1_bx, hdiv_leg_quad_p6p3_b1_bx, hdiv_leg_quad_p6p4_b1_bx, hdiv_leg_quad_p6p5_b1_bx, hdiv_leg_quad_p6p6_b1_bx, hdiv_leg_quad_p6p7_b1_bx, hdiv_leg_quad_p6p8_b1_bx, hdiv_leg_quad_p6p9_b1_bx, hdiv_leg_quad_p6p10_b1_bx, hdiv_leg_quad_p6p11_b1_bx, hdiv_leg_quad_p7p2_b1_bx, hdiv_leg_quad_p7p3_b1_bx, hdiv_leg_quad_p7p4_b1_bx, hdiv_leg_quad_p7p5_b1_bx, hdiv_leg_quad_p7p6_b1_bx, hdiv_leg_quad_p7p7_b1_bx, hdiv_leg_quad_p7p8_b1_bx, hdiv_leg_quad_p7p9_b1_bx, hdiv_leg_quad_p7p10_b1_bx, hdiv_leg_quad_p7p11_b1_bx, hdiv_leg_quad_p8p2_b1_bx, hdiv_leg_quad_p8p3_b1_bx, hdiv_leg_quad_p8p4_b1_bx, hdiv_leg_quad_p8p5_b1_bx, hdiv_leg_quad_p8p6_b1_bx, hdiv_leg_quad_p8p7_b1_bx, hdiv_leg_quad_p8p8_b1_bx, hdiv_leg_quad_p8p9_b1_bx, hdiv_leg_quad_p8p10_b1_bx, hdiv_leg_quad_p8p11_b1_bx, hdiv_leg_quad_p9p2_b1_bx, hdiv_leg_quad_p9p3_b1_bx, hdiv_leg_quad_p9p4_b1_bx, hdiv_leg_quad_p9p5_b1_bx, hdiv_leg_quad_p9p6_b1_bx, hdiv_leg_quad_p9p7_b1_bx, hdiv_leg_quad_p9p8_b1_bx, hdiv_leg_quad_p9p9_b1_bx, hdiv_leg_quad_p9p10_b1_bx, hdiv_leg_quad_p9p11_b1_bx, hdiv_leg_quad_p10p2_b1_bx, hdiv_leg_quad_p10p3_b1_bx, hdiv_leg_quad_p10p4_b1_bx, hdiv_leg_quad_p10p5_b1_bx, hdiv_leg_quad_p10p6_b1_bx, hdiv_leg_quad_p10p7_b1_bx, hdiv_leg_quad_p10p8_b1_bx, hdiv_leg_quad_p10p9_b1_bx, hdiv_leg_quad_p10p10_b1_bx, hdiv_leg_quad_p10p11_b1_bx, hdiv_leg_quad_p2p0_b2_bx, hdiv_leg_quad_p2p1_b2_bx, hdiv_leg_quad_p2p2_b2_bx, hdiv_leg_quad_p2p3_b2_bx, hdiv_leg_quad_p2p4_b2_bx, hdiv_leg_quad_p2p5_b2_bx, hdiv_leg_quad_p2p6_b2_bx, hdiv_leg_quad_p2p7_b2_bx, hdiv_leg_quad_p2p8_b2_bx, hdiv_leg_quad_p2p9_b2_bx, hdiv_leg_quad_p2p10_b2_bx, hdiv_leg_quad_p3p0_b2_bx, hdiv_leg_quad_p3p1_b2_bx, hdiv_leg_quad_p3p2_b2_bx, hdiv_leg_quad_p3p3_b2_bx, hdiv_leg_quad_p3p4_b2_bx, hdiv_leg_quad_p3p5_b2_bx, hdiv_leg_quad_p3p6_b2_bx, hdiv_leg_quad_p3p7_b2_bx, hdiv_leg_quad_p3p8_b2_bx, hdiv_leg_quad_p3p9_b2_bx, hdiv_leg_quad_p3p10_b2_bx, hdiv_leg_quad_p4p0_b2_bx, hdiv_leg_quad_p4p1_b2_bx, hdiv_leg_quad_p4p2_b2_bx, hdiv_leg_quad_p4p3_b2_bx, hdiv_leg_quad_p4p4_b2_bx, hdiv_leg_quad_p4p5_b2_bx, hdiv_leg_quad_p4p6_b2_bx, hdiv_leg_quad_p4p7_b2_bx, hdiv_leg_quad_p4p8_b2_bx, hdiv_leg_quad_p4p9_b2_bx, hdiv_leg_quad_p4p10_b2_bx, hdiv_leg_quad_p5p0_b2_bx, hdiv_leg_quad_p5p1_b2_bx, hdiv_leg_quad_p5p2_b2_bx, hdiv_leg_quad_p5p3_b2_bx, hdiv_leg_quad_p5p4_b2_bx, hdiv_leg_quad_p5p5_b2_bx, hdiv_leg_quad_p5p6_b2_bx, hdiv_leg_quad_p5p7_b2_bx, hdiv_leg_quad_p5p8_b2_bx, hdiv_leg_quad_p5p9_b2_bx, hdiv_leg_quad_p5p10_b2_bx, hdiv_leg_quad_p6p0_b2_bx, hdiv_leg_quad_p6p1_b2_bx, hdiv_leg_quad_p6p2_b2_bx, hdiv_leg_quad_p6p3_b2_bx, hdiv_leg_quad_p6p4_b2_bx, hdiv_leg_quad_p6p5_b2_bx, hdiv_leg_quad_p6p6_b2_bx, hdiv_leg_quad_p6p7_b2_bx, hdiv_leg_quad_p6p8_b2_bx, hdiv_leg_quad_p6p9_b2_bx, hdiv_leg_quad_p6p10_b2_bx, hdiv_leg_quad_p7p0_b2_bx, hdiv_leg_quad_p7p1_b2_bx, hdiv_leg_quad_p7p2_b2_bx, hdiv_leg_quad_p7p3_b2_bx, hdiv_leg_quad_p7p4_b2_bx, hdiv_leg_quad_p7p5_b2_bx, hdiv_leg_quad_p7p6_b2_bx, hdiv_leg_quad_p7p7_b2_bx, hdiv_leg_quad_p7p8_b2_bx, hdiv_leg_quad_p7p9_b2_bx, hdiv_leg_quad_p7p10_b2_bx, hdiv_leg_quad_p8p0_b2_bx, hdiv_leg_quad_p8p1_b2_bx, hdiv_leg_quad_p8p2_b2_bx, hdiv_leg_quad_p8p3_b2_bx, hdiv_leg_quad_p8p4_b2_bx, hdiv_leg_quad_p8p5_b2_bx, hdiv_leg_quad_p8p6_b2_bx, hdiv_leg_quad_p8p7_b2_bx, hdiv_leg_quad_p8p8_b2_bx, hdiv_leg_quad_p8p9_b2_bx, hdiv_leg_quad_p8p10_b2_bx, hdiv_leg_quad_p9p0_b2_bx, hdiv_leg_quad_p9p1_b2_bx, hdiv_leg_quad_p9p2_b2_bx, hdiv_leg_quad_p9p3_b2_bx, hdiv_leg_quad_p9p4_b2_bx, hdiv_leg_quad_p9p5_b2_bx, hdiv_leg_quad_p9p6_b2_bx, hdiv_leg_quad_p9p7_b2_bx, hdiv_leg_quad_p9p8_b2_bx, hdiv_leg_quad_p9p9_b2_bx, hdiv_leg_quad_p9p10_b2_bx, hdiv_leg_quad_p10p0_b2_bx, hdiv_leg_quad_p10p1_b2_bx, hdiv_leg_quad_p10p2_b2_bx, hdiv_leg_quad_p10p3_b2_bx, hdiv_leg_quad_p10p4_b2_bx, hdiv_leg_quad_p10p5_b2_bx, hdiv_leg_quad_p10p6_b2_bx, hdiv_leg_quad_p10p7_b2_bx, hdiv_leg_quad_p10p8_b2_bx, hdiv_leg_quad_p10p9_b2_bx, hdiv_leg_quad_p10p10_b2_bx, hdiv_leg_quad_p11p0_b2_bx, hdiv_leg_quad_p11p1_b2_bx, hdiv_leg_quad_p11p2_b2_bx, hdiv_leg_quad_p11p3_b2_bx, hdiv_leg_quad_p11p4_b2_bx, hdiv_leg_quad_p11p5_b2_bx, hdiv_leg_quad_p11p6_b2_bx, hdiv_leg_quad_p11p7_b2_bx, hdiv_leg_quad_p11p8_b2_bx, hdiv_leg_quad_p11p9_b2_bx, hdiv_leg_quad_p11p10_b2_bx, }; static Shapeset::shape_fn_t hdiv_leg_quad_fn_ay[] = { - hdiv_leg_quad_p0_e1_ay_0, hdiv_leg_quad_p0_e1_ay_1, hdiv_leg_quad_p0_e2_ay_0, hdiv_leg_quad_p0_e2_ay_1, hdiv_leg_quad_p0_e3_ay, hdiv_leg_quad_p0_e3_ay, hdiv_leg_quad_p0_e4_ay, hdiv_leg_quad_p0_e4_ay, + hdiv_leg_quad_p0_e1_ay_0, hdiv_leg_quad_p0_e1_ay_1, hdiv_leg_quad_p0_e2_ay_0, hdiv_leg_quad_p0_e2_ay_1, hdiv_leg_quad_p0_e3_ay, hdiv_leg_quad_p0_e3_ay, hdiv_leg_quad_p0_e4_ay, hdiv_leg_quad_p0_e4_ay, hdiv_leg_quad_p1_e1_ay, hdiv_leg_quad_p1_e1_ay, hdiv_leg_quad_p1_e2_ay, hdiv_leg_quad_p1_e2_ay, hdiv_leg_quad_p1_e3_ay, hdiv_leg_quad_p1_e3_ay, hdiv_leg_quad_p1_e4_ay, hdiv_leg_quad_p1_e4_ay, hdiv_leg_quad_p2_e1_ay_0, hdiv_leg_quad_p2_e1_ay_1, hdiv_leg_quad_p2_e2_ay_0, hdiv_leg_quad_p2_e2_ay_1, hdiv_leg_quad_p2_e3_ay, hdiv_leg_quad_p2_e3_ay, hdiv_leg_quad_p2_e4_ay, hdiv_leg_quad_p2_e4_ay, hdiv_leg_quad_p3_e1_ay, hdiv_leg_quad_p3_e1_ay, hdiv_leg_quad_p3_e2_ay, hdiv_leg_quad_p3_e2_ay, hdiv_leg_quad_p3_e3_ay, hdiv_leg_quad_p3_e3_ay, hdiv_leg_quad_p3_e4_ay, hdiv_leg_quad_p3_e4_ay, @@ -8408,7 +8408,7 @@ namespace Hermes hdiv_leg_quad_p9_e1_ay, hdiv_leg_quad_p9_e1_ay, hdiv_leg_quad_p9_e2_ay, hdiv_leg_quad_p9_e2_ay, hdiv_leg_quad_p9_e3_ay, hdiv_leg_quad_p9_e3_ay, hdiv_leg_quad_p9_e4_ay, hdiv_leg_quad_p9_e4_ay, hdiv_leg_quad_p10_e1_ay_0, hdiv_leg_quad_p10_e1_ay_1, hdiv_leg_quad_p10_e2_ay_0, hdiv_leg_quad_p10_e2_ay_1, hdiv_leg_quad_p10_e3_ay, hdiv_leg_quad_p10_e3_ay, hdiv_leg_quad_p10_e4_ay, hdiv_leg_quad_p10_e4_ay, - hdiv_leg_quad_p0p2_b1_ay, hdiv_leg_quad_p0p3_b1_ay, hdiv_leg_quad_p0p4_b1_ay, hdiv_leg_quad_p0p5_b1_ay, hdiv_leg_quad_p0p6_b1_ay, hdiv_leg_quad_p0p7_b1_ay, hdiv_leg_quad_p0p8_b1_ay, hdiv_leg_quad_p0p9_b1_ay, hdiv_leg_quad_p0p10_b1_ay, hdiv_leg_quad_p0p11_b1_ay, hdiv_leg_quad_p1p2_b1_ay, hdiv_leg_quad_p1p3_b1_ay, hdiv_leg_quad_p1p4_b1_ay, hdiv_leg_quad_p1p5_b1_ay, hdiv_leg_quad_p1p6_b1_ay, hdiv_leg_quad_p1p7_b1_ay, hdiv_leg_quad_p1p8_b1_ay, hdiv_leg_quad_p1p9_b1_ay, hdiv_leg_quad_p1p10_b1_ay, hdiv_leg_quad_p1p11_b1_ay, hdiv_leg_quad_p2p2_b1_ay, hdiv_leg_quad_p2p3_b1_ay, hdiv_leg_quad_p2p4_b1_ay, hdiv_leg_quad_p2p5_b1_ay, hdiv_leg_quad_p2p6_b1_ay, hdiv_leg_quad_p2p7_b1_ay, hdiv_leg_quad_p2p8_b1_ay, hdiv_leg_quad_p2p9_b1_ay, hdiv_leg_quad_p2p10_b1_ay, hdiv_leg_quad_p2p11_b1_ay, hdiv_leg_quad_p3p2_b1_ay, hdiv_leg_quad_p3p3_b1_ay, hdiv_leg_quad_p3p4_b1_ay, hdiv_leg_quad_p3p5_b1_ay, hdiv_leg_quad_p3p6_b1_ay, hdiv_leg_quad_p3p7_b1_ay, hdiv_leg_quad_p3p8_b1_ay, hdiv_leg_quad_p3p9_b1_ay, hdiv_leg_quad_p3p10_b1_ay, hdiv_leg_quad_p3p11_b1_ay, hdiv_leg_quad_p4p2_b1_ay, hdiv_leg_quad_p4p3_b1_ay, hdiv_leg_quad_p4p4_b1_ay, hdiv_leg_quad_p4p5_b1_ay, hdiv_leg_quad_p4p6_b1_ay, hdiv_leg_quad_p4p7_b1_ay, hdiv_leg_quad_p4p8_b1_ay, hdiv_leg_quad_p4p9_b1_ay, hdiv_leg_quad_p4p10_b1_ay, hdiv_leg_quad_p4p11_b1_ay, hdiv_leg_quad_p5p2_b1_ay, hdiv_leg_quad_p5p3_b1_ay, hdiv_leg_quad_p5p4_b1_ay, hdiv_leg_quad_p5p5_b1_ay, hdiv_leg_quad_p5p6_b1_ay, hdiv_leg_quad_p5p7_b1_ay, hdiv_leg_quad_p5p8_b1_ay, hdiv_leg_quad_p5p9_b1_ay, hdiv_leg_quad_p5p10_b1_ay, hdiv_leg_quad_p5p11_b1_ay, hdiv_leg_quad_p6p2_b1_ay, hdiv_leg_quad_p6p3_b1_ay, hdiv_leg_quad_p6p4_b1_ay, hdiv_leg_quad_p6p5_b1_ay, hdiv_leg_quad_p6p6_b1_ay, hdiv_leg_quad_p6p7_b1_ay, hdiv_leg_quad_p6p8_b1_ay, hdiv_leg_quad_p6p9_b1_ay, hdiv_leg_quad_p6p10_b1_ay, hdiv_leg_quad_p6p11_b1_ay, hdiv_leg_quad_p7p2_b1_ay, hdiv_leg_quad_p7p3_b1_ay, hdiv_leg_quad_p7p4_b1_ay, hdiv_leg_quad_p7p5_b1_ay, hdiv_leg_quad_p7p6_b1_ay, hdiv_leg_quad_p7p7_b1_ay, hdiv_leg_quad_p7p8_b1_ay, hdiv_leg_quad_p7p9_b1_ay, hdiv_leg_quad_p7p10_b1_ay, hdiv_leg_quad_p7p11_b1_ay, hdiv_leg_quad_p8p2_b1_ay, hdiv_leg_quad_p8p3_b1_ay, hdiv_leg_quad_p8p4_b1_ay, hdiv_leg_quad_p8p5_b1_ay, hdiv_leg_quad_p8p6_b1_ay, hdiv_leg_quad_p8p7_b1_ay, hdiv_leg_quad_p8p8_b1_ay, hdiv_leg_quad_p8p9_b1_ay, hdiv_leg_quad_p8p10_b1_ay, hdiv_leg_quad_p8p11_b1_ay, hdiv_leg_quad_p9p2_b1_ay, hdiv_leg_quad_p9p3_b1_ay, hdiv_leg_quad_p9p4_b1_ay, hdiv_leg_quad_p9p5_b1_ay, hdiv_leg_quad_p9p6_b1_ay, hdiv_leg_quad_p9p7_b1_ay, hdiv_leg_quad_p9p8_b1_ay, hdiv_leg_quad_p9p9_b1_ay, hdiv_leg_quad_p9p10_b1_ay, hdiv_leg_quad_p9p11_b1_ay, hdiv_leg_quad_p10p2_b1_ay, hdiv_leg_quad_p10p3_b1_ay, hdiv_leg_quad_p10p4_b1_ay, hdiv_leg_quad_p10p5_b1_ay, hdiv_leg_quad_p10p6_b1_ay, hdiv_leg_quad_p10p7_b1_ay, hdiv_leg_quad_p10p8_b1_ay, hdiv_leg_quad_p10p9_b1_ay, hdiv_leg_quad_p10p10_b1_ay, hdiv_leg_quad_p10p11_b1_ay, hdiv_leg_quad_p2p0_b2_ay, hdiv_leg_quad_p2p1_b2_ay, hdiv_leg_quad_p2p2_b2_ay, hdiv_leg_quad_p2p3_b2_ay, hdiv_leg_quad_p2p4_b2_ay, hdiv_leg_quad_p2p5_b2_ay, hdiv_leg_quad_p2p6_b2_ay, hdiv_leg_quad_p2p7_b2_ay, hdiv_leg_quad_p2p8_b2_ay, hdiv_leg_quad_p2p9_b2_ay, hdiv_leg_quad_p2p10_b2_ay, hdiv_leg_quad_p3p0_b2_ay, hdiv_leg_quad_p3p1_b2_ay, hdiv_leg_quad_p3p2_b2_ay, hdiv_leg_quad_p3p3_b2_ay, hdiv_leg_quad_p3p4_b2_ay, hdiv_leg_quad_p3p5_b2_ay, hdiv_leg_quad_p3p6_b2_ay, hdiv_leg_quad_p3p7_b2_ay, hdiv_leg_quad_p3p8_b2_ay, hdiv_leg_quad_p3p9_b2_ay, hdiv_leg_quad_p3p10_b2_ay, hdiv_leg_quad_p4p0_b2_ay, hdiv_leg_quad_p4p1_b2_ay, hdiv_leg_quad_p4p2_b2_ay, hdiv_leg_quad_p4p3_b2_ay, hdiv_leg_quad_p4p4_b2_ay, hdiv_leg_quad_p4p5_b2_ay, hdiv_leg_quad_p4p6_b2_ay, hdiv_leg_quad_p4p7_b2_ay, hdiv_leg_quad_p4p8_b2_ay, hdiv_leg_quad_p4p9_b2_ay, hdiv_leg_quad_p4p10_b2_ay, hdiv_leg_quad_p5p0_b2_ay, hdiv_leg_quad_p5p1_b2_ay, hdiv_leg_quad_p5p2_b2_ay, hdiv_leg_quad_p5p3_b2_ay, hdiv_leg_quad_p5p4_b2_ay, hdiv_leg_quad_p5p5_b2_ay, hdiv_leg_quad_p5p6_b2_ay, hdiv_leg_quad_p5p7_b2_ay, hdiv_leg_quad_p5p8_b2_ay, hdiv_leg_quad_p5p9_b2_ay, hdiv_leg_quad_p5p10_b2_ay, hdiv_leg_quad_p6p0_b2_ay, hdiv_leg_quad_p6p1_b2_ay, hdiv_leg_quad_p6p2_b2_ay, hdiv_leg_quad_p6p3_b2_ay, hdiv_leg_quad_p6p4_b2_ay, hdiv_leg_quad_p6p5_b2_ay, hdiv_leg_quad_p6p6_b2_ay, hdiv_leg_quad_p6p7_b2_ay, hdiv_leg_quad_p6p8_b2_ay, hdiv_leg_quad_p6p9_b2_ay, hdiv_leg_quad_p6p10_b2_ay, hdiv_leg_quad_p7p0_b2_ay, hdiv_leg_quad_p7p1_b2_ay, hdiv_leg_quad_p7p2_b2_ay, hdiv_leg_quad_p7p3_b2_ay, hdiv_leg_quad_p7p4_b2_ay, hdiv_leg_quad_p7p5_b2_ay, hdiv_leg_quad_p7p6_b2_ay, hdiv_leg_quad_p7p7_b2_ay, hdiv_leg_quad_p7p8_b2_ay, hdiv_leg_quad_p7p9_b2_ay, hdiv_leg_quad_p7p10_b2_ay, hdiv_leg_quad_p8p0_b2_ay, hdiv_leg_quad_p8p1_b2_ay, hdiv_leg_quad_p8p2_b2_ay, hdiv_leg_quad_p8p3_b2_ay, hdiv_leg_quad_p8p4_b2_ay, hdiv_leg_quad_p8p5_b2_ay, hdiv_leg_quad_p8p6_b2_ay, hdiv_leg_quad_p8p7_b2_ay, hdiv_leg_quad_p8p8_b2_ay, hdiv_leg_quad_p8p9_b2_ay, hdiv_leg_quad_p8p10_b2_ay, hdiv_leg_quad_p9p0_b2_ay, hdiv_leg_quad_p9p1_b2_ay, hdiv_leg_quad_p9p2_b2_ay, hdiv_leg_quad_p9p3_b2_ay, hdiv_leg_quad_p9p4_b2_ay, hdiv_leg_quad_p9p5_b2_ay, hdiv_leg_quad_p9p6_b2_ay, hdiv_leg_quad_p9p7_b2_ay, hdiv_leg_quad_p9p8_b2_ay, hdiv_leg_quad_p9p9_b2_ay, hdiv_leg_quad_p9p10_b2_ay, hdiv_leg_quad_p10p0_b2_ay, hdiv_leg_quad_p10p1_b2_ay, hdiv_leg_quad_p10p2_b2_ay, hdiv_leg_quad_p10p3_b2_ay, hdiv_leg_quad_p10p4_b2_ay, hdiv_leg_quad_p10p5_b2_ay, hdiv_leg_quad_p10p6_b2_ay, hdiv_leg_quad_p10p7_b2_ay, hdiv_leg_quad_p10p8_b2_ay, hdiv_leg_quad_p10p9_b2_ay, hdiv_leg_quad_p10p10_b2_ay, hdiv_leg_quad_p11p0_b2_ay, hdiv_leg_quad_p11p1_b2_ay, hdiv_leg_quad_p11p2_b2_ay, hdiv_leg_quad_p11p3_b2_ay, hdiv_leg_quad_p11p4_b2_ay, hdiv_leg_quad_p11p5_b2_ay, hdiv_leg_quad_p11p6_b2_ay, hdiv_leg_quad_p11p7_b2_ay, hdiv_leg_quad_p11p8_b2_ay, hdiv_leg_quad_p11p9_b2_ay, hdiv_leg_quad_p11p10_b2_ay, }; + hdiv_leg_quad_p0p2_b1_ay, hdiv_leg_quad_p0p3_b1_ay, hdiv_leg_quad_p0p4_b1_ay, hdiv_leg_quad_p0p5_b1_ay, hdiv_leg_quad_p0p6_b1_ay, hdiv_leg_quad_p0p7_b1_ay, hdiv_leg_quad_p0p8_b1_ay, hdiv_leg_quad_p0p9_b1_ay, hdiv_leg_quad_p0p10_b1_ay, hdiv_leg_quad_p0p11_b1_ay, hdiv_leg_quad_p1p2_b1_ay, hdiv_leg_quad_p1p3_b1_ay, hdiv_leg_quad_p1p4_b1_ay, hdiv_leg_quad_p1p5_b1_ay, hdiv_leg_quad_p1p6_b1_ay, hdiv_leg_quad_p1p7_b1_ay, hdiv_leg_quad_p1p8_b1_ay, hdiv_leg_quad_p1p9_b1_ay, hdiv_leg_quad_p1p10_b1_ay, hdiv_leg_quad_p1p11_b1_ay, hdiv_leg_quad_p2p2_b1_ay, hdiv_leg_quad_p2p3_b1_ay, hdiv_leg_quad_p2p4_b1_ay, hdiv_leg_quad_p2p5_b1_ay, hdiv_leg_quad_p2p6_b1_ay, hdiv_leg_quad_p2p7_b1_ay, hdiv_leg_quad_p2p8_b1_ay, hdiv_leg_quad_p2p9_b1_ay, hdiv_leg_quad_p2p10_b1_ay, hdiv_leg_quad_p2p11_b1_ay, hdiv_leg_quad_p3p2_b1_ay, hdiv_leg_quad_p3p3_b1_ay, hdiv_leg_quad_p3p4_b1_ay, hdiv_leg_quad_p3p5_b1_ay, hdiv_leg_quad_p3p6_b1_ay, hdiv_leg_quad_p3p7_b1_ay, hdiv_leg_quad_p3p8_b1_ay, hdiv_leg_quad_p3p9_b1_ay, hdiv_leg_quad_p3p10_b1_ay, hdiv_leg_quad_p3p11_b1_ay, hdiv_leg_quad_p4p2_b1_ay, hdiv_leg_quad_p4p3_b1_ay, hdiv_leg_quad_p4p4_b1_ay, hdiv_leg_quad_p4p5_b1_ay, hdiv_leg_quad_p4p6_b1_ay, hdiv_leg_quad_p4p7_b1_ay, hdiv_leg_quad_p4p8_b1_ay, hdiv_leg_quad_p4p9_b1_ay, hdiv_leg_quad_p4p10_b1_ay, hdiv_leg_quad_p4p11_b1_ay, hdiv_leg_quad_p5p2_b1_ay, hdiv_leg_quad_p5p3_b1_ay, hdiv_leg_quad_p5p4_b1_ay, hdiv_leg_quad_p5p5_b1_ay, hdiv_leg_quad_p5p6_b1_ay, hdiv_leg_quad_p5p7_b1_ay, hdiv_leg_quad_p5p8_b1_ay, hdiv_leg_quad_p5p9_b1_ay, hdiv_leg_quad_p5p10_b1_ay, hdiv_leg_quad_p5p11_b1_ay, hdiv_leg_quad_p6p2_b1_ay, hdiv_leg_quad_p6p3_b1_ay, hdiv_leg_quad_p6p4_b1_ay, hdiv_leg_quad_p6p5_b1_ay, hdiv_leg_quad_p6p6_b1_ay, hdiv_leg_quad_p6p7_b1_ay, hdiv_leg_quad_p6p8_b1_ay, hdiv_leg_quad_p6p9_b1_ay, hdiv_leg_quad_p6p10_b1_ay, hdiv_leg_quad_p6p11_b1_ay, hdiv_leg_quad_p7p2_b1_ay, hdiv_leg_quad_p7p3_b1_ay, hdiv_leg_quad_p7p4_b1_ay, hdiv_leg_quad_p7p5_b1_ay, hdiv_leg_quad_p7p6_b1_ay, hdiv_leg_quad_p7p7_b1_ay, hdiv_leg_quad_p7p8_b1_ay, hdiv_leg_quad_p7p9_b1_ay, hdiv_leg_quad_p7p10_b1_ay, hdiv_leg_quad_p7p11_b1_ay, hdiv_leg_quad_p8p2_b1_ay, hdiv_leg_quad_p8p3_b1_ay, hdiv_leg_quad_p8p4_b1_ay, hdiv_leg_quad_p8p5_b1_ay, hdiv_leg_quad_p8p6_b1_ay, hdiv_leg_quad_p8p7_b1_ay, hdiv_leg_quad_p8p8_b1_ay, hdiv_leg_quad_p8p9_b1_ay, hdiv_leg_quad_p8p10_b1_ay, hdiv_leg_quad_p8p11_b1_ay, hdiv_leg_quad_p9p2_b1_ay, hdiv_leg_quad_p9p3_b1_ay, hdiv_leg_quad_p9p4_b1_ay, hdiv_leg_quad_p9p5_b1_ay, hdiv_leg_quad_p9p6_b1_ay, hdiv_leg_quad_p9p7_b1_ay, hdiv_leg_quad_p9p8_b1_ay, hdiv_leg_quad_p9p9_b1_ay, hdiv_leg_quad_p9p10_b1_ay, hdiv_leg_quad_p9p11_b1_ay, hdiv_leg_quad_p10p2_b1_ay, hdiv_leg_quad_p10p3_b1_ay, hdiv_leg_quad_p10p4_b1_ay, hdiv_leg_quad_p10p5_b1_ay, hdiv_leg_quad_p10p6_b1_ay, hdiv_leg_quad_p10p7_b1_ay, hdiv_leg_quad_p10p8_b1_ay, hdiv_leg_quad_p10p9_b1_ay, hdiv_leg_quad_p10p10_b1_ay, hdiv_leg_quad_p10p11_b1_ay, hdiv_leg_quad_p2p0_b2_ay, hdiv_leg_quad_p2p1_b2_ay, hdiv_leg_quad_p2p2_b2_ay, hdiv_leg_quad_p2p3_b2_ay, hdiv_leg_quad_p2p4_b2_ay, hdiv_leg_quad_p2p5_b2_ay, hdiv_leg_quad_p2p6_b2_ay, hdiv_leg_quad_p2p7_b2_ay, hdiv_leg_quad_p2p8_b2_ay, hdiv_leg_quad_p2p9_b2_ay, hdiv_leg_quad_p2p10_b2_ay, hdiv_leg_quad_p3p0_b2_ay, hdiv_leg_quad_p3p1_b2_ay, hdiv_leg_quad_p3p2_b2_ay, hdiv_leg_quad_p3p3_b2_ay, hdiv_leg_quad_p3p4_b2_ay, hdiv_leg_quad_p3p5_b2_ay, hdiv_leg_quad_p3p6_b2_ay, hdiv_leg_quad_p3p7_b2_ay, hdiv_leg_quad_p3p8_b2_ay, hdiv_leg_quad_p3p9_b2_ay, hdiv_leg_quad_p3p10_b2_ay, hdiv_leg_quad_p4p0_b2_ay, hdiv_leg_quad_p4p1_b2_ay, hdiv_leg_quad_p4p2_b2_ay, hdiv_leg_quad_p4p3_b2_ay, hdiv_leg_quad_p4p4_b2_ay, hdiv_leg_quad_p4p5_b2_ay, hdiv_leg_quad_p4p6_b2_ay, hdiv_leg_quad_p4p7_b2_ay, hdiv_leg_quad_p4p8_b2_ay, hdiv_leg_quad_p4p9_b2_ay, hdiv_leg_quad_p4p10_b2_ay, hdiv_leg_quad_p5p0_b2_ay, hdiv_leg_quad_p5p1_b2_ay, hdiv_leg_quad_p5p2_b2_ay, hdiv_leg_quad_p5p3_b2_ay, hdiv_leg_quad_p5p4_b2_ay, hdiv_leg_quad_p5p5_b2_ay, hdiv_leg_quad_p5p6_b2_ay, hdiv_leg_quad_p5p7_b2_ay, hdiv_leg_quad_p5p8_b2_ay, hdiv_leg_quad_p5p9_b2_ay, hdiv_leg_quad_p5p10_b2_ay, hdiv_leg_quad_p6p0_b2_ay, hdiv_leg_quad_p6p1_b2_ay, hdiv_leg_quad_p6p2_b2_ay, hdiv_leg_quad_p6p3_b2_ay, hdiv_leg_quad_p6p4_b2_ay, hdiv_leg_quad_p6p5_b2_ay, hdiv_leg_quad_p6p6_b2_ay, hdiv_leg_quad_p6p7_b2_ay, hdiv_leg_quad_p6p8_b2_ay, hdiv_leg_quad_p6p9_b2_ay, hdiv_leg_quad_p6p10_b2_ay, hdiv_leg_quad_p7p0_b2_ay, hdiv_leg_quad_p7p1_b2_ay, hdiv_leg_quad_p7p2_b2_ay, hdiv_leg_quad_p7p3_b2_ay, hdiv_leg_quad_p7p4_b2_ay, hdiv_leg_quad_p7p5_b2_ay, hdiv_leg_quad_p7p6_b2_ay, hdiv_leg_quad_p7p7_b2_ay, hdiv_leg_quad_p7p8_b2_ay, hdiv_leg_quad_p7p9_b2_ay, hdiv_leg_quad_p7p10_b2_ay, hdiv_leg_quad_p8p0_b2_ay, hdiv_leg_quad_p8p1_b2_ay, hdiv_leg_quad_p8p2_b2_ay, hdiv_leg_quad_p8p3_b2_ay, hdiv_leg_quad_p8p4_b2_ay, hdiv_leg_quad_p8p5_b2_ay, hdiv_leg_quad_p8p6_b2_ay, hdiv_leg_quad_p8p7_b2_ay, hdiv_leg_quad_p8p8_b2_ay, hdiv_leg_quad_p8p9_b2_ay, hdiv_leg_quad_p8p10_b2_ay, hdiv_leg_quad_p9p0_b2_ay, hdiv_leg_quad_p9p1_b2_ay, hdiv_leg_quad_p9p2_b2_ay, hdiv_leg_quad_p9p3_b2_ay, hdiv_leg_quad_p9p4_b2_ay, hdiv_leg_quad_p9p5_b2_ay, hdiv_leg_quad_p9p6_b2_ay, hdiv_leg_quad_p9p7_b2_ay, hdiv_leg_quad_p9p8_b2_ay, hdiv_leg_quad_p9p9_b2_ay, hdiv_leg_quad_p9p10_b2_ay, hdiv_leg_quad_p10p0_b2_ay, hdiv_leg_quad_p10p1_b2_ay, hdiv_leg_quad_p10p2_b2_ay, hdiv_leg_quad_p10p3_b2_ay, hdiv_leg_quad_p10p4_b2_ay, hdiv_leg_quad_p10p5_b2_ay, hdiv_leg_quad_p10p6_b2_ay, hdiv_leg_quad_p10p7_b2_ay, hdiv_leg_quad_p10p8_b2_ay, hdiv_leg_quad_p10p9_b2_ay, hdiv_leg_quad_p10p10_b2_ay, hdiv_leg_quad_p11p0_b2_ay, hdiv_leg_quad_p11p1_b2_ay, hdiv_leg_quad_p11p2_b2_ay, hdiv_leg_quad_p11p3_b2_ay, hdiv_leg_quad_p11p4_b2_ay, hdiv_leg_quad_p11p5_b2_ay, hdiv_leg_quad_p11p6_b2_ay, hdiv_leg_quad_p11p7_b2_ay, hdiv_leg_quad_p11p8_b2_ay, hdiv_leg_quad_p11p9_b2_ay, hdiv_leg_quad_p11p10_b2_ay, }; static Shapeset::shape_fn_t hdiv_leg_quad_fn_by[] = { @@ -8424,174 +8424,174 @@ namespace Hermes hdiv_leg_quad_p9_e1_by, hdiv_leg_quad_p9_e1_by, hdiv_leg_quad_p9_e2_by, hdiv_leg_quad_p9_e2_by, hdiv_leg_quad_p9_e3_by, hdiv_leg_quad_p9_e3_by, hdiv_leg_quad_p9_e4_by, hdiv_leg_quad_p9_e4_by, hdiv_leg_quad_p10_e1_by, hdiv_leg_quad_p10_e1_by, hdiv_leg_quad_p10_e2_by, hdiv_leg_quad_p10_e2_by, hdiv_leg_quad_p10_e3_by_0, hdiv_leg_quad_p10_e3_by_1, hdiv_leg_quad_p10_e4_by_0, hdiv_leg_quad_p10_e4_by_1, - hdiv_leg_quad_p0p2_b1_by, hdiv_leg_quad_p0p3_b1_by, hdiv_leg_quad_p0p4_b1_by, hdiv_leg_quad_p0p5_b1_by, hdiv_leg_quad_p0p6_b1_by, hdiv_leg_quad_p0p7_b1_by, hdiv_leg_quad_p0p8_b1_by, hdiv_leg_quad_p0p9_b1_by, hdiv_leg_quad_p0p10_b1_by, hdiv_leg_quad_p0p11_b1_by, hdiv_leg_quad_p1p2_b1_by, hdiv_leg_quad_p1p3_b1_by, hdiv_leg_quad_p1p4_b1_by, hdiv_leg_quad_p1p5_b1_by, hdiv_leg_quad_p1p6_b1_by, hdiv_leg_quad_p1p7_b1_by, hdiv_leg_quad_p1p8_b1_by, hdiv_leg_quad_p1p9_b1_by, hdiv_leg_quad_p1p10_b1_by, hdiv_leg_quad_p1p11_b1_by, hdiv_leg_quad_p2p2_b1_by, hdiv_leg_quad_p2p3_b1_by, hdiv_leg_quad_p2p4_b1_by, hdiv_leg_quad_p2p5_b1_by, hdiv_leg_quad_p2p6_b1_by, hdiv_leg_quad_p2p7_b1_by, hdiv_leg_quad_p2p8_b1_by, hdiv_leg_quad_p2p9_b1_by, hdiv_leg_quad_p2p10_b1_by, hdiv_leg_quad_p2p11_b1_by, hdiv_leg_quad_p3p2_b1_by, hdiv_leg_quad_p3p3_b1_by, hdiv_leg_quad_p3p4_b1_by, hdiv_leg_quad_p3p5_b1_by, hdiv_leg_quad_p3p6_b1_by, hdiv_leg_quad_p3p7_b1_by, hdiv_leg_quad_p3p8_b1_by, hdiv_leg_quad_p3p9_b1_by, hdiv_leg_quad_p3p10_b1_by, hdiv_leg_quad_p3p11_b1_by, hdiv_leg_quad_p4p2_b1_by, hdiv_leg_quad_p4p3_b1_by, hdiv_leg_quad_p4p4_b1_by, hdiv_leg_quad_p4p5_b1_by, hdiv_leg_quad_p4p6_b1_by, hdiv_leg_quad_p4p7_b1_by, hdiv_leg_quad_p4p8_b1_by, hdiv_leg_quad_p4p9_b1_by, hdiv_leg_quad_p4p10_b1_by, hdiv_leg_quad_p4p11_b1_by, hdiv_leg_quad_p5p2_b1_by, hdiv_leg_quad_p5p3_b1_by, hdiv_leg_quad_p5p4_b1_by, hdiv_leg_quad_p5p5_b1_by, hdiv_leg_quad_p5p6_b1_by, hdiv_leg_quad_p5p7_b1_by, hdiv_leg_quad_p5p8_b1_by, hdiv_leg_quad_p5p9_b1_by, hdiv_leg_quad_p5p10_b1_by, hdiv_leg_quad_p5p11_b1_by, hdiv_leg_quad_p6p2_b1_by, hdiv_leg_quad_p6p3_b1_by, hdiv_leg_quad_p6p4_b1_by, hdiv_leg_quad_p6p5_b1_by, hdiv_leg_quad_p6p6_b1_by, hdiv_leg_quad_p6p7_b1_by, hdiv_leg_quad_p6p8_b1_by, hdiv_leg_quad_p6p9_b1_by, hdiv_leg_quad_p6p10_b1_by, hdiv_leg_quad_p6p11_b1_by, hdiv_leg_quad_p7p2_b1_by, hdiv_leg_quad_p7p3_b1_by, hdiv_leg_quad_p7p4_b1_by, hdiv_leg_quad_p7p5_b1_by, hdiv_leg_quad_p7p6_b1_by, hdiv_leg_quad_p7p7_b1_by, hdiv_leg_quad_p7p8_b1_by, hdiv_leg_quad_p7p9_b1_by, hdiv_leg_quad_p7p10_b1_by, hdiv_leg_quad_p7p11_b1_by, hdiv_leg_quad_p8p2_b1_by, hdiv_leg_quad_p8p3_b1_by, hdiv_leg_quad_p8p4_b1_by, hdiv_leg_quad_p8p5_b1_by, hdiv_leg_quad_p8p6_b1_by, hdiv_leg_quad_p8p7_b1_by, hdiv_leg_quad_p8p8_b1_by, hdiv_leg_quad_p8p9_b1_by, hdiv_leg_quad_p8p10_b1_by, hdiv_leg_quad_p8p11_b1_by, hdiv_leg_quad_p9p2_b1_by, hdiv_leg_quad_p9p3_b1_by, hdiv_leg_quad_p9p4_b1_by, hdiv_leg_quad_p9p5_b1_by, hdiv_leg_quad_p9p6_b1_by, hdiv_leg_quad_p9p7_b1_by, hdiv_leg_quad_p9p8_b1_by, hdiv_leg_quad_p9p9_b1_by, hdiv_leg_quad_p9p10_b1_by, hdiv_leg_quad_p9p11_b1_by, hdiv_leg_quad_p10p2_b1_by, hdiv_leg_quad_p10p3_b1_by, hdiv_leg_quad_p10p4_b1_by, hdiv_leg_quad_p10p5_b1_by, hdiv_leg_quad_p10p6_b1_by, hdiv_leg_quad_p10p7_b1_by, hdiv_leg_quad_p10p8_b1_by, hdiv_leg_quad_p10p9_b1_by, hdiv_leg_quad_p10p10_b1_by, hdiv_leg_quad_p10p11_b1_by, hdiv_leg_quad_p2p0_b2_by, hdiv_leg_quad_p2p1_b2_by, hdiv_leg_quad_p2p2_b2_by, hdiv_leg_quad_p2p3_b2_by, hdiv_leg_quad_p2p4_b2_by, hdiv_leg_quad_p2p5_b2_by, hdiv_leg_quad_p2p6_b2_by, hdiv_leg_quad_p2p7_b2_by, hdiv_leg_quad_p2p8_b2_by, hdiv_leg_quad_p2p9_b2_by, hdiv_leg_quad_p2p10_b2_by, hdiv_leg_quad_p3p0_b2_by, hdiv_leg_quad_p3p1_b2_by, hdiv_leg_quad_p3p2_b2_by, hdiv_leg_quad_p3p3_b2_by, hdiv_leg_quad_p3p4_b2_by, hdiv_leg_quad_p3p5_b2_by, hdiv_leg_quad_p3p6_b2_by, hdiv_leg_quad_p3p7_b2_by, hdiv_leg_quad_p3p8_b2_by, hdiv_leg_quad_p3p9_b2_by, hdiv_leg_quad_p3p10_b2_by, hdiv_leg_quad_p4p0_b2_by, hdiv_leg_quad_p4p1_b2_by, hdiv_leg_quad_p4p2_b2_by, hdiv_leg_quad_p4p3_b2_by, hdiv_leg_quad_p4p4_b2_by, hdiv_leg_quad_p4p5_b2_by, hdiv_leg_quad_p4p6_b2_by, hdiv_leg_quad_p4p7_b2_by, hdiv_leg_quad_p4p8_b2_by, hdiv_leg_quad_p4p9_b2_by, hdiv_leg_quad_p4p10_b2_by, hdiv_leg_quad_p5p0_b2_by, hdiv_leg_quad_p5p1_b2_by, hdiv_leg_quad_p5p2_b2_by, hdiv_leg_quad_p5p3_b2_by, hdiv_leg_quad_p5p4_b2_by, hdiv_leg_quad_p5p5_b2_by, hdiv_leg_quad_p5p6_b2_by, hdiv_leg_quad_p5p7_b2_by, hdiv_leg_quad_p5p8_b2_by, hdiv_leg_quad_p5p9_b2_by, hdiv_leg_quad_p5p10_b2_by, hdiv_leg_quad_p6p0_b2_by, hdiv_leg_quad_p6p1_b2_by, hdiv_leg_quad_p6p2_b2_by, hdiv_leg_quad_p6p3_b2_by, hdiv_leg_quad_p6p4_b2_by, hdiv_leg_quad_p6p5_b2_by, hdiv_leg_quad_p6p6_b2_by, hdiv_leg_quad_p6p7_b2_by, hdiv_leg_quad_p6p8_b2_by, hdiv_leg_quad_p6p9_b2_by, hdiv_leg_quad_p6p10_b2_by, hdiv_leg_quad_p7p0_b2_by, hdiv_leg_quad_p7p1_b2_by, hdiv_leg_quad_p7p2_b2_by, hdiv_leg_quad_p7p3_b2_by, hdiv_leg_quad_p7p4_b2_by, hdiv_leg_quad_p7p5_b2_by, hdiv_leg_quad_p7p6_b2_by, hdiv_leg_quad_p7p7_b2_by, hdiv_leg_quad_p7p8_b2_by, hdiv_leg_quad_p7p9_b2_by, hdiv_leg_quad_p7p10_b2_by, hdiv_leg_quad_p8p0_b2_by, hdiv_leg_quad_p8p1_b2_by, hdiv_leg_quad_p8p2_b2_by, hdiv_leg_quad_p8p3_b2_by, hdiv_leg_quad_p8p4_b2_by, hdiv_leg_quad_p8p5_b2_by, hdiv_leg_quad_p8p6_b2_by, hdiv_leg_quad_p8p7_b2_by, hdiv_leg_quad_p8p8_b2_by, hdiv_leg_quad_p8p9_b2_by, hdiv_leg_quad_p8p10_b2_by, hdiv_leg_quad_p9p0_b2_by, hdiv_leg_quad_p9p1_b2_by, hdiv_leg_quad_p9p2_b2_by, hdiv_leg_quad_p9p3_b2_by, hdiv_leg_quad_p9p4_b2_by, hdiv_leg_quad_p9p5_b2_by, hdiv_leg_quad_p9p6_b2_by, hdiv_leg_quad_p9p7_b2_by, hdiv_leg_quad_p9p8_b2_by, hdiv_leg_quad_p9p9_b2_by, hdiv_leg_quad_p9p10_b2_by, hdiv_leg_quad_p10p0_b2_by, hdiv_leg_quad_p10p1_b2_by, hdiv_leg_quad_p10p2_b2_by, hdiv_leg_quad_p10p3_b2_by, hdiv_leg_quad_p10p4_b2_by, hdiv_leg_quad_p10p5_b2_by, hdiv_leg_quad_p10p6_b2_by, hdiv_leg_quad_p10p7_b2_by, hdiv_leg_quad_p10p8_b2_by, hdiv_leg_quad_p10p9_b2_by, hdiv_leg_quad_p10p10_b2_by, hdiv_leg_quad_p11p0_b2_by, hdiv_leg_quad_p11p1_b2_by, hdiv_leg_quad_p11p2_b2_by, hdiv_leg_quad_p11p3_b2_by, hdiv_leg_quad_p11p4_b2_by, hdiv_leg_quad_p11p5_b2_by, hdiv_leg_quad_p11p6_b2_by, hdiv_leg_quad_p11p7_b2_by, hdiv_leg_quad_p11p8_b2_by, hdiv_leg_quad_p11p9_b2_by, hdiv_leg_quad_p11p10_b2_by, }; - - static int qb_0_1[] = { 88, }; - static int qb_0_2[] = { 88, 89, }; - static int qb_0_3[] = { 88, 89, 90, }; - static int qb_0_4[] = { 88, 89, 90, 91, }; - static int qb_0_5[] = { 88, 89, 90, 91, 92, }; - static int qb_0_6[] = { 88, 89, 90, 91, 92, 93, }; - static int qb_0_7[] = { 88, 89, 90, 91, 92, 93, 94, }; - static int qb_0_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, }; - static int qb_0_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, }; - static int qb_0_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, }; - static int qb_1_0[] = { 198, }; - static int qb_1_1[] = { 88, 198, 98, 199, }; - static int qb_1_2[] = { 88, 89, 198, 98, 199, 99, 200, }; - static int qb_1_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, }; - static int qb_1_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, }; - static int qb_1_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, }; - static int qb_1_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, }; - static int qb_1_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, }; - static int qb_1_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, }; - static int qb_1_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, }; - static int qb_1_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, }; - static int qb_2_0[] = { 198, 209, }; - static int qb_2_1[] = { 88, 198, 98, 199, 209, 108, 210, }; - static int qb_2_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, }; - static int qb_2_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, }; - static int qb_2_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, }; - static int qb_2_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, }; - static int qb_2_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, }; - static int qb_2_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, }; - static int qb_2_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, }; - static int qb_2_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, }; - static int qb_2_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, }; - static int qb_3_0[] = { 198, 209, 220, }; - static int qb_3_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, }; - static int qb_3_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, }; - static int qb_3_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, }; - static int qb_3_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, }; - static int qb_3_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, }; - static int qb_3_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, }; - static int qb_3_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, }; - static int qb_3_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, }; - static int qb_3_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, }; - static int qb_3_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, }; - static int qb_4_0[] = { 198, 209, 220, 231, }; - static int qb_4_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, }; - static int qb_4_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, }; - static int qb_4_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, }; - static int qb_4_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, }; - static int qb_4_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, }; - static int qb_4_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, }; - static int qb_4_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, }; - static int qb_4_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, }; - static int qb_4_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, }; - static int qb_4_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, }; - static int qb_5_0[] = { 198, 209, 220, 231, 242, }; - static int qb_5_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, }; - static int qb_5_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, }; - static int qb_5_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, }; - static int qb_5_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, }; - static int qb_5_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, }; - static int qb_5_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, }; - static int qb_5_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, }; - static int qb_5_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, }; - static int qb_5_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, }; - static int qb_5_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, }; - static int qb_6_0[] = { 198, 209, 220, 231, 242, 253, }; - static int qb_6_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, }; - static int qb_6_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, }; - static int qb_6_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, }; - static int qb_6_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, }; - static int qb_6_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, }; - static int qb_6_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, }; - static int qb_6_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, }; - static int qb_6_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, }; - static int qb_6_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, }; - static int qb_6_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, }; - static int qb_7_0[] = { 198, 209, 220, 231, 242, 253, 264, }; - static int qb_7_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, }; - static int qb_7_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, }; - static int qb_7_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, }; - static int qb_7_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, }; - static int qb_7_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, }; - static int qb_7_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, }; - static int qb_7_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, }; - static int qb_7_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, }; - static int qb_7_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, }; - static int qb_7_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, }; - static int qb_8_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, }; - static int qb_8_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, }; - static int qb_8_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, }; - static int qb_8_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, }; - static int qb_8_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, }; - static int qb_8_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, }; - static int qb_8_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, }; - static int qb_8_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, }; - static int qb_8_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, }; - static int qb_8_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, }; - static int qb_8_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, }; - static int qb_9_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, 286, }; - static int qb_9_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, 286, 178, 287, }; - static int qb_9_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, 286, 178, 287, 179, 288, }; - static int qb_9_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, 286, 178, 287, 179, 288, 180, 289, }; - static int qb_9_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, 286, 178, 287, 179, 288, 180, 289, 181, 290, }; - static int qb_9_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, }; - static int qb_9_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, }; - static int qb_9_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, }; - static int qb_9_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, }; - static int qb_9_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, }; - static int qb_9_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 187, 296, }; - static int qb_10_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, }; - static int qb_10_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, 286, 178, 287, 297, 188, 298, }; - static int qb_10_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, 286, 178, 287, 179, 288, 297, 188, 298, 189, 299, }; - static int qb_10_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, 286, 178, 287, 179, 288, 180, 289, 297, 188, 298, 189, 299, 190, 300, }; - static int qb_10_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, 286, 178, 287, 179, 288, 180, 289, 181, 290, 297, 188, 298, 189, 299, 190, 300, 191, 301, }; - static int qb_10_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, }; - static int qb_10_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, }; - static int qb_10_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, }; - static int qb_10_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, }; - static int qb_10_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, 196, 306, }; - static int qb_10_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 187, 296, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, 196, 306, 197, 307, }; - - #define nullptr16 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, - - static int* hdiv_leg_quad_bubble_indices[] = - { - nullptr, qb_0_1, qb_0_2, qb_0_3, qb_0_4, qb_0_5, qb_0_6, qb_0_7, qb_0_8, qb_0_9, qb_0_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_1_0, qb_1_1, qb_1_2, qb_1_3, qb_1_4, qb_1_5, qb_1_6, qb_1_7, qb_1_8, qb_1_9, qb_1_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_2_0, qb_2_1, qb_2_2, qb_2_3, qb_2_4, qb_2_5, qb_2_6, qb_2_7, qb_2_8, qb_2_9, qb_2_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_3_0, qb_3_1, qb_3_2, qb_3_3, qb_3_4, qb_3_5, qb_3_6, qb_3_7, qb_3_8, qb_3_9, qb_3_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_4_0, qb_4_1, qb_4_2, qb_4_3, qb_4_4, qb_4_5, qb_4_6, qb_4_7, qb_4_8, qb_4_9, qb_4_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_5_0, qb_5_1, qb_5_2, qb_5_3, qb_5_4, qb_5_5, qb_5_6, qb_5_7, qb_5_8, qb_5_9, qb_5_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_6_0, qb_6_1, qb_6_2, qb_6_3, qb_6_4, qb_6_5, qb_6_6, qb_6_7, qb_6_8, qb_6_9, qb_6_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_7_0, qb_7_1, qb_7_2, qb_7_3, qb_7_4, qb_7_5, qb_7_6, qb_7_7, qb_7_8, qb_7_9, qb_7_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_8_0, qb_8_1, qb_8_2, qb_8_3, qb_8_4, qb_8_5, qb_8_6, qb_8_7, qb_8_8, qb_8_9, qb_8_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_9_0, qb_9_1, qb_9_2, qb_9_3, qb_9_4, qb_9_5, qb_9_6, qb_9_7, qb_9_8, qb_9_9, qb_9_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 - qb_10_0, qb_10_1, qb_10_2, qb_10_3, qb_10_4, qb_10_5, qb_10_6, qb_10_7, qb_10_8, qb_10_9, qb_10_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + hdiv_leg_quad_p0p2_b1_by, hdiv_leg_quad_p0p3_b1_by, hdiv_leg_quad_p0p4_b1_by, hdiv_leg_quad_p0p5_b1_by, hdiv_leg_quad_p0p6_b1_by, hdiv_leg_quad_p0p7_b1_by, hdiv_leg_quad_p0p8_b1_by, hdiv_leg_quad_p0p9_b1_by, hdiv_leg_quad_p0p10_b1_by, hdiv_leg_quad_p0p11_b1_by, hdiv_leg_quad_p1p2_b1_by, hdiv_leg_quad_p1p3_b1_by, hdiv_leg_quad_p1p4_b1_by, hdiv_leg_quad_p1p5_b1_by, hdiv_leg_quad_p1p6_b1_by, hdiv_leg_quad_p1p7_b1_by, hdiv_leg_quad_p1p8_b1_by, hdiv_leg_quad_p1p9_b1_by, hdiv_leg_quad_p1p10_b1_by, hdiv_leg_quad_p1p11_b1_by, hdiv_leg_quad_p2p2_b1_by, hdiv_leg_quad_p2p3_b1_by, hdiv_leg_quad_p2p4_b1_by, hdiv_leg_quad_p2p5_b1_by, hdiv_leg_quad_p2p6_b1_by, hdiv_leg_quad_p2p7_b1_by, hdiv_leg_quad_p2p8_b1_by, hdiv_leg_quad_p2p9_b1_by, hdiv_leg_quad_p2p10_b1_by, hdiv_leg_quad_p2p11_b1_by, hdiv_leg_quad_p3p2_b1_by, hdiv_leg_quad_p3p3_b1_by, hdiv_leg_quad_p3p4_b1_by, hdiv_leg_quad_p3p5_b1_by, hdiv_leg_quad_p3p6_b1_by, hdiv_leg_quad_p3p7_b1_by, hdiv_leg_quad_p3p8_b1_by, hdiv_leg_quad_p3p9_b1_by, hdiv_leg_quad_p3p10_b1_by, hdiv_leg_quad_p3p11_b1_by, hdiv_leg_quad_p4p2_b1_by, hdiv_leg_quad_p4p3_b1_by, hdiv_leg_quad_p4p4_b1_by, hdiv_leg_quad_p4p5_b1_by, hdiv_leg_quad_p4p6_b1_by, hdiv_leg_quad_p4p7_b1_by, hdiv_leg_quad_p4p8_b1_by, hdiv_leg_quad_p4p9_b1_by, hdiv_leg_quad_p4p10_b1_by, hdiv_leg_quad_p4p11_b1_by, hdiv_leg_quad_p5p2_b1_by, hdiv_leg_quad_p5p3_b1_by, hdiv_leg_quad_p5p4_b1_by, hdiv_leg_quad_p5p5_b1_by, hdiv_leg_quad_p5p6_b1_by, hdiv_leg_quad_p5p7_b1_by, hdiv_leg_quad_p5p8_b1_by, hdiv_leg_quad_p5p9_b1_by, hdiv_leg_quad_p5p10_b1_by, hdiv_leg_quad_p5p11_b1_by, hdiv_leg_quad_p6p2_b1_by, hdiv_leg_quad_p6p3_b1_by, hdiv_leg_quad_p6p4_b1_by, hdiv_leg_quad_p6p5_b1_by, hdiv_leg_quad_p6p6_b1_by, hdiv_leg_quad_p6p7_b1_by, hdiv_leg_quad_p6p8_b1_by, hdiv_leg_quad_p6p9_b1_by, hdiv_leg_quad_p6p10_b1_by, hdiv_leg_quad_p6p11_b1_by, hdiv_leg_quad_p7p2_b1_by, hdiv_leg_quad_p7p3_b1_by, hdiv_leg_quad_p7p4_b1_by, hdiv_leg_quad_p7p5_b1_by, hdiv_leg_quad_p7p6_b1_by, hdiv_leg_quad_p7p7_b1_by, hdiv_leg_quad_p7p8_b1_by, hdiv_leg_quad_p7p9_b1_by, hdiv_leg_quad_p7p10_b1_by, hdiv_leg_quad_p7p11_b1_by, hdiv_leg_quad_p8p2_b1_by, hdiv_leg_quad_p8p3_b1_by, hdiv_leg_quad_p8p4_b1_by, hdiv_leg_quad_p8p5_b1_by, hdiv_leg_quad_p8p6_b1_by, hdiv_leg_quad_p8p7_b1_by, hdiv_leg_quad_p8p8_b1_by, hdiv_leg_quad_p8p9_b1_by, hdiv_leg_quad_p8p10_b1_by, hdiv_leg_quad_p8p11_b1_by, hdiv_leg_quad_p9p2_b1_by, hdiv_leg_quad_p9p3_b1_by, hdiv_leg_quad_p9p4_b1_by, hdiv_leg_quad_p9p5_b1_by, hdiv_leg_quad_p9p6_b1_by, hdiv_leg_quad_p9p7_b1_by, hdiv_leg_quad_p9p8_b1_by, hdiv_leg_quad_p9p9_b1_by, hdiv_leg_quad_p9p10_b1_by, hdiv_leg_quad_p9p11_b1_by, hdiv_leg_quad_p10p2_b1_by, hdiv_leg_quad_p10p3_b1_by, hdiv_leg_quad_p10p4_b1_by, hdiv_leg_quad_p10p5_b1_by, hdiv_leg_quad_p10p6_b1_by, hdiv_leg_quad_p10p7_b1_by, hdiv_leg_quad_p10p8_b1_by, hdiv_leg_quad_p10p9_b1_by, hdiv_leg_quad_p10p10_b1_by, hdiv_leg_quad_p10p11_b1_by, hdiv_leg_quad_p2p0_b2_by, hdiv_leg_quad_p2p1_b2_by, hdiv_leg_quad_p2p2_b2_by, hdiv_leg_quad_p2p3_b2_by, hdiv_leg_quad_p2p4_b2_by, hdiv_leg_quad_p2p5_b2_by, hdiv_leg_quad_p2p6_b2_by, hdiv_leg_quad_p2p7_b2_by, hdiv_leg_quad_p2p8_b2_by, hdiv_leg_quad_p2p9_b2_by, hdiv_leg_quad_p2p10_b2_by, hdiv_leg_quad_p3p0_b2_by, hdiv_leg_quad_p3p1_b2_by, hdiv_leg_quad_p3p2_b2_by, hdiv_leg_quad_p3p3_b2_by, hdiv_leg_quad_p3p4_b2_by, hdiv_leg_quad_p3p5_b2_by, hdiv_leg_quad_p3p6_b2_by, hdiv_leg_quad_p3p7_b2_by, hdiv_leg_quad_p3p8_b2_by, hdiv_leg_quad_p3p9_b2_by, hdiv_leg_quad_p3p10_b2_by, hdiv_leg_quad_p4p0_b2_by, hdiv_leg_quad_p4p1_b2_by, hdiv_leg_quad_p4p2_b2_by, hdiv_leg_quad_p4p3_b2_by, hdiv_leg_quad_p4p4_b2_by, hdiv_leg_quad_p4p5_b2_by, hdiv_leg_quad_p4p6_b2_by, hdiv_leg_quad_p4p7_b2_by, hdiv_leg_quad_p4p8_b2_by, hdiv_leg_quad_p4p9_b2_by, hdiv_leg_quad_p4p10_b2_by, hdiv_leg_quad_p5p0_b2_by, hdiv_leg_quad_p5p1_b2_by, hdiv_leg_quad_p5p2_b2_by, hdiv_leg_quad_p5p3_b2_by, hdiv_leg_quad_p5p4_b2_by, hdiv_leg_quad_p5p5_b2_by, hdiv_leg_quad_p5p6_b2_by, hdiv_leg_quad_p5p7_b2_by, hdiv_leg_quad_p5p8_b2_by, hdiv_leg_quad_p5p9_b2_by, hdiv_leg_quad_p5p10_b2_by, hdiv_leg_quad_p6p0_b2_by, hdiv_leg_quad_p6p1_b2_by, hdiv_leg_quad_p6p2_b2_by, hdiv_leg_quad_p6p3_b2_by, hdiv_leg_quad_p6p4_b2_by, hdiv_leg_quad_p6p5_b2_by, hdiv_leg_quad_p6p6_b2_by, hdiv_leg_quad_p6p7_b2_by, hdiv_leg_quad_p6p8_b2_by, hdiv_leg_quad_p6p9_b2_by, hdiv_leg_quad_p6p10_b2_by, hdiv_leg_quad_p7p0_b2_by, hdiv_leg_quad_p7p1_b2_by, hdiv_leg_quad_p7p2_b2_by, hdiv_leg_quad_p7p3_b2_by, hdiv_leg_quad_p7p4_b2_by, hdiv_leg_quad_p7p5_b2_by, hdiv_leg_quad_p7p6_b2_by, hdiv_leg_quad_p7p7_b2_by, hdiv_leg_quad_p7p8_b2_by, hdiv_leg_quad_p7p9_b2_by, hdiv_leg_quad_p7p10_b2_by, hdiv_leg_quad_p8p0_b2_by, hdiv_leg_quad_p8p1_b2_by, hdiv_leg_quad_p8p2_b2_by, hdiv_leg_quad_p8p3_b2_by, hdiv_leg_quad_p8p4_b2_by, hdiv_leg_quad_p8p5_b2_by, hdiv_leg_quad_p8p6_b2_by, hdiv_leg_quad_p8p7_b2_by, hdiv_leg_quad_p8p8_b2_by, hdiv_leg_quad_p8p9_b2_by, hdiv_leg_quad_p8p10_b2_by, hdiv_leg_quad_p9p0_b2_by, hdiv_leg_quad_p9p1_b2_by, hdiv_leg_quad_p9p2_b2_by, hdiv_leg_quad_p9p3_b2_by, hdiv_leg_quad_p9p4_b2_by, hdiv_leg_quad_p9p5_b2_by, hdiv_leg_quad_p9p6_b2_by, hdiv_leg_quad_p9p7_b2_by, hdiv_leg_quad_p9p8_b2_by, hdiv_leg_quad_p9p9_b2_by, hdiv_leg_quad_p9p10_b2_by, hdiv_leg_quad_p10p0_b2_by, hdiv_leg_quad_p10p1_b2_by, hdiv_leg_quad_p10p2_b2_by, hdiv_leg_quad_p10p3_b2_by, hdiv_leg_quad_p10p4_b2_by, hdiv_leg_quad_p10p5_b2_by, hdiv_leg_quad_p10p6_b2_by, hdiv_leg_quad_p10p7_b2_by, hdiv_leg_quad_p10p8_b2_by, hdiv_leg_quad_p10p9_b2_by, hdiv_leg_quad_p10p10_b2_by, hdiv_leg_quad_p11p0_b2_by, hdiv_leg_quad_p11p1_b2_by, hdiv_leg_quad_p11p2_b2_by, hdiv_leg_quad_p11p3_b2_by, hdiv_leg_quad_p11p4_b2_by, hdiv_leg_quad_p11p5_b2_by, hdiv_leg_quad_p11p6_b2_by, hdiv_leg_quad_p11p7_b2_by, hdiv_leg_quad_p11p8_b2_by, hdiv_leg_quad_p11p9_b2_by, hdiv_leg_quad_p11p10_b2_by, }; + + static short qb_0_1[] = { 88, }; + static short qb_0_2[] = { 88, 89, }; + static short qb_0_3[] = { 88, 89, 90, }; + static short qb_0_4[] = { 88, 89, 90, 91, }; + static short qb_0_5[] = { 88, 89, 90, 91, 92, }; + static short qb_0_6[] = { 88, 89, 90, 91, 92, 93, }; + static short qb_0_7[] = { 88, 89, 90, 91, 92, 93, 94, }; + static short qb_0_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, }; + static short qb_0_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, }; + static short qb_0_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, }; + static short qb_1_0[] = { 198, }; + static short qb_1_1[] = { 88, 198, 98, 199, }; + static short qb_1_2[] = { 88, 89, 198, 98, 199, 99, 200, }; + static short qb_1_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, }; + static short qb_1_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, }; + static short qb_1_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, }; + static short qb_1_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, }; + static short qb_1_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, }; + static short qb_1_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, }; + static short qb_1_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, }; + static short qb_1_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, }; + static short qb_2_0[] = { 198, 209, }; + static short qb_2_1[] = { 88, 198, 98, 199, 209, 108, 210, }; + static short qb_2_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, }; + static short qb_2_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, }; + static short qb_2_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, }; + static short qb_2_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, }; + static short qb_2_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, }; + static short qb_2_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, }; + static short qb_2_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, }; + static short qb_2_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, }; + static short qb_2_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, }; + static short qb_3_0[] = { 198, 209, 220, }; + static short qb_3_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, }; + static short qb_3_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, }; + static short qb_3_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, }; + static short qb_3_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, }; + static short qb_3_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, }; + static short qb_3_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, }; + static short qb_3_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, }; + static short qb_3_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, }; + static short qb_3_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, }; + static short qb_3_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, }; + static short qb_4_0[] = { 198, 209, 220, 231, }; + static short qb_4_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, }; + static short qb_4_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, }; + static short qb_4_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, }; + static short qb_4_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, }; + static short qb_4_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, }; + static short qb_4_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, }; + static short qb_4_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, }; + static short qb_4_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, }; + static short qb_4_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, }; + static short qb_4_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, }; + static short qb_5_0[] = { 198, 209, 220, 231, 242, }; + static short qb_5_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, }; + static short qb_5_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, }; + static short qb_5_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, }; + static short qb_5_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, }; + static short qb_5_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, }; + static short qb_5_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, }; + static short qb_5_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, }; + static short qb_5_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, }; + static short qb_5_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, }; + static short qb_5_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, }; + static short qb_6_0[] = { 198, 209, 220, 231, 242, 253, }; + static short qb_6_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, }; + static short qb_6_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, }; + static short qb_6_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, }; + static short qb_6_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, }; + static short qb_6_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, }; + static short qb_6_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, }; + static short qb_6_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, }; + static short qb_6_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, }; + static short qb_6_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, }; + static short qb_6_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, }; + static short qb_7_0[] = { 198, 209, 220, 231, 242, 253, 264, }; + static short qb_7_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, }; + static short qb_7_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, }; + static short qb_7_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, }; + static short qb_7_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, }; + static short qb_7_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, }; + static short qb_7_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, }; + static short qb_7_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, }; + static short qb_7_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, }; + static short qb_7_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, }; + static short qb_7_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, }; + static short qb_8_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, }; + static short qb_8_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, }; + static short qb_8_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, }; + static short qb_8_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, }; + static short qb_8_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, }; + static short qb_8_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, }; + static short qb_8_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, }; + static short qb_8_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, }; + static short qb_8_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, }; + static short qb_8_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, }; + static short qb_8_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, }; + static short qb_9_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, 286, }; + static short qb_9_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, 286, 178, 287, }; + static short qb_9_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, 286, 178, 287, 179, 288, }; + static short qb_9_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, 286, 178, 287, 179, 288, 180, 289, }; + static short qb_9_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, 286, 178, 287, 179, 288, 180, 289, 181, 290, }; + static short qb_9_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, }; + static short qb_9_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, }; + static short qb_9_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, }; + static short qb_9_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, }; + static short qb_9_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, }; + static short qb_9_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 187, 296, }; + static short qb_10_0[] = { 198, 209, 220, 231, 242, 253, 264, 275, 286, 297, }; + static short qb_10_1[] = { 88, 198, 98, 199, 209, 108, 210, 220, 118, 221, 231, 128, 232, 242, 138, 243, 253, 148, 254, 264, 158, 265, 275, 168, 276, 286, 178, 287, 297, 188, 298, }; + static short qb_10_2[] = { 88, 89, 198, 98, 199, 99, 200, 209, 108, 210, 109, 211, 220, 118, 221, 119, 222, 231, 128, 232, 129, 233, 242, 138, 243, 139, 244, 253, 148, 254, 149, 255, 264, 158, 265, 159, 266, 275, 168, 276, 169, 277, 286, 178, 287, 179, 288, 297, 188, 298, 189, 299, }; + static short qb_10_3[] = { 88, 89, 90, 198, 98, 199, 99, 200, 100, 201, 209, 108, 210, 109, 211, 110, 212, 220, 118, 221, 119, 222, 120, 223, 231, 128, 232, 129, 233, 130, 234, 242, 138, 243, 139, 244, 140, 245, 253, 148, 254, 149, 255, 150, 256, 264, 158, 265, 159, 266, 160, 267, 275, 168, 276, 169, 277, 170, 278, 286, 178, 287, 179, 288, 180, 289, 297, 188, 298, 189, 299, 190, 300, }; + static short qb_10_4[] = { 88, 89, 90, 91, 198, 98, 199, 99, 200, 100, 201, 101, 202, 209, 108, 210, 109, 211, 110, 212, 111, 213, 220, 118, 221, 119, 222, 120, 223, 121, 224, 231, 128, 232, 129, 233, 130, 234, 131, 235, 242, 138, 243, 139, 244, 140, 245, 141, 246, 253, 148, 254, 149, 255, 150, 256, 151, 257, 264, 158, 265, 159, 266, 160, 267, 161, 268, 275, 168, 276, 169, 277, 170, 278, 171, 279, 286, 178, 287, 179, 288, 180, 289, 181, 290, 297, 188, 298, 189, 299, 190, 300, 191, 301, }; + static short qb_10_5[] = { 88, 89, 90, 91, 92, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, }; + static short qb_10_6[] = { 88, 89, 90, 91, 92, 93, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, }; + static short qb_10_7[] = { 88, 89, 90, 91, 92, 93, 94, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, }; + static short qb_10_8[] = { 88, 89, 90, 91, 92, 93, 94, 95, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, }; + static short qb_10_9[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, 196, 306, }; + static short qb_10_10[] = { 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 198, 98, 199, 99, 200, 100, 201, 101, 202, 102, 203, 103, 204, 104, 205, 105, 206, 106, 207, 107, 208, 209, 108, 210, 109, 211, 110, 212, 111, 213, 112, 214, 113, 215, 114, 216, 115, 217, 116, 218, 117, 219, 220, 118, 221, 119, 222, 120, 223, 121, 224, 122, 225, 123, 226, 124, 227, 125, 228, 126, 229, 127, 230, 231, 128, 232, 129, 233, 130, 234, 131, 235, 132, 236, 133, 237, 134, 238, 135, 239, 136, 240, 137, 241, 242, 138, 243, 139, 244, 140, 245, 141, 246, 142, 247, 143, 248, 144, 249, 145, 250, 146, 251, 147, 252, 253, 148, 254, 149, 255, 150, 256, 151, 257, 152, 258, 153, 259, 154, 260, 155, 261, 156, 262, 157, 263, 264, 158, 265, 159, 266, 160, 267, 161, 268, 162, 269, 163, 270, 164, 271, 165, 272, 166, 273, 167, 274, 275, 168, 276, 169, 277, 170, 278, 171, 279, 172, 280, 173, 281, 174, 282, 175, 283, 176, 284, 177, 285, 286, 178, 287, 179, 288, 180, 289, 181, 290, 182, 291, 183, 292, 184, 293, 185, 294, 186, 295, 187, 296, 297, 188, 298, 189, 299, 190, 300, 191, 301, 192, 302, 193, 303, 194, 304, 195, 305, 196, 306, 197, 307, }; + +#define nullptr16 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + + static short* hdiv_leg_quad_bubble_indices[] = + { + nullptr, qb_0_1, qb_0_2, qb_0_3, qb_0_4, qb_0_5, qb_0_6, qb_0_7, qb_0_8, qb_0_9, qb_0_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_1_0, qb_1_1, qb_1_2, qb_1_3, qb_1_4, qb_1_5, qb_1_6, qb_1_7, qb_1_8, qb_1_9, qb_1_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_2_0, qb_2_1, qb_2_2, qb_2_3, qb_2_4, qb_2_5, qb_2_6, qb_2_7, qb_2_8, qb_2_9, qb_2_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_3_0, qb_3_1, qb_3_2, qb_3_3, qb_3_4, qb_3_5, qb_3_6, qb_3_7, qb_3_8, qb_3_9, qb_3_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_4_0, qb_4_1, qb_4_2, qb_4_3, qb_4_4, qb_4_5, qb_4_6, qb_4_7, qb_4_8, qb_4_9, qb_4_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_5_0, qb_5_1, qb_5_2, qb_5_3, qb_5_4, qb_5_5, qb_5_6, qb_5_7, qb_5_8, qb_5_9, qb_5_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_6_0, qb_6_1, qb_6_2, qb_6_3, qb_6_4, qb_6_5, qb_6_6, qb_6_7, qb_6_8, qb_6_9, qb_6_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_7_0, qb_7_1, qb_7_2, qb_7_3, qb_7_4, qb_7_5, qb_7_6, qb_7_7, qb_7_8, qb_7_9, qb_7_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_8_0, qb_8_1, qb_8_2, qb_8_3, qb_8_4, qb_8_5, qb_8_6, qb_8_7, qb_8_8, qb_8_9, qb_8_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_9_0, qb_9_1, qb_9_2, qb_9_3, qb_9_4, qb_9_5, qb_9_6, qb_9_7, qb_9_8, qb_9_9, qb_9_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 + qb_10_0, qb_10_1, qb_10_2, qb_10_3, qb_10_4, qb_10_5, qb_10_6, qb_10_7, qb_10_8, qb_10_9, qb_10_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16 }; - #define zero16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - static int hdiv_leg_quad_bubble_count[] = - { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, zero16 - 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 0, 0, 0, 0, 0, zero16 - 2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 0, 0, 0, 0, 0, zero16 - 3, 10, 17, 24, 31, 38, 45, 52, 59, 66, 73, 0, 0, 0, 0, 0, zero16 - 4, 13, 22, 31, 40, 49, 58, 67, 76, 85, 94, 0, 0, 0, 0, 0, zero16 - 5, 16, 27, 38, 49, 60, 71, 82, 93, 104, 115, 0, 0, 0, 0, 0, zero16 - 6, 19, 32, 45, 58, 71, 84, 97, 110, 123, 136, 0, 0, 0, 0, 0, zero16 - 7, 22, 37, 52, 67, 82, 97, 112, 127, 142, 157, 0, 0, 0, 0, 0, zero16 - 8, 25, 42, 59, 76, 93, 110, 127, 144, 161, 178, 0, 0, 0, 0, 0, zero16 - 9, 28, 47, 66, 85, 104, 123, 142, 161, 180, 199, 0, 0, 0, 0, 0, zero16 - 10, 31, 52, 73, 94, 115, 136, 157, 178, 199, 220, 0, 0, 0, 0, 0, zero16 +#define zero16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + static unsigned short hdiv_leg_quad_bubble_count[] = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, zero16 + 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 0, 0, 0, 0, 0, zero16 + 2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 0, 0, 0, 0, 0, zero16 + 3, 10, 17, 24, 31, 38, 45, 52, 59, 66, 73, 0, 0, 0, 0, 0, zero16 + 4, 13, 22, 31, 40, 49, 58, 67, 76, 85, 94, 0, 0, 0, 0, 0, zero16 + 5, 16, 27, 38, 49, 60, 71, 82, 93, 104, 115, 0, 0, 0, 0, 0, zero16 + 6, 19, 32, 45, 58, 71, 84, 97, 110, 123, 136, 0, 0, 0, 0, 0, zero16 + 7, 22, 37, 52, 67, 82, 97, 112, 127, 142, 157, 0, 0, 0, 0, 0, zero16 + 8, 25, 42, 59, 76, 93, 110, 127, 144, 161, 178, 0, 0, 0, 0, 0, zero16 + 9, 28, 47, 66, 85, 104, 123, 142, 161, 180, 199, 0, 0, 0, 0, 0, zero16 + 10, 31, 52, 73, 94, 115, 136, 157, 178, 199, 220, 0, 0, 0, 0, 0, zero16 }; - static int hdiv_leg_quad_vertex_indices[4] ={-1, -1, -1, -1}; + static short hdiv_leg_quad_vertex_indices[4] = { -1, -1, -1, -1 }; - static int hdiv_leg_quad_edge_indices_0[] = { 4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, 52, 53, 60, 61, 68, 69, 76, 77, 84, 85, }; + static short hdiv_leg_quad_edge_indices_0[] = { 4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, 52, 53, 60, 61, 68, 69, 76, 77, 84, 85, }; - static int hdiv_leg_quad_edge_indices_1[] = { 2, 3, 10, 11, 18, 19, 26, 27, 34, 35, 42, 43, 50, 51, 58, 59, 66, 67, 74, 75, 82, 83, }; + static short hdiv_leg_quad_edge_indices_1[] = { 2, 3, 10, 11, 18, 19, 26, 27, 34, 35, 42, 43, 50, 51, 58, 59, 66, 67, 74, 75, 82, 83, }; - static int hdiv_leg_quad_edge_indices_2[] = { 6, 7, 14, 15, 22, 23, 30, 31, 38, 39, 46, 47, 54, 55, 62, 63, 70, 71, 78, 79, 86, 87, }; + static short hdiv_leg_quad_edge_indices_2[] = { 6, 7, 14, 15, 22, 23, 30, 31, 38, 39, 46, 47, 54, 55, 62, 63, 70, 71, 78, 79, 86, 87, }; - static int hdiv_leg_quad_edge_indices_3[] = { 0, 1, 8, 9, 16, 17, 24, 25, 32, 33, 40, 41, 48, 49, 56, 57, 64, 65, 72, 73, 80, 81, }; + static short hdiv_leg_quad_edge_indices_3[] = { 0, 1, 8, 9, 16, 17, 24, 25, 32, 33, 40, 41, 48, 49, 56, 57, 64, 65, 72, 73, 80, 81, }; - static int* hdiv_leg_quad_edge_indices[4] = + static short* hdiv_leg_quad_edge_indices[4] = { hdiv_leg_quad_edge_indices_0, hdiv_leg_quad_edge_indices_1, @@ -8599,23 +8599,23 @@ namespace Hermes hdiv_leg_quad_edge_indices_3, }; - #define oo H2D_MAKE_QUAD_ORDER +#define oo H2D_MAKE_QUAD_ORDER - static int hdiv_leg_quad_index_to_order[] = + static unsigned short hdiv_leg_quad_index_to_order[] = { - oo(1, 0), oo(1, 0), oo(1, 0), oo(1, 0), oo(0, 1), oo(0, 1), oo(0, 1), oo(0, 1), - oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), - oo(1, 2), oo(1, 2), oo(1, 2), oo(1, 2), oo(2, 1), oo(2, 1), oo(2, 1), oo(2, 1), - oo(1, 3), oo(1, 3), oo(1, 3), oo(1, 3), oo(3, 1), oo(3, 1), oo(3, 1), oo(3, 1), - oo(1, 4), oo(1, 4), oo(1, 4), oo(1, 4), oo(4, 1), oo(4, 1), oo(4, 1), oo(4, 1), - oo(1, 5), oo(1, 5), oo(1, 5), oo(1, 5), oo(5, 1), oo(5, 1), oo(5, 1), oo(5, 1), - oo(1, 6), oo(1, 6), oo(1, 6), oo(1, 6), oo(6, 1), oo(6, 1), oo(6, 1), oo(6, 1), - oo(1, 7), oo(1, 7), oo(1, 7), oo(1, 7), oo(7, 1), oo(7, 1), oo(7, 1), oo(7, 1), - oo(1, 8), oo(1, 8), oo(1, 8), oo(1, 8), oo(8, 1), oo(8, 1), oo(8, 1), oo(8, 1), - oo(1, 9), oo(1, 9), oo(1, 9), oo(1, 9), oo(9, 1), oo(9, 1), oo(9, 1), oo(9, 1), - oo(1, 10), oo(1, 10), oo(1, 10), oo(1, 10), oo(10, 1), oo(10, 1), oo(10, 1), oo(10, 1), + oo(1, 0), oo(1, 0), oo(1, 0), oo(1, 0), oo(0, 1), oo(0, 1), oo(0, 1), oo(0, 1), + oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), oo(1, 1), + oo(1, 2), oo(1, 2), oo(1, 2), oo(1, 2), oo(2, 1), oo(2, 1), oo(2, 1), oo(2, 1), + oo(1, 3), oo(1, 3), oo(1, 3), oo(1, 3), oo(3, 1), oo(3, 1), oo(3, 1), oo(3, 1), + oo(1, 4), oo(1, 4), oo(1, 4), oo(1, 4), oo(4, 1), oo(4, 1), oo(4, 1), oo(4, 1), + oo(1, 5), oo(1, 5), oo(1, 5), oo(1, 5), oo(5, 1), oo(5, 1), oo(5, 1), oo(5, 1), + oo(1, 6), oo(1, 6), oo(1, 6), oo(1, 6), oo(6, 1), oo(6, 1), oo(6, 1), oo(6, 1), + oo(1, 7), oo(1, 7), oo(1, 7), oo(1, 7), oo(7, 1), oo(7, 1), oo(7, 1), oo(7, 1), + oo(1, 8), oo(1, 8), oo(1, 8), oo(1, 8), oo(8, 1), oo(8, 1), oo(8, 1), oo(8, 1), + oo(1, 9), oo(1, 9), oo(1, 9), oo(1, 9), oo(9, 1), oo(9, 1), oo(9, 1), oo(9, 1), + oo(1, 10), oo(1, 10), oo(1, 10), oo(1, 10), oo(10, 1), oo(10, 1), oo(10, 1), oo(10, 1), - oo(0, 2), oo(0, 3), oo(0, 4), oo(0, 5), oo(0, 6), oo(0, 7), oo(0, 8), oo(0, 9), oo(0, 10), oo(0, 11), oo(1, 2), oo(1, 3), oo(1, 4), oo(1, 5), oo(1, 6), oo(1, 7), oo(1, 8), oo(1, 9), oo(1, 10), oo(1, 11), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), oo(2, 11), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), oo(3, 11), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), oo(4, 11), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), oo(5, 11), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), oo(6, 11), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), oo(7, 11), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), oo(8, 11), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), oo(9, 11), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), oo(10, 11), oo(2, 0), oo(2, 1), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), oo(3, 0), oo(3, 1), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), oo(4, 0), oo(4, 1), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), oo(5, 0), oo(5, 1), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), oo(6, 0), oo(6, 1), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), oo(7, 0), oo(7, 1), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), oo(8, 0), oo(8, 1), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), oo(9, 0), oo(9, 1), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), oo(10, 0), oo(10, 1), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), oo(11, 0), oo(11, 1), oo(11, 2), oo(11, 3), oo(11, 4), oo(11, 5), oo(11, 6), oo(11, 7), oo(11, 8), oo(11, 9), oo(11, 10), + oo(0, 2), oo(0, 3), oo(0, 4), oo(0, 5), oo(0, 6), oo(0, 7), oo(0, 8), oo(0, 9), oo(0, 10), oo(0, 11), oo(1, 2), oo(1, 3), oo(1, 4), oo(1, 5), oo(1, 6), oo(1, 7), oo(1, 8), oo(1, 9), oo(1, 10), oo(1, 11), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), oo(2, 11), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), oo(3, 11), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), oo(4, 11), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), oo(5, 11), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), oo(6, 11), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), oo(7, 11), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), oo(8, 11), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), oo(9, 11), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), oo(10, 11), oo(2, 0), oo(2, 1), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), oo(3, 0), oo(3, 1), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), oo(4, 0), oo(4, 1), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), oo(5, 0), oo(5, 1), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), oo(6, 0), oo(6, 1), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), oo(7, 0), oo(7, 1), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), oo(8, 0), oo(8, 1), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), oo(9, 0), oo(9, 1), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), oo(10, 0), oo(10, 1), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), oo(11, 0), oo(11, 1), oo(11, 2), oo(11, 3), oo(11, 4), oo(11, 5), oo(11, 6), oo(11, 7), oo(11, 8), oo(11, 9), oo(11, 10), }; static Shapeset::shape_fn_t* hdiv_leg_quad_shape_fn_table[2] = @@ -8656,37 +8656,37 @@ namespace Hermes hdiv_leg_quad_shape_fn_table_y }; - static int* hdiv_leg_vertex_indices[2] = + static short* hdiv_leg_vertex_indices[2] = { nullptr, hdiv_leg_quad_vertex_indices }; - static int** hdiv_leg_edge_indices[2] = + static short** hdiv_leg_edge_indices[2] = { nullptr, hdiv_leg_quad_edge_indices }; - static int** hdiv_leg_bubble_indices[2] = + static short** hdiv_leg_bubble_indices[2] = { nullptr, hdiv_leg_quad_bubble_indices }; - static int* hdiv_leg_bubble_count[2] = + static unsigned short* hdiv_leg_bubble_count[2] = { nullptr, hdiv_leg_quad_bubble_count }; - static int* hdiv_leg_index_to_order[2] = + static unsigned short* hdiv_leg_index_to_order[2] = { nullptr, hdiv_leg_quad_index_to_order }; - int HdivShapesetLegendre::get_max_index(ElementMode2D mode) const { return max_index[mode]; } + unsigned short HdivShapesetLegendre::get_max_index(ElementMode2D mode) const { return max_index[mode]; } HdivShapesetLegendre::HdivShapesetLegendre() { @@ -8705,29 +8705,30 @@ namespace Hermes ref_vert[0][0][0] = -1.0; ref_vert[0][0][1] = -1.0; - ref_vert[0][1][0] = 1.0; + ref_vert[0][1][0] = 1.0; ref_vert[0][1][1] = -1.0; ref_vert[0][2][0] = -1.0; - ref_vert[0][2][1] = 1.0; + ref_vert[0][2][1] = 1.0; ref_vert[1][0][0] = -1.0; ref_vert[1][0][1] = -1.0; - ref_vert[1][1][0] = 1.0; + ref_vert[1][1][0] = 1.0; ref_vert[1][1][1] = -1.0; - ref_vert[1][2][0] = 1.0; - ref_vert[1][2][1] = 1.0; + ref_vert[1][2][0] = 1.0; + ref_vert[1][2][1] = 1.0; ref_vert[1][3][0] = -1.0; - ref_vert[1][3][1] = 1.0; + ref_vert[1][3][1] = 1.0; max_order = 10; min_order = 0; num_components = 2; - ebias = 0; // TODO + // TODO + ebias = 0; comb_table = nullptr; } - const int HdivShapesetLegendre::max_index[2] = { 149, 307 }; + const unsigned short HdivShapesetLegendre::max_index[2] = { 149, 307 }; } } \ No newline at end of file diff --git a/hermes2d/src/shapeset/shapeset_l2_legendre.cpp b/hermes2d/src/shapeset/shapeset_l2_legendre.cpp index ebb35888c5..8924f227ca 100644 --- a/hermes2d/src/shapeset/shapeset_l2_legendre.cpp +++ b/hermes2d/src/shapeset/shapeset_l2_legendre.cpp @@ -3654,343 +3654,343 @@ namespace Hermes static Shapeset::shape_fn_t leg_quad_fn[] = { - leg_quad_l0_l0, leg_quad_l0_l1, leg_quad_l0_l2, leg_quad_l0_l3, leg_quad_l0_l4, - leg_quad_l0_l5, leg_quad_l0_l6, leg_quad_l0_l7, leg_quad_l0_l8, leg_quad_l0_l9, - leg_quad_l0_l10, leg_quad_l1_l0, leg_quad_l1_l1, leg_quad_l1_l2, leg_quad_l1_l3, - leg_quad_l1_l4, leg_quad_l1_l5, leg_quad_l1_l6, leg_quad_l1_l7, leg_quad_l1_l8, - leg_quad_l1_l9, leg_quad_l1_l10, leg_quad_l2_l0, leg_quad_l2_l1, leg_quad_l2_l2, - leg_quad_l2_l3, leg_quad_l2_l4, leg_quad_l2_l5, leg_quad_l2_l6, leg_quad_l2_l7, - leg_quad_l2_l8, leg_quad_l2_l9, leg_quad_l2_l10, leg_quad_l3_l0, leg_quad_l3_l1, - leg_quad_l3_l2, leg_quad_l3_l3, leg_quad_l3_l4, leg_quad_l3_l5, leg_quad_l3_l6, - leg_quad_l3_l7, leg_quad_l3_l8, leg_quad_l3_l9, leg_quad_l3_l10, leg_quad_l4_l0, - leg_quad_l4_l1, leg_quad_l4_l2, leg_quad_l4_l3, leg_quad_l4_l4, leg_quad_l4_l5, - leg_quad_l4_l6, leg_quad_l4_l7, leg_quad_l4_l8, leg_quad_l4_l9, leg_quad_l4_l10, - leg_quad_l5_l0, leg_quad_l5_l1, leg_quad_l5_l2, leg_quad_l5_l3, leg_quad_l5_l4, - leg_quad_l5_l5, leg_quad_l5_l6, leg_quad_l5_l7, leg_quad_l5_l8, leg_quad_l5_l9, - leg_quad_l5_l10, leg_quad_l6_l0, leg_quad_l6_l1, leg_quad_l6_l2, leg_quad_l6_l3, - leg_quad_l6_l4, leg_quad_l6_l5, leg_quad_l6_l6, leg_quad_l6_l7, leg_quad_l6_l8, - leg_quad_l6_l9, leg_quad_l6_l10, leg_quad_l7_l0, leg_quad_l7_l1, leg_quad_l7_l2, - leg_quad_l7_l3, leg_quad_l7_l4, leg_quad_l7_l5, leg_quad_l7_l6, leg_quad_l7_l7, - leg_quad_l7_l8, leg_quad_l7_l9, leg_quad_l7_l10, leg_quad_l8_l0, leg_quad_l8_l1, - leg_quad_l8_l2, leg_quad_l8_l3, leg_quad_l8_l4, leg_quad_l8_l5, leg_quad_l8_l6, - leg_quad_l8_l7, leg_quad_l8_l8, leg_quad_l8_l9, leg_quad_l8_l10, leg_quad_l9_l0, - leg_quad_l9_l1, leg_quad_l9_l2, leg_quad_l9_l3, leg_quad_l9_l4, leg_quad_l9_l5, - leg_quad_l9_l6, leg_quad_l9_l7, leg_quad_l9_l8, leg_quad_l9_l9, leg_quad_l9_l10, - leg_quad_l10_l0, leg_quad_l10_l1, leg_quad_l10_l2, leg_quad_l10_l3, leg_quad_l10_l4, - leg_quad_l10_l5, leg_quad_l10_l6, leg_quad_l10_l7, leg_quad_l10_l8, leg_quad_l10_l9, + leg_quad_l0_l0, leg_quad_l0_l1, leg_quad_l0_l2, leg_quad_l0_l3, leg_quad_l0_l4, + leg_quad_l0_l5, leg_quad_l0_l6, leg_quad_l0_l7, leg_quad_l0_l8, leg_quad_l0_l9, + leg_quad_l0_l10, leg_quad_l1_l0, leg_quad_l1_l1, leg_quad_l1_l2, leg_quad_l1_l3, + leg_quad_l1_l4, leg_quad_l1_l5, leg_quad_l1_l6, leg_quad_l1_l7, leg_quad_l1_l8, + leg_quad_l1_l9, leg_quad_l1_l10, leg_quad_l2_l0, leg_quad_l2_l1, leg_quad_l2_l2, + leg_quad_l2_l3, leg_quad_l2_l4, leg_quad_l2_l5, leg_quad_l2_l6, leg_quad_l2_l7, + leg_quad_l2_l8, leg_quad_l2_l9, leg_quad_l2_l10, leg_quad_l3_l0, leg_quad_l3_l1, + leg_quad_l3_l2, leg_quad_l3_l3, leg_quad_l3_l4, leg_quad_l3_l5, leg_quad_l3_l6, + leg_quad_l3_l7, leg_quad_l3_l8, leg_quad_l3_l9, leg_quad_l3_l10, leg_quad_l4_l0, + leg_quad_l4_l1, leg_quad_l4_l2, leg_quad_l4_l3, leg_quad_l4_l4, leg_quad_l4_l5, + leg_quad_l4_l6, leg_quad_l4_l7, leg_quad_l4_l8, leg_quad_l4_l9, leg_quad_l4_l10, + leg_quad_l5_l0, leg_quad_l5_l1, leg_quad_l5_l2, leg_quad_l5_l3, leg_quad_l5_l4, + leg_quad_l5_l5, leg_quad_l5_l6, leg_quad_l5_l7, leg_quad_l5_l8, leg_quad_l5_l9, + leg_quad_l5_l10, leg_quad_l6_l0, leg_quad_l6_l1, leg_quad_l6_l2, leg_quad_l6_l3, + leg_quad_l6_l4, leg_quad_l6_l5, leg_quad_l6_l6, leg_quad_l6_l7, leg_quad_l6_l8, + leg_quad_l6_l9, leg_quad_l6_l10, leg_quad_l7_l0, leg_quad_l7_l1, leg_quad_l7_l2, + leg_quad_l7_l3, leg_quad_l7_l4, leg_quad_l7_l5, leg_quad_l7_l6, leg_quad_l7_l7, + leg_quad_l7_l8, leg_quad_l7_l9, leg_quad_l7_l10, leg_quad_l8_l0, leg_quad_l8_l1, + leg_quad_l8_l2, leg_quad_l8_l3, leg_quad_l8_l4, leg_quad_l8_l5, leg_quad_l8_l6, + leg_quad_l8_l7, leg_quad_l8_l8, leg_quad_l8_l9, leg_quad_l8_l10, leg_quad_l9_l0, + leg_quad_l9_l1, leg_quad_l9_l2, leg_quad_l9_l3, leg_quad_l9_l4, leg_quad_l9_l5, + leg_quad_l9_l6, leg_quad_l9_l7, leg_quad_l9_l8, leg_quad_l9_l9, leg_quad_l9_l10, + leg_quad_l10_l0, leg_quad_l10_l1, leg_quad_l10_l2, leg_quad_l10_l3, leg_quad_l10_l4, + leg_quad_l10_l5, leg_quad_l10_l6, leg_quad_l10_l7, leg_quad_l10_l8, leg_quad_l10_l9, leg_quad_l10_l10, }; static Shapeset::shape_fn_t leg_quad_fn_dx[] = { - leg_quad_l0_l0x, leg_quad_l0_l1x, leg_quad_l0_l2x, leg_quad_l0_l3x, leg_quad_l0_l4x, - leg_quad_l0_l5x, leg_quad_l0_l6x, leg_quad_l0_l7x, leg_quad_l0_l8x, leg_quad_l0_l9x, - leg_quad_l0_l10x, leg_quad_l1_l0x, leg_quad_l1_l1x, leg_quad_l1_l2x, leg_quad_l1_l3x, - leg_quad_l1_l4x, leg_quad_l1_l5x, leg_quad_l1_l6x, leg_quad_l1_l7x, leg_quad_l1_l8x, - leg_quad_l1_l9x, leg_quad_l1_l10x, leg_quad_l2_l0x, leg_quad_l2_l1x, leg_quad_l2_l2x, - leg_quad_l2_l3x, leg_quad_l2_l4x, leg_quad_l2_l5x, leg_quad_l2_l6x, leg_quad_l2_l7x, - leg_quad_l2_l8x, leg_quad_l2_l9x, leg_quad_l2_l10x, leg_quad_l3_l0x, leg_quad_l3_l1x, - leg_quad_l3_l2x, leg_quad_l3_l3x, leg_quad_l3_l4x, leg_quad_l3_l5x, leg_quad_l3_l6x, - leg_quad_l3_l7x, leg_quad_l3_l8x, leg_quad_l3_l9x, leg_quad_l3_l10x, leg_quad_l4_l0x, - leg_quad_l4_l1x, leg_quad_l4_l2x, leg_quad_l4_l3x, leg_quad_l4_l4x, leg_quad_l4_l5x, - leg_quad_l4_l6x, leg_quad_l4_l7x, leg_quad_l4_l8x, leg_quad_l4_l9x, leg_quad_l4_l10x, - leg_quad_l5_l0x, leg_quad_l5_l1x, leg_quad_l5_l2x, leg_quad_l5_l3x, leg_quad_l5_l4x, - leg_quad_l5_l5x, leg_quad_l5_l6x, leg_quad_l5_l7x, leg_quad_l5_l8x, leg_quad_l5_l9x, - leg_quad_l5_l10x, leg_quad_l6_l0x, leg_quad_l6_l1x, leg_quad_l6_l2x, leg_quad_l6_l3x, - leg_quad_l6_l4x, leg_quad_l6_l5x, leg_quad_l6_l6x, leg_quad_l6_l7x, leg_quad_l6_l8x, - leg_quad_l6_l9x, leg_quad_l6_l10x, leg_quad_l7_l0x, leg_quad_l7_l1x, leg_quad_l7_l2x, - leg_quad_l7_l3x, leg_quad_l7_l4x, leg_quad_l7_l5x, leg_quad_l7_l6x, leg_quad_l7_l7x, - leg_quad_l7_l8x, leg_quad_l7_l9x, leg_quad_l7_l10x, leg_quad_l8_l0x, leg_quad_l8_l1x, - leg_quad_l8_l2x, leg_quad_l8_l3x, leg_quad_l8_l4x, leg_quad_l8_l5x, leg_quad_l8_l6x, - leg_quad_l8_l7x, leg_quad_l8_l8x, leg_quad_l8_l9x, leg_quad_l8_l10x, leg_quad_l9_l0x, - leg_quad_l9_l1x, leg_quad_l9_l2x, leg_quad_l9_l3x, leg_quad_l9_l4x, leg_quad_l9_l5x, - leg_quad_l9_l6x, leg_quad_l9_l7x, leg_quad_l9_l8x, leg_quad_l9_l9x, leg_quad_l9_l10x, - leg_quad_l10_l0x, leg_quad_l10_l1x, leg_quad_l10_l2x, leg_quad_l10_l3x, leg_quad_l10_l4x, - leg_quad_l10_l5x, leg_quad_l10_l6x, leg_quad_l10_l7x, leg_quad_l10_l8x, leg_quad_l10_l9x, + leg_quad_l0_l0x, leg_quad_l0_l1x, leg_quad_l0_l2x, leg_quad_l0_l3x, leg_quad_l0_l4x, + leg_quad_l0_l5x, leg_quad_l0_l6x, leg_quad_l0_l7x, leg_quad_l0_l8x, leg_quad_l0_l9x, + leg_quad_l0_l10x, leg_quad_l1_l0x, leg_quad_l1_l1x, leg_quad_l1_l2x, leg_quad_l1_l3x, + leg_quad_l1_l4x, leg_quad_l1_l5x, leg_quad_l1_l6x, leg_quad_l1_l7x, leg_quad_l1_l8x, + leg_quad_l1_l9x, leg_quad_l1_l10x, leg_quad_l2_l0x, leg_quad_l2_l1x, leg_quad_l2_l2x, + leg_quad_l2_l3x, leg_quad_l2_l4x, leg_quad_l2_l5x, leg_quad_l2_l6x, leg_quad_l2_l7x, + leg_quad_l2_l8x, leg_quad_l2_l9x, leg_quad_l2_l10x, leg_quad_l3_l0x, leg_quad_l3_l1x, + leg_quad_l3_l2x, leg_quad_l3_l3x, leg_quad_l3_l4x, leg_quad_l3_l5x, leg_quad_l3_l6x, + leg_quad_l3_l7x, leg_quad_l3_l8x, leg_quad_l3_l9x, leg_quad_l3_l10x, leg_quad_l4_l0x, + leg_quad_l4_l1x, leg_quad_l4_l2x, leg_quad_l4_l3x, leg_quad_l4_l4x, leg_quad_l4_l5x, + leg_quad_l4_l6x, leg_quad_l4_l7x, leg_quad_l4_l8x, leg_quad_l4_l9x, leg_quad_l4_l10x, + leg_quad_l5_l0x, leg_quad_l5_l1x, leg_quad_l5_l2x, leg_quad_l5_l3x, leg_quad_l5_l4x, + leg_quad_l5_l5x, leg_quad_l5_l6x, leg_quad_l5_l7x, leg_quad_l5_l8x, leg_quad_l5_l9x, + leg_quad_l5_l10x, leg_quad_l6_l0x, leg_quad_l6_l1x, leg_quad_l6_l2x, leg_quad_l6_l3x, + leg_quad_l6_l4x, leg_quad_l6_l5x, leg_quad_l6_l6x, leg_quad_l6_l7x, leg_quad_l6_l8x, + leg_quad_l6_l9x, leg_quad_l6_l10x, leg_quad_l7_l0x, leg_quad_l7_l1x, leg_quad_l7_l2x, + leg_quad_l7_l3x, leg_quad_l7_l4x, leg_quad_l7_l5x, leg_quad_l7_l6x, leg_quad_l7_l7x, + leg_quad_l7_l8x, leg_quad_l7_l9x, leg_quad_l7_l10x, leg_quad_l8_l0x, leg_quad_l8_l1x, + leg_quad_l8_l2x, leg_quad_l8_l3x, leg_quad_l8_l4x, leg_quad_l8_l5x, leg_quad_l8_l6x, + leg_quad_l8_l7x, leg_quad_l8_l8x, leg_quad_l8_l9x, leg_quad_l8_l10x, leg_quad_l9_l0x, + leg_quad_l9_l1x, leg_quad_l9_l2x, leg_quad_l9_l3x, leg_quad_l9_l4x, leg_quad_l9_l5x, + leg_quad_l9_l6x, leg_quad_l9_l7x, leg_quad_l9_l8x, leg_quad_l9_l9x, leg_quad_l9_l10x, + leg_quad_l10_l0x, leg_quad_l10_l1x, leg_quad_l10_l2x, leg_quad_l10_l3x, leg_quad_l10_l4x, + leg_quad_l10_l5x, leg_quad_l10_l6x, leg_quad_l10_l7x, leg_quad_l10_l8x, leg_quad_l10_l9x, leg_quad_l10_l10x, }; static Shapeset::shape_fn_t leg_quad_fn_dy[] = { - leg_quad_l0_l0y, leg_quad_l0_l1y, leg_quad_l0_l2y, leg_quad_l0_l3y, leg_quad_l0_l4y, - leg_quad_l0_l5y, leg_quad_l0_l6y, leg_quad_l0_l7y, leg_quad_l0_l8y, leg_quad_l0_l9y, - leg_quad_l0_l10y, leg_quad_l1_l0y, leg_quad_l1_l1y, leg_quad_l1_l2y, leg_quad_l1_l3y, - leg_quad_l1_l4y, leg_quad_l1_l5y, leg_quad_l1_l6y, leg_quad_l1_l7y, leg_quad_l1_l8y, - leg_quad_l1_l9y, leg_quad_l1_l10y, leg_quad_l2_l0y, leg_quad_l2_l1y, leg_quad_l2_l2y, - leg_quad_l2_l3y, leg_quad_l2_l4y, leg_quad_l2_l5y, leg_quad_l2_l6y, leg_quad_l2_l7y, - leg_quad_l2_l8y, leg_quad_l2_l9y, leg_quad_l2_l10y, leg_quad_l3_l0y, leg_quad_l3_l1y, - leg_quad_l3_l2y, leg_quad_l3_l3y, leg_quad_l3_l4y, leg_quad_l3_l5y, leg_quad_l3_l6y, - leg_quad_l3_l7y, leg_quad_l3_l8y, leg_quad_l3_l9y, leg_quad_l3_l10y, leg_quad_l4_l0y, - leg_quad_l4_l1y, leg_quad_l4_l2y, leg_quad_l4_l3y, leg_quad_l4_l4y, leg_quad_l4_l5y, - leg_quad_l4_l6y, leg_quad_l4_l7y, leg_quad_l4_l8y, leg_quad_l4_l9y, leg_quad_l4_l10y, - leg_quad_l5_l0y, leg_quad_l5_l1y, leg_quad_l5_l2y, leg_quad_l5_l3y, leg_quad_l5_l4y, - leg_quad_l5_l5y, leg_quad_l5_l6y, leg_quad_l5_l7y, leg_quad_l5_l8y, leg_quad_l5_l9y, - leg_quad_l5_l10y, leg_quad_l6_l0y, leg_quad_l6_l1y, leg_quad_l6_l2y, leg_quad_l6_l3y, - leg_quad_l6_l4y, leg_quad_l6_l5y, leg_quad_l6_l6y, leg_quad_l6_l7y, leg_quad_l6_l8y, - leg_quad_l6_l9y, leg_quad_l6_l10y, leg_quad_l7_l0y, leg_quad_l7_l1y, leg_quad_l7_l2y, - leg_quad_l7_l3y, leg_quad_l7_l4y, leg_quad_l7_l5y, leg_quad_l7_l6y, leg_quad_l7_l7y, - leg_quad_l7_l8y, leg_quad_l7_l9y, leg_quad_l7_l10y, leg_quad_l8_l0y, leg_quad_l8_l1y, - leg_quad_l8_l2y, leg_quad_l8_l3y, leg_quad_l8_l4y, leg_quad_l8_l5y, leg_quad_l8_l6y, - leg_quad_l8_l7y, leg_quad_l8_l8y, leg_quad_l8_l9y, leg_quad_l8_l10y, leg_quad_l9_l0y, - leg_quad_l9_l1y, leg_quad_l9_l2y, leg_quad_l9_l3y, leg_quad_l9_l4y, leg_quad_l9_l5y, - leg_quad_l9_l6y, leg_quad_l9_l7y, leg_quad_l9_l8y, leg_quad_l9_l9y, leg_quad_l9_l10y, - leg_quad_l10_l0y, leg_quad_l10_l1y, leg_quad_l10_l2y, leg_quad_l10_l3y, leg_quad_l10_l4y, - leg_quad_l10_l5y, leg_quad_l10_l6y, leg_quad_l10_l7y, leg_quad_l10_l8y, leg_quad_l10_l9y, + leg_quad_l0_l0y, leg_quad_l0_l1y, leg_quad_l0_l2y, leg_quad_l0_l3y, leg_quad_l0_l4y, + leg_quad_l0_l5y, leg_quad_l0_l6y, leg_quad_l0_l7y, leg_quad_l0_l8y, leg_quad_l0_l9y, + leg_quad_l0_l10y, leg_quad_l1_l0y, leg_quad_l1_l1y, leg_quad_l1_l2y, leg_quad_l1_l3y, + leg_quad_l1_l4y, leg_quad_l1_l5y, leg_quad_l1_l6y, leg_quad_l1_l7y, leg_quad_l1_l8y, + leg_quad_l1_l9y, leg_quad_l1_l10y, leg_quad_l2_l0y, leg_quad_l2_l1y, leg_quad_l2_l2y, + leg_quad_l2_l3y, leg_quad_l2_l4y, leg_quad_l2_l5y, leg_quad_l2_l6y, leg_quad_l2_l7y, + leg_quad_l2_l8y, leg_quad_l2_l9y, leg_quad_l2_l10y, leg_quad_l3_l0y, leg_quad_l3_l1y, + leg_quad_l3_l2y, leg_quad_l3_l3y, leg_quad_l3_l4y, leg_quad_l3_l5y, leg_quad_l3_l6y, + leg_quad_l3_l7y, leg_quad_l3_l8y, leg_quad_l3_l9y, leg_quad_l3_l10y, leg_quad_l4_l0y, + leg_quad_l4_l1y, leg_quad_l4_l2y, leg_quad_l4_l3y, leg_quad_l4_l4y, leg_quad_l4_l5y, + leg_quad_l4_l6y, leg_quad_l4_l7y, leg_quad_l4_l8y, leg_quad_l4_l9y, leg_quad_l4_l10y, + leg_quad_l5_l0y, leg_quad_l5_l1y, leg_quad_l5_l2y, leg_quad_l5_l3y, leg_quad_l5_l4y, + leg_quad_l5_l5y, leg_quad_l5_l6y, leg_quad_l5_l7y, leg_quad_l5_l8y, leg_quad_l5_l9y, + leg_quad_l5_l10y, leg_quad_l6_l0y, leg_quad_l6_l1y, leg_quad_l6_l2y, leg_quad_l6_l3y, + leg_quad_l6_l4y, leg_quad_l6_l5y, leg_quad_l6_l6y, leg_quad_l6_l7y, leg_quad_l6_l8y, + leg_quad_l6_l9y, leg_quad_l6_l10y, leg_quad_l7_l0y, leg_quad_l7_l1y, leg_quad_l7_l2y, + leg_quad_l7_l3y, leg_quad_l7_l4y, leg_quad_l7_l5y, leg_quad_l7_l6y, leg_quad_l7_l7y, + leg_quad_l7_l8y, leg_quad_l7_l9y, leg_quad_l7_l10y, leg_quad_l8_l0y, leg_quad_l8_l1y, + leg_quad_l8_l2y, leg_quad_l8_l3y, leg_quad_l8_l4y, leg_quad_l8_l5y, leg_quad_l8_l6y, + leg_quad_l8_l7y, leg_quad_l8_l8y, leg_quad_l8_l9y, leg_quad_l8_l10y, leg_quad_l9_l0y, + leg_quad_l9_l1y, leg_quad_l9_l2y, leg_quad_l9_l3y, leg_quad_l9_l4y, leg_quad_l9_l5y, + leg_quad_l9_l6y, leg_quad_l9_l7y, leg_quad_l9_l8y, leg_quad_l9_l9y, leg_quad_l9_l10y, + leg_quad_l10_l0y, leg_quad_l10_l1y, leg_quad_l10_l2y, leg_quad_l10_l3y, leg_quad_l10_l4y, + leg_quad_l10_l5y, leg_quad_l10_l6y, leg_quad_l10_l7y, leg_quad_l10_l8y, leg_quad_l10_l9y, leg_quad_l10_l10y, }; static Shapeset::shape_fn_t leg_quad_fn_dxx[] = { - leg_quad_l0_l0xx, leg_quad_l0_l1xx, leg_quad_l0_l2xx, leg_quad_l0_l3xx, leg_quad_l0_l4xx, - leg_quad_l0_l5xx, leg_quad_l0_l6xx, leg_quad_l0_l7xx, leg_quad_l0_l8xx, leg_quad_l0_l9xx, - leg_quad_l0_l10xx, leg_quad_l1_l0xx, leg_quad_l1_l1xx, leg_quad_l1_l2xx, leg_quad_l1_l3xx, - leg_quad_l1_l4xx, leg_quad_l1_l5xx, leg_quad_l1_l6xx, leg_quad_l1_l7xx, leg_quad_l1_l8xx, - leg_quad_l1_l9xx, leg_quad_l1_l10xx, leg_quad_l2_l0xx, leg_quad_l2_l1xx, leg_quad_l2_l2xx, - leg_quad_l2_l3xx, leg_quad_l2_l4xx, leg_quad_l2_l5xx, leg_quad_l2_l6xx, leg_quad_l2_l7xx, - leg_quad_l2_l8xx, leg_quad_l2_l9xx, leg_quad_l2_l10xx, leg_quad_l3_l0xx, leg_quad_l3_l1xx, - leg_quad_l3_l2xx, leg_quad_l3_l3xx, leg_quad_l3_l4xx, leg_quad_l3_l5xx, leg_quad_l3_l6xx, - leg_quad_l3_l7xx, leg_quad_l3_l8xx, leg_quad_l3_l9xx, leg_quad_l3_l10xx, leg_quad_l4_l0xx, - leg_quad_l4_l1xx, leg_quad_l4_l2xx, leg_quad_l4_l3xx, leg_quad_l4_l4xx, leg_quad_l4_l5xx, - leg_quad_l4_l6xx, leg_quad_l4_l7xx, leg_quad_l4_l8xx, leg_quad_l4_l9xx, leg_quad_l4_l10xx, - leg_quad_l5_l0xx, leg_quad_l5_l1xx, leg_quad_l5_l2xx, leg_quad_l5_l3xx, leg_quad_l5_l4xx, - leg_quad_l5_l5xx, leg_quad_l5_l6xx, leg_quad_l5_l7xx, leg_quad_l5_l8xx, leg_quad_l5_l9xx, - leg_quad_l5_l10xx, leg_quad_l6_l0xx, leg_quad_l6_l1xx, leg_quad_l6_l2xx, leg_quad_l6_l3xx, - leg_quad_l6_l4xx, leg_quad_l6_l5xx, leg_quad_l6_l6xx, leg_quad_l6_l7xx, leg_quad_l6_l8xx, - leg_quad_l6_l9xx, leg_quad_l6_l10xx, leg_quad_l7_l0xx, leg_quad_l7_l1xx, leg_quad_l7_l2xx, - leg_quad_l7_l3xx, leg_quad_l7_l4xx, leg_quad_l7_l5xx, leg_quad_l7_l6xx, leg_quad_l7_l7xx, - leg_quad_l7_l8xx, leg_quad_l7_l9xx, leg_quad_l7_l10xx, leg_quad_l8_l0xx, leg_quad_l8_l1xx, - leg_quad_l8_l2xx, leg_quad_l8_l3xx, leg_quad_l8_l4xx, leg_quad_l8_l5xx, leg_quad_l8_l6xx, - leg_quad_l8_l7xx, leg_quad_l8_l8xx, leg_quad_l8_l9xx, leg_quad_l8_l10xx, leg_quad_l9_l0xx, - leg_quad_l9_l1xx, leg_quad_l9_l2xx, leg_quad_l9_l3xx, leg_quad_l9_l4xx, leg_quad_l9_l5xx, - leg_quad_l9_l6xx, leg_quad_l9_l7xx, leg_quad_l9_l8xx, leg_quad_l9_l9xx, leg_quad_l9_l10xx, - leg_quad_l10_l0xx, leg_quad_l10_l1xx, leg_quad_l10_l2xx, leg_quad_l10_l3xx, leg_quad_l10_l4xx, - leg_quad_l10_l5xx, leg_quad_l10_l6xx, leg_quad_l10_l7xx, leg_quad_l10_l8xx, leg_quad_l10_l9xx, + leg_quad_l0_l0xx, leg_quad_l0_l1xx, leg_quad_l0_l2xx, leg_quad_l0_l3xx, leg_quad_l0_l4xx, + leg_quad_l0_l5xx, leg_quad_l0_l6xx, leg_quad_l0_l7xx, leg_quad_l0_l8xx, leg_quad_l0_l9xx, + leg_quad_l0_l10xx, leg_quad_l1_l0xx, leg_quad_l1_l1xx, leg_quad_l1_l2xx, leg_quad_l1_l3xx, + leg_quad_l1_l4xx, leg_quad_l1_l5xx, leg_quad_l1_l6xx, leg_quad_l1_l7xx, leg_quad_l1_l8xx, + leg_quad_l1_l9xx, leg_quad_l1_l10xx, leg_quad_l2_l0xx, leg_quad_l2_l1xx, leg_quad_l2_l2xx, + leg_quad_l2_l3xx, leg_quad_l2_l4xx, leg_quad_l2_l5xx, leg_quad_l2_l6xx, leg_quad_l2_l7xx, + leg_quad_l2_l8xx, leg_quad_l2_l9xx, leg_quad_l2_l10xx, leg_quad_l3_l0xx, leg_quad_l3_l1xx, + leg_quad_l3_l2xx, leg_quad_l3_l3xx, leg_quad_l3_l4xx, leg_quad_l3_l5xx, leg_quad_l3_l6xx, + leg_quad_l3_l7xx, leg_quad_l3_l8xx, leg_quad_l3_l9xx, leg_quad_l3_l10xx, leg_quad_l4_l0xx, + leg_quad_l4_l1xx, leg_quad_l4_l2xx, leg_quad_l4_l3xx, leg_quad_l4_l4xx, leg_quad_l4_l5xx, + leg_quad_l4_l6xx, leg_quad_l4_l7xx, leg_quad_l4_l8xx, leg_quad_l4_l9xx, leg_quad_l4_l10xx, + leg_quad_l5_l0xx, leg_quad_l5_l1xx, leg_quad_l5_l2xx, leg_quad_l5_l3xx, leg_quad_l5_l4xx, + leg_quad_l5_l5xx, leg_quad_l5_l6xx, leg_quad_l5_l7xx, leg_quad_l5_l8xx, leg_quad_l5_l9xx, + leg_quad_l5_l10xx, leg_quad_l6_l0xx, leg_quad_l6_l1xx, leg_quad_l6_l2xx, leg_quad_l6_l3xx, + leg_quad_l6_l4xx, leg_quad_l6_l5xx, leg_quad_l6_l6xx, leg_quad_l6_l7xx, leg_quad_l6_l8xx, + leg_quad_l6_l9xx, leg_quad_l6_l10xx, leg_quad_l7_l0xx, leg_quad_l7_l1xx, leg_quad_l7_l2xx, + leg_quad_l7_l3xx, leg_quad_l7_l4xx, leg_quad_l7_l5xx, leg_quad_l7_l6xx, leg_quad_l7_l7xx, + leg_quad_l7_l8xx, leg_quad_l7_l9xx, leg_quad_l7_l10xx, leg_quad_l8_l0xx, leg_quad_l8_l1xx, + leg_quad_l8_l2xx, leg_quad_l8_l3xx, leg_quad_l8_l4xx, leg_quad_l8_l5xx, leg_quad_l8_l6xx, + leg_quad_l8_l7xx, leg_quad_l8_l8xx, leg_quad_l8_l9xx, leg_quad_l8_l10xx, leg_quad_l9_l0xx, + leg_quad_l9_l1xx, leg_quad_l9_l2xx, leg_quad_l9_l3xx, leg_quad_l9_l4xx, leg_quad_l9_l5xx, + leg_quad_l9_l6xx, leg_quad_l9_l7xx, leg_quad_l9_l8xx, leg_quad_l9_l9xx, leg_quad_l9_l10xx, + leg_quad_l10_l0xx, leg_quad_l10_l1xx, leg_quad_l10_l2xx, leg_quad_l10_l3xx, leg_quad_l10_l4xx, + leg_quad_l10_l5xx, leg_quad_l10_l6xx, leg_quad_l10_l7xx, leg_quad_l10_l8xx, leg_quad_l10_l9xx, leg_quad_l10_l10xx, }; static Shapeset::shape_fn_t leg_quad_fn_dxy[] = { - leg_quad_l0_l0xy, leg_quad_l0_l1xy, leg_quad_l0_l2xy, leg_quad_l0_l3xy, leg_quad_l0_l4xy, - leg_quad_l0_l5xy, leg_quad_l0_l6xy, leg_quad_l0_l7xy, leg_quad_l0_l8xy, leg_quad_l0_l9xy, - leg_quad_l0_l10xy, leg_quad_l1_l0xy, leg_quad_l1_l1xy, leg_quad_l1_l2xy, leg_quad_l1_l3xy, - leg_quad_l1_l4xy, leg_quad_l1_l5xy, leg_quad_l1_l6xy, leg_quad_l1_l7xy, leg_quad_l1_l8xy, - leg_quad_l1_l9xy, leg_quad_l1_l10xy, leg_quad_l2_l0xy, leg_quad_l2_l1xy, leg_quad_l2_l2xy, - leg_quad_l2_l3xy, leg_quad_l2_l4xy, leg_quad_l2_l5xy, leg_quad_l2_l6xy, leg_quad_l2_l7xy, - leg_quad_l2_l8xy, leg_quad_l2_l9xy, leg_quad_l2_l10xy, leg_quad_l3_l0xy, leg_quad_l3_l1xy, - leg_quad_l3_l2xy, leg_quad_l3_l3xy, leg_quad_l3_l4xy, leg_quad_l3_l5xy, leg_quad_l3_l6xy, - leg_quad_l3_l7xy, leg_quad_l3_l8xy, leg_quad_l3_l9xy, leg_quad_l3_l10xy, leg_quad_l4_l0xy, - leg_quad_l4_l1xy, leg_quad_l4_l2xy, leg_quad_l4_l3xy, leg_quad_l4_l4xy, leg_quad_l4_l5xy, - leg_quad_l4_l6xy, leg_quad_l4_l7xy, leg_quad_l4_l8xy, leg_quad_l4_l9xy, leg_quad_l4_l10xy, - leg_quad_l5_l0xy, leg_quad_l5_l1xy, leg_quad_l5_l2xy, leg_quad_l5_l3xy, leg_quad_l5_l4xy, - leg_quad_l5_l5xy, leg_quad_l5_l6xy, leg_quad_l5_l7xy, leg_quad_l5_l8xy, leg_quad_l5_l9xy, - leg_quad_l5_l10xy, leg_quad_l6_l0xy, leg_quad_l6_l1xy, leg_quad_l6_l2xy, leg_quad_l6_l3xy, - leg_quad_l6_l4xy, leg_quad_l6_l5xy, leg_quad_l6_l6xy, leg_quad_l6_l7xy, leg_quad_l6_l8xy, - leg_quad_l6_l9xy, leg_quad_l6_l10xy, leg_quad_l7_l0xy, leg_quad_l7_l1xy, leg_quad_l7_l2xy, - leg_quad_l7_l3xy, leg_quad_l7_l4xy, leg_quad_l7_l5xy, leg_quad_l7_l6xy, leg_quad_l7_l7xy, - leg_quad_l7_l8xy, leg_quad_l7_l9xy, leg_quad_l7_l10xy, leg_quad_l8_l0xy, leg_quad_l8_l1xy, - leg_quad_l8_l2xy, leg_quad_l8_l3xy, leg_quad_l8_l4xy, leg_quad_l8_l5xy, leg_quad_l8_l6xy, - leg_quad_l8_l7xy, leg_quad_l8_l8xy, leg_quad_l8_l9xy, leg_quad_l8_l10xy, leg_quad_l9_l0xy, - leg_quad_l9_l1xy, leg_quad_l9_l2xy, leg_quad_l9_l3xy, leg_quad_l9_l4xy, leg_quad_l9_l5xy, - leg_quad_l9_l6xy, leg_quad_l9_l7xy, leg_quad_l9_l8xy, leg_quad_l9_l9xy, leg_quad_l9_l10xy, - leg_quad_l10_l0xy, leg_quad_l10_l1xy, leg_quad_l10_l2xy, leg_quad_l10_l3xy, leg_quad_l10_l4xy, - leg_quad_l10_l5xy, leg_quad_l10_l6xy, leg_quad_l10_l7xy, leg_quad_l10_l8xy, leg_quad_l10_l9xy, + leg_quad_l0_l0xy, leg_quad_l0_l1xy, leg_quad_l0_l2xy, leg_quad_l0_l3xy, leg_quad_l0_l4xy, + leg_quad_l0_l5xy, leg_quad_l0_l6xy, leg_quad_l0_l7xy, leg_quad_l0_l8xy, leg_quad_l0_l9xy, + leg_quad_l0_l10xy, leg_quad_l1_l0xy, leg_quad_l1_l1xy, leg_quad_l1_l2xy, leg_quad_l1_l3xy, + leg_quad_l1_l4xy, leg_quad_l1_l5xy, leg_quad_l1_l6xy, leg_quad_l1_l7xy, leg_quad_l1_l8xy, + leg_quad_l1_l9xy, leg_quad_l1_l10xy, leg_quad_l2_l0xy, leg_quad_l2_l1xy, leg_quad_l2_l2xy, + leg_quad_l2_l3xy, leg_quad_l2_l4xy, leg_quad_l2_l5xy, leg_quad_l2_l6xy, leg_quad_l2_l7xy, + leg_quad_l2_l8xy, leg_quad_l2_l9xy, leg_quad_l2_l10xy, leg_quad_l3_l0xy, leg_quad_l3_l1xy, + leg_quad_l3_l2xy, leg_quad_l3_l3xy, leg_quad_l3_l4xy, leg_quad_l3_l5xy, leg_quad_l3_l6xy, + leg_quad_l3_l7xy, leg_quad_l3_l8xy, leg_quad_l3_l9xy, leg_quad_l3_l10xy, leg_quad_l4_l0xy, + leg_quad_l4_l1xy, leg_quad_l4_l2xy, leg_quad_l4_l3xy, leg_quad_l4_l4xy, leg_quad_l4_l5xy, + leg_quad_l4_l6xy, leg_quad_l4_l7xy, leg_quad_l4_l8xy, leg_quad_l4_l9xy, leg_quad_l4_l10xy, + leg_quad_l5_l0xy, leg_quad_l5_l1xy, leg_quad_l5_l2xy, leg_quad_l5_l3xy, leg_quad_l5_l4xy, + leg_quad_l5_l5xy, leg_quad_l5_l6xy, leg_quad_l5_l7xy, leg_quad_l5_l8xy, leg_quad_l5_l9xy, + leg_quad_l5_l10xy, leg_quad_l6_l0xy, leg_quad_l6_l1xy, leg_quad_l6_l2xy, leg_quad_l6_l3xy, + leg_quad_l6_l4xy, leg_quad_l6_l5xy, leg_quad_l6_l6xy, leg_quad_l6_l7xy, leg_quad_l6_l8xy, + leg_quad_l6_l9xy, leg_quad_l6_l10xy, leg_quad_l7_l0xy, leg_quad_l7_l1xy, leg_quad_l7_l2xy, + leg_quad_l7_l3xy, leg_quad_l7_l4xy, leg_quad_l7_l5xy, leg_quad_l7_l6xy, leg_quad_l7_l7xy, + leg_quad_l7_l8xy, leg_quad_l7_l9xy, leg_quad_l7_l10xy, leg_quad_l8_l0xy, leg_quad_l8_l1xy, + leg_quad_l8_l2xy, leg_quad_l8_l3xy, leg_quad_l8_l4xy, leg_quad_l8_l5xy, leg_quad_l8_l6xy, + leg_quad_l8_l7xy, leg_quad_l8_l8xy, leg_quad_l8_l9xy, leg_quad_l8_l10xy, leg_quad_l9_l0xy, + leg_quad_l9_l1xy, leg_quad_l9_l2xy, leg_quad_l9_l3xy, leg_quad_l9_l4xy, leg_quad_l9_l5xy, + leg_quad_l9_l6xy, leg_quad_l9_l7xy, leg_quad_l9_l8xy, leg_quad_l9_l9xy, leg_quad_l9_l10xy, + leg_quad_l10_l0xy, leg_quad_l10_l1xy, leg_quad_l10_l2xy, leg_quad_l10_l3xy, leg_quad_l10_l4xy, + leg_quad_l10_l5xy, leg_quad_l10_l6xy, leg_quad_l10_l7xy, leg_quad_l10_l8xy, leg_quad_l10_l9xy, leg_quad_l10_l10xy, }; static Shapeset::shape_fn_t leg_quad_fn_dyy[] = { - leg_quad_l0_l0yy, leg_quad_l0_l1yy, leg_quad_l0_l2yy, leg_quad_l0_l3yy, leg_quad_l0_l4yy, - leg_quad_l0_l5yy, leg_quad_l0_l6yy, leg_quad_l0_l7yy, leg_quad_l0_l8yy, leg_quad_l0_l9yy, - leg_quad_l0_l10yy, leg_quad_l1_l0yy, leg_quad_l1_l1yy, leg_quad_l1_l2yy, leg_quad_l1_l3yy, - leg_quad_l1_l4yy, leg_quad_l1_l5yy, leg_quad_l1_l6yy, leg_quad_l1_l7yy, leg_quad_l1_l8yy, - leg_quad_l1_l9yy, leg_quad_l1_l10yy, leg_quad_l2_l0yy, leg_quad_l2_l1yy, leg_quad_l2_l2yy, - leg_quad_l2_l3yy, leg_quad_l2_l4yy, leg_quad_l2_l5yy, leg_quad_l2_l6yy, leg_quad_l2_l7yy, - leg_quad_l2_l8yy, leg_quad_l2_l9yy, leg_quad_l2_l10yy, leg_quad_l3_l0yy, leg_quad_l3_l1yy, - leg_quad_l3_l2yy, leg_quad_l3_l3yy, leg_quad_l3_l4yy, leg_quad_l3_l5yy, leg_quad_l3_l6yy, - leg_quad_l3_l7yy, leg_quad_l3_l8yy, leg_quad_l3_l9yy, leg_quad_l3_l10yy, leg_quad_l4_l0yy, - leg_quad_l4_l1yy, leg_quad_l4_l2yy, leg_quad_l4_l3yy, leg_quad_l4_l4yy, leg_quad_l4_l5yy, - leg_quad_l4_l6yy, leg_quad_l4_l7yy, leg_quad_l4_l8yy, leg_quad_l4_l9yy, leg_quad_l4_l10yy, - leg_quad_l5_l0yy, leg_quad_l5_l1yy, leg_quad_l5_l2yy, leg_quad_l5_l3yy, leg_quad_l5_l4yy, - leg_quad_l5_l5yy, leg_quad_l5_l6yy, leg_quad_l5_l7yy, leg_quad_l5_l8yy, leg_quad_l5_l9yy, - leg_quad_l5_l10yy, leg_quad_l6_l0yy, leg_quad_l6_l1yy, leg_quad_l6_l2yy, leg_quad_l6_l3yy, - leg_quad_l6_l4yy, leg_quad_l6_l5yy, leg_quad_l6_l6yy, leg_quad_l6_l7yy, leg_quad_l6_l8yy, - leg_quad_l6_l9yy, leg_quad_l6_l10yy, leg_quad_l7_l0yy, leg_quad_l7_l1yy, leg_quad_l7_l2yy, - leg_quad_l7_l3yy, leg_quad_l7_l4yy, leg_quad_l7_l5yy, leg_quad_l7_l6yy, leg_quad_l7_l7yy, - leg_quad_l7_l8yy, leg_quad_l7_l9yy, leg_quad_l7_l10yy, leg_quad_l8_l0yy, leg_quad_l8_l1yy, - leg_quad_l8_l2yy, leg_quad_l8_l3yy, leg_quad_l8_l4yy, leg_quad_l8_l5yy, leg_quad_l8_l6yy, - leg_quad_l8_l7yy, leg_quad_l8_l8yy, leg_quad_l8_l9yy, leg_quad_l8_l10yy, leg_quad_l9_l0yy, - leg_quad_l9_l1yy, leg_quad_l9_l2yy, leg_quad_l9_l3yy, leg_quad_l9_l4yy, leg_quad_l9_l5yy, - leg_quad_l9_l6yy, leg_quad_l9_l7yy, leg_quad_l9_l8yy, leg_quad_l9_l9yy, leg_quad_l9_l10yy, - leg_quad_l10_l0yy, leg_quad_l10_l1yy, leg_quad_l10_l2yy, leg_quad_l10_l3yy, leg_quad_l10_l4yy, - leg_quad_l10_l5yy, leg_quad_l10_l6yy, leg_quad_l10_l7yy, leg_quad_l10_l8yy, leg_quad_l10_l9yy, + leg_quad_l0_l0yy, leg_quad_l0_l1yy, leg_quad_l0_l2yy, leg_quad_l0_l3yy, leg_quad_l0_l4yy, + leg_quad_l0_l5yy, leg_quad_l0_l6yy, leg_quad_l0_l7yy, leg_quad_l0_l8yy, leg_quad_l0_l9yy, + leg_quad_l0_l10yy, leg_quad_l1_l0yy, leg_quad_l1_l1yy, leg_quad_l1_l2yy, leg_quad_l1_l3yy, + leg_quad_l1_l4yy, leg_quad_l1_l5yy, leg_quad_l1_l6yy, leg_quad_l1_l7yy, leg_quad_l1_l8yy, + leg_quad_l1_l9yy, leg_quad_l1_l10yy, leg_quad_l2_l0yy, leg_quad_l2_l1yy, leg_quad_l2_l2yy, + leg_quad_l2_l3yy, leg_quad_l2_l4yy, leg_quad_l2_l5yy, leg_quad_l2_l6yy, leg_quad_l2_l7yy, + leg_quad_l2_l8yy, leg_quad_l2_l9yy, leg_quad_l2_l10yy, leg_quad_l3_l0yy, leg_quad_l3_l1yy, + leg_quad_l3_l2yy, leg_quad_l3_l3yy, leg_quad_l3_l4yy, leg_quad_l3_l5yy, leg_quad_l3_l6yy, + leg_quad_l3_l7yy, leg_quad_l3_l8yy, leg_quad_l3_l9yy, leg_quad_l3_l10yy, leg_quad_l4_l0yy, + leg_quad_l4_l1yy, leg_quad_l4_l2yy, leg_quad_l4_l3yy, leg_quad_l4_l4yy, leg_quad_l4_l5yy, + leg_quad_l4_l6yy, leg_quad_l4_l7yy, leg_quad_l4_l8yy, leg_quad_l4_l9yy, leg_quad_l4_l10yy, + leg_quad_l5_l0yy, leg_quad_l5_l1yy, leg_quad_l5_l2yy, leg_quad_l5_l3yy, leg_quad_l5_l4yy, + leg_quad_l5_l5yy, leg_quad_l5_l6yy, leg_quad_l5_l7yy, leg_quad_l5_l8yy, leg_quad_l5_l9yy, + leg_quad_l5_l10yy, leg_quad_l6_l0yy, leg_quad_l6_l1yy, leg_quad_l6_l2yy, leg_quad_l6_l3yy, + leg_quad_l6_l4yy, leg_quad_l6_l5yy, leg_quad_l6_l6yy, leg_quad_l6_l7yy, leg_quad_l6_l8yy, + leg_quad_l6_l9yy, leg_quad_l6_l10yy, leg_quad_l7_l0yy, leg_quad_l7_l1yy, leg_quad_l7_l2yy, + leg_quad_l7_l3yy, leg_quad_l7_l4yy, leg_quad_l7_l5yy, leg_quad_l7_l6yy, leg_quad_l7_l7yy, + leg_quad_l7_l8yy, leg_quad_l7_l9yy, leg_quad_l7_l10yy, leg_quad_l8_l0yy, leg_quad_l8_l1yy, + leg_quad_l8_l2yy, leg_quad_l8_l3yy, leg_quad_l8_l4yy, leg_quad_l8_l5yy, leg_quad_l8_l6yy, + leg_quad_l8_l7yy, leg_quad_l8_l8yy, leg_quad_l8_l9yy, leg_quad_l8_l10yy, leg_quad_l9_l0yy, + leg_quad_l9_l1yy, leg_quad_l9_l2yy, leg_quad_l9_l3yy, leg_quad_l9_l4yy, leg_quad_l9_l5yy, + leg_quad_l9_l6yy, leg_quad_l9_l7yy, leg_quad_l9_l8yy, leg_quad_l9_l9yy, leg_quad_l9_l10yy, + leg_quad_l10_l0yy, leg_quad_l10_l1yy, leg_quad_l10_l2yy, leg_quad_l10_l3yy, leg_quad_l10_l4yy, + leg_quad_l10_l5yy, leg_quad_l10_l6yy, leg_quad_l10_l7yy, leg_quad_l10_l8yy, leg_quad_l10_l9yy, leg_quad_l10_l10yy, }; - Shapeset::shape_fn_t* leg_quad_shape_fn_table[1] = { leg_quad_fn }; - Shapeset::shape_fn_t* leg_quad_shape_fn_table_dx[1] = { leg_quad_fn_dx }; - Shapeset::shape_fn_t* leg_quad_shape_fn_table_dy[1] = { leg_quad_fn_dy }; + Shapeset::shape_fn_t* leg_quad_shape_fn_table[1] = { leg_quad_fn }; + Shapeset::shape_fn_t* leg_quad_shape_fn_table_dx[1] = { leg_quad_fn_dx }; + Shapeset::shape_fn_t* leg_quad_shape_fn_table_dy[1] = { leg_quad_fn_dy }; Shapeset::shape_fn_t* leg_quad_shape_fn_table_dxx[1] = { leg_quad_fn_dxx }; Shapeset::shape_fn_t* leg_quad_shape_fn_table_dxy[1] = { leg_quad_fn_dxy }; Shapeset::shape_fn_t* leg_quad_shape_fn_table_dyy[1] = { leg_quad_fn_dyy }; - static int qb_0_0[] = { 0, }; - static int qb_0_1[] = { 0, 1, }; - static int qb_0_2[] = { 0, 1, 2, }; - static int qb_0_3[] = { 0, 1, 2, 3, }; - static int qb_0_4[] = { 0, 1, 2, 3, 4, }; - static int qb_0_5[] = { 0, 1, 2, 3, 4, 5, }; - static int qb_0_6[] = { 0, 1, 2, 3, 4, 5, 6, }; - static int qb_0_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, }; - static int qb_0_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, }; - static int qb_0_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, }; - static int qb_0_10[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, }; - static int qb_1_0[] = { 0, 11, }; - static int qb_1_1[] = { 0, 1, 11, 12, }; - static int qb_1_2[] = { 0, 1, 2, 11, 12, 13, }; - static int qb_1_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, }; - static int qb_1_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, }; - static int qb_1_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, }; - static int qb_1_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, }; - static int qb_1_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, }; - static int qb_1_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, }; - static int qb_1_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, }; - static int qb_1_10[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, }; - static int qb_2_0[] = { 0, 11, 22, }; - static int qb_2_1[] = { 0, 1, 11, 12, 22, 23, }; - static int qb_2_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, }; - static int qb_2_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, }; - static int qb_2_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, }; - static int qb_2_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, }; - static int qb_2_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, }; - static int qb_2_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, }; - static int qb_2_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, }; - static int qb_2_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, }; - static int qb_2_10[] = { 0, 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, }; - static int qb_3_0[] = { 0, 11, 22, 33, }; - static int qb_3_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, }; - static int qb_3_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, }; - static int qb_3_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, }; - static int qb_3_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, }; - static int qb_3_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, }; - static int qb_3_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, }; - static int qb_3_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, }; - static int qb_3_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, }; - static int qb_3_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, }; - static int qb_3_10[] = { 0, 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, }; - static int qb_4_0[] = { 0, 11, 22, 33, 44, }; - static int qb_4_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, }; - static int qb_4_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, }; - static int qb_4_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, }; - static int qb_4_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, }; - static int qb_4_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, }; - static int qb_4_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, }; - static int qb_4_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, }; - static int qb_4_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, }; - static int qb_4_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, }; - static int qb_4_10[] = { 0, 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, }; - static int qb_5_0[] = { 0, 11, 22, 33, 44, 55, }; - static int qb_5_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, }; - static int qb_5_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, }; - static int qb_5_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, }; - static int qb_5_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, }; - static int qb_5_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, }; - static int qb_5_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, }; - static int qb_5_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, }; - static int qb_5_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, }; - static int qb_5_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, }; - static int qb_5_10[] = { 0, 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, }; - static int qb_6_0[] = { 0, 11, 22, 33, 44, 55, 66, }; - static int qb_6_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, }; - static int qb_6_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, }; - static int qb_6_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, }; - static int qb_6_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, }; - static int qb_6_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, }; - static int qb_6_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, }; - static int qb_6_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, }; - static int qb_6_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, }; - static int qb_6_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, }; - static int qb_6_10[] = { 0, 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, }; - static int qb_7_0[] = { 0, 11, 22, 33, 44, 55, 66, 77, }; - static int qb_7_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, 77, 78, }; - static int qb_7_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, 77, 78, 79, }; - static int qb_7_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, 77, 78, 79, 80, }; - static int qb_7_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, 77, 78, 79, 80, 81, }; - static int qb_7_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, }; - static int qb_7_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, }; - static int qb_7_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, }; - static int qb_7_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, }; - static int qb_7_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, }; - static int qb_7_10[] = { 0, 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, }; - static int qb_8_0[] = { 0, 11, 22, 33, 44, 55, 66, 77, 88, }; - static int qb_8_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, 77, 78, 88, 89, }; - static int qb_8_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, 77, 78, 79, 88, 89, 90, }; - static int qb_8_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, 77, 78, 79, 80, 88, 89, 90, 91, }; - static int qb_8_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, 77, 78, 79, 80, 81, 88, 89, 90, 91, 92, }; - static int qb_8_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, }; - static int qb_8_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, }; - static int qb_8_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, }; - static int qb_8_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, }; - static int qb_8_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, }; - static int qb_8_10[] = { 0, 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, }; - static int qb_9_0[] = { 0, 11, 22, 33, 44, 55, 66, 77, 88, 99, }; - static int qb_9_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, 77, 78, 88, 89, 99, 100, }; - static int qb_9_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, 77, 78, 79, 88, 89, 90, 99, 100, 101, }; - static int qb_9_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, 77, 78, 79, 80, 88, 89, 90, 91, 99, 100, 101, 102, }; - static int qb_9_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, 77, 78, 79, 80, 81, 88, 89, 90, 91, 92, 99, 100, 101, 102, 103, }; - static int qb_9_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, 99, 100, 101, 102, 103, 104, }; - static int qb_9_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, 99, 100, 101, 102, 103, 104, 105, }; - static int qb_9_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, }; - static int qb_9_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, 99, 100, 101, 102, 103, 104, 105, 106, 107, }; - static int qb_9_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, }; - static int qb_9_10[] = { 0, 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, }; - static int qb_10_0[] = { 0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, }; - static int qb_10_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, 77, 78, 88, 89, 99, 100, 110, 111, }; - static int qb_10_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, 77, 78, 79, 88, 89, 90, 99, 100, 101, 110, 111, 112, }; - static int qb_10_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, 77, 78, 79, 80, 88, 89, 90, 91, 99, 100, 101, 102, 110, 111, 112, 113, }; - static int qb_10_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, 77, 78, 79, 80, 81, 88, 89, 90, 91, 92, 99, 100, 101, 102, 103, 110, 111, 112, 113, 114, }; - static int qb_10_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, 99, 100, 101, 102, 103, 104, 110, 111, 112, 113, 114, 115, }; - static int qb_10_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, 99, 100, 101, 102, 103, 104, 105, 110, 111, 112, 113, 114, 115, 116, }; - static int qb_10_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117, }; - static int qb_10_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, 99, 100, 101, 102, 103, 104, 105, 106, 107, 110, 111, 112, 113, 114, 115, 116, 117, 118, }; - static int qb_10_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, }; - static int qb_10_10[] = { 0, 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, }; - - #define nullptr16 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr - - int* leg_quad_bubble_indices[] = - { - qb_0_0, qb_0_1, qb_0_2, qb_0_3, qb_0_4, qb_0_5, qb_0_6, qb_0_7, qb_0_8, qb_0_9, qb_0_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_1_0, qb_1_1, qb_1_2, qb_1_3, qb_1_4, qb_1_5, qb_1_6, qb_1_7, qb_1_8, qb_1_9, qb_1_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_2_0, qb_2_1, qb_2_2, qb_2_3, qb_2_4, qb_2_5, qb_2_6, qb_2_7, qb_2_8, qb_2_9, qb_2_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_3_0, qb_3_1, qb_3_2, qb_3_3, qb_3_4, qb_3_5, qb_3_6, qb_3_7, qb_3_8, qb_3_9, qb_3_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_4_0, qb_4_1, qb_4_2, qb_4_3, qb_4_4, qb_4_5, qb_4_6, qb_4_7, qb_4_8, qb_4_9, qb_4_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_5_0, qb_5_1, qb_5_2, qb_5_3, qb_5_4, qb_5_5, qb_5_6, qb_5_7, qb_5_8, qb_5_9, qb_5_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_6_0, qb_6_1, qb_6_2, qb_6_3, qb_6_4, qb_6_5, qb_6_6, qb_6_7, qb_6_8, qb_6_9, qb_6_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_7_0, qb_7_1, qb_7_2, qb_7_3, qb_7_4, qb_7_5, qb_7_6, qb_7_7, qb_7_8, qb_7_9, qb_7_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_8_0, qb_8_1, qb_8_2, qb_8_3, qb_8_4, qb_8_5, qb_8_6, qb_8_7, qb_8_8, qb_8_9, qb_8_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_9_0, qb_9_1, qb_9_2, qb_9_3, qb_9_4, qb_9_5, qb_9_6, qb_9_7, qb_9_8, qb_9_9, qb_9_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, - qb_10_0, qb_10_1, qb_10_2, qb_10_3, qb_10_4, qb_10_5, qb_10_6, qb_10_7, qb_10_8, qb_10_9, qb_10_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + static short qb_0_0[] = { 0, }; + static short qb_0_1[] = { 0, 1, }; + static short qb_0_2[] = { 0, 1, 2, }; + static short qb_0_3[] = { 0, 1, 2, 3, }; + static short qb_0_4[] = { 0, 1, 2, 3, 4, }; + static short qb_0_5[] = { 0, 1, 2, 3, 4, 5, }; + static short qb_0_6[] = { 0, 1, 2, 3, 4, 5, 6, }; + static short qb_0_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, }; + static short qb_0_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, }; + static short qb_0_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, }; + static short qb_0_10[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, }; + static short qb_1_0[] = { 0, 11, }; + static short qb_1_1[] = { 0, 1, 11, 12, }; + static short qb_1_2[] = { 0, 1, 2, 11, 12, 13, }; + static short qb_1_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, }; + static short qb_1_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, }; + static short qb_1_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, }; + static short qb_1_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, }; + static short qb_1_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, }; + static short qb_1_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, }; + static short qb_1_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, }; + static short qb_1_10[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, }; + static short qb_2_0[] = { 0, 11, 22, }; + static short qb_2_1[] = { 0, 1, 11, 12, 22, 23, }; + static short qb_2_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, }; + static short qb_2_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, }; + static short qb_2_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, }; + static short qb_2_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, }; + static short qb_2_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, }; + static short qb_2_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, }; + static short qb_2_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, }; + static short qb_2_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, }; + static short qb_2_10[] = { 0, 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, }; + static short qb_3_0[] = { 0, 11, 22, 33, }; + static short qb_3_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, }; + static short qb_3_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, }; + static short qb_3_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, }; + static short qb_3_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, }; + static short qb_3_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, }; + static short qb_3_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, }; + static short qb_3_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, }; + static short qb_3_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, }; + static short qb_3_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, }; + static short qb_3_10[] = { 0, 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, }; + static short qb_4_0[] = { 0, 11, 22, 33, 44, }; + static short qb_4_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, }; + static short qb_4_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, }; + static short qb_4_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, }; + static short qb_4_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, }; + static short qb_4_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, }; + static short qb_4_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, }; + static short qb_4_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, }; + static short qb_4_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, }; + static short qb_4_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, }; + static short qb_4_10[] = { 0, 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, }; + static short qb_5_0[] = { 0, 11, 22, 33, 44, 55, }; + static short qb_5_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, }; + static short qb_5_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, }; + static short qb_5_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, }; + static short qb_5_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, }; + static short qb_5_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, }; + static short qb_5_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, }; + static short qb_5_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, }; + static short qb_5_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, }; + static short qb_5_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, }; + static short qb_5_10[] = { 0, 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, }; + static short qb_6_0[] = { 0, 11, 22, 33, 44, 55, 66, }; + static short qb_6_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, }; + static short qb_6_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, }; + static short qb_6_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, }; + static short qb_6_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, }; + static short qb_6_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, }; + static short qb_6_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, }; + static short qb_6_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, }; + static short qb_6_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, }; + static short qb_6_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, }; + static short qb_6_10[] = { 0, 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, }; + static short qb_7_0[] = { 0, 11, 22, 33, 44, 55, 66, 77, }; + static short qb_7_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, 77, 78, }; + static short qb_7_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, 77, 78, 79, }; + static short qb_7_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, 77, 78, 79, 80, }; + static short qb_7_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, 77, 78, 79, 80, 81, }; + static short qb_7_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, }; + static short qb_7_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, }; + static short qb_7_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, }; + static short qb_7_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, }; + static short qb_7_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, }; + static short qb_7_10[] = { 0, 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, }; + static short qb_8_0[] = { 0, 11, 22, 33, 44, 55, 66, 77, 88, }; + static short qb_8_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, 77, 78, 88, 89, }; + static short qb_8_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, 77, 78, 79, 88, 89, 90, }; + static short qb_8_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, 77, 78, 79, 80, 88, 89, 90, 91, }; + static short qb_8_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, 77, 78, 79, 80, 81, 88, 89, 90, 91, 92, }; + static short qb_8_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, }; + static short qb_8_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, }; + static short qb_8_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, }; + static short qb_8_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, }; + static short qb_8_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, }; + static short qb_8_10[] = { 0, 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, }; + static short qb_9_0[] = { 0, 11, 22, 33, 44, 55, 66, 77, 88, 99, }; + static short qb_9_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, 77, 78, 88, 89, 99, 100, }; + static short qb_9_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, 77, 78, 79, 88, 89, 90, 99, 100, 101, }; + static short qb_9_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, 77, 78, 79, 80, 88, 89, 90, 91, 99, 100, 101, 102, }; + static short qb_9_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, 77, 78, 79, 80, 81, 88, 89, 90, 91, 92, 99, 100, 101, 102, 103, }; + static short qb_9_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, 99, 100, 101, 102, 103, 104, }; + static short qb_9_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, 99, 100, 101, 102, 103, 104, 105, }; + static short qb_9_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, }; + static short qb_9_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, 99, 100, 101, 102, 103, 104, 105, 106, 107, }; + static short qb_9_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, }; + static short qb_9_10[] = { 0, 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, }; + static short qb_10_0[] = { 0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, }; + static short qb_10_1[] = { 0, 1, 11, 12, 22, 23, 33, 34, 44, 45, 55, 56, 66, 67, 77, 78, 88, 89, 99, 100, 110, 111, }; + static short qb_10_2[] = { 0, 1, 2, 11, 12, 13, 22, 23, 24, 33, 34, 35, 44, 45, 46, 55, 56, 57, 66, 67, 68, 77, 78, 79, 88, 89, 90, 99, 100, 101, 110, 111, 112, }; + static short qb_10_3[] = { 0, 1, 2, 3, 11, 12, 13, 14, 22, 23, 24, 25, 33, 34, 35, 36, 44, 45, 46, 47, 55, 56, 57, 58, 66, 67, 68, 69, 77, 78, 79, 80, 88, 89, 90, 91, 99, 100, 101, 102, 110, 111, 112, 113, }; + static short qb_10_4[] = { 0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 66, 67, 68, 69, 70, 77, 78, 79, 80, 81, 88, 89, 90, 91, 92, 99, 100, 101, 102, 103, 110, 111, 112, 113, 114, }; + static short qb_10_5[] = { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 16, 22, 23, 24, 25, 26, 27, 33, 34, 35, 36, 37, 38, 44, 45, 46, 47, 48, 49, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 71, 77, 78, 79, 80, 81, 82, 88, 89, 90, 91, 92, 93, 99, 100, 101, 102, 103, 104, 110, 111, 112, 113, 114, 115, }; + static short qb_10_6[] = { 0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 22, 23, 24, 25, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, 99, 100, 101, 102, 103, 104, 105, 110, 111, 112, 113, 114, 115, 116, }; + static short qb_10_7[] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 62, 66, 67, 68, 69, 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 83, 84, 88, 89, 90, 91, 92, 93, 94, 95, 99, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 117, }; + static short qb_10_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, 99, 100, 101, 102, 103, 104, 105, 106, 107, 110, 111, 112, 113, 114, 115, 116, 117, 118, }; + static short qb_10_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, }; + static short qb_10_10[] = { 0, 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, }; + +#define nullptr16 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr + + short* leg_quad_bubble_indices[] = + { + qb_0_0, qb_0_1, qb_0_2, qb_0_3, qb_0_4, qb_0_5, qb_0_6, qb_0_7, qb_0_8, qb_0_9, qb_0_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_1_0, qb_1_1, qb_1_2, qb_1_3, qb_1_4, qb_1_5, qb_1_6, qb_1_7, qb_1_8, qb_1_9, qb_1_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_2_0, qb_2_1, qb_2_2, qb_2_3, qb_2_4, qb_2_5, qb_2_6, qb_2_7, qb_2_8, qb_2_9, qb_2_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_3_0, qb_3_1, qb_3_2, qb_3_3, qb_3_4, qb_3_5, qb_3_6, qb_3_7, qb_3_8, qb_3_9, qb_3_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_4_0, qb_4_1, qb_4_2, qb_4_3, qb_4_4, qb_4_5, qb_4_6, qb_4_7, qb_4_8, qb_4_9, qb_4_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_5_0, qb_5_1, qb_5_2, qb_5_3, qb_5_4, qb_5_5, qb_5_6, qb_5_7, qb_5_8, qb_5_9, qb_5_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_6_0, qb_6_1, qb_6_2, qb_6_3, qb_6_4, qb_6_5, qb_6_6, qb_6_7, qb_6_8, qb_6_9, qb_6_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_7_0, qb_7_1, qb_7_2, qb_7_3, qb_7_4, qb_7_5, qb_7_6, qb_7_7, qb_7_8, qb_7_9, qb_7_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_8_0, qb_8_1, qb_8_2, qb_8_3, qb_8_4, qb_8_5, qb_8_6, qb_8_7, qb_8_8, qb_8_9, qb_8_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_9_0, qb_9_1, qb_9_2, qb_9_3, qb_9_4, qb_9_5, qb_9_6, qb_9_7, qb_9_8, qb_9_9, qb_9_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, + qb_10_0, qb_10_1, qb_10_2, qb_10_3, qb_10_4, qb_10_5, qb_10_6, qb_10_7, qb_10_8, qb_10_9, qb_10_10, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr16, }; - #define zero16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - - int leg_quad_bubble_count[] = - { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, zero16, - 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 0, 0, 0, 0, 0, zero16, - 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 0, 0, 0, 0, 0, zero16, - 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 0, 0, 0, 0, 0, zero16, - 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 0, 0, 0, 0, 0, zero16, - 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 0, 0, 0, 0, 0, zero16, - 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 0, 0, 0, 0, 0, zero16, - 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 0, 0, 0, 0, 0, zero16, - 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 0, 0, 0, 0, 0, zero16, - 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 0, 0, 0, 0, 0, zero16, - 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 120, 0, 0, 0, 0, 0, zero16, +#define zero16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + unsigned short leg_quad_bubble_count[] = + { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, zero16, + 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 0, 0, 0, 0, 0, zero16, + 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 0, 0, 0, 0, 0, zero16, + 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 0, 0, 0, 0, 0, zero16, + 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 0, 0, 0, 0, 0, zero16, + 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 0, 0, 0, 0, 0, zero16, + 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 0, 0, 0, 0, 0, zero16, + 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 0, 0, 0, 0, 0, zero16, + 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 0, 0, 0, 0, 0, zero16, + 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 0, 0, 0, 0, 0, zero16, + 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 120, 0, 0, 0, 0, 0, zero16, }; - int leg_quad_vertex_indices[4] = { -1, -1, -1, -1 }; + short leg_quad_vertex_indices[4] = { -1, -1, -1, -1 }; - static int leg_quad_edge_indices_0[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - static int leg_quad_edge_indices_1[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - static int leg_quad_edge_indices_2[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - static int leg_quad_edge_indices_3[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short leg_quad_edge_indices_0[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short leg_quad_edge_indices_1[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short leg_quad_edge_indices_2[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short leg_quad_edge_indices_3[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - int* leg_quad_edge_indices[4] = + short* leg_quad_edge_indices[4] = { leg_quad_edge_indices_0, leg_quad_edge_indices_1, @@ -3998,22 +3998,22 @@ namespace Hermes leg_quad_edge_indices_3 }; - #define oo H2D_MAKE_QUAD_ORDER - #define XX(a, b) oo(a, b), oo(a, b) - - int leg_quad_index_to_order[] = - { - oo(0, 0), oo(0, 1), oo(0, 2), oo(0, 3), oo(0, 4), oo(0, 5), oo(0, 6), oo(0, 7), oo(0, 8), oo(0, 9), oo(0, 10), - oo(1, 0), oo(1, 1), oo(1, 2), oo(1, 3), oo(1, 4), oo(1, 5), oo(1, 6), oo(1, 7), oo(1, 8), oo(1, 9), oo(1, 10), - oo(2, 0), oo(2, 1), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), - oo(3, 0), oo(3, 1), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), - oo(4, 0), oo(4, 1), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), - oo(5, 0), oo(5, 1), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), - oo(6, 0), oo(6, 1), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), - oo(7, 0), oo(7, 1), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), - oo(8, 0), oo(8, 1), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), - oo(9, 0), oo(9, 1), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), - oo(10, 0), oo(10, 1), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), +#define oo H2D_MAKE_QUAD_ORDER +#define XX(a, b) oo(a, b), oo(a, b) + + unsigned short leg_quad_index_to_order[] = + { + oo(0, 0), oo(0, 1), oo(0, 2), oo(0, 3), oo(0, 4), oo(0, 5), oo(0, 6), oo(0, 7), oo(0, 8), oo(0, 9), oo(0, 10), + oo(1, 0), oo(1, 1), oo(1, 2), oo(1, 3), oo(1, 4), oo(1, 5), oo(1, 6), oo(1, 7), oo(1, 8), oo(1, 9), oo(1, 10), + oo(2, 0), oo(2, 1), oo(2, 2), oo(2, 3), oo(2, 4), oo(2, 5), oo(2, 6), oo(2, 7), oo(2, 8), oo(2, 9), oo(2, 10), + oo(3, 0), oo(3, 1), oo(3, 2), oo(3, 3), oo(3, 4), oo(3, 5), oo(3, 6), oo(3, 7), oo(3, 8), oo(3, 9), oo(3, 10), + oo(4, 0), oo(4, 1), oo(4, 2), oo(4, 3), oo(4, 4), oo(4, 5), oo(4, 6), oo(4, 7), oo(4, 8), oo(4, 9), oo(4, 10), + oo(5, 0), oo(5, 1), oo(5, 2), oo(5, 3), oo(5, 4), oo(5, 5), oo(5, 6), oo(5, 7), oo(5, 8), oo(5, 9), oo(5, 10), + oo(6, 0), oo(6, 1), oo(6, 2), oo(6, 3), oo(6, 4), oo(6, 5), oo(6, 6), oo(6, 7), oo(6, 8), oo(6, 9), oo(6, 10), + oo(7, 0), oo(7, 1), oo(7, 2), oo(7, 3), oo(7, 4), oo(7, 5), oo(7, 6), oo(7, 7), oo(7, 8), oo(7, 9), oo(7, 10), + oo(8, 0), oo(8, 1), oo(8, 2), oo(8, 3), oo(8, 4), oo(8, 5), oo(8, 6), oo(8, 7), oo(8, 8), oo(8, 9), oo(8, 10), + oo(9, 0), oo(9, 1), oo(9, 2), oo(9, 3), oo(9, 4), oo(9, 5), oo(9, 6), oo(9, 7), oo(9, 8), oo(9, 9), oo(9, 10), + oo(10, 0), oo(10, 1), oo(10, 2), oo(10, 3), oo(10, 4), oo(10, 5), oo(10, 6), oo(10, 7), oo(10, 8), oo(10, 9), oo(10, 10), }; //// triangle legendre shapeset ///////////////////////////////////////////////////////////////// @@ -4149,44 +4149,44 @@ namespace Hermes inline double leg_f4(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .15309310892394863113733025466911821*a2-.15309310892394863113733025466911821*b2; + return .15309310892394863113733025466911821*a2 - .15309310892394863113733025466911821*b2; } inline double leg_f4_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .61237243569579452454932101867647285*a; } inline double leg_f4_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .30618621784789726227466050933823642*a + .30618621784789726227466050933823642*b; } inline double leg_f4_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 1.2247448713915890490986420373529457; } inline double leg_f4_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 0.; } inline double leg_f4_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .61237243569579452454932101867647285; } @@ -4198,12 +4198,12 @@ namespace Hermes inline double leg_f5_dx(double x, double y) { - return -.61237243569579452454932101867647285-.61237243569579452454932101867647285*y; + return -.61237243569579452454932101867647285 - .61237243569579452454932101867647285*y; } inline double leg_f5_dy(double x, double y) { - return -.61237243569579452454932101867647285*x-.61237243569579452454932101867647285; + return -.61237243569579452454932101867647285*x - .61237243569579452454932101867647285; } inline double leg_f5_dxx(double x, double y) @@ -4260,10 +4260,10 @@ namespace Hermes inline double leg_f7_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return (-.98821176880261854124965423263522453e-1*b2 + .98821176880261854124965423263522453e-1*a2)*a; + return (-.98821176880261854124965423263522453e-1 * b2 + .98821176880261854124965423263522453e-1 * a2)*a; } inline double leg_f7_1(double x, double y) @@ -4274,10 +4274,10 @@ namespace Hermes inline double leg_f7_dx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .59292706128157112474979253958113472*a2-.19764235376052370824993084652704491*b2; + return .59292706128157112474979253958113472*a2 - .19764235376052370824993084652704491*b2; } inline double leg_f7_dx_1(double x, double y) @@ -4288,10 +4288,10 @@ namespace Hermes inline double leg_f7_dy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -.98821176880261854124965423263522453e-1*b2 + (.19764235376052370824993084652704491*b + .29646353064078556237489626979056736*a)*a; + return -.98821176880261854124965423263522453e-1 * b2 + (.19764235376052370824993084652704491*b + .29646353064078556237489626979056736*a)*a; } inline double leg_f7_dy_1(double x, double y) @@ -4302,7 +4302,7 @@ namespace Hermes inline double leg_f7_dxx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 2.3717082451262844989991701583245389*a; } @@ -4314,7 +4314,7 @@ namespace Hermes inline double leg_f7_dyy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .39528470752104741649986169305408981*a + .39528470752104741649986169305408981*b; } @@ -4326,7 +4326,7 @@ namespace Hermes inline double leg_f7_dxy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 1.1858541225631422494995850791622694*a + .39528470752104741649986169305408981*b; } @@ -4379,7 +4379,7 @@ namespace Hermes inline double leg_f8_dyy_0(double x, double y) { - return -1.5811388300841896659994467722163592*x-1.5811388300841896659994467722163592; + return -1.5811388300841896659994467722163592*x - 1.5811388300841896659994467722163592; } inline double leg_f8_dyy_1(double x, double y) @@ -4389,7 +4389,7 @@ namespace Hermes inline double leg_f8_dxy_0(double x, double y) { - return -1.5811388300841896659994467722163592*y-.79056941504209483299972338610817962; + return -1.5811388300841896659994467722163592*y - .79056941504209483299972338610817962; } inline double leg_f8_dxy_1(double x, double y) @@ -4421,7 +4421,7 @@ namespace Hermes inline double leg_f9_dy_0(double x, double y) { - return -.79056941504209483299972338610817962*y*(3.*y + 2.)-.79056941504209483299972338610817962*(2.*y + 1.)*x; + return -.79056941504209483299972338610817962*y*(3.*y + 2.) - .79056941504209483299972338610817962*(2.*y + 1.)*x; } inline double leg_f9_dy_1(double x, double y) @@ -4441,7 +4441,7 @@ namespace Hermes inline double leg_f9_dyy_0(double x, double y) { - return -1.5811388300841896659994467722163592*x-4.7434164902525689979983403166490778*y-1.5811388300841896659994467722163592; + return -1.5811388300841896659994467722163592*x - 4.7434164902525689979983403166490778*y - 1.5811388300841896659994467722163592; } inline double leg_f9_dyy_1(double x, double y) @@ -4451,7 +4451,7 @@ namespace Hermes inline double leg_f9_dxy_0(double x, double y) { - return -1.5811388300841896659994467722163592*y-.79056941504209483299972338610817962; + return -1.5811388300841896659994467722163592*y - .79056941504209483299972338610817962; } inline double leg_f9_dxy_1(double x, double y) @@ -4465,45 +4465,45 @@ namespace Hermes inline double leg_f10(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .48412291827592711064740817497279995*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(1. + y); + return .48412291827592711064740817497279995*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(1. + y); } inline double leg_f10_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 1.1858541225631422494995850791622694*a*(1. + y); } inline double leg_f10_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.59292706128157112474979253958113472 + .59292706128157112474979253958113472*y-.29646353064078556237489626979056736*b)*b+ - (.59292706128157112474979253958113472 + .59292706128157112474979253958113472*y + .29646353064078556237489626979056736*a)*a; + double b = 1.0 - y; + return (.59292706128157112474979253958113472 + .59292706128157112474979253958113472*y - .29646353064078556237489626979056736*b)*b + + (.59292706128157112474979253958113472 + .59292706128157112474979253958113472*y + .29646353064078556237489626979056736*a)*a; } inline double leg_f10_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 2.3717082451262844989991701583245389 + 2.3717082451262844989991701583245389*y; } inline double leg_f10_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 1.1858541225631422494995850791622694*a + 1.1858541225631422494995850791622694*b; } inline double leg_f10_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 1.1858541225631422494995850791622694 + 1.1858541225631422494995850791622694*y + 1.1858541225631422494995850791622694*a; } @@ -4515,17 +4515,17 @@ namespace Hermes inline double leg_f11(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; - return .14615849167085708537436518485611521e-1*b4 + (-.87695095002514251224619110913669124e-1*b2 + .73079245835428542687182592428057604e-1*a2)*a2; + return .14615849167085708537436518485611521e-1 * b4 + (-.87695095002514251224619110913669124e-1 * b2 + .73079245835428542687182592428057604e-1 * a2)*a2; } inline double leg_f11_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -4535,27 +4535,27 @@ namespace Hermes inline double leg_f11_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -.58463396668342834149746073942446083e-1*b3 + (-.17539019000502850244923822182733825*b2+ - (.17539019000502850244923822182733825*b + .29231698334171417074873036971223041*a)*a)*a; + return -.58463396668342834149746073942446083e-1 * b3 + (-.17539019000502850244923822182733825*b2 + + (.17539019000502850244923822182733825*b + .29231698334171417074873036971223041*a)*a)*a; } inline double leg_f11_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 3.5078038001005700489847644365467650*a2-.70156076002011400979695288730935299*b2; + return 3.5078038001005700489847644365467650*a2 - .70156076002011400979695288730935299*b2; } inline double leg_f11_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return (.70156076002011400979695288730935299*b + .70156076002011400979695288730935299*a)*a; @@ -4564,7 +4564,7 @@ namespace Hermes inline double leg_f11_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return -.35078038001005700489847644365467650*b2 + (.70156076002011400979695288730935299*b + 1.7539019000502850244923822182733825*a)*a; @@ -4574,13 +4574,13 @@ namespace Hermes inline double leg_f12(double x, double y) { double y2 = y*y; - return -.23385358667337133659898429576978433*(x + 1.)*(5.*y2-1.)*(1. + y); + return -.23385358667337133659898429576978433*(x + 1.)*(5.*y2 - 1.)*(1. + y); } inline double leg_f12_dx(double x, double y) { double y2 = y*y; - return -.23385358667337133659898429576978433*(5.*y2-1.)*(1. + y); + return -.23385358667337133659898429576978433*(5.*y2 - 1.)*(1. + y); } inline double leg_f12_dy(double x, double y) @@ -4601,27 +4601,27 @@ namespace Hermes inline double leg_f12_dxy(double x, double y) { - return .23385358667337133659898429576978433-.23385358667337133659898429576978433*(10. + 15.*y)*y; + return .23385358667337133659898429576978433 - .23385358667337133659898429576978433*(10. + 15.*y)*y; } // number 13 inline double leg_f13(double x, double y) { double y2 = y*y; - return .23385358667337133659898429576978433*(x + y)*(5.*y2-1.)*(1. + y); + return .23385358667337133659898429576978433*(x + y)*(5.*y2 - 1.)*(1. + y); } inline double leg_f13_dx(double x, double y) { double y2 = y*y; - return .23385358667337133659898429576978433*(5.*y2-1.)*(1. + y); + return .23385358667337133659898429576978433*(5.*y2 - 1.)*(1. + y); } inline double leg_f13_dy(double x, double y) { double y2 = y*y; - return -.23385358667337133659898429576978433 + .23385358667337133659898429576978433*(-2. + (15. + 20.*y)*y)*y+ - .23385358667337133659898429576978433*(-1. + (10. + 15.*y)*y)*x; + return -.23385358667337133659898429576978433 + .23385358667337133659898429576978433*(-2. + (15. + 20.*y)*y)*y + + .23385358667337133659898429576978433*(-1. + (10. + 15.*y)*y)*x; } inline double leg_f13_dxx(double x, double y) @@ -4631,8 +4631,8 @@ namespace Hermes inline double leg_f13_dyy(double x, double y) { - return -.46770717334674267319796859153956866 + .46770717334674267319796859153956866*(15. + 30.*y)*y+ - .46770717334674267319796859153956866*(5. + 15.*y)*x; + return -.46770717334674267319796859153956866 + .46770717334674267319796859153956866*(15. + 30.*y)*y + + .46770717334674267319796859153956866*(5. + 15.*y)*x; } inline double leg_f13_dxy(double x, double y) @@ -4646,59 +4646,59 @@ namespace Hermes inline double leg_f14(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .84229416444580658121520354710938710*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)* - (.25000000000000000000000000000000000 + (1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y); + return .84229416444580658121520354710938710*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)* + (.25000000000000000000000000000000000 + (1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y); } inline double leg_f14_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return 2.0631909162161306774360682303013260*a*(.25000000000000000000000000000000000+ - (1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y); + double b = 1.0 - y; + return 2.0631909162161306774360682303013260*a*(.25000000000000000000000000000000000 + + (1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y); } inline double leg_f14_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.25789886452701633467950852878766574 + 1.0315954581080653387180341151506630*(1.5000000000000000000000000000000000+ - 1.2500000000000000000000000000000000*y)*y-.51579772905403266935901705757533149*(2.5000000000000000000000000000000000*y + 1.5000000000000000000000000000000000)*b)*b + (.25789886452701633467950852878766574 + 1.0315954581080653387180341151506630*(1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y + .51579772905403266935901705757533149*(2.5000000000000000000000000000000000*y + 1.5000000000000000000000000000000000)*a)*a; + double b = 1.0 - y; + return (.25789886452701633467950852878766574 + 1.0315954581080653387180341151506630*(1.5000000000000000000000000000000000 + + 1.2500000000000000000000000000000000*y)*y - .51579772905403266935901705757533149*(2.5000000000000000000000000000000000*y + 1.5000000000000000000000000000000000)*b)*b + (.25789886452701633467950852878766574 + 1.0315954581080653387180341151506630*(1.5000000000000000000000000000000000 + 1.2500000000000000000000000000000000*y)*y + .51579772905403266935901705757533149*(2.5000000000000000000000000000000000*y + 1.5000000000000000000000000000000000)*a)*a; } inline double leg_f14_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return 1.0315954581080653387180341151506630 + 4.1263818324322613548721364606026519*(1.5000000000000000000000000000000000+ - 1.2500000000000000000000000000000000*y)*y; + double b = 1.0 - y; + return 1.0315954581080653387180341151506630 + 4.1263818324322613548721364606026519*(1.5000000000000000000000000000000000 + + 1.2500000000000000000000000000000000*y)*y; } inline double leg_f14_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (5.1579772905403266935901705757533151*y + 3.0947863743241960161541023454519890-1.2894943226350816733975426439383287*b)*b+ - (5.1579772905403266935901705757533151*y + 3.0947863743241960161541023454519890 + 1.2894943226350816733975426439383287*a)*a; + double b = 1.0 - y; + return (5.1579772905403266935901705757533151*y + 3.0947863743241960161541023454519890 - 1.2894943226350816733975426439383287*b)*b + + (5.1579772905403266935901705757533151*y + 3.0947863743241960161541023454519890 + 1.2894943226350816733975426439383287*a)*a; } inline double leg_f14_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return .51579772905403266935901705757533151 + 2.0631909162161306774360682303013260*(1.5000000000000000000000000000000000+ - 1.2500000000000000000000000000000000*y)*y + 2.0631909162161306774360682303013260*(2.5000000000000000000000000000000000*y+ - 1.5000000000000000000000000000000000)*a; + double b = 1.0 - y; + return .51579772905403266935901705757533151 + 2.0631909162161306774360682303013260*(1.5000000000000000000000000000000000 + + 1.2500000000000000000000000000000000*y)*y + 2.0631909162161306774360682303013260*(2.5000000000000000000000000000000000*y + + 1.5000000000000000000000000000000000)*a; } // number 15 inline double leg_f15(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .44370598373247120319254962186712128*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(1. + y); @@ -4707,45 +4707,45 @@ namespace Hermes inline double leg_f15_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .44370598373247120319254962186712128*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(1. + y); + return .44370598373247120319254962186712128*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(1. + y); } inline double leg_f15_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -.35078038001005700489847644365467649*b2*(1. + y) + ((.70156076002011400979695288730935298 + .70156076002011400979695288730935298*y- - .35078038001005700489847644365467649*b)*b + (1.0523411400301710146954293309640295 + 1.0523411400301710146954293309640295*y+ - .35078038001005700489847644365467649*a)*a)*a; + return -.35078038001005700489847644365467649*b2*(1. + y) + ((.70156076002011400979695288730935298 + .70156076002011400979695288730935298*y - + .35078038001005700489847644365467649*b)*b + (1.0523411400301710146954293309640295 + 1.0523411400301710146954293309640295*y + + .35078038001005700489847644365467649*a)*a)*a; } inline double leg_f15_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 8.4187291202413681175634346477122357*a*(1. + y); } inline double leg_f15_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y-.70156076002011400979695288730935298*b)*b+ - (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y + 1.4031215200402280195939057746187060*b+ - 2.1046822800603420293908586619280589*a)*a; + double b = 1.0 - y; + return (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y - .70156076002011400979695288730935298*b)*b + + (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y + 1.4031215200402280195939057746187060*b + + 2.1046822800603420293908586619280589*a)*a; } inline double leg_f15_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y-.70156076002011400979695288730935298*b)*b+ - (4.2093645601206840587817173238561178 + 4.2093645601206840587817173238561178*y + 2.1046822800603420293908586619280589*a)*a; + double b = 1.0 - y; + return (1.4031215200402280195939057746187060 + 1.4031215200402280195939057746187060*y - .70156076002011400979695288730935298*b)*b + + (4.2093645601206840587817173238561178 + 4.2093645601206840587817173238561178*y + 2.1046822800603420293908586619280589*a)*a; } // ORDER 5 @@ -4756,11 +4756,11 @@ namespace Hermes inline double leg_f16_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; - return (.24859222776089561404717184605248599e-1*b4 + (-.82864075920298538015723948684161998e-1*b2 + .58004853144208976611006764078913399e-1*a2)*a2)*a; + return (.24859222776089561404717184605248599e-1 * b4 + (-.82864075920298538015723948684161998e-1 * b2 + .58004853144208976611006764078913399e-1 * a2)*a2)*a; } inline double leg_f16_1(double x, double y) @@ -4771,12 +4771,12 @@ namespace Hermes inline double leg_f16_dx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .49718445552179122809434369210497199e-1*b4 + (-.49718445552179122809434369210497199*b2 + .58004853144208976611006764078913399*a2)*a2; + return .49718445552179122809434369210497199e-1 * b4 + (-.49718445552179122809434369210497199*b2 + .58004853144208976611006764078913399*a2)*a2; } inline double leg_f16_dx_1(double x, double y) @@ -4787,13 +4787,13 @@ namespace Hermes inline double leg_f16_dy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .24859222776089561404717184605248599e-1*b4 + (-.99436891104358245618868738420994398e-1*b3 + (-.24859222776089561404717184605248599*b2+ - (.16572815184059707603144789736832400*b + .29002426572104488305503382039456699*a)*a)*a)*a; + return .24859222776089561404717184605248599e-1 * b4 + (-.99436891104358245618868738420994398e-1 * b3 + (-.24859222776089561404717184605248599*b2 + + (.16572815184059707603144789736832400*b + .29002426572104488305503382039456699*a)*a)*a)*a; } inline double leg_f16_dy_1(double x, double y) @@ -4804,7 +4804,7 @@ namespace Hermes inline double leg_f16_dxx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -4819,12 +4819,12 @@ namespace Hermes inline double leg_f16_dyy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -.19887378220871649123773747684198880*b3 + (-.19887378220871649123773747684198880*b2+ - (.99436891104358245618868738420994398*b + .99436891104358245618868738420994398*a)*a)*a; + return -.19887378220871649123773747684198880*b3 + (-.19887378220871649123773747684198880*b2 + + (.99436891104358245618868738420994398*b + .99436891104358245618868738420994398*a)*a)*a; } inline double leg_f16_dyy_1(double x, double y) @@ -4835,12 +4835,12 @@ namespace Hermes inline double leg_f16_dxy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -.19887378220871649123773747684198880*b3 + (-.99436891104358245618868738420994398*b2+ - (.99436891104358245618868738420994398*b + 2.3201941257683590644402705631565359*a)*a)*a; + return -.19887378220871649123773747684198880*b3 + (-.99436891104358245618868738420994398*b2 + + (.99436891104358245618868738420994398*b + 2.3201941257683590644402705631565359*a)*a)*a; } inline double leg_f16_dxy_1(double x, double y) @@ -4852,7 +4852,7 @@ namespace Hermes inline double leg_f17_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(x + 1.)*(7.*y2-3.)*y*(1. + y); + return -.26516504294495532165031663578931839*(x + 1.)*(7.*y2 - 3.)*y*(1. + y); } // number 17 @@ -4864,7 +4864,7 @@ namespace Hermes inline double leg_f17_dx_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(7.*y2-3.)*y*(1. + y); + return -.26516504294495532165031663578931839*(7.*y2 - 3.)*y*(1. + y); } inline double leg_f17_dx_1(double x, double y) @@ -4905,7 +4905,7 @@ namespace Hermes inline double leg_f17_dxy_0(double x, double y) { - return .79549512883486596495094990736795518-.26516504294495532165031663578931839*(-6. + (21. + 28.*y)*y)*y; + return .79549512883486596495094990736795518 - .26516504294495532165031663578931839*(-6. + (21. + 28.*y)*y)*y; } inline double leg_f17_dxy_1(double x, double y) @@ -4917,7 +4917,7 @@ namespace Hermes inline double leg_f18_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(x + y)*(7.*y2-3.)*y*(1. + y); + return -.26516504294495532165031663578931839*(x + y)*(7.*y2 - 3.)*y*(1. + y); } // number 18 @@ -4929,7 +4929,7 @@ namespace Hermes inline double leg_f18_dx_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(7.*y2-3.)*y*(1. + y); + return -.26516504294495532165031663578931839*(7.*y2 - 3.)*y*(1. + y); } inline double leg_f18_dx_1(double x, double y) @@ -4940,7 +4940,7 @@ namespace Hermes inline double leg_f18_dy_0(double x, double y) { double y2 = y*y; - return -.26516504294495532165031663578931839*(-6. + (-9. + (28. + 35.*y)*y)*y)*y-.26516504294495532165031663578931839*(-3. + (-6. + (21. + 28.*y)*y)*y)*x; + return -.26516504294495532165031663578931839*(-6. + (-9. + (28. + 35.*y)*y)*y)*y - .26516504294495532165031663578931839*(-3. + (-6. + (21. + 28.*y)*y)*y)*x; } inline double leg_f18_dy_1(double x, double y) @@ -4960,8 +4960,8 @@ namespace Hermes inline double leg_f18_dyy_0(double x, double y) { - return 1.5909902576697319299018998147359104-.53033008588991064330063327157863679*(-9. + (42. + 70.*y)*y)*y- - .53033008588991064330063327157863679*(-3. + (21. + 42.*y)*y)*x; + return 1.5909902576697319299018998147359104 - .53033008588991064330063327157863679*(-9. + (42. + 70.*y)*y)*y - + .53033008588991064330063327157863679*(-3. + (21. + 42.*y)*y)*x; } inline double leg_f18_dyy_1(double x, double y) @@ -4971,7 +4971,7 @@ namespace Hermes inline double leg_f18_dxy_0(double x, double y) { - return .79549512883486596495094990736795518-.26516504294495532165031663578931839*(-6. + (21. + 28.*y)*y)*y; + return .79549512883486596495094990736795518 - .26516504294495532165031663578931839*(-6. + (21. + 28.*y)*y)*y; } inline double leg_f18_dxy_1(double x, double y) @@ -4985,67 +4985,67 @@ namespace Hermes inline double leg_f19(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.1023963796102460793756732306830252*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)* - (-.25000000000000000000000000000000000 + (.25000000000000000000000000000000000 + (2.2500000000000000000000000000000000+ - 1.7500000000000000000000000000000000*y)*y)*y); + return 1.1023963796102460793756732306830252*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)* + (-.25000000000000000000000000000000000 + (.25000000000000000000000000000000000 + (2.2500000000000000000000000000000000 + + 1.7500000000000000000000000000000000*y)*y)*y); } inline double leg_f19_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return 2.7003086243366084295691530983699986*a*(-.25000000000000000000000000000000000 + (.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y); + double b = 1.0 - y; + return 2.7003086243366084295691530983699986*a*(-.25000000000000000000000000000000000 + (.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y); } inline double leg_f19_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-.33753857804207605369614413729624983 + 1.3501543121683042147845765491849993*(.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y-.67507715608415210739228827459249967* - (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*b)*b+ - (-.33753857804207605369614413729624983 + 1.3501543121683042147845765491849993*(.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y + .67507715608415210739228827459249967* - (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*a)*a; + double b = 1.0 - y; + return (-.33753857804207605369614413729624983 + 1.3501543121683042147845765491849993*(.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y - .67507715608415210739228827459249967* + (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*b)*b + + (-.33753857804207605369614413729624983 + 1.3501543121683042147845765491849993*(.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y + .67507715608415210739228827459249967* + (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*a)*a; } inline double leg_f19_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return -1.3501543121683042147845765491849993 + 5.4006172486732168591383061967399971*(.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y; + double b = 1.0 - y; + return -1.3501543121683042147845765491849993 + 5.4006172486732168591383061967399971*(.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y; } inline double leg_f19_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986*(4.5000000000000000000000000000000000+ - 5.2500000000000000000000000000000000*y)*y-.67507715608415210739228827459249967*(10.500000000000000000000000000000000*y+ - 4.5000000000000000000000000000000000)*b)*b + (.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986* - (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y + .67507715608415210739228827459249967* - (10.500000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a; + double b = 1.0 - y; + return (.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986*(4.5000000000000000000000000000000000 + + 5.2500000000000000000000000000000000*y)*y - .67507715608415210739228827459249967*(10.500000000000000000000000000000000*y + + 4.5000000000000000000000000000000000)*b)*b + (.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986* + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y + .67507715608415210739228827459249967* + (10.500000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a; } inline double leg_f19_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return -.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986*(.25000000000000000000000000000000000+ - (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y + 2.7003086243366084295691530983699986* - (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*a; + double b = 1.0 - y; + return -.67507715608415210739228827459249967 + 2.7003086243366084295691530983699986*(.25000000000000000000000000000000000 + + (2.2500000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y)*y + 2.7003086243366084295691530983699986* + (.25000000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 5.2500000000000000000000000000000000*y)*y)*a; } // number 20 inline double leg_f20(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .72944814386945601069179830653602616*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y); @@ -5054,47 +5054,47 @@ namespace Hermes inline double leg_f20_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .72944814386945601069179830653602616*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y); + return .72944814386945601069179830653602616*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y); } inline double leg_f20_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -.57667939240241767253899168157713749*b2*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y) + ((.86501908860362650880848752236570622 + 1.1533587848048353450779833631542750*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y-.57667939240241767253899168157713749*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (1.2975286329054397632127312835485594 + 1.7300381772072530176169750447314125*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + .57667939240241767253899168157713749*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*a)*a)*a; + return -.57667939240241767253899168157713749*b2*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y) + ((.86501908860362650880848752236570622 + 1.1533587848048353450779833631542750*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y - .57667939240241767253899168157713749*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (1.2975286329054397632127312835485594 + 1.7300381772072530176169750447314125*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + .57667939240241767253899168157713749*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*a)*a)*a; } inline double leg_f20_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 13.840305417658024140935800357851299*a*(.75000000000000000000000000000000000 + (2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y); } inline double leg_f20_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y-1.1533587848048353450779833631542750*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + (8.0735114936338474155458835420799248*y + 5.7667939240241767253899168157713747-2.0183778734084618538864708855199811*b)*b + (12.110267240450771123318825313119887*y + 8.6501908860362650880848752236570620 + 2.0183778734084618538864708855199811*a)*a)*a; + double b = 1.0 - y; + return (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y - 1.1533587848048353450779833631542750*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + (8.0735114936338474155458835420799248*y + 5.7667939240241767253899168157713747 - 2.0183778734084618538864708855199811*b)*b + (12.110267240450771123318825313119887*y + 8.6501908860362650880848752236570620 + 2.0183778734084618538864708855199811*a)*a)*a; } inline double leg_f20_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y-1.1533587848048353450779833631542750*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (5.1901145316217590528509251341942374 + 6.9201527088290120704679001789256498*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + 3.4600763544145060352339500894628249*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*a)*a; + double b = 1.0 - y; + return (1.7300381772072530176169750447314124 + 2.3067175696096706901559667263085499*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y - 1.1533587848048353450779833631542750*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*b)*b + (5.1901145316217590528509251341942374 + 6.9201527088290120704679001789256498*(2.5000000000000000000000000000000000 + 1.7500000000000000000000000000000000*y)*y + 3.4600763544145060352339500894628249*(3.5000000000000000000000000000000000*y + 2.5000000000000000000000000000000000)*a)*a; } // number 21 inline double leg_f21(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -5104,7 +5104,7 @@ namespace Hermes inline double leg_f21_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5114,41 +5114,41 @@ namespace Hermes inline double leg_f21_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-.31004898176538170982440809612960083-.31004898176538170982440809612960083*y + .77512245441345427456102024032400208e-1*b)*b3 + (-.93014694529614512947322428838880250*b2*(1. + y) + ((.93014694529614512947322428838880250 + .93014694529614512947322428838880250*y-.46507347264807256473661214419440125*b)*b + (1.5502449088269085491220404806480042 + 1.5502449088269085491220404806480042*y + .38756122720672713728051012016200104*a)*a)*a)*a; + return (-.31004898176538170982440809612960083 - .31004898176538170982440809612960083*y + .77512245441345427456102024032400208e-1 * b)*b3 + (-.93014694529614512947322428838880250*b2*(1. + y) + ((.93014694529614512947322428838880250 + .93014694529614512947322428838880250*y - .46507347264807256473661214419440125*b)*b + (1.5502449088269085491220404806480042 + 1.5502449088269085491220404806480042*y + .38756122720672713728051012016200104*a)*a)*a)*a; } inline double leg_f21_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return .33145630368119415206289579473664799*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(1. + y); + return .33145630368119415206289579473664799*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(1. + y); } inline double leg_f21_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -.62009796353076341964881619225920167*b3 + ((3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y-1.8602938905922902589464485767776050*b)*b + (3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y + 1.8602938905922902589464485767776050*b + 3.1004898176538170982440809612960083*a)*a)*a; + return -.62009796353076341964881619225920167*b3 + ((3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y - 1.8602938905922902589464485767776050*b)*b + (3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y + 1.8602938905922902589464485767776050*b + 3.1004898176538170982440809612960083*a)*a)*a; } inline double leg_f21_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -1.8602938905922902589464485767776050*b2*(1. + y) + ((3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y-1.8602938905922902589464485767776050*b)*b + (9.3014694529614512947322428838880250 + 9.3014694529614512947322428838880250*y + 3.1004898176538170982440809612960083*a)*a)*a; + return -1.8602938905922902589464485767776050*b2*(1. + y) + ((3.7205877811845805178928971535552100 + 3.7205877811845805178928971535552100*y - 1.8602938905922902589464485767776050*b)*b + (9.3014694529614512947322428838880250 + 9.3014694529614512947322428838880250*y + 3.1004898176538170982440809612960083*a)*a)*a; } // ORDER 6 @@ -5159,18 +5159,18 @@ namespace Hermes inline double leg_f22(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; - return -.22902420702262839621902490788791339e-2*b6 + (.34353631053394259432853736183187009e-1*b4 + (-.80158472457919938676658717760769688e-1*b2 + .48095083474751963205995230656461813e-1*a2)*a2)*a2; + return -.22902420702262839621902490788791339e-2 * b6 + (.34353631053394259432853736183187009e-1 * b4 + (-.80158472457919938676658717760769688e-1 * b2 + .48095083474751963205995230656461813e-1 * a2)*a2)*a2; } inline double leg_f22_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5182,19 +5182,19 @@ namespace Hermes inline double leg_f22_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return .13741452421357703773141494473274804e-1*b5 + (.68707262106788518865707472366374018e-1*b4 + (-.13741452421357703773141494473274804*b3 + (-.32063388983167975470663487104307875*b2 + (.16031694491583987735331743552153938*b + .28857050084851177923597138393877088*a)*a)*a)*a)*a; + return .13741452421357703773141494473274804e-1 * b5 + (.68707262106788518865707472366374018e-1 * b4 + (-.13741452421357703773141494473274804*b3 + (-.32063388983167975470663487104307875*b2 + (.16031694491583987735331743552153938*b + .28857050084851177923597138393877088*a)*a)*a)*a)*a; } inline double leg_f22_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5205,7 +5205,7 @@ namespace Hermes inline double leg_f22_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5216,7 +5216,7 @@ namespace Hermes inline double leg_f22_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5255,7 +5255,7 @@ namespace Hermes inline double leg_f23_dxy(double x, double y) { - return -.14657549249448217358017594104826457-.14657549249448217358017594104826457*(-28. + (-42. + (84. + 105.*y)*y)*y)*y; + return -.14657549249448217358017594104826457 - .14657549249448217358017594104826457*(-28. + (-42. + (84. + 105.*y)*y)*y)*y; } // number 24 @@ -5298,17 +5298,17 @@ namespace Hermes inline double leg_f25(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double y2 = y*y; - return 1.3055824196677337863296844245952112*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(-.12500000000000000000000000000000000 + (-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y); + return 1.3055824196677337863296844245952112*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(-.12500000000000000000000000000000000 + (-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y); } inline double leg_f25_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; return 3.1980107453341565144765659865075906*a*(-.12500000000000000000000000000000000 + (-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y); } @@ -5316,15 +5316,15 @@ namespace Hermes inline double leg_f25_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; - return (-.19987567158338478215478537415672443 + 1.5990053726670782572382829932537954*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y-.79950268633353912861914149662689767*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*b)*b + (-.19987567158338478215478537415672443 + 1.5990053726670782572382829932537954*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y + .79950268633353912861914149662689767*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*a)*a; + return (-.19987567158338478215478537415672443 + 1.5990053726670782572382829932537954*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y - .79950268633353912861914149662689767*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*b)*b + (-.19987567158338478215478537415672443 + 1.5990053726670782572382829932537954*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y + .79950268633353912861914149662689767*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*a)*a; } inline double leg_f25_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; return -.79950268633353912861914149662689769 + 6.3960214906683130289531319730151814*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y; } @@ -5332,15 +5332,15 @@ namespace Hermes inline double leg_f25_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; - return (-3.1980107453341565144765659865075906 + 3.1980107453341565144765659865075906*(10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2-.79950268633353912861914149662689767*(21. + 31.500000000000000000000000000000000*y)*y*b)*b + (-3.1980107453341565144765659865075906 + 3.1980107453341565144765659865075906*(10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2 + .79950268633353912861914149662689767*(21. + 31.500000000000000000000000000000000*y)*y*a)*a; + return (-3.1980107453341565144765659865075906 + 3.1980107453341565144765659865075906*(10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2 - .79950268633353912861914149662689767*(21. + 31.500000000000000000000000000000000*y)*y*b)*b + (-3.1980107453341565144765659865075906 + 3.1980107453341565144765659865075906*(10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2 + .79950268633353912861914149662689767*(21. + 31.500000000000000000000000000000000*y)*y*a)*a; } inline double leg_f25_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; return -.39975134316676956430957074831344884 + 3.1980107453341565144765659865075906*(-1. + (3.5000000000000000000000000000000000 + 2.6250000000000000000000000000000000*y)*y2)*y + 3.1980107453341565144765659865075906*(-1. + (10.500000000000000000000000000000000 + 10.500000000000000000000000000000000*y)*y2)*a; } @@ -5349,7 +5349,7 @@ namespace Hermes inline double leg_f26(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return .99215674164922147143810590761472265*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(2. + (5. + 3.*y)*y)*y; @@ -5358,47 +5358,47 @@ namespace Hermes inline double leg_f26_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return .99215674164922147143810590761472265*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(2. + (5. + 3.*y)*y)*y; + return .99215674164922147143810590761472265*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(2. + (5. + 3.*y)*y)*y; } inline double leg_f26_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -.78436877487569582622953627417361325*b2*(2. + (5. + 3.*y)*y)*y + ((1.5687375497513916524590725483472265*(2. + (5. + 3.*y)*y)*y-.78436877487569582622953627417361325*(2. + (10. + 9.*y)*y)*b)*b + (2.3531063246270874786886088225208398*(2. + (5. + 3.*y)*y)*y + .78436877487569582622953627417361325*(2. + (10. + 9.*y)*y)*a)*a)*a; + return -.78436877487569582622953627417361325*b2*(2. + (5. + 3.*y)*y)*y + ((1.5687375497513916524590725483472265*(2. + (5. + 3.*y)*y)*y - .78436877487569582622953627417361325*(2. + (10. + 9.*y)*y)*b)*b + (2.3531063246270874786886088225208398*(2. + (5. + 3.*y)*y)*y + .78436877487569582622953627417361325*(2. + (10. + 9.*y)*y)*a)*a)*a; } inline double leg_f26_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 18.824850597016699829508870580166718*a*(2. + (5. + 3.*y)*y)*y; } inline double leg_f26_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y-1.5687375497513916524590725483472265*(2. + (10. + 9.*y)*y)*b)*b + (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y + (6.2749501990055666098362901933889059 + 3.1374750995027833049181450966944530*(10. + 9.*y)*y-.78436877487569582622953627417361325*(18.*y + 10.)*b)*b + (9.4124252985083499147544352900833588 + 4.7062126492541749573772176450416795*(10. + 9.*y)*y + .78436877487569582622953627417361325*(18.*y + 10.)*a)*a)*a; + double b = 1.0 - y; + return (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y - 1.5687375497513916524590725483472265*(2. + (10. + 9.*y)*y)*b)*b + (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y + (6.2749501990055666098362901933889059 + 3.1374750995027833049181450966944530*(10. + 9.*y)*y - .78436877487569582622953627417361325*(18.*y + 10.)*b)*b + (9.4124252985083499147544352900833588 + 4.7062126492541749573772176450416795*(10. + 9.*y)*y + .78436877487569582622953627417361325*(18.*y + 10.)*a)*a)*a; } inline double leg_f26_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y-1.5687375497513916524590725483472265*(2. + (10. + 9.*y)*y)*b)*b + (9.4124252985083499147544352900833590*(2. + (5. + 3.*y)*y)*y + 4.7062126492541749573772176450416795*(2. + (10. + 9.*y)*y)*a)*a; + double b = 1.0 - y; + return (3.1374750995027833049181450966944530*(2. + (5. + 3.*y)*y)*y - 1.5687375497513916524590725483472265*(2. + (10. + 9.*y)*y)*b)*b + (9.4124252985083499147544352900833590*(2. + (5. + 3.*y)*y)*y + 4.7062126492541749573772176450416795*(2. + (10. + 9.*y)*y)*a)*a; } // number 27 inline double leg_f27(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -5408,7 +5408,7 @@ namespace Hermes inline double leg_f27_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5418,48 +5418,48 @@ namespace Hermes inline double leg_f27_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-.58593750000000000000000000000000000-.46875000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + .11718750000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b3 + (-1.4062500000000000000000000000000000*b2*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y) + ((1.7578125000000000000000000000000000 + 1.4062500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y-.70312500000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (2.9296875000000000000000000000000000 + 2.3437500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + .58593750000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*a)*a)*a)*a; + return (-.58593750000000000000000000000000000 - .46875000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + .11718750000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b3 + (-1.4062500000000000000000000000000000*b2*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y) + ((1.7578125000000000000000000000000000 + 1.4062500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y - .70312500000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (2.9296875000000000000000000000000000 + 2.3437500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + .58593750000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*a)*a)*a)*a; } inline double leg_f27_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return .50111482858579572128353777664953786*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y); + return .50111482858579572128353777664953786*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y); } inline double leg_f27_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-4.2187500000000000000000000000000000*y-3.2812500000000000000000000000000000 + .52734375000000000000000000000000000*b)*b3 + ((7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y-2.8125000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + (12.656250000000000000000000000000000*y + 9.8437500000000000000000000000000000-3.1640625000000000000000000000000000*b)*b + (21.093750000000000000000000000000000*y + 16.406250000000000000000000000000000 + 2.6367187500000000000000000000000000*a)*a)*a)*a; + return (-4.2187500000000000000000000000000000*y - 3.2812500000000000000000000000000000 + .52734375000000000000000000000000000*b)*b3 + ((7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y - 2.8125000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + (12.656250000000000000000000000000000*y + 9.8437500000000000000000000000000000 - 3.1640625000000000000000000000000000*b)*b + (21.093750000000000000000000000000000*y + 16.406250000000000000000000000000000 + 2.6367187500000000000000000000000000*a)*a)*a)*a; } inline double leg_f27_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -2.8125000000000000000000000000000000*b2*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y) + ((7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y-2.8125000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (17.578125000000000000000000000000000 + 14.062500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + 4.6875000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*a)*a)*a; + return -2.8125000000000000000000000000000000*b2*(1.2500000000000000000000000000000000 + (3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y) + ((7.0312500000000000000000000000000000 + 5.6250000000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y - 2.8125000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*b)*b + (17.578125000000000000000000000000000 + 14.062500000000000000000000000000000*(3.5000000000000000000000000000000000 + 2.2500000000000000000000000000000000*y)*y + 4.6875000000000000000000000000000000*(4.5000000000000000000000000000000000*y + 3.5000000000000000000000000000000000)*a)*a)*a; } // number 28 inline double leg_f28(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -5469,7 +5469,7 @@ namespace Hermes inline double leg_f28_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5480,18 +5480,18 @@ namespace Hermes inline double leg_f28_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .18012218143288356533005732055603413*b4*(1. + y) + ((-.72048872573153426132022928222413650-.72048872573153426132022928222413650*y + .18012218143288356533005732055603413*b)*b3 + (-1.8012218143288356533005732055603413*b2*(1. + y) + ((1.2008145428858904355337154703735608 + 1.2008145428858904355337154703735608*y-.60040727144294521776685773518678042*b)*b + (2.1014254500503082621840020731537315 + 2.1014254500503082621840020731537315*y + .42028509001006165243680041463074629*a)*a)*a)*a)*a; + return .18012218143288356533005732055603413*b4*(1. + y) + ((-.72048872573153426132022928222413650 - .72048872573153426132022928222413650*y + .18012218143288356533005732055603413*b)*b3 + (-1.8012218143288356533005732055603413*b2*(1. + y) + ((1.2008145428858904355337154703735608 + 1.2008145428858904355337154703735608*y - .60040727144294521776685773518678042*b)*b + (2.1014254500503082621840020731537315 + 2.1014254500503082621840020731537315*y + .42028509001006165243680041463074629*a)*a)*a)*a)*a; } inline double leg_f28_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5501,21 +5501,21 @@ namespace Hermes inline double leg_f28_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-1.4409774514630685226404585644482730-1.4409774514630685226404585644482730*y + .36024436286576713066011464111206825*b)*b3 + ((-1.4409774514630685226404585644482730-1.4409774514630685226404585644482730*y-1.4409774514630685226404585644482730*b)*b2 + ((7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y-3.6024436286576713066011464111206825*b)*b + (7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y + 2.4016290857717808710674309407471217*b + 4.2028509001006165243680041463074629*a)*a)*a)*a; + return (-1.4409774514630685226404585644482730 - 1.4409774514630685226404585644482730*y + .36024436286576713066011464111206825*b)*b3 + ((-1.4409774514630685226404585644482730 - 1.4409774514630685226404585644482730*y - 1.4409774514630685226404585644482730*b)*b2 + ((7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y - 3.6024436286576713066011464111206825*b)*b + (7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y + 2.4016290857717808710674309407471217*b + 4.2028509001006165243680041463074629*a)*a)*a)*a; } inline double leg_f28_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-1.4409774514630685226404585644482730-1.4409774514630685226404585644482730*y + .36024436286576713066011464111206825*b)*b3 + (-7.2048872573153426132022928222413650*b2*(1. + y) + ((7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y-3.6024436286576713066011464111206825*b)*b + (16.811403600402466097472016585229852 + 16.811403600402466097472016585229852*y + 4.2028509001006165243680041463074629*a)*a)*a)*a; + return (-1.4409774514630685226404585644482730 - 1.4409774514630685226404585644482730*y + .36024436286576713066011464111206825*b)*b3 + (-7.2048872573153426132022928222413650*b2*(1. + y) + ((7.2048872573153426132022928222413650 + 7.2048872573153426132022928222413650*y - 3.6024436286576713066011464111206825*b)*b + (16.811403600402466097472016585229852 + 16.811403600402466097472016585229852*y + 4.2028509001006165243680041463074629*a)*a)*a)*a; } // ORDER 7 @@ -5526,12 +5526,12 @@ namespace Hermes inline double leg_f29_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; - return (-.62243890546786924194680470080844507e-2*b6 + (.43570723382750846936276329056591155e-1*b4 + (-.78427302088951524485297392301864079e-1*b2 + .41080967760879369968489110253357375e-1*a2)*a2)*a2)*a; + return (-.62243890546786924194680470080844507e-2 * b6 + (.43570723382750846936276329056591155e-1 * b4 + (-.78427302088951524485297392301864079e-1 * b2 + .41080967760879369968489110253357375e-1 * a2)*a2)*a2)*a; } inline double leg_f29_1(double x, double y) @@ -5542,14 +5542,14 @@ namespace Hermes inline double leg_f29_dx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.12448778109357384838936094016168901e-1*b6 + (.26142434029650508161765797433954693*b4 + (-.78427302088951524485297392301864079*b2 + .57513354865231117955884754354700324*a2)*a2)*a2; + return -.12448778109357384838936094016168901e-1 * b6 + (.26142434029650508161765797433954693*b4 + (-.78427302088951524485297392301864079*b2 + .57513354865231117955884754354700324*a2)*a2)*a2; } inline double leg_f29_dx_1(double x, double y) @@ -5560,14 +5560,14 @@ namespace Hermes inline double leg_f29_dy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.62243890546786924194680470080844507e-2*b6 + (.37346334328072154516808282048506704e-1*b5 + (.13071217014825254080882898716977346*b4 + (-.17428289353100338774510531622636462*b3 + (-.39213651044475762242648696150932039*b2 + (.15685460417790304897059478460372816*b + .28756677432615558977942377177350162*a)*a)*a)*a)*a)*a; + return -.62243890546786924194680470080844507e-2 * b6 + (.37346334328072154516808282048506704e-1 * b5 + (.13071217014825254080882898716977346*b4 + (-.17428289353100338774510531622636462*b3 + (-.39213651044475762242648696150932039*b2 + (.15685460417790304897059478460372816*b + .28756677432615558977942377177350162*a)*a)*a)*a)*a)*a; } inline double leg_f29_dy_1(double x, double y) @@ -5578,7 +5578,7 @@ namespace Hermes inline double leg_f29_dxx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5595,13 +5595,13 @@ namespace Hermes inline double leg_f29_dyy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return .74692668656144309033616564097013408e-1*b5 + (.74692668656144309033616564097013408e-1*b4 + (-1.0456973611860203264706318973581877*b3 + (-1.0456973611860203264706318973581877*b2 + (1.5685460417790304897059478460372816*b + 1.5685460417790304897059478460372816*a)*a)*a)*a)*a; + return .74692668656144309033616564097013408e-1 * b5 + (.74692668656144309033616564097013408e-1 * b4 + (-1.0456973611860203264706318973581877*b3 + (-1.0456973611860203264706318973581877*b2 + (1.5685460417790304897059478460372816*b + 1.5685460417790304897059478460372816*a)*a)*a)*a)*a; } inline double leg_f29_dyy_1(double x, double y) @@ -5612,13 +5612,13 @@ namespace Hermes inline double leg_f29_dxy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return .74692668656144309033616564097013408e-1*b5 + (.52284868059301016323531594867909386*b4 + (-1.0456973611860203264706318973581877*b3 + (-3.1370920835580609794118956920745631*b2 + (1.5685460417790304897059478460372816*b + 3.4508012919138670773530852612820195*a)*a)*a)*a)*a; + return .74692668656144309033616564097013408e-1 * b5 + (.52284868059301016323531594867909386*b4 + (-1.0456973611860203264706318973581877*b3 + (-3.1370920835580609794118956920745631*b2 + (1.5685460417790304897059478460372816*b + 3.4508012919138670773530852612820195*a)*a)*a)*a)*a; } inline double leg_f29_dxy_1(double x, double y) @@ -5683,7 +5683,7 @@ namespace Hermes inline double leg_f30_dxy_0(double x, double y) { - return -.79672179899887262969191001703480969-.15934435979977452593838200340696194*(10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y; + return -.79672179899887262969191001703480969 - .15934435979977452593838200340696194*(10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y; } inline double leg_f30_dxy_1(double x, double y) @@ -5718,7 +5718,7 @@ namespace Hermes inline double leg_f31_dy_0(double x, double y) { double y2 = y*y; - return -.15934435979977452593838200340696194*(10. + (15. + (-120. + (-150. + (198. + 231.*y)*y)*y)*y)*y)*y-.15934435979977452593838200340696194*(5. + (10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y)*x; + return -.15934435979977452593838200340696194*(10. + (15. + (-120. + (-150. + (198. + 231.*y)*y)*y)*y)*y)*y - .15934435979977452593838200340696194*(5. + (10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y)*x; } inline double leg_f31_dy_1(double x, double y) @@ -5738,7 +5738,7 @@ namespace Hermes inline double leg_f31_dyy_0(double x, double y) { - return -1.5934435979977452593838200340696194-.31868871959954905187676400681392388*(15. + (-180. + (-300. + (495. + 693.*y)*y)*y)*y)*y-.31868871959954905187676400681392388*(5. + (-90. + (-180. + (330. + 495.*y)*y)*y)*y)*x; + return -1.5934435979977452593838200340696194 - .31868871959954905187676400681392388*(15. + (-180. + (-300. + (495. + 693.*y)*y)*y)*y)*y - .31868871959954905187676400681392388*(5. + (-90. + (-180. + (330. + 495.*y)*y)*y)*y)*x; } inline double leg_f31_dyy_1(double x, double y) @@ -5748,7 +5748,7 @@ namespace Hermes inline double leg_f31_dxy_0(double x, double y) { - return -.79672179899887262969191001703480969-.15934435979977452593838200340696194*(10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y; + return -.79672179899887262969191001703480969 - .15934435979977452593838200340696194*(10. + (-90. + (-120. + (165. + 198.*y)*y)*y)*y)*y; } inline double leg_f31_dxy_1(double x, double y) @@ -5762,44 +5762,44 @@ namespace Hermes inline double leg_f32(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.4752421108802058983765559207693054*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(.12500000000000000000000000000000000 + (-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y); + return 1.4752421108802058983765559207693054*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(.12500000000000000000000000000000000 + (-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y); } inline double leg_f32_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 3.6135904187228682497009747173648780*a*(.12500000000000000000000000000000000 + (-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y); } inline double leg_f32_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.22584940117017926560631091983530488 + 1.8067952093614341248504873586824390*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y-.90339760468071706242524367934121949*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*b)*b + (.22584940117017926560631091983530488 + 1.8067952093614341248504873586824390*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y + .90339760468071706242524367934121949*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (.22584940117017926560631091983530488 + 1.8067952093614341248504873586824390*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y - .90339760468071706242524367934121949*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*b)*b + (.22584940117017926560631091983530488 + 1.8067952093614341248504873586824390*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y + .90339760468071706242524367934121949*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*a)*a; } inline double leg_f32_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .90339760468071706242524367934121949 + 7.2271808374457364994019494347297560*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y; } inline double leg_f32_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-1.3550964070210755936378655190118293 + 3.6135904187228682497009747173648780*(-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y-.90339760468071706242524367934121949*(-5.5000000000000000000000000000000000 + (-4.5000000000000000000000000000000000 + (67.500000000000000000000000000000000 + 82.500000000000000000000000000000000*y)*y)*y)*b)*b + (-1.3550964070210755936378655190118293 + 3.6135904187228682497009747173648780*(-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y + .90339760468071706242524367934121949*(-5.5000000000000000000000000000000000 + (-4.5000000000000000000000000000000000 + (67.500000000000000000000000000000000 + 82.500000000000000000000000000000000*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (-1.3550964070210755936378655190118293 + 3.6135904187228682497009747173648780*(-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y - .90339760468071706242524367934121949*(-5.5000000000000000000000000000000000 + (-4.5000000000000000000000000000000000 + (67.500000000000000000000000000000000 + 82.500000000000000000000000000000000*y)*y)*y)*b)*b + (-1.3550964070210755936378655190118293 + 3.6135904187228682497009747173648780*(-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y + .90339760468071706242524367934121949*(-5.5000000000000000000000000000000000 + (-4.5000000000000000000000000000000000 + (67.500000000000000000000000000000000 + 82.500000000000000000000000000000000*y)*y)*y)*a)*a; } inline double leg_f32_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .45169880234035853121262183967060975 + 3.6135904187228682497009747173648780*(-.37500000000000000000000000000000000 + (-2.7500000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (5.6250000000000000000000000000000000 + 4.1250000000000000000000000000000000*y)*y)*y)*y)*y + 3.6135904187228682497009747173648780*(-.37500000000000000000000000000000000 + (-5.5000000000000000000000000000000000 + (-2.2500000000000000000000000000000000 + (22.500000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*y)*a; } @@ -5807,7 +5807,7 @@ namespace Hermes inline double leg_f33(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return 1.2208540490103741136884064212095202*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y); @@ -5816,47 +5816,47 @@ namespace Hermes inline double leg_f33_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.2208540490103741136884064212095202*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y); + return 1.2208540490103741136884064212095202*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y); } inline double leg_f33_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -.96516987137790443929991476509124903*b2*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y) + ((-.66355428657230930201869140100023374 + 1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y-.96516987137790443929991476509124903*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-.99533142985846395302803710150035059 + 2.8955096141337133178997442952737472*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + .96516987137790443929991476509124903*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*a)*a)*a; + return -.96516987137790443929991476509124903*b2*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y) + ((-.66355428657230930201869140100023374 + 1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y - .96516987137790443929991476509124903*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-.99533142985846395302803710150035059 + 2.8955096141337133178997442952737472*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + .96516987137790443929991476509124903*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*a)*a)*a; } inline double leg_f33_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 23.164076913069706543197954362189978*a*(-.34375000000000000000000000000000000 + (-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y); } inline double leg_f33_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y-1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + (-2.4129246784447610982497869127281226 + 3.8606794855116177571996590603649962*(7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y-.96516987137790443929991476509124903*(7.8750000000000000000000000000000000 + (56.250000000000000000000000000000000 + 61.875000000000000000000000000000000*y)*y)*b)*b + (-3.6193870176671416473746803690921840 + 5.7910192282674266357994885905474944*(7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y + .96516987137790443929991476509124903*(7.8750000000000000000000000000000000 + (56.250000000000000000000000000000000 + 61.875000000000000000000000000000000*y)*y)*a)*a)*a; + double b = 1.0 - y; + return (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y - 1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + (-2.4129246784447610982497869127281226 + 3.8606794855116177571996590603649962*(7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y - .96516987137790443929991476509124903*(7.8750000000000000000000000000000000 + (56.250000000000000000000000000000000 + 61.875000000000000000000000000000000*y)*y)*b)*b + (-3.6193870176671416473746803690921840 + 5.7910192282674266357994885905474944*(7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y + .96516987137790443929991476509124903*(7.8750000000000000000000000000000000 + (56.250000000000000000000000000000000 + 61.875000000000000000000000000000000*y)*y)*a)*a)*a; } inline double leg_f33_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y-1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-3.9813257194338558121121484060014024 + 11.582038456534853271598977181094989*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + 5.7910192282674266357994885905474944*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (-1.3271085731446186040373828020004674 + 3.8606794855116177571996590603649962*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y - 1.9303397427558088785998295301824982*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*b)*b + (-3.9813257194338558121121484060014024 + 11.582038456534853271598977181094989*(-.62500000000000000000000000000000000 + (3.9375000000000000000000000000000000 + (9.3750000000000000000000000000000000 + 5.1562500000000000000000000000000000*y)*y)*y)*y + 5.7910192282674266357994885905474944*(-.62500000000000000000000000000000000 + (7.8750000000000000000000000000000000 + (28.125000000000000000000000000000000 + 20.625000000000000000000000000000000*y)*y)*y)*a)*a; } // number 34 inline double leg_f34(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -5866,7 +5866,7 @@ namespace Hermes inline double leg_f34_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5876,48 +5876,48 @@ namespace Hermes inline double leg_f34_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-.36576554434386081824112622088898979-.62702664744661854555621637866683965*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + .15675666186165463638905409466670991*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b3 + (-1.8810799423398556366686491360005189*b2*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y) + ((1.0972966330315824547233786626669694 + 1.8810799423398556366686491360005189*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y-.94053997116992781833432456800025947*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (1.8288277217193040912056311044449490 + 3.1351332372330927277810818933341982*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + .78378330930827318194527047333354953*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*a)*a)*a)*a; + return (-.36576554434386081824112622088898979 - .62702664744661854555621637866683965*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + .15675666186165463638905409466670991*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b3 + (-1.8810799423398556366686491360005189*b2*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y) + ((1.0972966330315824547233786626669694 + 1.8810799423398556366686491360005189*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y - .94053997116992781833432456800025947*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (1.8288277217193040912056311044449490 + 3.1351332372330927277810818933341982*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + .78378330930827318194527047333354953*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*a)*a)*a)*a; } inline double leg_f34_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return .67031968203506862686507519221230759*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y); + return .67031968203506862686507519221230759*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y); } inline double leg_f34_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-5.9567531507428761827840555973349767-1.2540532948932370911124327573336793*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y + .15675666186165463638905409466670991*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*b)*b3 + ((4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y-3.7621598846797112733372982720010379*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + (17.870259452228628548352166792004930 + 3.7621598846797112733372982720010379*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y-.94053997116992781833432456800025947*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*b)*b + (29.783765753714380913920277986674883 + 6.2702664744661854555621637866683965*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y + .78378330930827318194527047333354953*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*a)*a)*a)*a; + return (-5.9567531507428761827840555973349767 - 1.2540532948932370911124327573336793*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y + .15675666186165463638905409466670991*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*b)*b3 + ((4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y - 3.7621598846797112733372982720010379*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + (17.870259452228628548352166792004930 + 3.7621598846797112733372982720010379*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y - .94053997116992781833432456800025947*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*b)*b + (29.783765753714380913920277986674883 + 6.2702664744661854555621637866683965*(17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y + .78378330930827318194527047333354953*(27.500000000000000000000000000000000*y + 17.500000000000000000000000000000000)*a)*a)*a)*a; } inline double leg_f34_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -3.7621598846797112733372982720010379*b2*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y) + ((4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y-3.7621598846797112733372982720010379*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (10.972966330315824547233786626669694 + 18.810799423398556366686491360005189*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + 6.2702664744661854555621637866683965*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*a)*a)*a; + return -3.7621598846797112733372982720010379*b2*(.58333333333333333333333333333333333 + (4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y) + ((4.3891865321263298188935146506678776 + 7.5243197693594225466745965440020758*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y - 3.7621598846797112733372982720010379*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*b)*b + (10.972966330315824547233786626669694 + 18.810799423398556366686491360005189*(4.7500000000000000000000000000000000 + (8.7500000000000000000000000000000000 + 4.5833333333333333333333333333333333*y)*y)*y + 6.2702664744661854555621637866683965*(4.7500000000000000000000000000000000 + (17.500000000000000000000000000000000 + 13.750000000000000000000000000000000*y)*y)*a)*a)*a; } // number 35 inline double leg_f35(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -5927,7 +5927,7 @@ namespace Hermes inline double leg_f35_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5938,18 +5938,18 @@ namespace Hermes inline double leg_f35_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .25543394004820110678174896037405033*b4*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((-1.7880375803374077474722427226183523-1.0217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .25543394004820110678174896037405033*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + (-2.5543394004820110678174896037405033*b2*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((2.9800626338956795791204045376972539 + 1.7028929336546740452116597358270022*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y-.85144646682733702260582986791350110*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (5.2151096093174392634607079409701943 + 2.9800626338956795791204045376972539*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .59601252677913591582408090753945079*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a)*a)*a)*a; + return .25543394004820110678174896037405033*b4*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((-1.7880375803374077474722427226183523 - 1.0217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .25543394004820110678174896037405033*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + (-2.5543394004820110678174896037405033*b2*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((2.9800626338956795791204045376972539 + 1.7028929336546740452116597358270022*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y - .85144646682733702260582986791350110*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (5.2151096093174392634607079409701943 + 2.9800626338956795791204045376972539*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .59601252677913591582408090753945079*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a)*a)*a)*a; } inline double leg_f35_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -5959,28 +5959,28 @@ namespace Hermes inline double leg_f35_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-3.5760751606748154949444854452367047-2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .51086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + ((-3.5760751606748154949444854452367047-2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + (-11.239093362120848698396954256458215*y-9.1956218417352398441429625734658122 + 1.4048866702651060872996192820572768*b)*b)*b2 + ((17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y-5.1086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + (18.731822270201414497328257094097024*y + 15.326036402892066406904937622443020-4.6829555675503536243320642735242559*b)*b + (32.780688972852475370324449914669793*y + 26.820563705061116212083640839275286 + 3.2780688972852475370324449914669793*a)*a)*a)*a)*a; + return (-3.5760751606748154949444854452367047 - 2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .51086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + ((-3.5760751606748154949444854452367047 - 2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + (-11.239093362120848698396954256458215*y - 9.1956218417352398441429625734658122 + 1.4048866702651060872996192820572768*b)*b)*b2 + ((17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y - 5.1086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + (18.731822270201414497328257094097024*y + 15.326036402892066406904937622443020 - 4.6829555675503536243320642735242559*b)*b + (32.780688972852475370324449914669793*y + 26.820563705061116212083640839275286 + 3.2780688972852475370324449914669793*a)*a)*a)*a)*a; } inline double leg_f35_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-3.5760751606748154949444854452367047-2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .51086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + (-10.217357601928044271269958414962013*b2*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y-5.1086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (41.720876874539514107685663527761555 + 23.840501071165436632963236301578031*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + 5.9601252677913591582408090753945079*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a)*a)*a; + return (-3.5760751606748154949444854452367047 - 2.0434715203856088542539916829924027*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + .51086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b3 + (-10.217357601928044271269958414962013*b2*(1.7500000000000000000000000000000000 + (4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y) + ((17.880375803374077474722427226183523 + 10.217357601928044271269958414962013*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y - 5.1086788009640221356349792074810066*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*b)*b + (41.720876874539514107685663527761555 + 23.840501071165436632963236301578031*(4.5000000000000000000000000000000000 + 2.7500000000000000000000000000000000*y)*y + 5.9601252677913591582408090753945079*(5.5000000000000000000000000000000000*y + 4.5000000000000000000000000000000000)*a)*a)*a)*a; } // number 36 inline double leg_f36(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -5991,7 +5991,7 @@ namespace Hermes inline double leg_f36_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6003,19 +6003,19 @@ namespace Hermes inline double leg_f36_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.12872301429969852374331755029475975 + .12872301429969852374331755029475975*y-.21453835716616420623886258382459958e-1*b)*b5 + (.64361507149849261871658775147379875*b4*(1. + y) + ((-1.2872301429969852374331755029475975-1.2872301429969852374331755029475975*y + .32180753574924630935829387573689937*b)*b3 + (-3.0035370003262988873440761735443942*b2*(1. + y) + ((1.5017685001631494436720380867721971 + 1.5017685001631494436720380867721971*y-.75088425008157472183601904338609854*b)*b + (2.7031833002936689986096685561899547 + 2.7031833002936689986096685561899547*y + .45053055004894483310161142603165912*a)*a)*a)*a)*a)*a; + return (.12872301429969852374331755029475975 + .12872301429969852374331755029475975*y - .21453835716616420623886258382459958e-1 * b)*b5 + (.64361507149849261871658775147379875*b4*(1. + y) + ((-1.2872301429969852374331755029475975 - 1.2872301429969852374331755029475975*y + .32180753574924630935829387573689937*b)*b3 + (-3.0035370003262988873440761735443942*b2*(1. + y) + ((1.5017685001631494436720380867721971 + 1.5017685001631494436720380867721971*y - .75088425008157472183601904338609854*b)*b + (2.7031833002936689986096685561899547 + 2.7031833002936689986096685561899547*y + .45053055004894483310161142603165912*a)*a)*a)*a)*a)*a; } inline double leg_f36_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6027,25 +6027,25 @@ namespace Hermes inline double leg_f36_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return .25744602859939704748663510058951950*b5 + ((-5.1489205719879409497327020117903900-5.1489205719879409497327020117903900*y + 1.2872301429969852374331755029475975*b)*b3 + ((-5.1489205719879409497327020117903900-5.1489205719879409497327020117903900*y-2.5744602859939704748663510058951950*b)*b2 + ((12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y-6.0070740006525977746881523470887883*b)*b + (12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y + 3.0035370003262988873440761735443942*b + 5.4063666005873379972193371123799095*a)*a)*a)*a)*a; + return .25744602859939704748663510058951950*b5 + ((-5.1489205719879409497327020117903900 - 5.1489205719879409497327020117903900*y + 1.2872301429969852374331755029475975*b)*b3 + ((-5.1489205719879409497327020117903900 - 5.1489205719879409497327020117903900*y - 2.5744602859939704748663510058951950*b)*b2 + ((12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y - 6.0070740006525977746881523470887883*b)*b + (12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y + 3.0035370003262988873440761735443942*b + 5.4063666005873379972193371123799095*a)*a)*a)*a)*a; } inline double leg_f36_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return 1.2872301429969852374331755029475975*b4*(1. + y) + ((-5.1489205719879409497327020117903900-5.1489205719879409497327020117903900*y + 1.2872301429969852374331755029475975*b)*b3 + (-18.021222001957793324064457041266365*b2*(1. + y) + ((12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y-6.0070740006525977746881523470887883*b)*b + (27.031833002936689986096685561899547 + 27.031833002936689986096685561899547*y + 5.4063666005873379972193371123799095*a)*a)*a)*a)*a; + return 1.2872301429969852374331755029475975*b4*(1. + y) + ((-5.1489205719879409497327020117903900 - 5.1489205719879409497327020117903900*y + 1.2872301429969852374331755029475975*b)*b3 + (-18.021222001957793324064457041266365*b2*(1. + y) + ((12.014148001305195549376304694177577 + 12.014148001305195549376304694177577*y - 6.0070740006525977746881523470887883*b)*b + (27.031833002936689986096685561899547 + 27.031833002936689986096685561899547*y + 5.4063666005873379972193371123799095*a)*a)*a)*a)*a; } // ORDER 8 @@ -6056,19 +6056,19 @@ namespace Hermes inline double leg_f37(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return .41787914848721779896314222930969401e-3*b8 + (-.11700616157642098370967982420671432e-1*b6 + (.52652772709389442669355920893021445e-1*b4 + (-.77224066640437849248388683976431453e-1*b2 + .35854030940203287151037603274771746e-1*a2)*a2)*a2)*a2; + return .41787914848721779896314222930969401e-3 * b8 + (-.11700616157642098370967982420671432e-1 * b6 + (.52652772709389442669355920893021445e-1 * b4 + (-.77224066640437849248388683976431453e-1 * b2 + .35854030940203287151037603274771746e-1 * a2)*a2)*a2)*a2; } inline double leg_f37_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6076,13 +6076,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-.46802464630568393483871929682685729e-1*b6 + (.42122218167511554135484736714417156*b4 + (-.92668879968525419098066420771717743*b2 + .57366449504325259441660165239634793*a2)*a2)*a2)*a; + return (-.46802464630568393483871929682685729e-1 * b6 + (.42122218167511554135484736714417156*b4 + (-.92668879968525419098066420771717743*b2 + .57366449504325259441660165239634793*a2)*a2)*a2)*a; } inline double leg_f37_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6090,26 +6090,26 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.33430331878977423917051378344775521e-2*b7 + (-.23401232315284196741935964841342864e-1*b6 + (.70203696945852590225807894524028593e-1*b5 + (.21061109083755777067742368357208578*b4 + (-.21061109083755777067742368357208578*b3 + (-.46334439984262709549033210385858872*b2 + (.15444813328087569849677736795286291*b + .28683224752162629720830082619817397*a)*a)*a)*a)*a)*a)*a; + return -.33430331878977423917051378344775521e-2 * b7 + (-.23401232315284196741935964841342864e-1 * b6 + (.70203696945852590225807894524028593e-1 * b5 + (.21061109083755777067742368357208578*b4 + (-.21061109083755777067742368357208578*b3 + (-.46334439984262709549033210385858872*b2 + (.15444813328087569849677736795286291*b + .28683224752162629720830082619817397*a)*a)*a)*a)*a)*a)*a; } inline double leg_f37_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.93604929261136786967743859365371458e-1*b6 + (2.5273330900506932481290842028650294*b4 + (-9.2668879968525419098066420771717743*b2 + 8.0313029306055363218324231335488711*a2)*a2)*a2; + return -.93604929261136786967743859365371458e-1 * b6 + (2.5273330900506932481290842028650294*b4 + (-9.2668879968525419098066420771717743*b2 + 8.0313029306055363218324231335488711*a2)*a2)*a2; } inline double leg_f37_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6122,33 +6122,33 @@ namespace Hermes inline double leg_f37_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.46802464630568393483871929682685729e-1*b6 + (.28081478778341036090323157809611437*b5 + (1.2636665450253466240645421014325147*b4 + (-1.6848887267004621654193894685766862*b3 + (-4.6334439984262709549033210385858872*b2 + (1.8533775993705083819613284154343549*b + 4.0156514653027681609162115667744355*a)*a)*a)*a)*a)*a; + return -.46802464630568393483871929682685729e-1 * b6 + (.28081478778341036090323157809611437*b5 + (1.2636665450253466240645421014325147*b4 + (-1.6848887267004621654193894685766862*b3 + (-4.6334439984262709549033210385858872*b2 + (1.8533775993705083819613284154343549*b + 4.0156514653027681609162115667744355*a)*a)*a)*a)*a)*a; } // number 38 inline double leg_f38(double x, double y) { double y2 = y*y; - return -.21395412402545551306912882140656333e-1*(x + 1.)*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); + return -.21395412402545551306912882140656333e-1 * (x + 1.)*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); } inline double leg_f38_dx(double x, double y) { double y2 = y*y; - return -.21395412402545551306912882140656333e-1*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); + return -.21395412402545551306912882140656333e-1 * (-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); } inline double leg_f38_dy(double x, double y) { double y2 = y*y; - return -.21395412402545551306912882140656333e-1*(x + 1.)*(-5. + (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y); + return -.21395412402545551306912882140656333e-1 * (x + 1.)*(-5. + (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y); } inline double leg_f38_dxx(double x, double y) @@ -6163,26 +6163,26 @@ namespace Hermes inline double leg_f38_dxy(double x, double y) { - return .10697706201272775653456441070328166-.21395412402545551306912882140656333e-1*(270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y; + return .10697706201272775653456441070328166 - .21395412402545551306912882140656333e-1 * (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y; } // number 39 inline double leg_f39(double x, double y) { double y2 = y*y; - return .21395412402545551306912882140656333e-1*(x + y)*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); + return .21395412402545551306912882140656333e-1 * (x + y)*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); } inline double leg_f39_dx(double x, double y) { double y2 = y*y; - return .21395412402545551306912882140656333e-1*(-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); + return .21395412402545551306912882140656333e-1 * (-5. + (135. + (-495. + 429.*y2)*y2)*y2)*(1. + y); } inline double leg_f39_dy(double x, double y) { double y2 = y*y; - return -.10697706201272775653456441070328166 + .21395412402545551306912882140656333e-1*(-10. + (405. + (540. + (-2475. + (-2970. + (3003. + 3432.*y)*y)*y)*y)*y)*y)*y + .21395412402545551306912882140656333e-1*(-5. + (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y)*x; + return -.10697706201272775653456441070328166 + .21395412402545551306912882140656333e-1 * (-10. + (405. + (540. + (-2475. + (-2970. + (3003. + 3432.*y)*y)*y)*y)*y)*y)*y + .21395412402545551306912882140656333e-1 * (-5. + (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y)*x; } inline double leg_f39_dxx(double x, double y) @@ -6192,12 +6192,12 @@ namespace Hermes inline double leg_f39_dyy(double x, double y) { - return -.21395412402545551306912882140656333 + .42790824805091102613825764281312666e-1*(405. + (810. + (-4950. + (-7425. + (9009. + 12012.*y)*y)*y)*y)*y)*y + .42790824805091102613825764281312666e-1*(135. + (405. + (-2970. + (-4950. + (6435. + 9009.*y)*y)*y)*y)*y)*x; + return -.21395412402545551306912882140656333 + .42790824805091102613825764281312666e-1 * (405. + (810. + (-4950. + (-7425. + (9009. + 12012.*y)*y)*y)*y)*y)*y + .42790824805091102613825764281312666e-1 * (135. + (405. + (-2970. + (-4950. + (6435. + 9009.*y)*y)*y)*y)*y)*x; } inline double leg_f39_dxy(double x, double y) { - return -.10697706201272775653456441070328166 + .21395412402545551306912882140656333e-1*(270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y; + return -.10697706201272775653456441070328166 + .21395412402545551306912882140656333e-1 * (270. + (405. + (-1980. + (-2475. + (2574. + 3003.*y)*y)*y)*y)*y)*y; } // Bubble functions, order 8 @@ -6206,44 +6206,44 @@ namespace Hermes inline double leg_f40(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.6233099319400270136250045367308206*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(.78125000000000000000000000000000000e-1 + (.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y); + return 1.6233099319400270136250045367308206*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(.78125000000000000000000000000000000e-1 + (.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y); } inline double leg_f40_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 3.9762810276451551143588958519087301*a*(.78125000000000000000000000000000000e-1 + (.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y); } inline double leg_f40_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.15532347764238887165464436921518476 + 1.9881405138225775571794479259543650*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y-.99407025691128877858972396297718251*(.78125000000000000000000000000000000 + (-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (.15532347764238887165464436921518476 + 1.9881405138225775571794479259543650*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y + .99407025691128877858972396297718251*(.78125000000000000000000000000000000 + (-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (.15532347764238887165464436921518476 + 1.9881405138225775571794479259543650*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y - .99407025691128877858972396297718251*(.78125000000000000000000000000000000 + (-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (.15532347764238887165464436921518476 + 1.9881405138225775571794479259543650*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y + .99407025691128877858972396297718251*(.78125000000000000000000000000000000 + (-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; } inline double leg_f40_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .62129391056955548661857747686073905 + 7.9525620552903102287177917038174600*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y; } inline double leg_f40_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (3.1064695528477774330928873843036954 + 3.9762810276451551143588958519087301*(-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y-.99407025691128877858972396297718251*(-1.4062500000000000000000000000000000 + (-39.375000000000000000000000000000000 + (-30.937500000000000000000000000000000 + (185.62500000000000000000000000000000 + 201.09375000000000000000000000000000*y)*y)*y)*y)*b)*b + (3.1064695528477774330928873843036954 + 3.9762810276451551143588958519087301*(-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y + .99407025691128877858972396297718251*(-1.4062500000000000000000000000000000 + (-39.375000000000000000000000000000000 + (-30.937500000000000000000000000000000 + (185.62500000000000000000000000000000 + 201.09375000000000000000000000000000*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (3.1064695528477774330928873843036954 + 3.9762810276451551143588958519087301*(-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y - .99407025691128877858972396297718251*(-1.4062500000000000000000000000000000 + (-39.375000000000000000000000000000000 + (-30.937500000000000000000000000000000 + (185.62500000000000000000000000000000 + 201.09375000000000000000000000000000*y)*y)*y)*y)*b)*b + (3.1064695528477774330928873843036954 + 3.9762810276451551143588958519087301*(-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y + .99407025691128877858972396297718251*(-1.4062500000000000000000000000000000 + (-39.375000000000000000000000000000000 + (-30.937500000000000000000000000000000 + (185.62500000000000000000000000000000 + 201.09375000000000000000000000000000*y)*y)*y)*y)*a)*a; } inline double leg_f40_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return .31064695528477774330928873843036954 + 3.9762810276451551143588958519087301*(.78125000000000000000000000000000000 + (-.70312500000000000000000000000000000 + (-6.5625000000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (9.2812500000000000000000000000000000 + 6.7031250000000000000000000000000000*y)*y)*y)*y)*y)*y + 3.9762810276451551143588958519087301*(.78125000000000000000000000000000000 + (-1.4062500000000000000000000000000000 + (-19.687500000000000000000000000000000 + (-10.312500000000000000000000000000000 + (46.406250000000000000000000000000000 + 40.218750000000000000000000000000000*y)*y)*y)*y)*y)*a; } @@ -6251,7 +6251,7 @@ namespace Hermes inline double leg_f41(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return 1.4187993420613458492725943245537961*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y); @@ -6260,47 +6260,47 @@ namespace Hermes inline double leg_f41_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.4187993420613458492725943245537961*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y); + return 1.4187993420613458492725943245537961*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y); } inline double leg_f41_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -1.1216593659155472035363028403674680*b2*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y) + ((-.14020742073944340044203785504593349 + 2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y-1.1216593659155472035363028403674680*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.21031113110916510066305678256890025 + 3.3649780977466416106089085211024040*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + 1.1216593659155472035363028403674680*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; + return -1.1216593659155472035363028403674680*b2*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y) + ((-.14020742073944340044203785504593349 + 2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y - 1.1216593659155472035363028403674680*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.21031113110916510066305678256890025 + 3.3649780977466416106089085211024040*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + 1.1216593659155472035363028403674680*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; } inline double leg_f41_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 26.919824781973132884871268168819232*a*(-.62500000000000000000000000000000000e-1 + (-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y); } inline double leg_f41_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y-2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + (-8.1320304028877172256381955926641427 + 4.4866374636621888141452113614698719*(-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y-1.1216593659155472035363028403674680*(-6.2500000000000000000000000000000000 + (41.250000000000000000000000000000000 + (206.25000000000000000000000000000000 + 178.75000000000000000000000000000000*y)*y)*y)*b)*b + (-12.198045604331575838457293388996214 + 6.7299561954932832212178170422048078*(-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y + 1.1216593659155472035363028403674680*(-6.2500000000000000000000000000000000 + (41.250000000000000000000000000000000 + (206.25000000000000000000000000000000 + 178.75000000000000000000000000000000*y)*y)*y)*a)*a)*a; + double b = 1.0 - y; + return (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y - 2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + (-8.1320304028877172256381955926641427 + 4.4866374636621888141452113614698719*(-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y - 1.1216593659155472035363028403674680*(-6.2500000000000000000000000000000000 + (41.250000000000000000000000000000000 + (206.25000000000000000000000000000000 + 178.75000000000000000000000000000000*y)*y)*y)*b)*b + (-12.198045604331575838457293388996214 + 6.7299561954932832212178170422048078*(-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y + 1.1216593659155472035363028403674680*(-6.2500000000000000000000000000000000 + (41.250000000000000000000000000000000 + (206.25000000000000000000000000000000 + 178.75000000000000000000000000000000*y)*y)*y)*a)*a)*a; } inline double leg_f41_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y-2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.84124452443666040265222713027560098 + 13.459912390986566442435634084409616*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + 6.7299561954932832212178170422048078*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (-.28041484147888680088407571009186700 + 4.4866374636621888141452113614698719*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y - 2.2433187318310944070726056807349359*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-.84124452443666040265222713027560098 + 13.459912390986566442435634084409616*(-1.8125000000000000000000000000000000 + (-3.1250000000000000000000000000000000 + (6.8750000000000000000000000000000000 + (17.187500000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y)*y + 6.7299561954932832212178170422048078*(-1.8125000000000000000000000000000000 + (-6.2500000000000000000000000000000000 + (20.625000000000000000000000000000000 + (68.750000000000000000000000000000000 + 44.687500000000000000000000000000000*y)*y)*y)*y)*a)*a; } // number 42 inline double leg_f42(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -6310,7 +6310,7 @@ namespace Hermes inline double leg_f42_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6320,48 +6320,48 @@ namespace Hermes inline double leg_f42_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (.24246526978786345616698149680517773-.77588886332116305973434078977656874*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + .19397221583029076493358519744414218*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b3 + (-2.3276665899634891792030223693297061*b2*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y) + ((-.72739580936359036850094449041553317 + 2.3276665899634891792030223693297061*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y-1.1638332949817445896015111846648531*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-1.2123263489393172808349074840258886 + 3.8794443166058152986717039488828435*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + .96986107915145382466792598722071090*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; + return (.24246526978786345616698149680517773 - .77588886332116305973434078977656874*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + .19397221583029076493358519744414218*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b3 + (-2.3276665899634891792030223693297061*b2*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y) + ((-.72739580936359036850094449041553317 + 2.3276665899634891792030223693297061*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y - 1.1638332949817445896015111846648531*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-1.2123263489393172808349074840258886 + 3.8794443166058152986717039488828435*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + .96986107915145382466792598722071090*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; } inline double leg_f42_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return .82946008478893335842946748358641783*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y); + return .82946008478893335842946748358641783*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y); } inline double leg_f42_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-2.7156110216240707090701927642179905-1.5517777266423261194686815795531374*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y + .19397221583029076493358519744414218*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*b)*b3 + ((-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y-4.6553331799269783584060447386594123*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + (8.1468330648722121272105782926539716 + 4.6553331799269783584060447386594123*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y-1.1638332949817445896015111846648531*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*b)*b + (13.578055108120353545350963821089953 + 7.7588886332116305973434078977656874*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y + .96986107915145382466792598722071090*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*a)*a)*a)*a; + return (-2.7156110216240707090701927642179905 - 1.5517777266423261194686815795531374*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y + .19397221583029076493358519744414218*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*b)*b3 + ((-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y - 4.6553331799269783584060447386594123*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + (8.1468330648722121272105782926539716 + 4.6553331799269783584060447386594123*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y - 1.1638332949817445896015111846648531*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*b)*b + (13.578055108120353545350963821089953 + 7.7588886332116305973434078977656874*(24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y + .96986107915145382466792598722071090*(24.750000000000000000000000000000000 + (115.50000000000000000000000000000000 + 107.25000000000000000000000000000000*y)*y)*a)*a)*a)*a; } inline double leg_f42_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -4.6553331799269783584060447386594123*b2*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y) + ((-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y-4.6553331799269783584060447386594123*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-7.2739580936359036850094449041553317 + 23.276665899634891792030223693297061*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + 7.7588886332116305973434078977656874*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*a)*a)*a; + return -4.6553331799269783584060447386594123*b2*(-.31250000000000000000000000000000000 + (1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y) + ((-2.9095832374543614740037779616621327 + 9.3106663598539567168120894773188247*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y - 4.6553331799269783584060447386594123*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*b)*b + (-7.2739580936359036850094449041553317 + 23.276665899634891792030223693297061*(1.7500000000000000000000000000000000 + (12.375000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.9375000000000000000000000000000000*y)*y)*y)*y + 7.7588886332116305973434078977656874*(1.7500000000000000000000000000000000 + (24.750000000000000000000000000000000 + (57.750000000000000000000000000000000 + 35.750000000000000000000000000000000*y)*y)*y)*a)*a)*a; } // number 43 inline double leg_f43(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -6371,7 +6371,7 @@ namespace Hermes inline double leg_f43_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6382,18 +6382,18 @@ namespace Hermes inline double leg_f43_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .33292808027579391902410751141834787*b4*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((-1.9975684816547635141446450685100873-1.3317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .33292808027579391902410751141834787*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + (-3.3292808027579391902410751141834787*b2*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((3.3292808027579391902410751141834788 + 2.2195205351719594601607167427889859*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y-1.1097602675859797300803583713944929*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (5.8262414048263935829218814498210879 + 3.8841609365509290552812542998807252*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .77683218731018581105625085997614505*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; + return .33292808027579391902410751141834787*b4*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((-1.9975684816547635141446450685100873 - 1.3317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .33292808027579391902410751141834787*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + (-3.3292808027579391902410751141834787*b2*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((3.3292808027579391902410751141834788 + 2.2195205351719594601607167427889859*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y - 1.1097602675859797300803583713944929*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (5.8262414048263935829218814498210879 + 3.8841609365509290552812542998807252*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .77683218731018581105625085997614505*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; } inline double leg_f43_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6403,28 +6403,28 @@ namespace Hermes inline double leg_f43_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-3.9951369633095270282892901370201747-2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .66585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + ((-3.9951369633095270282892901370201747-2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + (-22.639109458753986493639310776447656-2.6634246422063513521928600913467831*(27. + 19.500000000000000000000000000000000*y)*y + .33292808027579391902410751141834787*(39.*y + 27.)*b)*b)*b2 + ((19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y-6.6585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + (37.731849097923310822732184627412759 + 4.4390410703439189203214334855779718*(27. + 19.500000000000000000000000000000000*y)*y-1.1097602675859797300803583713944929*(39.*y + 27.)*b)*b + (66.030735921365793939781323097972327 + 7.7683218731018581105625085997614505*(27. + 19.500000000000000000000000000000000*y)*y + .77683218731018581105625085997614505*(39.*y + 27.)*a)*a)*a)*a)*a; + return (-3.9951369633095270282892901370201747 - 2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .66585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + ((-3.9951369633095270282892901370201747 - 2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + (-22.639109458753986493639310776447656 - 2.6634246422063513521928600913467831*(27. + 19.500000000000000000000000000000000*y)*y + .33292808027579391902410751141834787*(39.*y + 27.)*b)*b)*b2 + ((19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y - 6.6585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + (37.731849097923310822732184627412759 + 4.4390410703439189203214334855779718*(27. + 19.500000000000000000000000000000000*y)*y - 1.1097602675859797300803583713944929*(39.*y + 27.)*b)*b + (66.030735921365793939781323097972327 + 7.7683218731018581105625085997614505*(27. + 19.500000000000000000000000000000000*y)*y + .77683218731018581105625085997614505*(39.*y + 27.)*a)*a)*a)*a)*a; } inline double leg_f43_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-3.9951369633095270282892901370201747-2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .66585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + (-13.317123211031756760964300456733915*b2*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y-6.6585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (46.609931238611148663375051598568703 + 31.073287492407432442250034399045802*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + 7.7683218731018581105625085997614505*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*a)*a)*a)*a; + return (-3.9951369633095270282892901370201747 - 2.6634246422063513521928600913467831*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + .66585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b3 + (-13.317123211031756760964300456733915*b2*(1.5000000000000000000000000000000000 + (8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y) + ((19.975684816547635141446450685100873 + 13.317123211031756760964300456733915*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y - 6.6585616055158783804821502283669576*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*b)*b + (46.609931238611148663375051598568703 + 31.073287492407432442250034399045802*(8.5000000000000000000000000000000000 + (13.500000000000000000000000000000000 + 6.5000000000000000000000000000000000*y)*y)*y + 7.7683218731018581105625085997614505*(8.5000000000000000000000000000000000 + (27. + 19.500000000000000000000000000000000*y)*y)*a)*a)*a)*a; } // number 44 inline double leg_f44(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -6435,7 +6435,7 @@ namespace Hermes inline double leg_f44_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6447,19 +6447,19 @@ namespace Hermes inline double leg_f44_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.39148713351102899664245105172126804 + .17399428156045733184108935632056358*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y-.28999046926742888640181559386760596e-1*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b5 + (.86997140780228665920544678160281788*b4*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((-3.9148713351102899664245105172126804-1.7399428156045733184108935632056358*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + .43498570390114332960272339080140894*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + (-4.0598665697440044096254183141464834*b2*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((4.5673498909620049608285956034147938 + 2.0299332848720022048127091570732417*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y-1.0149666424360011024063545785366209*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (8.2212298037316089294914720861466287 + 3.6538799127696039686628764827318351*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + .60897998546160066144381274712197252*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a; + return (.39148713351102899664245105172126804 + .17399428156045733184108935632056358*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y - .28999046926742888640181559386760596e-1 * (6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b5 + (.86997140780228665920544678160281788*b4*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((-3.9148713351102899664245105172126804 - 1.7399428156045733184108935632056358*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + .43498570390114332960272339080140894*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + (-4.0598665697440044096254183141464834*b2*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((4.5673498909620049608285956034147938 + 2.0299332848720022048127091570732417*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y - 1.0149666424360011024063545785366209*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (8.2212298037316089294914720861466287 + 3.6538799127696039686628764827318351*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + .60897998546160066144381274712197252*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a; } inline double leg_f44_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6471,99 +6471,99 @@ namespace Hermes inline double leg_f44_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (2.2619256602859453139341616321673265*y + 1.9139370971650306502519829195261993-.18849380502382877616118013601394388*b)*b5 + ((-15.659485340441159865698042068850722-6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 1.7399428156045733184108935632056358*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + ((-15.659485340441159865698042068850722-6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + (-22.619256602859453139341616321673265*y-19.139370971650306502519829195261993 + 2.8274070753574316424177020402091581*b)*b)*b2 + ((36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y-8.1197331394880088192508366282929670*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + (26.389132703336028662565219041952143*y + 22.329266133592024252939800727805659-6.5972831758340071656413047604880354*b)*b + (47.500438866004851592617394275513857*y + 40.192679040465643655291641310050186 + 3.9583699055004042993847828562928213*a)*a)*a)*a)*a)*a; + return (2.2619256602859453139341616321673265*y + 1.9139370971650306502519829195261993 - .18849380502382877616118013601394388*b)*b5 + ((-15.659485340441159865698042068850722 - 6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 1.7399428156045733184108935632056358*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + ((-15.659485340441159865698042068850722 - 6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + (-22.619256602859453139341616321673265*y - 19.139370971650306502519829195261993 + 2.8274070753574316424177020402091581*b)*b)*b2 + ((36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y - 8.1197331394880088192508366282929670*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + (26.389132703336028662565219041952143*y + 22.329266133592024252939800727805659 - 6.5972831758340071656413047604880354*b)*b + (47.500438866004851592617394275513857*y + 40.192679040465643655291641310050186 + 3.9583699055004042993847828562928213*a)*a)*a)*a)*a)*a; } inline double leg_f44_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return 1.7399428156045733184108935632056358*b4*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((-15.659485340441159865698042068850722-6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 1.7399428156045733184108935632056358*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + (-24.359199418464026457752509884878900*b2*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y-8.1197331394880088192508366282929670*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (82.212298037316089294914720861466287 + 36.538799127696039686628764827318351*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 7.3077598255392079373257529654636703*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*a)*a)*a)*a)*a; + return 1.7399428156045733184108935632056358*b4*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((-15.659485340441159865698042068850722 - 6.9597712624182932736435742528225433*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 1.7399428156045733184108935632056358*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b3 + (-24.359199418464026457752509884878900*b2*(2.2500000000000000000000000000000000 + (5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y) + ((36.538799127696039686628764827318350 + 16.239466278976017638501673256585934*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y - 8.1197331394880088192508366282929670*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*b)*b + (82.212298037316089294914720861466287 + 36.538799127696039686628764827318351*(5.5000000000000000000000000000000000 + 3.2500000000000000000000000000000000*y)*y + 7.3077598255392079373257529654636703*(6.5000000000000000000000000000000000*y + 5.5000000000000000000000000000000000)*a)*a)*a)*a)*a; } // number 45 inline double leg_f45(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; - return .91069207987015857989057523397342891e-1*(-.79672179899887262969191001703480969*b6 + (5.5770525929921084078433701192436678*b4 + (-10.038694667385795134118066214638602*b2 + 5.2583638733925593559666061124297439*a2)*a2)*a2)*a*(1. + y); + return .91069207987015857989057523397342891e-1 * (-.79672179899887262969191001703480969*b6 + (5.5770525929921084078433701192436678*b4 + (-10.038694667385795134118066214638602*b2 + 5.2583638733925593559666061124297439*a2)*a2)*a2)*a*(1. + y); } inline double leg_f45_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return .91069207987015857989057523397342891e-1*(-1.5934435979977452593838200340696194*b6 + (33.462315557952650447060220715462007*b4 + (-100.38694667385795134118066214638602*b2 + 73.617094227495830983532485574016415*a2)*a2)*a2)*(1. + y); + return .91069207987015857989057523397342891e-1 * (-1.5934435979977452593838200340696194*b6 + (33.462315557952650447060220715462007*b4 + (-100.38694667385795134118066214638602*b2 + 73.617094227495830983532485574016415*a2)*a2)*a2)*(1. + y); } inline double leg_f45_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.72556823220817774297504599550421409e-1*b6*(1. + y) + ((.43534093932490664578502759730252845 + .43534093932490664578502759730252845*y-.72556823220817774297504599550421409e-1*b)*b5 + (1.5236932876371732602475965905588496*b4*(1. + y) + ((-2.0315910501828976803301287874117995-2.0315910501828976803301287874117995*y + .50789776254572442008253219685294985*b)*b3 + (-4.5710798629115197807427897716765487*b2*(1. + y) + ((1.8284319451646079122971159086706195 + 1.8284319451646079122971159086706195*y-.91421597258230395614855795433530975*b)*b + (3.3521252328017811725447124992294690 + 3.3521252328017811725447124992294690*y + .47887503325739731036353035703278130*a)*a)*a)*a)*a)*a)*a; + return -.72556823220817774297504599550421409e-1 * b6*(1. + y) + ((.43534093932490664578502759730252845 + .43534093932490664578502759730252845*y - .72556823220817774297504599550421409e-1 * b)*b5 + (1.5236932876371732602475965905588496*b4*(1. + y) + ((-2.0315910501828976803301287874117995 - 2.0315910501828976803301287874117995*y + .50789776254572442008253219685294985*b)*b3 + (-4.5710798629115197807427897716765487*b2*(1. + y) + ((1.8284319451646079122971159086706195 + 1.8284319451646079122971159086706195*y - .91421597258230395614855795433530975*b)*b + (3.3521252328017811725447124992294690 + 3.3521252328017811725447124992294690*y + .47887503325739731036353035703278130*a)*a)*a)*a)*a)*a)*a; } inline double leg_f45_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return .91069207987015857989057523397342891e-1*(133.84926223181060178824088286184803*b4 + (-803.09557339086361072944529717108816*b2 + 883.40513072994997180238982688819698*a2)*a2)*a*(1. + y); + return .91069207987015857989057523397342891e-1 * (133.84926223181060178824088286184803*b4 + (-803.09557339086361072944529717108816*b2 + 883.40513072994997180238982688819698*a2)*a2)*a*(1. + y); } inline double leg_f45_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y-.14511364644163554859500919910084282*b)*b5 + ((.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y + .87068187864981329157005519460505690*b)*b4 + ((-12.189546301097386081980772724470796-12.189546301097386081980772724470796*y + 3.0473865752743465204951931811176992*b)*b3 + ((-12.189546301097386081980772724470796-12.189546301097386081980772724470796*y-4.0631821003657953606602575748235988*b)*b2 + ((18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y-9.1421597258230395614855795433530975*b)*b + (18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y + 3.6568638903292158245942318173412390*b + 6.7042504656035623450894249984589381*a)*a)*a)*a)*a)*a; + return (.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y - .14511364644163554859500919910084282*b)*b5 + ((.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y + .87068187864981329157005519460505690*b)*b4 + ((-12.189546301097386081980772724470796 - 12.189546301097386081980772724470796*y + 3.0473865752743465204951931811176992*b)*b3 + ((-12.189546301097386081980772724470796 - 12.189546301097386081980772724470796*y - 4.0631821003657953606602575748235988*b)*b2 + ((18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y - 9.1421597258230395614855795433530975*b)*b + (18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y + 3.6568638903292158245942318173412390*b + 6.7042504656035623450894249984589381*a)*a)*a)*a)*a)*a; } inline double leg_f45_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y-.14511364644163554859500919910084282*b)*b5 + (6.0947731505486930409903863622353983*b4*(1. + y) + ((-12.189546301097386081980772724470796-12.189546301097386081980772724470796*y + 3.0473865752743465204951931811176992*b)*b3 + (-36.568638903292158245942318173412390*b2*(1. + y) + ((18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y-9.1421597258230395614855795433530975*b)*b + (40.225502793621374070536549990753629 + 40.225502793621374070536549990753629*y + 6.7042504656035623450894249984589381*a)*a)*a)*a)*a)*a; + return (.87068187864981329157005519460505690 + .87068187864981329157005519460505690*y - .14511364644163554859500919910084282*b)*b5 + (6.0947731505486930409903863622353983*b4*(1. + y) + ((-12.189546301097386081980772724470796 - 12.189546301097386081980772724470796*y + 3.0473865752743465204951931811176992*b)*b3 + (-36.568638903292158245942318173412390*b2*(1. + y) + ((18.284319451646079122971159086706195 + 18.284319451646079122971159086706195*y - 9.1421597258230395614855795433530975*b)*b + (40.225502793621374070536549990753629 + 40.225502793621374070536549990753629*y + 6.7042504656035623450894249984589381*a)*a)*a)*a)*a)*a; } // ORDER 9 @@ -6574,13 +6574,13 @@ namespace Hermes inline double leg_f46_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return (.15570321374480096167037609154822953e-2*b8 + (-.18684385649376115400445130985787544e-1*b6 + (.61658472642941180821468932253098894e-1*b4 + (-.76339061367450985778961535170503392e-1*b2 + .31807942236437910741233972987709747e-1*a2)*a2)*a2)*a2)*a; + return (.15570321374480096167037609154822953e-2 * b8 + (-.18684385649376115400445130985787544e-1 * b6 + (.61658472642941180821468932253098894e-1 * b4 + (-.76339061367450985778961535170503392e-1 * b2 + .31807942236437910741233972987709747e-1 * a2)*a2)*a2)*a2)*a; } inline double leg_f46_1(double x, double y) @@ -6591,7 +6591,7 @@ namespace Hermes inline double leg_f46_dx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6600,7 +6600,7 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .31140642748960192334075218309645906e-2*b8 + (-.11210631389625669240267078591472526*b6 + (.61658472642941180821468932253098894*b4 + (-1.0687468591443138009054614923870475*b2 + .57254296025588239334221151377877544*a2)*a2)*a2)*a2; + return .31140642748960192334075218309645906e-2 * b8 + (-.11210631389625669240267078591472526*b6 + (.61658472642941180821468932253098894*b4 + (-1.0687468591443138009054614923870475*b2 + .57254296025588239334221151377877544*a2)*a2)*a2)*a2; } inline double leg_f46_dx_1(double x, double y) @@ -6611,7 +6611,7 @@ namespace Hermes inline double leg_f46_dy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6620,7 +6620,7 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .15570321374480096167037609154822953e-2*b8 + (-.12456257099584076933630087323858362e-1*b7 + (-.56053156948128346201335392957362631e-1*b6 + (.11210631389625669240267078591472526*b5 + (.30829236321470590410734466126549447*b4 + (-.24663389057176472328587572901239557*b3 + (-.53437342957215690045273074619352374*b2 + (.15267812273490197155792307034100678*b + .28627148012794119667110575688938772*a)*a)*a)*a)*a)*a)*a)*a; + return .15570321374480096167037609154822953e-2 * b8 + (-.12456257099584076933630087323858362e-1 * b7 + (-.56053156948128346201335392957362631e-1 * b6 + (.11210631389625669240267078591472526*b5 + (.30829236321470590410734466126549447*b4 + (-.24663389057176472328587572901239557*b3 + (-.53437342957215690045273074619352374*b2 + (.15267812273490197155792307034100678*b + .28627148012794119667110575688938772*a)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f46_dy_1(double x, double y) @@ -6631,7 +6631,7 @@ namespace Hermes inline double leg_f46_dxx_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6650,7 +6650,7 @@ namespace Hermes inline double leg_f46_dyy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6658,7 +6658,7 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.24912514199168153867260174647716725e-1*b7 + (-.24912514199168153867260174647716725e-1*b6 + (.67263788337754015441602471548835157*b5 + (.67263788337754015441602471548835157*b4 + (-2.4663389057176472328587572901239557*b3 + (-2.4663389057176472328587572901239557*b2 + (2.1374937182886276018109229847740950*b + 2.1374937182886276018109229847740950*a)*a)*a)*a)*a)*a)*a; + return -.24912514199168153867260174647716725e-1 * b7 + (-.24912514199168153867260174647716725e-1 * b6 + (.67263788337754015441602471548835157*b5 + (.67263788337754015441602471548835157*b4 + (-2.4663389057176472328587572901239557*b3 + (-2.4663389057176472328587572901239557*b2 + (2.1374937182886276018109229847740950*b + 2.1374937182886276018109229847740950*a)*a)*a)*a)*a)*a)*a; } inline double leg_f46_dyy_1(double x, double y) @@ -6669,7 +6669,7 @@ namespace Hermes inline double leg_f46_dxy_0(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6677,7 +6677,7 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.24912514199168153867260174647716725e-1*b7 + (-.22421262779251338480534157182945052*b6 + (.67263788337754015441602471548835157*b5 + (2.4663389057176472328587572901239557*b4 + (-2.4663389057176472328587572901239557*b3 + (-6.4124811548658828054327689543222849*b2 + (2.1374937182886276018109229847740950*b + 4.5803436820470591467376921102302035*a)*a)*a)*a)*a)*a)*a; + return -.24912514199168153867260174647716725e-1 * b7 + (-.22421262779251338480534157182945052*b6 + (.67263788337754015441602471548835157*b5 + (2.4663389057176472328587572901239557*b4 + (-2.4663389057176472328587572901239557*b3 + (-6.4124811548658828054327689543222849*b2 + (2.1374937182886276018109229847740950*b + 4.5803436820470591467376921102302035*a)*a)*a)*a)*a)*a)*a; } inline double leg_f46_dxy_1(double x, double y) @@ -6689,7 +6689,7 @@ namespace Hermes inline double leg_f47_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(x + 1.)*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); + return -.22777155839239454964352159677912434e-1 * (x + 1.)*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); } // number 47 @@ -6701,7 +6701,7 @@ namespace Hermes inline double leg_f47_dx_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); + return -.22777155839239454964352159677912434e-1 * (-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); } inline double leg_f47_dx_1(double x, double y) @@ -6712,7 +6712,7 @@ namespace Hermes inline double leg_f47_dy_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(x + 1.)*(-35. + (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y); + return -.22777155839239454964352159677912434e-1 * (x + 1.)*(-35. + (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y); } inline double leg_f47_dy_1(double x, double y) @@ -6742,7 +6742,7 @@ namespace Hermes inline double leg_f47_dxy_0(double x, double y) { - return .79720045437338092375232558872693520-.22777155839239454964352159677912434e-1*(-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y; + return .79720045437338092375232558872693520 - .22777155839239454964352159677912434e-1 * (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y; } inline double leg_f47_dxy_1(double x, double y) @@ -6754,7 +6754,7 @@ namespace Hermes inline double leg_f48_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(x + y)*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); + return -.22777155839239454964352159677912434e-1 * (x + y)*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); } // number 48 @@ -6766,7 +6766,7 @@ namespace Hermes inline double leg_f48_dx_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); + return -.22777155839239454964352159677912434e-1 * (-35. + (385. + (-1001. + 715.*y2)*y2)*y2)*y*(1. + y); } inline double leg_f48_dx_1(double x, double y) @@ -6777,7 +6777,7 @@ namespace Hermes inline double leg_f48_dy_0(double x, double y) { double y2 = y*y; - return -.22777155839239454964352159677912434e-1*(-70. + (-105. + (1540. + (1925. + (-6006. + (-7007. + (5720. + 6435.*y)*y)*y)*y)*y)*y)*y)*y-.22777155839239454964352159677912434e-1*(-35. + (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y)*x; + return -.22777155839239454964352159677912434e-1 * (-70. + (-105. + (1540. + (1925. + (-6006. + (-7007. + (5720. + 6435.*y)*y)*y)*y)*y)*y)*y)*y - .22777155839239454964352159677912434e-1 * (-35. + (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y)*x; } inline double leg_f48_dy_1(double x, double y) @@ -6797,7 +6797,7 @@ namespace Hermes inline double leg_f48_dyy_0(double x, double y) { - return 1.5944009087467618475046511774538704-.45554311678478909928704319355824868e-1*(-105. + (2310. + (3850. + (-15015. + (-21021. + (20020. + 25740.*y)*y)*y)*y)*y)*y)*y-.45554311678478909928704319355824868e-1*(-35. + (1155. + (2310. + (-10010. + (-15015. + (15015. + 20020.*y)*y)*y)*y)*y)*y)*x; + return 1.5944009087467618475046511774538704 - .45554311678478909928704319355824868e-1 * (-105. + (2310. + (3850. + (-15015. + (-21021. + (20020. + 25740.*y)*y)*y)*y)*y)*y)*y - .45554311678478909928704319355824868e-1 * (-35. + (1155. + (2310. + (-10010. + (-15015. + (15015. + 20020.*y)*y)*y)*y)*y)*y)*x; } inline double leg_f48_dyy_1(double x, double y) @@ -6807,7 +6807,7 @@ namespace Hermes inline double leg_f48_dxy_0(double x, double y) { - return .79720045437338092375232558872693520-.22777155839239454964352159677912434e-1*(-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y; + return .79720045437338092375232558872693520 - .22777155839239454964352159677912434e-1 * (-70. + (1155. + (1540. + (-5005. + (-6006. + (5005. + 5720.*y)*y)*y)*y)*y)*y)*y; } inline double leg_f48_dxy_1(double x, double y) @@ -6821,44 +6821,44 @@ namespace Hermes inline double leg_f49(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.7563249754401486360699529803715482*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(-.78125000000000000000000000000000000e-1 + (.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); + return 1.7563249754401486360699529803715482*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(-.78125000000000000000000000000000000e-1 + (.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); } inline double leg_f49_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 4.3021000123345612730902482891395519*a*(-.78125000000000000000000000000000000e-1 + (.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); } inline double leg_f49_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (-.16805078173181879973008782379451375 + 2.1510500061672806365451241445697760*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y-1.0755250030836403182725620722848880*(.39062500000000000000000000000000000 + (6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (-.16805078173181879973008782379451375 + 2.1510500061672806365451241445697760*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 1.0755250030836403182725620722848880*(.39062500000000000000000000000000000 + (6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (-.16805078173181879973008782379451375 + 2.1510500061672806365451241445697760*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y - 1.0755250030836403182725620722848880*(.39062500000000000000000000000000000 + (6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (-.16805078173181879973008782379451375 + 2.1510500061672806365451241445697760*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 1.0755250030836403182725620722848880*(.39062500000000000000000000000000000 + (6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a; } inline double leg_f49_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return -.67220312692727519892035129517805500 + 8.6042000246691225461804965782791037*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y; } inline double leg_f49_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.6805078173181879973008782379451375 + 4.3021000123345612730902482891395519*(6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y-1.0755250030836403182725620722848880*(6.0937500000000000000000000000000000 + (-5.1562500000000000000000000000000000 + (-175.31250000000000000000000000000000 + (-134.06250000000000000000000000000000 + (469.21875000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (1.6805078173181879973008782379451375 + 4.3021000123345612730902482891395519*(6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.0755250030836403182725620722848880*(6.0937500000000000000000000000000000 + (-5.1562500000000000000000000000000000 + (-175.31250000000000000000000000000000 + (-134.06250000000000000000000000000000 + (469.21875000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (1.6805078173181879973008782379451375 + 4.3021000123345612730902482891395519*(6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y - 1.0755250030836403182725620722848880*(6.0937500000000000000000000000000000 + (-5.1562500000000000000000000000000000 + (-175.31250000000000000000000000000000 + (-134.06250000000000000000000000000000 + (469.21875000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (1.6805078173181879973008782379451375 + 4.3021000123345612730902482891395519*(6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.0755250030836403182725620722848880*(6.0937500000000000000000000000000000 + (-5.1562500000000000000000000000000000 + (-175.31250000000000000000000000000000 + (-134.06250000000000000000000000000000 + (469.21875000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; } inline double leg_f49_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return -.33610156346363759946017564758902751 + 4.3021000123345612730902482891395519*(.39062500000000000000000000000000000 + (3.0468750000000000000000000000000000 + (-.85937500000000000000000000000000000 + (-14.609375000000000000000000000000000 + (-6.7031250000000000000000000000000000 + (15.640625000000000000000000000000000 + 11.171875000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 4.3021000123345612730902482891395519*(.39062500000000000000000000000000000 + (6.0937500000000000000000000000000000 + (-2.5781250000000000000000000000000000 + (-58.437500000000000000000000000000000 + (-33.515625000000000000000000000000000 + (93.843750000000000000000000000000000 + 78.203125000000000000000000000000000*y)*y)*y)*y)*y)*y)*a; } @@ -6866,7 +6866,7 @@ namespace Hermes inline double leg_f50(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return 1.5921853230058714151559241260993711*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y); @@ -6875,47 +6875,47 @@ namespace Hermes inline double leg_f50_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.5921853230058714151559241260993711*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y); + return 1.5921853230058714151559241260993711*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y); } inline double leg_f50_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -1.2587330194473605815215838648165324*b2*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y) + ((.51136028915049023624314344508171630 + 2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y-1.2587330194473605815215838648165324*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (.76704043372573535436471516762257442 + 3.7761990583420817445647515944495971*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.2587330194473605815215838648165324*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a)*a; + return -1.2587330194473605815215838648165324*b2*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y) + ((.51136028915049023624314344508171630 + 2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y - 1.2587330194473605815215838648165324*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (.76704043372573535436471516762257442 + 3.7761990583420817445647515944495971*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.2587330194473605815215838648165324*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a)*a; } inline double leg_f50_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 30.209592466736653956518012755596777*a*(.20312500000000000000000000000000000 + (.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y); } inline double leg_f50_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y-2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + (.15734162743092007269019798310206655 + 5.0349320777894423260863354592661295*(-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y-1.2587330194473605815215838648165324*(-12.031250000000000000000000000000000 + (-61.875000000000000000000000000000000 + (134.06250000000000000000000000000000 + (625.62500000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*b)*b + (.23601244114638010903529697465309982 + 7.5523981166841634891295031888991943*(-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y + 1.2587330194473605815215838648165324*(-12.031250000000000000000000000000000 + (-61.875000000000000000000000000000000 + (134.06250000000000000000000000000000 + (625.62500000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; + double b = 1.0 - y; + return (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y - 2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + (.15734162743092007269019798310206655 + 5.0349320777894423260863354592661295*(-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y - 1.2587330194473605815215838648165324*(-12.031250000000000000000000000000000 + (-61.875000000000000000000000000000000 + (134.06250000000000000000000000000000 + (625.62500000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*b)*b + (.23601244114638010903529697465309982 + 7.5523981166841634891295031888991943*(-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y + 1.2587330194473605815215838648165324*(-12.031250000000000000000000000000000 + (-61.875000000000000000000000000000000 + (134.06250000000000000000000000000000 + (625.62500000000000000000000000000000 + 469.21875000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; } inline double leg_f50_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y-2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (3.0681617349029414174588606704902977 + 15.104796233368326978259006377798388*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + 7.5523981166841634891295031888991943*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (1.0227205783009804724862868901634326 + 5.0349320777894423260863354592661295*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y - 2.5174660388947211630431677296330648*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (3.0681617349029414174588606704902977 + 15.104796233368326978259006377798388*(.31250000000000000000000000000000000e-1 + (-6.0156250000000000000000000000000000 + (-10.312500000000000000000000000000000 + (11.171875000000000000000000000000000 + (31.281250000000000000000000000000000 + 15.640625000000000000000000000000000*y)*y)*y)*y)*y)*y + 7.5523981166841634891295031888991943*(.31250000000000000000000000000000000e-1 + (-12.031250000000000000000000000000000 + (-30.937500000000000000000000000000000 + (44.687500000000000000000000000000000 + (156.40625000000000000000000000000000 + 93.843750000000000000000000000000000*y)*y)*y)*y)*y)*a)*a; } // number 51 inline double leg_f51(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -6925,7 +6925,7 @@ namespace Hermes inline double leg_f51_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6935,48 +6935,48 @@ namespace Hermes inline double leg_f51_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (.39905292492166838819716431718425096-.91212097124952774445066129642114507*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + .22803024281238193611266532410528627*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-2.7363629137485832333519838892634352*b2*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y) + ((-1.1971587747650051645914929515527529 + 2.7363629137485832333519838892634352*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y-1.3681814568742916166759919446317176*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-1.9952646246083419409858215859212548 + 4.5606048562476387222533064821057254*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + 1.1401512140619096805633266205264313*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a; + return (.39905292492166838819716431718425096 - .91212097124952774445066129642114507*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + .22803024281238193611266532410528627*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-2.7363629137485832333519838892634352*b2*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y) + ((-1.1971587747650051645914929515527529 + 2.7363629137485832333519838892634352*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y - 1.3681814568742916166759919446317176*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-1.9952646246083419409858215859212548 + 4.5606048562476387222533064821057254*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + 1.1401512140619096805633266205264313*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a; } inline double leg_f51_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return .97509833420206208638416899890309576*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y); + return .97509833420206208638416899890309576*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y); } inline double leg_f51_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (4.9026502204662116264223044682636546-1.8242419424990554889013225928422901*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y + .22803024281238193611266532410528627*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*b)*b3 + ((-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y-5.4727258274971664667039677785268703*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + (-14.707950661398634879266913404790964 + 5.4727258274971664667039677785268703*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y-1.3681814568742916166759919446317176*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*b)*b + (-24.513251102331058132111522341318273 + 9.1212097124952774445066129642114507*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y + 1.1401512140619096805633266205264313*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; + return (4.9026502204662116264223044682636546 - 1.8242419424990554889013225928422901*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y + .22803024281238193611266532410528627*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*b)*b3 + ((-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y - 5.4727258274971664667039677785268703*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + (-14.707950661398634879266913404790964 + 5.4727258274971664667039677785268703*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y - 1.3681814568742916166759919446317176*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*b)*b + (-24.513251102331058132111522341318273 + 9.1212097124952774445066129642114507*(5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y + 1.1401512140619096805633266205264313*(5.2500000000000000000000000000000000 + (165.75000000000000000000000000000000 + (477.75000000000000000000000000000000 + 341.25000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; } inline double leg_f51_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return -5.4727258274971664667039677785268703*b2*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y) + ((-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y-5.4727258274971664667039677785268703*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-11.971587747650051645914929515527529 + 27.363629137485832333519838892634352*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + 9.1212097124952774445066129642114507*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; + return -5.4727258274971664667039677785268703*b2*(-.43750000000000000000000000000000000 + (-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y) + ((-4.7886350990600206583659718062110115 + 10.945451654994332933407935557053741*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y - 5.4727258274971664667039677785268703*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*b)*b + (-11.971587747650051645914929515527529 + 27.363629137485832333519838892634352*(-2.6875000000000000000000000000000000 + (2.6250000000000000000000000000000000 + (27.625000000000000000000000000000000 + (39.812500000000000000000000000000000 + 17.062500000000000000000000000000000*y)*y)*y)*y)*y + 9.1212097124952774445066129642114507*(-2.6875000000000000000000000000000000 + (5.2500000000000000000000000000000000 + (82.875000000000000000000000000000000 + (159.25000000000000000000000000000000 + 85.312500000000000000000000000000000*y)*y)*y)*y)*a)*a)*a; } // number 52 inline double leg_f52(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -6986,7 +6986,7 @@ namespace Hermes inline double leg_f52_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -6997,18 +6997,18 @@ namespace Hermes inline double leg_f52_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .40891964427865092013487337229616315*b4*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((-.35780468874381955511801420075914278-1.6356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .40891964427865092013487337229616315*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + (-4.0891964427865092013487337229616315*b2*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((.59634114790636592519669033459857128 + 2.7261309618576728008991558153077544*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y-1.3630654809288364004495779076538772*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (1.0435970088361403690942080855474997 + 4.7707291832509274015735226767885701*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .95414583665018548031470453535771402*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a)*a; + return .40891964427865092013487337229616315*b4*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((-.35780468874381955511801420075914278 - 1.6356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .40891964427865092013487337229616315*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + (-4.0891964427865092013487337229616315*b2*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((.59634114790636592519669033459857128 + 2.7261309618576728008991558153077544*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y - 1.3630654809288364004495779076538772*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (1.0435970088361403690942080855474997 + 4.7707291832509274015735226767885701*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .95414583665018548031470453535771402*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a)*a; } inline double leg_f52_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7018,28 +7018,28 @@ namespace Hermes inline double leg_f52_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-.71560937748763911023602840151828554-3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .81783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + ((-.71560937748763911023602840151828554-3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + (-23.308419723883102447687782220881300-3.2713571542292073610789869783693052*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y + .40891964427865092013487337229616315*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*b)*b)*b2 + ((3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y-8.1783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + (38.847366206471837412812970368135500 + 5.4522619237153456017983116306155087*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y-1.3630654809288364004495779076538772*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*b)*b + (67.982890861325715472422698144237124 + 9.5414583665018548031470453535771402*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y + .95414583665018548031470453535771402*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; + return (-.71560937748763911023602840151828554 - 3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .81783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + ((-.71560937748763911023602840151828554 - 3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + (-23.308419723883102447687782220881300 - 3.2713571542292073610789869783693052*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y + .40891964427865092013487337229616315*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*b)*b)*b2 + ((3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y - 8.1783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + (38.847366206471837412812970368135500 + 5.4522619237153456017983116306155087*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y - 1.3630654809288364004495779076538772*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*b)*b + (67.982890861325715472422698144237124 + 9.5414583665018548031470453535771402*(53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y + .95414583665018548031470453535771402*(53.625000000000000000000000000000000 + (204.75000000000000000000000000000000 + 170.62500000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; } inline double leg_f52_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (-.71560937748763911023602840151828554-3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .81783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + (-16.356785771146036805394934891846526*b2*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y-8.1783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (8.3487760706891229527536646843799979 + 38.165833466007419212588181414308561*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + 9.5414583665018548031470453535771402*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; + return (-.71560937748763911023602840151828554 - 3.2713571542292073610789869783693052*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + .81783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b3 + (-16.356785771146036805394934891846526*b2*(.21875000000000000000000000000000000 + (7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y) + ((3.5780468874381955511801420075914278 + 16.356785771146036805394934891846526*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y - 8.1783928855730184026974674459232632*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*b)*b + (8.3487760706891229527536646843799979 + 38.165833466007419212588181414308561*(7.1250000000000000000000000000000000 + (26.812500000000000000000000000000000 + (34.125000000000000000000000000000000 + 14.218750000000000000000000000000000*y)*y)*y)*y + 9.5414583665018548031470453535771402*(7.1250000000000000000000000000000000 + (53.625000000000000000000000000000000 + (102.37500000000000000000000000000000 + 56.875000000000000000000000000000000*y)*y)*y)*a)*a)*a)*a; } // number 53 inline double leg_f53(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -7050,7 +7050,7 @@ namespace Hermes inline double leg_f53_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7062,19 +7062,19 @@ namespace Hermes inline double leg_f53_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.60822596331878833691165842189837477 + .22117307757046848614969397159940900*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y-.36862179595078081024948995266568168e-1*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b5 + (1.1058653878523424307484698579970450*b4*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((-6.0822596331878833691165842189837477-2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + .55293269392617121537423492899852251*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + (-5.1607051433109313434928593373195434*b2*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((7.0959695720525305973026815888143723 + 2.5803525716554656717464296686597717*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y-1.2901762858277328358732148343298859*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (12.772745229694555075144826859865870 + 4.6446346289798382091435734035875891*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + .77410577149663970152392890059793149*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a)*a; + return (.60822596331878833691165842189837477 + .22117307757046848614969397159940900*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y - .36862179595078081024948995266568168e-1 * (13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b5 + (1.1058653878523424307484698579970450*b4*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((-6.0822596331878833691165842189837477 - 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + .55293269392617121537423492899852251*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + (-5.1607051433109313434928593373195434*b2*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((7.0959695720525305973026815888143723 + 2.5803525716554656717464296686597717*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y - 1.2901762858277328358732148343298859*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (12.772745229694555075144826859865870 + 4.6446346289798382091435734035875891*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + .77410577149663970152392890059793149*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a)*a; } inline double leg_f53_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7086,32 +7086,32 @@ namespace Hermes inline double leg_f53_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (5.8610865556174148829668902473843387 + .44234615514093697229938794319881801*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y-.36862179595078081024948995266568168e-1*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b5 + ((-24.329038532751533476466336875934991-8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + ((-24.329038532751533476466336875934991-8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + (-58.610865556174148829668902473843387-4.4234615514093697229938794319881801*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y + .55293269392617121537423492899852251*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b)*b2 + ((56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y-10.321410286621862686985718674639087*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + (68.379343148869840301280386219483951 + 5.1607051433109313434928593373195434*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y-1.2901762858277328358732148343298859*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b + (123.08281766796571254230469519507111 + 9.2892692579596764182871468071751781*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y + .77410577149663970152392890059793149*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*a)*a)*a)*a)*a)*a; + return (5.8610865556174148829668902473843387 + .44234615514093697229938794319881801*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y - .36862179595078081024948995266568168e-1 * (52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b5 + ((-24.329038532751533476466336875934991 - 8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + ((-24.329038532751533476466336875934991 - 8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + (-58.610865556174148829668902473843387 - 4.4234615514093697229938794319881801*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y + .55293269392617121537423492899852251*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b)*b2 + ((56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y - 10.321410286621862686985718674639087*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + (68.379343148869840301280386219483951 + 5.1607051433109313434928593373195434*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y - 1.2901762858277328358732148343298859*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*b)*b + (123.08281766796571254230469519507111 + 9.2892692579596764182871468071751781*(38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y + .77410577149663970152392890059793149*(52.500000000000000000000000000000000*y + 38.500000000000000000000000000000000)*a)*a)*a)*a)*a)*a; } inline double leg_f53_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return 2.2117307757046848614969397159940900*b4*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((-24.329038532751533476466336875934991-8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + (-30.964230859865588060957156023917261*b2*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y-10.321410286621862686985718674639087*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (127.72745229694555075144826859865870 + 46.446346289798382091435734035875891*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 9.2892692579596764182871468071751781*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; + return 2.2117307757046848614969397159940900*b4*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((-24.329038532751533476466336875934991 - 8.8469231028187394459877588639763602*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 2.2117307757046848614969397159940900*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b3 + (-30.964230859865588060957156023917261*b2*(2.7500000000000000000000000000000000 + (13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y) + ((56.767756576420244778421452710514978 + 20.642820573243725373971437349278174*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y - 10.321410286621862686985718674639087*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*b)*b + (127.72745229694555075144826859865870 + 46.446346289798382091435734035875891*(13.250000000000000000000000000000000 + (19.250000000000000000000000000000000 + 8.7500000000000000000000000000000000*y)*y)*y + 9.2892692579596764182871468071751781*(13.250000000000000000000000000000000 + (38.500000000000000000000000000000000 + 26.250000000000000000000000000000000*y)*y)*a)*a)*a)*a)*a; } // number 54 inline double leg_f54(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -7122,7 +7122,7 @@ namespace Hermes inline double leg_f54_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7135,20 +7135,20 @@ namespace Hermes inline double leg_f54_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.94533039239549870023101308425754951e-1*b6*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((1.5597951474525728553811715890249567 + .56719823543729922013860785055452969*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-.94533039239549870023101308425754951e-1*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + (1.9851938240305472704851274769408539*b4*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((-7.2790440214453399917788007487831311-2.6469250987073963606468366359211386*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + .66173127467684909016170915898028464*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + (-5.9555814720916418114553824308225617*b2*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((6.5511396193008059926009206739048179 + 2.3822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-1.1911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (12.010422635384810986435021235492166 + 4.3674264128672039950672804492698786*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + .62391805898102914215246863560998266*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a; + return -.94533039239549870023101308425754951e-1 * b6*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((1.5597951474525728553811715890249567 + .56719823543729922013860785055452969*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - .94533039239549870023101308425754951e-1 * (7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + (1.9851938240305472704851274769408539*b4*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((-7.2790440214453399917788007487831311 - 2.6469250987073963606468366359211386*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + .66173127467684909016170915898028464*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + (-5.9555814720916418114553824308225617*b2*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((6.5511396193008059926009206739048179 + 2.3822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - 1.1911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (12.010422635384810986435021235492166 + 4.3674264128672039950672804492698786*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + .62391805898102914215246863560998266*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f54_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7160,44 +7160,44 @@ namespace Hermes inline double leg_f54_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-.18906607847909974004620261685150989*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + ((3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (8.5079735315594883020791177583179455*y + 7.3735770606848898618019020572088860-.70899779429662402517325981319316211*b)*b)*b4 + ((-43.674264128672039950672804492698787-15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 3.9703876480610945409702549538817078*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + ((-43.674264128672039950672804492698787-15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (-39.703876480610945409702549538817079*y-34.410026283196152688408876266974801 + 4.9629845600763681762128186923521348*b)*b)*b2 + ((65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-11.911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (35.733488832549850868732294584935370*y + 30.969023654876537419567988640277321-8.9333722081374627171830736462338426*b)*b + (65.511396193008059926009206739048179*y + 56.776543367273651935874645840508422 + 4.6793854423577185661435147670748699*a)*a)*a)*a)*a)*a)*a; + return (3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - .18906607847909974004620261685150989*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + ((3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (8.5079735315594883020791177583179455*y + 7.3735770606848898618019020572088860 - .70899779429662402517325981319316211*b)*b)*b4 + ((-43.674264128672039950672804492698787 - 15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 3.9703876480610945409702549538817078*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + ((-43.674264128672039950672804492698787 - 15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (-39.703876480610945409702549538817079*y - 34.410026283196152688408876266974801 + 4.9629845600763681762128186923521348*b)*b)*b2 + ((65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - 11.911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + (35.733488832549850868732294584935370*y + 30.969023654876537419567988640277321 - 8.9333722081374627171830736462338426*b)*b + (65.511396193008059926009206739048179*y + 56.776543367273651935874645840508422 + 4.6793854423577185661435147670748699*a)*a)*a)*a)*a)*a)*a; } inline double leg_f54_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-.18906607847909974004620261685150989*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + (7.9407752961221890819405099077634157*b4*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((-43.674264128672039950672804492698787-15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 3.9703876480610945409702549538817078*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + (-47.644651776733134491643059446580494*b2*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y-11.911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (144.12507162461773183722025482590599 + 52.409116954406447940807365391238543*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 8.7348528257344079901345608985397572*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a; + return (3.1195902949051457107623431780499134 + 1.1343964708745984402772157011090594*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - .18906607847909974004620261685150989*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b5 + (7.9407752961221890819405099077634157*b4*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((-43.674264128672039950672804492698787 - 15.881550592244378163881019815526832*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 3.9703876480610945409702549538817078*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b3 + (-47.644651776733134491643059446580494*b2*(2.7500000000000000000000000000000000 + (6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y) + ((65.511396193008059926009206739048179 + 23.822325888366567245821529723290247*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y - 11.911162944183283622910764861645123*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*b)*b + (144.12507162461773183722025482590599 + 52.409116954406447940807365391238543*(6.5000000000000000000000000000000000 + 3.7500000000000000000000000000000000*y)*y + 8.7348528257344079901345608985397572*(7.5000000000000000000000000000000000*y + 6.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a; } // number 55 inline double leg_f55(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return .55090590344733555051405113120224709e-1*(.10697706201272775653456441070328167*b8 + (-2.9953577363563771829678034996918866*b6 + (13.479109813603697323355115748613490*b4 + (-19.769361059952089407587503097966452*b2 + 9.1786319206920415106656264383415669*a2)*a2)*a2)*a2)*(1. + y); + return .55090590344733555051405113120224709e-1 * (.10697706201272775653456441070328167*b8 + (-2.9953577363563771829678034996918866*b6 + (13.479109813603697323355115748613490*b4 + (-19.769361059952089407587503097966452*b2 + 9.1786319206920415106656264383415669*a2)*a2)*a2)*a2)*(1. + y); } inline double leg_f55_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7205,13 +7205,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return .55090590344733555051405113120224709e-1*(-11.981430945425508731871213998767547*b6 + (107.83287850882957858684092598890792*b4 + (-237.23233271942507289105003717559742*b2 + 146.85811073107266417065002301346507*a2)*a2)*a2)*a*(1. + y); + return .55090590344733555051405113120224709e-1 * (-11.981430945425508731871213998767547*b6 + (107.83287850882957858684092598890792*b4 + (-237.23233271942507289105003717559742*b2 + 146.85811073107266417065002301346507*a2)*a2)*a2)*a*(1. + y); } inline double leg_f55_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7219,13 +7219,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-.47147435997010740107742172080116283e-1-.47147435997010740107742172080116283e-1*y + .58934294996263425134677715100145354e-2*b)*b7 + (-.33003205197907518075419520456081398*b6*(1. + y) + ((.99009615593722554226258561368244194 + .99009615593722554226258561368244194*y-.16501602598953759037709760228040699*b)*b5 + (2.9702884678116766267877568410473258*b4*(1. + y) + ((-2.9702884678116766267877568410473258-2.9702884678116766267877568410473258*y + .74257211695291915669693921026183146*b)*b3 + (-6.5346346291856885789330650503041168*b2*(1. + y) + ((2.1782115430618961929776883501013723 + 2.1782115430618961929776883501013723*y-1.0891057715309480964888441750506861*b)*b + (4.0452500085435215012442783644739771 + 4.0452500085435215012442783644739771*y + .50565625106794018765553479555924713*a)*a)*a)*a)*a)*a)*a)*a; + return (-.47147435997010740107742172080116283e-1 - .47147435997010740107742172080116283e-1 * y + .58934294996263425134677715100145354e-2 * b)*b7 + (-.33003205197907518075419520456081398*b6*(1. + y) + ((.99009615593722554226258561368244194 + .99009615593722554226258561368244194*y - .16501602598953759037709760228040699*b)*b5 + (2.9702884678116766267877568410473258*b4*(1. + y) + ((-2.9702884678116766267877568410473258 - 2.9702884678116766267877568410473258*y + .74257211695291915669693921026183146*b)*b3 + (-6.5346346291856885789330650503041168*b2*(1. + y) + ((2.1782115430618961929776883501013723 + 2.1782115430618961929776883501013723*y - 1.0891057715309480964888441750506861*b)*b + (4.0452500085435215012442783644739771 + 4.0452500085435215012442783644739771*y + .50565625106794018765553479555924713*a)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f55_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7233,13 +7233,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return .55090590344733555051405113120224709e-1*(-23.962861890851017463742427997535093*b6 + (646.99727105297747152104555593344752*b4 + (-2372.3233271942507289105003717559742*b2 + 2056.0135502350172983891003221885110*a2)*a2)*a2)*(1. + y); + return .55090590344733555051405113120224709e-1 * (-23.962861890851017463742427997535093*b6 + (646.99727105297747152104555593344752*b4 + (-2372.3233271942507289105003717559742*b2 + 2056.0135502350172983891003221885110*a2)*a2)*a2)*(1. + y); } inline double leg_f55_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7247,13 +7247,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.94294871994021480215484344160232566e-1*b7 + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y-.66006410395815036150839040912162796*b)*b5 + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y + 1.9801923118744510845251712273648839*b)*b4 + ((-23.762307742493413014302054728378607-23.762307742493413014302054728378607*y + 5.9405769356233532535755136820946517*b)*b3 + ((-23.762307742493413014302054728378607-23.762307742493413014302054728378607*y-5.9405769356233532535755136820946517*b)*b2 + ((26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y-13.069269258371377157866130100608234*b)*b + (26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y + 4.3564230861237923859553767002027445*b + 8.0905000170870430024885567289479542*a)*a)*a)*a)*a)*a)*a; + return -.94294871994021480215484344160232566e-1 * b7 + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y - .66006410395815036150839040912162796*b)*b5 + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y + 1.9801923118744510845251712273648839*b)*b4 + ((-23.762307742493413014302054728378607 - 23.762307742493413014302054728378607*y + 5.9405769356233532535755136820946517*b)*b3 + ((-23.762307742493413014302054728378607 - 23.762307742493413014302054728378607*y - 5.9405769356233532535755136820946517*b)*b2 + ((26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y - 13.069269258371377157866130100608234*b)*b + (26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y + 4.3564230861237923859553767002027445*b + 8.0905000170870430024885567289479542*a)*a)*a)*a)*a)*a)*a; } inline double leg_f55_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7261,7 +7261,7 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.66006410395815036150839040912162796*b6*(1. + y) + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y-.66006410395815036150839040912162796*b)*b5 + (17.821730806870059760726541046283955*b4*(1. + y) + ((-23.762307742493413014302054728378607-23.762307742493413014302054728378607*y + 5.9405769356233532535755136820946517*b)*b3 + (-65.346346291856885789330650503041168*b2*(1. + y) + ((26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y-13.069269258371377157866130100608234*b)*b + (56.633500119609301017419897102635679 + 56.633500119609301017419897102635679*y + 8.0905000170870430024885567289479542*a)*a)*a)*a)*a)*a)*a; + return -.66006410395815036150839040912162796*b6*(1. + y) + ((3.9603846237489021690503424547297678 + 3.9603846237489021690503424547297678*y - .66006410395815036150839040912162796*b)*b5 + (17.821730806870059760726541046283955*b4*(1. + y) + ((-23.762307742493413014302054728378607 - 23.762307742493413014302054728378607*y + 5.9405769356233532535755136820946517*b)*b3 + (-65.346346291856885789330650503041168*b2*(1. + y) + ((26.138538516742754315732260201216467 + 26.138538516742754315732260201216467*y - 13.069269258371377157866130100608234*b)*b + (56.633500119609301017419897102635679 + 56.633500119609301017419897102635679*y + 8.0905000170870430024885567289479542*a)*a)*a)*a)*a)*a)*a; } // ORDER 10 @@ -7272,20 +7272,20 @@ namespace Hermes inline double leg_f56(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; double b10 = b8*b2; - return -.82303806344571752837660497036322993e-4*b10 + (.37036712855057288776947223666345347e-2*b8 + (-.27160256093708678436427964021986588e-1*b6 + (.70616665843642563934712706457165128e-1*b4 + (-.75660713403902747072906471204105494e-1*b2 + .28582936174807704449764666899328742e-1*a2)*a2)*a2)*a2)*a2; + return -.82303806344571752837660497036322993e-4 * b10 + (.37036712855057288776947223666345347e-2 * b8 + (-.27160256093708678436427964021986588e-1 * b6 + (.70616665843642563934712706457165128e-1 * b4 + (-.75660713403902747072906471204105494e-1 * b2 + .28582936174807704449764666899328742e-1 * a2)*a2)*a2)*a2)*a2; } inline double leg_f56_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7295,13 +7295,13 @@ namespace Hermes double b7 = b6*b; double b8 = b7*b; double b9 = b8*b; - return (.14814685142022915510778889466538139e-1*b8 + (-.21728204874966942749142371217589270*b6 + (.84739999012371076721655247748598154*b4 + (-1.2105714144624439531665035392656879*b2 + .57165872349615408899529333798657485*a2)*a2)*a2)*a2)*a; + return (.14814685142022915510778889466538139e-1 * b8 + (-.21728204874966942749142371217589270*b6 + (.84739999012371076721655247748598154*b4 + (-1.2105714144624439531665035392656879*b2 + .57165872349615408899529333798657485*a2)*a2)*a2)*a2)*a; } inline double leg_f56_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7311,13 +7311,13 @@ namespace Hermes double b7 = b6*b; double b8 = b7*b; double b9 = b8*b; - return .82303806344571752837660497036322993e-3*b9 + (.74073425710114577553894447332690694e-2*b8 + (-.29629370284045831021557778933076278e-1*b7 + (-.10864102437483471374571185608794635*b6 + (.16296153656225207061856778413191953*b5 + (.42369999506185538360827623874299077*b4 + (-.28246666337457025573885082582866051*b3 + (-.60528570723122197658325176963284395*b2 + (.15132142680780549414581294240821099*b + .28582936174807704449764666899328742*a)*a)*a)*a)*a)*a)*a)*a)*a; + return .82303806344571752837660497036322993e-3 * b9 + (.74073425710114577553894447332690694e-2 * b8 + (-.29629370284045831021557778933076278e-1 * b7 + (-.10864102437483471374571185608794635*b6 + (.16296153656225207061856778413191953*b5 + (.42369999506185538360827623874299077*b4 + (-.28246666337457025573885082582866051*b3 + (-.60528570723122197658325176963284395*b2 + (.15132142680780549414581294240821099*b + .28582936174807704449764666899328742*a)*a)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f56_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7326,13 +7326,13 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .29629370284045831021557778933076278e-1*b8 + (-1.3036922924980165649485422730553562*b6 + (8.4739999012371076721655247748598154*b4 + (-16.947999802474215344331049549719631*b2 + 10.289857022930773601915280083758347*a2)*a2)*a2)*a2; + return .29629370284045831021557778933076278e-1 * b8 + (-1.3036922924980165649485422730553562*b6 + (8.4739999012371076721655247748598154*b4 + (-16.947999802474215344331049549719631*b2 + 10.289857022930773601915280083758347*a2)*a2)*a2)*a2; } inline double leg_f56_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7347,7 +7347,7 @@ namespace Hermes inline double leg_f56_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7356,26 +7356,26 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .14814685142022915510778889466538139e-1*b8 + (-.11851748113618332408623111573230511*b7 + (-.65184614624900828247427113652767811*b6 + (1.3036922924980165649485422730553562*b5 + (4.2369999506185538360827623874299077*b4 + (-3.3895999604948430688662099099439261*b3 + (-8.4739999012371076721655247748598154*b2 + (2.4211428289248879063330070785313758*b + 5.1449285114653868009576400418791736*a)*a)*a)*a)*a)*a)*a)*a; + return .14814685142022915510778889466538139e-1 * b8 + (-.11851748113618332408623111573230511*b7 + (-.65184614624900828247427113652767811*b6 + (1.3036922924980165649485422730553562*b5 + (4.2369999506185538360827623874299077*b4 + (-3.3895999604948430688662099099439261*b3 + (-8.4739999012371076721655247748598154*b2 + (2.4211428289248879063330070785313758*b + 5.1449285114653868009576400418791736*a)*a)*a)*a)*a)*a)*a)*a; } // number 57 inline double leg_f57(double x, double y) { double y2 = y*y; - return -.12039871099548782129394906995027821e-1*(x + 1.)*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); + return -.12039871099548782129394906995027821e-1 * (x + 1.)*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); } inline double leg_f57_dx(double x, double y) { double y2 = y*y; - return -.12039871099548782129394906995027821e-1*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); + return -.12039871099548782129394906995027821e-1 * (7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); } inline double leg_f57_dy(double x, double y) { double y2 = y*y; - return -.12039871099548782129394906995027821e-1*(x + 1.)*(7. + (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y); + return -.12039871099548782129394906995027821e-1 * (x + 1.)*(7. + (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y); } inline double leg_f57_dxx(double x, double y) @@ -7390,26 +7390,26 @@ namespace Hermes inline double leg_f57_dxy(double x, double y) { - return -.84279097696841474905764348965194744e-1-.12039871099548782129394906995027821e-1*(-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y; + return -.84279097696841474905764348965194744e-1 - .12039871099548782129394906995027821e-1 * (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y; } // number 58 inline double leg_f58(double x, double y) { double y2 = y*y; - return .12039871099548782129394906995027821e-1*(x + y)*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); + return .12039871099548782129394906995027821e-1 * (x + y)*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); } inline double leg_f58_dx(double x, double y) { double y2 = y*y; - return .12039871099548782129394906995027821e-1*(7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); + return .12039871099548782129394906995027821e-1 * (7. + (-308. + (2002. + (-4004. + 2431.*y2)*y2)*y2)*y2)*(1. + y); } inline double leg_f58_dy(double x, double y) { double y2 = y*y; - return .84279097696841474905764348965194744e-1 + .12039871099548782129394906995027821e-1*(14. + (-924. + (-1232. + (10010. + (12012. + (-28028. + (-32032. + (21879. + 24310.*y)*y)*y)*y)*y)*y)*y)*y)*y + .12039871099548782129394906995027821e-1*(7. + (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y)*x; + return .84279097696841474905764348965194744e-1 + .12039871099548782129394906995027821e-1 * (14. + (-924. + (-1232. + (10010. + (12012. + (-28028. + (-32032. + (21879. + 24310.*y)*y)*y)*y)*y)*y)*y)*y)*y + .12039871099548782129394906995027821e-1 * (7. + (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y)*x; } inline double leg_f58_dxx(double x, double y) @@ -7419,12 +7419,12 @@ namespace Hermes inline double leg_f58_dyy(double x, double y) { - return .16855819539368294981152869793038949 + .24079742199097564258789813990055641e-1*(-924. + (-1848. + (20020. + (30030. + (-84084. + (-112112. + (87516. + 109395.*y)*y)*y)*y)*y)*y)*y)*y + .24079742199097564258789813990055641e-1*(-308. + (-924. + (12012. + (20020. + (-60060. + (-84084. + (68068. + 87516.*y)*y)*y)*y)*y)*y)*y)*x; + return .16855819539368294981152869793038949 + .24079742199097564258789813990055641e-1 * (-924. + (-1848. + (20020. + (30030. + (-84084. + (-112112. + (87516. + 109395.*y)*y)*y)*y)*y)*y)*y)*y + .24079742199097564258789813990055641e-1 * (-308. + (-924. + (12012. + (20020. + (-60060. + (-84084. + (68068. + 87516.*y)*y)*y)*y)*y)*y)*y)*x; } inline double leg_f58_dxy(double x, double y) { - return .84279097696841474905764348965194744e-1 + .12039871099548782129394906995027821e-1*(-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y; + return .84279097696841474905764348965194744e-1 + .12039871099548782129394906995027821e-1 * (-616. + (-924. + (8008. + (10010. + (-24024. + (-28028. + (19448. + 21879.*y)*y)*y)*y)*y)*y)*y)*y; } // Bubble functions, order 10 @@ -7433,17 +7433,17 @@ namespace Hermes inline double leg_f59(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double y2 = y*y; - return 1.8781826691835577799972514353411927*(.61237243569579452454932101867647285*a2-.61237243569579452454932101867647285*b2)*(-.54687500000000000000000000000000000e-1 + (-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y); + return 1.8781826691835577799972514353411927*(.61237243569579452454932101867647285*a2 - .61237243569579452454932101867647285*b2)*(-.54687500000000000000000000000000000e-1 + (-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y); } inline double leg_f59_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; return 4.6005891832382558280858377040928971*a*(-.54687500000000000000000000000000000e-1 + (-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y); } @@ -7451,15 +7451,15 @@ namespace Hermes inline double leg_f59_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; - return (-.12579736047917105779922212472129016 + 2.3002945916191279140429188520464486*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y-1.1501472958095639570214594260232243*(-.65625000000000000000000000000000000 + (2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y)*b)*b + (-.12579736047917105779922212472129016 + 2.3002945916191279140429188520464486*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y + 1.1501472958095639570214594260232243*(-.65625000000000000000000000000000000 + (2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y)*a)*a; + return (-.12579736047917105779922212472129016 + 2.3002945916191279140429188520464486*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y - 1.1501472958095639570214594260232243*(-.65625000000000000000000000000000000 + (2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y)*b)*b + (-.12579736047917105779922212472129016 + 2.3002945916191279140429188520464486*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y + 1.1501472958095639570214594260232243*(-.65625000000000000000000000000000000 + (2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y)*a)*a; } inline double leg_f59_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; return -.50318944191668423119688849888516062 + 9.2011783664765116561716754081857942*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y; } @@ -7467,15 +7467,15 @@ namespace Hermes inline double leg_f59_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; - return (-3.0191366515001053871813309933109638 + 4.6005891832382558280858377040928971*(2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y-1.1501472958095639570214594260232243*(2.4062500000000000000000000000000000 + (57.750000000000000000000000000000000 + (-625.62500000000000000000000000000000 + (-469.21875000000000000000000000000000 + (1126.1250000000000000000000000000000 + 1063.5625000000000000000000000000000*y)*y)*y)*y2)*y)*b)*b + (-3.0191366515001053871813309933109638 + 4.6005891832382558280858377040928971*(2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y + 1.1501472958095639570214594260232243*(2.4062500000000000000000000000000000 + (57.750000000000000000000000000000000 + (-625.62500000000000000000000000000000 + (-469.21875000000000000000000000000000 + (1126.1250000000000000000000000000000 + 1063.5625000000000000000000000000000*y)*y)*y)*y2)*y)*a)*a; + return (-3.0191366515001053871813309933109638 + 4.6005891832382558280858377040928971*(2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y - 1.1501472958095639570214594260232243*(2.4062500000000000000000000000000000 + (57.750000000000000000000000000000000 + (-625.62500000000000000000000000000000 + (-469.21875000000000000000000000000000 + (1126.1250000000000000000000000000000 + 1063.5625000000000000000000000000000*y)*y)*y)*y2)*y)*b)*b + (-3.0191366515001053871813309933109638 + 4.6005891832382558280858377040928971*(2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y + 1.1501472958095639570214594260232243*(2.4062500000000000000000000000000000 + (57.750000000000000000000000000000000 + (-625.62500000000000000000000000000000 + (-469.21875000000000000000000000000000 + (1126.1250000000000000000000000000000 + 1063.5625000000000000000000000000000*y)*y)*y)*y2)*y)*a)*a; } inline double leg_f59_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double y2 = y*y; return -.25159472095834211559844424944258031 + 4.6005891832382558280858377040928971*(-.65625000000000000000000000000000000 + (1.2031250000000000000000000000000000 + (9.6250000000000000000000000000000000 + (-31.281250000000000000000000000000000 + (-15.640625000000000000000000000000000 + (26.812500000000000000000000000000000 + 18.992187500000000000000000000000000*y)*y)*y)*y2)*y)*y)*y + 4.6005891832382558280858377040928971*(-.65625000000000000000000000000000000 + (2.4062500000000000000000000000000000 + (28.875000000000000000000000000000000 + (-156.40625000000000000000000000000000 + (-93.843750000000000000000000000000000 + (187.68750000000000000000000000000000 + 151.93750000000000000000000000000000*y)*y)*y)*y2)*y)*y)*a; } @@ -7484,7 +7484,7 @@ namespace Hermes inline double leg_f60(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; return 1.7465387901340515412774319981019878*(-.79056941504209483299972338610817962*b2 + .79056941504209483299972338610817962*a2)*a*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); @@ -7493,47 +7493,47 @@ namespace Hermes inline double leg_f60_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return 1.7465387901340515412774319981019878*(4.7434164902525689979983403166490778*a2-1.5811388300841896659994467722163592*b2)*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); + return 1.7465387901340515412774319981019878*(4.7434164902525689979983403166490778*a2 - 1.5811388300841896659994467722163592*b2)*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); } inline double leg_f60_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; - return -1.3807601496646051572657795977932815*b2*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y) + ((.17259501870807564465822244972416018 + 2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y-1.3807601496646051572657795977932815*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (.25889252806211346698733367458624028 + 4.1422804489938154717973387933798444*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 1.3807601496646051572657795977932815*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a)*a; + return -1.3807601496646051572657795977932815*b2*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y) + ((.17259501870807564465822244972416018 + 2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y - 1.3807601496646051572657795977932815*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (.25889252806211346698733367458624028 + 4.1422804489938154717973387933798444*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 1.3807601496646051572657795977932815*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a)*a; } inline double leg_f60_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; return 33.138243591950523774378710347038755*a*(.62500000000000000000000000000000000e-1 + (1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y); } inline double leg_f60_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y-2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + (8.6297509354037822329111224862080092 + 5.5230405986584206290631183911731259*(3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y-1.3807601496646051572657795977932815*(3. + (-97.500000000000000000000000000000000 + (-341.25000000000000000000000000000000 + (341.25000000000000000000000000000000 + (1706.2500000000000000000000000000000 + 1160.2500000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (12.944626403105673349366683729312014 + 8.2845608979876309435946775867596891*(3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.3807601496646051572657795977932815*(3. + (-97.500000000000000000000000000000000 + (-341.25000000000000000000000000000000 + (341.25000000000000000000000000000000 + (1706.2500000000000000000000000000000 + 1160.2500000000000000000000000000000*y)*y)*y)*y)*y)*a)*a)*a; + double b = 1.0 - y; + return (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y - 2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + (8.6297509354037822329111224862080092 + 5.5230405986584206290631183911731259*(3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y - 1.3807601496646051572657795977932815*(3. + (-97.500000000000000000000000000000000 + (-341.25000000000000000000000000000000 + (341.25000000000000000000000000000000 + (1706.2500000000000000000000000000000 + 1160.2500000000000000000000000000000*y)*y)*y)*y)*y)*b)*b + (12.944626403105673349366683729312014 + 8.2845608979876309435946775867596891*(3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y + 1.3807601496646051572657795977932815*(3. + (-97.500000000000000000000000000000000 + (-341.25000000000000000000000000000000 + (341.25000000000000000000000000000000 + (1706.2500000000000000000000000000000 + 1160.2500000000000000000000000000000*y)*y)*y)*y)*y)*a)*a)*a; } inline double leg_f60_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; - return (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y-2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (1.0355701122484538679493346983449611 + 16.569121795975261887189355173519378*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 8.2845608979876309435946775867596891*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a; + double b = 1.0 - y; + return (.34519003741615128931644489944832037 + 5.5230405986584206290631183911731259*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y - 2.7615202993292103145315591955865629*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*b)*b + (1.0355701122484538679493346983449611 + 16.569121795975261887189355173519378*(1.5625000000000000000000000000000000 + (1.5000000000000000000000000000000000 + (-16.250000000000000000000000000000000 + (-28.437500000000000000000000000000000 + (17.062500000000000000000000000000000 + (56.875000000000000000000000000000000 + 27.625000000000000000000000000000000*y)*y)*y)*y)*y)*y)*y + 8.2845608979876309435946775867596891*(1.5625000000000000000000000000000000 + (3. + (-48.750000000000000000000000000000000 + (-113.75000000000000000000000000000000 + (85.312500000000000000000000000000000 + (341.25000000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y)*y)*y)*y)*a)*a; } // number 61 inline double leg_f61(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -7544,7 +7544,7 @@ namespace Hermes inline double leg_f61_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7555,52 +7555,52 @@ namespace Hermes inline double leg_f61_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double y2 = y*y; - return (-.86306134878487797796370546040008498e-1-1.0356736185418535735564465524801020*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + .25891840463546339338911163812002550*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b3 + (-3.1070208556255607206693396574403060*b2*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y) + ((.25891840463546339338911163812002550 + 3.1070208556255607206693396574403060*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y-1.5535104278127803603346698287201530*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (.43153067439243898898185273020004250 + 5.1783680927092678677822327624005100*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + 1.2945920231773169669455581906001275*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*a)*a)*a)*a; + return (-.86306134878487797796370546040008498e-1 - 1.0356736185418535735564465524801020*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + .25891840463546339338911163812002550*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b3 + (-3.1070208556255607206693396574403060*b2*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y) + ((.25891840463546339338911163812002550 + 3.1070208556255607206693396574403060*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y - 1.5535104278127803603346698287201530*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (.43153067439243898898185273020004250 + 5.1783680927092678677822327624005100*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + 1.2945920231773169669455581906001275*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*a)*a)*a)*a; } inline double leg_f61_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double y2 = y*y; - return 1.1071816700297210425642255794583961*(56.124860801609120783756230984748240*a2-11.224972160321824156751246196949648*b2)*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y); + return 1.1071816700297210425642255794583961*(56.124860801609120783756230984748240*a2 - 11.224972160321824156751246196949648*b2)*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y); } inline double leg_f61_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double y2 = y*y; - return (5.4372864973447312611713444005205354-2.0713472370837071471128931049602040*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y + .25891840463546339338911163812002550*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*b)*b3 + ((1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y-6.2140417112511214413386793148806119*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + (-16.311859492034193783514033201561606 + 6.2140417112511214413386793148806119*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y-1.5535104278127803603346698287201530*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*b)*b + (-27.186432486723656305856722002602676 + 10.356736185418535735564465524801020*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y + 1.2945920231773169669455581906001275*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*a)*a)*a)*a; + return (5.4372864973447312611713444005205354 - 2.0713472370837071471128931049602040*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y + .25891840463546339338911163812002550*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*b)*b3 + ((1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y - 6.2140417112511214413386793148806119*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + (-16.311859492034193783514033201561606 + 6.2140417112511214413386793148806119*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y - 1.5535104278127803603346698287201530*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*b)*b + (-27.186432486723656305856722002602676 + 10.356736185418535735564465524801020*(-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y + 1.2945920231773169669455581906001275*(-24.375000000000000000000000000000000 + (682.50000000000000000000000000000000 + (1592.5000000000000000000000000000000 + 966.87500000000000000000000000000000*y)*y)*y2)*a)*a)*a)*a; } inline double leg_f61_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double y2 = y*y; - return -6.2140417112511214413386793148806119*b2*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y) + ((1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y-6.2140417112511214413386793148806119*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (2.5891840463546339338911163812002550 + 31.070208556255607206693396574403060*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + 10.356736185418535735564465524801020*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*a)*a)*a; + return -6.2140417112511214413386793148806119*b2*(.83333333333333333333333333333333333e-1 + (-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y) + ((1.0356736185418535735564465524801020 + 12.428083422502242882677358629761224*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y - 6.2140417112511214413386793148806119*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*b)*b + (2.5891840463546339338911163812002550 + 31.070208556255607206693396574403060*(-2.6250000000000000000000000000000000 + (-12.187500000000000000000000000000000 + (56.875000000000000000000000000000000 + (79.625000000000000000000000000000000 + 32.229166666666666666666666666666667*y)*y)*y2)*y)*y + 10.356736185418535735564465524801020*(-2.6250000000000000000000000000000000 + (-24.375000000000000000000000000000000 + (227.50000000000000000000000000000000 + (398.12500000000000000000000000000000 + 193.37500000000000000000000000000000*y)*y)*y2)*y)*a)*a)*a; } // number 62 inline double leg_f62(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -7610,7 +7610,7 @@ namespace Hermes inline double leg_f62_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7621,18 +7621,18 @@ namespace Hermes inline double leg_f62_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; - return .48127746299266741539338459887275870*b4*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((1.4438323889780022461801537966182761-1.9251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .48127746299266741539338459887275870*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-4.8127746299266741539338459887275870*b2*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((-2.4063873149633370769669229943637935 + 3.2085164199511161026225639924850580*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y-1.6042582099755580513112819962425290*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-4.2111778011858398846921152401366384 + 5.6149037349144531795894869868488513*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + 1.1229807469828906359178973973697703*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a)*a; + return .48127746299266741539338459887275870*b4*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((1.4438323889780022461801537966182761 - 1.9251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .48127746299266741539338459887275870*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-4.8127746299266741539338459887275870*b2*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((-2.4063873149633370769669229943637935 + 3.2085164199511161026225639924850580*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y - 1.6042582099755580513112819962425290*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-4.2111778011858398846921152401366384 + 5.6149037349144531795894869868488513*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + 1.1229807469828906359178973973697703*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a)*a; } inline double leg_f62_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7642,28 +7642,28 @@ namespace Hermes inline double leg_f62_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (2.8876647779560044923603075932365521-3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .96255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + ((2.8876647779560044923603075932365521-3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + (2.8876647779560044923603075932365521-3.8502197039413393231470767909820695*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y + .48127746299266741539338459887275870*(42. + (420. + (945. + 595.*y)*y)*y)*b)*b)*b2 + ((-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y-9.6255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + (-4.8127746299266741539338459887275868 + 6.4170328399022322052451279849701158*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y-1.6042582099755580513112819962425290*(42. + (420. + (945. + 595.*y)*y)*y)*b)*b + (-8.4223556023716797693842304802732771 + 11.229807469828906359178973973697703*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y + 1.1229807469828906359178973973697703*(42. + (420. + (945. + 595.*y)*y)*y)*a)*a)*a)*a)*a; + return (2.8876647779560044923603075932365521 - 3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .96255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + ((2.8876647779560044923603075932365521 - 3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + (2.8876647779560044923603075932365521 - 3.8502197039413393231470767909820695*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y + .48127746299266741539338459887275870*(42. + (420. + (945. + 595.*y)*y)*y)*b)*b)*b2 + ((-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y - 9.6255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + (-4.8127746299266741539338459887275868 + 6.4170328399022322052451279849701158*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y - 1.6042582099755580513112819962425290*(42. + (420. + (945. + 595.*y)*y)*y)*b)*b + (-8.4223556023716797693842304802732771 + 11.229807469828906359178973973697703*(42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y + 1.1229807469828906359178973973697703*(42. + (420. + (945. + 595.*y)*y)*y)*a)*a)*a)*a)*a; } inline double leg_f62_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; - return (2.8876647779560044923603075932365521-3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .96255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-19.251098519706696615735383954910348*b2*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y-9.6255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-33.689422409486719077536921921093108 + 44.919229879315625436715895894790810*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + 11.229807469828906359178973973697703*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a; + return (2.8876647779560044923603075932365521 - 3.8502197039413393231470767909820695*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + .96255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b3 + (-19.251098519706696615735383954910348*b2*(-.75000000000000000000000000000000000 + (-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y) + ((-14.438323889780022461801537966182761 + 19.251098519706696615735383954910348*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y - 9.6255492598533483078676919774551738*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*b)*b + (-33.689422409486719077536921921093108 + 44.919229879315625436715895894790810*(-.75000000000000000000000000000000000 + (21. + (70. + (78.750000000000000000000000000000000 + 29.750000000000000000000000000000000*y)*y)*y)*y)*y + 11.229807469828906359178973973697703*(-.75000000000000000000000000000000000 + (42. + (210. + (315. + 148.75000000000000000000000000000000*y)*y)*y)*y)*a)*a)*a)*a; } // number 63 inline double leg_f63(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -7674,7 +7674,7 @@ namespace Hermes inline double leg_f63_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7686,19 +7686,19 @@ namespace Hermes inline double leg_f63_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (.40274574277309068430839343011964242 + .26849716184872712287226228674642828*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y-.44749526974787853812043714457738048e-1*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b5 + (1.3424858092436356143613114337321414*b4*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((-4.0274574277309068430839343011964242-2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + .67124290462181780718065571686607068*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + (-6.2649337764702995336861200240833266*b2*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((4.6987003323527246502645900180624949 + 3.1324668882351497668430600120416633*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y-1.5662334441175748834215300060208316*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (8.4576605982349043704762620325124910 + 5.6384403988232695803175080216749940*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + .93974006647054493005291800361249898*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*a)*a)*a)*a)*a)*a; + return (.40274574277309068430839343011964242 + .26849716184872712287226228674642828*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y - .44749526974787853812043714457738048e-1 * (16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b5 + (1.3424858092436356143613114337321414*b4*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((-4.0274574277309068430839343011964242 - 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + .67124290462181780718065571686607068*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + (-6.2649337764702995336861200240833266*b2*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((4.6987003323527246502645900180624949 + 3.1324668882351497668430600120416633*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y - 1.5662334441175748834215300060208316*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (8.4576605982349043704762620325124910 + 5.6384403988232695803175080216749940*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + .93974006647054493005291800361249898*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*a)*a)*a)*a)*a)*a; } inline double leg_f63_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7710,32 +7710,32 @@ namespace Hermes inline double leg_f63_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (8.8604063410079950547846554626321332 + .53699432369745424574452457349285655*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y-.44749526974787853812043714457738048e-1*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b5 + ((-16.109829710923627372335737204785697-10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + ((-16.109829710923627372335737204785697-10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + (-88.604063410079950547846554626321332-5.3699432369745424574452457349285655*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y + .67124290462181780718065571686607068*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b)*b2 + ((37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y-12.529867552940599067372240048166653*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + (103.37140731175994230582098039737489 + 6.2649337764702995336861200240833266*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y-1.5662334441175748834215300060208316*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b + (186.06853316116789615047776471527480 + 11.276880797646539160635016043349988*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y + .93974006647054493005291800361249898*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*a)*a)*a)*a)*a)*a; + return (8.8604063410079950547846554626321332 + .53699432369745424574452457349285655*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y - .44749526974787853812043714457738048e-1 * (97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b5 + ((-16.109829710923627372335737204785697 - 10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + ((-16.109829710923627372335737204785697 - 10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + (-88.604063410079950547846554626321332 - 5.3699432369745424574452457349285655*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y + .67124290462181780718065571686607068*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b)*b2 + ((37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y - 12.529867552940599067372240048166653*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + (103.37140731175994230582098039737489 + 6.2649337764702995336861200240833266*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y - 1.5662334441175748834215300060208316*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*b)*b + (186.06853316116789615047776471527480 + 11.276880797646539160635016043349988*(97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y + .93974006647054493005291800361249898*(97.500000000000000000000000000000000 + (330. + 255.*y)*y)*a)*a)*a)*a)*a)*a; } inline double leg_f63_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return 2.6849716184872712287226228674642828*b4*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((-16.109829710923627372335737204785697-10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + (-37.589602658821797202116720144499958*b2*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y-12.529867552940599067372240048166653*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (84.576605982349043704762620325124910 + 56.384403988232695803175080216749940*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 11.276880797646539160635016043349988*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*a)*a)*a)*a)*a; + return 2.6849716184872712287226228674642828*b4*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((-16.109829710923627372335737204785697 - 10.739886473949084914890491469857131*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 2.6849716184872712287226228674642828*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b3 + (-37.589602658821797202116720144499958*b2*(1.5000000000000000000000000000000000 + (16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y) + ((37.589602658821797202116720144499959 + 25.059735105881198134744480096333306*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y - 12.529867552940599067372240048166653*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*b)*b + (84.576605982349043704762620325124910 + 56.384403988232695803175080216749940*(16.500000000000000000000000000000000 + (48.750000000000000000000000000000000 + (55. + 21.250000000000000000000000000000000*y)*y)*y)*y + 11.276880797646539160635016043349988*(16.500000000000000000000000000000000 + (97.500000000000000000000000000000000 + (165. + 85.*y)*y)*y)*a)*a)*a)*a)*a; } // number 64 inline double leg_f64(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; @@ -7746,7 +7746,7 @@ namespace Hermes inline double leg_f64_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7759,20 +7759,20 @@ namespace Hermes inline double leg_f64_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; double b6 = b5*b; - return -.11754826450890581801454183188941421*b6*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((3.0562548772315512683780876291247695 + .70528958705343490808725099133648527*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-.11754826450890581801454183188941421*(19. + (52. + 34.*y)*y)*b)*b5 + (2.4685135546870221783053784696776984*b4*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((-14.262522760413905919097742269248924-3.2913514062493629044071712929035978*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + .82283785156234072610179282322589947*(19. + (52. + 34.*y)*y)*b)*b3 + (-7.4055406640610665349161354090330953*b2*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((12.836270484372515327187968042324031 + 2.9622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-1.4811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (23.533162554682944766511274744260725 + 5.4307298203114487922718326332909365*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + .77581854575877839889597609047013379*(19. + (52. + 34.*y)*y)*a)*a)*a)*a)*a)*a)*a; + return -.11754826450890581801454183188941421*b6*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((3.0562548772315512683780876291247695 + .70528958705343490808725099133648527*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - .11754826450890581801454183188941421*(19. + (52. + 34.*y)*y)*b)*b5 + (2.4685135546870221783053784696776984*b4*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((-14.262522760413905919097742269248924 - 3.2913514062493629044071712929035978*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + .82283785156234072610179282322589947*(19. + (52. + 34.*y)*y)*b)*b3 + (-7.4055406640610665349161354090330953*b2*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((12.836270484372515327187968042324031 + 2.9622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - 1.4811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (23.533162554682944766511274744260725 + 5.4307298203114487922718326332909365*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + .77581854575877839889597609047013379*(19. + (52. + 34.*y)*y)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f64_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7784,44 +7784,44 @@ namespace Hermes inline double leg_f64_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-.23509652901781163602908366377882842*(19. + (52. + 34.*y)*y)*b)*b5 + ((6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (26.801004308030526507315537670786440 + 1.4105791741068698161745019826729705*(52. + 34.*y)*y-.11754826450890581801454183188941421*(68.*y + 52.)*b)*b)*b4 + ((-85.575136562483435514586453615493545-19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 4.9370271093740443566107569393553969*(19. + (52. + 34.*y)*y)*b)*b3 + ((-85.575136562483435514586453615493545-19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (-125.07135343747579036747250913033672-6.5827028124987258088143425858071959*(52. + 34.*y)*y + .82283785156234072610179282322589947*(68.*y + 52.)*b)*b)*b2 + ((128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-14.811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (112.56421809372821133072525821730305 + 5.9244325312488532279329083272264761*(52. + 34.*y)*y-1.4811081328122133069832270818066191*(68.*y + 52.)*b)*b + (206.36773317183505410632964006505559 + 10.861459640622897584543665266581873*(52. + 34.*y)*y + .77581854575877839889597609047013379*(68.*y + 52.)*a)*a)*a)*a)*a)*a)*a; + return (6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - .23509652901781163602908366377882842*(19. + (52. + 34.*y)*y)*b)*b5 + ((6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (26.801004308030526507315537670786440 + 1.4105791741068698161745019826729705*(52. + 34.*y)*y - .11754826450890581801454183188941421*(68.*y + 52.)*b)*b)*b4 + ((-85.575136562483435514586453615493545 - 19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 4.9370271093740443566107569393553969*(19. + (52. + 34.*y)*y)*b)*b3 + ((-85.575136562483435514586453615493545 - 19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (-125.07135343747579036747250913033672 - 6.5827028124987258088143425858071959*(52. + 34.*y)*y + .82283785156234072610179282322589947*(68.*y + 52.)*b)*b)*b2 + ((128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - 14.811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + (112.56421809372821133072525821730305 + 5.9244325312488532279329083272264761*(52. + 34.*y)*y - 1.4811081328122133069832270818066191*(68.*y + 52.)*b)*b + (206.36773317183505410632964006505559 + 10.861459640622897584543665266581873*(52. + 34.*y)*y + .77581854575877839889597609047013379*(68.*y + 52.)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f64_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; double b4 = b3*b; double b5 = b4*b; - return (6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-.23509652901781163602908366377882842*(19. + (52. + 34.*y)*y)*b)*b5 + (9.8740542187480887132215138787107937*b4*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((-85.575136562483435514586453615493545-19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 4.9370271093740443566107569393553969*(19. + (52. + 34.*y)*y)*b)*b3 + (-59.244325312488532279329083272264761*b2*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y-14.811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (282.39795065619533719813529693112870 + 65.168757843737385507261991599491238*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 10.861459640622897584543665266581873*(19. + (52. + 34.*y)*y)*a)*a)*a)*a)*a)*a; + return (6.1125097544631025367561752582495390 + 1.4105791741068698161745019826729705*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - .23509652901781163602908366377882842*(19. + (52. + 34.*y)*y)*b)*b5 + (9.8740542187480887132215138787107937*b4*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((-85.575136562483435514586453615493545 - 19.748108437496177426443027757421587*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 4.9370271093740443566107569393553969*(19. + (52. + 34.*y)*y)*b)*b3 + (-59.244325312488532279329083272264761*b2*(4.3333333333333333333333333333333333 + (19. + (26. + 11.333333333333333333333333333333333*y)*y)*y) + ((128.36270484372515327187968042324031 + 29.622162656244266139664541636132381*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y - 14.811081328122133069832270818066191*(19. + (52. + 34.*y)*y)*b)*b + (282.39795065619533719813529693112870 + 65.168757843737385507261991599491238*(19. + (26. + 11.333333333333333333333333333333333*y)*y)*y + 10.861459640622897584543665266581873*(19. + (52. + 34.*y)*y)*a)*a)*a)*a)*a)*a; } // number 65 inline double leg_f65(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return .69728750379731214109841784629056465e-1*(.10697706201272775653456441070328167*b8 + (-2.9953577363563771829678034996918866*b6 + (13.479109813603697323355115748613490*b4 + (-19.769361059952089407587503097966452*b2 + 9.1786319206920415106656264383415669*a2)*a2)*a2)*a2)*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); + return .69728750379731214109841784629056465e-1 * (.10697706201272775653456441070328167*b8 + (-2.9953577363563771829678034996918866*b6 + (13.479109813603697323355115748613490*b4 + (-19.769361059952089407587503097966452*b2 + 9.1786319206920415106656264383415669*a2)*a2)*a2)*a2)*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); } inline double leg_f65_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7829,13 +7829,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return .69728750379731214109841784629056465e-1*(-11.981430945425508731871213998767547*b6 + (107.83287850882957858684092598890792*b4 + (-237.23233271942507289105003717559742*b2 + 146.85811073107266417065002301346507*a2)*a2)*a2)*a*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); + return .69728750379731214109841784629056465e-1 * (-11.981430945425508731871213998767547*b6 + (107.83287850882957858684092598890792*b4 + (-237.23233271942507289105003717559742*b2 + 146.85811073107266417065002301346507*a2)*a2)*a2)*a*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); } inline double leg_f65_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7843,13 +7843,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-.19394379818950552502986780397515149-.59675014827540161547651631992354305e-1*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .74593768534425201934564539990442882e-2*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b7 + (-.41772510379278113083356142394648014*b6*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((4.0728197619796160256272238834781813 + 1.2531753113783433925006842718394404*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-.20886255189639056541678071197324007*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + (3.7595259341350301775020528155183212*b4*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((-12.218459285938848076881671650434544-3.7595259341350301775020528155183212*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .93988148353375754437551320387958031*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + (-8.2709570550970663905045161941403067*b2*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((8.9602034763551552563798925436519989 + 2.7569856850323554635015053980467689*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-1.3784928425161777317507526990233844*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (16.640377884659574047562657581067998 + 5.1201162722029458607885100249439995*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .64001453402536823259856375311799993*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a)*a; + return (-.19394379818950552502986780397515149 - .59675014827540161547651631992354305e-1 * (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .74593768534425201934564539990442882e-2 * (8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b7 + (-.41772510379278113083356142394648014*b6*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((4.0728197619796160256272238834781813 + 1.2531753113783433925006842718394404*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - .20886255189639056541678071197324007*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + (3.7595259341350301775020528155183212*b4*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((-12.218459285938848076881671650434544 - 3.7595259341350301775020528155183212*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .93988148353375754437551320387958031*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + (-8.2709570550970663905045161941403067*b2*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((8.9602034763551552563798925436519989 + 2.7569856850323554635015053980467689*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - 1.3784928425161777317507526990233844*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (16.640377884659574047562657581067998 + 5.1201162722029458607885100249439995*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + .64001453402536823259856375311799993*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f65_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7857,13 +7857,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return .69728750379731214109841784629056465e-1*(-23.962861890851017463742427997535093*b6 + (646.99727105297747152104555593344752*b4 + (-2372.3233271942507289105003717559742*b2 + 2056.0135502350172983891003221885110*a2)*a2)*a2)*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); + return .69728750379731214109841784629056465e-1 * (-23.962861890851017463742427997535093*b6 + (646.99727105297747152104555593344752*b4 + (-2372.3233271942507289105003717559742*b2 + 2056.0135502350172983891003221885110*a2)*a2)*a2)*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y); } inline double leg_f65_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7871,13 +7871,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-1.0144752520681827463100777438700232*y-.89512522241310242321477447988531460 + .63404703254261421644379858991876449e-1*b)*b7 + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-.83545020758556226166712284789296028*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (21.303980293431837672511632621270488*y + 18.797629670675150887510264077591607-1.7753316911193198060426360517725406*b)*b)*b4 + ((-97.747674287510784615053373203476350-30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 7.5190518682700603550041056310366424*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + ((-97.747674287510784615053373203476350-30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (-63.911940880295513017534897863811461*y-56.392889012025452662530792232774819 + 7.9889926100369391271918622329764326*b)*b)*b2 + ((107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-16.541914110194132781009032388280613*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (46.868756645550042879525591766795072*y + 41.354785275485331952522580970701534-11.717189161387510719881397941698768*b)*b + (87.041976627450079633404670424047990*y + 76.801744083044187911827650374159992 + 5.4401235392156299770877919015029993*a)*a)*a)*a)*a)*a)*a)*a; + return (-1.0144752520681827463100777438700232*y - .89512522241310242321477447988531460 + .63404703254261421644379858991876449e-1 * b)*b7 + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - .83545020758556226166712284789296028*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (21.303980293431837672511632621270488*y + 18.797629670675150887510264077591607 - 1.7753316911193198060426360517725406*b)*b)*b4 + ((-97.747674287510784615053373203476350 - 30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 7.5190518682700603550041056310366424*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + ((-97.747674287510784615053373203476350 - 30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (-63.911940880295513017534897863811461*y - 56.392889012025452662530792232774819 + 7.9889926100369391271918622329764326*b)*b)*b2 + ((107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - 16.541914110194132781009032388280613*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + (46.868756645550042879525591766795072*y + 41.354785275485331952522580970701534 - 11.717189161387510719881397941698768*b)*b + (87.041976627450079633404670424047990*y + 76.801744083044187911827650374159992 + 5.4401235392156299770877919015029993*a)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f65_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7885,26 +7885,26 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return -.83545020758556226166712284789296028*b6*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-.83545020758556226166712284789296028*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + (22.557155604810181065012316893109926*b4*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((-97.747674287510784615053373203476350-30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 7.5190518682700603550041056310366424*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + (-82.709570550970663905045161941403067*b2*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y-16.541914110194132781009032388280613*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (232.96529038523403666587720613495197 + 71.681627810841242051039140349215992*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 10.240232544405891721577020049887999*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a; + return -.83545020758556226166712284789296028*b6*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((16.291279047918464102508895533912725 + 5.0127012455133735700027370873577615*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - .83545020758556226166712284789296028*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b5 + (22.557155604810181065012316893109926*b4*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((-97.747674287510784615053373203476350 - 30.076207473080241420016422524146569*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 7.5190518682700603550041056310366424*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b3 + (-82.709570550970663905045161941403067*b2*(3.2500000000000000000000000000000000 + (7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y) + ((107.52244171626186307655871052382399 + 33.083828220388265562018064776561226*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y - 16.541914110194132781009032388280613*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*b)*b + (232.96529038523403666587720613495197 + 71.681627810841242051039140349215992*(7.5000000000000000000000000000000000 + 4.2500000000000000000000000000000000*y)*y + 10.240232544405891721577020049887999*(8.5000000000000000000000000000000000*y + 7.5000000000000000000000000000000000)*a)*a)*a)*a)*a)*a)*a; } // number 66 inline double leg_f66(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b4 = b2*b2; double b6 = b4*b2; double b8 = b6*b2; - return .32612178450642258898018265094570013e-1*(.79720045437338092375232558872693519*b8 + (-9.5664054524805710850279070647232223*b6 + (31.569137993185884580592093313586634*b4 + (-39.085599420134904718828306007297737*b2 + 16.285666425056210299511794169707390*a2)*a2)*a2)*a2)*a*(1. + y); + return .32612178450642258898018265094570013e-1 * (.79720045437338092375232558872693519*b8 + (-9.5664054524805710850279070647232223*b6 + (31.569137993185884580592093313586634*b4 + (-39.085599420134904718828306007297737*b2 + 16.285666425056210299511794169707390*a2)*a2)*a2)*a2)*a*(1. + y); } inline double leg_f66_dx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7913,13 +7913,13 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .32612178450642258898018265094570013e-1*(1.5944009087467618475046511774538704*b8 + (-57.398432714883426510167442388339334*b6 + (315.69137993185884580592093313586634*b4 + (-547.19839188188866606359628410216831*b2 + 293.14199565101178539121229505473303*a2)*a2)*a2)*a2)*(1. + y); + return .32612178450642258898018265094570013e-1 * (1.5944009087467618475046511774538704*b8 + (-57.398432714883426510167442388339334*b6 + (315.69137993185884580592093313586634*b4 + (-547.19839188188866606359628410216831*b2 + 293.14199565101178539121229505473303*a2)*a2)*a2)*a2)*(1. + y); } inline double leg_f66_dy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7928,13 +7928,13 @@ namespace Hermes double b6 = b5*b; double b7 = b6*b; double b8 = b7*b; - return .25998443478957790700562193556377897e-1*b8*(1. + y) + ((-.20798754783166232560449754845102318-.20798754783166232560449754845102318*y + .25998443478957790700562193556377897e-1*b)*b7 + (-.93594396524248046522023896802960429*b6*(1. + y) + ((1.8718879304849609304404779360592086 + 1.8718879304849609304404779360592086*y-.31198132174749348840674632267653476*b)*b5 + (5.1476918088336425587113143241628238*b4*(1. + y) + ((-4.1181534470669140469690514593302588-4.1181534470669140469690514593302588*y + 1.0295383617667285117422628648325647*b)*b3 + (-8.9226658019783137684329448285488942*b2*(1. + y) + ((2.5493330862795182195522699510139698 + 2.5493330862795182195522699510139698*y-1.2746665431397591097761349755069849*b)*b + (4.7799995367740966616605061581511934 + 4.7799995367740966616605061581511934*y + .53111105964156629574005623979457703*a)*a)*a)*a)*a)*a)*a)*a)*a; + return .25998443478957790700562193556377897e-1 * b8*(1. + y) + ((-.20798754783166232560449754845102318 - .20798754783166232560449754845102318*y + .25998443478957790700562193556377897e-1 * b)*b7 + (-.93594396524248046522023896802960429*b6*(1. + y) + ((1.8718879304849609304404779360592086 + 1.8718879304849609304404779360592086*y - .31198132174749348840674632267653476*b)*b5 + (5.1476918088336425587113143241628238*b4*(1. + y) + ((-4.1181534470669140469690514593302588 - 4.1181534470669140469690514593302588*y + 1.0295383617667285117422628648325647*b)*b3 + (-8.9226658019783137684329448285488942*b2*(1. + y) + ((2.5493330862795182195522699510139698 + 2.5493330862795182195522699510139698*y - 1.2746665431397591097761349755069849*b)*b + (4.7799995367740966616605061581511934 + 4.7799995367740966616605061581511934*y + .53111105964156629574005623979457703*a)*a)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f66_dxx(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7942,13 +7942,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return .32612178450642258898018265094570013e-1*(-229.59373085953370604066976955335733*b6 + (2525.5310394548707664473674650869307*b4 + (-6566.3807025826639927631554092260198*b2 + 4690.2719304161885662593967208757284*a2)*a2)*a2)*a*(1. + y); + return .32612178450642258898018265094570013e-1 * (-229.59373085953370604066976955335733*b6 + (2525.5310394548707664473674650869307*b4 + (-6566.3807025826639927631554092260198*b2 + 4690.2719304161885662593967208757284*a2)*a2)*a2)*a*(1. + y); } inline double leg_f66_dyy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7956,13 +7956,13 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-.41597509566332465120899509690204634-.41597509566332465120899509690204634*y + .51996886957915581401124387112755795e-1*b)*b7 + ((-.41597509566332465120899509690204634-.41597509566332465120899509690204634*y-.41597509566332465120899509690204634*b)*b6 + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y-1.8718879304849609304404779360592086*b)*b5 + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y + 3.7437758609699218608809558721184173*b)*b4 + ((-41.181534470669140469690514593302588-41.181534470669140469690514593302588*y + 10.295383617667285117422628648325647*b)*b3 + ((-41.181534470669140469690514593302588-41.181534470669140469690514593302588*y-8.2363068941338280939381029186605177*b)*b2 + ((35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y-17.845331603956627536865889657097789*b)*b + (35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y + 5.0986661725590364391045399020279395*b + 9.5599990735481933233210123163023868*a)*a)*a)*a)*a)*a)*a)*a; + return (-.41597509566332465120899509690204634 - .41597509566332465120899509690204634*y + .51996886957915581401124387112755795e-1 * b)*b7 + ((-.41597509566332465120899509690204634 - .41597509566332465120899509690204634*y - .41597509566332465120899509690204634*b)*b6 + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y - 1.8718879304849609304404779360592086*b)*b5 + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y + 3.7437758609699218608809558721184173*b)*b4 + ((-41.181534470669140469690514593302588 - 41.181534470669140469690514593302588*y + 10.295383617667285117422628648325647*b)*b3 + ((-41.181534470669140469690514593302588 - 41.181534470669140469690514593302588*y - 8.2363068941338280939381029186605177*b)*b2 + ((35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y - 17.845331603956627536865889657097789*b)*b + (35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y + 5.0986661725590364391045399020279395*b + 9.5599990735481933233210123163023868*a)*a)*a)*a)*a)*a)*a)*a; } inline double leg_f66_dxy(double x, double y) { double a = 1.0 + 2.0*x + y; - double b = 1.0-y; + double b = 1.0 - y; double a2 = a*a; double b2 = b*b; double b3 = b2*b; @@ -7970,136 +7970,136 @@ namespace Hermes double b5 = b4*b; double b6 = b5*b; double b7 = b6*b; - return (-.41597509566332465120899509690204634-.41597509566332465120899509690204634*y + .51996886957915581401124387112755795e-1*b)*b7+ - (-3.7437758609699218608809558721184173*b6*(1. + y) + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y- - 1.8718879304849609304404779360592086*b)*b5 + (41.181534470669140469690514593302588*b4*(1. + y) + ((-41.181534470669140469690514593302588- - 41.181534470669140469690514593302588*y + 10.295383617667285117422628648325647*b)*b3 + (-107.07198962373976522119533794258673*b2*(1. + y)+ - ((35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y-17.845331603956627536865889657097789*b)*b+ - (76.479992588385546586568098530419093 + 76.479992588385546586568098530419093*y+ - 9.5599990735481933233210123163023868*a)*a)*a)*a)*a)*a)*a)*a; + return (-.41597509566332465120899509690204634 - .41597509566332465120899509690204634*y + .51996886957915581401124387112755795e-1 * b)*b7 + + (-3.7437758609699218608809558721184173*b6*(1. + y) + ((11.231327582909765582642867616355252 + 11.231327582909765582642867616355252*y - + 1.8718879304849609304404779360592086*b)*b5 + (41.181534470669140469690514593302588*b4*(1. + y) + ((-41.181534470669140469690514593302588 - + 41.181534470669140469690514593302588*y + 10.295383617667285117422628648325647*b)*b3 + (-107.07198962373976522119533794258673*b2*(1. + y) + + ((35.690663207913255073731779314195579 + 35.690663207913255073731779314195579*y - 17.845331603956627536865889657097789*b)*b + + (76.479992588385546586568098530419093 + 76.479992588385546586568098530419093*y + + 9.5599990735481933233210123163023868*a)*a)*a)*a)*a)*a)*a)*a; } static Shapeset::shape_fn_t leg_tri_fn[] = { - leg_tri_l0_l0, leg_f1, leg_f2, leg_f3, leg_f4, leg_f5, leg_f6, leg_f7_0, - leg_f8_0, leg_f9_0, leg_f10, leg_f11, - leg_f12, leg_f13, leg_f14, leg_f15, leg_f16_0, leg_f17_0, - leg_f18_0, leg_f19, leg_f20, leg_f21, leg_f22, - leg_f23, leg_f24, leg_f25, leg_f26, leg_f27, leg_f28, leg_f29_0, - leg_f30_0, leg_f31_0, leg_f32, leg_f33, - leg_f34, leg_f35, leg_f36, leg_f37, leg_f38, leg_f39, leg_f40, - leg_f41, leg_f42, leg_f43, leg_f44, leg_f45, leg_f46_0, - leg_f47_0, leg_f48_0, leg_f49, leg_f50, leg_f51, - leg_f52, leg_f53, leg_f54, leg_f55, leg_f56, leg_f57, leg_f58, - leg_f59, leg_f60, leg_f61, leg_f62, leg_f63, leg_f64, leg_f65, + leg_tri_l0_l0, leg_f1, leg_f2, leg_f3, leg_f4, leg_f5, leg_f6, leg_f7_0, + leg_f8_0, leg_f9_0, leg_f10, leg_f11, + leg_f12, leg_f13, leg_f14, leg_f15, leg_f16_0, leg_f17_0, + leg_f18_0, leg_f19, leg_f20, leg_f21, leg_f22, + leg_f23, leg_f24, leg_f25, leg_f26, leg_f27, leg_f28, leg_f29_0, + leg_f30_0, leg_f31_0, leg_f32, leg_f33, + leg_f34, leg_f35, leg_f36, leg_f37, leg_f38, leg_f39, leg_f40, + leg_f41, leg_f42, leg_f43, leg_f44, leg_f45, leg_f46_0, + leg_f47_0, leg_f48_0, leg_f49, leg_f50, leg_f51, + leg_f52, leg_f53, leg_f54, leg_f55, leg_f56, leg_f57, leg_f58, + leg_f59, leg_f60, leg_f61, leg_f62, leg_f63, leg_f64, leg_f65, leg_f66 }; static Shapeset::shape_fn_t leg_tri_fn_dx[] = { - leg_tri_l0_l0x, leg_f1_dx, leg_f2_dx, leg_f3_dx, leg_f4_dx, leg_f5_dx, leg_f6_dx, leg_f7_dx_0, - leg_f8_dx_0, leg_f9_dx_0, leg_f10_dx, leg_f11_dx, - leg_f12_dx, leg_f13_dx, leg_f14_dx, leg_f15_dx, leg_f16_dx_0, leg_f17_dx_0, - leg_f18_dx_0, leg_f19_dx, leg_f20_dx, leg_f21_dx, leg_f22_dx, - leg_f23_dx, leg_f24_dx, leg_f25_dx, leg_f26_dx, leg_f27_dx, leg_f28_dx, leg_f29_dx_0, - leg_f30_dx_0, leg_f31_dx_0, leg_f32_dx, leg_f33_dx, - leg_f34_dx, leg_f35_dx, leg_f36_dx, leg_f37_dx, leg_f38_dx, leg_f39_dx, leg_f40_dx, - leg_f41_dx, leg_f42_dx, leg_f43_dx, leg_f44_dx, leg_f45_dx, leg_f46_dx_0, - leg_f47_dx_0, leg_f48_dx_0, leg_f49_dx, leg_f50_dx, leg_f51_dx, - leg_f52_dx, leg_f53_dx, leg_f54_dx, leg_f55_dx, leg_f56_dx, leg_f57_dx, leg_f58_dx, - leg_f59_dx, leg_f60_dx, leg_f61_dx, leg_f62_dx, leg_f63_dx, leg_f64_dx, leg_f65_dx, + leg_tri_l0_l0x, leg_f1_dx, leg_f2_dx, leg_f3_dx, leg_f4_dx, leg_f5_dx, leg_f6_dx, leg_f7_dx_0, + leg_f8_dx_0, leg_f9_dx_0, leg_f10_dx, leg_f11_dx, + leg_f12_dx, leg_f13_dx, leg_f14_dx, leg_f15_dx, leg_f16_dx_0, leg_f17_dx_0, + leg_f18_dx_0, leg_f19_dx, leg_f20_dx, leg_f21_dx, leg_f22_dx, + leg_f23_dx, leg_f24_dx, leg_f25_dx, leg_f26_dx, leg_f27_dx, leg_f28_dx, leg_f29_dx_0, + leg_f30_dx_0, leg_f31_dx_0, leg_f32_dx, leg_f33_dx, + leg_f34_dx, leg_f35_dx, leg_f36_dx, leg_f37_dx, leg_f38_dx, leg_f39_dx, leg_f40_dx, + leg_f41_dx, leg_f42_dx, leg_f43_dx, leg_f44_dx, leg_f45_dx, leg_f46_dx_0, + leg_f47_dx_0, leg_f48_dx_0, leg_f49_dx, leg_f50_dx, leg_f51_dx, + leg_f52_dx, leg_f53_dx, leg_f54_dx, leg_f55_dx, leg_f56_dx, leg_f57_dx, leg_f58_dx, + leg_f59_dx, leg_f60_dx, leg_f61_dx, leg_f62_dx, leg_f63_dx, leg_f64_dx, leg_f65_dx, leg_f66_dx }; static Shapeset::shape_fn_t leg_tri_fn_dy[] = { - leg_tri_l0_l0y, leg_f1_dy, leg_f2_dy, leg_f3_dy, leg_f4_dy, leg_f5_dy, leg_f6_dy, leg_f7_dy_0, - leg_f8_dy_0, leg_f9_dy_0, leg_f10_dy, leg_f11_dy, - leg_f12_dy, leg_f13_dy, leg_f14_dy, leg_f15_dy, leg_f16_dy_0, leg_f17_dy_0, - leg_f18_dy_0, leg_f19_dy, leg_f20_dy, leg_f21_dy, leg_f22_dy, - leg_f23_dy, leg_f24_dy, leg_f25_dy, leg_f26_dy, leg_f27_dy, leg_f28_dy, leg_f29_dy_0, - leg_f30_dy_0, leg_f31_dy_0, leg_f32_dy, leg_f33_dy, - leg_f34_dy, leg_f35_dy, leg_f36_dy, leg_f37_dy, leg_f38_dy, leg_f39_dy, leg_f40_dy, - leg_f41_dy, leg_f42_dy, leg_f43_dy, leg_f44_dy, leg_f45_dy, leg_f46_dy_0, - leg_f47_dy_0, leg_f48_dy_0, leg_f49_dy, leg_f50_dy, leg_f51_dy, - leg_f52_dy, leg_f53_dy, leg_f54_dy, leg_f55_dy, leg_f56_dy, leg_f57_dy, leg_f58_dy, - leg_f59_dy, leg_f60_dy, leg_f61_dy, leg_f62_dy, leg_f63_dy, leg_f64_dy, leg_f65_dy, + leg_tri_l0_l0y, leg_f1_dy, leg_f2_dy, leg_f3_dy, leg_f4_dy, leg_f5_dy, leg_f6_dy, leg_f7_dy_0, + leg_f8_dy_0, leg_f9_dy_0, leg_f10_dy, leg_f11_dy, + leg_f12_dy, leg_f13_dy, leg_f14_dy, leg_f15_dy, leg_f16_dy_0, leg_f17_dy_0, + leg_f18_dy_0, leg_f19_dy, leg_f20_dy, leg_f21_dy, leg_f22_dy, + leg_f23_dy, leg_f24_dy, leg_f25_dy, leg_f26_dy, leg_f27_dy, leg_f28_dy, leg_f29_dy_0, + leg_f30_dy_0, leg_f31_dy_0, leg_f32_dy, leg_f33_dy, + leg_f34_dy, leg_f35_dy, leg_f36_dy, leg_f37_dy, leg_f38_dy, leg_f39_dy, leg_f40_dy, + leg_f41_dy, leg_f42_dy, leg_f43_dy, leg_f44_dy, leg_f45_dy, leg_f46_dy_0, + leg_f47_dy_0, leg_f48_dy_0, leg_f49_dy, leg_f50_dy, leg_f51_dy, + leg_f52_dy, leg_f53_dy, leg_f54_dy, leg_f55_dy, leg_f56_dy, leg_f57_dy, leg_f58_dy, + leg_f59_dy, leg_f60_dy, leg_f61_dy, leg_f62_dy, leg_f63_dy, leg_f64_dy, leg_f65_dy, leg_f66_dy }; static Shapeset::shape_fn_t leg_tri_fn_dxx[] = { - leg_tri_l0_l0xx, leg_f1_dxx, leg_f2_dxx, leg_f3_dxx, leg_f4_dxx, leg_f5_dxx, leg_f6_dxx, leg_f7_dxx_0, - leg_f7_dxx_1, leg_f8_dxx_0, leg_f8_dxx_1, leg_f9_dxx_0, leg_f9_dxx_1, leg_f10_dxx, leg_f11_dxx, - leg_f12_dxx, leg_f13_dxx, leg_f14_dxx, leg_f15_dxx, leg_f16_dxx_0, leg_f16_dxx_1, leg_f17_dxx_0, - leg_f17_dxx_1, leg_f18_dxx_0, leg_f18_dxx_1, leg_f19_dxx, leg_f20_dxx, leg_f21_dxx, leg_f22_dxx, - leg_f23_dxx, leg_f24_dxx, leg_f25_dxx, leg_f26_dxx, leg_f27_dxx, leg_f28_dxx, leg_f29_dxx_0, - leg_f29_dxx_1, leg_f30_dxx_0, leg_f30_dxx_1, leg_f31_dxx_0, leg_f31_dxx_1, leg_f32_dxx, leg_f33_dxx, - leg_f34_dxx, leg_f35_dxx, leg_f36_dxx, leg_f37_dxx, leg_f38_dxx, leg_f39_dxx, leg_f40_dxx, - leg_f41_dxx, leg_f42_dxx, leg_f43_dxx, leg_f44_dxx, leg_f45_dxx, leg_f46_dxx_0, leg_f46_dxx_1, - leg_f47_dxx_0, leg_f47_dxx_1, leg_f48_dxx_0, leg_f48_dxx_1, leg_f49_dxx, leg_f50_dxx, leg_f51_dxx, - leg_f52_dxx, leg_f53_dxx, leg_f54_dxx, leg_f55_dxx, leg_f56_dxx, leg_f57_dxx, leg_f58_dxx, - leg_f59_dxx, leg_f60_dxx, leg_f61_dxx, leg_f62_dxx, leg_f63_dxx, leg_f64_dxx, leg_f65_dxx, + leg_tri_l0_l0xx, leg_f1_dxx, leg_f2_dxx, leg_f3_dxx, leg_f4_dxx, leg_f5_dxx, leg_f6_dxx, leg_f7_dxx_0, + leg_f7_dxx_1, leg_f8_dxx_0, leg_f8_dxx_1, leg_f9_dxx_0, leg_f9_dxx_1, leg_f10_dxx, leg_f11_dxx, + leg_f12_dxx, leg_f13_dxx, leg_f14_dxx, leg_f15_dxx, leg_f16_dxx_0, leg_f16_dxx_1, leg_f17_dxx_0, + leg_f17_dxx_1, leg_f18_dxx_0, leg_f18_dxx_1, leg_f19_dxx, leg_f20_dxx, leg_f21_dxx, leg_f22_dxx, + leg_f23_dxx, leg_f24_dxx, leg_f25_dxx, leg_f26_dxx, leg_f27_dxx, leg_f28_dxx, leg_f29_dxx_0, + leg_f29_dxx_1, leg_f30_dxx_0, leg_f30_dxx_1, leg_f31_dxx_0, leg_f31_dxx_1, leg_f32_dxx, leg_f33_dxx, + leg_f34_dxx, leg_f35_dxx, leg_f36_dxx, leg_f37_dxx, leg_f38_dxx, leg_f39_dxx, leg_f40_dxx, + leg_f41_dxx, leg_f42_dxx, leg_f43_dxx, leg_f44_dxx, leg_f45_dxx, leg_f46_dxx_0, leg_f46_dxx_1, + leg_f47_dxx_0, leg_f47_dxx_1, leg_f48_dxx_0, leg_f48_dxx_1, leg_f49_dxx, leg_f50_dxx, leg_f51_dxx, + leg_f52_dxx, leg_f53_dxx, leg_f54_dxx, leg_f55_dxx, leg_f56_dxx, leg_f57_dxx, leg_f58_dxx, + leg_f59_dxx, leg_f60_dxx, leg_f61_dxx, leg_f62_dxx, leg_f63_dxx, leg_f64_dxx, leg_f65_dxx, leg_f66_dxx }; static Shapeset::shape_fn_t leg_tri_fn_dxy[] = { - leg_tri_l0_l0xy, leg_f1_dxy, leg_f2_dxy, leg_f3_dxy, leg_f4_dxy, leg_f5_dxy, leg_f6_dxy, leg_f7_dxy_0, - leg_f7_dxy_1, leg_f8_dxy_0, leg_f8_dxy_1, leg_f9_dxy_0, leg_f9_dxy_1, leg_f10_dxy, leg_f11_dxy, - leg_f12_dxy, leg_f13_dxy, leg_f14_dxy, leg_f15_dxy, leg_f16_dxy_0, leg_f16_dxy_1, leg_f17_dxy_0, - leg_f17_dxy_1, leg_f18_dxy_0, leg_f18_dxy_1, leg_f19_dxy, leg_f20_dxy, leg_f21_dxy, leg_f22_dxy, - leg_f23_dxy, leg_f24_dxy, leg_f25_dxy, leg_f26_dxy, leg_f27_dxy, leg_f28_dxy, leg_f29_dxy_0, - leg_f29_dxy_1, leg_f30_dxy_0, leg_f30_dxy_1, leg_f31_dxy_0, leg_f31_dxy_1, leg_f32_dxy, leg_f33_dxy, - leg_f34_dxy, leg_f35_dxy, leg_f36_dxy, leg_f37_dxy, leg_f38_dxy, leg_f39_dxy, leg_f40_dxy, - leg_f41_dxy, leg_f42_dxy, leg_f43_dxy, leg_f44_dxy, leg_f45_dxy, leg_f46_dxy_0, leg_f46_dxy_1, - leg_f47_dxy_0, leg_f47_dxy_1, leg_f48_dxy_0, leg_f48_dxy_1, leg_f49_dxy, leg_f50_dxy, leg_f51_dxy, - leg_f52_dxy, leg_f53_dxy, leg_f54_dxy, leg_f55_dxy, leg_f56_dxy, leg_f57_dxy, leg_f58_dxy, - leg_f59_dxy, leg_f60_dxy, leg_f61_dxy, leg_f62_dxy, leg_f63_dxy, leg_f64_dxy, leg_f65_dxy, + leg_tri_l0_l0xy, leg_f1_dxy, leg_f2_dxy, leg_f3_dxy, leg_f4_dxy, leg_f5_dxy, leg_f6_dxy, leg_f7_dxy_0, + leg_f7_dxy_1, leg_f8_dxy_0, leg_f8_dxy_1, leg_f9_dxy_0, leg_f9_dxy_1, leg_f10_dxy, leg_f11_dxy, + leg_f12_dxy, leg_f13_dxy, leg_f14_dxy, leg_f15_dxy, leg_f16_dxy_0, leg_f16_dxy_1, leg_f17_dxy_0, + leg_f17_dxy_1, leg_f18_dxy_0, leg_f18_dxy_1, leg_f19_dxy, leg_f20_dxy, leg_f21_dxy, leg_f22_dxy, + leg_f23_dxy, leg_f24_dxy, leg_f25_dxy, leg_f26_dxy, leg_f27_dxy, leg_f28_dxy, leg_f29_dxy_0, + leg_f29_dxy_1, leg_f30_dxy_0, leg_f30_dxy_1, leg_f31_dxy_0, leg_f31_dxy_1, leg_f32_dxy, leg_f33_dxy, + leg_f34_dxy, leg_f35_dxy, leg_f36_dxy, leg_f37_dxy, leg_f38_dxy, leg_f39_dxy, leg_f40_dxy, + leg_f41_dxy, leg_f42_dxy, leg_f43_dxy, leg_f44_dxy, leg_f45_dxy, leg_f46_dxy_0, leg_f46_dxy_1, + leg_f47_dxy_0, leg_f47_dxy_1, leg_f48_dxy_0, leg_f48_dxy_1, leg_f49_dxy, leg_f50_dxy, leg_f51_dxy, + leg_f52_dxy, leg_f53_dxy, leg_f54_dxy, leg_f55_dxy, leg_f56_dxy, leg_f57_dxy, leg_f58_dxy, + leg_f59_dxy, leg_f60_dxy, leg_f61_dxy, leg_f62_dxy, leg_f63_dxy, leg_f64_dxy, leg_f65_dxy, leg_f66_dxy }; static Shapeset::shape_fn_t leg_tri_fn_dyy[] = { - leg_tri_l0_l0yy, leg_f1_dyy, leg_f2_dyy, leg_f3_dyy, leg_f4_dyy, leg_f5_dyy, leg_f6_dyy, leg_f7_dyy_0, - leg_f7_dyy_1, leg_f8_dyy_0, leg_f8_dyy_1, leg_f9_dyy_0, leg_f9_dyy_1, leg_f10_dyy, leg_f11_dyy, - leg_f12_dyy, leg_f13_dyy, leg_f14_dyy, leg_f15_dyy, leg_f16_dyy_0, leg_f16_dyy_1, leg_f17_dyy_0, - leg_f17_dyy_1, leg_f18_dyy_0, leg_f18_dyy_1, leg_f19_dyy, leg_f20_dyy, leg_f21_dyy, leg_f22_dyy, - leg_f23_dyy, leg_f24_dyy, leg_f25_dyy, leg_f26_dyy, leg_f27_dyy, leg_f28_dyy, leg_f29_dyy_0, - leg_f29_dyy_1, leg_f30_dyy_0, leg_f30_dyy_1, leg_f31_dyy_0, leg_f31_dyy_1, leg_f32_dyy, leg_f33_dyy, - leg_f34_dyy, leg_f35_dyy, leg_f36_dyy, leg_f37_dyy, leg_f38_dyy, leg_f39_dyy, leg_f40_dyy, - leg_f41_dyy, leg_f42_dyy, leg_f43_dyy, leg_f44_dyy, leg_f45_dyy, leg_f46_dyy_0, leg_f46_dyy_1, - leg_f47_dyy_0, leg_f47_dyy_1, leg_f48_dyy_0, leg_f48_dyy_1, leg_f49_dyy, leg_f50_dyy, leg_f51_dyy, - leg_f52_dyy, leg_f53_dyy, leg_f54_dyy, leg_f55_dyy, leg_f56_dyy, leg_f57_dyy, leg_f58_dyy, - leg_f59_dyy, leg_f60_dyy, leg_f61_dyy, leg_f62_dyy, leg_f63_dyy, leg_f64_dyy, leg_f65_dyy, + leg_tri_l0_l0yy, leg_f1_dyy, leg_f2_dyy, leg_f3_dyy, leg_f4_dyy, leg_f5_dyy, leg_f6_dyy, leg_f7_dyy_0, + leg_f7_dyy_1, leg_f8_dyy_0, leg_f8_dyy_1, leg_f9_dyy_0, leg_f9_dyy_1, leg_f10_dyy, leg_f11_dyy, + leg_f12_dyy, leg_f13_dyy, leg_f14_dyy, leg_f15_dyy, leg_f16_dyy_0, leg_f16_dyy_1, leg_f17_dyy_0, + leg_f17_dyy_1, leg_f18_dyy_0, leg_f18_dyy_1, leg_f19_dyy, leg_f20_dyy, leg_f21_dyy, leg_f22_dyy, + leg_f23_dyy, leg_f24_dyy, leg_f25_dyy, leg_f26_dyy, leg_f27_dyy, leg_f28_dyy, leg_f29_dyy_0, + leg_f29_dyy_1, leg_f30_dyy_0, leg_f30_dyy_1, leg_f31_dyy_0, leg_f31_dyy_1, leg_f32_dyy, leg_f33_dyy, + leg_f34_dyy, leg_f35_dyy, leg_f36_dyy, leg_f37_dyy, leg_f38_dyy, leg_f39_dyy, leg_f40_dyy, + leg_f41_dyy, leg_f42_dyy, leg_f43_dyy, leg_f44_dyy, leg_f45_dyy, leg_f46_dyy_0, leg_f46_dyy_1, + leg_f47_dyy_0, leg_f47_dyy_1, leg_f48_dyy_0, leg_f48_dyy_1, leg_f49_dyy, leg_f50_dyy, leg_f51_dyy, + leg_f52_dyy, leg_f53_dyy, leg_f54_dyy, leg_f55_dyy, leg_f56_dyy, leg_f57_dyy, leg_f58_dyy, + leg_f59_dyy, leg_f60_dyy, leg_f61_dyy, leg_f62_dyy, leg_f63_dyy, leg_f64_dyy, leg_f65_dyy, leg_f66_dyy }; - Shapeset::shape_fn_t* leg_tri_shape_fn_table[1] = { leg_tri_fn }; - Shapeset::shape_fn_t* leg_tri_shape_fn_table_dx[1] = { leg_tri_fn_dx }; - Shapeset::shape_fn_t* leg_tri_shape_fn_table_dy[1] = { leg_tri_fn_dy }; - Shapeset::shape_fn_t* leg_tri_shape_fn_table_dxx[1] = { leg_tri_fn_dxx }; - Shapeset::shape_fn_t* leg_tri_shape_fn_table_dxy[1] = { leg_tri_fn_dxy }; - Shapeset::shape_fn_t* leg_tri_shape_fn_table_dyy[1] = { leg_tri_fn_dyy }; - - static int qb_0[] = { 0, }; - static int qb_1[] = { 1, 2, 3, }; - static int qb_2[] = { 1, 2, 3, 4, 5, 6, }; - static int qb_3[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - static int qb_4[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, }; - static int qb_5[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, }; - static int qb_6[] = { 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, }; - static int qb_7[] = { 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 }; - static int qb_8[] = { 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, }; - static int qb_9[] = { 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 }; - static int qb_10[] = { 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 }; - - int* leg_tri_bubble_indices[11] = { qb_0, qb_1, qb_2, qb_3, qb_4, qb_5, qb_6, qb_7, qb_8, qb_9, qb_10 }; - - int leg_tri_bubble_count[11] = { 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66 }; - - int leg_tri_vertex_indices[4] = { -1, -1, -1, -1 }; - - static int leg_tri_edge_indices_0[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - static int leg_tri_edge_indices_1[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - static int leg_tri_edge_indices_2[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - static int leg_tri_edge_indices_3[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - - int* leg_tri_edge_indices[4] = + Shapeset::shape_fn_t* leg_tri_shape_fn_table[1] = { leg_tri_fn }; + Shapeset::shape_fn_t* leg_tri_shape_fn_table_dx[1] = { leg_tri_fn_dx }; + Shapeset::shape_fn_t* leg_tri_shape_fn_table_dy[1] = { leg_tri_fn_dy }; + Shapeset::shape_fn_t* leg_tri_shape_fn_table_dxx[1] = { leg_tri_fn_dxx }; + Shapeset::shape_fn_t* leg_tri_shape_fn_table_dxy[1] = { leg_tri_fn_dxy }; + Shapeset::shape_fn_t* leg_tri_shape_fn_table_dyy[1] = { leg_tri_fn_dyy }; + + static short qb_0[] = { 0, }; + static short qb_1[] = { 1, 2, 3, }; + static short qb_2[] = { 1, 2, 3, 4, 5, 6, }; + static short qb_3[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + static short qb_4[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, }; + static short qb_5[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, }; + static short qb_6[] = { 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, }; + static short qb_7[] = { 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 }; + static short qb_8[] = { 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, }; + static short qb_9[] = { 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 }; + static short qb_10[] = { 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 }; + + short* leg_tri_bubble_indices[11] = { qb_0, qb_1, qb_2, qb_3, qb_4, qb_5, qb_6, qb_7, qb_8, qb_9, qb_10 }; + + unsigned short leg_tri_bubble_count[11] = { 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66 }; + + short leg_tri_vertex_indices[4] = { -1, -1, -1, -1 }; + + static short leg_tri_edge_indices_0[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short leg_tri_edge_indices_1[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short leg_tri_edge_indices_2[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short leg_tri_edge_indices_3[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + + short* leg_tri_edge_indices[4] = { leg_tri_edge_indices_0, leg_tri_edge_indices_1, @@ -8107,18 +8107,18 @@ namespace Hermes leg_tri_edge_indices_3 }; - int leg_tri_index_to_order[] = + unsigned short leg_tri_index_to_order[] = { - 0, - 1, 1, 1, - 2, 2, 2, - 3, 3, 3, 3, + 0, + 1, 1, 1, + 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }; @@ -8160,37 +8160,37 @@ namespace Hermes leg_quad_shape_fn_table_dxy }; - static int* leg_vertex_indices[2] = + static short* leg_vertex_indices[2] = { leg_tri_vertex_indices, leg_quad_vertex_indices }; - static int** leg_edge_indices[2] = + static short** leg_edge_indices[2] = { leg_tri_edge_indices, leg_quad_edge_indices }; - static int** leg_bubble_indices[2] = + static short** leg_bubble_indices[2] = { leg_tri_bubble_indices, leg_quad_bubble_indices }; - static int* leg_bubble_count[2] = + static unsigned short* leg_bubble_count[2] = { leg_tri_bubble_count, leg_quad_bubble_count }; - static int* leg_index_to_order[2] = + static unsigned short* leg_index_to_order[2] = { leg_tri_index_to_order, leg_quad_index_to_order }; - int L2ShapesetLegendre::get_max_index(ElementMode2D mode) const { return max_index[mode]; } + unsigned short L2ShapesetLegendre::get_max_index(ElementMode2D mode) const { return max_index[mode]; } L2ShapesetLegendre::L2ShapesetLegendre() { @@ -8209,19 +8209,19 @@ namespace Hermes ref_vert[0][0][0] = -1.0; ref_vert[0][0][1] = -1.0; - ref_vert[0][1][0] = 1.0; + ref_vert[0][1][0] = 1.0; ref_vert[0][1][1] = -1.0; ref_vert[0][2][0] = -1.0; - ref_vert[0][2][1] = 1.0; + ref_vert[0][2][1] = 1.0; ref_vert[1][0][0] = -1.0; ref_vert[1][0][1] = -1.0; - ref_vert[1][1][0] = 1.0; + ref_vert[1][1][0] = 1.0; ref_vert[1][1][1] = -1.0; - ref_vert[1][2][0] = 1.0; - ref_vert[1][2][1] = 1.0; + ref_vert[1][2][0] = 1.0; + ref_vert[1][2][1] = 1.0; ref_vert[1][3][0] = -1.0; - ref_vert[1][3][1] = 1.0; + ref_vert[1][3][1] = 1.0; max_order = 10; min_order = 0; @@ -8231,7 +8231,7 @@ namespace Hermes comb_table = nullptr; } - - const int L2ShapesetLegendre::max_index[2] = { 66, 120 }; + + const unsigned short L2ShapesetLegendre::max_index[2] = { 66, 120 }; } } \ No newline at end of file diff --git a/hermes2d/src/shapeset/shapeset_l2_taylor.cpp b/hermes2d/src/shapeset/shapeset_l2_taylor.cpp index 79e8e39184..0987b8c314 100644 --- a/hermes2d/src/shapeset/shapeset_l2_taylor.cpp +++ b/hermes2d/src/shapeset/shapeset_l2_taylor.cpp @@ -22,7 +22,6 @@ namespace Hermes { namespace Hermes2D { - #define minus_triangle_x_c 0.3333333333333333333333333 #define minus_triangle_y_c 0.3333333333333333333333333 @@ -317,36 +316,36 @@ namespace Hermes taylor_dyy_0, taylor_dyy_1, taylor_dyy_2, taylor_dyy_3, taylor_dyy_4, taylor_dyy_5 }; - Shapeset::shape_fn_t* shape_fn_table_tri[1] = { fn_tri }; - Shapeset::shape_fn_t* shape_fn_table_quad[1] = { fn_quad }; - Shapeset::shape_fn_t* shape_fn_table_dx_tri[1] = { dx_tri }; - Shapeset::shape_fn_t* shape_fn_table_dx_quad[1] = { dx_quad }; - Shapeset::shape_fn_t* shape_fn_table_dy_tri[1] = { dy_tri }; - Shapeset::shape_fn_t* shape_fn_table_dy_quad[1] = { dy_quad }; - Shapeset::shape_fn_t* mode_shape_fn_table_dxx[1] = { fn_dxx }; - Shapeset::shape_fn_t* mode_shape_fn_table_dxy[1] = { fn_dxy }; - Shapeset::shape_fn_t* mode_shape_fn_table_dyy[1] = { fn_dyy }; + Shapeset::shape_fn_t* shape_fn_table_tri[1] = { fn_tri }; + Shapeset::shape_fn_t* shape_fn_table_quad[1] = { fn_quad }; + Shapeset::shape_fn_t* shape_fn_table_dx_tri[1] = { dx_tri }; + Shapeset::shape_fn_t* shape_fn_table_dx_quad[1] = { dx_quad }; + Shapeset::shape_fn_t* shape_fn_table_dy_tri[1] = { dy_tri }; + Shapeset::shape_fn_t* shape_fn_table_dy_quad[1] = { dy_quad }; + Shapeset::shape_fn_t* mode_shape_fn_table_dxx[1] = { fn_dxx }; + Shapeset::shape_fn_t* mode_shape_fn_table_dxy[1] = { fn_dxy }; + Shapeset::shape_fn_t* mode_shape_fn_table_dyy[1] = { fn_dyy }; - static int qb_0[] = { 0, }; - static int qb_1_contains_means[] = { 0, 1, 2, }; - static int qb_1[] = { 1, 2, }; - static int qb_2_contains_means[] = { 0, 1, 2, 3, 4, 5 }; - static int qb_2[] = { 1, 2, 3, 4, 5 }; + static short qb_0[] = { 0, }; + static short qb_1_contains_means[] = { 0, 1, 2, }; + static short qb_1[] = { 1, 2, }; + static short qb_2_contains_means[] = { 0, 1, 2, 3, 4, 5 }; + static short qb_2[] = { 1, 2, 3, 4, 5 }; - int* mode_bubble_indices_contains_means[3] = { qb_0, qb_1_contains_means, qb_2_contains_means }; - int* mode_bubble_indices[3] = { qb_0, qb_1, qb_2 }; + short* mode_bubble_indices_contains_means[3] = { qb_0, qb_1_contains_means, qb_2_contains_means }; + short* mode_bubble_indices[3] = { qb_0, qb_1, qb_2 }; - int mode_bubble_count_contains_means[3] = { 1, 3, 6 }; - int mode_bubble_count[3] = { 1, 2, 5 }; + unsigned short mode_bubble_count_contains_means[3] = { 1, 3, 6 }; + unsigned short mode_bubble_count[3] = { 1, 2, 5 }; - int mode_vertex_indices[4] = { -1, -1, -1, -1 }; + short mode_vertex_indices[4] = { -1, -1, -1, -1 }; - static int edge_indices_0[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - static int edge_indices_1[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - static int edge_indices_2[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - static int edge_indices_3[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short edge_indices_0[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short edge_indices_1[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short edge_indices_2[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + static short edge_indices_3[22] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - int* mode_edge_indices[4] = + short* mode_edge_indices[4] = { edge_indices_0, edge_indices_1, @@ -354,7 +353,7 @@ namespace Hermes edge_indices_3 }; - int mode_index_to_order[] = + unsigned short mode_index_to_order[] = { 0, 1, 1, 2, 2, 2 }; @@ -395,43 +394,43 @@ namespace Hermes mode_shape_fn_table_dxy }; - static int* s_vertex_indices[2] = + static short* s_vertex_indices[2] = { mode_vertex_indices, mode_vertex_indices }; - static int** s_edge_indices[2] = + static short** s_edge_indices[2] = { mode_edge_indices, mode_edge_indices }; - static int** s_bubble_indices_contains_means[2] = + static short** s_bubble_indices_contains_means[2] = { mode_bubble_indices_contains_means, mode_bubble_indices_contains_means }; - static int** s_bubble_indices[2] = + static short** s_bubble_indices[2] = { mode_bubble_indices, mode_bubble_indices }; - static int* s_bubble_count_contains_means[2] = + static unsigned short* s_bubble_count_contains_means[2] = { mode_bubble_count_contains_means, mode_bubble_count_contains_means }; - static int* s_bubble_count[2] = + static unsigned short* s_bubble_count[2] = { mode_bubble_count, mode_bubble_count }; - static int* s_index_to_order[2] = + static unsigned short* s_index_to_order[2] = { mode_index_to_order, mode_index_to_order @@ -448,12 +447,12 @@ namespace Hermes vertex_indices = s_vertex_indices; edge_indices = s_edge_indices; - if(contains_means) + if (contains_means) bubble_indices = s_bubble_indices_contains_means; else bubble_indices = s_bubble_indices; - if(contains_means) + if (contains_means) bubble_count = s_bubble_count_contains_means; else bubble_count = s_bubble_count; @@ -462,19 +461,19 @@ namespace Hermes ref_vert[0][0][0] = -1.0; ref_vert[0][0][1] = -1.0; - ref_vert[0][1][0] = 1.0; + ref_vert[0][1][0] = 1.0; ref_vert[0][1][1] = -1.0; ref_vert[0][2][0] = -1.0; - ref_vert[0][2][1] = 1.0; + ref_vert[0][2][1] = 1.0; ref_vert[1][0][0] = -1.0; ref_vert[1][0][1] = -1.0; - ref_vert[1][1][0] = 1.0; + ref_vert[1][1][0] = 1.0; ref_vert[1][1][1] = -1.0; - ref_vert[1][2][0] = 1.0; - ref_vert[1][2][1] = 1.0; + ref_vert[1][2][0] = 1.0; + ref_vert[1][2][1] = 1.0; ref_vert[1][3][0] = -1.0; - ref_vert[1][3][1] = 1.0; + ref_vert[1][3][1] = 1.0; max_order = 2; min_order = 0; @@ -485,9 +484,9 @@ namespace Hermes comb_table = nullptr; } - int* L2ShapesetTaylor::get_bubble_indices(int order, ElementMode2D mode) const + short* L2ShapesetTaylor::get_bubble_indices(unsigned short order, ElementMode2D mode) const { - if(mode == HERMES_MODE_QUAD) + if (mode == HERMES_MODE_QUAD) { assert(H2D_GET_V_ORDER(order) == H2D_GET_H_ORDER(order)); return bubble_indices[mode][H2D_GET_V_ORDER(order)]; @@ -496,9 +495,9 @@ namespace Hermes return Shapeset::get_bubble_indices(order, mode); } - int L2ShapesetTaylor::get_num_bubbles(int order, ElementMode2D mode) const + unsigned short L2ShapesetTaylor::get_num_bubbles(unsigned short order, ElementMode2D mode) const { - if(mode == HERMES_MODE_QUAD) + if (mode == HERMES_MODE_QUAD) { assert(H2D_GET_V_ORDER(order) == H2D_GET_H_ORDER(order)); return bubble_count[mode][H2D_GET_V_ORDER(order)]; @@ -507,7 +506,7 @@ namespace Hermes return Shapeset::get_num_bubbles(order, mode); } - const int L2ShapesetTaylor::max_index[2] = { 5, 5 }; - int L2ShapesetTaylor::get_max_index(ElementMode2D mode) const { return max_index[mode]; } + const unsigned short L2ShapesetTaylor::max_index[2] = { 5, 5 }; + unsigned short L2ShapesetTaylor::get_max_index(ElementMode2D mode) const { return max_index[mode]; } } } \ No newline at end of file diff --git a/hermes2d/src/solver/linear_solver.cpp b/hermes2d/src/solver/linear_solver.cpp index 1910824db4..7e72cffc01 100644 --- a/hermes2d/src/solver/linear_solver.cpp +++ b/hermes2d/src/solver/linear_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -20,6 +20,7 @@ \brief General linear solver functionality. */ #include "solver/linear_solver.h" +#include "solvers/matrix_solver.h" using namespace Hermes::Algebra; @@ -28,27 +29,29 @@ namespace Hermes namespace Hermes2D { template - LinearSolver::LinearSolver(bool force_use_direct_solver) : Solver(force_use_direct_solver) + LinearSolver::LinearSolver(bool force_use_direct_solver) : Solver(false), Hermes::Solvers::MatrixSolver(force_use_direct_solver) { - this->init_linear(force_use_direct_solver); + this->dp = new DiscreteProblem(true); + this->own_dp = true; } template - LinearSolver::LinearSolver(DiscreteProblem* dp, bool force_use_direct_solver) : Solver(dp, force_use_direct_solver) + LinearSolver::LinearSolver(DiscreteProblem* dp, bool force_use_direct_solver) : Solver(dp), Hermes::Solvers::MatrixSolver(force_use_direct_solver) { - this->init_linear(force_use_direct_solver); } template - LinearSolver::LinearSolver(WeakForm* wf, SpaceSharedPtr& space, bool force_use_direct_solver) : Solver(wf, space, force_use_direct_solver) + LinearSolver::LinearSolver(WeakFormSharedPtr wf, SpaceSharedPtr space, bool force_use_direct_solver) : Solver(false), Hermes::Solvers::MatrixSolver(force_use_direct_solver) { - this->init_linear(force_use_direct_solver); + this->dp = new DiscreteProblem(wf, space, true, true, true); + this->own_dp = true; } template - LinearSolver::LinearSolver(WeakForm* wf, Hermes::vector >& spaces, bool force_use_direct_solver) : Solver(wf, spaces, force_use_direct_solver) + LinearSolver::LinearSolver(WeakFormSharedPtr wf, std::vector > spaces, bool force_use_direct_solver) : Solver(false), Hermes::Solvers::MatrixSolver(force_use_direct_solver) { - this->init_linear(force_use_direct_solver); + this->dp = new DiscreteProblem(wf, spaces, true); + this->own_dp = true; } template @@ -56,12 +59,6 @@ namespace Hermes { } - template - void LinearSolver::init_linear(bool force_use_direct_solver) - { - this->dp->set_linear(); - } - template Scalar* LinearSolver::get_sln_vector() { @@ -75,29 +72,34 @@ namespace Hermes } template - void LinearSolver::set_weak_formulation(WeakForm* wf) + void LinearSolver::set_weak_formulation(WeakFormSharedPtr wf) { Solver::set_weak_formulation(wf); this->jacobian_reusable = false; } template - void LinearSolver::set_spaces(Hermes::vector >& spaces) + void LinearSolver::set_spaces(std::vector > spaces) { Solver::set_spaces(spaces); this->jacobian_reusable = false; } + template + void LinearSolver::set_verbose_output(bool to_set) + { + Hermes::Solvers::MatrixSolver::set_verbose_output(to_set); + this->dp->set_verbose_output(to_set); + } + template void LinearSolver::solve(Scalar* coeff_vec) { this->check(); - this->tick(); - this->on_initialization(); - this->info("\tLinearSolver: assembling..."); + this->tick(); // Extremely important. Space::assign_dofs(this->dp->get_spaces()); @@ -105,16 +107,16 @@ namespace Hermes // Assemble the residual always and the Matrix when necessary (nonconstant jacobian, not reusable, ...). if (this->jacobian_reusable && this->constant_jacobian) { - this->info("\tLinearSolver: reusing Matrix, assembling RHS."); + this->info("\tLinearSolver: assembling... [reusing matrix, assembling rhs]."); this->dp->assemble(coeff_vec, this->get_residual()); this->linear_matrix_solver->set_reuse_scheme(Hermes::Solvers::HERMES_REUSE_MATRIX_STRUCTURE_COMPLETELY); } else { if (this->jacobian_reusable) - this->info("\tLinearSolver: recalculating a reusable Matrix."); + this->info("\tLinearSolver: assembling... [re-assembling with a reusable matrix structure]."); else - this->info("\tLinearSolver: calculating the Matrix."); + this->info("\tLinearSolver: assembling... [assembling the matrix and rhs anew]."); this->dp->assemble(coeff_vec, this->get_jacobian(), this->get_residual()); this->linear_matrix_solver->set_reuse_scheme(Hermes::Solvers::HERMES_CREATE_STRUCTURE_FROM_SCRATCH); } @@ -122,7 +124,9 @@ namespace Hermes this->process_matrix_output(this->get_jacobian(), 1); this->process_vector_output(this->get_residual(), 1); - this->info("\tLinearSolver: assembling done. Solving..."); + this->tick(); + this->info("\tLinearSolver: assembling done in %s. Solving...", this->last_str().c_str()); + this->tick(); // Solve, if the solver is iterative, give him the initial guess. this->linear_matrix_solver->solve(coeff_vec); @@ -132,11 +136,10 @@ namespace Hermes this->on_finish(); this->tick(); - this->info("\tLinearSolver: done."); - this->info("\tLinearSolver: solution duration: %f s.", this->last()); + this->info("\tLinearSolver: solving done in %s.", this->last_str().c_str()); } - template class HERMES_API LinearSolver; - template class HERMES_API LinearSolver >; + template class HERMES_API LinearSolver < double > ; + template class HERMES_API LinearSolver < std::complex > ; } } diff --git a/hermes2d/src/solver/newton_solver.cpp b/hermes2d/src/solver/newton_solver.cpp index 169d142757..80839c22b3 100644 --- a/hermes2d/src/solver/newton_solver.cpp +++ b/hermes2d/src/solver/newton_solver.cpp @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -30,6 +30,8 @@ namespace Hermes template NewtonSolver::NewtonSolver() : Solver(), NewtonMatrixSolver() { + this->dp = new DiscreteProblem(false, true); + this->own_dp = true; } template @@ -38,19 +40,17 @@ namespace Hermes } template - NewtonSolver::NewtonSolver(WeakForm* wf, SpaceSharedPtr& space) : Solver(wf, space), NewtonMatrixSolver() + NewtonSolver::NewtonSolver(WeakFormSharedPtr wf, SpaceSharedPtr space) : Solver(wf, space), NewtonMatrixSolver() { + this->dp = new DiscreteProblem(wf, space, false, true); + this->own_dp = true; } template - NewtonSolver::NewtonSolver(WeakForm* wf, Hermes::vector >& spaces) : Solver(wf, spaces), NewtonMatrixSolver() + NewtonSolver::NewtonSolver(WeakFormSharedPtr wf, std::vector > spaces) : Solver(wf, spaces), NewtonMatrixSolver() { - } - - template - void NewtonSolver::init() - { - this->dp->set_linear(false); + this->dp = new DiscreteProblem(wf, spaces, false, true); + this->own_dp = true; } template @@ -70,6 +70,13 @@ namespace Hermes return this->sln_vector; } + template + void NewtonSolver::set_verbose_output(bool to_set) + { + MatrixSolver::set_verbose_output(to_set); + this->dp->set_verbose_output(to_set); + } + template void NewtonSolver::assemble_residual(bool store_previous_residual) { @@ -79,19 +86,26 @@ namespace Hermes } template - void NewtonSolver::assemble_jacobian(bool store_previous_jacobian) + bool NewtonSolver::assemble_jacobian(bool store_previous_jacobian) { - this->dp->assemble(this->sln_vector, this->get_jacobian()); - this->process_matrix_output(this->get_jacobian(), this->get_current_iteration_number()); + bool result = this->dp->assemble(this->sln_vector, this->get_jacobian()); + /// After the first time we assemble the matrix on the new reference space, we can no longer reuse the previous one. + this->dp->set_reassembled_states_reuse_linear_system_fn(nullptr); + + this->process_matrix_output(this->get_jacobian(), this->get_current_iteration_number()); + return result; } template - void NewtonSolver::assemble(bool store_previous_jacobian, bool store_previous_residual) + bool NewtonSolver::assemble(bool store_previous_jacobian, bool store_previous_residual) { - this->dp->assemble(this->sln_vector, this->get_jacobian(), this->get_residual()); + bool result = this->dp->assemble(this->sln_vector, this->get_jacobian(), this->get_residual()); + /// After the first time we assemble the matrix on the new reference space, we can no longer reuse the previous one. + this->dp->set_reassembled_states_reuse_linear_system_fn(nullptr); this->get_residual()->change_sign(); this->process_vector_output(this->get_residual(), this->get_current_iteration_number()); this->process_matrix_output(this->get_jacobian(), this->get_current_iteration_number()); + return result; } template @@ -101,7 +115,7 @@ namespace Hermes } template - void NewtonSolver::set_weak_formulation(WeakForm* wf) + void NewtonSolver::set_weak_formulation(WeakFormSharedPtr wf) { Solver::set_weak_formulation(wf); this->jacobian_reusable = false; @@ -115,13 +129,13 @@ namespace Hermes } template - void NewtonSolver::set_spaces(Hermes::vector >& spaces) + void NewtonSolver::set_spaces(std::vector > spaces) { Solver::set_spaces(spaces); this->jacobian_reusable = false; } - template class HERMES_API NewtonSolver; - template class HERMES_API NewtonSolver >; + template class HERMES_API NewtonSolver < double > ; + template class HERMES_API NewtonSolver < std::complex > ; } } diff --git a/hermes2d/src/solver/nox_solver.cpp b/hermes2d/src/solver/nox_solver.cpp index c6f880bbcd..a325958a6d 100644 --- a/hermes2d/src/solver/nox_solver.cpp +++ b/hermes2d/src/solver/nox_solver.cpp @@ -16,6 +16,7 @@ \brief NOX (nonliner) solver interface. */ #include "solver/nox_solver.h" +#include "projections/ogprojection.h" #if(defined HAVE_NOX && defined HAVE_EPETRA && defined HAVE_TEUCHOS) @@ -26,34 +27,44 @@ namespace Hermes static Epetra_SerialComm seq_comm; template - DiscreteProblemNOX::DiscreteProblemNOX() : DiscreteProblem() + DiscreteProblemNOX::DiscreteProblemNOX() : DiscreteProblem(), jacobian(nullptr) { this->precond = Teuchos::null; } template - DiscreteProblemNOX::DiscreteProblemNOX(WeakForm* wf, Hermes::vector >& spaces) : DiscreteProblem(wf, spaces) + DiscreteProblemNOX::DiscreteProblemNOX(WeakFormSharedPtr wf, std::vector > spaces) : DiscreteProblem(wf, spaces), jacobian(new EpetraMatrix()) { this->precond = Teuchos::null; + this->jacobian->prealloc(Space::get_num_dofs(spaces)); } template - DiscreteProblemNOX::DiscreteProblemNOX(WeakForm* wf, SpaceSharedPtr& space) : DiscreteProblem(wf, space) + DiscreteProblemNOX::DiscreteProblemNOX(WeakFormSharedPtr wf, SpaceSharedPtr space) : DiscreteProblem(wf, space), jacobian(new EpetraMatrix()) { this->precond = Teuchos::null; + this->jacobian->prealloc(Space::get_num_dofs(space)); + } + + template + DiscreteProblemNOX::~DiscreteProblemNOX() + { + delete this->jacobian; } template bool DiscreteProblemNOX::computeF(const Epetra_Vector &x, Epetra_Vector &f, FillType flag) { - EpetraVector xx(x); // wrap our structures around core Epetra objects + // wrap our structures around core Epetra objects + EpetraVector xx(x); EpetraVector rhs(f); rhs.zero(); - Scalar* coeff_vec = malloc_with_check(xx.get_size(), this); + Scalar* coeff_vec = malloc_with_check(xx.get_size()); xx.extract(coeff_vec); - this->assemble(coeff_vec, nullptr, &rhs); // nullptr is for the global matrix. + // nullptr is for the global matrix. + this->assemble(coeff_vec, nullptr, &rhs); free_with_check(coeff_vec); return true; @@ -65,14 +76,16 @@ namespace Hermes Epetra_RowMatrix *jac = dynamic_cast(&op); assert(jac != nullptr); - EpetraVector xx(x); // wrap our structures around core Epetra objects + // wrap our structures around core Epetra objects + EpetraVector xx(x); EpetraMatrix jacob(*jac); jacob.zero(); - Scalar* coeff_vec = malloc_with_check(xx.get_size(), this); + Scalar* coeff_vec = malloc_with_check(xx.get_size()); xx.extract(coeff_vec); - this->assemble(coeff_vec, &jacob, nullptr); // nullptr is for the right-hand side. + // nullptr is for the right-hand side. + this->assemble(coeff_vec, &jacob, nullptr); free_with_check(coeff_vec); //jacob.finish(); @@ -83,14 +96,15 @@ namespace Hermes bool DiscreteProblemNOX::computePreconditioner(const Epetra_Vector &x, Epetra_Operator &m, Teuchos::ParameterList *precParams) { - EpetraVector xx(x); // wrap our structures around core Epetra objects + // wrap our structures around core Epetra objects + EpetraVector xx(x); - Scalar* coeff_vec = malloc_with_check(xx.get_size(), this); + Scalar* coeff_vec = malloc_with_check(xx.get_size()); xx.extract(coeff_vec); - this->assemble(coeff_vec, &jacobian); + this->assemble(coeff_vec, jacobian); free_with_check(coeff_vec); - precond->create(&jacobian); + precond->create(jacobian); precond->compute(); m = *precond->get_obj(); @@ -106,7 +120,7 @@ namespace Hermes template EpetraMatrix *DiscreteProblemNOX::get_jacobian() { - return &jacobian; + return jacobian; } template @@ -116,7 +130,25 @@ namespace Hermes } template - NewtonSolverNOX::NewtonSolverNOX(DiscreteProblemNOX* problem) : dp(problem), sln_vector(nullptr) + NewtonSolverNOX::NewtonSolverNOX(DiscreteProblemNOX* problem) : dp(problem), sln_vector(nullptr), own_dp(false) + { + init(); + } + + template + NewtonSolverNOX::NewtonSolverNOX(WeakFormSharedPtr wf, std::vector > spaces) : dp(new DiscreteProblemNOX(wf, spaces)), sln_vector(nullptr), own_dp(true) + { + init(); + } + + template + NewtonSolverNOX::NewtonSolverNOX(WeakFormSharedPtr wf, SpaceSharedPtr space) : dp(new DiscreteProblemNOX(wf, space)), sln_vector(nullptr), own_dp(true) + { + init(); + } + + template + void NewtonSolverNOX::init() { // default values // convergence test @@ -165,7 +197,7 @@ namespace Hermes void NewtonSolverNOX::set_time(double time) { } - + template void NewtonSolverNOX::set_time_step(double time_step) { @@ -176,6 +208,8 @@ namespace Hermes { // FIXME: this does not destroy the "interface_", and Trilinos // complains at closing main.cpp. + if (this->own_dp) + delete this->dp; } template @@ -239,6 +273,24 @@ namespace Hermes nl_pars->sublist("Direction").sublist("Newton").sublist("Linear Solver").set("Max Age Of Prec", max_age); } + template + void NewtonSolverNOX::solve(std::vector > initial_guess) + { + Scalar* coeff_vec = malloc_with_check(Space::get_num_dofs(this->dp->spaces)); + OGProjection::project_global(this->dp->spaces, initial_guess, coeff_vec); + this->solve(coeff_vec); + free_with_check(coeff_vec); + } + + template + void NewtonSolverNOX::solve(MeshFunctionSharedPtr initial_guess) + { + Scalar* coeff_vec = malloc_with_check(Space::get_num_dofs(this->dp->spaces)); + OGProjection::project_global(this->dp->spaces[0], initial_guess, coeff_vec); + this->solve(coeff_vec); + free_with_check(coeff_vec); + } + template void NewtonSolverNOX::solve(Scalar* coeff_vec) { @@ -249,8 +301,10 @@ namespace Hermes if (!coeff_vec) temp_init_sln.zero(); else - for (int i = 0; i < ndofs; i++) - temp_init_sln.set(i, coeff_vec[i]); + { + for (int i = 0; i < ndofs; i++) + temp_init_sln.set(i, coeff_vec[i]); + } NOX::Epetra::Vector init_sln(*temp_init_sln.vec); @@ -269,9 +323,9 @@ namespace Hermes Teuchos::RCP jac_mat; // Create linear system - if(this->dp->get_weak_formulation()->is_matrix_free()) + if (this->dp->get_weak_formulation()->is_matrix_free()) { - if(precond == Teuchos::null) + if (precond == Teuchos::null) { //Matrix free without preconditioner lin_sys = Teuchos::rcp(new NOX::Epetra::LinearSystemAztecOO(print_pars, ls_pars, i_req, init_sln)); } @@ -286,7 +340,7 @@ namespace Hermes { // not matrix Free (with jacobian) Teuchos::RCP i_jac = Teuchos::rcpFromRef(*dp); jac_mat = Teuchos::rcp(dp->get_jacobian()->mat); - if(precond == Teuchos::null) + if (precond == Teuchos::null) { //Matrix without preconditioner lin_sys = Teuchos::rcp(new NOX::Epetra::LinearSystemAztecOO(print_pars, ls_pars, i_req, i_jac, jac_mat, init_sln)); @@ -307,28 +361,28 @@ namespace Hermes Teuchos::RCP converged = Teuchos::rcp(new NOX::StatusTest::Combo(NOX::StatusTest::Combo::AND)); - if(conv_flag.absresid) + if (conv_flag.absresid) { Teuchos::RCP absresid = Teuchos::rcp(new NOX::StatusTest::NormF(conv.abs_resid, conv.norm_type, conv.stype)); converged->addStatusTest(absresid); } - if(conv_flag.relresid) + if (conv_flag.relresid) { Teuchos::RCP relresid = Teuchos::rcp(new NOX::StatusTest::NormF(*grp.get(), conv.rel_resid)); converged->addStatusTest(relresid); } - if(conv_flag.update) + if (conv_flag.update) { Teuchos::RCP update = Teuchos::rcp(new NOX::StatusTest::NormUpdate(conv.update)); converged->addStatusTest(update); } - if(conv_flag.wrms) + if (conv_flag.wrms) { Teuchos::RCP wrms = Teuchos::rcp(new NOX::StatusTest::NormWRMS(conv.wrms_rtol, conv.wrms_atol)); @@ -354,13 +408,14 @@ namespace Hermes // Create the solver Teuchos::RCP solver = NOX::Solver::buildSolver(grp, cmb, final_pars); - /// Solve. + // Solve. NOX::StatusTest::StatusType status = solver->solve(); - if(!this->dp->get_weak_formulation()->is_matrix_free()) - jac_mat.release(); // release the ownership (we take care of jac_mat by ourselves) + if (!this->dp->get_weak_formulation()->is_matrix_free()) + // release the ownership (we take care of jac_mat by ourselves) + jac_mat.release(); - if(status == NOX::StatusTest::Converged) + if (status == NOX::StatusTest::Converged) { // get result informations num_iters = solver->getNumIterations(); @@ -374,10 +429,10 @@ namespace Hermes const Epetra_Vector &f_sln = (dynamic_cast(f_grp.getX())).getEpetraVector(); // extract solution - if(this->sln_vector) + if (this->sln_vector) free_with_check(this->sln_vector); this->sln_vector = (Scalar*)calloc(ndofs, sizeof(Scalar)); - + f_sln.ExtractCopy(this->sln_vector); } else // not converged @@ -470,10 +525,12 @@ namespace Hermes conv.wrms_atol = atol; } - template class HERMES_API DiscreteProblemNOX; - // template class HERMES_API DiscreteProblemNOX >; //complex version of nox solver is not implemented - template class HERMES_API NewtonSolverNOX; - // template class HERMES_API NewtonSolverNOX >; //complex version of nox solver is not implemented + template class HERMES_API DiscreteProblemNOX < double > ; + //complex version of nox solver is not implemented + // template class HERMES_API DiscreteProblemNOX >; + template class HERMES_API NewtonSolverNOX < double > ; + //complex version of nox solver is not implemented + // template class HERMES_API NewtonSolverNOX >; } } #endif \ No newline at end of file diff --git a/hermes2d/src/solver/picard_solver.cpp b/hermes2d/src/solver/picard_solver.cpp index e74d1ce22f..2602387eb7 100644 --- a/hermes2d/src/solver/picard_solver.cpp +++ b/hermes2d/src/solver/picard_solver.cpp @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -28,33 +28,29 @@ namespace Hermes namespace Hermes2D { template - PicardSolver::PicardSolver() : Solver(), PicardMatrixSolver() + PicardSolver::PicardSolver() : Solver(false), PicardMatrixSolver() { - this->init(); + this->dp = new DiscreteProblem(false, false); + this->own_dp = true; } template PicardSolver::PicardSolver(DiscreteProblem* dp) : Solver(dp), PicardMatrixSolver() { - this->init(); } template - PicardSolver::PicardSolver(WeakForm* wf, SpaceSharedPtr& space) : Solver(wf, space), PicardMatrixSolver() + PicardSolver::PicardSolver(WeakFormSharedPtr wf, SpaceSharedPtr space) : Solver(false), PicardMatrixSolver() { - this->init(); + this->dp = new DiscreteProblem(wf, space, false, false); + this->own_dp = true; } template - PicardSolver::PicardSolver(WeakForm* wf, Hermes::vector >& spaces) : Solver(wf, spaces), PicardMatrixSolver() + PicardSolver::PicardSolver(WeakFormSharedPtr wf, std::vector > spaces) : Solver(false), PicardMatrixSolver() { - this->init(); - } - - template - void PicardSolver::init() - { - this->dp->set_linear(false, false); + this->dp = new DiscreteProblem(wf, spaces, false, false); + this->own_dp = true; } template @@ -74,6 +70,13 @@ namespace Hermes return this->sln_vector; } + template + void PicardSolver::set_verbose_output(bool to_set) + { + MatrixSolver::set_verbose_output(to_set); + this->dp->set_verbose_output(to_set); + } + template void PicardSolver::assemble_residual(bool store_previous_residual) { @@ -83,7 +86,7 @@ namespace Hermes } template - void PicardSolver::assemble_jacobian(bool store_previous_jacobian) + bool PicardSolver::assemble_jacobian(bool store_previous_jacobian) { if (store_previous_jacobian) { @@ -92,14 +95,15 @@ namespace Hermes if (this->get_current_iteration_number() > 1) this->previous_jacobian = this->get_jacobian()->duplicate(); } - + bool use_Anderson = this->anderson_is_on && (this->vec_in_memory >= this->num_last_vectors_used); - this->dp->assemble(use_Anderson ? this->previous_Anderson_sln_vector : this->sln_vector, this->get_jacobian()); - this->process_matrix_output(this->get_jacobian(), this->get_current_iteration_number()); + bool result = this->dp->assemble(use_Anderson ? this->previous_Anderson_sln_vector : this->sln_vector, this->get_jacobian()); + this->process_matrix_output(this->get_jacobian(), this->get_current_iteration_number()); + return result; } template - void PicardSolver::assemble(bool store_previous_jacobian, bool store_previous_residual) + bool PicardSolver::assemble(bool store_previous_jacobian, bool store_previous_residual) { if (store_previous_jacobian) { @@ -110,9 +114,10 @@ namespace Hermes } bool use_Anderson = this->anderson_is_on && (this->vec_in_memory >= this->num_last_vectors_used); - this->dp->assemble(use_Anderson ? this->previous_Anderson_sln_vector : this->sln_vector, this->get_jacobian(), this->get_residual()); + bool result = this->dp->assemble(use_Anderson ? this->previous_Anderson_sln_vector : this->sln_vector, this->get_jacobian(), this->get_residual()); this->process_vector_output(this->get_residual(), this->get_current_iteration_number()); this->process_matrix_output(this->get_jacobian(), this->get_current_iteration_number()); + return result; } template @@ -122,7 +127,7 @@ namespace Hermes } template - void PicardSolver::set_weak_formulation(WeakForm* wf) + void PicardSolver::set_weak_formulation(WeakFormSharedPtr wf) { Solver::set_weak_formulation(wf); this->jacobian_reusable = false; @@ -136,13 +141,13 @@ namespace Hermes } template - void PicardSolver::set_spaces(Hermes::vector >& spaces) + void PicardSolver::set_spaces(std::vector > spaces) { Solver::set_spaces(spaces); this->jacobian_reusable = false; } - template class HERMES_API PicardSolver; - template class HERMES_API PicardSolver >; + template class HERMES_API PicardSolver < double > ; + template class HERMES_API PicardSolver < std::complex > ; } } \ No newline at end of file diff --git a/hermes2d/src/solver/runge_kutta.cpp b/hermes2d/src/solver/runge_kutta.cpp index f9242a565b..060b219b75 100644 --- a/hermes2d/src/solver/runge_kutta.cpp +++ b/hermes2d/src/solver/runge_kutta.cpp @@ -14,7 +14,7 @@ // along with Hermes2D. If not, see . #include "solver/runge_kutta.h" -#include "discrete_problem.h" +#include "discrete_problem/discrete_problem.h" #include "projections/ogprojection.h" #include "norm_form.h" @@ -26,18 +26,18 @@ namespace Hermes namespace Hermes2D { template - RungeKutta::RungeKutta(WeakForm* wf, Hermes::vector > spaces, ButcherTable* bt) - : wf(wf), bt(bt), num_stages(bt->get_size()), stage_wf_right(bt->get_size() * spaces.size()), - stage_wf_left(spaces.size()), start_from_zero_K_vector(false), block_diagonal_jacobian(false), residual_as_vector(true), iteration(0), + RungeKutta::RungeKutta(WeakFormSharedPtr wf, std::vector > spaces, ButcherTable* bt) + : wf(wf), bt(bt), num_stages(bt->get_size()), stage_wf_right(new WeakForm(bt->get_size() * spaces.size())), + stage_wf_left(new WeakForm(spaces.size())), start_from_zero_K_vector(false), block_diagonal_jacobian(false), residual_as_vector(true), iteration(0), freeze_jacobian(false), newton_tol(1e-6), newton_max_iter(20), newton_damping_coeff(1.0), newton_max_allowed_residual_norm(1e10) { - for(unsigned int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { this->spaces.push_back(spaces.at(i)); this->spaces_seqs.push_back(spaces.at(i)->get_seq()); } - if(bt==nullptr) + if (bt == nullptr) throw Exceptions::NullException(2); matrix_right = create_matrix(); @@ -61,15 +61,15 @@ namespace Hermes } template - RungeKutta::RungeKutta(WeakForm* wf, SpaceSharedPtr space, ButcherTable* bt) - : wf(wf), bt(bt), num_stages(bt->get_size()), stage_wf_right(bt->get_size() * 1), - stage_wf_left(1), start_from_zero_K_vector(false), block_diagonal_jacobian(false), residual_as_vector(true), iteration(0), + RungeKutta::RungeKutta(WeakFormSharedPtr wf, SpaceSharedPtr space, ButcherTable* bt) + : wf(wf), bt(bt), num_stages(bt->get_size()), stage_wf_right(new WeakForm(bt->get_size())), + stage_wf_left(new WeakForm(1)), start_from_zero_K_vector(false), block_diagonal_jacobian(false), residual_as_vector(true), iteration(0), freeze_jacobian(false), newton_tol(1e-6), newton_max_iter(20), newton_damping_coeff(1.0), newton_max_allowed_residual_norm(1e10) { this->spaces.push_back(space); this->spaces_seqs.push_back(space->get_seq()); - if(bt==nullptr) throw Exceptions::NullException(2); + if (bt == nullptr) throw Exceptions::NullException(2); matrix_right = create_matrix(); matrix_left = create_matrix(); @@ -92,41 +92,41 @@ namespace Hermes } template - void RungeKutta::set_spaces(Hermes::vector >& spaces) + void RungeKutta::set_spaces(std::vector > spaces) { bool delete_K_vector = false; - for(unsigned int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) { - if(spaces[i]->get_seq() != this->spaces_seqs[i]) + if (spaces[i]->get_seq() != this->spaces_seqs[i]) delete_K_vector = true; } this->spaces = spaces; this->spaces_seqs.clear(); - for(unsigned int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) this->spaces_seqs.push_back(spaces.at(i)->get_seq()); - if(delete_K_vector) + if (delete_K_vector) { - delete [] K_vector; + delete[] K_vector; K_vector = new Scalar[num_stages * Space::get_num_dofs(this->spaces)]; this->info("\tRunge-Kutta: K vectors are being set to zero, as the spaces changed during computation."); memset(K_vector, 0, num_stages * Space::get_num_dofs(this->spaces) * sizeof(Scalar)); } - delete [] u_ext_vec; + delete[] u_ext_vec; u_ext_vec = new Scalar[num_stages * Space::get_num_dofs(this->spaces)]; - delete [] vector_left; + delete[] vector_left; vector_left = new Scalar[num_stages* Space::get_num_dofs(this->spaces)]; - if(this->stage_dp_left != nullptr) + if (this->stage_dp_left != nullptr) this->stage_dp_left->set_spaces(this->spaces); } template - void RungeKutta::set_space(SpaceSharedPtr& space) + void RungeKutta::set_space(SpaceSharedPtr space) { bool delete_K_vector = false; - if(space->get_seq() != this->spaces_seqs[0]) + if (space->get_seq() != this->spaces_seqs[0]) delete_K_vector = true; this->spaces.clear(); @@ -134,24 +134,24 @@ namespace Hermes this->spaces_seqs.clear(); this->spaces_seqs.push_back(space->get_seq()); - if(delete_K_vector) + if (delete_K_vector) { - delete [] K_vector; + delete[] K_vector; K_vector = new Scalar[num_stages * Space::get_num_dofs(this->spaces)]; this->info("\tRunge-Kutta: K vector is being set to zero, as the spaces changed during computation."); memset(K_vector, 0, num_stages * Space::get_num_dofs(this->spaces) * sizeof(Scalar)); } - delete [] u_ext_vec; + delete[] u_ext_vec; u_ext_vec = new Scalar[num_stages * Space::get_num_dofs(this->spaces)]; - delete [] vector_left; + delete[] vector_left; vector_left = new Scalar[num_stages* Space::get_num_dofs(this->spaces)]; - if(this->stage_dp_left != nullptr) + if (this->stage_dp_left != nullptr) this->stage_dp_left->set_space(space); } template - Hermes::vector >& RungeKutta::get_spaces() + std::vector > RungeKutta::get_spaces() { return this->spaces; } @@ -161,15 +161,15 @@ namespace Hermes { this->create_stage_wf(spaces.size(), block_diagonal_jacobian); - if(this->get_verbose_output()) + if (this->get_verbose_output()) { - this->stage_wf_left.set_verbose_output(true); - this->stage_wf_right.set_verbose_output(true); + this->stage_wf_left->set_verbose_output(true); + this->stage_wf_right->set_verbose_output(true); } else { - this->stage_wf_left.set_verbose_output(false); - this->stage_wf_right.set_verbose_output(false); + this->stage_wf_left->set_verbose_output(true); + this->stage_wf_right->set_verbose_output(true); } // The tensor discrete problem is created in two parts. First, matrix_left is the Jacobian @@ -179,23 +179,23 @@ namespace Hermes // matrix and residula vector coming from the function f(...). Of course the RK equation is assumed // in a form suitable for the Newton's method: k_i - f(...) = 0. At the end, matrix_left and vector_left // are added to matrix_right and vector_right, respectively. - this->stage_dp_left = new DiscreteProblem(&stage_wf_left, spaces); + this->stage_dp_left = new DiscreteProblem(stage_wf_left, spaces); // All Spaces of the problem. - Hermes::vector > stage_spaces_vector; + std::vector > stage_spaces_vector; // Create spaces for stage solutions K_i. This is necessary // to define a num_stages x num_stages block weak formulation. for (unsigned int i = 0; i < num_stages; i++) - for(unsigned int space_i = 0; space_i < spaces.size(); space_i++) + for (unsigned int space_i = 0; space_i < spaces.size(); space_i++) stage_spaces_vector.push_back(spaces[space_i]); - this->stage_dp_right = new DiscreteProblem(&stage_wf_right, stage_spaces_vector); + this->stage_dp_right = new DiscreteProblem(stage_wf_right, stage_spaces_vector); // Prepare residuals of stage solutions. - if(!residual_as_vector) + if (!residual_as_vector) for (unsigned int i = 0; i < num_stages; i++) - for(unsigned int sln_i = 0; sln_i < spaces.size(); sln_i++) + for (unsigned int sln_i = 0; sln_i < spaces.size(); sln_i++) residuals_vector.push_back(new Solution(spaces[sln_i]->get_mesh())); } @@ -223,12 +223,12 @@ namespace Hermes this->freeze_jacobian = true; } template - void RungeKutta::set_tolerance(double newton_tol) + void RungeKutta::set_newton_tolerance(double newton_tol) { this->newton_tol = newton_tol; } template - void RungeKutta::set_max_allowed_iterations(int newton_max_iter) + void RungeKutta::set_newton_max_allowed_iterations(int newton_max_iter) { this->newton_max_iter = newton_max_iter; } @@ -246,17 +246,17 @@ namespace Hermes template RungeKutta::~RungeKutta() { - if(stage_dp_left != nullptr) + if (stage_dp_left != nullptr) delete stage_dp_left; - if(stage_dp_right != nullptr) + if (stage_dp_right != nullptr) delete stage_dp_right; delete solver; delete matrix_right; delete matrix_left; delete vector_right; - delete [] K_vector; - delete [] u_ext_vec; - delete [] vector_left; + delete[] K_vector; + delete[] u_ext_vec; + delete[] vector_left; } template @@ -276,33 +276,33 @@ namespace Hermes void RungeKutta::rk_time_step_newton(MeshFunctionSharedPtr sln_time_prev, MeshFunctionSharedPtr sln_time_new, MeshFunctionSharedPtr error_fn) { - Hermes::vector > slns_time_prev = Hermes::vector >(); + std::vector > slns_time_prev = std::vector >(); slns_time_prev.push_back(sln_time_prev); - Hermes::vector > slns_time_new = Hermes::vector >(); + std::vector > slns_time_new = std::vector >(); slns_time_new.push_back(sln_time_new); - Hermes::vector > error_fns = Hermes::vector >(); + std::vector > error_fns = std::vector >(); error_fns.push_back(error_fn); return rk_time_step_newton(slns_time_prev, slns_time_new, error_fns); } template - void RungeKutta::rk_time_step_newton(Hermes::vector > slns_time_prev, - Hermes::vector > slns_time_new, - Hermes::vector > error_fns) + void RungeKutta::rk_time_step_newton(std::vector > slns_time_prev, + std::vector > slns_time_new, + std::vector > error_fns) { this->tick(); int ndof = Space::get_num_dofs(spaces); - if(this->stage_dp_left == nullptr) + if (this->stage_dp_left == nullptr) this->init(); // Creates the stage weak formulation. update_stage_wf(slns_time_prev); // Check whether the user provided a nonzero B2-row if he wants temporal error estimation. - if(error_fns != Hermes::vector >() && bt->is_embedded() == false) + if (error_fns != std::vector >() && bt->is_embedded() == false) throw Hermes::Exceptions::Exception("rk_time_step_newton(): R-K method must be embedded if temporal error estimate is requested."); info("\tRunge-Kutta: time step, time: %f, time step: %f", this->time, this->time_step); @@ -312,12 +312,12 @@ namespace Hermes Space::update_essential_bc_values(spaces, this->time + bt->get_C(stage_i)*this->time_step); // All Spaces of the problem. - Hermes::vector > stage_spaces_vector; + std::vector > stage_spaces_vector; // Create spaces for stage solutions K_i. This is necessary // to define a num_stages x num_stages block weak formulation. for (unsigned int i = 0; i < num_stages; i++) { - for(unsigned int space_i = 0; space_i < spaces.size(); space_i++) + for (unsigned int space_i = 0; space_i < spaces.size(); space_i++) { typename Space::ReferenceSpaceCreator ref_space_creator(spaces[space_i], spaces[space_i]->get_mesh(), 0); stage_spaces_vector.push_back(ref_space_creator.create_ref_space()); @@ -326,7 +326,7 @@ namespace Hermes this->stage_dp_right->set_spaces(stage_spaces_vector); // Zero utility vectors. - if(start_from_zero_K_vector || !iteration) + if (start_from_zero_K_vector || !iteration) memset(K_vector, 0, num_stages * ndof * sizeof(Scalar)); memset(u_ext_vec, 0, num_stages * ndof * sizeof(Scalar)); memset(vector_left, 0, num_stages * ndof * sizeof(Scalar)); @@ -348,11 +348,11 @@ namespace Hermes prepare_u_ext_vec(); // Reinitialize filters. - if(this->filters_to_reinit.size() > 0) + if (this->filters_to_reinit.size() > 0) { Solution::vector_to_solutions(u_ext_vec, spaces, slns_time_new); - for(unsigned int filters_i = 0; filters_i < this->filters_to_reinit.size(); filters_i++) + for (unsigned int filters_i = 0; filters_i < this->filters_to_reinit.size(); filters_i++) filters_to_reinit.at(filters_i)->reinit(); } @@ -370,7 +370,7 @@ namespace Hermes // Multiply the residual vector with -1 since the matrix // equation reads J(Y^n) \deltaY^{n + 1} = -F(Y^n). vector_right->change_sign(); - if(this->output_rhsOn && (this->output_rhsIterations == -1 || this->output_rhsIterations >= it)) + if (this->output_rhsOn && (this->output_rhsIterations == -1 || this->output_rhsIterations >= it)) { char* fileName = new char[this->RhsFilename.length() + 5]; sprintf(fileName, "%s%i", this->RhsFilename.c_str(), it); @@ -378,19 +378,19 @@ namespace Hermes } // Measure the residual norm. - if(residual_as_vector) + if (residual_as_vector) // Calculate the l2-norm of residual vector. - residual_norm = get_l2_norm(vector_right); + residual_norm = get_l2_norm(vector_right); else { // Translate residual vector into residual functions. - Hermes::vector add_dir_lift_vector; + std::vector add_dir_lift_vector; add_dir_lift_vector.reserve(1); add_dir_lift_vector.push_back(false); - Solution::vector_to_solutions(vector_right, stage_dp_right->get_spaces(), residuals_vector, false); + Solution::vector_to_solutions_common_dir_lift(vector_right, stage_dp_right->get_spaces(), residuals_vector, false); - Hermes::vector > meshFns; - for(int i = 0; i < residuals_vector.size(); i++) + std::vector > meshFns; + for (unsigned short i = 0; i < residuals_vector.size(); i++) meshFns.push_back(residuals_vector[i]); DefaultNormCalculator errorCalculator(meshFns.size()); @@ -398,24 +398,24 @@ namespace Hermes } // Info for the user. - if(it == 1) + if (it == 1) this->info("\tRunge-Kutta: Newton initial residual norm: %g", residual_norm); else - this->info("\tRunge-Kutta: Newton iteration %d, residual norm: %g", it-1, residual_norm); + this->info("\tRunge-Kutta: Newton iteration %d, residual norm: %g", it - 1, residual_norm); // If maximum allowed residual norm is exceeded, fail. - if(residual_norm > newton_max_allowed_residual_norm) + if (residual_norm > newton_max_allowed_residual_norm) { throw Exceptions::ValueException("residual norm", residual_norm, newton_max_allowed_residual_norm); } // If residual norm is within tolerance, or the maximum number // of iteration has been reached, or the problem is linear, then quit. - if((residual_norm < newton_tol || it > newton_max_iter) && it > 1) + if ((residual_norm < newton_tol || it > newton_max_iter) && it > 1) break; bool rhs_only = (freeze_jacobian && it > 1); - if(!rhs_only) + if (!rhs_only) { // Assemble the block Jacobian matrix of the stationary residual F // Diagonal blocks are created even if empty, so that matrix_left @@ -427,7 +427,7 @@ namespace Hermes // resulting tensor Jacobian. matrix_right->add_sparse_to_diagonal_blocks(num_stages, matrix_left); - if(this->output_matrixOn && (this->output_matrixIterations == -1 || this->output_matrixIterations >= it)) + if (this->output_matrixOn && (this->output_matrixIterations == -1 || this->output_matrixIterations >= it)) { char* fileName = new char[this->matrixFilename.length() + 5]; sprintf(fileName, "%s%i", this->matrixFilename.c_str(), it); @@ -451,7 +451,7 @@ namespace Hermes } // If max number of iterations was exceeded, fail. - if(it >= newton_max_iter) + if (it >= newton_max_iter && residual_norm > newton_tol) { this->tick(); this->info("\tRunge-Kutta: time step duration: %f s.\n", this->last()); @@ -475,7 +475,7 @@ namespace Hermes // If error_fn is not nullptr, use the B2-row in the Butcher's // table to calculate the temporal error estimate. - if(error_fns != Hermes::vector >()) + if (error_fns != std::vector >()) { for (int i = 0; i < ndof; i++) { @@ -488,7 +488,7 @@ namespace Hermes } // Clean up. - delete [] coeff_vec; + delete[] coeff_vec; iteration++; this->tick(); @@ -496,28 +496,28 @@ namespace Hermes } template - void RungeKutta::rk_time_step_newton(Hermes::vector > slns_time_prev, - Hermes::vector > slns_time_new) + void RungeKutta::rk_time_step_newton(std::vector > slns_time_prev, + std::vector > slns_time_new) { return rk_time_step_newton(slns_time_prev, slns_time_new, - Hermes::vector >()); + std::vector >()); } template void RungeKutta::rk_time_step_newton(MeshFunctionSharedPtr sln_time_prev, MeshFunctionSharedPtr sln_time_new) { - Hermes::vector > slns_time_prev; + std::vector > slns_time_prev; slns_time_prev.push_back(sln_time_prev); - Hermes::vector > slns_time_new; + std::vector > slns_time_new; slns_time_new.push_back(sln_time_new); - Hermes::vector > error_fns; + std::vector > error_fns; return rk_time_step_newton(slns_time_prev, slns_time_new, error_fns); } template - void RungeKutta::set_filters_to_reinit(Hermes::vector*> filters_to_reinit) + void RungeKutta::set_filters_to_reinit(std::vector*> filters_to_reinit) { - for(int i = 0; i < filters_to_reinit.size(); i++) + for (unsigned short i = 0; i < filters_to_reinit.size(); i++) this->filters_to_reinit.push_back(filters_to_reinit.at(i)); } @@ -525,29 +525,31 @@ namespace Hermes void RungeKutta::create_stage_wf(unsigned int size, bool block_diagonal_jacobian) { // Clear the WeakForms. - stage_wf_left.delete_all(); - stage_wf_right.delete_all(); + stage_wf_left->delete_all(); + stage_wf_right->delete_all(); + + int spaces_size = stage_wf_right->original_neq = spaces.size(); // First let's do the mass matrix (only one block ndof times ndof). - for(unsigned int component_i = 0; component_i < size; component_i++) + for (unsigned int component_i = 0; component_i < size; component_i++) { - if(spaces[component_i]->get_type() == HERMES_H1_SPACE + if (spaces[component_i]->get_type() == HERMES_H1_SPACE || spaces[component_i]->get_type() == HERMES_L2_SPACE) { MatrixDefaultNormFormVol* proj_form = new MatrixDefaultNormFormVol(component_i, component_i, HERMES_L2_NORM); proj_form->areas.push_back(HERMES_ANY); proj_form->scaling_factor = 1.0; proj_form->u_ext_offset = 0; - stage_wf_left.add_matrix_form(proj_form); + stage_wf_left->add_matrix_form(proj_form); } - if(spaces[component_i]->get_type() == HERMES_HDIV_SPACE + if (spaces[component_i]->get_type() == HERMES_HDIV_SPACE || spaces[component_i]->get_type() == HERMES_HCURL_SPACE) { MatrixDefaultNormFormVol* proj_form = new MatrixDefaultNormFormVol(component_i, component_i, HERMES_HCURL_NORM); proj_form->areas.push_back(HERMES_ANY); proj_form->scaling_factor = 1.0; proj_form->u_ext_offset = 0; - stage_wf_left.add_matrix_form(proj_form); + stage_wf_left->add_matrix_form(proj_form); } } @@ -558,10 +560,10 @@ namespace Hermes // Extracting volume and surface matrix and vector forms from the // original weak formulation. - Hermes::vector *> mfvol_base = wf->mfvol; - Hermes::vector *> mfsurf_base = wf->mfsurf; - Hermes::vector *> vfvol_base = wf->vfvol; - Hermes::vector *> vfsurf_base = wf->vfsurf; + std::vector *> mfvol_base = wf->mfvol; + std::vector *> mfsurf_base = wf->mfsurf; + std::vector *> vfvol_base = wf->vfvol; + std::vector *> vfsurf_base = wf->vfsurf; // Duplicate matrix volume forms, scale them according // to the Butcher's table, enhance them with additional @@ -574,18 +576,18 @@ namespace Hermes { for (unsigned int j = 0; j < num_stages; j++) { - if(block_diagonal_jacobian && i != j) continue; + if (block_diagonal_jacobian && i != j) continue; MatrixFormVol* mfv_ij = mfvol_base[m]->clone(); - mfv_ij->i = mfv_ij->i + i * spaces.size(); - mfv_ij->j = mfv_ij->j + j * spaces.size(); + mfv_ij->i = mfv_ij->i + i * spaces_size; + mfv_ij->j = mfv_ij->j + j * spaces_size; - mfv_ij->u_ext_offset = i * spaces.size(); + mfv_ij->u_ext_offset = i * spaces_size; // Add the matrix form to the corresponding block of the // stage Jacobian matrix. - stage_wf_right.add_matrix_form(mfv_ij); + stage_wf_right->add_matrix_form(mfv_ij); } } } @@ -599,18 +601,18 @@ namespace Hermes { for (unsigned int j = 0; j < num_stages; j++) { - if(block_diagonal_jacobian && i != j) continue; + if (block_diagonal_jacobian && i != j) continue; MatrixFormSurf* mfs_ij = mfsurf_base[m]->clone(); - mfs_ij->i = mfs_ij->i + i * spaces.size(); - mfs_ij->j = mfs_ij->j + j * spaces.size(); + mfs_ij->i = mfs_ij->i + i * spaces_size; + mfs_ij->j = mfs_ij->j + j * spaces_size; - mfs_ij->u_ext_offset = i * spaces.size(); + mfs_ij->u_ext_offset = i * spaces_size; // Add the matrix form to the corresponding block of the // stage Jacobian matrix. - stage_wf_right.add_matrix_form_surf(mfs_ij); + stage_wf_right->add_matrix_form_surf(mfs_ij); } } } @@ -624,14 +626,14 @@ namespace Hermes { VectorFormVol* vfv_i = vfvol_base[m]->clone(); - vfv_i->i = vfv_i->i + i * spaces.size(); + vfv_i->i = vfv_i->i + i * spaces_size; vfv_i->scaling_factor = -1.0; - vfv_i->u_ext_offset = i * spaces.size(); + vfv_i->u_ext_offset = i * spaces_size; // Add the matrix form to the corresponding block of the // stage Jacobian matrix. - stage_wf_right.add_vector_form(vfv_i); + stage_wf_right->add_vector_form(vfv_i); } } @@ -644,38 +646,38 @@ namespace Hermes { VectorFormSurf* vfs_i = vfsurf_base[m]->clone(); - vfs_i->i = vfs_i->i + i * spaces.size(); + vfs_i->i = vfs_i->i + i * spaces_size; vfs_i->scaling_factor = -1.0; - vfs_i->u_ext_offset = i * spaces.size(); + vfs_i->u_ext_offset = i * spaces_size; // Add the matrix form to the corresponding block of the // stage Jacobian matrix. - stage_wf_right.add_vector_form_surf(vfs_i); + stage_wf_right->add_vector_form_surf(vfs_i); } } } template - void RungeKutta::update_stage_wf(Hermes::vector > slns_time_prev) + void RungeKutta::update_stage_wf(std::vector > slns_time_prev) { - if(this->wf->global_integration_order_set) + if (this->wf->global_integration_order_set) { - this->stage_wf_left.set_global_integration_order(this->wf->global_integration_order); - this->stage_wf_right.set_global_integration_order(this->wf->global_integration_order); + this->stage_wf_left->set_global_integration_order(this->wf->global_integration_order); + this->stage_wf_right->set_global_integration_order(this->wf->global_integration_order); } // Extracting volume and surface matrix and vector forms from the // 'right' weak formulation. - Hermes::vector *> mfvol = stage_wf_right.mfvol; - Hermes::vector *> mfsurf = stage_wf_right.mfsurf; - Hermes::vector *> vfvol = stage_wf_right.vfvol; - Hermes::vector *> vfsurf = stage_wf_right.vfsurf; + std::vector *> mfvol = stage_wf_right->mfvol; + std::vector *> mfsurf = stage_wf_right->mfsurf; + std::vector *> vfvol = stage_wf_right->vfvol; + std::vector *> vfsurf = stage_wf_right->vfsurf; - stage_wf_right.ext.clear(); + stage_wf_right->ext.clear(); - for(unsigned int slns_time_prev_i = 0; slns_time_prev_i < slns_time_prev.size(); slns_time_prev_i++) - stage_wf_right.ext.push_back(slns_time_prev[slns_time_prev_i]); + for (unsigned int slns_time_prev_i = 0; slns_time_prev_i < slns_time_prev.size(); slns_time_prev_i++) + stage_wf_right->ext.push_back(slns_time_prev[slns_time_prev_i]); // Duplicate matrix volume forms, scale them according // to the Butcher's table, enhance them with additional @@ -725,7 +727,7 @@ namespace Hermes for (unsigned int stage_i = 0; stage_i < num_stages; stage_i++) { unsigned int running_space_ndofs = 0; - for(unsigned int space_i = 0; space_i < spaces.size(); space_i++) + for (unsigned int space_i = 0; space_i < spaces.size(); space_i++) { for (int idx = 0; idx < spaces[space_i]->get_num_dofs(); idx++) { @@ -738,7 +740,7 @@ namespace Hermes } } } - template class HERMES_API RungeKutta; - template class HERMES_API RungeKutta >; + template class HERMES_API RungeKutta < double > ; + template class HERMES_API RungeKutta < std::complex > ; } } diff --git a/hermes2d/src/solver/solver.cpp b/hermes2d/src/solver/solver.cpp index 0154f3f4a4..bbacd11b81 100644 --- a/hermes2d/src/solver/solver.cpp +++ b/hermes2d/src/solver/solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -30,33 +30,36 @@ namespace Hermes namespace Hermes2D { template - Solver::Solver(bool force_use_direct_solver) : dp(new DiscreteProblem()), own_dp(true) + Solver::Solver(bool initialize_discrete_problem) { - this->init(force_use_direct_solver); + if (initialize_discrete_problem) + { + this->dp = new DiscreteProblem(); + own_dp = true; + } + else + own_dp = false; } template - Solver::Solver(DiscreteProblem* dp, bool force_use_direct_solver) : dp(dp), own_dp(false) + Solver::Solver(DiscreteProblem* dp) : dp(dp), own_dp(false) { - this->init(force_use_direct_solver); } template - Solver::Solver(WeakForm* wf, SpaceSharedPtr& space, bool force_use_direct_solver) : dp(new DiscreteProblem(wf, space)), own_dp(true) + Solver::Solver(WeakFormSharedPtr wf, SpaceSharedPtr space) : dp(new DiscreteProblem(wf, space)), own_dp(true) { - this->init(force_use_direct_solver); } template - Solver::Solver(WeakForm* wf, Hermes::vector >& spaces, bool force_use_direct_solver) : dp(new DiscreteProblem(wf, spaces)), own_dp(true) + Solver::Solver(WeakFormSharedPtr wf, std::vector > spaces) : dp(new DiscreteProblem(wf, spaces)), own_dp(true) { - this->init(force_use_direct_solver); } - + template Solver::~Solver() { - if(own_dp) + if (own_dp) delete this->dp; else { @@ -65,11 +68,6 @@ namespace Hermes } } - template - void Solver::init(bool force_use_direct_solver) - { - } - template void Solver::solve() { @@ -77,23 +75,23 @@ namespace Hermes } template - void Solver::solve(MeshFunctionSharedPtr& initial_guess) + void Solver::solve(MeshFunctionSharedPtr initial_guess) { - if(this->dp->get_spaces().size() != 1) + if (this->dp->get_spaces().size() != 1) throw Hermes::Exceptions::ValueException("dp->get_spaces().size()", this->dp->get_spaces().size(), 1); Scalar* coeff_vec = new Scalar[Space::get_num_dofs(this->dp->get_spaces())]; OGProjection::project_global(this->dp->get_spaces()[0], initial_guess, coeff_vec); this->solve(coeff_vec); - delete [] coeff_vec; + delete[] coeff_vec; } template - void Solver::solve(Hermes::vector >& initial_guess) + void Solver::solve(std::vector > initial_guess) { Scalar* coeff_vec = new Scalar[Space::get_num_dofs(this->dp->get_spaces())]; OGProjection::project_global(this->dp->get_spaces(), initial_guess, coeff_vec); this->solve(coeff_vec); - delete [] coeff_vec; + delete[] coeff_vec; } template @@ -101,7 +99,7 @@ namespace Hermes { return this->dp->isOkay(); } - + template void Solver::set_time(double time) { @@ -110,7 +108,7 @@ namespace Hermes } template - void Solver::set_weak_formulation(WeakForm* wf) + void Solver::set_weak_formulation(WeakFormSharedPtr wf) { this->dp->set_weak_formulation(wf); } @@ -122,18 +120,18 @@ namespace Hermes } template - void Solver::set_spaces(Hermes::vector >& spaces) + void Solver::set_spaces(std::vector > spaces) { this->dp->set_spaces(spaces); } - + template - Hermes::vector >& Solver::get_spaces() + std::vector > Solver::get_spaces() { return this->dp->get_spaces(); } - template class HERMES_API Solver; - template class HERMES_API Solver >; + template class HERMES_API Solver < double > ; + template class HERMES_API Solver < std::complex > ; } } diff --git a/hermes2d/src/space/space.cpp b/hermes2d/src/space/space.cpp index 58a6eb3ca3..0cebbe295d 100644 --- a/hermes2d/src/space/space.cpp +++ b/hermes2d/src/space/space.cpp @@ -1,4 +1,3 @@ - // This file is part of Hermes2D. // // Hermes2D is free software: you can redistribute it and/or modify @@ -98,10 +97,10 @@ namespace Hermes if (essential_bcs != nullptr) { - for (typename Hermes::vector*>::const_iterator it = essential_bcs->begin(); it != essential_bcs->end(); it++) - for (unsigned int i = 0; i < (*it)->markers.size(); i++) - if (mesh->boundary_markers_conversion.conversion_table_inverse.find((*it)->markers.at(i)) == mesh->boundary_markers_conversion.conversion_table_inverse.end() && (*it)->markers.at(i) != HERMES_ANY) - throw Hermes::Exceptions::Exception("A boundary condition defined on a non-existent marker %s.", (*it)->markers.at(i).c_str()); + for (typename std::vector*>::const_iterator it = essential_bcs->begin(); it != essential_bcs->end(); it++) + for (unsigned int i = 0; i < (*it)->markers.size(); i++) + if (mesh->boundary_markers_conversion.conversion_table_inverse.find((*it)->markers.at(i)) == mesh->boundary_markers_conversion.conversion_table_inverse.end() && (*it)->markers.at(i) != HERMES_ANY) + throw Hermes::Exceptions::Exception("A boundary condition defined on a non-existent marker %s.", (*it)->markers.at(i).c_str()); } own_shapeset = (shapeset == nullptr); } @@ -166,7 +165,7 @@ namespace Hermes if (edata == nullptr) { - throw Hermes::Exceptions::Exception("nullptr edata detected in Space::get_element_order()."); + throw Hermes::Exceptions::Exception("nullptr edata detected in Space."); return false; } @@ -191,8 +190,9 @@ namespace Hermes } template - Node* Space::get_mid_edge_vertex_node(Element* e, int i, int j) + Node* Space::get_mid_edge_vertex_node(Element* e, unsigned char i, unsigned char j) { + unsigned char prev = e->prev_vert(i); if (e->is_triangle()) return e->sons[3]->vn[e->prev_vert(i)]; else if (e->sons[2] == nullptr) @@ -247,11 +247,6 @@ namespace Hermes this->essential_bcs = space->essential_bcs; - if (this->own_shapeset) - delete this->shapeset; - - this->shapeset = space->shapeset->clone(); - if (new_mesh->get_seq() != space->get_mesh()->get_seq()) { new_mesh->copy(space->get_mesh()); @@ -336,18 +331,18 @@ namespace Hermes resize_tables(); - if (mesh->get_element(id)->is_quad() && get_type() != HERMES_L2_SPACE && get_type() != HERMES_L2_MARKERWISE_CONST_SPACE && H2D_GET_V_ORDER(order) == 0) - if (order_v != -1) - order = H2D_MAKE_QUAD_ORDER(order, order_v); - else - order = H2D_MAKE_QUAD_ORDER(order, order); + if (mesh->get_element(id)->is_quad() && H2D_GET_V_ORDER(order) == 0) + if (order_v != -1) + order = H2D_MAKE_QUAD_ORDER(order, order_v); + else + order = H2D_MAKE_QUAD_ORDER(order, order); edata[id].order = order; seq = g_space_seq++; } template - void Space::update_essential_bc_values(Hermes::vector >& spaces, double time) + void Space::update_essential_bc_values(std::vector > spaces, double time) { int n = spaces.size(); for (int i = 0; i < n; i++) @@ -359,17 +354,17 @@ namespace Hermes } template - void Space::update_essential_bc_values(SpaceSharedPtr& space, double time) + void Space::update_essential_bc_values(SpaceSharedPtr space, double time) { space->get_essential_bcs()->set_current_time(time); space->update_essential_bc_values(); } template - int Space::get_num_dofs(Hermes::vector > spaces) + int Space::get_num_dofs(std::vector > spaces) { int ndof = 0; - for (unsigned int i = 0; i < spaces.size(); i++) + for (unsigned char i = 0; i < spaces.size(); i++) ndof += spaces[i]->get_num_dofs(); return ndof; } @@ -381,7 +376,7 @@ namespace Hermes } template - int Space::assign_dofs(Hermes::vector > spaces) + int Space::assign_dofs(std::vector > spaces) { int n = spaces.size(); @@ -462,10 +457,10 @@ namespace Hermes set_element_order_internal(e->id, std::max(horizontal_min_order, get_element_order(e->id) + horizontal_order_change)); } else - if (get_element_order(e->id) == -1) - set_element_order_internal(e->id, H2D_MAKE_QUAD_ORDER(horizontal_min_order, vertical_min_order)); - else - set_element_order_internal(e->id, H2D_MAKE_QUAD_ORDER(std::max(H2D_GET_H_ORDER(get_element_order(e->id)) + horizontal_order_change, horizontal_min_order), std::max(H2D_GET_V_ORDER(get_element_order(e->id)) + vertical_order_change, vertical_min_order))); + if (get_element_order(e->id) == -1) + set_element_order_internal(e->id, H2D_MAKE_QUAD_ORDER(horizontal_min_order, vertical_min_order)); + else + set_element_order_internal(e->id, H2D_MAKE_QUAD_ORDER(std::max(H2D_GET_H_ORDER(get_element_order(e->id)) + horizontal_order_change, horizontal_min_order), std::max(H2D_GET_V_ORDER(get_element_order(e->id)) + vertical_order_change, vertical_min_order))); } } @@ -473,18 +468,18 @@ namespace Hermes void Space::unrefine_all_mesh_elements_internal(bool keep_initial_refinements, bool only_unrefine_space_data) { // find inactive elements with active sons - Hermes::vector list; + std::vector list; Element* e; for_all_inactive_elements(e, this->mesh) { bool found = true; for (unsigned int i = 0; i < 4; i++) - if (e->sons[i] != nullptr && - (!e->sons[i]->active || (keep_initial_refinements && e->sons[i]->id < this->mesh->ninitial)) - ) - { + if (e->sons[i] != nullptr && + (!e->sons[i]->active || (keep_initial_refinements && e->sons[i]->id < this->mesh->ninitial)) + ) + { found = false; break; - } + } if (found) list.push_back(e->id); } @@ -588,9 +583,9 @@ namespace Hermes } template - void Space::unrefine_all_mesh_elements(Hermes::vector > spaces, bool keep_initial_refinements) + void Space::unrefine_all_mesh_elements(std::vector > spaces, bool keep_initial_refinements) { - for (int i = 0; i < spaces.size() - 1; i++) + for (unsigned char i = 0; i < spaces.size() - 1; i++) spaces[i]->unrefine_all_mesh_elements_internal(keep_initial_refinements, true); spaces[spaces.size() - 1]->unrefine_all_mesh_elements_internal(keep_initial_refinements, false); @@ -627,9 +622,9 @@ namespace Hermes { // The triangular order is just the current order. int current_order_triangular = current_order; - /// This is the default setup, we ALWAYS increase by attribute of this functor class: 'order_increase'. - /// This is OVERRIDABLE. Plus when overriding, one does not have to care about min / max possible values (due to shapeset, Space requirements). - /// These are guarded internally. + // This is the default setup, we ALWAYS increase by attribute of this functor class: 'order_increase'. + // This is OVERRIDABLE. Plus when overriding, one does not have to care about min / max possible values (due to shapeset, Space requirements). + // These are guarded internally. new_order = current_order_triangular + this->order_increase; } else @@ -680,16 +675,17 @@ namespace Hermes if (ref_space == nullptr) throw Exceptions::Exception("Something went wrong in ReferenceSpaceCreator::create_ref_space()."); - /// Call to the OVERRIDABLE handling method. + // Call to the OVERRIDABLE handling method. this->handle_orders(ref_space); - /// Finish - MUST BE CALLED BEFORE RETURN. + // Finish - MUST BE CALLED BEFORE RETURN. this->finish_construction(ref_space); // Assign dofs? if (assign_dofs) ref_space->assign_dofs(); - /// Return. + + // Return. return ref_space; } @@ -742,10 +738,10 @@ namespace Hermes if (ref_space->mesh->get_element(e->id)->active) ref_space->edata[e->id].changed_in_last_adaptation = to_set; else - for (unsigned int i = 0; i < 4; i++) - if (ref_space->mesh->get_element(e->id)->sons[i] != nullptr) - if (ref_space->mesh->get_element(e->id)->sons[i]->active) - ref_space->edata[ref_space->mesh->get_element(e->id)->sons[i]->id].changed_in_last_adaptation = to_set; + for (unsigned int i = 0; i < 4; i++) + if (ref_space->mesh->get_element(e->id)->sons[i] != nullptr) + if (ref_space->mesh->get_element(e->id)->sons[i]->active) + ref_space->edata[ref_space->mesh->get_element(e->id)->sons[i]->id].changed_in_last_adaptation = to_set; } } } @@ -755,7 +751,8 @@ namespace Hermes { // Adjust wrt. max and min possible orders. int mo = shapeset->get_max_order(); - int lower_limit = (get_type() == HERMES_L2_SPACE || get_type() == HERMES_L2_MARKERWISE_CONST_SPACE || get_type() == HERMES_HCURL_SPACE) ? 0 : 1; // L2 and Hcurl may use zero orders. + // L2 and Hcurl may use zero orders. + int lower_limit = (get_type() == HERMES_L2_SPACE || get_type() == HERMES_L2_MARKERWISE_CONST_SPACE || get_type() == HERMES_HCURL_SPACE) ? 0 : 1; int ho = std::max(lower_limit, std::min(H2D_GET_H_ORDER(order), mo)); int vo = std::max(lower_limit, std::min(H2D_GET_V_ORDER(order), mo)); order = e->is_triangle() ? ho : H2D_MAKE_QUAD_ORDER(ho, vo); @@ -763,19 +760,21 @@ namespace Hermes if (e->active) edata[e->id].order = order; else - for (int i = 0; i < 4; i++) - if (e->sons[i] != nullptr) - update_orders_recurrent(e->sons[i], order); + for (int i = 0; i < 4; i++) + if (e->sons[i] != nullptr) + update_orders_recurrent(e->sons[i], order); } template int Space::get_edge_order(Element* e, int edge) const { Node* en = e->en[edge]; - if (en->id >= nsize || edge >= (int)e->get_nvert()) return 0; + if (en->id >= nsize || edge >= e->get_nvert()) + return 0; if (ndata[en->id].n == -1) - return get_edge_order_internal(ndata[en->id].base); // constrained node + // constrained node + return get_edge_order_internal(ndata[en->id].base); else return get_edge_order_internal(en); } @@ -875,7 +874,7 @@ namespace Hermes if (edata == nullptr) { - throw Hermes::Exceptions::Exception("nullptr edata detected in Space::get_element_order()."); + throw Hermes::Exceptions::Exception("nullptr edata detected in Space::assign_dofs()."); return false; } @@ -896,7 +895,7 @@ namespace Hermes update_constraints(); post_assign(); - mesh_seq = mesh->get_seq(); + this->mesh_seq = mesh->get_seq(); seq_assigned = this->seq; this->ndof = next_dof - first_dof; @@ -913,7 +912,8 @@ namespace Hermes int i, j; for (i = 0; i < mesh->get_max_node_id(); i++) { - ndata[i].n = 1; // Natural boundary condition. The point is that it is not (0 == Dirichlet). + // Natural boundary condition. The point is that it is not (0 == Dirichlet). + ndata[i].n = 1; ndata[i].dof = H2D_UNASSIGNED_DOF; } @@ -922,16 +922,16 @@ namespace Hermes Element* e; for_all_active_elements(e, mesh) { - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { if (e->en[i]->bnd) - if (essential_bcs != nullptr) - if (essential_bcs->get_boundary_condition(mesh->boundary_markers_conversion.get_user_marker(e->en[i]->marker).marker) != nullptr) - { + if (essential_bcs != nullptr) + if (essential_bcs->get_boundary_condition(mesh->boundary_markers_conversion.get_user_marker(e->en[i]->marker).marker) != nullptr) + { j = e->next_vert(i); ndata[e->vn[i]->id].n = 0; ndata[e->vn[j]->id].n = 0; - } + } } } } @@ -967,9 +967,9 @@ namespace Hermes // add vertex, edge and bubble functions to the assembly list al->cnt = 0; - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) get_vertex_assembly_list(e, i, al); - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) get_boundary_assembly_list_internal(e, i, al); get_bubble_assembly_list(e, al); } @@ -992,7 +992,7 @@ namespace Hermes if (!ed->n) return; - int* indices = shapeset->get_bubble_indices(ed->order, e->get_mode()); + short* indices = shapeset->get_bubble_indices(ed->order, e->get_mode()); for (int i = 0, dof = ed->bdof; i < ed->n; i++, dof++, indices++) al->add_triplet(*indices, dof, 1.0); } @@ -1006,14 +1006,14 @@ namespace Hermes template void Space::precalculate_projection_matrix(int nv, double**& mat, double*& p) { - int n = shapeset->get_max_order() + 1 - nv; + unsigned char n = shapeset->get_max_order() + 1 - nv; mat = new_matrix(n, n); int component = (get_type() == HERMES_HDIV_SPACE) ? 1 : 0; Quad1DStd quad1d; - for (int i = 0; i < n; i++) + for (unsigned char i = 0; i < n; i++) { - for (int j = i; j < n; j++) + for (unsigned char j = i; j < n; j++) { int o = i + j + 4; double2* pt = quad1d.get_points(o); @@ -1022,8 +1022,9 @@ namespace Hermes double val = 0.0; for (int k = 0; k < quad1d.get_num_points(o); k++) { - val += pt[k][1] * shapeset->get_fn_value(ii, pt[k][0], -1.0, component, HERMES_MODE_QUAD) - * shapeset->get_fn_value(ij, pt[k][0], -1.0, component, HERMES_MODE_QUAD); + double val_ii = shapeset->get_fn_value(ii, pt[k][0], -1.0, component, HERMES_MODE_QUAD); + double val_ij = shapeset->get_fn_value(ij, pt[k][0], -1.0, component, HERMES_MODE_QUAD); + val += pt[k][1] * val_ii * val_ij; } mat[i][j] = val; } @@ -1046,8 +1047,8 @@ namespace Hermes nd->edge_bc_proj = nullptr; if (nd->dof != H2D_UNASSIGNED_DOF && en->bnd) - if (essential_bcs != nullptr) - { + if (essential_bcs != nullptr) + { EssentialBoundaryCondition *bc = this->essential_bcs->get_boundary_condition(this->mesh->boundary_markers_conversion.get_user_marker(en->marker).marker); if (bc != nullptr) { @@ -1060,7 +1061,7 @@ namespace Hermes ndata[e->vn[i]->id].vertex_bc_coef = nd->edge_bc_proj + 0; ndata[e->vn[j]->id].vertex_bc_coef = nd->edge_bc_proj + 1; } - } + } } template @@ -1069,7 +1070,7 @@ namespace Hermes Element* e; for_all_active_elements(e, mesh) { - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { int j = e->next_vert(i); if (e->vn[i]->bnd && e->vn[j]->bnd) @@ -1305,10 +1306,10 @@ namespace Hermes if (essential_bcs != nullptr && spaceTypeFromString(parsed_xml_space->spaceType().get().c_str()) != HERMES_L2_SPACE && spaceTypeFromString(parsed_xml_space->spaceType().get().c_str()) != HERMES_L2_MARKERWISE_CONST_SPACE) { space->essential_bcs = essential_bcs; - for (typename Hermes::vector*>::const_iterator it = essential_bcs->begin(); it != essential_bcs->end(); it++) - for (unsigned int i = 0; i < (*it)->markers.size(); i++) - if (space->get_mesh()->boundary_markers_conversion.conversion_table_inverse.find((*it)->markers.at(i)) == space->get_mesh()->boundary_markers_conversion.conversion_table_inverse.end()) - throw Hermes::Exceptions::Exception("A boundary condition defined on a non-existent marker."); + for (typename std::vector*>::const_iterator it = essential_bcs->begin(); it != essential_bcs->end(); it++) + for (unsigned int i = 0; i < (*it)->markers.size(); i++) + if (space->get_mesh()->boundary_markers_conversion.conversion_table_inverse.find((*it)->markers.at(i)) == space->get_mesh()->boundary_markers_conversion.conversion_table_inverse.end()) + throw Hermes::Exceptions::Exception("A boundary condition defined on a non-existent marker."); } space->resize_tables(); @@ -1404,10 +1405,10 @@ namespace Hermes if (essential_bcs != nullptr && space->get_type() != HERMES_L2_SPACE && space->get_type() != HERMES_L2_MARKERWISE_CONST_SPACE) { space->essential_bcs = essential_bcs; - for (typename Hermes::vector*>::const_iterator it = essential_bcs->begin(); it != essential_bcs->end(); it++) - for (unsigned int i = 0; i < (*it)->markers.size(); i++) - if (space->get_mesh()->boundary_markers_conversion.conversion_table_inverse.find((*it)->markers.at(i)) == space->get_mesh()->boundary_markers_conversion.conversion_table_inverse.end()) - throw Hermes::Exceptions::Exception("A boundary condition defined on a non-existent marker."); + for (typename std::vector*>::const_iterator it = essential_bcs->begin(); it != essential_bcs->end(); it++) + for (unsigned int i = 0; i < (*it)->markers.size(); i++) + if (space->get_mesh()->boundary_markers_conversion.conversion_table_inverse.find((*it)->markers.at(i)) == space->get_mesh()->boundary_markers_conversion.conversion_table_inverse.end()) + throw Hermes::Exceptions::Exception("A boundary condition defined on a non-existent marker."); } // Element count. @@ -1530,33 +1531,33 @@ namespace Hermes namespace Mixins { template - Hermes::vector >& SettableSpaces::get_spaces() + std::vector > SettableSpaces::get_spaces() { throw Hermes::Exceptions::MethodNotOverridenException("SettableSpaces::get_spaces()"); } template - SpaceSharedPtr& SettableSpaces::get_space(int n) + SpaceSharedPtr SettableSpaces::get_space(int n) { return this->get_spaces()[n]; } template - void SettableSpaces::set_space(SpaceSharedPtr& space) + void SettableSpaces::set_space(SpaceSharedPtr space) { - Hermes::vector > spaces; + std::vector > spaces; spaces.push_back(space); this->set_spaces(spaces); } - template class HERMES_API SettableSpaces; - template class HERMES_API SettableSpaces >; + template class HERMES_API SettableSpaces < double > ; + template class HERMES_API SettableSpaces < std::complex > ; } - template class HERMES_API Space; - template class HERMES_API Space >; + template class HERMES_API Space < double > ; + template class HERMES_API Space < std::complex > ; - template class HERMES_API SpaceSharedPtr; - template class HERMES_API SpaceSharedPtr >; + template class HERMES_API SpaceSharedPtr < double > ; + template class HERMES_API SpaceSharedPtr < std::complex > ; } } \ No newline at end of file diff --git a/hermes2d/src/space/space_h1.cpp b/hermes2d/src/space/space_h1.cpp index f7206767d0..84fb6756f0 100644 --- a/hermes2d/src/space/space_h1.cpp +++ b/hermes2d/src/space/space_h1.cpp @@ -51,15 +51,15 @@ namespace Hermes H1Space::H1Space(MeshSharedPtr mesh, EssentialBCs* essential_bcs, int p_init, Shapeset* shapeset) : Space(mesh, shapeset, essential_bcs) { - init(shapeset, p_init); - } + init(shapeset, p_init); + } template H1Space::H1Space(MeshSharedPtr mesh, int p_init, Shapeset* shapeset) : Space(mesh, shapeset, nullptr) { - init(shapeset, p_init); - } + init(shapeset, p_init); + } template H1Space::~H1Space() @@ -69,23 +69,32 @@ namespace Hermes template void H1Space::copy(SpaceSharedPtr space, MeshSharedPtr new_mesh) { - Space::copy(space, new_mesh); - + this->set_shapeset(space->get_shapeset(), true); this->precalculate_projection_matrix(2, this->proj_mat, this->chol_p); + Space::copy(space, new_mesh); + this->assign_dofs(); } template - void H1Space::set_shapeset(Shapeset *shapeset) + void H1Space::set_shapeset(Shapeset *shapeset, bool clone) { - if (shapeset->get_id() < 10) + if (!(shapeset->get_id() < 10)) + throw Hermes::Exceptions::Exception("Wrong shapeset type in H1Space::set_shapeset()"); + + if (clone) + { + if (this->own_shapeset) + delete this->shapeset; + + this->shapeset = shapeset->clone(); + } + else { this->shapeset = shapeset; this->own_shapeset = false; } - else - throw Hermes::Exceptions::Exception("Wrong shapeset type in H1Space::set_shapeset()"); } template @@ -107,7 +116,7 @@ namespace Hermes int order = this->get_element_order(e->id); if (order > 0) { - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { Node* vn = e->vn[i]; typename Space::NodeData* nd = this->ndata + vn->id; @@ -141,7 +150,7 @@ namespace Hermes int order = this->get_element_order(e->id); if (order > 0) { - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { Node* vn = e->vn[i]; typename Space::NodeData* nd = this->ndata + vn->id; @@ -156,21 +165,21 @@ namespace Hermes nd->n = ndofs; if (en->bnd) - if (this->essential_bcs != nullptr) - if (this->essential_bcs->get_boundary_condition(this->mesh->boundary_markers_conversion.get_user_marker(e->en[i]->marker).marker) != nullptr) - nd->dof = this->H2D_CONSTRAINED_DOF; - else - { - nd->dof = this->next_dof; - this->next_dof += ndofs; - this->edge_functions_count += ndofs; - } - else - { - nd->dof = this->next_dof; - this->next_dof += ndofs; - this->edge_functions_count += ndofs; - } + if (this->essential_bcs != nullptr) + if (this->essential_bcs->get_boundary_condition(this->mesh->boundary_markers_conversion.get_user_marker(e->en[i]->marker).marker) != nullptr) + nd->dof = this->H2D_CONSTRAINED_DOF; + else + { + nd->dof = this->next_dof; + this->next_dof += ndofs; + this->edge_functions_count += ndofs; + } + else + { + nd->dof = this->next_dof; + this->next_dof += ndofs; + this->edge_functions_count += ndofs; + } else { nd->dof = this->next_dof; @@ -216,10 +225,10 @@ namespace Hermes else // constrained { for (int j = 0; j < nd->ncomponents; j++) - if (nd->baselist[j].coef != (Scalar)0) - { + if (nd->baselist[j].coef != (Scalar)0) + { al->add_triplet(index, nd->baselist[j].dof, nd->baselist[j].coef); - } + } } } @@ -257,39 +266,34 @@ namespace Hermes } } - - template Scalar* H1Space::get_bc_projection(SurfPos* surf_pos, int order, EssentialBoundaryCondition *bc) { assert(order >= 1); Scalar* proj = malloc_with_check, Scalar>(order + 1, this); - if (bc->get_value_type() == EssentialBoundaryCondition::BC_CONST) + if (bc->get_value_type() == BC_CONST) { proj[0] = proj[1] = bc->value_const; } // If the BC is not constant. - else if (bc->get_value_type() == EssentialBoundaryCondition::BC_FUNCTION) + else if (bc->get_value_type() == BC_FUNCTION) { surf_pos->t = surf_pos->lo; // Find out the (x, y) coordinates for the first endpoint. - double x, y, n_x, n_y, t_x, t_y; + double x, y; Curve* curve = nullptr; CurvMap* cm = surf_pos->base->cm; if (cm) - { - while (!cm->toplevel) - cm = cm->parent->cm; curve = cm->curves[surf_pos->surf_num]; - } - CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y, n_x, n_y, t_x, t_y); + + CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y); // Calculate. - proj[0] = bc->value(x, y, n_x, n_y, t_x, t_y); + proj[0] = bc->value(x, y); surf_pos->t = surf_pos->hi; // Find out the (x, y) coordinates for the second endpoint. - CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y, n_x, n_y, t_x, t_y); + CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y); // Calculate. - proj[1] = bc->value(x, y, n_x, n_y, t_x, t_y); + proj[1] = bc->value(x, y); } if (order-- > 1) @@ -310,26 +314,21 @@ namespace Hermes Scalar l = proj[0] * s + proj[1] * t; surf_pos->t = surf_pos->lo * s + surf_pos->hi * t; - if (bc->get_value_type() == EssentialBoundaryCondition::BC_CONST) - rhs[i] += pt[j][1] * this->shapeset->get_fn_value(ii, pt[j][0], -1.0, 0, surf_pos->base->get_mode()) - * (bc->value_const - l); + if (bc->get_value_type() == BC_CONST) + rhs[i] += pt[j][1] * this->shapeset->get_fn_value(ii, pt[j][0], -1.0, 0, surf_pos->base->get_mode()) * (bc->value_const - l); // If the BC is not constant. - else if (bc->get_value_type() == EssentialBoundaryCondition::BC_FUNCTION) + else if (bc->get_value_type() == BC_FUNCTION) { // Find out the (x, y) coordinate. - double x, y, n_x, n_y, t_x, t_y; + double x, y; Curve* curve = nullptr; CurvMap* cm = surf_pos->base->cm; if (cm) - { - while (!cm->toplevel) - cm = cm->parent->cm; curve = cm->curves[surf_pos->surf_num]; - } - CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y, n_x, n_y, t_x, t_y); + + CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y); // Calculate. - rhs[i] += pt[j][1] * this->shapeset->get_fn_value(ii, pt[j][0], -1.0, 0, surf_pos->base->get_mode()) - * (bc->value(x, y, n_x, n_y, t_x, t_y) - l); + rhs[i] += pt[j][1] * this->shapeset->get_fn_value(ii, pt[j][0], -1.0, 0, surf_pos->base->get_mode()) * (bc->value(x, y) - l); } } } @@ -408,13 +407,25 @@ namespace Hermes } ncomponents = current - result; + if(ncomponents < max_result) + { +typename Space::BaseComponent* reallocated_result = (typename Space::BaseComponent*) realloc(result, ncomponents * sizeof(typename Space::BaseComponent)); + if(edge_dofs != NULL) + { + edge_dofs = reallocated_result + (edge_dofs - result); + } + return reallocated_result; + } + else + return result; } template void H1Space::update_constrained_nodes(Element* e, typename Space::EdgeInfo* ei0, typename Space::EdgeInfo* ei1, typename Space::EdgeInfo* ei2, typename Space::EdgeInfo* ei3) { - int j, k; + unsigned char i, j; + unsigned int k; typename Space::EdgeInfo* ei[4] = { ei0, ei1, ei2, ei3 }; typename Space::NodeData* nd; @@ -423,7 +434,7 @@ namespace Hermes // on non-refined elements all we have to do is update edge nodes lying on constrained edges if (e->active) { - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (i = 0; i < e->get_nvert(); i++) { if (ei[i] != nullptr) { @@ -440,7 +451,7 @@ namespace Hermes { // create new_ edge infos where we don't have them yet typename Space::EdgeInfo ei_data[4]; - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (i = 0; i < e->get_nvert(); i++) { if (ei[i] == nullptr) { @@ -463,7 +474,7 @@ namespace Hermes } // create a baselist for each mid-edge vertex node - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (i = 0; i < e->get_nvert(); i++) { if (ei[i] == nullptr) continue; j = e->next_vert(i); @@ -471,10 +482,14 @@ namespace Hermes Node* mid_vn = this->get_mid_edge_vertex_node(e, i, j); if (mid_vn == nullptr) continue; - Node* vn[2] = { e->vn[i], e->vn[j] }; // endpoint vertex nodes - Node* en = ei[i]->node; // constraining edge node - typename Space::BaseComponent *bl[2], dummy_bl[2]; // base lists of v[0] and v[1] - int nc[2] = { 0, 0 }; // number of components of bl[0] and bl[1] + // endpoint vertex nodes + Node* vn[2] = { e->vn[i], e->vn[j] }; + // constraining edge node + Node* en = ei[i]->node; + // base lists of v[0] and v[1] + typename Space::BaseComponent *bl[2], dummy_bl[2]; + // number of components of bl[0] and bl[1] + int nc[2] = { 0, 0 }; // get baselists of vn[0] and vn[1] - pretend we have them even if they are unconstrained for (k = 0; k < 2; k++) @@ -513,9 +528,9 @@ namespace Hermes // create edge infos for half-edges typename Space::EdgeInfo half_ei_data[4][2]; typename Space::EdgeInfo* half_ei[4][2]; - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (i = 0; i < e->get_nvert(); i++) { - if (ei[i] == nullptr) + if (!ei[i]) { half_ei[i][0] = half_ei[i][1] = nullptr; } @@ -570,7 +585,7 @@ namespace Hermes update_constrained_nodes(e, nullptr, nullptr, nullptr, nullptr); } - template HERMES_API class H1Space; - template HERMES_API class H1Space >; + template HERMES_API class H1Space < double > ; + template HERMES_API class H1Space < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/space/space_hcurl.cpp b/hermes2d/src/space/space_hcurl.cpp index 3fc9d2911c..d05968286f 100644 --- a/hermes2d/src/space/space_hcurl.cpp +++ b/hermes2d/src/space/space_hcurl.cpp @@ -33,15 +33,15 @@ namespace Hermes HcurlSpace::HcurlSpace(MeshSharedPtr mesh, EssentialBCs* essential_bcs, int p_init, Shapeset* shapeset) : Space(mesh, shapeset, essential_bcs) { - init(shapeset, p_init); - } + init(shapeset, p_init); + } template HcurlSpace::HcurlSpace(MeshSharedPtr mesh, int p_init, Shapeset* shapeset) : Space(mesh, shapeset, nullptr) { - init(shapeset, p_init); - } + init(shapeset, p_init); + } template void HcurlSpace::init(Shapeset* shapeset, int p_init, bool assign_dofs_init) @@ -76,21 +76,31 @@ namespace Hermes template void HcurlSpace::copy(SpaceSharedPtr space, MeshSharedPtr new_mesh) { - Space::copy(space, new_mesh); + this->set_shapeset(space->get_shapeset(), true); this->precalculate_projection_matrix(0, this->proj_mat, this->chol_p); + + Space::copy(space, new_mesh); } template - void HcurlSpace::set_shapeset(Shapeset *shapeset) + void HcurlSpace::set_shapeset(Shapeset *shapeset, bool clone) { - if (shapeset->get_id() < 20 && shapeset->get_id() > 9) + if (!(shapeset->get_id() < 20 && shapeset->get_id() > 9)) + throw Hermes::Exceptions::Exception("Wrong shapeset type in HcurlSpace::set_shapeset()"); + + if (clone) + { + if (this->own_shapeset) + delete this->shapeset; + + this->shapeset = shapeset->clone(); + } + else { this->shapeset = shapeset; this->own_shapeset = false; } - else - throw Hermes::Exceptions::Exception("Wrong shapeset type in HcurlSpace::set_shapeset()"); } template @@ -105,21 +115,21 @@ namespace Hermes int ndofs = this->get_edge_order_internal(en) + 1; this->ndata[en->id].n = ndofs; if (en->bnd) - if (this->essential_bcs != nullptr) - if (this->essential_bcs->get_boundary_condition(this->mesh->boundary_markers_conversion.get_user_marker(en->marker).marker) != nullptr) - this->ndata[en->id].dof = this->H2D_CONSTRAINED_DOF; - else - { - this->ndata[en->id].dof = this->next_dof; - this->next_dof += ndofs; - this->edge_functions_count += ndofs; - } - else - { - this->ndata[en->id].dof = this->next_dof; - this->next_dof += ndofs; - this->edge_functions_count += ndofs; - } + if (this->essential_bcs != nullptr) + if (this->essential_bcs->get_boundary_condition(this->mesh->boundary_markers_conversion.get_user_marker(en->marker).marker) != nullptr) + this->ndata[en->id].dof = this->H2D_CONSTRAINED_DOF; + else + { + this->ndata[en->id].dof = this->next_dof; + this->next_dof += ndofs; + this->edge_functions_count += ndofs; + } + else + { + this->ndata[en->id].dof = this->next_dof; + this->next_dof += ndofs; + this->edge_functions_count += ndofs; + } else { this->ndata[en->id].dof = this->next_dof; @@ -173,7 +183,8 @@ namespace Hermes int ori = part < 0 ? 1 : 0; if (part < 0) part ^= ~0; - nd = &this->ndata[nd->base->id]; // ccc + // ccc + nd = &this->ndata[nd->base->id]; for (int j = 0, dof = nd->dof; j < nd->n; j++, dof++) al->add_triplet(this->shapeset->get_constrained_edge_index(surf_num, j, ori, part, e->get_mode()), dof, 1.0); } @@ -207,21 +218,21 @@ namespace Hermes double t = (pt[j][0] + 1) * 0.5, s = 1.0 - t; surf_pos->t = surf_pos->lo * s + surf_pos->hi * t; - if (bc->get_value_type() == EssentialBoundaryCondition::BC_CONST) + if (bc->get_value_type() == BC_CONST) { rhs[i] += pt[j][1] * this->shapeset->get_fn_value(ii, pt[j][0], -1.0, 0, surf_pos->base->get_mode()) * bc->value_const * el; } // If the BC is not constant. - else if (bc->get_value_type() == EssentialBoundaryCondition::BC_FUNCTION) + else if (bc->get_value_type() == BC_FUNCTION) { // Find out the (x, y) coordinate. - double x, y, n_x, n_y, t_x, t_y; + double x, y; Curve* curve = surf_pos->base->is_curved() ? surf_pos->base->cm->curves[surf_pos->surf_num] : nullptr; - CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y, n_x, n_y, t_x, t_y); + CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y); // Calculate. rhs[i] += pt[j][1] * this->shapeset->get_fn_value(ii, pt[j][0], -1.0, 0, surf_pos->base->get_mode()) - * bc->value(x, y, n_x, n_y, t_x, t_y) * el; + * bc->value(x, y) * el; } } } @@ -241,7 +252,7 @@ namespace Hermes // on non-refined elements all we have to do is update edge nodes lying on constrained edges if (e->active) { - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { if (ei[i] != nullptr) { @@ -257,7 +268,7 @@ namespace Hermes { // create new_ edge infos where we don't have them yet typename Space::EdgeInfo ei_data[4]; - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { if (ei[i] == nullptr) { @@ -282,7 +293,7 @@ namespace Hermes // create edge infos for half-edges typename Space::EdgeInfo half_ei_data[4][2]; typename Space::EdgeInfo* half_ei[4][2]; - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { if (ei[i] == nullptr) { @@ -339,7 +350,7 @@ namespace Hermes update_constrained_nodes(e, nullptr, nullptr, nullptr, nullptr); } - template class HERMES_API HcurlSpace; - template class HERMES_API HcurlSpace >; + template class HERMES_API HcurlSpace < double > ; + template class HERMES_API HcurlSpace < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/space/space_hdiv.cpp b/hermes2d/src/space/space_hdiv.cpp index dd922ae56e..6592e72a21 100644 --- a/hermes2d/src/space/space_hdiv.cpp +++ b/hermes2d/src/space/space_hdiv.cpp @@ -32,15 +32,15 @@ namespace Hermes HdivSpace::HdivSpace(MeshSharedPtr mesh, EssentialBCs* essential_bcs, int p_init, Shapeset* shapeset) : Space(mesh, shapeset, essential_bcs) { - init(shapeset, p_init); - } + init(shapeset, p_init); + } template HdivSpace::HdivSpace(MeshSharedPtr mesh, int p_init, Shapeset* shapeset) : Space(mesh, shapeset, nullptr) { - init(shapeset, p_init); - } + init(shapeset, p_init); + } template void HdivSpace::init(Shapeset* shapeset, int p_init, bool assign_dofs_init) @@ -75,21 +75,31 @@ namespace Hermes template void HdivSpace::copy(SpaceSharedPtr space, MeshSharedPtr new_mesh) { - Space::copy(space, new_mesh); + this->set_shapeset(space->get_shapeset(), true); this->precalculate_projection_matrix(0, this->proj_mat, this->chol_p); + + Space::copy(space, new_mesh); } template - void HdivSpace::set_shapeset(Shapeset *shapeset) + void HdivSpace::set_shapeset(Shapeset *shapeset, bool clone) { - if (shapeset->get_id() < 30 && shapeset->get_id() > 19) + if (!(shapeset->get_id() < 30 && shapeset->get_id() > 19)) + throw Hermes::Exceptions::Exception("Wrong shapeset type in HdivSpace::set_shapeset()"); + + if (clone) + { + if (this->own_shapeset) + delete this->shapeset; + + this->shapeset = shapeset->clone(); + } + else { this->shapeset = shapeset; this->own_shapeset = false; } - else - throw Hermes::Exceptions::Exception("Wrong shapeset type in HdivSpace::set_shapeset()"); } template @@ -105,21 +115,21 @@ namespace Hermes this->ndata[en->id].n = ndofs; if (en->bnd) - if (this->essential_bcs != nullptr) - if (this->essential_bcs->get_boundary_condition(this->mesh->boundary_markers_conversion.get_user_marker(en->marker).marker) != nullptr) - this->ndata[en->id].dof = this->H2D_CONSTRAINED_DOF; - else - { - this->ndata[en->id].dof = this->next_dof; - this->next_dof += ndofs; - this->edge_functions_count += ndofs; - } - else - { - this->ndata[en->id].dof = this->next_dof; - this->next_dof += ndofs; - this->edge_functions_count += ndofs; - } + if (this->essential_bcs != nullptr) + if (this->essential_bcs->get_boundary_condition(this->mesh->boundary_markers_conversion.get_user_marker(en->marker).marker) != nullptr) + this->ndata[en->id].dof = this->H2D_CONSTRAINED_DOF; + else + { + this->ndata[en->id].dof = this->next_dof; + this->next_dof += ndofs; + this->edge_functions_count += ndofs; + } + else + { + this->ndata[en->id].dof = this->next_dof; + this->next_dof += ndofs; + this->edge_functions_count += ndofs; + } else { this->ndata[en->id].dof = this->next_dof; @@ -175,7 +185,8 @@ namespace Hermes int ori = part < 0 ? 1 : 0; if (part < 0) part ^= ~0; - nd = &this->ndata[nd->base->id]; // ccc + // ccc + nd = &this->ndata[nd->base->id]; for (int j = 0, dof = nd->dof; j < nd->n; j++, dof++) al->add_triplet(this->shapeset->get_constrained_edge_index(surf_num, j, ori, part, e->get_mode()), dof, 1.0); } @@ -187,8 +198,8 @@ namespace Hermes typename Space::ElementData* ed = &this->edata[e->id]; if (!ed->n) return; - int* indices = this->shapeset->get_bubble_indices(ed->order, e->get_mode()); - for (int i = 0, dof = ed->bdof; i < ed->n; i++, dof++) + short* indices = this->shapeset->get_bubble_indices(ed->order, e->get_mode()); + for (unsigned short i = 0, dof = ed->bdof; i < ed->n; i++, dof++) al->add_triplet(*indices++, dof, 1.0); } @@ -223,21 +234,21 @@ namespace Hermes // If the BC on this part of the boundary is constant. EssentialBoundaryCondition *bc = this->essential_bcs->get_boundary_condition(this->mesh->boundary_markers_conversion.get_user_marker(surf_pos->marker).marker); - if (bc->get_value_type() == EssentialBoundaryCondition::BC_CONST) + if (bc->get_value_type() == BC_CONST) { rhs[i] += pt[j][1] * this->shapeset->get_fn_value(ii, pt[j][0], -1.0, 1, surf_pos->base->get_mode()) * bc->value_const * el; } // If the BC is not constant. - else if (bc->get_value_type() == EssentialBoundaryCondition::BC_FUNCTION) + else if (bc->get_value_type() == BC_FUNCTION) { // Find out the (x, y) coordinate. - double x, y, n_x, n_y, t_x, t_y; + double x, y; Curve* curve = surf_pos->base->is_curved() ? surf_pos->base->cm->curves[surf_pos->surf_num] : nullptr; - CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y, n_x, n_y, t_x, t_y); + CurvMap::nurbs_edge(surf_pos->base, curve, surf_pos->surf_num, 2.0*surf_pos->t - 1.0, x, y); // Calculate. rhs[i] += pt[j][1] * this->shapeset->get_fn_value(ii, pt[j][0], -1.0, 1, surf_pos->base->get_mode()) - * bc->value(x, y, n_x, n_y, t_x, t_y) * el; + * bc->value(x, y) * el; } } } @@ -261,7 +272,7 @@ namespace Hermes // on non-refined elements all we have to do is update edge nodes lying on constrained edges if (e->active) { - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { if (ei[i] != nullptr) { @@ -277,7 +288,7 @@ namespace Hermes { // create new_ edge infos where we don't have them yet typename Space::EdgeInfo ei_data[4]; - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { if (ei[i] == nullptr) { @@ -302,7 +313,7 @@ namespace Hermes // create edge infos for half-edges typename Space::EdgeInfo half_ei_data[4][2]; typename Space::EdgeInfo* half_ei[4][2]; - for (unsigned int i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { if (ei[i] == nullptr) { @@ -359,7 +370,7 @@ namespace Hermes update_constrained_nodes(e, nullptr, nullptr, nullptr, nullptr); } - template HERMES_API class HdivSpace; - template HERMES_API class HdivSpace >; + template HERMES_API class HdivSpace < double > ; + template HERMES_API class HdivSpace < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/space/space_l2.cpp b/hermes2d/src/space/space_l2.cpp index 95cf791fc1..42c847df8d 100644 --- a/hermes2d/src/space/space_l2.cpp +++ b/hermes2d/src/space/space_l2.cpp @@ -61,25 +61,34 @@ namespace Hermes template L2Space::~L2Space() { - } template void L2Space::copy(SpaceSharedPtr space, MeshSharedPtr new_mesh) { + this->set_shapeset(space->get_shapeset(), true); + Space::copy(space, new_mesh); } template - void L2Space::set_shapeset(Shapeset *shapeset) + void L2Space::set_shapeset(Shapeset *shapeset, bool clone) { - if (shapeset->get_id() < 40 && shapeset->get_id() > 29) + if (!(shapeset->get_id() < 40 && shapeset->get_id() > 29)) + throw Hermes::Exceptions::Exception("Wrong shapeset type in L2Space::set_shapeset()"); + + if (clone) + { + if (this->own_shapeset) + delete this->shapeset; + + this->shapeset = shapeset->clone(); + } + else { this->shapeset = shapeset; this->own_shapeset = false; } - else - throw Hermes::Exceptions::Exception("Wrong shapeset type in L2Space::set_shapeset()"); } template @@ -91,7 +100,8 @@ namespace Hermes { typename Space::ElementData* ed = &this->edata[e->id]; ed->bdof = this->next_dof; - ed->n = this->shapeset->get_num_bubbles(ed->order, e->get_mode()); //FIXME: this function might return invalid value because retrieved bubble functions for non-uniform orders might be invalid for the given order. + //FIXME: this function might return invalid value because retrieved bubble functions for non-uniform orders might be invalid for the given order. + ed->n = this->shapeset->get_num_bubbles(ed->order, e->get_mode()); this->next_dof += ed->n; this->bubble_functions_count += ed->n; } @@ -115,8 +125,8 @@ namespace Hermes typename Space::ElementData* ed = &this->edata[e->id]; if (!ed->n) return; - int* indices = this->shapeset->get_bubble_indices(ed->order, e->get_mode()); - for (int i = 0, dof = ed->bdof; i < ed->n; i++, dof++) + short* indices = this->shapeset->get_bubble_indices(ed->order, e->get_mode()); + for (unsigned short i = 0, dof = ed->bdof; i < ed->n; i++, dof++) { //printf("triplet: %d, %d, %f\n", *indices, dof, 1.0); al->add_triplet(*indices++, dof, 1.0); @@ -158,10 +168,10 @@ namespace Hermes this->bubble_functions_count = max_marker; } - template HERMES_API class L2Space; - template HERMES_API class L2Space >; + template HERMES_API class L2Space < double > ; + template HERMES_API class L2Space < std::complex > ; - template HERMES_API class L2MarkerWiseConstSpace; - template HERMES_API class L2MarkerWiseConstSpace >; + template HERMES_API class L2MarkerWiseConstSpace < double > ; + template HERMES_API class L2MarkerWiseConstSpace < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes2d/src/spline.cpp b/hermes2d/src/spline.cpp index 8dae01380b..36f8416b99 100644 --- a/hermes2d/src/spline.cpp +++ b/hermes2d/src/spline.cpp @@ -22,7 +22,7 @@ namespace Hermes { namespace Hermes2D { - CubicSpline::CubicSpline(Hermes::vector points, Hermes::vector values, + CubicSpline::CubicSpline(std::vector points, std::vector values, double bc_left, double bc_right, bool first_der_left, bool first_der_right, bool extrapolate_der_left, bool extrapolate_der_right) : Hermes::Hermes1DFunction(), points(points), values(values), @@ -30,11 +30,11 @@ namespace Hermes first_der_right(first_der_right), extrapolate_der_left(extrapolate_der_left), extrapolate_der_right(extrapolate_der_right) { - for (int i = 1; i < points.size(); i++) + for (unsigned short i = 1; i < points.size(); i++) if (points[i] <= points[i - 1]) throw Exceptions::Exception("Points must be in ascending order when constructing a spline."); - this->is_const = false; - } + this->is_const = false; + } CubicSpline::CubicSpline(double const_value) : Hermes::Hermes1DFunction(const_value) { @@ -176,7 +176,7 @@ namespace Hermes fclose(f); throw Hermes::Exceptions::Exception("The cubic spline has no coefficients. Calculate using calculate_coeffs."); } - + // Plotting on the left of the area of definition. double x_left = point_left - extension; double h = extension / subdiv; @@ -343,33 +343,39 @@ namespace Hermes // Choose just one of the following two variables to be True, // and state the corresponding value for the derivative. offset = 2 * nelem + 2 * (nelem - 1); - double xx = points[0]; // Left end-point. + // Left end-point. + double xx = points[0]; if (first_der_left == false) { matrix[offset + 0][2] = 2; matrix[offset + 0][3] = 6 * xx; - rhs[n - 2] = bc_left; // Value of the second derivative. + // Value of the second derivative. + rhs[n - 2] = bc_left; } else { matrix[offset + 0][1] = 1; matrix[offset + 0][2] = 2 * xx; matrix[offset + 0][3] = 3 * xx*xx; - rhs[n - 2] = bc_left; // Value of the first derivative. + // Value of the first derivative. + rhs[n - 2] = bc_left; } - xx = points[nelem]; // Right end-point. + // Right end-point. + xx = points[nelem]; if (first_der_right == false) { matrix[offset + 1][n - 2] = 2; matrix[offset + 1][n - 1] = 6 * xx; - rhs[n - 1] = bc_right; // Value of the second derivative. + // Value of the second derivative. + rhs[n - 1] = bc_right; } else { matrix[offset + 1][n - 3] = 1; matrix[offset + 1][n - 2] = 2 * xx; matrix[offset + 1][n - 1] = 3 * xx*xx; - rhs[n - 1] = bc_right; // Value of the first derivative. + // Value of the first derivative. + rhs[n - 1] = bc_right; } // Solve the matrix problem. @@ -408,4 +414,4 @@ namespace Hermes return; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/sub_element_map.cpp b/hermes2d/src/sub_element_map.cpp deleted file mode 100644 index 8cebcd6ead..0000000000 --- a/hermes2d/src/sub_element_map.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// This file is part of Hermes2D. -// -// Hermes2D is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// Hermes2D 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 Hermes2D. If not, see . - -#include "sub_element_map.h" - -namespace Hermes -{ - namespace Hermes2D - { - template - SubElementMap::SubElementMap() : root(nullptr) - { - } - - template - SubElementMap::~SubElementMap() - { - this->clear(); - } - - template - void SubElementMap::clear() - { - this->root.clear_subtree(); - memset(this->root.children, 0, 8 * sizeof(Node*)); - } - - template - T* SubElementMap::get(uint64_t sub_idx, bool& to_add) - { - if(sub_idx == 0) - return root.data; - Node* node = &root; - while (sub_idx > 0) - { - int current_son = (sub_idx - 1) & 7; - Node* child_node = node->children[current_son]; - if(child_node == nullptr) - if(to_add) - node->children[current_son] = new Node(nullptr); - else - return nullptr; - sub_idx = (sub_idx - 1) >> 3; - node = child_node; - } - if(to_add) - to_add = false; - return node->data; - } - - template - void SubElementMap::add(uint64_t sub_idx, T* data) - { - Node* node = &root; - while (sub_idx > 0) - { - int current_son = (sub_idx - 1) & 7; - Node* child_node = node->children[current_son]; - if(child_node == nullptr) - { - node->children[current_son] = new Node(nullptr); - } - sub_idx = (sub_idx - 1) >> 3; - node = child_node; - } - node->data = data; - } - - template - SubElementMap::Node::Node(T* data) : data(data) - { - memset(this->children, 0, 8 * sizeof(Node*)); - } - - template - void SubElementMap::Node::clear_subtree() - { - for(int i = 0; i < 8; i++) - { - if(this->children[i] != nullptr) - { - this->children[i]->clear_subtree; - delete this->children[i]; - } - } - } - } -} \ No newline at end of file diff --git a/hermes2d/src/views/base_view.cpp b/hermes2d/src/views/base_view.cpp index 3a028f5cc9..fa5014aa74 100644 --- a/hermes2d/src/views/base_view.cpp +++ b/hermes2d/src/views/base_view.cpp @@ -32,7 +32,6 @@ namespace Hermes BaseView::BaseView(const char* title, WinGeom* wg) : ScalarView((char*)title, wg), sln(MeshFunctionSharedPtr(new Solution())), complex_filter(MeshFunctionSharedPtr()) { - pss = nullptr; this->show_edges = true; basic_title.assign(title); } @@ -41,7 +40,6 @@ namespace Hermes BaseView::BaseView(char* title, WinGeom* wg) : ScalarView(title, wg), sln(MeshFunctionSharedPtr(new Solution())), complex_filter(MeshFunctionSharedPtr()) { - pss = nullptr; this->show_edges = true; basic_title.assign(title); } @@ -51,7 +49,6 @@ namespace Hermes { this->space = space; free(); - pss = new PrecalcShapeset(space->shapeset); ndof = this->space->get_num_dofs(); base_index = 0; this->eps = eps; @@ -62,7 +59,6 @@ namespace Hermes template void BaseView::free() { - if (pss != nullptr) { delete pss; pss = nullptr; } } template<> @@ -74,11 +70,11 @@ namespace Hermes { if (base_index < ndof) coeffs[base_index] = 1.0; - Solution::vector_to_solution(coeffs, space, sln, pss, false); + Solution::vector_to_solution(coeffs, space, sln, false); } else { - Solution::vector_to_solution(coeffs, space, sln, pss, true); + Solution::vector_to_solution(coeffs, space, sln, true); } ScalarView::show(sln, item); @@ -94,14 +90,13 @@ namespace Hermes if (base_index >= 0) { if (base_index < ndof) coeffs[base_index] = 1.0; - Solution >::vector_to_solution(coeffs, space, sln, pss, false); + Solution >::vector_to_solution(coeffs, space, sln, false); } else { - Solution >::vector_to_solution(coeffs, space, sln, pss, true); + Solution >::vector_to_solution(coeffs, space, sln, true); } - complex_filter = MeshFunctionSharedPtr(new Hermes::Hermes2D::RealFilter(sln.get())); ScalarView::show(complex_filter, item); update_title(); @@ -176,8 +171,8 @@ namespace Hermes { namespace Views { - template class HERMES_API BaseView; - template class HERMES_API BaseView >; + template class HERMES_API BaseView < double > ; + template class HERMES_API BaseView < std::complex > ; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/views/linearizer.cpp b/hermes2d/src/views/linearizer.cpp index 02839c2450..f79f603a60 100644 --- a/hermes2d/src/views/linearizer.cpp +++ b/hermes2d/src/views/linearizer.cpp @@ -40,7 +40,7 @@ namespace Hermes } template - LinearizerMultidimensional::LinearizerMultidimensional(LinearizerOutputType linearizerOutputType, bool auto_max) : + LinearizerMultidimensional::LinearizerMultidimensional(LinearizerOutputType linearizerOutputType) : states(nullptr), num_states(0), dmult(1.0), curvature_epsilon(1e-5), linearizerOutputType(linearizerOutputType), criterion(LinearizerCriterionFixed(1)) { xdisp = nullptr; @@ -103,8 +103,8 @@ namespace Hermes void LinearizerMultidimensional::check_data(MeshFunctionSharedPtr* sln) { for (int k = 0; k < LinearizerDataDimensions::dimension; k++) - if (!sln[k]) - throw Exceptions::Exception("Linearizer: too few solutions, probably wrong template argument."); + if (!sln[k]) + throw Exceptions::Exception("Linearizer: too few solutions, probably wrong template argument."); } template @@ -369,7 +369,7 @@ namespace Hermes } template - void LinearizerMultidimensional::save_solution_vtk(Hermes::vector > slns, Hermes::vector items, const char* filename, const char *quantity_name, + void LinearizerMultidimensional::save_solution_vtk(std::vector > slns, std::vector items, const char* filename, const char *quantity_name, bool mode_3D) { if (this->linearizerOutputType != FileExport) @@ -417,7 +417,8 @@ namespace Hermes fprintf(f, "CELL_TYPES %d\n", this->get_triangle_count()); for (int i = 0; i < this->get_triangle_count(); i++) { - fprintf(f, "5\n"); // The "5" means triangle in VTK. + // The "5" means triangle in VTK. + fprintf(f, "5\n"); } // This outputs double solution values. @@ -445,15 +446,15 @@ namespace Hermes template void LinearizerMultidimensional::save_solution_vtk(MeshFunctionSharedPtr sln, const char* filename, const char* quantity_name, bool mode_3D, int item) { - Hermes::vector > slns; - Hermes::vector items; + std::vector > slns; + std::vector items; slns.push_back(sln); items.push_back(item); LinearizerMultidimensional::save_solution_vtk(slns, items, filename, quantity_name, mode_3D); } template - void LinearizerMultidimensional::save_solution_tecplot(Hermes::vector > slns, Hermes::vector items, const char* filename, Hermes::vector quantity_names) + void LinearizerMultidimensional::save_solution_tecplot(std::vector > slns, std::vector items, const char* filename, std::vector quantity_names) { if (this->linearizerOutputType != FileExport) throw Exceptions::Exception("This LinearizerMultidimensional is not meant to be used for file export, create a new one with appropriate linearizerOutputType."); @@ -497,11 +498,11 @@ namespace Hermes template void LinearizerMultidimensional::save_solution_tecplot(MeshFunctionSharedPtr sln, const char* filename, const char* quantity_name, int item) { - Hermes::vector > slns; - Hermes::vector items; + std::vector > slns; + std::vector items; slns.push_back(sln); items.push_back(item); - Hermes::vector quantity_names; + std::vector quantity_names; quantity_names.push_back(quantity_name); LinearizerMultidimensional::save_solution_tecplot(slns, items, filename, quantity_names); } @@ -558,7 +559,7 @@ namespace Hermes { while (this->current_thread_size == 0) { - if (this->current_thread_size == this->thread_sizes.size() - 1) + if (this->current_thread_size == this->thread_sizes[this->thread_sizes.size() - 1]) { this->end = true; break; @@ -665,7 +666,6 @@ namespace Hermes return this->linearizer->threadLinearizerMultidimensional[this->current_thread]->triangle_markers[this->current_thread_index]; } - template #ifdef _MSC_VER typename LinearizerMultidimensional::Iterator LinearizerMultidimensional::vertices_begin() const @@ -759,15 +759,15 @@ namespace Hermes return count; } - template class HERMES_API LinearizerMultidimensional >; - template class HERMES_API LinearizerMultidimensional >::Iterator::triangle_t>; - template class HERMES_API LinearizerMultidimensional >::Iterator::vertex_t>; - template class HERMES_API LinearizerMultidimensional >::Iterator::edge_t>; + template class HERMES_API LinearizerMultidimensional < ScalarLinearizerDataDimensions > ; + template class HERMES_API LinearizerMultidimensional >::Iterator < ScalarLinearizerDataDimensions::triangle_t > ; + template class HERMES_API LinearizerMultidimensional >::Iterator < ScalarLinearizerDataDimensions::vertex_t > ; + template class HERMES_API LinearizerMultidimensional >::Iterator < ScalarLinearizerDataDimensions::edge_t > ; - template class HERMES_API LinearizerMultidimensional >; - template class HERMES_API LinearizerMultidimensional >::Iterator::triangle_t>; - template class HERMES_API LinearizerMultidimensional >::Iterator::vertex_t>; - template class HERMES_API LinearizerMultidimensional >::Iterator::edge_t>; + template class HERMES_API LinearizerMultidimensional < VectorLinearizerDataDimensions > ; + template class HERMES_API LinearizerMultidimensional >::Iterator < VectorLinearizerDataDimensions::triangle_t > ; + template class HERMES_API LinearizerMultidimensional >::Iterator < VectorLinearizerDataDimensions::vertex_t > ; + template class HERMES_API LinearizerMultidimensional >::Iterator < VectorLinearizerDataDimensions::edge_t > ; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/views/mesh_view.cpp b/hermes2d/src/views/mesh_view.cpp index 4a1a81928d..d5bdeb64a6 100644 --- a/hermes2d/src/views/mesh_view.cpp +++ b/hermes2d/src/views/mesh_view.cpp @@ -26,7 +26,7 @@ namespace Hermes namespace Views { MeshView::MeshView(const char* title, WinGeom* wg) - : View(title, wg), lin(nullptr) + : View(title, wg), lin(new Linearizer(OpenGL)) { nodes = elems = nullptr; b_scale = false; @@ -36,7 +36,7 @@ namespace Hermes } MeshView::MeshView(char* title, WinGeom* wg) - : View(title, wg), lin(nullptr) + : View(title, wg), lin(new Linearizer(OpenGL)) { nodes = elems = nullptr; b_scale = false; @@ -86,7 +86,7 @@ namespace Hermes oi->id = e->id; oi->type = e->marker; oi->x = oi->y = 0.0; - for (unsigned i = 0; i < e->get_nvert(); i++) + for (unsigned char i = 0; i < e->get_nvert(); i++) { oi->x += e->vn[i]->x; oi->y += e->vn[i]->y; @@ -102,6 +102,11 @@ namespace Hermes wait_for_draw(); } + Linearizer* MeshView::get_linearizer() + { + return this->lin; + } + void MeshView::set_b_elem_mrk(bool set) { if (b_ids) diff --git a/hermes2d/src/views/order_view.cpp b/hermes2d/src/views/order_view.cpp index 0f14225543..3d06c3819e 100644 --- a/hermes2d/src/views/order_view.cpp +++ b/hermes2d/src/views/order_view.cpp @@ -166,9 +166,9 @@ namespace Hermes double2* lbox; int nl = ord.get_labels(lvert, ltext, lbox); for (i = 0; i < nl; i++) - if (lbox[i][0] * scale > get_text_width(ltext[i]) && - lbox[i][1] * scale > 13) - { + if (lbox[i][0] * scale > get_text_width(ltext[i]) && + lbox[i][1] * scale > 13) + { //color = get_palette_color((vert[lvert[i]][2] - 1) / 9.0); const float* color = order_colors[(int)vert[lvert[i]][2]]; if ((color[0] * 0.39f + color[1] * 0.50f + color[2] * 0.11f) > 0.5f) @@ -177,7 +177,7 @@ namespace Hermes glColor3f(1, 1, 1); draw_text(tvert[lvert[i]][0], tvert[lvert[i]][1], ltext[i], 0); - } + } } free_with_check(tvert); @@ -210,18 +210,18 @@ namespace Hermes case 'p': { - switch (pal_type) - { - case H2DV_PT_HUESCALE: pal_type = H2DV_PT_GRAYSCALE; break; - case H2DV_PT_GRAYSCALE: pal_type = H2DV_PT_INVGRAYSCALE; break; - case H2DV_PT_INVGRAYSCALE: pal_type = H2DV_PT_HUESCALE; break; - default: throw Hermes::Exceptions::Exception("Invalid palette type"); - } - ord.lock_data(); - init_order_palette(ord.get_vertices()); - ord.unlock_data(); - refresh(); - break; + switch (pal_type) + { + case H2DV_PT_HUESCALE: pal_type = H2DV_PT_GRAYSCALE; break; + case H2DV_PT_GRAYSCALE: pal_type = H2DV_PT_INVGRAYSCALE; break; + case H2DV_PT_INVGRAYSCALE: pal_type = H2DV_PT_HUESCALE; break; + default: throw Hermes::Exceptions::Exception("Invalid palette type"); + } + ord.lock_data(); + init_order_palette(ord.get_vertices()); + ord.unlock_data(); + refresh(); + break; } default: diff --git a/hermes2d/src/views/orderizer.cpp b/hermes2d/src/views/orderizer.cpp index f77db348e3..47f9b670d4 100644 --- a/hermes2d/src/views/orderizer.cpp +++ b/hermes2d/src/views/orderizer.cpp @@ -25,37 +25,37 @@ namespace Hermes namespace Views { // vertices - static int* ord_np[2] = { num_vert_tri, num_vert_quad }; + static unsigned char* ord_np[2] = { num_vert_tri, num_vert_quad }; static double3* ord_tables_tri[2] = { vert_tri0, vert_tri1 }; static double3* ord_tables_quad[2] = { vert_quad0, vert_quad1 }; static double3** ord_tables[2] = { ord_tables_tri, ord_tables_quad }; // triangles - static int* num_elem[2] = { num_elem_tri, num_elem_quad }; + static unsigned short* num_elem[2] = { num_elem_tri, num_elem_quad }; static int3* ord_elem_tri[2] = { elem_tri0, elem_tri1 }; static int3* ord_elem_quad[2] = { elem_quad0, elem_quad1 }; static int3** ord_elem[2] = { ord_elem_tri, ord_elem_quad }; // edges - static int* num_edge[2] = { num_edge_tri, num_edge_quad }; + static unsigned short* num_edge[2] = { num_edge_tri, num_edge_quad }; static int3* ord_edge_tri[2] = { edge_tri0, edge_tri1 }; static int3* ord_edge_quad[2] = { edge_quad0, edge_quad1 }; static int3** ord_edge[2] = { ord_edge_tri, ord_edge_quad }; // vertices_simple - static int* ord_np_simple[2] = { num_vert_tri_simple, num_vert_quad_simple }; + static unsigned char* ord_np_simple[2] = { num_vert_tri_simple, num_vert_quad_simple }; static double3* ord_tables_tri_simple[2] = { vert_tri_simple, vert_tri_simple }; static double3* ord_tables_quad_simple[2] = { vert_quad_simple, vert_quad_simple }; static double3** ord_tables_simple[2] = { ord_tables_tri_simple, ord_tables_quad_simple }; // triangles - static int* num_elem_simple[2] = { num_elem_tri_simple, num_elem_quad_simple }; + static unsigned short* num_elem_simple[2] = { num_elem_tri_simple, num_elem_quad_simple }; static int3* ord_elem_tri_simple[2] = { elem_tri_simple, elem_tri_simple }; static int3* ord_elem_quad_simple[2] = { elem_quad_simple, elem_quad_simple }; static int3** ord_elem_simple[2] = { ord_elem_tri_simple, ord_elem_quad_simple }; // edges - static int* num_edge_simple[2] = { num_edge_tri_simple, num_edge_quad_simple }; + static unsigned short* num_edge_simple[2] = { num_edge_tri_simple, num_edge_quad_simple }; static int3* ord_edge_tri_simple[2] = { edge_tri_simple, edge_tri_simple }; static int3* ord_edge_quad_simple[2] = { edge_quad_simple, edge_quad_simple }; static int3** ord_edge_simple[2] = { ord_edge_tri_simple, ord_edge_quad_simple }; @@ -71,6 +71,11 @@ namespace Hermes tables = ord_tables; np = ord_np; }; + + virtual unsigned char get_id() + { + return 5; + }; } quad_ord; static class Quad2DOrdSimple : public Quad2D @@ -84,6 +89,11 @@ namespace Hermes tables = ord_tables_simple; np = ord_np_simple; }; + + virtual unsigned char get_id() + { + return 6; + }; } quad_ord_simple; Orderizer::Orderizer() @@ -108,7 +118,7 @@ namespace Hermes { for (int j = 0; j <= 10; j++) { - assert((unsigned)p < sizeof(buffer)-5); + assert((unsigned)p < sizeof(buffer) - 5); if (i == j) sprintf(buffer + p, "%d", i); else @@ -236,16 +246,16 @@ namespace Hermes { oo = o[4] = o[5] = space->get_element_order(e->id); if (show_edge_orders) - for (unsigned int k = 0; k < e->get_nvert(); k++) - o[k] = space->get_edge_order(e, k); + for (unsigned int k = 0; k < e->get_nvert(); k++) + o[k] = space->get_edge_order(e, k); else if (e->is_curved()) { if (e->is_triangle()) - for (unsigned int k = 0; k < e->get_nvert(); k++) - o[k] = oo; + for (unsigned int k = 0; k < e->get_nvert(); k++) + o[k] = oo; else - for (unsigned int k = 0; k < e->get_nvert(); k++) - o[k] = H2D_GET_H_ORDER(oo); + for (unsigned int k = 0; k < e->get_nvert(); k++) + o[k] = H2D_GET_H_ORDER(oo); } double3* pt; @@ -373,14 +383,14 @@ namespace Hermes void Orderizer::free() { - free_with_check(verts, true); - free_with_check(lvert, true); - free_with_check(ltext, true); - free_with_check(lbox, true); - free_with_check(tris, true); - free_with_check(tri_markers, true); - free_with_check(edges, true); - free_with_check(edge_markers, true); + free_with_check(verts, true); + free_with_check(lvert, true); + free_with_check(ltext, true); + free_with_check(lbox, true); + free_with_check(tris, true); + free_with_check(tri_markers, true); + free_with_check(edges, true); + free_with_check(edge_markers, true); } template @@ -417,7 +427,8 @@ namespace Hermes fprintf(f, "CELL_TYPES %d\n", this->triangle_count); for (int i = 0; i < this->triangle_count; i++) - fprintf(f, "5\n"); // The "5" means triangle in VTK. + // The "5" means triangle in VTK. + fprintf(f, "5\n"); // This outputs double solution values. Look into Hermes2D/src/output/vtk.cpp // for how it is done for vectors. @@ -464,7 +475,8 @@ namespace Hermes fprintf(f, "CELL_TYPES %d\n", this->triangle_count); for (int i = 0; i < this->triangle_count; i++) - fprintf(f, "5\n"); // The "5" means triangle in VTK. + // The "5" means triangle in VTK. + fprintf(f, "5\n"); // This outputs double solution values. Look into Hermes2D/src/output/vtk.cpp // for how it is done for vectors. @@ -507,7 +519,8 @@ namespace Hermes fprintf(f, "CELL_TYPES %d\n", this->edges_count); for (int i = 0; i < this->edges_count; i++) - fprintf(f, "3\n"); // The "3" means line in VTK. + // The "3" means line in VTK. + fprintf(f, "3\n"); // This outputs double solution values. Look into Hermes2D/src/output/vtk.cpp // for how it is done for vectors. diff --git a/hermes2d/src/views/orderizer_quad.cpp b/hermes2d/src/views/orderizer_quad.cpp index f11bd7e0ec..2fa07b178a 100644 --- a/hermes2d/src/views/orderizer_quad.cpp +++ b/hermes2d/src/views/orderizer_quad.cpp @@ -1,6 +1,6 @@ /// Simple quad. -static int num_vert_quad_simple[2] = { 13, 13 }; +static unsigned char num_vert_quad_simple[2] = { 13, 13 }; static double3 vert_quad_simple[] = { @@ -19,7 +19,7 @@ static double3 vert_quad_simple[] = { 0.0, 0.0, 5.0 }, }; -static int num_elem_quad_simple[2] = { 4 , 4}; +static unsigned short num_elem_quad_simple[2] = { 4 , 4}; static int3 elem_quad_simple[] = { @@ -29,7 +29,7 @@ static int3 elem_quad_simple[] = {9,10,11} }; -static int num_edge_quad_simple[2] = {4, 4}; +static unsigned short num_edge_quad_simple[2] = {4, 4}; static int3 edge_quad_simple[] = { @@ -40,7 +40,7 @@ static int3 edge_quad_simple[] = }; // triangles -static int num_vert_tri_simple[2] = { 4, 4 }; +static unsigned char num_vert_tri_simple[2] = { 4, 4 }; static double3 vert_tri_simple[] = { @@ -50,14 +50,14 @@ static double3 vert_tri_simple[] = { -1.0, 1.0, 4.0 }, }; -static int num_elem_tri_simple[2] = { 1 , 1}; +static unsigned short num_elem_tri_simple[2] = { 1 , 1}; static int3 elem_tri_simple[] = { {0,1,2} }; -static int num_edge_tri_simple[2] = {3, 3}; +static unsigned short num_edge_tri_simple[2] = {3, 3}; static int3 edge_tri_simple[] = { @@ -71,7 +71,7 @@ static int3 edge_tri_simple[] = /// Edge orders. -static int num_vert_quad[2] = { 29, 77 }; +static unsigned char num_vert_quad[2] = { 29, 77 }; static double3 vert_quad0[] = { @@ -203,7 +203,7 @@ static double3 vert_quad1[] = }; -static int num_elem_quad[2] = { 12 , 64}; +static unsigned short num_elem_quad[2] = { 12 , 64}; static int3 elem_quad0[] = { @@ -295,7 +295,7 @@ static int3 elem_quad1[] = }; -static int num_edge_quad[2] = {4, 16}; +static unsigned short num_edge_quad[2] = {4, 16}; static int3 edge_quad0[] = { @@ -326,7 +326,7 @@ static int3 edge_quad1[] = }; // triangles -static int num_vert_tri[2] = { 16, 38 }; +static unsigned char num_vert_tri[2] = { 16, 38 }; static double3 vert_tri0[] = { @@ -399,7 +399,7 @@ static double3 vert_tri1[] = }; -static int num_elem_tri[2] = { 7 , 30}; +static unsigned short num_elem_tri[2] = { 7 , 30}; static int3 elem_tri0[] = { @@ -450,7 +450,7 @@ static int3 elem_tri1[] = {34,32,33}, }; -static int num_edge_tri[2] = {3, 12}; +static unsigned short num_edge_tri[2] = {3, 12}; static int3 edge_tri0[] = { diff --git a/hermes2d/src/views/scalar_view.cpp b/hermes2d/src/views/scalar_view.cpp index a1a60667ce..7c817f1cd3 100644 --- a/hermes2d/src/views/scalar_view.cpp +++ b/hermes2d/src/views/scalar_view.cpp @@ -131,18 +131,19 @@ namespace Hermes wait_for_draw(); // FIXME: find out why this has to be called after wait_for_draw in order for the view to be reset initially. - reset_view(false); // setting true here makes the view always reset after calling 'show'; particularly in the adaptivity process, + // setting true here makes the view always reset after calling 'show'; particularly in the adaptivity process, + reset_view(false); // it would disallow the observation of the process from a manually set viewpoint. refresh(); // Now we reset the active element if it was set before the MeshFunction sln entered this method. // Only for Solutions. This method may fail for filters, as they may not have RefMaps correctly set. if (dynamic_cast*>(sln.get()) != nullptr) - if (active_element != nullptr) - // Also when there has not been a call to set_active_element since assignment to this MeshFunction, - // there is nothing to restore to. - if (active_element->active) - sln->set_active_element(active_element); + if (active_element != nullptr) + // Also when there has not been a call to set_active_element since assignment to this MeshFunction, + // there is nothing to restore to. + if (active_element->active) + sln->set_active_element(active_element); } void ScalarView::show_linearizer_data(double eps, int item) @@ -153,7 +154,8 @@ namespace Hermes update_layout(); wait_for_draw(); // FIXME: find out why this has to be called after wait_for_draw in order for the view to be reset initially. - reset_view(false); // setting true here makes the view always reset after calling 'show'; particularly in the adaptivity process, + // setting true here makes the view always reset after calling 'show'; particularly in the adaptivity process, + reset_view(false); // it would disallow the observation of the process from a manually set viewpoint. refresh(); } @@ -244,6 +246,11 @@ namespace Hermes return this->lin; } + void ScalarView::set_linearizer_criterion(LinearizerCriterion criterion) + { + this->lin->set_criterion(criterion); + } + void ScalarView::draw_element_infos_2d() { //create widgets @@ -256,7 +263,7 @@ namespace Hermes glDisable(GL_BLEND); //draw element IDs - Hermes::vector::const_iterator iter = element_infos.begin(); + std::vector::const_iterator iter = element_infos.begin(); while (iter != element_infos.end()) { //check element dimension in pixels @@ -435,7 +442,8 @@ namespace Hermes glEnd(); //GL clenaup - glMatrixMode(GL_TEXTURE); //switch-off texture transform + //switch-off texture transform + glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); } @@ -714,7 +722,8 @@ namespace Hermes do_zoom_to_fit = true; } - View::reset_view(force_reset); // Reset 2d view. + // Reset 2d view. + View::reset_view(force_reset); } double ScalarView::calculate_ztrans_to_fit_view() @@ -797,7 +806,7 @@ namespace Hermes void ScalarView::set_min_max_range(double min, double max) { - /// \todo allow settin min = max, in which case draw the corresponding contour. + /// \todo allow setting min = max, in which case draw the corresponding contour. if (fabs(max - min) < Hermes::HermesEpsilon) { this->warn("Range (%f, %f) is too narrow: adjusted to (%f, %f)", min, max, min - 0.5, max); @@ -921,7 +930,6 @@ namespace Hermes } } - void ScalarView::on_mouse_move(int x, int y) { if (mode3d && (dragging || scaling || panning)) @@ -977,7 +985,6 @@ namespace Hermes panning = false; } - const char* ScalarView::get_help_text() const { return @@ -1009,4 +1016,4 @@ namespace Hermes } } } -#endif +#endif \ No newline at end of file diff --git a/hermes2d/src/views/stream_view.cpp b/hermes2d/src/views/stream_view.cpp deleted file mode 100644 index ee275c9b54..0000000000 --- a/hermes2d/src/views/stream_view.cpp +++ /dev/null @@ -1,620 +0,0 @@ -// This file is part of Hermes2D. -// -// Hermes2D is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// Hermes2D 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 Hermes2D. If not, see . - -#ifndef NOGLUT -#include -#include "global.h" -#include "stream_view.h" - -namespace Hermes -{ - namespace Hermes2D - { - namespace Views - { - StreamView::StreamView(const char* title, WinGeom* wg) - : View(title, wg), vec(nullptr) - { - lines = false; - pmode = false; - num_stream = 0; - root_x_min = 1e100; - root_y_min = 1e100; - root_x_max = -1e100; - root_y_max = -1e100; - root = nullptr; - } - - StreamView::StreamView(char* title, WinGeom* wg) - : View(title, wg), vec(nullptr) - { - lines = false; - pmode = false; - num_stream = 0; - root_x_min = 1e100; - root_y_min = 1e100; - root_x_max = -1e100; - root_y_max = -1e100; - root = nullptr; - } - - void StreamView::show(MeshFunctionSharedPtr xsln, MeshFunctionSharedPtr ysln, int marker, double step) - { - if(this->vec == nullptr) - this->vec = new Vectorizer; - if(xsln == ysln) - throw Hermes::Exceptions::Exception("Identical solutions passed to the two-argument version of show(). This is most likely a mistake."); - show(xsln, ysln, marker, step, H2D_FN_VAL_0, H2D_FN_VAL_0); - } - - bool StreamView::is_in_triangle(int idx, double x, double y, double3& bar) - { - double4* vert = vec->get_vertices(); - int3* xtris = vec->get_triangles(); - int3& tri = xtris[idx]; - double x1 = vert[tri[0]][0], x2 = vert[tri[1]][0], x3 = vert[tri[2]][0]; - double y1 = vert[tri[0]][1], y2 = vert[tri[1]][1], y3 = vert[tri[2]][1]; - double jac = ((x1 - x3)*(y2 - y3) - (x2 - x3)*(y1 - y3)); - double eps = jac * Hermes::HermesEpsilon; - double a = ((y2 - y3) * (x - x3) - (x2 - x3) * (y - y3)); - double b = ((x1 - x3) * (y - y3) - (y1 - y3) * (x - x3)); - double c = jac - a - b; - bar[0] = a / jac; bar[1] = b / jac; bar[2] = c / jac; - if((a >= - eps && a <= jac + eps) && (b >= - eps && b <= jac + eps) && (c >= - eps && c <= jac + eps)) - return true; - else - return false; - } - - void StreamView::add_element_to_tree(Node* father, int e_idx, double x_min, double x_max, double y_min, double y_max) - { - double4* vert = vec->get_vertices(); - int3* xtris = vec->get_triangles(); - if(father->leaf == true) - { - father->elements[father->num_elem++] = e_idx; - if(father->num_elem >= 100) // too many elements - { - father->leaf = false; - for (int k = 0; k < 2; k++) - { - father->sons[k] = new Node; - father->sons[k]->level = father->level + 1; - father->sons[k]->leaf = true; - father->sons[k]->num_elem = 0; - } - for (int i = 0; i < father->num_elem; i++) - add_element_to_tree(father, father->elements[i], x_min, x_max, y_min, y_max); - } - } - else - { - double x_mid = (x_min + x_max)/2; - double y_mid = (y_min + y_max)/2; - int3& tri = xtris[e_idx]; - if(father->level % 2) // level = 1, 3, 5, ... - { - if(vert[tri[0]][1] <= y_mid || vert[tri[1]][1] <= y_mid || vert[tri[2]][1] <= y_mid) - add_element_to_tree(father->sons[0], e_idx, x_min, x_max, y_min, y_mid); - if(vert[tri[0]][1] >= y_mid || vert[tri[1]][1] >= y_mid || vert[tri[2]][1] >= y_mid) - add_element_to_tree(father->sons[1], e_idx, x_min, x_max, y_mid, y_max); - } - else // level 0, 2, 4, ... - { - if(vert[tri[0]][0] <= x_mid || vert[tri[1]][0] <= x_mid || vert[tri[2]][0] <= x_mid) - add_element_to_tree(father->sons[0], e_idx, x_min, x_mid, y_min, y_max); - if(vert[tri[0]][0] >= x_mid || vert[tri[1]][0] >= x_mid || vert[tri[2]][0] >= x_mid) - add_element_to_tree(father->sons[1], e_idx, x_mid, x_max, y_min, y_max); - } - } - } - - void StreamView::build_tree() - { - root->leaf = true; - root->level = 0; - root->num_elem = 0; - for (int i = 0; i < vec->get_num_triangles(); i++) - { - add_element_to_tree(root, i, root_x_min, root_x_max, root_y_min, root_y_max); - } - } - - int StreamView::find_triangle_in_tree(double x, double y, Node* father, double x_min, double x_max, double y_min, double y_max, double3& bar) - { - if(father->leaf == true) - { - double4* vert = vec->get_vertices(); - int3* xtris = vec->get_triangles(); - for (int idx = 0; idx < father->num_elem; idx++) - { - int i = father->elements[idx]; - if(is_in_triangle(i, x, y, bar)) return i; - } - return -1; - } - else - { - double x_mid = (x_max + x_min)/2; - double y_mid = (y_max + y_min)/2; - if(father->level % 2) // level = 1, 3, 5, ... - if(y <= y_mid) - return find_triangle_in_tree(x, y, father->sons[0], x_min, x_max, y_min, y_mid, bar); - else - return find_triangle_in_tree(x, y, father->sons[1], x_min, x_max, y_mid, y_max, bar); - else // level 0, 2, 4, ... - if(x <= x_mid) - return find_triangle_in_tree(x, y, father->sons[0], x_min, x_mid, y_min, y_max, bar); - else - return find_triangle_in_tree(x, y, father->sons[1], x_mid, x_max, y_min, y_max, bar); - } - } - - bool StreamView::get_solution_values(double x, double y, double& xval, double& yval) - { - double4* vert = vec->get_vertices(); - int3* xtris = vec->get_triangles(); - double3 bar; - int e_idx; - if((e_idx = find_triangle_in_tree(x, y, root, root_x_min, root_x_max, root_y_min, root_y_max, bar)) == -1) return false; - int3& tri = xtris[e_idx]; - xval = bar[0] * vert[tri[0]][2] + bar[1] * vert[tri[1]][2] + bar[2] * vert[tri[2]][2]; - yval = bar[0] * vert[tri[0]][3] + bar[1] * vert[tri[1]][3] + bar[2] * vert[tri[2]][3]; - return true; - } - - void StreamView::delete_tree(Node* father) - { - if(father->leaf == false) - { - delete_tree(father->sons[0]); - delete_tree(father->sons[1]); - } - free_with_check(father); - } - - int StreamView::create_streamline(double x_start, double y_start, int idx) - { - double ODE_EPS = 1e-5; - double tau = initial_tau; - double x = x_start; - double y = y_start; - int k = 0; - const int buffer_length = 5000; - double2* buffer = malloc_with_check(buffer_length, this); - bool tau_ok = false; - bool end = false; - bool almost_end_of_domain = false; - - double k1, k2, k3, k4, k5; - double l1, l2, l3, l4, l5; - double x1, x2, x3, x4, x5; - double y1, y2, y3, y4, y5; - - while(1) - { - if(get_solution_values(x, y, k1, l1) == false) // point (x, y) does not lie in the domain - { - tau = tau/2; // draw streamline to the end of the domain - if(tau < min_tau) break; - continue; - } - if(fabs(k1) / max_mag < 1e-5 && fabs(l1) / max_mag < 1e-5) break; // stop streamline when zero solution - - // add new_ point to steamline - buffer[k][0] = x; - buffer[k][1] = y; - k++; - if(k >= buffer_length) break; - - do - { - if(almost_end_of_domain) // draw streamline to the end of the domain - { - almost_end_of_domain = false; - tau = tau/2; - if(tau < min_tau) { end = true; break; } - } - - // Merson's adaptive Runge-Kutta method - x1 = x + 1.0/3.0 * tau * k1; y1 = y + 1.0/3.0 * tau * l1; - if(get_solution_values(x1, y1, k2, l2) == false) { almost_end_of_domain = true; continue; } - x2 = x + 1.0/6.0 * tau * (k1 + k2); y2 = y + 1.0/6.0 * tau * (l1 + l2); - if(get_solution_values(x2, y2, k3, l3) == false) { almost_end_of_domain = true; continue; } - x3 = x + tau * (0.125 * k1 + 0.375 * k3); y3 = y + tau * (0.125 * l1 + 0.375 * l3); - if(get_solution_values(x3, y3, k4, l4) == false) { almost_end_of_domain = true; continue; } - x4 = x + tau * (0.5 * k1 - 1.5 * k3 + 2.0 * k4); y4 = y + tau * (0.5 * l1 - 1.5 * l3 + 2.0 * l4); - if(get_solution_values(x4, y4, k5, l5) == false) { almost_end_of_domain = true; continue; } - x5 = x + tau * 1.0/6.0 * (k1 + 4.0 * k4 + k5); y5 = y + tau * 1.0/6.0 * (l1 + 4.0 * l4 + l5); - - // error according to Merson - double x_err = 1.0/5.0 * (x4 - x5) / (root_x_max - root_x_min); - double y_err = 1.0/5.0 * (y4 - y5) / (root_y_max - root_y_min); - double err = std::max(fabs(x_err), fabs(y_err)); - if(err < ODE_EPS) - { - tau_ok = true; x = x5; y = y5; - } - else - { - tau_ok = false; tau = tau/2; - if(tau < min_tau) tau = min_tau; - } - - if(err < ODE_EPS/32) - { - // new_ tau according to Merson - tau = 0.8 * tau * pow(ODE_EPS/err, 0.2); - if(tau > max_tau) tau = max_tau; - } - } - while (!tau_ok); - if(end) break; // get out from both while cycles - } - - streamlines[idx] = malloc_with_check(k, this); - memcpy(streamlines[idx], buffer, k*sizeof(double2)); - free_with_check(buffer); - - return k; - } - - static double4* comp_vert; - static int compare(const void* p1, const void* p2) - { - const int3* e1 = ((const int3*) p1); - const int3* e2 = ((const int3*) p2); - double x1 = comp_vert[(*e1)[0]][0]; - double y1 = comp_vert[(*e1)[0]][1]; - double x2 = comp_vert[(*e2)[0]][0]; - double y2 = comp_vert[(*e2)[0]][1]; - if(x1 < x2) return -1; - if(x1 == x2 && y1 < y2) return -1; - if(x1 > x2) return 1; - if(x1 == x2 && y1 > y2) return 1; - if(x1 == x2 && y1 == y2) return 0; - throw Hermes::Exceptions::Exception("internal error: reached end of non-void function"); - return 0; - } - - int StreamView::find_initial_edge(int num_edges, int3* edges) - { - int i, j; - double4* vert = vec->get_vertices(); - for (i = 0; i < num_edges; i++) - { - if(edges[i][2] == 0) // not visited yet - { - for (j = 0; j < num_edges; j++) - if(vert[edges[j][1]][0] == vert[edges[i][0]][0] && vert[edges[j][1]][1] == vert[edges[i][0]][1]) - break; - if(j == num_edges) return i; - } - } - return -1; - } - - static int find_next_edge(int num_edges, int3* edges, int b_idx) - { - int3 key; - key[0] = b_idx; - int3* edge = (int3*) bsearch(&key, edges, num_edges, sizeof(int3), compare); - if(edge == nullptr) - return -1; // not found - else - return edge - edges; - } - - void StreamView::find_initial_points(int marker, double step, double2*& initial_points) - { - int k = 0; - int ne = vec->get_num_edges(); - int2* edges = vec->get_edges(); - int* edge_markers = vec->get_edge_markers(); - double4* vert = vec->get_vertices(); - int3* bnd_edges = malloc_with_check(ne, this); - for (int i = 0; i < ne; i++) - { - if(edge_markers[i] == marker) - { - bnd_edges[k][0] = edges[i][0]; - bnd_edges[k][1] = edges[i][1]; - bnd_edges[k++][2] = 0; // not visited - } - } - int num_edges = k; - - // sort edges by their first vertex coordinates - // sort first by x, then by y - comp_vert = vert; - qsort(bnd_edges, num_edges, sizeof(int3), compare); - - // create list of initial points - int buffer_length = 1000; - initial_points = malloc_with_check(buffer_length, this); - k = 0; - int idx; - while ((idx = find_initial_edge(num_edges, bnd_edges)) != -1) - { - double tmp_step = step; - do - { - bnd_edges[idx][2] = 1; // visited - double ax = vert[bnd_edges[idx][0]][0]; double bx = vert[bnd_edges[idx][1]][0]; - double ay = vert[bnd_edges[idx][0]][1]; double by = vert[bnd_edges[idx][1]][1]; - double len = sqrt(sqr(bx - ax) + sqr(by - ay)); - double remaining_len = len; double init_x = ax; double init_y = ay; - while (tmp_step < remaining_len) - { - initial_points[k][0] = init_x + tmp_step * ((bx - ax) / len); - initial_points[k][1] = init_y + tmp_step * ((by - ay) / len); - remaining_len = remaining_len - tmp_step; - tmp_step = step; - init_x = initial_points[k][0]; - init_y = initial_points[k][1]; - k++; - } - tmp_step = tmp_step - remaining_len; - } - while ((idx = find_next_edge(num_edges, bnd_edges, bnd_edges[idx][1])) != -1); - } - num_stream = k; - - free_with_check(bnd_edges); - } - - void StreamView::show(MeshFunctionSharedPtr xsln, MeshFunctionSharedPtr ysln, int marker, double step, int xitem, int yitem) - { - if(vec == nullptr) - vec = new Linearizer; - vec->process_solution(xsln, ysln, xitem, yitem); - - vec->lock_data(); - if(range_auto) - { - range_min = vec->get_min_value(); - range_max = vec->get_max_value(); - } - vec->calc_vertices_aabb(&vertices_min_x, &vertices_max_x, &vertices_min_y, &vertices_max_y); - - // create streamlines - double4* vert = vec->get_vertices(); - for (int i = 0; i < vec->get_num_vertices(); i++) - { - if(vert[i][0] < root_x_min) root_x_min = vert[i][0]; - if(vert[i][0] > root_x_max) root_x_max = vert[i][0]; - if(vert[i][1] < root_y_min) root_y_min = vert[i][1]; - if(vert[i][1] > root_y_max) root_y_max = vert[i][1]; - } - - initial_tau = std::max(root_x_max - root_x_min, root_y_max - root_y_min) / 100; - max_tau = initial_tau * 10; - min_tau = initial_tau / 50; - max_mag = vec->get_max_value(); - - this->tick(); - root = new Node; - build_tree(); - - double2* initial_points; - find_initial_points(marker, step, initial_points); - - streamlines = (double2**) malloc(sizeof(double2*) * (num_stream)); - streamlength = (int*) malloc(sizeof(int) * (num_stream)); - for (int i = 0; i < num_stream; i++) - streamlength[i] = create_streamline(initial_points[i][0], initial_points[i][1], i); - - free_with_check(initial_points); - - vec->unlock_data(); - - create(); - update_layout(); - reset_view(false); - refresh(); - wait_for_draw(); - } - - void StreamView::add_streamline(double x, double y) - { - if(root == nullptr) - throw Hermes::Exceptions::Exception("Function add_streamline must be called after StreamView::show()."); - this->tick(); - streamlines = (double2**) realloc(streamlines, sizeof(double2*) * (num_stream + 1)); - streamlength = (int*) realloc(streamlength, sizeof(int) * (num_stream + 1)); - streamlength[num_stream] = create_streamline(x, y, num_stream); - num_stream++; - refresh(); - } - - static int n_vert(int i) { return (i + 1) % 3; } - static int p_vert(int i) { return (i + 2) % 3; } - - void StreamView::on_display() - { - set_ortho_projection(); - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); - glDisable(GL_TEXTURE_1D); - glPolygonMode(GL_FRONT_AND_BACK, pmode ? GL_LINE : GL_FILL); - - // transform all vertices - vec->lock_data(); - int i; - int nv = vec->get_num_vertices(); - double4* vert = vec->get_vertices(); - double2* tvert = malloc_with_check(nv, this); - - for (i = 0; i < nv; i++) - { - tvert[i][0] = transform_x(vert[i][0]); - tvert[i][1] = transform_y(vert[i][1]); - } - - // value range - double min = range_min, max = range_max; - if(range_auto) { min = vec->get_min_value(); max = vec->get_max_value(); } - double irange = 1.0 / (max - min); - // special case: constant solution - if(fabs(min - max) < Hermes::HermesEpsilon) { irange = 1.0; min -= 0.5; } - - // draw all triangles - int3* xtris = vec->get_triangles(); - - glEnable(GL_TEXTURE_1D); - glBindTexture(GL_TEXTURE_1D, gl_pallete_tex_id); - glBegin(GL_TRIANGLES); - glColor3f(0.95f, 0.95f, 0.95f); - for (i = 0; i < vec->get_num_triangles(); i++) - { - double mag = sqrt(sqr(vert[xtris[i][0]][2]) + sqr(vert[xtris[i][0]][3])); - glTexCoord2d((mag -min) * irange * tex_scale + tex_shift, 0.0); - glVertex2d(tvert[xtris[i][0]][0], tvert[xtris[i][0]][1]); - - mag = sqrt(sqr(vert[xtris[i][1]][2]) + sqr(vert[xtris[i][1]][3])); - glTexCoord2d((mag -min) * irange * tex_scale + tex_shift, 0.0); - glVertex2d(tvert[xtris[i][1]][0], tvert[xtris[i][1]][1]); - - mag = sqrt(sqr(vert[xtris[i][2]][2]) + sqr(vert[xtris[i][2]][3])); - glTexCoord2d((mag -min) * irange * tex_scale + tex_shift, 0.0); - glVertex2d(tvert[xtris[i][2]][0], tvert[xtris[i][2]][1]); - } - glEnd(); - glDisable(GL_TEXTURE_1D); - - // draw all edges - glColor3f(0.5, 0.5, 0.5); - glBegin(GL_LINES); - int2* edges = vec->get_edges(); - for (i = 0; i < vec->get_num_edges(); i++) - { - if(lines || edges[i][2] != 0) - { - glVertex2d(tvert[edges[i][0]][0], tvert[edges[i][0]][1]); - glVertex2d(tvert[edges[i][1]][0], tvert[edges[i][1]][1]); - } - } - glEnd(); - - // draw streamlines - glColor3f(0.0, 0.0, 0.0); - for (i = 0; i < num_stream; i++) - { - glBegin(GL_LINE_STRIP); - int k = 0; - for (int j = 0; j < streamlength[i] - 1; j++) - { - glVertex2d(transform_x(streamlines[i][j][0]), transform_y(streamlines[i][j][1])); - glVertex2d(transform_x(streamlines[i][j + 1][0]), transform_y(streamlines[i][j + 1][1])); - } - glEnd(); - } - - free_with_check(tvert); - vec->unlock_data(); - } - - void StreamView::on_mouse_move(int x, int y) - { - View::on_mouse_move(x, y); - } - - void StreamView::on_key_down(unsigned char key, int x, int y) - { - switch (key) - { - case 'm': - lines = !lines; - refresh(); - break; - - case 'l': - pmode = !pmode; - refresh(); - break; - - case 'c': - reset_view(true); - refresh(); - break; - - case 'f': - set_palette_filter(pal_filter != GL_LINEAR); - break; - - // delete last streamline - case 26: // ctrl z - if(num_stream > 0) - { - num_stream--; - free_with_check(streamlines[num_stream]); - refresh(); - } - break; - - default: - View::on_key_down(key, x, y); - break; - } - } - - void StreamView::on_left_mouse_down(int x, int y) - { - View::on_left_mouse_down(x, y); - - // adding streamline (initial point set at (x, y)) - if(!scale_focused && glutGetModifiers() == GLUT_ACTIVE_CTRL) - { - this->tick(); - streamlines = (double2**) realloc(streamlines, sizeof(double2*) * (num_stream + 1)); - streamlength = (int*) realloc(streamlength, sizeof(int) * (num_stream + 1)); - streamlength[num_stream] = create_streamline(untransform_x(x), untransform_y(y), num_stream); - num_stream++; - refresh(); - } - } - - const char* StreamView::get_help_text() const - { - return - "StreamView\n\n" - "Controls:\n" - " Left mouse - pan\n" - " Right mouse - zoom\n" - " CTRL + Left mouse click - add steamline\n" - " CTRL z - delete last streamline\n" - " C - center image\n" - " F - toggle smooth palette\n" - " H - render high-quality frame\n" - " M - toggle mesh\n" - " P - cycle palettes\n" - " S - save screenshot\n" - " F1 - this help\n" - " Esc, Q - quit"; - } - - StreamView::~StreamView() - { - delete_tree(root); - for (int i = 0; i < num_stream; i++) - free_with_check(streamlines[i]); - free_with_check(streamlines); - free_with_check(streamlength); - delete vec; - } - } - } -} -#endif \ No newline at end of file diff --git a/hermes2d/src/views/thread_linearizer.cpp b/hermes2d/src/views/thread_linearizer.cpp index 2693d8ae63..f1e48fd7e8 100644 --- a/hermes2d/src/views/thread_linearizer.cpp +++ b/hermes2d/src/views/thread_linearizer.cpp @@ -21,9 +21,13 @@ //#define DEBUG_LINEARIZER -static const int default_allocation_multiplier_vertices = 10; +static const int default_allocation_multiplier_vertices = 8; static const int default_allocation_multiplier_triangles = 15; -static const int default_allocation_multiplier_edges = 10; +static const int default_allocation_multiplier_edges = 8; + +static const int default_allocation_maxsize_vertices = 500000; +static const int default_allocation_maxsize_triangles = 1000000; +static const int default_allocation_maxsize_edges = 500000; static const int default_allocation_minsize_vertices = 10000; static const int default_allocation_minsize_triangles = 15000; @@ -38,7 +42,7 @@ namespace Hermes namespace Views { template - ThreadLinearizerMultidimensional::ThreadLinearizerMultidimensional(LinearizerMultidimensional* linearizer) : user_specified_max(false), user_specified_min(false), criterion(linearizer->criterion) + ThreadLinearizerMultidimensional::ThreadLinearizerMultidimensional(LinearizerMultidimensional* linearizer) : criterion(linearizer->criterion) { vertex_size = 0; triangle_size = 0; @@ -115,7 +119,6 @@ namespace Hermes } else fns[k] = sln[k]->clone(); - fns[k]->set_refmap(new RefMap); fns[k]->set_quad_2d(&g_quad_lin); } if (user_xdisp) @@ -154,9 +157,9 @@ namespace Hermes { int number_of_elements = mesh->get_num_elements(); - this->vertex_size = std::max(default_allocation_multiplier_vertices * number_of_elements, std::max(this->vertex_size, default_allocation_minsize_vertices)); - this->triangle_size = std::max(default_allocation_multiplier_triangles * number_of_elements, std::max(this->triangle_size, default_allocation_minsize_triangles)); - this->edges_size = std::max(default_allocation_multiplier_edges * number_of_elements, std::max(this->edges_size, default_allocation_minsize_edges)); + this->vertex_size = std::min(default_allocation_maxsize_vertices, std::max(default_allocation_multiplier_vertices * number_of_elements, std::max(this->vertex_size, default_allocation_minsize_vertices))); + this->triangle_size = std::min(default_allocation_maxsize_triangles, std::max(default_allocation_multiplier_triangles * number_of_elements, std::max(this->triangle_size, default_allocation_minsize_triangles))); + this->edges_size = std::min(default_allocation_maxsize_edges, std::max(default_allocation_multiplier_edges * number_of_elements, std::max(this->edges_size, default_allocation_minsize_edges))); // Set counts. this->vertex_count = 0; @@ -191,20 +194,6 @@ namespace Hermes free_with_check(this->info, true); } - template - void ThreadLinearizerMultidimensional::set_min_value(double min) - { - this->user_specified_min = true; - this->user_specified_min_value = min; - } - - template - void ThreadLinearizerMultidimensional::set_max_value(double max) - { - this->user_specified_max = true; - this->user_specified_max_value = max; - } - template void ThreadLinearizerMultidimensional::process_state(Traverse::State* current_state) { @@ -279,7 +268,7 @@ namespace Hermes fns[k]->set_quad_order(1, item[k]); values[k] = fns[k]->get_values(component[k], value_type[k]); } - int* vertex_indices = tri_indices[0]; + unsigned short* vertex_indices = tri_indices[0]; if (curved) { @@ -384,7 +373,7 @@ namespace Hermes const double* values[LinearizerDataDimensions::dimension]; double* physical_x; double* physical_y; - int* vertex_indices = quad_indices[0]; + unsigned short* vertex_indices = quad_indices[0]; bool flip = this->quad_flip(iv0, iv1, iv2, iv3); for (int k = 0; k < LinearizerDataDimensions::dimension; k++) { @@ -489,8 +478,8 @@ namespace Hermes this->pop_transforms(); } else - if (split == 1) // h-split - { + if (split == 1) // h-split + { this->push_transforms(4); process_quad(iv0, iv1, mid1, mid3, level + 1); this->pop_transforms(); @@ -498,17 +487,17 @@ namespace Hermes this->push_transforms(5); process_quad(mid3, mid1, iv2, iv3, level + 1); this->pop_transforms(); - } - else // v-split - { - this->push_transforms(6); - process_quad(iv0, mid0, mid2, iv3, level + 1); - this->pop_transforms(); + } + else // v-split + { + this->push_transforms(6); + process_quad(iv0, mid0, mid2, iv3, level + 1); + this->pop_transforms(); - this->push_transforms(7); - process_quad(mid0, iv1, iv2, mid2, level + 1); - this->pop_transforms(); - } + this->push_transforms(7); + process_quad(mid0, iv1, iv2, mid2, level + 1); + this->pop_transforms(); + } } else { @@ -536,42 +525,33 @@ namespace Hermes } template - void ThreadLinearizerMultidimensional::split_decision(int& split, int iv0, int iv1, int iv2, int iv3, ElementMode2D mode, const double** values, double* physical_x, double* physical_y, int* vertex_indices) const + void ThreadLinearizerMultidimensional::split_decision(int& split, int iv0, int iv1, int iv2, int iv3, ElementMode2D mode, const double** values, double* physical_x, double* physical_y, unsigned short* vertex_indices) const { + // Initialization. split = 0; bool done = false; - double max_value = std::max(std::max(this->vertices[iv0][2], this->vertices[iv1][2]), this->vertices[iv2][2]); - if (mode == HERMES_MODE_QUAD) - max_value = std::max(max_value, this->vertices[iv3][2]); - double min_value = std::min(std::min(this->vertices[iv0][2], this->vertices[iv1][2]), this->vertices[iv2][2]); - if (mode == HERMES_MODE_QUAD) - min_value = std::min(max_value, this->vertices[iv3][2]); - - if (!finite(max_value)) - throw Exceptions::Exception("Infinite value detected in Linearizer."); - - if (this->user_specified_max && (max_value > this->user_specified_max_value)) - return; - - if (!done && this->user_specified_min && (min_value < this->user_specified_min_value)) - return; // Core of the decision - calculate the approximate error of linearizing the normalized solution for (int k = 0; k < LinearizerDataDimensions::dimension; k++) { - // Errors in edge midpoints summed up. + // Errors (split element - non-split element values) in edge midpoints summed up. double error = fabs(values[k][vertex_indices[0]] - midval[2 + k][0]) + fabs(values[k][vertex_indices[1]] - midval[2 + k][1]) + fabs(values[k][vertex_indices[2]] - midval[2 + k][2]); + // For the quad we have one more midpoint. if (mode == HERMES_MODE_QUAD) error += fabs(values[k][vertex_indices[3]] - midval[2 + k][3]); // Divide by the edge count. error /= (3 + mode); + // Relative error. + // max_value_approx here is only an approximation - only taking into account the elements being processed by this thread. double relative_error = error / this->max_value_approx; + // Split ? + // See the header of this method (split_decision) for explanation. // We put 3 here so that it is easier to test 'full split' both for quads && triangles. split = (relative_error > this->criterion.error_tolerance) ? 3 : 0; @@ -581,23 +561,27 @@ namespace Hermes double horizontal_error = fabs(values[k][vertex_indices[1]] - midval[2 + k][1]) + fabs(values[k][vertex_indices[3]] - midval[2 + k][3]); double vertical_error = fabs(values[k][vertex_indices[0]] - midval[2 + k][0]) + fabs(values[k][vertex_indices[2]] - midval[2 + k][2]); - // decide whether to split horizontally or vertically only - if (horizontal_error > 5 * vertical_error) - split = 1; // h-split - else if (vertical_error > 5 * horizontal_error) - split = 2; // v-split + // Decide whether to split horizontally or vertically only + // If one error is LINEARIZER_DIRECTIONAL_QUAD_REFINEMENT_REQUIREMENT larger than the other. + if (horizontal_error > LINEARIZER_DIRECTIONAL_QUAD_REFINEMENT_REQUIREMENT * vertical_error) + // h-split + split = 1; + else if (vertical_error > LINEARIZER_DIRECTIONAL_QUAD_REFINEMENT_REQUIREMENT * horizontal_error) + // v-split + split = 2; else split = 3; } } - // do the same for the curvature + // If we are not splitting into four elements alreasdy and we have a curved element, check if we have to split because of the curvature. if (curved && split != 3) { for (int i = 0; i < 3 + mode; i++) { double error = sqr(physical_x[vertex_indices[i]] - midval[0][i]) + sqr(physical_y[vertex_indices[i]] - midval[1][i]); + double diameter = sqr(fns[0]->get_active_element()->diameter); split = (error / diameter) > this->curvature_epsilon ? 3 : split; @@ -726,8 +710,8 @@ namespace Hermes while (i >= 0 && i < this->vertex_count) { if ((this->info[i][0] == p1 && this->info[i][1] == p2) - && (fabs(x - this->vertices[i][0]) < Hermes::HermesSqrtEpsilon) - && (fabs(y - this->vertices[i][1]) < Hermes::HermesSqrtEpsilon)) + && (fabs(x - this->vertices[i][0]) < Hermes::HermesEpsilon) + && (fabs(y - this->vertices[i][1]) < Hermes::HermesEpsilon)) { bool check_value = true; for (int k = 0; k < LinearizerDataDimensions::dimension; k++) @@ -771,7 +755,6 @@ namespace Hermes this->hash_table = realloc_with_check(this->hash_table, new_vertex_size, this); memset(this->hash_table + this->vertex_size, 0xff, sizeof(int)* (new_vertex_size - this->vertex_size)); - this->vertex_size = new_vertex_size; } return this->vertex_count++; @@ -836,10 +819,10 @@ namespace Hermes this->triangle_markers[triangle_count++] = marker; } - template class HERMES_API ThreadLinearizerMultidimensional >; - template class HERMES_API ThreadLinearizerMultidimensional >; - template class HERMES_API ThreadLinearizerMultidimensional >; - template class HERMES_API ThreadLinearizerMultidimensional >; + template class HERMES_API ThreadLinearizerMultidimensional < ScalarLinearizerDataDimensions > ; + template class HERMES_API ThreadLinearizerMultidimensional < VectorLinearizerDataDimensions > ; + template class HERMES_API ThreadLinearizerMultidimensional < ScalarLinearizerDataDimensions > ; + template class HERMES_API ThreadLinearizerMultidimensional < VectorLinearizerDataDimensions > ; } } } diff --git a/hermes2d/src/views/vector_base_view.cpp b/hermes2d/src/views/vector_base_view.cpp index 564aed5357..540519b313 100644 --- a/hermes2d/src/views/vector_base_view.cpp +++ b/hermes2d/src/views/vector_base_view.cpp @@ -158,8 +158,8 @@ namespace Hermes { namespace Views { - template class HERMES_API VectorBaseView; - template class HERMES_API VectorBaseView >; + template class HERMES_API VectorBaseView < double > ; + template class HERMES_API VectorBaseView < std::complex > ; } } -} +} \ No newline at end of file diff --git a/hermes2d/src/views/vector_view.cpp b/hermes2d/src/views/vector_view.cpp index 0c23aa1c18..f2ef77b382 100644 --- a/hermes2d/src/views/vector_view.cpp +++ b/hermes2d/src/views/vector_view.cpp @@ -106,6 +106,11 @@ namespace Hermes return this->vec; } + void VectorView::set_vectorizer_criterion(LinearizerCriterion criterion) + { + this->vec->set_criterion(criterion); + } + void VectorView::plot_arrow(double x, double y, double xval, double yval, double max, double min, double gs) { if (mode == 1) @@ -156,7 +161,8 @@ namespace Hermes if (mode == 1) { float color[3]; - get_palette_color((mag - min) / (max - min), color); // 0.0 -- 1.0 + // 0.0 -- 1.0 + get_palette_color((mag - min) / (max - min), color); glColor3f(color[0], color[1], color[2]); if (mag / (max - min) < 1e-5) @@ -229,7 +235,7 @@ namespace Hermes if (range_auto) { min = vec->get_min_value(); max = vec->get_max_value(); } double irange = 1.0 / (max - min); // special case: constant solution - if (fabs(min - max) < Hermes::HermesEpsilon) { irange = 1.0; min -= 0.5; } + if (fabs(min - max) < Hermes::HermesSqrtEpsilon) { irange = 1.0; min -= 0.5; } // draw all triangles if (mode != 1) @@ -287,41 +293,46 @@ namespace Hermes double wh = output_height + gt, ww = output_width + gs; - double vert[3][2] = { - { - triangle[0][0], - triangle[0][1] - }, - { - triangle[1][0], - triangle[1][1] - }, - { - triangle[2][0], - triangle[2][1] - } + double vert[3][4] = { + { + triangle[0][0], + triangle[0][1], + triangle[0][2], + triangle[0][3] + }, + { + triangle[1][0], + triangle[1][1], + triangle[1][2], + triangle[1][3] + }, + { + triangle[2][0], + triangle[2][1], + triangle[2][2], + triangle[2][3] + } }; double tvert[3][2] = { - { - transform_x(triangle[0][0]), - transform_y(triangle[0][1]) - }, - { - transform_x(triangle[1][0]), - transform_y(triangle[1][1]) - }, - { - transform_x(triangle[2][0]), - transform_y(triangle[2][1]) - } + { + transform_x(triangle[0][0]), + transform_y(triangle[0][1]) + }, + { + transform_x(triangle[1][0]), + transform_y(triangle[1][1]) + }, + { + transform_x(triangle[2][0]), + transform_y(triangle[2][1]) + } }; - if ((tvert[0][0] < -gs) && (tvert[1][0] < -gs) && (tvert[2][0] < -gs)) continue; - if ((tvert[0][0] > ww) && (tvert[1][0] > ww) && (tvert[2][0] > ww)) continue; + if ((tvert[0][0] > ww) && (tvert[1][0] > ww) && (tvert[2][0] > ww)) continue; if ((tvert[0][1] < -gt) && (tvert[1][1] < -gt) && (tvert[2][1] < -gt)) continue; - if ((tvert[0][1] > wh) && (tvert[1][1] > wh) && (tvert[2][1] > wh)) continue; + if ((tvert[0][1] > wh) && (tvert[1][1] > wh) && (tvert[2][1] > wh)) continue; // find vertex with min y-coordinate for (k = 0; k < 3; k++) @@ -344,7 +355,8 @@ namespace Hermes a[n] /= c[n]; b[n] /= c[n]; d[n] /= c[n]; } - s = (int)ceil((tvert[l1][1] - gy) / gt); // first step + // first step + s = (int)ceil((tvert[l1][1] - gy) / gt); lry = gy + s*gt; bool shift = hexa && (s & 1); @@ -353,11 +365,13 @@ namespace Hermes { if (tvert[l1][1] == tvert[l2][1]) { - l1 = l2; l2 = r2; + l1 = l2; + l2 = r2; } else if (tvert[r1][1] == tvert[r2][1]) { - r1 = r2; r2 = l2; + r1 = r2; + r2 = l2; } } diff --git a/hermes2d/src/views/view.cpp b/hermes2d/src/views/view.cpp index a23fe8441f..c696450816 100644 --- a/hermes2d/src/views/view.cpp +++ b/hermes2d/src/views/view.cpp @@ -214,7 +214,8 @@ namespace Hermes void View::on_create(int output_id) { - this->output_id = output_id; //does not need thread protection because it is during execution of add_view + //does not need thread protection because it is during execution of add_view + this->output_id = output_id; create_gl_palette(); set_palette_filter(pal_filter == GL_LINEAR); } @@ -459,38 +460,38 @@ namespace Hermes { case 'h': { - hq_frame = true; - refresh(); - break; + hq_frame = true; + refresh(); + break; } case 27: case 'q': { - close(); - break; + close(); + break; } case 's': { - const char *file_name = get_screenshot_file_name(); - glReadBuffer(GL_FRONT_LEFT); - save_screenshot_internal(file_name); - break; + const char *file_name = get_screenshot_file_name(); + glReadBuffer(GL_FRONT_LEFT); + save_screenshot_internal(file_name); + break; } case 'p': { - switch (pal_type) - { - case H2DV_PT_HUESCALE: pal_type = H2DV_PT_GRAYSCALE; break; - case H2DV_PT_GRAYSCALE: pal_type = H2DV_PT_INVGRAYSCALE; break; - case H2DV_PT_INVGRAYSCALE: pal_type = H2DV_PT_HUESCALE; break; - default: throw Hermes::Exceptions::Exception("Invalid palette type"); - } - create_gl_palette(); - refresh(); - break; + switch (pal_type) + { + case H2DV_PT_HUESCALE: pal_type = H2DV_PT_GRAYSCALE; break; + case H2DV_PT_GRAYSCALE: pal_type = H2DV_PT_INVGRAYSCALE; break; + case H2DV_PT_INVGRAYSCALE: pal_type = H2DV_PT_HUESCALE; break; + default: throw Hermes::Exceptions::Exception("Invalid palette type"); + } + create_gl_palette(); + refresh(); + break; } default: @@ -640,7 +641,8 @@ namespace Hermes void View::set_palette_filter(bool linear) { - view_sync.enter(); //lock to prevent simultaneuous rendering + //lock to prevent simultaneuous rendering + view_sync.enter(); pal_filter = linear ? GL_LINEAR : GL_NEAREST; @@ -651,7 +653,8 @@ namespace Hermes glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, pal_filter); update_tex_adjust(); - view_sync.leave(); //unlock + //unlock + view_sync.leave(); refresh(); } @@ -724,10 +727,13 @@ namespace Hermes if (align > -1) { int width = glutBitmapLength(font, (const unsigned char*)text); - if (align == 1) x -= width; // align right - else x -= (double)width / 2; // center + // align right + if (align == 1) x -= width; + // center + else x -= (double)width / 2; } - y += 5; //(double) glutBitmapHeight(font) / 2 - 1; + //(double) glutBitmapHeight(font) / 2 - 1; + y += 5; glDisable(GL_TEXTURE_1D); glDisable(GL_LIGHTING); @@ -755,7 +761,7 @@ namespace Hermes int n = 1; for (const char* p = text; *p; p++) - if (*p == '\n') n++; + if (*p == '\n') n++; int width = get_text_width(text); int height = n * glutBitmapHeight(GLUT_BITMAP_9_BY_15); @@ -838,7 +844,8 @@ namespace Hermes #ifdef GL_BGRA_EXT glReadPixels(0, 0, output_width, output_height, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels); #else - glReadPixels(0, 0, output_width, output_height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); // FIXME!!! + // FIXME!!! + glReadPixels(0, 0, output_width, output_height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); this->warn("BGRA format not supported. Saved image will have inverted colors"); #endif // opening file for binary writing @@ -848,10 +855,11 @@ namespace Hermes // fill in bitmap header file_header.type = BITMAP_ID; - file_header.size = sizeof(BitmapFileHeader)+sizeof(BitmapInfoHeader)+ + file_header.size = sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader) + 4 * output_width * output_height; file_header.reserved1 = file_header.reserved2 = 0; - file_header.off_bits = 14 + 40; // length of both headers + // length of both headers + file_header.off_bits = 14 + 40; if (fwrite(&file_header, sizeof(file_header), 1, file) != 1) { @@ -864,11 +872,14 @@ namespace Hermes info_header.width = output_width; info_header.height = output_height; info_header.planes = 1; - info_header.bit_count = 32; // 4 bytes per pixel = 32 bits + // 4 bytes per pixel = 32 bits + info_header.bit_count = 32; info_header.compression = 0; info_header.size_image = output_width * output_height * 4; - info_header.xdpi = 2835; // 72 dpi - info_header.ydpi = 2835; // 72 dpi + // 72 dpi + info_header.xdpi = 2835; + // 72 dpi + info_header.ydpi = 2835; info_header.clr_used = 0; info_header.clr_important = 0; diff --git a/hermes2d/src/views/view_support.cpp b/hermes2d/src/views/view_support.cpp index 2275b53631..3f787eea2c 100644 --- a/hermes2d/src/views/view_support.cpp +++ b/hermes2d/src/views/view_support.cpp @@ -34,7 +34,8 @@ namespace Hermes { namespace Views { - ViewMonitor view_sync; ///< Synchronization. + // Synchronization. + ViewMonitor view_sync; /* monitor */ ViewMonitor::ViewMonitor() @@ -60,25 +61,31 @@ namespace Hermes } /* forward definitions */ - static bool glut_initialized = false; ///< True if GLUT is initialized - static bool glew_initialized = false; ///< True if GLEW is initialized + // True if GLUT is initialized + static bool glut_initialized = false; + // True if GLEW is initialized + static bool glew_initialized = false; /* threading */ - struct ThreadInfo { ///< Thread information - pthread_t thread; ///< View thread. - bool should_quit; ///< True if view thread should end + struct ThreadInfo { //< Thread information + // View thread. + pthread_t thread; + // True if view thread should end + bool should_quit; ThreadInfo() : should_quit(false) {}; }; - static ThreadInfo* view_thread; ///< Current view thread. + // Current view thread. + static ThreadInfo* view_thread; - typedef int (*CTC_FUNC)(void*); + typedef int(*CTC_FUNC)(void*); static CTC_FUNC ctc_function = nullptr; static void* ctc_param; static int ctc_result; - static std::map view_instances; ///< Instances of views. + // Instances of views. + static std::map view_instances; - struct ViewParams { ///< Parameters used to initialize view + struct ViewParams { //< Parameters used to initialize view View* view; int x, y; int width, height; @@ -86,13 +93,14 @@ namespace Hermes ViewParams(View* view, int x, int y, int width, int height, const char* title) : view(view), x(x), y(y), width(width), height(height), title(title) {}; }; - struct RemoveParams { ///< Parameters used to remove view + struct RemoveParams { //< Parameters used to remove view int view_id; - bool destroy_glut_window; ///< True to destroy glut window. + // True to destroy glut window. + bool destroy_glut_window; RemoveParams(int view_id, bool destroy_glut_window) : view_id(view_id), destroy_glut_window(destroy_glut_window) {}; }; - struct TitleParams { ///< Parameters of a title + struct TitleParams { //< Parameters of a title int view_id; const char* title; TitleParams(int view_id, const char* title) : view_id(view_id), title(title) {}; @@ -107,18 +115,18 @@ namespace Hermes init_glut(); //run message loop - while(1) + while (1) { //handle glut messages glutMainLoopEvent(); //check whether to quit - if(thread_info->should_quit) + if (thread_info->should_quit) break; //handle CTC view_sync.enter(); - if(ctc_function != nullptr) + if (ctc_function != nullptr) { ctc_result = ctc_function(ctc_param); ctc_function = nullptr; @@ -130,7 +138,7 @@ namespace Hermes #ifdef _WINDOWS Sleep(10); #else - usleep(10*1000); + usleep(10 * 1000); #endif } @@ -142,21 +150,21 @@ namespace Hermes return nullptr; } - /// Returns true, if outside the thread. + // Returns true, if outside the thread. static bool need_safe_call() { return pthread_equal(view_thread->thread, pthread_self()) == 0; } - /// Does a cross thread call. + // Does a cross thread call. static int call_in_thread(CTC_FUNC func, void* param) { //check whether the thread is running if not start it view_sync.enter(); - if(view_thread == nullptr) + if (view_thread == nullptr) { ThreadInfo* new_thread_info = nullptr; try { new_thread_info = new ThreadInfo(); } - catch(std::bad_alloc&) { throw Hermes::Exceptions::Exception("Failed to allocate structure for view thread"); } + catch (std::bad_alloc&) { throw Hermes::Exceptions::Exception("Failed to allocate structure for view thread"); } int err = pthread_create(&new_thread_info->thread, nullptr, view_thread_func, new_thread_info); - if(err) + if (err) { delete new_thread_info; throw Hermes::Exceptions::Exception("Failed to create main thread, error: %d", err); @@ -166,7 +174,7 @@ namespace Hermes view_sync.leave(); //make call - if(need_safe_call()) + if (need_safe_call()) { view_sync.enter(); ctc_function = func; @@ -180,12 +188,12 @@ namespace Hermes return func(param); } - /// Sets a title of a view. Function has to be called just from the inside of view thread with a locked sync_view. + // Sets a title of a view. Function has to be called just from the inside of view thread with a locked sync_view. static int set_view_title_in_thread(void* title_pars_ptr) { TitleParams& title_params = *((TitleParams*)title_pars_ptr); std::map::iterator found_view = view_instances.find(title_params.view_id); - if(found_view == view_instances.end()) + if (found_view == view_instances.end()) { throw Exceptions::Exception("Settings title of a view that is not registered."); return -1; @@ -198,7 +206,7 @@ namespace Hermes return 0; } - /// Adds a new_ view. Function has to be called just from the inside of view thread with a locked sync_view. + // Adds a new_ view. Function has to be called just from the inside of view thread with a locked sync_view. int add_view_in_thread(void* view_pars_ptr) { ViewParams& view_params = *((ViewParams*)view_pars_ptr); @@ -211,7 +219,7 @@ namespace Hermes //initialize GLEW GLenum err = glewInit(); - if(err != GLEW_OK) + if (err != GLEW_OK) throw Exceptions::Exception("GLEW error: %s", glewGetErrorString(err)); glew_initialized = true; @@ -235,23 +243,24 @@ namespace Hermes return view_id; } - /// Removes a new_ view. Function has to be called just from the inside of view thread with a locked sync_view. + // Removes a new_ view. Function has to be called just from the inside of view thread with a locked sync_view. int remove_view_in_thread(void* remove_params_ptr) { RemoveParams& params = *(RemoveParams*)remove_params_ptr; std::map::iterator found_view = view_instances.find(params.view_id); - if(found_view == view_instances.end()) + if (found_view == view_instances.end()) { throw Exceptions::Exception("Removing of a view that is not registered"); return -1; } //destroy window if requested (it will not be requested when remove is called as a reaction to on_close) - if(params.destroy_glut_window) + if (params.destroy_glut_window) { //remove window from GLUT glutSetWindow(params.view_id); - glutSetWindowData(nullptr); //prevent stubs from being executed if there is still some message waiting for the window + //prevent stubs from being executed if there is still some message waiting for the window + glutSetWindowData(nullptr); //call on-close event found_view->second->on_close(); @@ -264,7 +273,7 @@ namespace Hermes view_instances.erase(found_view); //thread cleanup - if(view_instances.empty()) + if (view_instances.empty()) { view_thread->should_quit = true; view_thread = nullptr; @@ -278,16 +287,16 @@ namespace Hermes return 0; } - /// Forces a redisplay of a view. Function has to be called just from the inside of view thread. + // Forces a redisplay of a view. Function has to be called just from the inside of view thread. static int refresh_view_in_thread(void* view_id_ptr) { int view_id = *((int*)view_id_ptr); std::map::iterator found_view = view_instances.find(view_id); - if(found_view == view_instances.end()) + if (found_view == view_instances.end()) throw Exceptions::Exception("Refreshing a view that is not registered"); //redisplay - if(found_view != view_instances.end()) + if (found_view != view_instances.end()) { glutSetWindow(view_id); glutPostRedisplay(); @@ -297,34 +306,35 @@ namespace Hermes } /* GLUT */ - static long double_click_delay_ms = 300; ///< Length of the double-click time. (FIXME: get double-click time for Linux) + // Length of the double-click time. (FIXME: get double-click time for Linux) + static long double_click_delay_ms = 300; #define STUB_GET_VIEW() View* wnd = (View*)glutGetWindowData() /* retrieves view for the current GLUT callback */ #define STUB_CALL(__call) STUB_GET_VIEW(); if(wnd != nullptr) __call; /* calls a method of a view for the current GLUT callbakc */ - void on_display_stub(void) { STUB_CALL( wnd->pre_display() ); } - void on_reshape_stub(int width, int height) { STUB_CALL( wnd->on_reshape(width, height) ); } - void on_mouse_move_stub(int x, int y) { STUB_CALL( wnd->on_mouse_move(x, y) ); } - void on_key_down_stub(unsigned char key, int x, int y) { STUB_CALL( wnd->on_key_down(key, x, y) ); } - void on_special_key_stub(int key, int x, int y) { STUB_CALL( wnd->on_special_key(key, x, y) ); } - void on_entry_stub(int state) { STUB_CALL( wnd->on_entry(state) ); } + void on_display_stub(void) { STUB_CALL(wnd->pre_display()); } + void on_reshape_stub(int width, int height) { STUB_CALL(wnd->on_reshape(width, height)); } + void on_mouse_move_stub(int x, int y) { STUB_CALL(wnd->on_mouse_move(x, y)); } + void on_key_down_stub(unsigned char key, int x, int y) { STUB_CALL(wnd->on_key_down(key, x, y)); } + void on_special_key_stub(int key, int x, int y) { STUB_CALL(wnd->on_special_key(key, x, y)); } + void on_entry_stub(int state) { STUB_CALL(wnd->on_entry(state)); } void on_mouse_click_stub(int button, int state, int x, int y) { STUB_GET_VIEW(); - if(wnd == nullptr) + if (wnd == nullptr) return; // emulate double-click messages - if(state == GLUT_DOWN) + if (state == GLUT_DOWN) { static double last_tick = 0; double tick = View::get_tick_count(); //if(tick < last_tick) //todo - if(tick - last_tick < double_click_delay_ms) + if (tick - last_tick < double_click_delay_ms) { - if(button == GLUT_LEFT_BUTTON) + if (button == GLUT_LEFT_BUTTON) wnd->on_left_mouse_double_click(x, y); - else if(button == GLUT_RIGHT_BUTTON) + else if (button == GLUT_RIGHT_BUTTON) wnd->on_right_mouse_double_click(x, y); else wnd->on_middle_mouse_double_click(x, y); @@ -336,23 +346,23 @@ namespace Hermes } // call proper click handler - if(button == GLUT_LEFT_BUTTON) + if (button == GLUT_LEFT_BUTTON) { - if(state == GLUT_DOWN) + if (state == GLUT_DOWN) wnd->on_left_mouse_down(x, y); else wnd->on_left_mouse_up(x, y); } - else if(button == GLUT_RIGHT_BUTTON) + else if (button == GLUT_RIGHT_BUTTON) { - if(state == GLUT_DOWN) + if (state == GLUT_DOWN) wnd->on_right_mouse_down(x, y); else wnd->on_right_mouse_up(x, y); } else { - if(state == GLUT_DOWN) + if (state == GLUT_DOWN) wnd->on_middle_mouse_down(x, y); else wnd->on_middle_mouse_up(x, y); @@ -361,7 +371,7 @@ namespace Hermes void on_close_stub() { STUB_GET_VIEW(); - if(wnd == nullptr) + if (wnd == nullptr) return; //call callback @@ -375,16 +385,16 @@ namespace Hermes view_sync.leave(); } - ///initialize GLUT + //initialize GLUT bool init_glut() { static int argc = 1; static const char* argv[1] = { "x" }; //prepare GLUT environment - if(!glut_initialized) + if (!glut_initialized) { - glutInit(&argc, (char**) argv); + glutInit(&argc, (char**)argv); glut_initialized = true; } glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH | GLUT_ACCUM); @@ -398,7 +408,7 @@ namespace Hermes return true; } - /// shutdowns GLUT + // shutdowns GLUT bool shutdown_glut() { return true; @@ -442,7 +452,7 @@ namespace Hermes view_instances.clear(); //tell thread to finish - if(view_thread != nullptr) + if (view_thread != nullptr) { current_thread = view_thread->thread; view_thread->should_quit = true; @@ -451,7 +461,7 @@ namespace Hermes view_sync.leave(); //wait for thread to finish - if(should_wait) + if (should_wait) { glew_initialized = false; pthread_join(current_thread, nullptr); @@ -465,7 +475,7 @@ namespace Hermes //tell thread to finish view_sync.enter(); - if(view_thread != nullptr) + if (view_thread != nullptr) { current_thread = view_thread->thread; should_wait = true; @@ -473,7 +483,7 @@ namespace Hermes view_sync.leave(); //wait for thread to finish - if(should_wait) + if (should_wait) { fprintf(stdout, "%s", text); fflush(stdout); pthread_join(current_thread, nullptr); @@ -484,7 +494,7 @@ namespace Hermes { //wait for key view_sync.enter(); - if(view_thread != nullptr) + if (view_thread != nullptr) { fprintf(stdout, "%s", text); fflush(stdout); view_sync.wait_keypress(); @@ -494,4 +504,4 @@ namespace Hermes } } } -#endif +#endif \ No newline at end of file diff --git a/hermes2d/src/weakform/weakform.cpp b/hermes2d/src/weakform/weakform.cpp index 39f8003857..9e44d99695 100644 --- a/hermes2d/src/weakform/weakform.cpp +++ b/hermes2d/src/weakform/weakform.cpp @@ -30,17 +30,34 @@ namespace Hermes { namespace Hermes2D { + template + WeakFormSharedPtr::WeakFormSharedPtr(Hermes::Hermes2D::WeakForm* ptr) : std::tr1::shared_ptr >(ptr) + { + } + + template + WeakFormSharedPtr::WeakFormSharedPtr(const WeakFormSharedPtr& other) : std::tr1::shared_ptr >(other) + { + } + + template + void WeakFormSharedPtr::operator=(const WeakFormSharedPtr& other) + { + std::tr1::shared_ptr >::operator=(other); + } + static bool warned_nonOverride = false; - /// This is to be used by weak forms specifying numerical flux through interior edges. - /// Forms with this identifier will receive DiscontinuousFunc representations of shape - /// and ext. functions, which they may query for values on either side of given interface. + // This is to be used by weak forms specifying numerical flux through interior edges. + // Forms with this identifier will receive DiscontinuousFunc representations of shape + // and ext. functions, which they may query for values on either side of given interface. static const std::string H2D_DG_INNER_EDGE = "-1234567"; template WeakForm::WeakForm(unsigned int neq, bool mat_free) : Hermes::Mixins::Loggable(false) { this->neq = neq; + this->original_neq = neq; this->is_matfree = mat_free; } @@ -53,7 +70,7 @@ namespace Hermes template WeakForm::~WeakForm() { - for(unsigned int i = 0; i < this->forms.size(); i++) + for (unsigned int i = 0; i < this->forms.size(); i++) delete get_forms()[i]; delete_all(); } @@ -61,10 +78,10 @@ namespace Hermes template WeakForm* WeakForm::clone() const { - if(!warned_nonOverride) + if (!warned_nonOverride) #pragma omp critical (warning_weakform_nonOverride) { - if(!warned_nonOverride) + if (!warned_nonOverride) this->warn("Using default WeakForm::clone, if you have any dynamically created data in your WeakForm constructor, you need to overload this method!"); warned_nonOverride = true; } @@ -78,19 +95,19 @@ namespace Hermes } template - void WeakForm::set_active_edge_state(Element** e, int isurf) + void WeakForm::set_active_edge_state(Element** e, unsigned char isurf) { // Nothing here, supposed to be overriden if necessary. } template - void WeakForm::set_active_DG_state(Element** e, int isurf) + void WeakForm::set_active_DG_state(Element** e, unsigned char isurf) { // Nothing here, supposed to be overriden if necessary. } template - void WeakForm::cloneMembers(const WeakForm* other_wf) + void WeakForm::cloneMembers(const WeakFormSharedPtr& other_wf) { this->mfvol.clear(); this->mfsurf.clear(); @@ -101,9 +118,9 @@ namespace Hermes this->forms.clear(); this->ext.clear(); - for(unsigned int i = 0; i < other_wf->forms.size(); i++) + for (unsigned int i = 0; i < other_wf->forms.size(); i++) { - if(dynamic_cast*>(other_wf->forms[i]) != nullptr) + if (dynamic_cast*>(other_wf->forms[i]) != nullptr) { MatrixFormVol* form = (dynamic_cast*>(other_wf->forms[i]))->clone(); form->copy_base(other_wf->forms[i]); @@ -111,7 +128,7 @@ namespace Hermes this->mfvol.push_back(dynamic_cast*>(this->forms.back())); continue; } - if(dynamic_cast*>(other_wf->forms[i]) != nullptr) + if (dynamic_cast*>(other_wf->forms[i]) != nullptr) { VectorFormVol* form = (dynamic_cast*>(other_wf->forms[i]))->clone(); form->copy_base(other_wf->forms[i]); @@ -119,7 +136,7 @@ namespace Hermes this->vfvol.push_back(dynamic_cast*>(this->forms.back())); continue; } - if(dynamic_cast*>(other_wf->forms[i]) != nullptr) + if (dynamic_cast*>(other_wf->forms[i]) != nullptr) { MatrixFormSurf* form = (dynamic_cast*>(other_wf->forms[i]))->clone(); form->copy_base(other_wf->forms[i]); @@ -127,7 +144,7 @@ namespace Hermes this->mfsurf.push_back(dynamic_cast*>(this->forms.back())); continue; } - if(dynamic_cast*>(other_wf->forms[i]) != nullptr) + if (dynamic_cast*>(other_wf->forms[i]) != nullptr) { VectorFormSurf* form = (dynamic_cast*>(other_wf->forms[i]))->clone(); form->copy_base(other_wf->forms[i]); @@ -135,7 +152,7 @@ namespace Hermes this->vfsurf.push_back(dynamic_cast*>(this->forms.back())); continue; } - if(dynamic_cast*>(other_wf->forms[i]) != nullptr) + if (dynamic_cast*>(other_wf->forms[i]) != nullptr) { MatrixFormDG* form = (dynamic_cast*>(other_wf->forms[i]))->clone(); form->copy_base(other_wf->forms[i]); @@ -143,7 +160,7 @@ namespace Hermes this->mfDG.push_back(dynamic_cast*>(this->forms.back())); continue; } - if(dynamic_cast*>(other_wf->forms[i]) != nullptr) + if (dynamic_cast*>(other_wf->forms[i]) != nullptr) { VectorFormDG* form = (dynamic_cast*>(other_wf->forms[i]))->clone(); form->copy_base(other_wf->forms[i]); @@ -153,7 +170,7 @@ namespace Hermes continue; } } - for(unsigned int i = 0; i < other_wf->forms.size(); i++) + for (unsigned int i = 0; i < other_wf->forms.size(); i++) { this->cloneMemberExtFunctions(other_wf->forms[i]->ext, this->forms[i]->ext); other_wf->forms[i]->u_ext_fn = this->forms[i]->u_ext_fn; @@ -164,18 +181,18 @@ namespace Hermes } template - void WeakForm::cloneMemberExtFunctions(Hermes::vector > source_ext, Hermes::vector >& cloned_ext) + void WeakForm::cloneMemberExtFunctions(std::vector > source_ext, std::vector >& cloned_ext) { cloned_ext.clear(); - for(unsigned int i = 0; i < source_ext.size(); i++) + for (unsigned int i = 0; i < source_ext.size(); i++) { Solution* originalSln = dynamic_cast*>(source_ext[i].get()); - if(originalSln) + if (originalSln) { Solution* newSln = nullptr; - if(originalSln->get_type() == HERMES_SLN) + if (originalSln->get_type() == HERMES_SLN) { - newSln = new Solution; + newSln = new Solution < Scalar > ; newSln->copy(source_ext[i].get()); } else @@ -209,7 +226,7 @@ namespace Hermes } template - void WeakForm::set_ext(Hermes::vector > ext) + void WeakForm::set_ext(std::vector > ext) { this->ext = ext; } @@ -222,22 +239,22 @@ namespace Hermes } template - void WeakForm::set_u_ext_fn(Hermes::vector > ext) + void WeakForm::set_u_ext_fn(std::vector > ext) { this->u_ext_fn = ext; } template template - void WeakForm::processFormMarkers(const Hermes::vector >& spaces, bool surface, Hermes::vector forms_to_process) + void WeakForm::processFormMarkers(const std::vector > spaces, bool surface, std::vector forms_to_process) { - for(int form_i = 0; form_i < forms_to_process.size(); form_i++) + for (unsigned short form_i = 0; form_i < forms_to_process.size(); form_i++) { Form* form = forms_to_process[form_i]; form->areas_internal.clear(); - for(int marker_i = 0; marker_i < form->areas.size(); marker_i++) + for (unsigned short marker_i = 0; marker_i < form->areas.size(); marker_i++) { - if(form->areas[marker_i] == HERMES_ANY) + if (form->areas[marker_i] == HERMES_ANY) { form->assembleEverywhere = true; form->areas_internal.clear(); @@ -245,12 +262,12 @@ namespace Hermes } Mesh::MarkersConversion::IntValid marker; - if(surface) + if (surface) marker = spaces[form->i]->get_mesh()->get_boundary_markers_conversion().get_internal_marker(form->areas[marker_i]); else marker = spaces[form->i]->get_mesh()->get_element_markers_conversion().get_internal_marker(form->areas[marker_i]); - if(marker.valid) + if (marker.valid) form->areas_internal.push_back(marker.marker); else throw Exceptions::Exception("Marker not valid in assembling: %s.", form->areas[marker_i].c_str()); @@ -259,7 +276,7 @@ namespace Hermes } template - void WeakForm::processFormMarkers(const Hermes::vector >& spaces) + void WeakForm::processFormMarkers(const std::vector > spaces) { processFormMarkers(spaces, false, this->mfvol); processFormMarkers(spaces, false, this->vfvol); @@ -270,19 +287,19 @@ namespace Hermes template bool WeakForm::is_DG() const { - if(this->mfDG.empty() && this->vfDG.empty()) + if (this->mfDG.empty() && this->vfDG.empty()) return false; return true; } template - Hermes::vector > WeakForm::get_ext() const + std::vector > WeakForm::get_ext() const { return this->ext; } template - Form::Form(int i) : scaling_factor(1.0), u_ext_offset(0), wf(nullptr), assembleEverywhere(false), i(i) + Form::Form(int i) : scaling_factor(1.0), wf(nullptr), assembleEverywhere(false), i(i) { areas.push_back(HERMES_ANY); stage_time = 0.0; @@ -312,13 +329,13 @@ namespace Hermes areas.push_back(area); } template - void Form::set_areas(Hermes::vector areas) + void Form::set_areas(std::vector areas) { this->areas = areas; } template - Hermes::vector Form::getAreas() const + std::vector Form::getAreas() const { return this->areas; } @@ -329,12 +346,6 @@ namespace Hermes this->scaling_factor = scalingFactor; } - template - void Form::set_uExtOffset(int u_ext_offset) - { - this->u_ext_offset = u_ext_offset; - } - template void Form::set_ext(MeshFunctionSharedPtr ext) { @@ -343,7 +354,7 @@ namespace Hermes } template - void Form::set_ext(Hermes::vector > ext) + void Form::set_ext(std::vector > ext) { this->ext = ext; } @@ -356,13 +367,13 @@ namespace Hermes } template - void Form::set_u_ext_fn(Hermes::vector > ext) + void Form::set_u_ext_fn(std::vector > ext) { this->u_ext_fn = ext; } template - Hermes::vector > Form::get_ext() const + std::vector > Form::get_ext() const { return this->ext; } @@ -370,15 +381,17 @@ namespace Hermes template void Form::copy_base(Form* other_form) { - this->u_ext_offset = other_form->u_ext_offset; this->stage_time = other_form->stage_time; this->scaling_factor = other_form->scaling_factor; + this->u_ext_offset = other_form->u_ext_offset; + this->previous_iteration_space_index = other_form->previous_iteration_space_index; } template MatrixForm::MatrixForm(unsigned int i, unsigned int j) : - Form(i), sym(HERMES_NONSYM),j(j), previous_iteration_space_index(j) + Form(i), sym(HERMES_NONSYM), j(j) { + this->previous_iteration_space_index = j; } template @@ -387,42 +400,42 @@ namespace Hermes } template - Scalar MatrixForm::value(int n, double *wt, Func **u_ext, Func *u, Func *v, - Geom *e, Func **ext) const + MatrixFormVol::MatrixFormVol(unsigned int i, unsigned int j) : + MatrixForm(i, j) { - throw Hermes::Exceptions::MethodNotOverridenException("MatrixForm::value"); - return 0.0; } template - Hermes::Ord MatrixForm::ord(int n, double *wt, Func **u_ext, Func *u, Func *v, - Geom *e, Func **ext) const + MatrixFormVol::~MatrixFormVol() { - throw Hermes::Exceptions::MethodNotOverridenException("MatrixForm::ord"); - return Hermes::Ord(); } template - MatrixFormVol::MatrixFormVol(unsigned int i, unsigned int j) : - MatrixForm(i, j) + void MatrixFormVol::setSymFlag(SymFlag sym) { + this->sym = sym; } template - MatrixFormVol::~MatrixFormVol() + SymFlag MatrixFormVol::getSymFlag() const { + return this->sym; } template - void MatrixFormVol::setSymFlag(SymFlag sym) + Scalar MatrixFormVol::value(int n, double *wt, Func **u_ext, Func *u, Func *v, + GeomVol *e, Func **ext) const { - this->sym = sym; + throw Hermes::Exceptions::MethodNotOverridenException("MatrixFormVol::value"); + return 0.0; } template - SymFlag MatrixFormVol::getSymFlag() const + Hermes::Ord MatrixFormVol::ord(int n, double *wt, Func **u_ext, Func *u, Func *v, + GeomVol *e, Func **ext) const { - return this->sym; + throw Hermes::Exceptions::MethodNotOverridenException("MatrixFormVol::ord"); + return Hermes::Ord(); } template @@ -438,6 +451,22 @@ namespace Hermes { } + template + Scalar MatrixFormSurf::value(int n, double *wt, Func **u_ext, Func *u, Func *v, + GeomSurf *e, Func **ext) const + { + throw Hermes::Exceptions::MethodNotOverridenException("MatrixFormSurf::value"); + return 0.0; + } + + template + Hermes::Ord MatrixFormSurf::ord(int n, double *wt, Func **u_ext, Func *u, Func *v, + GeomSurf *e, Func **ext) const + { + throw Hermes::Exceptions::MethodNotOverridenException("MatrixFormSurf::ord"); + return Hermes::Ord(); + } + template MatrixFormSurf* MatrixFormSurf::clone() const { @@ -452,8 +481,9 @@ namespace Hermes template MatrixFormDG::MatrixFormDG(unsigned int i, unsigned int j) : - Form(i), j(j), previous_iteration_space_index(j) + Form(i), j(j) { + this->previous_iteration_space_index = j; this->set_area(H2D_DG_INNER_EDGE); } @@ -464,7 +494,7 @@ namespace Hermes template Scalar MatrixFormDG::value(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, - Geom *e, DiscontinuousFunc **ext) const + InterfaceGeom *e, DiscontinuousFunc **ext) const { throw Hermes::Exceptions::MethodNotOverridenException("MatrixFormDG::value"); return 0.0; @@ -472,7 +502,7 @@ namespace Hermes template Hermes::Ord MatrixFormDG::ord(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, - Geom *e, DiscontinuousFunc **ext) const + InterfaceGeom *e, DiscontinuousFunc **ext) const { throw Hermes::Exceptions::MethodNotOverridenException("MatrixFormDG::ord"); return Hermes::Ord(); @@ -489,6 +519,7 @@ namespace Hermes VectorForm::VectorForm(unsigned int i) : Form(i) { + this->previous_iteration_space_index = i; } template @@ -508,18 +539,18 @@ namespace Hermes } template - Scalar VectorForm::value(int n, double *wt, Func **u_ext, Func *v, - Geom *e, Func **ext) const + Scalar VectorFormVol::value(int n, double *wt, Func **u_ext, Func *v, + GeomVol *e, Func **ext) const { - throw Hermes::Exceptions::MethodNotOverridenException("VectorForm::value"); + throw Hermes::Exceptions::MethodNotOverridenException("VectorFormVol::value"); return 0.0; } template - Hermes::Ord VectorForm::ord(int n, double *wt, Func **u_ext, Func *v, - Geom *e, Func **ext) const + Hermes::Ord VectorFormVol::ord(int n, double *wt, Func **u_ext, Func *v, + GeomVol *e, Func **ext) const { - throw Hermes::Exceptions::MethodNotOverridenException("VectorForm::ord"); + throw Hermes::Exceptions::MethodNotOverridenException("VectorFormVol::ord"); return Hermes::Ord(); } @@ -536,6 +567,22 @@ namespace Hermes { } + template + Scalar VectorFormSurf::value(int n, double *wt, Func **u_ext, Func *v, + GeomSurf *e, Func **ext) const + { + throw Hermes::Exceptions::MethodNotOverridenException("VectorFormSurf::value"); + return 0.0; + } + + template + Hermes::Ord VectorFormSurf::ord(int n, double *wt, Func **u_ext, Func *v, + GeomSurf *e, Func **ext) const + { + throw Hermes::Exceptions::MethodNotOverridenException("VectorFormSurf::ord"); + return Hermes::Ord(); + } + template VectorFormSurf::~VectorFormSurf() { @@ -562,7 +609,7 @@ namespace Hermes template Scalar VectorFormDG::value(int n, double *wt, DiscontinuousFunc **u_ext, Func *v, - Geom *e, DiscontinuousFunc **ext) const + InterfaceGeom *e, DiscontinuousFunc **ext) const { throw Hermes::Exceptions::MethodNotOverridenException("VectorFormDG::value"); return 0.0; @@ -570,7 +617,7 @@ namespace Hermes template Hermes::Ord VectorFormDG::ord(int n, double *wt, DiscontinuousFunc **u_ext, Func *v, - Geom *e, DiscontinuousFunc **ext) const + InterfaceGeom *e, DiscontinuousFunc **ext) const { throw Hermes::Exceptions::MethodNotOverridenException("VectorFormDG::ord"); return Hermes::Ord(); @@ -583,16 +630,24 @@ namespace Hermes return nullptr; } + template + void Form::set_weakform(WeakForm* wf) + { + this->wf = wf; + if (wf->original_neq != wf->neq) + this->previous_iteration_space_index %= wf->original_neq; + } + template void WeakForm::add_matrix_form(MatrixFormVol* form) { - if(form->i >= neq || form->j >= neq) + if (form->i >= neq || form->j >= neq) throw Hermes::Exceptions::Exception("Invalid equation number."); - if(form->sym < -1 || form->sym > 1) + if (form->sym < -1 || form->sym > 1) throw Hermes::Exceptions::Exception("\"sym\" must be -1, 0 or 1."); - if(form->sym < 0 && form->i == form->j) + if (form->sym < 0 && form->i == form->j) throw Hermes::Exceptions::Exception("Only off-diagonal forms can be antisymmetric."); - if(mfvol.size() > 100) + if (mfvol.size() > 100) { this->warn("Large number of forms (> 100). Is this the intent?"); } @@ -605,7 +660,7 @@ namespace Hermes template void WeakForm::add_matrix_form_surf(MatrixFormSurf* form) { - if(form->i >= neq || form->j >= neq) + if (form->i >= neq || form->j >= neq) throw Hermes::Exceptions::Exception("Invalid equation number."); form->set_weakform(this); @@ -616,7 +671,7 @@ namespace Hermes template void WeakForm::add_matrix_form_DG(MatrixFormDG* form) { - if(form->i >= neq || form->j >= neq) + if (form->i >= neq || form->j >= neq) throw Hermes::Exceptions::Exception("Invalid equation number."); form->set_weakform(this); @@ -627,7 +682,7 @@ namespace Hermes template void WeakForm::add_vector_form(VectorFormVol* form) { - if(form->i >= neq) + if (form->i >= neq) throw Hermes::Exceptions::Exception("Invalid equation number."); form->set_weakform(this); vfvol.push_back(form); @@ -637,7 +692,7 @@ namespace Hermes template void WeakForm::add_vector_form_surf(VectorFormSurf* form) { - if(form->i >= neq) + if (form->i >= neq) throw Hermes::Exceptions::Exception("Invalid equation number."); form->set_weakform(this); @@ -648,7 +703,7 @@ namespace Hermes template void WeakForm::add_vector_form_DG(VectorFormDG* form) { - if(form->i >= neq) + if (form->i >= neq) throw Hermes::Exceptions::Exception("Invalid equation number."); form->set_weakform(this); @@ -657,38 +712,38 @@ namespace Hermes } template - Hermes::vector *> WeakForm::get_forms() const + std::vector *> WeakForm::get_forms() const { return forms; } template - Hermes::vector *> WeakForm::get_mfvol() const + std::vector *> WeakForm::get_mfvol() const { return mfvol; } template - Hermes::vector *> WeakForm::get_mfsurf() const + std::vector *> WeakForm::get_mfsurf() const { return mfsurf; } template - Hermes::vector *> WeakForm::get_mfDG() const + std::vector *> WeakForm::get_mfDG() const { return mfDG; } template - Hermes::vector *> WeakForm::get_vfvol() const + std::vector *> WeakForm::get_vfvol() const { return vfvol; } template - Hermes::vector *> WeakForm::get_vfsurf() const + std::vector *> WeakForm::get_vfsurf() const { return vfsurf; } template - Hermes::vector *> WeakForm::get_vfDG() const + std::vector *> WeakForm::get_vfDG() const { return vfDG; } @@ -701,25 +756,25 @@ namespace Hermes { for (unsigned int j = 0; j < neq; j++) blocks[i][j] = false; - if(force_diagonal_blocks) + if (force_diagonal_blocks) blocks[i][i] = true; } for (unsigned i = 0; i < mfvol.size(); i++) { - if(fabs(mfvol[i]->scaling_factor) > Hermes::HermesSqrtEpsilon) + if (fabs(mfvol[i]->scaling_factor) > Hermes::HermesSqrtEpsilon) blocks[mfvol[i]->i][mfvol[i]->j] = true; - if(mfvol[i]->sym) - if(fabs(mfvol[i]->scaling_factor) > Hermes::HermesSqrtEpsilon) + if (mfvol[i]->sym) + if (fabs(mfvol[i]->scaling_factor) > Hermes::HermesSqrtEpsilon) blocks[mfvol[i]->j][mfvol[i]->i] = true; } for (unsigned i = 0; i < mfsurf.size(); i++) { - if(fabs(mfsurf[i]->scaling_factor) > Hermes::HermesSqrtEpsilon) + if (fabs(mfsurf[i]->scaling_factor) > Hermes::HermesSqrtEpsilon) blocks[mfsurf[i]->i][mfsurf[i]->j] = true; } for (unsigned i = 0; i < mfDG.size(); i++) { - if(fabs(mfDG[i]->scaling_factor) > Hermes::HermesSqrtEpsilon) + if (fabs(mfDG[i]->scaling_factor) > Hermes::HermesSqrtEpsilon) blocks[mfDG[i]->i][mfDG[i]->j] = true; } @@ -750,25 +805,28 @@ namespace Hermes return current_time_step; } - template class HERMES_API WeakForm; - template class HERMES_API WeakForm >; - template class HERMES_API Form; - template class HERMES_API Form >; - template class HERMES_API MatrixForm; - template class HERMES_API MatrixForm >; - template class HERMES_API MatrixFormVol; - template class HERMES_API MatrixFormVol >; - template class HERMES_API MatrixFormSurf; - template class HERMES_API MatrixFormSurf >; - template class HERMES_API MatrixFormDG; - template class HERMES_API MatrixFormDG >; - template class HERMES_API VectorForm; - template class HERMES_API VectorForm >; - template class HERMES_API VectorFormVol; - template class HERMES_API VectorFormVol >; - template class HERMES_API VectorFormSurf; - template class HERMES_API VectorFormSurf >; - template class HERMES_API VectorFormDG; - template class HERMES_API VectorFormDG >; + template class HERMES_API WeakForm < double > ; + template class HERMES_API WeakForm < std::complex > ; + template class HERMES_API Form < double > ; + template class HERMES_API Form < std::complex > ; + template class HERMES_API MatrixForm < double > ; + template class HERMES_API MatrixForm < std::complex > ; + template class HERMES_API MatrixFormVol < double > ; + template class HERMES_API MatrixFormVol < std::complex > ; + template class HERMES_API MatrixFormSurf < double > ; + template class HERMES_API MatrixFormSurf < std::complex > ; + template class HERMES_API MatrixFormDG < double > ; + template class HERMES_API MatrixFormDG < std::complex > ; + template class HERMES_API VectorForm < double > ; + template class HERMES_API VectorForm < std::complex > ; + template class HERMES_API VectorFormVol < double > ; + template class HERMES_API VectorFormVol < std::complex > ; + template class HERMES_API VectorFormSurf < double > ; + template class HERMES_API VectorFormSurf < std::complex > ; + template class HERMES_API VectorFormDG < double > ; + template class HERMES_API VectorFormDG < std::complex > ; + + template class HERMES_API WeakFormSharedPtr < double > ; + template class HERMES_API WeakFormSharedPtr < std::complex > ; } } diff --git a/hermes2d/src/weakform_library/weakforms_elasticity.cpp b/hermes2d/src/weakform_library/weakforms_elasticity.cpp index f0585eae10..400470e331 100644 --- a/hermes2d/src/weakform_library/weakforms_elasticity.cpp +++ b/hermes2d/src/weakform_library/weakforms_elasticity.cpp @@ -41,17 +41,17 @@ namespace Hermes template Scalar DefaultJacobianElasticity_0_0::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { - return (lambda + 2*mu) * int_dudx_dvdx(n, wt, u, v) + + return (lambda + 2 * mu) * int_dudx_dvdx(n, wt, u, v) + mu * int_dudy_dvdy(n, wt, u, v); } template Ord DefaultJacobianElasticity_0_0::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { - return (lambda + 2*mu) * int_dudx_dvdx(n, wt, u, v) + + return (lambda + 2 * mu) * int_dudx_dvdx(n, wt, u, v) + mu * int_dudy_dvdy(n, wt, u, v); } @@ -80,7 +80,7 @@ namespace Hermes template Scalar DefaultJacobianElasticity_0_1::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { return lambda * int_dudy_dvdx(n, wt, u, v) + mu * int_dudx_dvdy(n, wt, u, v); @@ -88,7 +88,7 @@ namespace Hermes template Ord DefaultJacobianElasticity_0_1::ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { return lambda * int_dudy_dvdx(n, wt, u, v) + mu * int_dudx_dvdy(n, wt, u, v); @@ -117,17 +117,17 @@ namespace Hermes template Scalar DefaultResidualElasticity_0_0::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { - return (2*mu + lambda) * int_dudx_dvdx(n, wt, u_ext[0], v) + + return (2 * mu + lambda) * int_dudx_dvdx(n, wt, u_ext[0], v) + mu * int_dudy_dvdy(n, wt, u_ext[0], v); } template Ord DefaultResidualElasticity_0_0::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { - return (2*mu + lambda) * int_dudx_dvdx(n, wt, u_ext[0], v) + + return (2 * mu + lambda) * int_dudx_dvdx(n, wt, u_ext[0], v) + mu * int_dudy_dvdy(n, wt, u_ext[0], v); } @@ -154,7 +154,7 @@ namespace Hermes template Scalar DefaultResidualElasticity_0_1::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return lambda * int_dudy_dvdx(n, wt, u_ext[1], v) + mu * int_dudx_dvdy(n, wt, u_ext[1], v); @@ -162,7 +162,7 @@ namespace Hermes template Ord DefaultResidualElasticity_0_1::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return lambda * int_dudy_dvdx(n, wt, u_ext[1], v) + mu * int_dudx_dvdy(n, wt, u_ext[1], v); @@ -191,7 +191,7 @@ namespace Hermes template Scalar DefaultResidualElasticity_1_0::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return mu * int_dudy_dvdx(n, wt, u_ext[0], v) + lambda * int_dudx_dvdy(n, wt, u_ext[0], v); @@ -199,7 +199,7 @@ namespace Hermes template Ord DefaultResidualElasticity_1_0::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return mu * int_dudy_dvdx(n, wt, u_ext[0], v) + lambda * int_dudx_dvdy(n, wt, u_ext[0], v); @@ -228,17 +228,17 @@ namespace Hermes template Scalar DefaultResidualElasticity_1_1::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { - return (2*mu + lambda) * int_dudy_dvdy(n, wt, u_ext[1], v) + + return (2 * mu + lambda) * int_dudy_dvdy(n, wt, u_ext[1], v) + mu * int_dudx_dvdx(n, wt, u_ext[1], v); } template Ord DefaultResidualElasticity_1_1::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { - return (2*mu + lambda) * int_dudy_dvdy(n, wt, u_ext[1], v) + + return (2 * mu + lambda) * int_dudy_dvdy(n, wt, u_ext[1], v) + mu * int_dudx_dvdx(n, wt, u_ext[1], v); } @@ -265,18 +265,18 @@ namespace Hermes template Scalar DefaultJacobianElasticity_1_1::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { return mu * int_dudx_dvdx(n, wt, u, v) + - (lambda + 2*mu) * int_dudy_dvdy(n, wt, u, v); + (lambda + 2 * mu) * int_dudy_dvdy(n, wt, u, v); } template Ord DefaultJacobianElasticity_1_1::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return mu * int_dudx_dvdx(n, wt, u, v) + - (lambda + 2*mu) * int_dudy_dvdy(n, wt, u, v); + (lambda + 2 * mu) * int_dudy_dvdy(n, wt, u, v); } template @@ -285,13 +285,13 @@ namespace Hermes return new DefaultJacobianElasticity_1_1(this->i, this->j, this->areas[0], this->lambda, this->mu); } - template class HERMES_API DefaultJacobianElasticity_0_0; - template class HERMES_API DefaultJacobianElasticity_0_1; - template class HERMES_API DefaultResidualElasticity_0_0; - template class HERMES_API DefaultResidualElasticity_0_1; - template class HERMES_API DefaultResidualElasticity_1_0; - template class HERMES_API DefaultResidualElasticity_1_1; - template class HERMES_API DefaultJacobianElasticity_1_1; + template class HERMES_API DefaultJacobianElasticity_0_0 < double > ; + template class HERMES_API DefaultJacobianElasticity_0_1 < double > ; + template class HERMES_API DefaultResidualElasticity_0_0 < double > ; + template class HERMES_API DefaultResidualElasticity_0_1 < double > ; + template class HERMES_API DefaultResidualElasticity_1_0 < double > ; + template class HERMES_API DefaultResidualElasticity_1_1 < double > ; + template class HERMES_API DefaultJacobianElasticity_1_1 < double > ; }; } } \ No newline at end of file diff --git a/hermes2d/src/weakform_library/weakforms_h1.cpp b/hermes2d/src/weakform_library/weakforms_h1.cpp index 797b49e1ef..648b53dd94 100644 --- a/hermes2d/src/weakform_library/weakforms_h1.cpp +++ b/hermes2d/src/weakform_library/weakforms_h1.cpp @@ -26,66 +26,66 @@ namespace Hermes DefaultMatrixFormVol::DefaultMatrixFormVol(int i, int j, std::string area, Hermes2DFunction* coeff, SymFlag sym, GeomType gt) : MatrixFormVol(i, j), coeff(coeff), gt(gt) { - this->set_area(area); - this->setSymFlag(sym); + this->set_area(area); + this->setSymFlag(sym); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template<> DefaultMatrixFormVol >::DefaultMatrixFormVol (int i, int j, std::string area, Hermes2DFunction >* coeff, SymFlag sym, GeomType gt) : MatrixFormVol >(i, j), coeff(coeff), gt(gt) { - this->set_area(area); - this->setSymFlag(sym); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction >(std::complex(1.0, 1.0)); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_area(area); + this->setSymFlag(sym); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction >(std::complex(1.0, 1.0)); + this->own_coeff = true; } + else + this->own_coeff = false; + } template<> DefaultMatrixFormVol::DefaultMatrixFormVol - (int i, int j, Hermes::vector areas, + (int i, int j, std::vector areas, Hermes2DFunction* coeff, SymFlag sym, GeomType gt) : MatrixFormVol(i, j), coeff(coeff), gt(gt) { - this->set_areas(areas); - this->setSymFlag(sym); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + this->setSymFlag(sym); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template<> DefaultMatrixFormVol >::DefaultMatrixFormVol - (int i, int j, Hermes::vector areas, + (int i, int j, std::vector areas, Hermes2DFunction >* coeff, SymFlag sym, GeomType gt) : MatrixFormVol >(i, j), coeff(coeff), gt(gt) { - this->set_areas(areas); - this->setSymFlag(sym); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction >(std::complex(1.0, 1.0)); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + this->setSymFlag(sym); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction >(std::complex(1.0, 1.0)); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultMatrixFormVol::~DefaultMatrixFormVol() @@ -96,7 +96,7 @@ namespace Hermes template Scalar DefaultMatrixFormVol::value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar result = 0; if (gt == HERMES_PLANAR) @@ -131,7 +131,7 @@ namespace Hermes template Ord DefaultMatrixFormVol::ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Ord result = Ord(0); if (gt == HERMES_PLANAR) { @@ -165,34 +165,34 @@ namespace Hermes DefaultJacobianDiffusion::DefaultJacobianDiffusion(int i, int j, std::string area, Hermes1DFunction* coeff, SymFlag sym, GeomType gt) - : MatrixFormVol(i, j), idx_j(j), coeff(coeff), gt(gt) + : MatrixFormVol(i, j), coeff(coeff), gt(gt) { - this->set_area(area); - this->setSymFlag(sym); - if (coeff == nullptr) - { - this->coeff = new Hermes1DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; - }; + this->set_area(area); + this->setSymFlag(sym); + if (coeff == nullptr) + { + this->coeff = new Hermes1DFunction(1.0); + this->own_coeff = true; + } + else + this->own_coeff = false; + }; template - DefaultJacobianDiffusion::DefaultJacobianDiffusion(int i, int j, Hermes::vector areas, + DefaultJacobianDiffusion::DefaultJacobianDiffusion(int i, int j, std::vector areas, Hermes1DFunction* coeff, SymFlag sym, GeomType gt) - : MatrixFormVol(i, j), idx_j(j), coeff(coeff), gt(gt) + : MatrixFormVol(i, j), coeff(coeff), gt(gt) { - this->set_areas(areas); - this->setSymFlag(sym); - if (coeff == nullptr) - { - this->coeff = new Hermes1DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + this->setSymFlag(sym); + if (coeff == nullptr) + { + this->coeff = new Hermes1DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultJacobianDiffusion::~DefaultJacobianDiffusion() @@ -203,7 +203,7 @@ namespace Hermes template Scalar DefaultJacobianDiffusion::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar result = 0; if (gt == HERMES_PLANAR) @@ -213,20 +213,20 @@ namespace Hermes Scalar result_der = 0; for (int i = 0; i < n; i++) { - result += wt[i] * ( (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]) ); - result_der += wt[i] * (u->val[i] * (u_ext[idx_j]->dx[i] * v->dx[i] + u_ext[idx_j]->dy[i] * v->dy[i])); + result += wt[i] * ((u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i])); + result_der += wt[i] * (u->val[i] * (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i])); } - result *= coeff->value(u_ext[idx_j]->val[0]); - result_der *= coeff->derivative(u_ext[idx_j]->val[0]); + result *= coeff->value(u_ext[this->previous_iteration_space_index]->val[0]); + result_der *= coeff->derivative(u_ext[this->previous_iteration_space_index]->val[0]); result += result_der; } else { for (int i = 0; i < n; i++) { - result += wt[i] * (coeff->derivative(u_ext[idx_j]->val[i]) * u->val[i] * - (u_ext[idx_j]->dx[i] * v->dx[i] + u_ext[idx_j]->dy[i] * v->dy[i]) - + coeff->value(u_ext[idx_j]->val[i]) + result += wt[i] * (coeff->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * + (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]) + + coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i])); } } @@ -234,17 +234,17 @@ namespace Hermes else { if (gt == HERMES_AXISYM_X) { for (int i = 0; i < n; i++) { - result += wt[i] * e->y[i] * (coeff->derivative(u_ext[idx_j]->val[i]) * u->val[i] * - (u_ext[idx_j]->dx[i] * v->dx[i] + u_ext[idx_j]->dy[i] * v->dy[i]) - + coeff->value(u_ext[idx_j]->val[i]) + result += wt[i] * e->y[i] * (coeff->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * + (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]) + + coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i])); } } else { for (int i = 0; i < n; i++) { - result += wt[i] * e->x[i] * (coeff->derivative(u_ext[idx_j]->val[i]) * u->val[i] * - (u_ext[idx_j]->dx[i] * v->dx[i] + u_ext[idx_j]->dy[i] * v->dy[i]) - + coeff->value(u_ext[idx_j]->val[i]) + result += wt[i] * e->x[i] * (coeff->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * + (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]) + + coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i])); } } @@ -255,31 +255,31 @@ namespace Hermes template Ord DefaultJacobianDiffusion::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { - result += wt[i] * (coeff->derivative(u_ext[idx_j]->val[i]) * u->val[i] * - (u_ext[idx_j]->dx[i] * v->dx[i] + u_ext[idx_j]->dy[i] * v->dy[i]) - + coeff->value(u_ext[idx_j]->val[i]) + result += wt[i] * (coeff->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * + (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]) + + coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i])); } } else { if (gt == HERMES_AXISYM_X) { for (int i = 0; i < n; i++) { - result += wt[i] * e->y[i] * (coeff->derivative(u_ext[idx_j]->val[i]) * u->val[i] * - (u_ext[idx_j]->dx[i] * v->dx[i] + u_ext[idx_j]->dy[i] * v->dy[i]) - + coeff->value(u_ext[idx_j]->val[i]) + result += wt[i] * e->y[i] * (coeff->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * + (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]) + + coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i])); } } else { for (int i = 0; i < n; i++) { - result += wt[i] * e->x[i] * (coeff->derivative(u_ext[idx_j]->val[i]) * u->val[i] * - (u_ext[idx_j]->dx[i] * v->dx[i] + u_ext[idx_j]->dy[i] * v->dy[i]) - + coeff->value(u_ext[idx_j]->val[i]) + result += wt[i] * e->x[i] * (coeff->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * + (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]) + + coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i])); } } @@ -298,34 +298,34 @@ namespace Hermes DefaultMatrixFormDiffusion::DefaultMatrixFormDiffusion(int i, int j, std::string area, Hermes1DFunction* coeff, SymFlag sym, GeomType gt) - : MatrixFormVol(i, j), idx_j(j), coeff(coeff), gt(gt) + : MatrixFormVol(i, j), coeff(coeff), gt(gt) { - this->set_area(area); - this->setSymFlag(sym); - if (coeff == nullptr) - { - this->coeff = new Hermes1DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; - }; + this->set_area(area); + this->setSymFlag(sym); + if (coeff == nullptr) + { + this->coeff = new Hermes1DFunction(1.0); + this->own_coeff = true; + } + else + this->own_coeff = false; + }; template - DefaultMatrixFormDiffusion::DefaultMatrixFormDiffusion(int i, int j, Hermes::vector areas, + DefaultMatrixFormDiffusion::DefaultMatrixFormDiffusion(int i, int j, std::vector areas, Hermes1DFunction* coeff, SymFlag sym, GeomType gt) - : MatrixFormVol(i, j), idx_j(j), coeff(coeff), gt(gt) + : MatrixFormVol(i, j), coeff(coeff), gt(gt) { - this->set_areas(areas); - this->setSymFlag(sym); - if (coeff == nullptr) - { - this->coeff = new Hermes1DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + this->setSymFlag(sym); + if (coeff == nullptr) + { + this->coeff = new Hermes1DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultMatrixFormDiffusion::~DefaultMatrixFormDiffusion() @@ -336,7 +336,7 @@ namespace Hermes template Scalar DefaultMatrixFormDiffusion::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar result = 0; if (gt == HERMES_PLANAR) { @@ -362,7 +362,7 @@ namespace Hermes template Ord DefaultMatrixFormDiffusion::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); if (gt == HERMES_PLANAR) { @@ -397,63 +397,60 @@ namespace Hermes Hermes1DFunction* coeff1, Hermes1DFunction* coeff2, GeomType gt) - : MatrixFormVol(i, j), - idx_j(j), coeff1(coeff1), coeff2(coeff2), gt(gt) + : MatrixFormVol(i, j), coeff1(coeff1), coeff2(coeff2), gt(gt) { - this->set_area(area); + this->set_area(area); - if (gt != HERMES_PLANAR) throw Hermes::Exceptions::Exception("Axisymmetric advection forms not implemented yet."); + if (gt != HERMES_PLANAR) throw Hermes::Exceptions::Exception("Axisymmetric advection forms not implemented yet."); - // If coeff1 == nullptr or coeff22 == nullptr, initialize it to be constant 1.0. - if (coeff1 == nullptr) - { - this->coeff1 = new Hermes1DFunction(1.0); - this->own_coeff1 = true; - } - else - this->own_coeff1 = false; - if (coeff2 == nullptr) - { - this->coeff2 = new Hermes1DFunction(1.0); - this->own_coeff2 = true; - } - else - this->own_coeff2 = false; + // If coeff1 == nullptr or coeff22 == nullptr, initialize it to be constant 1.0. + if (coeff1 == nullptr) + { + this->coeff1 = new Hermes1DFunction(1.0); + this->own_coeff1 = true; + } + else + this->own_coeff1 = false; + if (coeff2 == nullptr) + { + this->coeff2 = new Hermes1DFunction(1.0); + this->own_coeff2 = true; } + else + this->own_coeff2 = false; + } template - DefaultJacobianAdvection::DefaultJacobianAdvection(int i, int j, Hermes::vector areas, + DefaultJacobianAdvection::DefaultJacobianAdvection(int i, int j, std::vector areas, Hermes1DFunction* coeff1, Hermes1DFunction* coeff2, GeomType gt) - : MatrixFormVol(i, j), - idx_j(j), coeff1(coeff1), coeff2(coeff2), gt(gt) + : MatrixFormVol(i, j), coeff1(coeff1), coeff2(coeff2), gt(gt) { - this->set_areas(areas); + this->set_areas(areas); - if (gt != HERMES_PLANAR) throw Hermes::Exceptions::Exception("Axisymmetric advection forms not implemented yet."); + if (gt != HERMES_PLANAR) throw Hermes::Exceptions::Exception("Axisymmetric advection forms not implemented yet."); - // If coeff1 == nullptr or coeff22 == nullptr, initialize it to be constant 1.0. - if (coeff1 == nullptr) - { - this->coeff1 = new Hermes1DFunction(1.0); - this->own_coeff1 = true; - } - else - this->own_coeff1 = false; - if (coeff2 == nullptr) - { - this->coeff2 = new Hermes1DFunction(1.0); - this->own_coeff2 = true; - } - else - this->own_coeff2 = false; + // If coeff1 == nullptr or coeff22 == nullptr, initialize it to be constant 1.0. + if (coeff1 == nullptr) + { + this->coeff1 = new Hermes1DFunction(1.0); + this->own_coeff1 = true; } + else + this->own_coeff1 = false; + if (coeff2 == nullptr) + { + this->coeff2 = new Hermes1DFunction(1.0); + this->own_coeff2 = true; + } + else + this->own_coeff2 = false; + } template DefaultJacobianAdvection::~DefaultJacobianAdvection() { - if (this->own_coeff1) delete coeff1; if (this->own_coeff2) @@ -462,28 +459,28 @@ namespace Hermes template Scalar DefaultJacobianAdvection::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar result = 0; for (int i = 0; i < n; i++) { - result += wt[i] * (coeff1->derivative(u_ext[idx_j]->val[i]) * u->val[i] * u_ext[idx_j]->dx[i] * v->val[i] - + coeff1->value(u_ext[idx_j]->val[i]) * u->dx[i] * v->val[i] - + coeff2->derivative(u_ext[idx_j]->val[i]) * u->val[i] * u_ext[idx_j]->dy[i] * v->val[i] - + coeff2->value(u_ext[idx_j]->val[i]) * u->dy[i] * v->val[i]); + result += wt[i] * (coeff1->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * u_ext[this->previous_iteration_space_index]->dx[i] * v->val[i] + + coeff1->value(u_ext[this->previous_iteration_space_index]->val[i]) * u->dx[i] * v->val[i] + + coeff2->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * u_ext[this->previous_iteration_space_index]->dy[i] * v->val[i] + + coeff2->value(u_ext[this->previous_iteration_space_index]->val[i]) * u->dy[i] * v->val[i]); } return result; } template Ord DefaultJacobianAdvection::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); for (int i = 0; i < n; i++) { - result += wt[i] * (coeff1->derivative(u_ext[idx_j]->val[i]) * u->val[i] * u_ext[idx_j]->dx[i] * v->val[i] - + coeff1->value(u_ext[idx_j]->val[i]) * u->dx[i] * v->val[i] - + coeff2->derivative(u_ext[idx_j]->val[i]) * u->val[i] * u_ext[idx_j]->dy[i] * v->val[i] - + coeff2->value(u_ext[idx_j]->val[i]) * u->dy[i] * v->val[i]); + result += wt[i] * (coeff1->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * u_ext[this->previous_iteration_space_index]->dx[i] * v->val[i] + + coeff1->value(u_ext[this->previous_iteration_space_index]->val[i]) * u->dx[i] * v->val[i] + + coeff2->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u->val[i] * u_ext[this->previous_iteration_space_index]->dy[i] * v->val[i] + + coeff2->value(u_ext[this->previous_iteration_space_index]->val[i]) * u->dy[i] * v->val[i]); } return result; } @@ -501,43 +498,42 @@ namespace Hermes GeomType gt) : VectorFormVol(i), coeff(coeff), gt(gt) { - this->set_area(area); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_area(area); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template - DefaultVectorFormVol::DefaultVectorFormVol(int i, Hermes::vector areas, + DefaultVectorFormVol::DefaultVectorFormVol(int i, std::vector areas, Hermes2DFunction* coeff, GeomType gt) : VectorFormVol(i), coeff(coeff), gt(gt) { - this->set_areas(areas); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultVectorFormVol::~DefaultVectorFormVol() { - if (this->own_coeff) delete coeff; }; template Scalar DefaultVectorFormVol::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar result = 0; if (gt == HERMES_PLANAR) { @@ -562,7 +558,7 @@ namespace Hermes template Ord DefaultVectorFormVol::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); if (gt == HERMES_PLANAR) { @@ -596,61 +592,60 @@ namespace Hermes DefaultResidualVol::DefaultResidualVol(int i, std::string area, Hermes2DFunction* coeff, GeomType gt) - : VectorFormVol(i), idx_i(i), coeff(coeff), gt(gt) + : VectorFormVol(i), coeff(coeff), gt(gt) { - this->set_area(area); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_area(area); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template - DefaultResidualVol::DefaultResidualVol(int i, Hermes::vector areas, + DefaultResidualVol::DefaultResidualVol(int i, std::vector areas, Hermes2DFunction* coeff, GeomType gt) - : VectorFormVol(i), idx_i(i), coeff(coeff), gt(gt) + : VectorFormVol(i), coeff(coeff), gt(gt) { - this->set_areas(areas); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultResidualVol::~DefaultResidualVol() { - if (this->own_coeff) delete coeff; }; template Scalar DefaultResidualVol::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar result = 0; if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { - result += wt[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } else { if (gt == HERMES_AXISYM_X) { for (int i = 0; i < n; i++) { - result += wt[i] * e->y[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * e->y[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } else { for (int i = 0; i < n; i++) { - result += wt[i] * e->x[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * e->x[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } } @@ -659,23 +654,23 @@ namespace Hermes template Ord DefaultResidualVol::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { - result += wt[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } else { if (gt == HERMES_AXISYM_X) { for (int i = 0; i < n; i++) { - result += wt[i] * e->y[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * e->y[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } else { for (int i = 0; i < n; i++) { - result += wt[i] * e->x[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * e->x[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } } @@ -692,63 +687,62 @@ namespace Hermes template DefaultResidualDiffusion::DefaultResidualDiffusion(int i, std::string area, Hermes1DFunction* coeff, GeomType gt) - : VectorFormVol(i), idx_i(i), coeff(coeff), gt(gt) + : VectorFormVol(i), coeff(coeff), gt(gt) { - this->set_area(area); - if (coeff == nullptr) - { - this->coeff = new Hermes1DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; - }; + this->set_area(area); + if (coeff == nullptr) + { + this->coeff = new Hermes1DFunction(1.0); + this->own_coeff = true; + } + else + this->own_coeff = false; + }; template - DefaultResidualDiffusion::DefaultResidualDiffusion(int i, Hermes::vector areas, + DefaultResidualDiffusion::DefaultResidualDiffusion(int i, std::vector areas, Hermes1DFunction* coeff, GeomType gt) - : VectorFormVol(i), idx_i(i), coeff(coeff), gt(gt) + : VectorFormVol(i), coeff(coeff), gt(gt) { - this->set_areas(areas); - if (coeff == nullptr) - { - this->coeff = new Hermes1DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + if (coeff == nullptr) + { + this->coeff = new Hermes1DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultResidualDiffusion::~DefaultResidualDiffusion() { - if (this->own_coeff) delete coeff; }; template Scalar DefaultResidualDiffusion::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar result = 0; if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { - result += wt[i] * coeff->value(u_ext[idx_i]->val[i]) - * (u_ext[idx_i]->dx[i] * v->dx[i] + u_ext[idx_i]->dy[i] * v->dy[i]); + result += wt[i] * coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) + * (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]); } } else { if (gt == HERMES_AXISYM_X) { for (int i = 0; i < n; i++) { - result += wt[i] * e->y[i] * coeff->value(u_ext[idx_i]->val[i]) - * (u_ext[idx_i]->dx[i] * v->dx[i] + u_ext[idx_i]->dy[i] * v->dy[i]); + result += wt[i] * e->y[i] * coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) + * (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]); } } else { for (int i = 0; i < n; i++) { - result += wt[i] * e->x[i] * coeff->value(u_ext[idx_i]->val[i]) - * (u_ext[idx_i]->dx[i] * v->dx[i] + u_ext[idx_i]->dy[i] * v->dy[i]); + result += wt[i] * e->x[i] * coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) + * (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]); } } } @@ -758,12 +752,12 @@ namespace Hermes template Ord DefaultResidualDiffusion::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); for (int i = 0; i < n; i++) { - result += wt[i] * coeff->value(u_ext[idx_i]->val[i]) - * (u_ext[idx_i]->dx[i] * v->dx[i] + u_ext[idx_i]->dy[i] * v->dy[i]); + result += wt[i] * coeff->value(u_ext[this->previous_iteration_space_index]->val[i]) + * (u_ext[this->previous_iteration_space_index]->dx[i] * v->dx[i] + u_ext[this->previous_iteration_space_index]->dy[i] * v->dy[i]); } if (gt != HERMES_PLANAR) result = result * Ord(1); @@ -781,57 +775,56 @@ namespace Hermes Hermes1DFunction* coeff1, Hermes1DFunction* coeff2, GeomType gt) - : VectorFormVol(i), idx_i(i), coeff1(coeff1), coeff2(coeff2), gt(gt) + : VectorFormVol(i), coeff1(coeff1), coeff2(coeff2), gt(gt) { - this->set_area(area); + this->set_area(area); - if (gt != HERMES_PLANAR) throw Hermes::Exceptions::Exception("Axisymmetric advection forms not implemented yet."); + if (gt != HERMES_PLANAR) throw Hermes::Exceptions::Exception("Axisymmetric advection forms not implemented yet."); - // If coeff1 == nullptr or coeff22 == nullptr, initialize it to be constant 1.0. - if (coeff1 == nullptr) - { - this->coeff1 = new Hermes1DFunction(1.0); - this->own_coeff1 = true; - } - else - this->own_coeff1 = false; - if (coeff2 == nullptr) - { - this->coeff2 = new Hermes1DFunction(1.0); - this->own_coeff2 = true; - } - else - this->own_coeff2 = false; + // If coeff1 == nullptr or coeff22 == nullptr, initialize it to be constant 1.0. + if (coeff1 == nullptr) + { + this->coeff1 = new Hermes1DFunction(1.0); + this->own_coeff1 = true; } + else + this->own_coeff1 = false; + if (coeff2 == nullptr) + { + this->coeff2 = new Hermes1DFunction(1.0); + this->own_coeff2 = true; + } + else + this->own_coeff2 = false; + } template - DefaultResidualAdvection::DefaultResidualAdvection(int i, Hermes::vector areas, \ + DefaultResidualAdvection::DefaultResidualAdvection(int i, std::vector areas, \ Hermes1DFunction* coeff1, Hermes1DFunction* coeff2, GeomType gt) - : VectorFormVol(i), - idx_i(i), coeff1(coeff1), coeff2(coeff2), gt(gt) + : VectorFormVol(i), coeff1(coeff1), coeff2(coeff2), gt(gt) { - this->set_areas(areas); + this->set_areas(areas); - if (gt != HERMES_PLANAR) throw Hermes::Exceptions::Exception("Axisymmetric advection forms not implemented yet."); + if (gt != HERMES_PLANAR) throw Hermes::Exceptions::Exception("Axisymmetric advection forms not implemented yet."); - // If coeff1 == nullptr or coeff22 == nullptr, initialize it to be constant 1.0. - if (coeff1 == nullptr) - { - this->coeff1 = new Hermes1DFunction(1.0); - this->own_coeff1 = true; - } - else - this->own_coeff1 = false; - if (coeff2 == nullptr) - { - this->coeff2 = new Hermes1DFunction(1.0); - this->own_coeff2 = true; - } - else - this->own_coeff2 = false; + // If coeff1 == nullptr or coeff22 == nullptr, initialize it to be constant 1.0. + if (coeff1 == nullptr) + { + this->coeff1 = new Hermes1DFunction(1.0); + this->own_coeff1 = true; + } + else + this->own_coeff1 = false; + if (coeff2 == nullptr) + { + this->coeff2 = new Hermes1DFunction(1.0); + this->own_coeff2 = true; } + else + this->own_coeff2 = false; + } template DefaultResidualAdvection::~DefaultResidualAdvection() @@ -844,10 +837,10 @@ namespace Hermes template Scalar DefaultResidualAdvection::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar result = 0; - Func* u_prev = u_ext[idx_i]; + Func* u_prev = u_ext[this->previous_iteration_space_index]; for (int i = 0; i < n; i++) { result += wt[i] * (coeff1->value(u_prev->val[i]) * (u_prev->dx[i] * v->val[i]) + coeff2->value(u_prev->val[i]) * (u_prev->dy[i] * v->val[i])); @@ -857,10 +850,10 @@ namespace Hermes template Ord DefaultResidualAdvection::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); - Func* u_prev = u_ext[idx_i]; + Func* u_prev = u_ext[this->previous_iteration_space_index]; for (int i = 0; i < n; i++) { result += wt[i] * (coeff1->value(u_prev->val[i]) * (u_prev->dx[i] * v->val[i]) + coeff2->value(u_prev->val[i]) * (u_prev->dy[i] * v->val[i])); @@ -880,43 +873,42 @@ namespace Hermes GeomType gt) : MatrixFormSurf(i, j), coeff(coeff), gt(gt) { - this->set_area(area); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_area(area); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template - DefaultMatrixFormSurf::DefaultMatrixFormSurf(int i, int j, Hermes::vector areas, + DefaultMatrixFormSurf::DefaultMatrixFormSurf(int i, int j, std::vector areas, Hermes2DFunction* coeff, GeomType gt) : MatrixFormSurf(i, j), coeff(coeff), gt(gt) { - this->set_areas(areas); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultMatrixFormSurf::~DefaultMatrixFormSurf() { - if (this->own_coeff) delete coeff; }; template Scalar DefaultMatrixFormSurf::value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Scalar result = 0; if (gt == HERMES_PLANAR) { @@ -942,7 +934,7 @@ namespace Hermes template Ord DefaultMatrixFormSurf::ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomSurf *e, Func **ext) const { Ord result = Ord(0); if (gt == HERMES_PLANAR) { @@ -976,51 +968,49 @@ namespace Hermes DefaultJacobianFormSurf::DefaultJacobianFormSurf(int i, int j, std::string area, Hermes1DFunction* coeff, GeomType gt) - : MatrixFormSurf(i, j), - idx_j(j), coeff(coeff), gt(gt) + : MatrixFormSurf(i, j), coeff(coeff), gt(gt) { - this->set_area(area); - if (coeff == nullptr) - { - this->coeff = new Hermes1DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_area(area); + if (coeff == nullptr) + { + this->coeff = new Hermes1DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template - DefaultJacobianFormSurf::DefaultJacobianFormSurf(int i, int j, Hermes::vector areas, + DefaultJacobianFormSurf::DefaultJacobianFormSurf(int i, int j, std::vector areas, Hermes1DFunction* coeff, GeomType gt) : MatrixFormSurf(i, j), coeff(coeff), gt(gt) { - this->set_areas(areas); - if (coeff == nullptr) - { - this->coeff = new Hermes1DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + if (coeff == nullptr) + { + this->coeff = new Hermes1DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultJacobianFormSurf::~DefaultJacobianFormSurf() { - if (this->own_coeff) delete coeff; }; template Scalar DefaultJacobianFormSurf::value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Scalar result = 0; for (int i = 0; i < n; i++) { - result += wt[i] * (coeff->derivative(u_ext[idx_j]->val[i]) * u_ext[idx_j]->val[i] - + coeff->value(u_ext[idx_j]->val[i])) + result += wt[i] * (coeff->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u_ext[this->previous_iteration_space_index]->val[i] + + coeff->value(u_ext[this->previous_iteration_space_index]->val[i])) * u->val[i] * v->val[i]; } return result; @@ -1028,12 +1018,12 @@ namespace Hermes template Ord DefaultJacobianFormSurf::ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomSurf *e, Func **ext) const { Ord result = Ord(0); for (int i = 0; i < n; i++) { - result += wt[i] * (coeff->derivative(u_ext[idx_j]->val[i]) * u_ext[idx_j]->val[i] - + coeff->value(u_ext[idx_j]->val[i])) + result += wt[i] * (coeff->derivative(u_ext[this->previous_iteration_space_index]->val[i]) * u_ext[this->previous_iteration_space_index]->val[i] + + coeff->value(u_ext[this->previous_iteration_space_index]->val[i])) * u->val[i] * v->val[i]; } return result; @@ -1051,45 +1041,43 @@ namespace Hermes GeomType gt) : VectorFormSurf(i), coeff(coeff), gt(gt) { - this->set_area(area); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_area(area); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template - DefaultVectorFormSurf::DefaultVectorFormSurf(int i, Hermes::vector areas, + DefaultVectorFormSurf::DefaultVectorFormSurf(int i, std::vector areas, Hermes2DFunction* coeff, GeomType gt) : VectorFormSurf(i), coeff(coeff), gt(gt) { - this->set_areas(areas); - + this->set_areas(areas); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultVectorFormSurf::~DefaultVectorFormSurf() { - if (this->own_coeff) delete coeff; }; template Scalar DefaultVectorFormSurf::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Scalar result = 0; if (gt == HERMES_PLANAR) { @@ -1115,7 +1103,7 @@ namespace Hermes template Ord DefaultVectorFormSurf::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Ord result = Ord(0); if (gt == HERMES_PLANAR) { @@ -1149,61 +1137,60 @@ namespace Hermes DefaultResidualSurf::DefaultResidualSurf(int i, std::string area, Hermes2DFunction* coeff, GeomType gt) - : VectorFormSurf(i), idx_i(i), coeff(coeff), gt(gt) + : VectorFormSurf(i), coeff(coeff), gt(gt) { - this->set_area(area); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_area(area); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template - DefaultResidualSurf::DefaultResidualSurf(int i, Hermes::vector areas, + DefaultResidualSurf::DefaultResidualSurf(int i, std::vector areas, Hermes2DFunction* coeff, GeomType gt) - : VectorFormSurf(i), idx_i(i), coeff(coeff), gt(gt) + : VectorFormSurf(i), coeff(coeff), gt(gt) { - this->set_areas(areas); - if (coeff == nullptr) - { - this->coeff = new Hermes2DFunction(1.0); - this->own_coeff = true; - } - else - this->own_coeff = false; + this->set_areas(areas); + if (coeff == nullptr) + { + this->coeff = new Hermes2DFunction(1.0); + this->own_coeff = true; } + else + this->own_coeff = false; + } template DefaultResidualSurf::~DefaultResidualSurf() { - if (this->own_coeff) delete coeff; }; template Scalar DefaultResidualSurf::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Scalar result = 0; if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { - result += wt[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } else { if (gt == HERMES_AXISYM_X) { for (int i = 0; i < n; i++) { - result += wt[i] * e->y[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * e->y[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } else { for (int i = 0; i < n; i++) { - result += wt[i] * e->x[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * e->x[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } } @@ -1213,23 +1200,23 @@ namespace Hermes template Ord DefaultResidualSurf::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Ord result = Ord(0); if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { - result += wt[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } else { if (gt == HERMES_AXISYM_X) { for (int i = 0; i < n; i++) { - result += wt[i] * e->y[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * e->y[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } else { for (int i = 0; i < n; i++) { - result += wt[i] * e->x[i] * coeff->value(e->x[i], e->y[i]) * u_ext[idx_i]->val[i] * v->val[i]; + result += wt[i] * e->x[i] * coeff->value(e->x[i], e->y[i]) * u_ext[this->previous_iteration_space_index]->val[i] * v->val[i]; } } } @@ -1248,12 +1235,12 @@ namespace Hermes Hermes1DFunction* coeff, GeomType gt) : WeakForm() { - // Jacobian. - this->add_matrix_form(new DefaultJacobianDiffusion(0, 0, area, coeff, HERMES_NONSYM, gt)); + // Jacobian. + this->add_matrix_form(new DefaultJacobianDiffusion(0, 0, area, coeff, HERMES_NONSYM, gt)); - // Residual. - this->add_vector_form(new DefaultResidualDiffusion(0, area, coeff, gt)); - }; + // Residual. + this->add_vector_form(new DefaultResidualDiffusion(0, area, coeff, gt)); + }; template DefaultWeakFormLaplaceLinear::DefaultWeakFormLaplaceLinear(std::string area, GeomType gt) : WeakForm() @@ -1273,59 +1260,59 @@ namespace Hermes Hermes2DFunction* f, GeomType gt) : WeakForm() { - // Jacobian. - // NOTE: The flag HERMES_NONSYM is important here. - this->add_matrix_form(new DefaultJacobianDiffusion(0, 0, area, coeff, HERMES_NONSYM, gt)); + // Jacobian. + // NOTE: The flag HERMES_NONSYM is important here. + this->add_matrix_form(new DefaultJacobianDiffusion(0, 0, area, coeff, HERMES_NONSYM, gt)); - // Residual. - this->add_vector_form(new DefaultResidualDiffusion(0, area, coeff, gt)); - this->add_vector_form(new DefaultVectorFormVol(0, area, f, gt)); - }; + // Residual. + this->add_vector_form(new DefaultResidualDiffusion(0, area, coeff, gt)); + this->add_vector_form(new DefaultVectorFormVol(0, area, f, gt)); + }; template DefaultWeakFormPoissonLinear::DefaultWeakFormPoissonLinear(std::string area, Hermes2DFunction* f, GeomType gt) : WeakForm() { - // Jacobian. - this->add_matrix_form(new DefaultMatrixFormDiffusion(0, 0, area, nullptr, HERMES_SYM)); - - // Residual. - this->add_vector_form(new DefaultVectorFormVol(0, area, f)); - }; - - template class HERMES_API DefaultMatrixFormVol; - template class HERMES_API DefaultMatrixFormVol >; - template class HERMES_API DefaultJacobianDiffusion; - template class HERMES_API DefaultJacobianDiffusion >; - template class HERMES_API DefaultMatrixFormDiffusion; - template class HERMES_API DefaultMatrixFormDiffusion >; - template class HERMES_API DefaultResidualAdvection; - template class HERMES_API DefaultResidualAdvection >; - template class HERMES_API DefaultJacobianAdvection; - template class HERMES_API DefaultJacobianAdvection >; - template class HERMES_API DefaultResidualDiffusion; - template class HERMES_API DefaultResidualDiffusion >; - template class HERMES_API DefaultMatrixFormSurf; - template class HERMES_API DefaultMatrixFormSurf >; - template class HERMES_API DefaultVectorFormSurf; - template class HERMES_API DefaultVectorFormSurf >; - template class HERMES_API DefaultVectorFormVol; - template class HERMES_API DefaultVectorFormVol >; - template class HERMES_API DefaultJacobianFormSurf; - template class HERMES_API DefaultJacobianFormSurf >; - template class HERMES_API DefaultWeakFormLaplace; - template class HERMES_API DefaultWeakFormLaplace >; - template class HERMES_API DefaultWeakFormLaplaceLinear; - template class HERMES_API DefaultWeakFormLaplaceLinear >; - template class HERMES_API DefaultWeakFormPoisson; - template class HERMES_API DefaultWeakFormPoisson >; - template class HERMES_API DefaultWeakFormPoissonLinear; - template class HERMES_API DefaultWeakFormPoissonLinear >; - template class HERMES_API DefaultResidualSurf; - template class HERMES_API DefaultResidualSurf >; - template class HERMES_API DefaultResidualVol; - template class HERMES_API DefaultResidualVol >; + // Jacobian. + this->add_matrix_form(new DefaultMatrixFormDiffusion(0, 0, area, nullptr, HERMES_SYM)); + + // Residual. + this->add_vector_form(new DefaultVectorFormVol(0, area, f)); + }; + + template class HERMES_API DefaultMatrixFormVol < double > ; + template class HERMES_API DefaultMatrixFormVol < std::complex > ; + template class HERMES_API DefaultJacobianDiffusion < double > ; + template class HERMES_API DefaultJacobianDiffusion < std::complex > ; + template class HERMES_API DefaultMatrixFormDiffusion < double > ; + template class HERMES_API DefaultMatrixFormDiffusion < std::complex > ; + template class HERMES_API DefaultResidualAdvection < double > ; + template class HERMES_API DefaultResidualAdvection < std::complex > ; + template class HERMES_API DefaultJacobianAdvection < double > ; + template class HERMES_API DefaultJacobianAdvection < std::complex > ; + template class HERMES_API DefaultResidualDiffusion < double > ; + template class HERMES_API DefaultResidualDiffusion < std::complex > ; + template class HERMES_API DefaultMatrixFormSurf < double > ; + template class HERMES_API DefaultMatrixFormSurf < std::complex > ; + template class HERMES_API DefaultVectorFormSurf < double > ; + template class HERMES_API DefaultVectorFormSurf < std::complex > ; + template class HERMES_API DefaultVectorFormVol < double > ; + template class HERMES_API DefaultVectorFormVol < std::complex > ; + template class HERMES_API DefaultJacobianFormSurf < double > ; + template class HERMES_API DefaultJacobianFormSurf < std::complex > ; + template class HERMES_API DefaultWeakFormLaplace < double > ; + template class HERMES_API DefaultWeakFormLaplace < std::complex > ; + template class HERMES_API DefaultWeakFormLaplaceLinear < double > ; + template class HERMES_API DefaultWeakFormLaplaceLinear < std::complex > ; + template class HERMES_API DefaultWeakFormPoisson < double > ; + template class HERMES_API DefaultWeakFormPoisson < std::complex > ; + template class HERMES_API DefaultWeakFormPoissonLinear < double > ; + template class HERMES_API DefaultWeakFormPoissonLinear < std::complex > ; + template class HERMES_API DefaultResidualSurf < double > ; + template class HERMES_API DefaultResidualSurf < std::complex > ; + template class HERMES_API DefaultResidualVol < double > ; + template class HERMES_API DefaultResidualVol < std::complex > ; }; } -} +} \ No newline at end of file diff --git a/hermes2d/src/weakform_library/weakforms_hcurl.cpp b/hermes2d/src/weakform_library/weakforms_hcurl.cpp index bfc3207063..ca54c1f500 100644 --- a/hermes2d/src/weakform_library/weakforms_hcurl.cpp +++ b/hermes2d/src/weakform_library/weakforms_hcurl.cpp @@ -56,7 +56,7 @@ namespace Hermes } template - static Scalar int_F_e_f(int n, double *wt, double (*F)(int marker, Real x, Real y), Func *u, Func *v, Geom *e) + static Scalar int_F_e_f(int n, double *wt, double(*F)(int marker, Real x, Real y), Func *u, Func *v, Geom *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -65,11 +65,11 @@ namespace Hermes } template - static Scalar int_e_tau_f_tau(int n, double *wt, Func *u, Func *v, Geom *e) + static Scalar int_e_tau_f_tau(int n, double *wt, Func *u, Func *v, GeomSurf *e) { Scalar result = Scalar(0); for (int i = 0; i < n; i++) - result += wt[i] * ( (u->val0[i] * e->tx[i] + u->val1[i] * e->ty[i]) * + result += wt[i] * ((u->val0[i] * e->tx[i] + u->val1[i] * e->ty[i]) * conj(v->val0[i] * e->tx[i] + v->val1[i] * e->ty[i])); return result; } @@ -87,13 +87,13 @@ namespace Hermes this->setSymFlag(sym); // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); } template DefaultMatrixFormVol::DefaultMatrixFormVol - (int i, int j, Hermes::vector areas, Scalar const_coeff, + (int i, int j, std::vector areas, Scalar const_coeff, Hermes2DFunction* f_coeff, SymFlag sym, GeomType gt) : MatrixFormVol(i, j), const_coeff(const_coeff), function_coeff(f_coeff), gt(gt) { @@ -101,23 +101,23 @@ namespace Hermes this->setSymFlag(sym); // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); } template DefaultMatrixFormVol::~DefaultMatrixFormVol() { - if(function_coeff == nullptr) + if (function_coeff == nullptr) delete function_coeff; }; template Scalar DefaultMatrixFormVol::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar result = 0; - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { result = const_coeff * int_e_f(n, wt, u, v); } @@ -128,10 +128,10 @@ namespace Hermes template Ord DefaultMatrixFormVol::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { result = const_coeff * int_e_f(n, wt, u, v); } @@ -157,12 +157,12 @@ namespace Hermes this->setSymFlag(sym); // If spline is nullptr, initialize it to be constant 1.0. - if(c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); + if (c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); }; template - DefaultJacobianCurlCurl::DefaultJacobianCurlCurl(int i, int j, Hermes::vector areas, + DefaultJacobianCurlCurl::DefaultJacobianCurlCurl(int i, int j, std::vector areas, Scalar const_coeff, CubicSpline* c_spline, SymFlag sym, GeomType gt) : MatrixFormVol(i, j), @@ -172,7 +172,7 @@ namespace Hermes this->setSymFlag(sym); // If spline is nullptr, initialize it to be constant 1.0. - if(c_spline == nullptr) + if (c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); } @@ -180,16 +180,16 @@ namespace Hermes template DefaultJacobianCurlCurl::~DefaultJacobianCurlCurl() { - if(spline_coeff == nullptr) + if (spline_coeff == nullptr) delete spline_coeff; }; template Scalar DefaultJacobianCurlCurl::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar result = 0; - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { result = const_coeff * int_curl_e_curl_f(n, wt, u, v); } @@ -200,10 +200,10 @@ namespace Hermes template Ord DefaultJacobianCurlCurl::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { result = const_coeff * int_curl_e_curl_f(n, wt, u, v); } @@ -228,14 +228,14 @@ namespace Hermes this->set_area(area); // If f_coeff0 is nullptr, initialize it to be constant 1.0. - if(f_coeff0 == nullptr) this->function_coeff0 = new Hermes2DFunction(1.0); + if (f_coeff0 == nullptr) this->function_coeff0 = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); - if(f_coeff1 == nullptr) this->function_coeff1 = new Hermes2DFunction(1.0); + if (f_coeff1 == nullptr) this->function_coeff1 = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); } template - DefaultVectorFormVol::DefaultVectorFormVol(int i, Hermes::vector areas, + DefaultVectorFormVol::DefaultVectorFormVol(int i, std::vector areas, Scalar const_coeff0, Scalar const_coeff1, Hermes2DFunction* f_coeff0, Hermes2DFunction* f_coeff1, GeomType gt) @@ -243,24 +243,24 @@ namespace Hermes function_coeff0(f_coeff0), function_coeff1(f_coeff1), gt(gt) { this->set_areas(areas); - + // If f_coeff0 is nullptr, initialize it to be constant 1.0. - if(f_coeff0 == nullptr) this->function_coeff0 = new Hermes2DFunction(1.0); + if (f_coeff0 == nullptr) this->function_coeff0 = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); - if(f_coeff1 == nullptr) this->function_coeff1 = new Hermes2DFunction(1.0); + if (f_coeff1 == nullptr) this->function_coeff1 = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); } template DefaultVectorFormVol::~DefaultVectorFormVol() { - if(function_coeff0 == nullptr) delete function_coeff0; - if(function_coeff1 == nullptr) delete function_coeff1; + if (function_coeff0 == nullptr) delete function_coeff0; + if (function_coeff1 == nullptr) delete function_coeff1; }; template Scalar DefaultVectorFormVol::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar int_v0 = 0, int_v1 = 0; for (int i = 0; i < n; i++) int_v0 += wt[i] * v->val0[i]; @@ -270,7 +270,7 @@ namespace Hermes template Ord DefaultVectorFormVol::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord int_v0 = Ord(0), int_v1 = Ord(0); for (int i = 0; i < n; i++) int_v0 += wt[i] * v->val0[i]; @@ -294,12 +294,12 @@ namespace Hermes this->set_area(area); // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant functions in Hcurl forms not implemented yet."); } template - DefaultResidualVol::DefaultResidualVol(int i, Hermes::vector areas, Scalar const_coeff, + DefaultResidualVol::DefaultResidualVol(int i, std::vector areas, Scalar const_coeff, Hermes2DFunction* f_coeff, GeomType gt) : VectorFormVol(i), @@ -308,22 +308,22 @@ namespace Hermes this->set_areas(areas); // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant functions in Hcurl forms not implemented yet."); } template DefaultResidualVol::~DefaultResidualVol() { - if(function_coeff == nullptr) delete function_coeff; + if (function_coeff == nullptr) delete function_coeff; }; template Scalar DefaultResidualVol::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar result = 0; - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { @@ -338,10 +338,10 @@ namespace Hermes template Ord DefaultResidualVol::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord result = Ord(0); - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { @@ -369,12 +369,12 @@ namespace Hermes this->set_area(area); // If spline is nullptr, initialize it to be constant 1.0. - if(c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); + if (c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); }; template - DefaultResidualCurlCurl::DefaultResidualCurlCurl(int i, Hermes::vector areas, Scalar const_coeff, + DefaultResidualCurlCurl::DefaultResidualCurlCurl(int i, std::vector areas, Scalar const_coeff, CubicSpline* c_spline, GeomType gt) : VectorFormVol(i), @@ -383,23 +383,23 @@ namespace Hermes this->set_areas(areas); // If spline is nullptr, initialize it to be constant 1.0. - if(c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); + if (c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); } template DefaultResidualCurlCurl::~DefaultResidualCurlCurl() { - if(spline_coeff == nullptr) delete spline_coeff; + if (spline_coeff == nullptr) delete spline_coeff; }; template Scalar DefaultResidualCurlCurl::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Func* u_prev = u_ext[idx_i]; Scalar result = 0; - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { @@ -417,11 +417,11 @@ namespace Hermes template Ord DefaultResidualCurlCurl::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Func* u_prev = u_ext[idx_i]; Ord result = Ord(0); - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { @@ -451,34 +451,34 @@ namespace Hermes { this->set_area(area); // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant functions in Hcurl forms not implemented yet."); } template - DefaultMatrixFormSurf::DefaultMatrixFormSurf(int i, int j, Hermes::vector areas, + DefaultMatrixFormSurf::DefaultMatrixFormSurf(int i, int j, std::vector areas, Scalar const_coeff, Hermes2DFunction* f_coeff, GeomType gt) : MatrixFormSurf(i, j), const_coeff(const_coeff), function_coeff(f_coeff), gt(gt) { this->set_areas(areas); // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant functions in Hcurl forms not implemented yet."); } template DefaultMatrixFormSurf::~DefaultMatrixFormSurf() { - if(function_coeff == nullptr) delete function_coeff; + if (function_coeff == nullptr) delete function_coeff; }; template Scalar DefaultMatrixFormSurf::value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Scalar result = 0; - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { result = const_coeff * int_e_tau_f_tau(n, wt, u, v, e); } @@ -489,10 +489,10 @@ namespace Hermes template Ord DefaultMatrixFormSurf::ord(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomSurf *e, Func **ext) const { Ord result = Ord(0); - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { result = const_coeff * int_e_tau_f_tau(n, wt, u, v, e); } @@ -516,36 +516,36 @@ namespace Hermes { this->set_area(area); // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant functions in Hcurl forms not implemented yet."); } template - DefaultResidualSurf::DefaultResidualSurf(int i, Hermes::vector areas, + DefaultResidualSurf::DefaultResidualSurf(int i, std::vector areas, Scalar const_coeff, Hermes2DFunction* f_coeff, GeomType gt) : VectorFormSurf(i), const_coeff(const_coeff), function_coeff(f_coeff), gt(gt) { // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant functions in Hcurl forms not implemented yet."); } template DefaultResidualSurf::~DefaultResidualSurf() { - if(function_coeff == nullptr) delete function_coeff; + if (function_coeff == nullptr) delete function_coeff; }; template Scalar DefaultResidualSurf::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Scalar result = 0; - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) - result += wt[i] * ( (u_ext[0]->val0[i] * e->tx[i] + u_ext[0]->val1[i] * e->ty[i]) * + result += wt[i] * ((u_ext[0]->val0[i] * e->tx[i] + u_ext[0]->val1[i] * e->ty[i]) * conj(v->val0[i] * e->tx[i] + v->val1[i] * e->ty[i])); result *= const_coeff; } @@ -556,13 +556,13 @@ namespace Hermes template Ord DefaultResidualSurf::ord(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const + Func *v, GeomSurf *e, Func **ext) const { Ord result = Ord(0); - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) - result += wt[i] * ( (u_ext[0]->val0[i] * e->tx[i] + u_ext[0]->val1[i] * e->ty[i]) * + result += wt[i] * ((u_ext[0]->val0[i] * e->tx[i] + u_ext[0]->val1[i] * e->ty[i]) * conj(v->val0[i] * e->tx[i] + v->val1[i] * e->ty[i])); } else throw Hermes::Exceptions::Exception("Axisymmetric Hcurl forms not implemnted yet."); @@ -584,34 +584,34 @@ namespace Hermes { this->set_area(area); // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); } template - DefaultVectorFormSurf::DefaultVectorFormSurf(int i, Hermes::vector areas, Scalar const_coeff, + DefaultVectorFormSurf::DefaultVectorFormSurf(int i, std::vector areas, Scalar const_coeff, Hermes2DFunction* f_coeff, GeomType gt) : VectorFormSurf(i), const_coeff(const_coeff), function_coeff(f_coeff), gt(gt) { this->set_areas(areas); // If f_coeff is nullptr, initialize it to be constant 1.0. - if(f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); + if (f_coeff == nullptr) this->function_coeff = new Hermes2DFunction(1.0); else throw Hermes::Exceptions::Exception("Nonconstant coefficients in Hcurl forms not implemented yet."); } template DefaultVectorFormSurf::~DefaultVectorFormSurf() { - if(function_coeff == nullptr) delete function_coeff; + if (function_coeff == nullptr) delete function_coeff; }; template Scalar DefaultVectorFormSurf::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Scalar result = 0; - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { @@ -625,10 +625,10 @@ namespace Hermes template Ord DefaultVectorFormSurf::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Ord result = Ord(0); - if(gt == HERMES_PLANAR) + if (gt == HERMES_PLANAR) { for (int i = 0; i < n; i++) { @@ -646,22 +646,22 @@ namespace Hermes return new DefaultVectorFormSurf(*this); } - template class HERMES_API DefaultJacobianCurlCurl; - template class HERMES_API DefaultJacobianCurlCurl >; - template class HERMES_API DefaultMatrixFormVol; - template class HERMES_API DefaultMatrixFormVol >; - template class HERMES_API DefaultVectorFormVol; - template class HERMES_API DefaultVectorFormVol >; - template class HERMES_API DefaultResidualVol; - template class HERMES_API DefaultResidualVol >; - template class HERMES_API DefaultResidualCurlCurl; - template class HERMES_API DefaultResidualCurlCurl >; - template class HERMES_API DefaultMatrixFormSurf; - template class HERMES_API DefaultMatrixFormSurf >; - template class HERMES_API DefaultVectorFormSurf; - template class HERMES_API DefaultVectorFormSurf >; - template class HERMES_API DefaultResidualSurf; - template class HERMES_API DefaultResidualSurf >; + template class HERMES_API DefaultJacobianCurlCurl < double > ; + template class HERMES_API DefaultJacobianCurlCurl < std::complex > ; + template class HERMES_API DefaultMatrixFormVol < double > ; + template class HERMES_API DefaultMatrixFormVol < std::complex > ; + template class HERMES_API DefaultVectorFormVol < double > ; + template class HERMES_API DefaultVectorFormVol < std::complex > ; + template class HERMES_API DefaultResidualVol < double > ; + template class HERMES_API DefaultResidualVol < std::complex > ; + template class HERMES_API DefaultResidualCurlCurl < double > ; + template class HERMES_API DefaultResidualCurlCurl < std::complex > ; + template class HERMES_API DefaultMatrixFormSurf < double > ; + template class HERMES_API DefaultMatrixFormSurf < std::complex > ; + template class HERMES_API DefaultVectorFormSurf < double > ; + template class HERMES_API DefaultVectorFormSurf < std::complex > ; + template class HERMES_API DefaultResidualSurf < double > ; + template class HERMES_API DefaultResidualSurf < std::complex > ; }; } } \ No newline at end of file diff --git a/hermes2d/src/weakform_library/weakforms_maxwell.cpp b/hermes2d/src/weakform_library/weakforms_maxwell.cpp index ece96348d6..2485c93ba9 100644 --- a/hermes2d/src/weakform_library/weakforms_maxwell.cpp +++ b/hermes2d/src/weakform_library/weakforms_maxwell.cpp @@ -36,10 +36,10 @@ namespace Hermes this->setSymFlag(sym); // If spline is nullptr, initialize it to be constant 1.0. - if(c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); + if (c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); } template - DefaultJacobianMagnetostatics::DefaultJacobianMagnetostatics(int i, int j, Hermes::vector areas, + DefaultJacobianMagnetostatics::DefaultJacobianMagnetostatics(int i, int j, std::vector areas, Scalar const_coeff, CubicSpline* c_spline, SymFlag sym, @@ -53,47 +53,47 @@ namespace Hermes this->setSymFlag(sym); // If spline is nullptr, initialize it to be constant 1.0. - if(c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); + if (c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); } template Scalar DefaultJacobianMagnetostatics::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar planar_part = 0; Scalar axisym_part = 0; for (int i = 0; i < n; i++) { Scalar B_i = sqrt(sqr(u_ext[idx_j]->dx[i]) + sqr(u_ext[idx_j]->dy[i])); - if(std::abs(B_i) > Hermes::HermesSqrtEpsilon) + if (std::abs(B_i) > Hermes::HermesSqrtEpsilon) { planar_part += wt[i] * const_coeff*spline_coeff->derivative(B_i) / B_i * (u_ext[idx_j]->dx[i] * u->dx[i] + u_ext[idx_j]->dy[i] * u->dy[i]) * (u_ext[idx_j]->dx[i] * v->dx[i] + u_ext[idx_j]->dy[i] * v->dy[i]); - if(gt == HERMES_AXISYM_X) + if (gt == HERMES_AXISYM_X) { axisym_part += wt[i] * const_coeff*spline_coeff->derivative(B_i) / B_i / e->y[i] - * (u_ext[idx_j]->dx[i] * u->dx[i] + u_ext[idx_j]->dy[i] * u->dy[i]) + * (u_ext[idx_j]->dx[i] * u->dx[i] + u_ext[idx_j]->dy[i] * u->dy[i]) * u_ext[idx_j]->val[i] * v->dy[i]; } - else if(gt == HERMES_AXISYM_Y) + else if (gt == HERMES_AXISYM_Y) { axisym_part += wt[i] * const_coeff*spline_coeff->derivative(B_i) / B_i / e->x[i] - * (u_ext[idx_j]->dx[i] * u->dx[i] + u_ext[idx_j]->dy[i] * u->dy[i]) + * (u_ext[idx_j]->dx[i] * u->dx[i] + u_ext[idx_j]->dy[i] * u->dy[i]) * u_ext[idx_j]->val[i] * v->dx[i]; } } planar_part += wt[i] * const_coeff*spline_coeff->value(B_i) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]); - if(gt == HERMES_AXISYM_X) + if (gt == HERMES_AXISYM_X) { axisym_part += wt[i] * const_coeff*spline_coeff->value(B_i) / e->y[i] - * u->val[i] * v->dy[i]; + * u->val[i] * v->dy[i]; } - else if(gt == HERMES_AXISYM_Y) + else if (gt == HERMES_AXISYM_Y) { axisym_part += wt[i] * const_coeff*spline_coeff->value(B_i) / e->x[i] - * u->val[i] * v->dx[i]; + * u->val[i] * v->dx[i]; } } @@ -102,7 +102,7 @@ namespace Hermes template Ord DefaultJacobianMagnetostatics::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord planar_part(0); for (int i = 0; i < n; i++) @@ -137,11 +137,11 @@ namespace Hermes { this->set_area(area); // If spline is nullptr, initialize it to be constant 1.0. - if(c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); + if (c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); } template - DefaultResidualMagnetostatics::DefaultResidualMagnetostatics(int i, Hermes::vector areas, Scalar const_coeff, + DefaultResidualMagnetostatics::DefaultResidualMagnetostatics(int i, std::vector areas, Scalar const_coeff, CubicSpline* c_spline, GeomType gt, int order_increase) : VectorFormVol(i), idx_i(i), const_coeff(const_coeff), spline_coeff(c_spline), gt(gt), @@ -150,12 +150,12 @@ namespace Hermes this->set_areas(areas); // If spline is nullptr, initialize it to be constant 1.0. - if(c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); + if (c_spline == nullptr) this->spline_coeff = new CubicSpline(1.0); } template Scalar DefaultResidualMagnetostatics::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar planar_part = 0; Scalar axisym_part = 0; @@ -164,17 +164,17 @@ namespace Hermes Scalar B_i = sqrt(sqr(u_ext[idx_i]->dx[i]) + sqr(u_ext[idx_i]->dy[i])); planar_part += wt[i] * const_coeff*spline_coeff->value(B_i) * (u_ext[idx_i]->dx[i] * v->dx[i] + u_ext[idx_i]->dy[i] * v->dy[i]); - if(gt == HERMES_AXISYM_X) axisym_part += wt[i] * const_coeff*spline_coeff->value(B_i) / e->y[i] - * u_ext[idx_i]->val[i] * v->dy[i]; - else if(gt == HERMES_AXISYM_Y) axisym_part += wt[i] * const_coeff*spline_coeff->value(B_i) / e->x[i] - * u_ext[idx_i]->val[i] * v->dx[i]; + if (gt == HERMES_AXISYM_X) axisym_part += wt[i] * const_coeff*spline_coeff->value(B_i) / e->y[i] + * u_ext[idx_i]->val[i] * v->dy[i]; + else if (gt == HERMES_AXISYM_Y) axisym_part += wt[i] * const_coeff*spline_coeff->value(B_i) / e->x[i] + * u_ext[idx_i]->val[i] * v->dx[i]; } return planar_part + axisym_part; } template Ord DefaultResidualMagnetostatics::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Ord planar_part(0); for (int i = 0; i < n; i++) @@ -193,8 +193,8 @@ namespace Hermes return new DefaultResidualMagnetostatics(*this); } - template class HERMES_API DefaultJacobianMagnetostatics; - template class HERMES_API DefaultResidualMagnetostatics; + template class HERMES_API DefaultJacobianMagnetostatics < double > ; + template class HERMES_API DefaultResidualMagnetostatics < double > ; } } } \ No newline at end of file diff --git a/hermes2d/src/weakform_library/weakforms_neutronics.cpp b/hermes2d/src/weakform_library/weakforms_neutronics.cpp index 20b289dcf6..9ddca764ee 100644 --- a/hermes2d/src/weakform_library/weakforms_neutronics.cpp +++ b/hermes2d/src/weakform_library/weakforms_neutronics.cpp @@ -29,32 +29,32 @@ namespace Hermes namespace Diffusion { template - DefaultWeakFormFixedSource::DefaultWeakFormFixedSource(Hermes::vector regions, - Hermes::vector D_map, - Hermes::vector Sigma_a_map, - Hermes::vector Q_map) : WeakForm(1) + DefaultWeakFormFixedSource::DefaultWeakFormFixedSource(std::vector regions, + std::vector D_map, + std::vector Sigma_a_map, + std::vector Q_map) : WeakForm(1) { - using namespace WeakFormsH1; - - for (unsigned int i = 0; i < regions.size(); i++) - { - /* Jacobian */ - // Diffusion. - this->add_matrix_form(new DefaultJacobianDiffusion(0, 0, regions[i], new Hermes1DFunction(D_map[i]), - HERMES_SYM)); - // Absorption. - this->add_matrix_form(new DefaultMatrixFormVol(0, 0, regions[i], new Hermes2DFunction(Sigma_a_map[i]), - HERMES_SYM)); - - /* Residual */ - // Diffusion. - this->add_vector_form(new DefaultResidualDiffusion(0, regions[i], new Hermes1DFunction(D_map[i]))); - // Absorption. - this->add_vector_form(new DefaultResidualVol(0, regions[i], new Hermes2DFunction(Sigma_a_map[i]))); - // Sources. - this->add_vector_form(new DefaultVectorFormVol(0, regions[i], new Hermes2DFunction(-Q_map[i]))); - } + using namespace WeakFormsH1; + + for (unsigned int i = 0; i < regions.size(); i++) + { + /* Jacobian */ + // Diffusion. + this->add_matrix_form(new DefaultJacobianDiffusion(0, 0, regions[i], new Hermes1DFunction(D_map[i]), + HERMES_SYM)); + // Absorption. + this->add_matrix_form(new DefaultMatrixFormVol(0, 0, regions[i], new Hermes2DFunction(Sigma_a_map[i]), + HERMES_SYM)); + + /* Residual */ + // Diffusion. + this->add_vector_form(new DefaultResidualDiffusion(0, regions[i], new Hermes1DFunction(D_map[i]))); + // Absorption. + this->add_vector_form(new DefaultResidualVol(0, regions[i], new Hermes2DFunction(Sigma_a_map[i]))); + // Sources. + this->add_vector_form(new DefaultVectorFormVol(0, regions[i], new Hermes2DFunction(-Q_map[i]))); } + } } } @@ -169,8 +169,8 @@ namespace Hermes rank1::const_iterator f = itf->second.begin(); for (; a != ita->second.end(); ++a, ++f) - if (*a < *f) - this->warn(W_SA_LT_SF); + if (*a < *f) + this->warn(W_SA_LT_SF); } } } @@ -187,7 +187,8 @@ namespace Hermes else { throw Hermes::Exceptions::Exception(E_INVALID_MARKER); - return *(new rank1()); // To avoid MSVC problems; execution should never come to this point. + // To avoid MSVC problems; execution should never come to this point. + return *(new rank1()); } } const rank1& MaterialPropertyMaps::get_nu(std::string material) const @@ -200,7 +201,8 @@ namespace Hermes else { throw Hermes::Exceptions::Exception(E_INVALID_MARKER); - return *(new rank1()); // To avoid MSVC problems; execution should never come to this point. + // To avoid MSVC problems; execution should never come to this point. + return *(new rank1()); } } const rank1& MaterialPropertyMaps::get_chi(std::string material) const @@ -213,7 +215,8 @@ namespace Hermes else { throw Hermes::Exceptions::Exception(E_INVALID_MARKER); - return *(new rank1()); // To avoid MSVC problems; execution should never come to this point. + // To avoid MSVC problems; execution should never come to this point. + return *(new rank1()); } } @@ -379,7 +382,7 @@ namespace Hermes // Now, we surely have Sigma_r ... if (scattering_multigroup_structure.empty()) - scattering_multigroup_structure = bool2(G, Hermes::vector(G, true)); + scattering_multigroup_structure = bool2(G, std::vector(G, true)); if (!Sigma_s_given) { @@ -391,17 +394,17 @@ namespace Hermes { Sigma_s = create_map2_by_diagonals(Common::NDArrayMapOp::subtract(Sigma_t, Sigma_r)); - scattering_multigroup_structure = bool2(G, Hermes::vector(G, false)); + scattering_multigroup_structure = bool2(G, std::vector(G, false)); for (unsigned int gto = 0; gto < G; gto++) - for (unsigned int gfrom = 0; gfrom < G; gfrom++) - if (gto == gfrom) - scattering_multigroup_structure[gto][gfrom] = true; + for (unsigned int gfrom = 0; gfrom < G; gfrom++) + if (gto == gfrom) + scattering_multigroup_structure[gto][gfrom] = true; } else { this->warn(W_NO_SCATTERING); fill_with(0.0, &Sigma_s); - scattering_multigroup_structure = bool2(G, Hermes::vector(G, false)); + scattering_multigroup_structure = bool2(G, std::vector(G, false)); } Sigma_s_given = true; @@ -413,8 +416,8 @@ namespace Hermes { MaterialPropertyMap1::const_iterator Sr_elem = Sigma_r.begin(); for (; Sr_elem != Sigma_r.end(); ++Sr_elem) - for (unsigned int g = 0; g < G; g++) - D[Sr_elem->first][g] = 1. / (3.*Sr_elem->second[g]); + for (unsigned int g = 0; g < G; g++) + D[Sr_elem->first][g] = 1. / (3.*Sr_elem->second[g]); D_given = true; } @@ -441,7 +444,8 @@ namespace Hermes else { throw Hermes::Exceptions::Exception(E_INVALID_MARKER); - return *(new rank2()); // To avoid MSVC problems; execution should never come to this point. + // To avoid MSVC problems; execution should never come to this point. + return *(new rank2()); } } const rank1& MaterialPropertyMaps::get_Sigma_r(std::string material) const @@ -454,7 +458,8 @@ namespace Hermes else { throw Hermes::Exceptions::Exception(E_INVALID_MARKER); - return *(new rank1()); // To avoid MSVC problems; execution should never come to this point. + // To avoid MSVC problems; execution should never come to this point. + return *(new rank1()); } } const rank1& MaterialPropertyMaps::get_D(std::string material) const @@ -467,7 +472,8 @@ namespace Hermes else { throw Hermes::Exceptions::Exception(E_INVALID_MARKER); - return *(new rank1()); // To avoid MSVC problems; execution should never come to this point. + // To avoid MSVC problems; execution should never come to this point. + return *(new rank1()); } } const rank1& MaterialPropertyMaps::get_src(std::string material) const @@ -480,7 +486,8 @@ namespace Hermes else { throw Hermes::Exceptions::Exception(E_INVALID_MARKER); - return *(new rank1()); // To avoid MSVC problems; execution should never come to this point. + // To avoid MSVC problems; execution should never come to this point. + return *(new rank1()); } } @@ -531,7 +538,7 @@ namespace Hermes template template Scalar VacuumBoundaryCondition::Jacobian::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomSurf *e, Func **ext) const { Scalar result; @@ -548,7 +555,7 @@ namespace Hermes template template Scalar VacuumBoundaryCondition::Residual::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const + Func *v, GeomSurf *e, Func **ext) const { Scalar result; @@ -565,7 +572,7 @@ namespace Hermes template template Scalar DiffusionReaction::Jacobian::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar result; @@ -597,7 +604,7 @@ namespace Hermes template template Scalar DiffusionReaction::Residual::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar result; @@ -629,7 +636,7 @@ namespace Hermes template template Scalar FissionYield::Jacobian::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { if (!matprop.get_fission_multigroup_structure()[gto]) return Scalar(0.0); @@ -653,7 +660,7 @@ namespace Hermes template template Scalar FissionYield::OuterIterationForm::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { if (!matprop.get_fission_multigroup_structure()[g]) return Scalar(0.0); @@ -686,7 +693,7 @@ namespace Hermes template template Scalar FissionYield::Residual::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { if (!matprop.get_fission_multigroup_structure()[gto]) return Scalar(0.0); @@ -710,7 +717,7 @@ namespace Hermes template template Scalar Scattering::Jacobian::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar result = Scalar(0); if (geom_type == HERMES_PLANAR) result = int_u_v(n, wt, u, v); @@ -726,7 +733,7 @@ namespace Hermes template template Scalar Scattering::Residual::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { Scalar result = Scalar(0); if (geom_type == HERMES_PLANAR) result = int_u_ext_v(n, wt, u_ext[gfrom], v); @@ -742,7 +749,7 @@ namespace Hermes template template Scalar ExternalSources::LinearForm::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { std::string mat = this->mesh->get_element_markers_conversion().get_user_marker(e->elem_marker).marker; @@ -796,94 +803,94 @@ namespace Hermes DefaultWeakFormFixedSource::DefaultWeakFormFixedSource(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, GeomType geom_type) : WeakForm(matprop.get_G()) { - lhs_init(matprop.get_G(), matprop, mesh, geom_type); - for (unsigned int gto = 0; gto < matprop.get_G(); gto++) - this->add_vector_form(new ExternalSources::LinearForm(gto, matprop, mesh, geom_type)); - } + lhs_init(matprop.get_G(), matprop, mesh, geom_type); + for (unsigned int gto = 0; gto < matprop.get_G(); gto++) + this->add_vector_form(new ExternalSources::LinearForm(gto, matprop, mesh, geom_type)); + } template DefaultWeakFormFixedSource::DefaultWeakFormFixedSource(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, Hermes2DFunction*f_src, std::string src_area, GeomType geom_type) : WeakForm(matprop.get_G()) { - lhs_init(matprop.get_G(), matprop, mesh, geom_type); - for (unsigned int gto = 0; gto < matprop.get_G(); gto++) - this->add_vector_form(new WeakFormsH1::DefaultVectorFormVol(gto, src_area, f_src, geom_type)); - } + lhs_init(matprop.get_G(), matprop, mesh, geom_type); + for (unsigned int gto = 0; gto < matprop.get_G(); gto++) + this->add_vector_form(new WeakFormsH1::DefaultVectorFormVol(gto, src_area, f_src, geom_type)); + } template DefaultWeakFormFixedSource::DefaultWeakFormFixedSource(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, Hermes2DFunction*f_src, - Hermes::vector src_areas, + std::vector src_areas, GeomType geom_type) : WeakForm(matprop.get_G()) { - lhs_init(matprop.get_G(), matprop, mesh, geom_type); - for (unsigned int gto = 0; gto < matprop.get_G(); gto++) - this->add_vector_form(new WeakFormsH1::DefaultVectorFormVol(gto, src_areas, f_src, geom_type)); - } + lhs_init(matprop.get_G(), matprop, mesh, geom_type); + for (unsigned int gto = 0; gto < matprop.get_G(); gto++) + this->add_vector_form(new WeakFormsH1::DefaultVectorFormVol(gto, src_areas, f_src, geom_type)); + } template DefaultWeakFormFixedSource::DefaultWeakFormFixedSource(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - const Hermes::vector*>& f_src, + const std::vector*>& f_src, std::string src_area, GeomType geom_type) : WeakForm(matprop.get_G()) { - if (f_src.size() != matprop.get_G()) - throw Hermes::Exceptions::Exception(E_INVALID_SIZE); + if (f_src.size() != matprop.get_G()) + throw Hermes::Exceptions::Exception(E_INVALID_SIZE); - lhs_init(matprop.get_G(), matprop, mesh, geom_type); - for (unsigned int gto = 0; gto < matprop.get_G(); gto++) - this->add_vector_form(new WeakFormsH1::DefaultVectorFormVol(gto, src_area, f_src[gto], geom_type)); - } + lhs_init(matprop.get_G(), matprop, mesh, geom_type); + for (unsigned int gto = 0; gto < matprop.get_G(); gto++) + this->add_vector_form(new WeakFormsH1::DefaultVectorFormVol(gto, src_area, f_src[gto], geom_type)); + } template DefaultWeakFormFixedSource::DefaultWeakFormFixedSource(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - const Hermes::vector*>& f_src, - Hermes::vector src_areas, + const std::vector*>& f_src, + std::vector src_areas, GeomType geom_type) : WeakForm(matprop.get_G()) { - if (f_src.size() != matprop.get_G()) - throw Hermes::Exceptions::Exception(E_INVALID_SIZE); + if (f_src.size() != matprop.get_G()) + throw Hermes::Exceptions::Exception(E_INVALID_SIZE); - lhs_init(matprop.get_G(), matprop, mesh, geom_type); - for (unsigned int gto = 0; gto < matprop.get_G(); gto++) - this->add_vector_form(new WeakFormsH1::DefaultVectorFormVol(gto, src_areas, f_src[gto], geom_type)); - } + lhs_init(matprop.get_G(), matprop, mesh, geom_type); + for (unsigned int gto = 0; gto < matprop.get_G(); gto++) + this->add_vector_form(new WeakFormsH1::DefaultVectorFormVol(gto, src_areas, f_src[gto], geom_type)); + } template DefaultWeakFormSourceIteration::DefaultWeakFormSourceIteration(const MaterialPropertyMaps& matprop, MeshSharedPtr mesh, - Hermes::vector >& iterates, + std::vector >& iterates, double initial_keff_guess, GeomType geom_type) : WeakForm(matprop.get_G()) { - bool2 Ss_nnz = matprop.get_scattering_multigroup_structure(); + bool2 Ss_nnz = matprop.get_scattering_multigroup_structure(); - for (unsigned int gto = 0; gto < matprop.get_G(); gto++) - { - this->add_matrix_form(new DiffusionReaction::Jacobian(gto, matprop, mesh, geom_type)); - this->add_vector_form(new DiffusionReaction::Residual(gto, matprop, mesh, geom_type)); + for (unsigned int gto = 0; gto < matprop.get_G(); gto++) + { + this->add_matrix_form(new DiffusionReaction::Jacobian(gto, matprop, mesh, geom_type)); + this->add_vector_form(new DiffusionReaction::Residual(gto, matprop, mesh, geom_type)); - for (unsigned int gfrom = 0; gfrom < matprop.get_G(); gfrom++) + for (unsigned int gfrom = 0; gfrom < matprop.get_G(); gfrom++) + { + if (Ss_nnz[gto][gfrom]) { - if (Ss_nnz[gto][gfrom]) - { - this->add_matrix_form(new Scattering::Jacobian(gto, gfrom, matprop, mesh, geom_type)); - this->add_vector_form(new Scattering::Residual(gto, gfrom, matprop, mesh, geom_type)); - } + this->add_matrix_form(new Scattering::Jacobian(gto, gfrom, matprop, mesh, geom_type)); + this->add_vector_form(new Scattering::Residual(gto, gfrom, matprop, mesh, geom_type)); } - - FissionYield::OuterIterationForm* keff_iteration_form = - new FissionYield::OuterIterationForm(gto, matprop, mesh, iterates, initial_keff_guess, geom_type); - keff_iteration_forms.push_back(keff_iteration_form); - this->add_vector_form(keff_iteration_form); } + + FissionYield::OuterIterationForm* keff_iteration_form = new FissionYield::OuterIterationForm(gto, matprop, mesh, iterates, initial_keff_guess, geom_type); + this->set_ext(iterates); + keff_iteration_forms.push_back(keff_iteration_form); + this->add_vector_form(keff_iteration_form); } + } template void DefaultWeakFormSourceIteration::update_keff(double new_keff) { /* Somehow does not work with templates. A bug / typo from me? - Hermes::vector *>::iterator it = keff_iteration_forms.begin(); + std::vector *>::iterator it = keff_iteration_forms.begin(); for ( ; it != keff_iteration_forms.end(); ++it) (*it)->update_keff(new_keff); */ @@ -895,7 +902,7 @@ namespace Hermes namespace SupportClasses { - void SourceFilter::filter_fn(int n, Hermes::vector values, double* result) + void SourceFilter::filter_fn(int n, const std::vector& values, double* result) { for (int i = 0; i < n; i++) { @@ -910,8 +917,8 @@ namespace Hermes { namespace Diffusion { - template class HERMES_API DefaultWeakFormFixedSource; - template class HERMES_API DefaultWeakFormFixedSource >; + template class HERMES_API DefaultWeakFormFixedSource < double > ; + template class HERMES_API DefaultWeakFormFixedSource < std::complex > ; } } namespace Multigroup @@ -920,47 +927,47 @@ namespace Hermes { namespace Diffusion { - template class HERMES_API FissionYield::Jacobian; - template class HERMES_API FissionYield::Jacobian >; - template class HERMES_API FissionYield::OuterIterationForm; - template class HERMES_API FissionYield::OuterIterationForm >; - template class HERMES_API FissionYield::Residual; - template class HERMES_API FissionYield::Residual >; - - template class HERMES_API VacuumBoundaryCondition::Jacobian; - template class HERMES_API VacuumBoundaryCondition::Jacobian >; - template class HERMES_API VacuumBoundaryCondition::Residual; - template class HERMES_API VacuumBoundaryCondition::Residual >; + template class HERMES_API FissionYield::Jacobian < double > ; + template class HERMES_API FissionYield::Jacobian < std::complex > ; + template class HERMES_API FissionYield::OuterIterationForm < double > ; + template class HERMES_API FissionYield::OuterIterationForm < std::complex > ; + template class HERMES_API FissionYield::Residual < double > ; + template class HERMES_API FissionYield::Residual < std::complex > ; + + template class HERMES_API VacuumBoundaryCondition::Jacobian < double > ; + template class HERMES_API VacuumBoundaryCondition::Jacobian < std::complex > ; + template class HERMES_API VacuumBoundaryCondition::Residual < double > ; + template class HERMES_API VacuumBoundaryCondition::Residual < std::complex > ; template double VacuumBoundaryCondition::Jacobian::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomSurf *e, Func **ext) const; template double VacuumBoundaryCondition::Residual::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomSurf *e, Func **ext) const; template double DiffusionReaction::Jacobian::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; template double DiffusionReaction::Residual::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; template double FissionYield::Jacobian::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; template double FissionYield::OuterIterationForm::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; template double FissionYield::Residual::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; template double Scattering::Jacobian::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; template double Scattering::Residual::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; template double ExternalSources::LinearForm::vector_form(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; } } @@ -968,14 +975,14 @@ namespace Hermes { namespace Diffusion { - template class HERMES_API DefaultWeakFormFixedSource; - template class HERMES_API DefaultWeakFormFixedSource >; + template class HERMES_API DefaultWeakFormFixedSource < double > ; + template class HERMES_API DefaultWeakFormFixedSource < std::complex > ; - template class HERMES_API DefaultWeakFormSourceIteration; - template class HERMES_API DefaultWeakFormSourceIteration >; + template class HERMES_API DefaultWeakFormSourceIteration < double > ; + template class HERMES_API DefaultWeakFormSourceIteration < std::complex > ; } } } } } -} +} \ No newline at end of file diff --git a/hermes2d/test_examples/00-quickShow/definitions.cpp b/hermes2d/test_examples/00-quickShow/definitions.cpp index a33f465e66..80e56867ab 100644 --- a/hermes2d/test_examples/00-quickShow/definitions.cpp +++ b/hermes2d/test_examples/00-quickShow/definitions.cpp @@ -1,11 +1,11 @@ #include "definitions.h" CustomWeakFormSteadyState::CustomWeakFormSteadyState(Hermes1DFunction* thermal_conductivity, - Hermes2DFunction* heat_source) - : WeakForm(1) + Hermes2DFunction* heat_source) + : WeakForm(1) { #ifdef LINEAR_NONLINEAR_SWITCH - + // Matrix. this->add_matrix_form(new DefaultMatrixFormDiffusion(0, 0, HERMES_ANY_MARKER, thermal_conductivity)); @@ -25,27 +25,23 @@ CustomWeakFormSteadyState::CustomWeakFormSteadyState(Hermes1DFunction* t #endif }; - - CustomWeakFormTimeDependent::CustomWeakFormTimeDependent(Hermes1DFunction* thermal_conductivity, - Hermes2DFunction* heat_source, - MeshFunctionSharedPtr prev_sln) - : CustomWeakFormSteadyState(thermal_conductivity, heat_source) + Hermes2DFunction* heat_source, + MeshFunctionSharedPtr prev_sln) + : CustomWeakFormSteadyState(thermal_conductivity, heat_source) { // Jacobian. this->add_matrix_form(new CustomMatrixFormVol(0, 0)); // Residual. add_vector_form(new CustomResidualFormVol(0)); - + CustomVectorFormVol* vec_form_vol = new CustomVectorFormVol(0); vec_form_vol->set_ext(prev_sln); add_vector_form(vec_form_vol); }; - - -CustomNonlinearity::CustomNonlinearity(double alpha): Hermes1DFunction() +CustomNonlinearity::CustomNonlinearity(double alpha) : Hermes1DFunction() { this->is_const = false; this->alpha = alpha; @@ -57,7 +53,7 @@ double CustomNonlinearity::value(double u) const } Ord CustomNonlinearity::value(Ord u) const -{ +{ return Ord(10); } @@ -71,37 +67,37 @@ Ord CustomNonlinearity::derivative(Ord u) const return Ord(10); } -CustomEssentialBCNonConst::CustomEssentialBCNonConst(std::string marker) : EssentialBoundaryCondition(Hermes::vector()) +CustomEssentialBCNonConst::CustomEssentialBCNonConst(std::string marker) : EssentialBoundaryCondition(std::vector()) { markers.push_back(marker); } -EssentialBoundaryCondition::EssentialBCValueType CustomEssentialBCNonConst::get_value_type() const -{ - return EssentialBoundaryCondition::BC_FUNCTION; +EssentialBCValueType CustomEssentialBCNonConst::get_value_type() const +{ + return BC_FUNCTION; } -double CustomEssentialBCNonConst::value(double x, double y, double n_x, double n_y, double t_x, double t_y) const +double CustomEssentialBCNonConst::value(double x, double y) const { return (x + 10) * (y + 10) / 100.; } -void CustomInitialCondition::derivatives (double x, double y, double& dx, double& dy) const +void CustomInitialCondition::derivatives(double x, double y, double& dx, double& dy) const { - dx = (y + 10)/100.; - dy = (x + 10)/100.; + dx = (y + 10) / 100.; + dy = (x + 10) / 100.; }; -double CustomInitialCondition::value (double x, double y) const +double CustomInitialCondition::value(double x, double y) const { return (x + 10) * (y + 10) / 100.; } -Ord CustomInitialCondition::ord(double x, double y) const +Ord CustomInitialCondition::ord(double x, double y) const { return Hermes::Ord(x*y); } - + MeshFunction* CustomInitialCondition::clone() const { return new CustomInitialCondition(mesh); @@ -111,11 +107,11 @@ CustomInitialCondition::~CustomInitialCondition() { } -CustomWeakFormTimeDependent::CustomMatrixFormVol::CustomMatrixFormVol(int i, int j) : DefaultMatrixFormVol(i, j, HERMES_ANY_MARKER) +CustomWeakFormTimeDependent::CustomMatrixFormVol::CustomMatrixFormVol(int i, int j) : DefaultMatrixFormVol(i, j, HERMES_ANY_MARKER) { } -double CustomWeakFormTimeDependent::CustomMatrixFormVol::value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const +double CustomWeakFormTimeDependent::CustomMatrixFormVol::value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const { return DefaultMatrixFormVol::value(n, wt, u_ext, u, v, e, ext) / this->wf->get_current_time_step(); } @@ -129,13 +125,13 @@ CustomWeakFormTimeDependent::CustomVectorFormVol::CustomVectorFormVol(int i) : D { } -double CustomWeakFormTimeDependent::CustomVectorFormVol::value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const +double CustomWeakFormTimeDependent::CustomVectorFormVol::value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { double result = 0; - + for (int i = 0; i < n; i++) result += wt[i] * ext[0]->val[i] * v->val[i]; - + return -result / this->wf->get_current_time_step(); } @@ -148,13 +144,13 @@ CustomWeakFormTimeDependent::CustomResidualFormVol::CustomResidualFormVol(int i) { } -double CustomWeakFormTimeDependent::CustomResidualFormVol::value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const +double CustomWeakFormTimeDependent::CustomResidualFormVol::value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { double result = 0; - + for (int i = 0; i < n; i++) result += wt[i] * u_ext[0]->val[i] * v->val[i]; - + return result / this->wf->get_current_time_step(); } diff --git a/hermes2d/test_examples/00-quickShow/definitions.h b/hermes2d/test_examples/00-quickShow/definitions.h index 6b2210d650..1171dcdb45 100644 --- a/hermes2d/test_examples/00-quickShow/definitions.h +++ b/hermes2d/test_examples/00-quickShow/definitions.h @@ -8,7 +8,7 @@ using namespace Views; #define LINEAR_NONLINEAR_SWITCH -class CustomNonlinearity : public Hermes1DFunction +class CustomNonlinearity : public Hermes1DFunction < double > { public: CustomNonlinearity(double alpha); @@ -21,73 +21,73 @@ class CustomNonlinearity : public Hermes1DFunction virtual Ord derivative(Ord u) const; - protected: - double alpha; +protected: + double alpha; }; -class CustomEssentialBCNonConst : public EssentialBoundaryCondition +class CustomEssentialBCNonConst : public EssentialBoundaryCondition < double > { public: CustomEssentialBCNonConst(std::string marker); virtual EssentialBCValueType get_value_type() const; - virtual double value(double x, double y, double n_x, double n_y, double t_x, double t_y) const; + virtual double value(double x, double y) const; }; -class CustomInitialCondition : public ExactSolutionScalar +class CustomInitialCondition : public ExactSolutionScalar < double > { public: CustomInitialCondition(MeshSharedPtr mesh) : ExactSolutionScalar(mesh) {}; ~CustomInitialCondition(); - virtual void derivatives (double x, double y, double& dx, double& dy) const; + virtual void derivatives(double x, double y, double& dx, double& dy) const; - virtual double value (double x, double y) const; + virtual double value(double x, double y) const; virtual Ord ord(double x, double y) const; MeshFunction* clone() const; }; -class CustomWeakFormSteadyState : public WeakForm +class CustomWeakFormSteadyState : public WeakForm < double > { public: CustomWeakFormSteadyState(Hermes1DFunction* thermal_conductivity, Hermes2DFunction* heat_source); }; - + class CustomWeakFormTimeDependent : public CustomWeakFormSteadyState { public: CustomWeakFormTimeDependent(Hermes1DFunction* thermal_conductivity, Hermes2DFunction* heat_source, MeshFunctionSharedPtr prev_sln); - - class CustomMatrixFormVol : public DefaultMatrixFormVol + + class CustomMatrixFormVol : public DefaultMatrixFormVol < double > { CustomMatrixFormVol(int i, int j); - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const; + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const; friend class CustomWeakFormTimeDependent; }; - - class CustomVectorFormVol : public DefaultResidualVol + + class CustomVectorFormVol : public DefaultResidualVol < double > { CustomVectorFormVol(int i); - double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + double value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; friend class CustomWeakFormTimeDependent; }; - - class CustomResidualFormVol : public DefaultResidualVol + + class CustomResidualFormVol : public DefaultResidualVol < double > { CustomResidualFormVol(int i); - double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + double value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; diff --git a/hermes2d/test_examples/00-quickShow/main.cpp b/hermes2d/test_examples/00-quickShow/main.cpp index b3ac7b52cc..96c3889cb0 100644 --- a/hermes2d/test_examples/00-quickShow/main.cpp +++ b/hermes2d/test_examples/00-quickShow/main.cpp @@ -16,7 +16,7 @@ const int INIT_REF_NUM = 2; const int P_INIT = 1; #pragma region Time-dependency setup. -// Time step. +// Time step. double time_step_length = 0.05; // Time interval length. double current_time = 0.; @@ -37,7 +37,7 @@ MeshSharedPtr mesh(new Mesh); // Initialize boundary conditions. DefaultEssentialBCConst bc_zero("Zero", 0.); CustomEssentialBCNonConst bc_essential("Bdy"); -EssentialBCs essential_bcs(Hermes::vector*>(&bc_zero, &bc_essential)); +EssentialBCs essential_bcs({ &bc_zero, &bc_essential }); // Initialize the initial condition. MeshFunctionSharedPtr sln_time_prev(new CustomInitialCondition(mesh)); @@ -215,7 +215,6 @@ int main(int argc, char* argv[]) return 0; } - #pragma region Helper functions void load_mesh(MeshSharedPtr& mesh, const char* filename, int num_initial_refinements) diff --git a/hermes2d/test_examples/01-poisson/definitions.cpp b/hermes2d/test_examples/01-poisson/definitions.cpp index 6aa27a5443..a4ccf6fff4 100644 --- a/hermes2d/test_examples/01-poisson/definitions.cpp +++ b/hermes2d/test_examples/01-poisson/definitions.cpp @@ -3,8 +3,8 @@ /* Weak forms */ CustomWeakFormPoisson::CustomWeakFormPoisson(std::string mat_al, Hermes::Hermes1DFunction* lambda_al, - std::string mat_cu, Hermes::Hermes1DFunction* lambda_cu, - Hermes::Hermes2DFunction* src_term) : Hermes::Hermes2D::WeakForm(1) + std::string mat_cu, Hermes::Hermes1DFunction* lambda_cu, + Hermes::Hermes2DFunction* src_term) : Hermes::Hermes2D::WeakForm(1) { // Jacobian forms. add_matrix_form(new Hermes::Hermes2D::WeakFormsH1::DefaultMatrixFormDiffusion(0, 0, mat_al, lambda_al)); diff --git a/hermes2d/test_examples/01-poisson/main.cpp b/hermes2d/test_examples/01-poisson/main.cpp index 7de3fbc004..19a963df9d 100644 --- a/hermes2d/test_examples/01-poisson/main.cpp +++ b/hermes2d/test_examples/01-poisson/main.cpp @@ -27,113 +27,64 @@ using namespace Hermes::Hermes2D; // // The following parameters can be changed: -const bool HERMES_VISUALIZATION = true; // Set to "false" to suppress Hermes OpenGL visualization. -const bool VTK_VISUALIZATION = true; // Set to "true" to enable VTK output. -const int P_INIT = 3; // Uniform polynomial degree of mesh elements. -const int INIT_REF_NUM = 3; // Number of initial uniform mesh refinements. +// Set to "false" to suppress Hermes OpenGL visualization. +const bool HERMES_VISUALIZATION = true; +// Set to "true" to enable VTK output. +const bool VTK_VISUALIZATION = false; +// Uniform polynomial degree of mesh elements. +const int P_INIT = 10; +// Number of initial uniform mesh refinements. +const int INIT_REF_NUM = 4; // Problem parameters. -const double LAMBDA_AL = 236.0; // Thermal cond. of Al for temperatures around 20 deg Celsius. -const double LAMBDA_CU = 386.0; // Thermal cond. of Cu for temperatures around 20 deg Celsius. -const double VOLUME_HEAT_SRC = 5; // Volume heat sources generated (for example) by electric current. -const double FIXED_BDY_TEMP = 20; // Fixed temperature on the boundary. - -class MyVolumetricIntegralCalculator : public PostProcessing::SurfaceIntegralCalculator -{ -public: - MyVolumetricIntegralCalculator(MeshFunctionSharedPtr source_function, int number_of_integrals) : PostProcessing::SurfaceIntegralCalculator(source_function, number_of_integrals) - { - } - - MyVolumetricIntegralCalculator(Hermes::vector > source_functions, int number_of_integrals) : PostProcessing::SurfaceIntegralCalculator(source_functions, number_of_integrals) - { - } - - virtual void integral(int n, double* wt, Func **fns, Geom *e, double* result) - { - for (int i = 0; i < n; i++) - result[0] += wt[i] * fns[0]->val[i]; - }; - - virtual void order(Func **fns, Hermes::Ord* result) { - result[0] = Hermes::Ord(21); - } -}; +// Thermal cond. of Al, Cu for temperatures around 20 deg Celsius. +const double LAMBDA_AL = 236.0, LAMBDA_CU = 386.0; +// Volume heat sources generated (for example) by electric current. +const double VOLUME_HEAT_SRC = 5; +// Fixed temperature on the boundary. +const double FIXED_BDY_TEMP = 20; int main(int argc, char* argv[]) { - // Load the mesh. - MeshSharedPtr mesh(new Mesh); - Hermes::Hermes2D::MeshReaderH2DXML mloader; - mloader.load("domain.xml", mesh); - - // Refine all elements, do it INIT_REF_NUM-times. - for (unsigned int i = 0; i < INIT_REF_NUM; i++) - mesh->refine_all_elements(); - - // Initialize essential boundary conditions. - Hermes::Hermes2D::DefaultEssentialBCConst bc_essential(Hermes::vector("Bottom", "Inner", "Outer", "Left"), - FIXED_BDY_TEMP); - Hermes::Hermes2D::EssentialBCs bcs(&bc_essential); - - // Initialize space-> - SpaceSharedPtr space(new Hermes::Hermes2D::H1Space(mesh, &bcs, P_INIT)); + // Load the mesh. + MeshSharedPtr mesh(new Mesh); + Hermes::Hermes2D::MeshReaderH2DXML mloader; + mloader.load("domain.xml", mesh); - std::cout << "Ndofs: " << space->get_num_dofs() << std::endl; + // Refine all elements, do it INIT_REF_NUM-times. + for (unsigned int i = 0; i < INIT_REF_NUM; i++) + mesh->refine_all_elements(); - // Initialize the weak formulation. - CustomWeakFormPoisson wf("Aluminum", new Hermes::Hermes1DFunction(LAMBDA_AL), "Copper", - new Hermes::Hermes1DFunction(LAMBDA_CU), new Hermes::Hermes2DFunction(VOLUME_HEAT_SRC)); + // Initialize essential boundary conditions. + Hermes::Hermes2D::DefaultEssentialBCConst bc_essential({ "Bottom", "Inner", "Outer", "Left" }, FIXED_BDY_TEMP); + Hermes::Hermes2D::EssentialBCs bcs(&bc_essential); - // Initialize the solution. - MeshFunctionSharedPtr sln(new Solution); + // Initialize space. + SpaceSharedPtr space(new Hermes::Hermes2D::H1Space(mesh, &bcs, P_INIT)); + std::cout << "Ndofs: " << space->get_num_dofs() << std::endl; - // Initialize linear solver. - Hermes::Hermes2D::LinearSolver linear_solver(&wf, space); + // Initialize the weak formulation. + WeakFormSharedPtr wf(new CustomWeakFormPoisson("Aluminum", new Hermes::Hermes1DFunction(LAMBDA_AL), "Copper", + new Hermes::Hermes1DFunction(LAMBDA_CU), new Hermes::Hermes2DFunction(VOLUME_HEAT_SRC))); - // Solve the linear problem. - try - { - linear_solver.solve(); + // Initialize the solution. + MeshFunctionSharedPtr sln(new Solution); - // Get the solution vector. - double* sln_vector = linear_solver.get_sln_vector(); + // Initialize linear solver. + Hermes::Hermes2D::LinearSolver linear_solver(wf, space); - // Translate the solution vector into the previously initialized Solution. - Hermes::Hermes2D::Solution::vector_to_solution(sln_vector, space, sln); + // Solve the problem. + linear_solver.solve(); - // VTK output. - if (VTK_VISUALIZATION) - { - // Output solution in VTK format. - Hermes::Hermes2D::Views::Linearizer lin(FileExport); - bool mode_3D = false; - lin.save_solution_vtk(sln, "sln.vtk", "Temperature", mode_3D, 1); + // Translate the solution vector into the previously initialized Solution. + Hermes::Hermes2D::Solution::vector_to_solution(linear_solver.get_sln_vector(), space, sln); - // Output mesh and element orders in VTK format. - Hermes::Hermes2D::Views::Orderizer ord; - ord.save_mesh_vtk(space, "mesh.vtk"); - ord.save_orders_vtk(space, "ord.vtk"); - ord.save_markers_vtk(space, "markers.vtk"); - } + // Visualize the solution. + Hermes::Hermes2D::Views::ScalarView viewS("Solution", new Hermes::Hermes2D::Views::WinGeom(750, 50, 600, 600)); + viewS.get_linearizer()->set_criterion(Views::LinearizerCriterionFixed(3)); + viewS.show(sln); - if (HERMES_VISUALIZATION) - { - // Visualize the solution. - Hermes::Hermes2D::Views::ScalarView viewS("Solution", new Hermes::Hermes2D::Views::WinGeom(0, 0, 500, 400)); - Hermes::Hermes2D::Views::OrderView viewSp("Space", new Hermes::Hermes2D::Views::WinGeom(0, 400, 500, 400)); - viewS.show(sln); - viewSp.show(space); - viewS.wait_for_close(); - } - } - catch (Exceptions::Exception& e) - { - std::cout << e.info(); - } - catch (std::exception& e) - { - std::cout << e.what(); - } - return 0; + // Wait for view to be closed. + Views::View::wait(); + return 0; } \ No newline at end of file diff --git a/hermes2d/test_examples/02-poisson-newton/definitions.cpp b/hermes2d/test_examples/02-poisson-newton/definitions.cpp index 73969a4268..923777e618 100644 --- a/hermes2d/test_examples/02-poisson-newton/definitions.cpp +++ b/hermes2d/test_examples/02-poisson-newton/definitions.cpp @@ -26,18 +26,18 @@ CustomWeakFormPoissonNewton::CustomWeakFormPoissonNewton(std::string mat_al, Her /* Custom non-constant Dirichlet condition */ -CustomDirichletCondition::CustomDirichletCondition(Hermes::vector markers, +CustomDirichletCondition::CustomDirichletCondition(std::vector markers, double A, double B, double C) : Hermes::Hermes2D::EssentialBoundaryCondition(markers), A(A), B(B), C(C) { } -Hermes::Hermes2D::EssentialBoundaryCondition::EssentialBCValueType CustomDirichletCondition::get_value_type() const +Hermes::Hermes2D::EssentialBCValueType CustomDirichletCondition::get_value_type() const { - return Hermes::Hermes2D::EssentialBoundaryCondition::BC_FUNCTION; + return Hermes::Hermes2D::BC_FUNCTION; } -double CustomDirichletCondition::value(double x, double y, double n_x, double n_y, double t_x, double t_y) const +double CustomDirichletCondition::value(double x, double y) const { return A*x + B*y + C; } \ No newline at end of file diff --git a/hermes2d/test_examples/02-poisson-newton/definitions.h b/hermes2d/test_examples/02-poisson-newton/definitions.h index 13fdbca07b..03766a38fe 100644 --- a/hermes2d/test_examples/02-poisson-newton/definitions.h +++ b/hermes2d/test_examples/02-poisson-newton/definitions.h @@ -19,11 +19,11 @@ class CustomWeakFormPoissonNewton : public Hermes::Hermes2D::WeakForm class CustomDirichletCondition : public Hermes::Hermes2D::EssentialBoundaryCondition { public: - CustomDirichletCondition(Hermes::vector markers, double A, double B, double C); + CustomDirichletCondition(std::vector markers, double A, double B, double C); virtual EssentialBCValueType get_value_type() const; - virtual double value(double x, double y, double n_x, double n_y, double t_x, double t_y) const; + virtual double value(double x, double y) const; protected: double A, B, C; diff --git a/hermes2d/test_examples/02-poisson-newton/main.cpp b/hermes2d/test_examples/02-poisson-newton/main.cpp index 64c6eb8a77..8ecbb78d7b 100644 --- a/hermes2d/test_examples/02-poisson-newton/main.cpp +++ b/hermes2d/test_examples/02-poisson-newton/main.cpp @@ -15,17 +15,26 @@ // // The following parameters can be changed: -const bool HERMES_VISUALIZATION = true; // Set to "false" to suppress Hermes OpenGL visualization. -const bool VTK_VISUALIZATION = true; // Set to "true" to enable VTK output. -const int P_INIT = 5; // Uniform polynomial degree of mesh elements. -const int INIT_REF_NUM = 0; // Number of initial uniform mesh refinements. +// Set to "false" to suppress Hermes OpenGL visualization. +const bool HERMES_VISUALIZATION = true; +// Set to "true" to enable VTK output. +const bool VTK_VISUALIZATION = true; +// Uniform polynomial degree of mesh elements. +const int P_INIT = 5; +// Number of initial uniform mesh refinements. +const int INIT_REF_NUM = 0; // Problem parameters. -const double LAMBDA_AL = 236.0; // Thermal cond. of Al for temperatures around 20 deg Celsius. -const double LAMBDA_CU = 386.0; // Thermal cond. of Cu for temperatures around 20 deg Celsius. -const double VOLUME_HEAT_SRC = 0.0; // Volume heat sources generated by electric current. -const double ALPHA = 5.0; // Heat transfer coefficient. -const double T_EXTERIOR = 50.0; // Exterior temperature. +// Thermal cond. of Al for temperatures around 20 deg Celsius. +const double LAMBDA_AL = 236.0; +// Thermal cond. of Cu for temperatures around 20 deg Celsius. +const double LAMBDA_CU = 386.0; +// Volume heat sources generated by electric current. +const double VOLUME_HEAT_SRC = 0.0; +// Heat transfer coefficient. +const double ALPHA = 5.0; +// Exterior temperature. +const double T_EXTERIOR = 50.0; const double BDY_A_PARAM = 0.0; const double BDY_B_PARAM = 0.0; const double BDY_C_PARAM = 20.0; @@ -42,14 +51,13 @@ int main(int argc, char* argv[]) mesh->refine_all_elements(); // Initialize the weak formulation. - CustomWeakFormPoissonNewton wf("Aluminum", new Hermes::Hermes1DFunction(LAMBDA_AL), + WeakFormSharedPtr wf(new CustomWeakFormPoissonNewton("Aluminum", new Hermes::Hermes1DFunction(LAMBDA_AL), "Copper", new Hermes::Hermes1DFunction(LAMBDA_CU), new Hermes::Hermes2DFunction(-VOLUME_HEAT_SRC), - "Outer", ALPHA, T_EXTERIOR); + "Outer", ALPHA, T_EXTERIOR)); // Initialize boundary conditions. - CustomDirichletCondition bc_essential(Hermes::vector("Bottom", "Inner", "Left"), - BDY_A_PARAM, BDY_B_PARAM, BDY_C_PARAM); + CustomDirichletCondition bc_essential({ "Bottom", "Inner", "Left" }, BDY_A_PARAM, BDY_B_PARAM, BDY_C_PARAM); Hermes::Hermes2D::EssentialBCs bcs(&bc_essential); // Create an H1 space with default shapeset. @@ -59,7 +67,7 @@ int main(int argc, char* argv[]) // Initialize the Newton solver. Hermes::Hermes2D::NewtonSolver newton; - newton.set_weak_formulation(&wf); + newton.set_weak_formulation(wf); newton.set_space(space); // Perform Newton's iteration and translate the resulting coefficient vector into a Solution. @@ -70,7 +78,7 @@ int main(int argc, char* argv[]) Hermes::Hermes2D::Solution::vector_to_solution(newton.get_sln_vector(), space, sln); // VTK output. - if(VTK_VISUALIZATION) { + if (VTK_VISUALIZATION) { // Output solution in VTK format. Hermes::Hermes2D::Views::Linearizer lin(FileExport); bool mode_3D = true; @@ -79,15 +87,15 @@ int main(int argc, char* argv[]) // Output mesh and element orders in VTK format. Hermes::Hermes2D::Views::Orderizer ord; ord.save_orders_vtk(space, "ord.vtk"); - } + } // Visualize the solution. - if(HERMES_VISUALIZATION) { + if (HERMES_VISUALIZATION) { Hermes::Hermes2D::Views::ScalarView view("Solution", new Hermes::Hermes2D::Views::WinGeom(0, 0, 440, 350)); - view.get_linearizer()->set_criterion(Views::LinearizerCriterionFixed(2)); + //view.get_linearizer()->set_criterion(Views::LinearizerCriterionFixed(2)); view.show(sln); Hermes::Hermes2D::Views::View::wait(); } return 0; -} +} \ No newline at end of file diff --git a/hermes2d/test_examples/03-navier-stokes/definitions.cpp b/hermes2d/test_examples/03-navier-stokes/definitions.cpp index 758e866e3a..12dffb7dc5 100644 --- a/hermes2d/test_examples/03-navier-stokes/definitions.cpp +++ b/hermes2d/test_examples/03-navier-stokes/definitions.cpp @@ -54,11 +54,11 @@ class WeakFormNSSimpleLinearization : public WeakForm VectorFormVolVel* vector_vel_form_x = new VectorFormVolVel(0, Stokes, time_step); - Hermes::vector *> ext_vel_x; + std::vector *> ext_vel_x; VectorFormVolVel* vector_vel_form_y = new VectorFormVolVel(1, Stokes, time_step); - Hermes::vector *> ext_vel_y; + std::vector *> ext_vel_y; }; class BilinearFormSymVel : public MatrixFormVol @@ -69,14 +69,14 @@ class WeakFormNSSimpleLinearization : public WeakForm sym = HERMES_SYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ double result = int_grad_u_grad_v(n, wt, u, v) / Reynolds; if(!Stokes) result += int_u_v(n, wt, u, v) / time_step; return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const { Ord result = int_grad_u_grad_v(n, wt, u, v) / Reynolds; if(!Stokes) @@ -103,7 +103,7 @@ class WeakFormNSSimpleLinearization : public WeakForm sym = HERMES_NONSYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ double result = 0; if(!Stokes) { Func* xvel_prev_time = ext[2]; @@ -113,7 +113,7 @@ class WeakFormNSSimpleLinearization : public WeakForm return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const { + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const { Ord result = Ord(0); if(!Stokes) { Func* xvel_prev_time = ext[2]; @@ -140,11 +140,11 @@ class WeakFormNSSimpleLinearization : public WeakForm sym = HERMES_ANTISYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ return - int_u_dvdx(n, wt, u, v); } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const { + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const { return - int_u_dvdx(n, wt, u, v); } @@ -162,11 +162,11 @@ class WeakFormNSSimpleLinearization : public WeakForm sym = HERMES_ANTISYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ return - int_u_dvdy(n, wt, u, v); } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ return - int_u_dvdy(n, wt, u, v); } @@ -183,7 +183,7 @@ class WeakFormNSSimpleLinearization : public WeakForm VectorFormVolVel(int i, bool Stokes, double time_step) : VectorFormVol(i), Stokes(Stokes), time_step(time_step) { } - double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const{ double result = 0; if(!Stokes) { Func* vel_prev_time = ext[2]; // this form is used with both velocity components @@ -192,7 +192,7 @@ class WeakFormNSSimpleLinearization : public WeakForm return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const { + Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { Ord result = Ord(0); if(!Stokes) { Func* vel_prev_time = ext[2]; // this form is used with both velocity components @@ -248,7 +248,7 @@ class WeakFormNSNewton : public WeakForm VectorFormNS_0* F_0 = new VectorFormNS_0(0, Stokes, Reynolds, time_step); - //F_0->set_ext(Hermes::vector >(xvel_prev_time, yvel_prev_time)); + //F_0->set_ext(std::vector >(xvel_prev_time, yvel_prev_time)); this->set_ext(xvel_prev_time); add_vector_form(F_0); @@ -266,14 +266,14 @@ class WeakFormNSNewton : public WeakForm sym = HERMES_SYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ double result = int_grad_u_grad_v(n, wt, u, v) / Reynolds; if(!Stokes) result += int_u_v(n, wt, u, v) / time_step; return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const { Ord result = int_grad_u_grad_v(n, wt, u, v) / Reynolds; if(!Stokes) @@ -300,7 +300,7 @@ class WeakFormNSNewton : public WeakForm sym = HERMES_NONSYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ double result = 0; if(!Stokes) { Func* xvel_prev_newton = ext[0]; @@ -312,7 +312,7 @@ class WeakFormNSNewton : public WeakForm return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ Ord result = Ord(0); if(!Stokes) { Func* xvel_prev_newton = ext[0]; @@ -341,7 +341,7 @@ class WeakFormNSNewton : public WeakForm sym = HERMES_NONSYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ double result = 0; if(!Stokes) { Func* xvel_prev_newton = ext[0]; @@ -351,7 +351,7 @@ class WeakFormNSNewton : public WeakForm return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const { + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const { Ord result = Ord(0); if(!Stokes) { Func* xvel_prev_newton = ext[0]; @@ -378,7 +378,7 @@ class WeakFormNSNewton : public WeakForm sym = HERMES_NONSYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ double result = 0; if(!Stokes) { Func* yvel_prev_newton = ext[1]; @@ -388,7 +388,7 @@ class WeakFormNSNewton : public WeakForm return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ Ord result = Ord(0); if(!Stokes) { Func* yvel_prev_newton = ext[1]; @@ -415,7 +415,7 @@ class WeakFormNSNewton : public WeakForm sym = HERMES_NONSYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ double result = 0; if(!Stokes) { Func* xvel_prev_newton = ext[0]; @@ -427,7 +427,7 @@ class WeakFormNSNewton : public WeakForm return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const { + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const { Ord result = Ord(0); if(!Stokes) { Func* xvel_prev_newton = ext[0]; @@ -456,11 +456,11 @@ class WeakFormNSNewton : public WeakForm sym = HERMES_ANTISYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ return - int_u_dvdx(n, wt, u, v); } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const { + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const { return - int_u_dvdx(n, wt, u, v); } @@ -478,11 +478,11 @@ class WeakFormNSNewton : public WeakForm sym = HERMES_ANTISYM; } - double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const{ return - int_u_dvdy(n, wt, u, v); } - Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const { + Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const { return - int_u_dvdy(n, wt, u, v); } @@ -499,7 +499,7 @@ class WeakFormNSNewton : public WeakForm VectorFormNS_0(int i, bool Stokes, double Reynolds, double time_step) : VectorFormVol(i), Stokes(Stokes), Reynolds(Reynolds), time_step(time_step) { } - double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const{ double result = 0; Func* p_prev_newton = u_ext[2]; Func* xvel_prev_time = ext[2]; @@ -515,7 +515,7 @@ class WeakFormNSNewton : public WeakForm return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const { + Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { Ord result = Ord(0); Func* p_prev_newton = u_ext[2]; Func* xvel_prev_time = ext[2]; @@ -548,7 +548,7 @@ class WeakFormNSNewton : public WeakForm VectorFormNS_1(int i, bool Stokes, double Reynolds, double time_step) : VectorFormVol(i), Stokes(Stokes), Reynolds(Reynolds), time_step(time_step) { } - double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const{ double result = 0; Func* p_prev_newton = u_ext[2]; Func* xvel_prev_time = ext[2]; @@ -564,7 +564,7 @@ class WeakFormNSNewton : public WeakForm return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const{ + Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const{ Ord result = Ord(0); Func* p_prev_newton = u_ext[2]; Func* xvel_prev_time = ext[2]; @@ -597,7 +597,7 @@ class WeakFormNSNewton : public WeakForm VectorFormNS_2(int i) : VectorFormVol(i) { } - double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const{ + double value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const{ double result = 0; Func* xvel_prev_newton = ext[0]; Func* yvel_prev_newton = ext[1]; @@ -607,7 +607,7 @@ class WeakFormNSNewton : public WeakForm return result; } - Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const { + Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { Ord result = Ord(0); Func* xvel_prev_newton = ext[0]; Func* yvel_prev_newton = ext[1]; @@ -634,10 +634,10 @@ class WeakFormNSNewton : public WeakForm class EssentialBCNonConst : public EssentialBoundaryCondition { public: - EssentialBCNonConst(Hermes::vector markers, double vel_inlet, double H, double startup_time) : + EssentialBCNonConst(std::vector markers, double vel_inlet, double H, double startup_time) : EssentialBoundaryCondition(markers), vel_inlet(vel_inlet), H(H), startup_time(startup_time) {}; EssentialBCNonConst(std::string marker, double vel_inlet, double H, double startup_time) : - EssentialBoundaryCondition(Hermes::vector()), vel_inlet(vel_inlet), H(H), startup_time(startup_time) { + EssentialBoundaryCondition(std::vector()), vel_inlet(vel_inlet), H(H), startup_time(startup_time) { markers.push_back(marker); }; @@ -647,7 +647,7 @@ class EssentialBCNonConst : public EssentialBoundaryCondition return BC_FUNCTION; }; - virtual double value(double x, double y, double n_x, double n_y, double t_x, double t_y) const { + virtual double value(double x, double y) const { double val_y = vel_inlet * y*(H-y) / (H/2.)/(H/2.); if (current_time <= startup_time) return val_y * current_time/startup_time; diff --git a/hermes2d/test_examples/03-navier-stokes/domain.xml b/hermes2d/test_examples/03-navier-stokes/domain.xml new file mode 100644 index 0000000000..16cb0672ff --- /dev/null +++ b/hermes2d/test_examples/03-navier-stokes/domain.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hermes2d/test_examples/03-navier-stokes/main.cpp b/hermes2d/test_examples/03-navier-stokes/main.cpp index 0f9702f0ed..c14c19aa3c 100644 --- a/hermes2d/test_examples/03-navier-stokes/main.cpp +++ b/hermes2d/test_examples/03-navier-stokes/main.cpp @@ -1,7 +1,5 @@ #include "hermes2d.h" -//#define USE_PARALUTION - using namespace Hermes; using namespace Hermes::Hermes2D; @@ -67,10 +65,14 @@ double current_time = 0; // from 0 to VEL_INLET, then it stays constant. const double STARTUP_TIME = 1.0; -const double TAU = 0.1; // Time step. -const double T_FINAL = 0.8; // Time interval length. -const double NEWTON_TOL = 1e-3; // Stopping criterion for the Newton's method. -const double H = 5; // Domain height (necessary to define the parabolic velocity profile at inlet). +// Time step. +const double TAU = 0.1; +// Time interval length. +const double T_FINAL = 1000.0; +// Stopping criterion for the Newton's method. +const double NEWTON_TOL = 1e-3; +// Domain height (necessary to define the parabolic velocity profile at inlet). +const double H = 5; // Boundary markers. const std::string BDY_BOTTOM = "1"; @@ -84,33 +86,83 @@ const std::string BDY_OBSTACLE = "5"; int main(int argc, char* argv[]) { - // This either enables PARALUTION or leaves the default UMFPACK. -#ifdef USE_PARALUTION - HermesCommonApi.set_integral_param_value(matrixSolverType, SOLVER_PARALUTION_ITERATIVE); + // Load the mesh. + MeshSharedPtr mesh(new Mesh); + MeshReaderH2D mloader; + mloader.load("domain.mesh", mesh); + + // Initial mesh refinements. + mesh->refine_towards_boundary(BDY_OBSTACLE, 2, false); + mesh->refine_towards_boundary(BDY_TOP, 2, true); // '4' is the number of levels, + mesh->refine_towards_boundary(BDY_BOTTOM, 2, true); // 'true' stands for anisotropic refinements. + mesh->refine_all_elements(); + mesh->refine_all_elements(); + + // Initialize boundary conditions. + EssentialBCNonConst bc_left_vel_x(BDY_LEFT, VEL_INLET, H, STARTUP_TIME); + Hermes::Hermes2D::DefaultEssentialBCConst bc_other_vel_x({ BDY_BOTTOM, BDY_TOP, BDY_OBSTACLE }, 0.0); + Hermes::Hermes2D::EssentialBCs bcs_vel_x({ &bc_left_vel_x, &bc_other_vel_x }); + Hermes::Hermes2D::DefaultEssentialBCConst bc_vel_y({ BDY_LEFT, BDY_BOTTOM, BDY_TOP, BDY_OBSTACLE }, 0.0); + Hermes::Hermes2D::EssentialBCs bcs_vel_y(&bc_vel_y); + Hermes::Hermes2D::EssentialBCs bcs_pressure; + + // Spaces for velocity components and pressure. + SpaceSharedPtr xvel_space(new H1Space(mesh, &bcs_vel_x, P_INIT_VEL)); + SpaceSharedPtr yvel_space(new H1Space(mesh, &bcs_vel_y, P_INIT_VEL)); +#ifdef PRESSURE_IN_L2 + SpaceSharedPtr p_space(new L2Space(mesh, P_INIT_PRESSURE)); +#else + SpaceSharedPtr p_space(new H1Space(mesh, &bcs_pressure, P_INIT_PRESSURE)); #endif + std::vector > spaces({ xvel_space, yvel_space, p_space }); + + // Calculate and report the number of degrees of freedom. + int ndof = Space::get_num_dofs(spaces); -#include "setup.cpp" + // Define projection norms. + NormType vel_proj_norm = HERMES_H1_NORM; +#ifdef PRESSURE_IN_L2 + NormType p_proj_norm = HERMES_L2_NORM; +#else + NormType p_proj_norm = HERMES_H1_NORM; +#endif + std::vector proj_norms({ vel_proj_norm, vel_proj_norm, p_proj_norm }); + + // Solutions for the Newton's iteration and time stepping. + MeshFunctionSharedPtr xvel_prev_time(new ConstantSolution(mesh, 0.0)); + MeshFunctionSharedPtr yvel_prev_time(new ConstantSolution(mesh, 0.0)); + MeshFunctionSharedPtr p_prev_time(new ConstantSolution(mesh, 0.0)); + std::vector > sln_prev_time = { xvel_prev_time, yvel_prev_time, p_prev_time }; + double* coeff_vec = new double[Space::get_num_dofs(spaces)]; + + // Project the initial condition on the FE space to obtain initial coefficient vector for the Newton's method. + OGProjection::project_global(spaces, sln_prev_time, coeff_vec, proj_norms); + + // Initialize weak formulation. + WeakFormSharedPtr wf(new WeakFormNSNewton(STOKES, RE, TAU, xvel_prev_time, yvel_prev_time)); + UExtFunctionSharedPtr fn_0(new CustomUExtFunction(0)); + UExtFunctionSharedPtr fn_1(new CustomUExtFunction(1)); + wf->set_ext({ xvel_prev_time, yvel_prev_time }); + wf->set_u_ext_fn({ fn_0, fn_1 }); + + // Initialize views. + Views::VectorView vview("velocity[m/s]", new Views::WinGeom(0, 0, 750, 240)); + Views::ScalarView pview("pressure[Pa]", new Views::WinGeom(0, 290, 750, 240)); + vview.set_min_max_range(0, 1.6); + vview.fix_scale_width(80); + //pview.set_min_max_range(-0.9, 1.0); + pview.fix_scale_width(80); + pview.show_mesh(true); // Initialize the Newton solver. - Hermes::Hermes2D::NewtonSolver newton(&wf, spaces); + Hermes::Hermes2D::NewtonSolver newton(wf, spaces); + newton.get_linear_matrix_solver()->set_verbose_output(true); //newton.output_matrix(); newton.set_matrix_export_format(Hermes::Algebra::MatrixExportFormat::EXPORT_FORMAT_MATRIX_MARKET); - newton.set_rhs_export_format(Hermes::Algebra::MatrixExportFormat::EXPORT_FORMAT_MATRIX_MARKET); //newton.output_rhs(); - // Verbose. - newton.get_linear_matrix_solver()->set_verbose_output(true); + newton.set_rhs_export_format(Hermes::Algebra::MatrixExportFormat::EXPORT_FORMAT_MATRIX_MARKET); + newton.set_sufficient_improvement_factor_jacobian(2.); -#ifdef USE_PARALUTION - // Relative tolerance of PARALUTION. - newton.get_linear_matrix_solver()->as_IterSolver()->set_tolerance(1e-8, Solvers::LoopSolverToleranceType::RelativeTolerance); - // Use GMRES. - newton.get_linear_matrix_solver()->as_IterSolver()->set_solver_type(Solvers::IterSolverType::BiCGStab); - // Max iterations -> 10000 - newton.get_linear_matrix_solver()->as_IterSolver()->set_max_iters(10000); - // Use Saddle-point preconditioner. - newton.get_linear_matrix_solver()->as_IterSolver()->set_precond(new Preconditioners::ParalutionPrecond(Preconditioners::PreconditionerType::SaddlePoint)); -#endif - // Newton method setup: // - max allowed iterations newton.set_max_allowed_iterations(10); @@ -120,11 +172,8 @@ int main(int argc, char* argv[]) newton.set_tolerance(1e-3, Hermes::Solvers::ResidualNormAbsolute); // Time-stepping loop: - for (int ts = 1; ts <= T_FINAL / TAU; ts++) + for (int time_step = 1; time_step <= T_FINAL / TAU; time_step++, current_time += TAU) { - current_time += TAU; - Hermes::Mixins::Loggable::Static::info("Time step %i, time %f.", ts, current_time); - // Update time-dependent essential BCs. newton.set_time(current_time); @@ -136,15 +185,15 @@ int main(int argc, char* argv[]) // Visualization. vview.set_title("Velocity, time %g", current_time); - //vview.get_vectorizer()->set_criterion(Views::LinearizerCriterionFixed(2)); vview.show(xvel_prev_time, yvel_prev_time); - std::cout << "Vectorizer done." << std::endl; - + if(!(time_step % 100)) + vview.save_numbered_screenshot("Velocity", (time_step / 100), true); + pview.set_title("Pressure, time %g", current_time); - //pview.get_linearizer()->set_criterion(Views::LinearizerCriterionFixed(2)); pview.show(p_prev_time); - std::cout << "Linearizer done." << std::endl; + if (!(time_step % 100)) + pview.save_numbered_screenshot("Pressure", (time_step / 100), true); } return 0; -} +} \ No newline at end of file diff --git a/hermes2d/test_examples/03-navier-stokes/setup.cpp b/hermes2d/test_examples/03-navier-stokes/setup.cpp deleted file mode 100644 index e531de50c4..0000000000 --- a/hermes2d/test_examples/03-navier-stokes/setup.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -// Load the mesh. -MeshSharedPtr mesh(new Mesh); -MeshReaderH2D mloader; -mloader.load("domain.mesh", mesh); - -// Initial mesh refinements. -mesh->refine_towards_boundary(BDY_OBSTACLE, 2, false); -mesh->refine_towards_boundary(BDY_TOP, 2, true); // '4' is the number of levels, -mesh->refine_towards_boundary(BDY_BOTTOM, 2, true); // 'true' stands for anisotropic refinements. -mesh->refine_all_elements(); -mesh->refine_all_elements(); - -// Initialize boundary conditions. -EssentialBCNonConst bc_left_vel_x(BDY_LEFT, VEL_INLET, H, STARTUP_TIME); -Hermes::Hermes2D::DefaultEssentialBCConst bc_other_vel_x(Hermes::vector(BDY_BOTTOM, BDY_TOP, BDY_OBSTACLE), 0.0); -Hermes::Hermes2D::EssentialBCs bcs_vel_x(Hermes::vector *>(&bc_left_vel_x, &bc_other_vel_x)); -Hermes::Hermes2D::DefaultEssentialBCConst bc_vel_y(Hermes::vector(BDY_LEFT, BDY_BOTTOM, BDY_TOP, BDY_OBSTACLE), 0.0); -Hermes::Hermes2D::EssentialBCs bcs_vel_y(&bc_vel_y); -Hermes::Hermes2D::EssentialBCs bcs_pressure; - -// Spaces for velocity components and pressure. -SpaceSharedPtr xvel_space(new H1Space(mesh, &bcs_vel_x, P_INIT_VEL)); -SpaceSharedPtr yvel_space(new H1Space(mesh, &bcs_vel_y, P_INIT_VEL)); -#ifdef PRESSURE_IN_L2 -SpaceSharedPtr p_space(new L2Space(mesh, P_INIT_PRESSURE)); -#else -SpaceSharedPtr p_space(new H1Space(mesh, &bcs_pressure, P_INIT_PRESSURE)); -#endif -Hermes::vector > spaces(xvel_space, yvel_space, p_space); - -// Calculate and report the number of degrees of freedom. -int ndof = Space::get_num_dofs(Hermes::vector >(xvel_space, yvel_space, p_space)); - -// Define projection norms. -NormType vel_proj_norm = HERMES_H1_NORM; -#ifdef PRESSURE_IN_L2 -NormType p_proj_norm = HERMES_L2_NORM; -#else -NormType p_proj_norm = HERMES_H1_NORM; -#endif -Hermes::vector proj_norms(vel_proj_norm, vel_proj_norm, p_proj_norm); - -// Solutions for the Newton's iteration and time stepping. -MeshFunctionSharedPtr xvel_prev_time(new ConstantSolution(mesh, 0.0)); -MeshFunctionSharedPtr yvel_prev_time(new ConstantSolution(mesh, 0.0)); -MeshFunctionSharedPtr p_prev_time(new ConstantSolution(mesh, 0.0)); -Hermes::vector > sln_prev_time(xvel_prev_time, yvel_prev_time, p_prev_time); -double* coeff_vec = new double[Space::get_num_dofs(Hermes::vector >(xvel_space, yvel_space, p_space))]; - -// Project the initial condition on the FE space to obtain initial coefficient vector for the Newton's method. -OGProjection::project_global(spaces, sln_prev_time, coeff_vec, proj_norms); - -// Initialize weak formulation. -WeakFormNSNewton wf(STOKES, RE, TAU, xvel_prev_time, yvel_prev_time); -UExtFunctionSharedPtr fn_0(new CustomUExtFunction(0)); -UExtFunctionSharedPtr fn_1(new CustomUExtFunction(1)); -wf.set_ext(Hermes::vector >(xvel_prev_time, yvel_prev_time)); -wf.set_u_ext_fn(Hermes::vector >(fn_0, fn_1)); - -// Initialize views. -Views::VectorView vview("velocity[m/s]", new Views::WinGeom(0, 0, 750, 240)); -Views::ScalarView pview("pressure[Pa]", new Views::WinGeom(0, 290, 750, 240)); -vview.set_min_max_range(0, 1.6); -vview.fix_scale_width(80); -//pview.set_min_max_range(-0.9, 1.0); -pview.fix_scale_width(80); -pview.show_mesh(true); diff --git a/hermes2d/test_examples/04-complex-adapt/definitions.cpp b/hermes2d/test_examples/04-complex-adapt/definitions.cpp index 565ba4cbf3..449be4c74b 100644 --- a/hermes2d/test_examples/04-complex-adapt/definitions.cpp +++ b/hermes2d/test_examples/04-complex-adapt/definitions.cpp @@ -1,21 +1,21 @@ #include "definitions.h" -CustomWeakForm::CustomWeakForm(std::string mat_air, double mu_air, - std::string mat_iron, double mu_iron, double gamma_iron, - std::string mat_wire, double mu_wire, std::complex j_ext, double omega) : Hermes::Hermes2D::WeakForm >(1) +CustomWeakForm::CustomWeakForm(std::string mat_air, double mu_air, + std::string mat_iron, double mu_iron, double gamma_iron, + std::string mat_wire, double mu_wire, std::complex j_ext, double omega) : Hermes::Hermes2D::WeakForm >(1) { - std::complex ii = std::complex(0.0, 1.0); + std::complex ii = std::complex(0.0, 1.0); // Jacobian. - add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion >(0, 0, mat_air, new Hermes1DFunction >(1.0/mu_air))); - add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion >(0, 0, mat_iron, new Hermes1DFunction >(1.0/mu_iron))); - add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion >(0, 0, mat_wire, new Hermes1DFunction >(1.0/mu_wire))); + add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion >(0, 0, mat_air, new Hermes1DFunction >(1.0 / mu_air))); + add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion >(0, 0, mat_iron, new Hermes1DFunction >(1.0 / mu_iron))); + add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion >(0, 0, mat_wire, new Hermes1DFunction >(1.0 / mu_wire))); add_matrix_form(new WeakFormsH1::DefaultMatrixFormVol >(0, 0, mat_iron, new Hermes2DFunction >(ii * omega * gamma_iron))); // Residual. - add_vector_form(new WeakFormsH1::DefaultResidualDiffusion >(0, mat_air, new Hermes1DFunction >(1.0/mu_air))); - add_vector_form(new WeakFormsH1::DefaultResidualDiffusion >(0, mat_iron, new Hermes1DFunction >(1.0/mu_iron))); - add_vector_form(new WeakFormsH1::DefaultResidualDiffusion >(0, mat_wire, new Hermes1DFunction >(1.0/mu_wire))); + add_vector_form(new WeakFormsH1::DefaultResidualDiffusion >(0, mat_air, new Hermes1DFunction >(1.0 / mu_air))); + add_vector_form(new WeakFormsH1::DefaultResidualDiffusion >(0, mat_iron, new Hermes1DFunction >(1.0 / mu_iron))); + add_vector_form(new WeakFormsH1::DefaultResidualDiffusion >(0, mat_wire, new Hermes1DFunction >(1.0 / mu_wire))); add_vector_form(new WeakFormsH1::DefaultVectorFormVol >(0, mat_wire, new Hermes2DFunction >(-j_ext))); add_vector_form(new WeakFormsH1::DefaultResidualVol >(0, mat_iron, new Hermes2DFunction >(ii * omega * gamma_iron))); } \ No newline at end of file diff --git a/hermes2d/test_examples/04-complex-adapt/main.cpp b/hermes2d/test_examples/04-complex-adapt/main.cpp index d77df4a14a..cfd7e669e2 100644 --- a/hermes2d/test_examples/04-complex-adapt/main.cpp +++ b/hermes2d/test_examples/04-complex-adapt/main.cpp @@ -11,24 +11,27 @@ typedef std::complex complex; // Domain: Rectangle of height 0.003 and width 0.004. Different // materials for the wire, air, and iron (see mesh file domain2.mesh). // -// BC: Zero Dirichlet on the top and right edges, zero Neumann -// elsewhere. +// BC: Zero Dirichlet on the top and left and right edges, zero Neumann +// on the bottom. // // The following parameters can be changed: -const int INIT_REF_NUM = 0; // Number of initial uniform mesh refinements. -const int P_INIT = 1; // Initial polynomial degree of all mesh elements. -const double THRESHOLD = 0.95; // This is a quantitative parameter of Adaptivity. +// Number of initial uniform mesh refinements. +const int INIT_REF_NUM = 0; +// Initial polynomial degree of all mesh elements. +const int P_INIT = 1; +// This is a quantitative parameter of Adaptivity. +const double THRESHOLD = 0.9; // Error calculation & adaptivity. -DefaultErrorCalculator< ::complex, HERMES_H1_NORM> errorCalculator(RelativeErrorToGlobalNorm, 1); +DefaultErrorCalculator<::complex, HERMES_H1_NORM> errorCalculator(RelativeErrorToGlobalNorm, 1); // Stopping criterion for an adaptivity step. -AdaptStoppingCriterionSingleElement< ::complex> stoppingCriterion(0.9); +AdaptStoppingCriterionSingleElement<::complex> stoppingCriterion(THRESHOLD); // Adaptivity processor class. -Adapt< ::complex> adaptivity(&errorCalculator, &stoppingCriterion); +Adapt<::complex> adaptivity(&errorCalculator, &stoppingCriterion); // Predefined list of element refinement candidates. const CandList CAND_LIST = H2D_HP_ANISO; // Stopping criterion for adaptivity. -const double ERR_STOP = 1e-3; +const double TOTAL_ERROR_ESTIMATE_STOP = 1e-3; // Problem parameters. const double MU_0 = 4.0*M_PI*1e-7; @@ -38,7 +41,6 @@ const double J_EXT = 1e6; const double FREQ = 5e3; const double OMEGA = 2 * M_PI * FREQ; - int main(int argc, char* argv[]) { Hermes::Mixins::TimeMeasurable m; @@ -53,49 +55,49 @@ int main(int argc, char* argv[]) for (int i = 0; i < INIT_REF_NUM; i++) mesh->refine_all_elements(); // Initialize boundary conditions. - Hermes::Hermes2D::DefaultEssentialBCConst< ::complex> bc_essential("Dirichlet", ::complex(0.0, 0.0)); - EssentialBCs< ::complex> bcs(&bc_essential); + Hermes::Hermes2D::DefaultEssentialBCConst<::complex> bc_essential("Dirichlet",::complex(0.0, 0.0)); + EssentialBCs<::complex> bcs(&bc_essential); // Create an H1 space with default shapeset. - SpaceSharedPtr< ::complex> space(new H1Space< ::complex>(mesh, &bcs, P_INIT)); + SpaceSharedPtr<::complex> space(new H1Space<::complex>(mesh, &bcs, P_INIT)); int ndof = space->get_num_dofs(); // Initialize the weak formulation. - CustomWeakForm wf("Air", MU_0, "Iron", MU_IRON, GAMMA_IRON, - "Wire", MU_0, ::complex(J_EXT, 0.0), OMEGA); + WeakFormSharedPtr<::complex> wf(new CustomWeakForm("Air", MU_0, "Iron", MU_IRON, GAMMA_IRON, + "Wire", MU_0,::complex(J_EXT, 0.0), OMEGA)); // Initialize coarse and reference mesh solution. - MeshFunctionSharedPtr< ::complex> sln(new Hermes::Hermes2D::Solution< ::complex>()); - MeshFunctionSharedPtr< ::complex> ref_sln(new Hermes::Hermes2D::Solution< ::complex>()); + MeshFunctionSharedPtr<::complex> sln(new Hermes::Hermes2D::Solution<::complex>()); + MeshFunctionSharedPtr<::complex> ref_sln(new Hermes::Hermes2D::Solution<::complex>()); // Initialize refinement selector. - H1ProjBasedSelector< ::complex> selector(CAND_LIST); + H1ProjBasedSelector<::complex> selector(CAND_LIST); // Initialize views. - Views::ScalarView sview("Solution", new Views::WinGeom(0, 0, 600, 350)); - Views::ScalarView sview2("Ref. Solution", new Views::WinGeom(0, 0, 600, 350)); + Views::ScalarView sview("Solution (real part)", new Views::WinGeom(0, 0, 600, 350)); + Views::ScalarView sview_error("Error function", new Views::WinGeom(0, 360, 600, 350)); Views::OrderView oview("Polynomial orders", new Views::WinGeom(610, 0, 520, 350)); // DOF and CPU convergence graphs initialization. SimpleGraph graph_dof, graph_cpu; - DiscreteProblem< ::complex> dp(&wf, space); + DiscreteProblem<::complex> dp(wf, space); // Perform Newton's iteration and translate the resulting coefficient vector into a Solution. - Hermes::Hermes2D::NewtonSolver< ::complex> newton(&dp); + Hermes::Hermes2D::NewtonSolver<::complex> newton(&dp); SimpleGraph graph_dof_est; - + // Adaptivity loop: int as = 1; bool done = false; adaptivity.set_space(space); do { - // Construct globally refined reference mesh and setup reference space-> + // Construct globally refined reference mesh and setup reference space. Mesh::ReferenceMeshCreator ref_mesh_creator(mesh); MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh(); - Space< ::complex>::ReferenceSpaceCreator ref_space_creator(space, ref_mesh); - SpaceSharedPtr< ::complex> ref_space = ref_space_creator.create_ref_space(); - + Space<::complex>::ReferenceSpaceCreator ref_space_creator(space, ref_mesh); + SpaceSharedPtr<::complex> ref_space = ref_space_creator.create_ref_space(); + newton.set_space(ref_space); int ndof_ref = ref_space->get_num_dofs(); @@ -103,31 +105,25 @@ int main(int argc, char* argv[]) // Initialize reference problem. // Initial coefficient vector for the Newton's method. - ::complex* coeff_vec = new ::complex[ndof_ref]; + ::complex* coeff_vec = new::complex[ndof_ref]; memset(coeff_vec, 0, ndof_ref * sizeof(::complex)); // Perform Newton's iteration and translate the resulting coefficient vector into a Solution. - try - { - newton.solve(coeff_vec); - } - catch(Hermes::Exceptions::Exception& e) - { - e.print_msg(); - } - - Hermes::Hermes2D::Solution< ::complex>::vector_to_solution(newton.get_sln_vector(), ref_space, ref_sln); + newton.solve(coeff_vec); + Hermes::Hermes2D::Solution<::complex>::vector_to_solution(newton.get_sln_vector(), ref_space, ref_sln); // Project the fine mesh solution onto the coarse mesh. - OGProjection< ::complex> ogProjection; + OGProjection<::complex> ogProjection; ogProjection.project_global(space, ref_sln, sln); // View the coarse mesh solution and polynomial orders. MeshFunctionSharedPtr real_filter(new RealFilter(sln)); MeshFunctionSharedPtr rreal_filter(new RealFilter(ref_sln)); - sview2.show(rreal_filter); + sview.show(rreal_filter); + sview.save_numbered_screenshot("sln%02d.bmp", as, true); - oview.show(space); + oview.show(ref_space); + oview.save_numbered_screenshot("refSpace%02d.bmp", as, true); // Calculate element errors and total error estimate. errorCalculator.calculate_errors(sln, ref_sln); @@ -135,10 +131,11 @@ int main(int argc, char* argv[]) // Add entry to DOF and CPU convergence graphs. graph_dof_est.add_values(space->get_num_dofs(), errorCalculator.get_total_error_squared() * 100.); - sview.show(errorCalculator.get_errorMeshFunction()); + sview_error.show(errorCalculator.get_errorMeshFunction()); + sview_error.save_numbered_screenshot("errorView%02d.bmp", as, true); - // If err_est too large, adapt the mesh-> - if(errorCalculator.get_total_error_squared() * 100. < ERR_STOP) + // If err_est too large, adapt the mesh. + if (errorCalculator.get_total_error_squared() * 100. < TOTAL_ERROR_ESTIMATE_STOP) done = true; else { @@ -147,14 +144,13 @@ int main(int argc, char* argv[]) } // Clean up. - delete [] coeff_vec; + delete[] coeff_vec; // Increase counter. as++; - } - while (done == false); + } while (done == false); - graph_dof_est.save("conv_dof_est.dat"); + graph_dof_est.save("conv_dof_est.dat"); // Show the reference solution - the final result. sview.set_title("Fine mesh solution"); diff --git a/hermes2d/test_examples/05-hcurl-adapt/bessel.cpp b/hermes2d/test_examples/05-hcurl-adapt/bessel.cpp index d6dca2b28f..965f1ac89b 100644 --- a/hermes2d/test_examples/05-hcurl-adapt/bessel.cpp +++ b/hermes2d/test_examples/05-hcurl-adapt/bessel.cpp @@ -1875,7 +1875,6 @@ extern double sin ( double ); // extern double p1evl ( double, void *, int ); // extern double floor ( double ); extern double fabs ( double ); -extern int isnan ( double ); // extern int isfinite ( double ); static double stirf ( double ); double lgam ( double ); diff --git a/hermes2d/test_examples/05-hcurl-adapt/definitions.cpp b/hermes2d/test_examples/05-hcurl-adapt/definitions.cpp index a5c9a58f49..5e21a84289 100644 --- a/hermes2d/test_examples/05-hcurl-adapt/definitions.cpp +++ b/hermes2d/test_examples/05-hcurl-adapt/definitions.cpp @@ -133,7 +133,7 @@ class CustomWeakForm : public Hermes::Hermes2D::WeakForm > } virtual std::complex value(int n, double *wt, Func > *u_ext[], - Func *v, Geom *e, Func > **ext) const + Func *v, GeomSurf *e, Func > **ext) const { std::complex result = 0; #pragma omp critical (jv) @@ -155,8 +155,7 @@ class CustomWeakForm : public Hermes::Hermes2D::WeakForm > return -result; } - virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + virtual Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, Func **ext) const { return Hermes::Ord(10); } diff --git a/hermes2d/test_examples/05-hcurl-adapt/main.cpp b/hermes2d/test_examples/05-hcurl-adapt/main.cpp index 3729fc8f0b..33edeac73c 100644 --- a/hermes2d/test_examples/05-hcurl-adapt/main.cpp +++ b/hermes2d/test_examples/05-hcurl-adapt/main.cpp @@ -17,7 +17,7 @@ typedef std::complex complex; // Domain: L-shape domain // // Meshes: you can use either "lshape3q.mesh" (quadrilateral mesh) or -// "lshape3t.mesh" (triangular mesh). See the mesh->load(...) command below. +// "lshape3t.mesh" (triangular mesh). See the mesh.load(...) command below. // // BC: perfect conductor on boundary markers 1 and 6 (essential BC) // impedance boundary condition on rest of boundary (natural BC) @@ -36,19 +36,19 @@ const int P_INIT = 2; const int INIT_REF_NUM = 1; // Error calculation & adaptivity. -DefaultErrorCalculator< ::complex, HERMES_HCURL_NORM> errorCalculator(RelativeErrorToGlobalNorm, 1); +DefaultErrorCalculator<::complex, HERMES_HCURL_NORM> errorCalculator(RelativeErrorToGlobalNorm, 1); // Stopping criterion for an adaptivity step. -AdaptStoppingCriterionSingleElement< ::complex> stoppingCriterion(0.75); +AdaptStoppingCriterionSingleElement<::complex> stoppingCriterion(0.75); // Adaptivity processor class. -Adapt< ::complex> adaptivity(&errorCalculator, &stoppingCriterion); +Adapt<::complex> adaptivity(&errorCalculator, &stoppingCriterion); // Predefined list of element refinement candidates. const CandList CAND_LIST = H2D_HP_ANISO; // Stopping criterion for adaptivity. const double ERR_STOP = 1e-3; // Problem parameters. -const double MU_R = 1.0; -const double KAPPA = 1.0; +const double MU_R = 1.0; +const double KAPPA = 1.0; const double LAMBDA = 1.0; // Bessel functions, exact solution, and weak forms. @@ -59,33 +59,34 @@ int main(int argc, char* argv[]) // Load the mesh. MeshSharedPtr mesh(new Mesh); MeshReaderH2D mloader; - mloader.load("lshape3q.mesh", mesh); // quadrilaterals - //mloader.load("lshape3t.mesh", mesh); // triangles + // quadrilaterals + mloader.load("lshape3q.mesh", mesh); + // triangles + //mloader.load("lshape3t.mesh", mesh); // Perform initial mesh refinemets. for (int i = 0; i < INIT_REF_NUM; i++) mesh->refine_all_elements(); // Initialize boundary conditions. - Hermes::Hermes2D::DefaultEssentialBCConst< ::complex > bc_essential(Hermes::vector("Corner_horizontal", - "Corner_vertical"), 0); - EssentialBCs< ::complex > bcs(&bc_essential); + Hermes::Hermes2D::DefaultEssentialBCConst<::complex > bc_essential(std::vector({ "Corner_horizontal", "Corner_vertical" }), 0); + EssentialBCs<::complex > bcs(&bc_essential); // Create an Hcurl space with default shapeset. - SpaceSharedPtr< ::complex > space(new HcurlSpace< ::complex >(mesh, &bcs, P_INIT)); + SpaceSharedPtr<::complex > space(new HcurlSpace<::complex >(mesh, &bcs, P_INIT)); int ndof = space->get_num_dofs(); // Initialize the weak formulation. - CustomWeakForm wf(MU_R, KAPPA); + WeakFormSharedPtr<::complex> wf(new CustomWeakForm(MU_R, KAPPA)); // Initialize coarse and reference mesh solutions. - MeshFunctionSharedPtr< ::complex > sln(new Hermes::Hermes2D::Solution< ::complex >()); - MeshFunctionSharedPtr< ::complex > ref_sln(new Hermes::Hermes2D::Solution< ::complex >()); + MeshFunctionSharedPtr<::complex > sln(new Hermes::Hermes2D::Solution<::complex >()); + MeshFunctionSharedPtr<::complex > ref_sln(new Hermes::Hermes2D::Solution<::complex >()); // Initialize exact solution. - MeshFunctionSharedPtr< ::complex > sln_exact(new CustomExactSolution(mesh)); + MeshFunctionSharedPtr<::complex > sln_exact(new CustomExactSolution(mesh)); // Initialize refinement selector. - HcurlProjBasedSelector< ::complex > selector(CAND_LIST); + HcurlProjBasedSelector<::complex > selector(CAND_LIST); // Initialize views. Views::VectorView v_view("Solution (magnitude)", new Views::WinGeom(0, 0, 460, 350)); @@ -96,10 +97,10 @@ int main(int argc, char* argv[]) SimpleGraph graph_dof_est, graph_cpu_est, graph_dof_exact, graph_cpu_exact; - DiscreteProblem< ::complex > dp(&wf, space); + DiscreteProblem<::complex > dp(wf, space); // Perform Newton's iteration and translate the resulting coefficient vector into a Solution. - Hermes::Hermes2D::NewtonSolver< ::complex > newton(&dp); + Hermes::Hermes2D::NewtonSolver<::complex > newton(&dp); Views::Linearizer lin(FileExport); Views::Orderizer ord; @@ -109,35 +110,35 @@ int main(int argc, char* argv[]) adaptivity.set_space(space); do { - // Construct globally refined reference mesh and setup reference space-> + // Construct globally refined reference mesh and setup reference space. Mesh::ReferenceMeshCreator ref_mesh_creator(mesh); MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh(); - Space< ::complex >::ReferenceSpaceCreator ref_space_creator(space, ref_mesh); - SpaceSharedPtr< ::complex > ref_space = ref_space_creator.create_ref_space(); + Space<::complex >::ReferenceSpaceCreator ref_space_creator(space, ref_mesh); + SpaceSharedPtr<::complex > ref_space = ref_space_creator.create_ref_space(); newton.set_space(ref_space); int ndof_ref = ref_space->get_num_dofs(); // Initial coefficient vector for the Newton's method. - ::complex* coeff_vec = new ::complex[ndof_ref]; + ::complex* coeff_vec = new::complex[ndof_ref]; memset(coeff_vec, 0, ndof_ref * sizeof(::complex)); - + try { newton.solve(coeff_vec); } - catch(Hermes::Exceptions::Exception& e) + catch (Hermes::Exceptions::Exception& e) { e.print_msg(); } - Hermes::Hermes2D::Solution< ::complex >::vector_to_solution(newton.get_sln_vector(), ref_space, ref_sln); + Hermes::Hermes2D::Solution<::complex >::vector_to_solution(newton.get_sln_vector(), ref_space, ref_sln); // Project the fine mesh solution onto the coarse mesh. - OGProjection< ::complex > ogProjection; + OGProjection<::complex > ogProjection; ogProjection.project_global(space, ref_sln, sln); // View the coarse mesh solution and polynomial orders. - if(HERMES_VISUALIZATION) + if (HERMES_VISUALIZATION) { MeshFunctionSharedPtr real_filter(new RealFilter(sln)); v_view.show(real_filter); @@ -163,23 +164,22 @@ int main(int argc, char* argv[]) graph_dof_exact.add_values(space->get_num_dofs(), err_exact_rel); graph_dof_exact.save("conv_dof_exact.dat"); - // If err_est_rel too large, adapt the mesh-> - if(err_est_rel < ERR_STOP) + // If err_est_rel too large, adapt the mesh. + if (err_est_rel < ERR_STOP) done = true; else { done = adaptivity.adapt(&selector); // Increase the counter of performed adaptivity steps. - if(done == false) as++; + if (done == false) as++; } // Clean up. - delete [] coeff_vec; - } - while (done == false); + delete[] coeff_vec; + } while (done == false); // Show the reference solution - the final result. - if(HERMES_VISUALIZATION) + if (HERMES_VISUALIZATION) { v_view.set_title("Fine mesh solution (magnitude)"); MeshFunctionSharedPtr real_filter(new RealFilter(ref_sln)); diff --git a/hermes2d/test_examples/06-system-adapt/definitions.cpp b/hermes2d/test_examples/06-system-adapt/definitions.cpp index 4df9f3aa5e..021b755aa8 100644 --- a/hermes2d/test_examples/06-system-adapt/definitions.cpp +++ b/hermes2d/test_examples/06-system-adapt/definitions.cpp @@ -1,212 +1,208 @@ #include "definitions.h" -double CustomExactFunction1::val(double x) +double CustomExactFunction1::val(double x) { - return Hermes::cos(M_PI*x/2); + return Hermes::cos(M_PI*x / 2); } - -double CustomExactFunction1::dx(double x) + +double CustomExactFunction1::dx(double x) { - return -Hermes::sin(M_PI*x/2)*(M_PI/2.); + return -Hermes::sin(M_PI*x / 2)*(M_PI / 2.); } - -double CustomExactFunction1::ddxx(double x) + +double CustomExactFunction1::ddxx(double x) { - return -Hermes::cos(M_PI*x/2)*(M_PI/2.)*(M_PI/2.); + return -Hermes::cos(M_PI*x / 2)*(M_PI / 2.)*(M_PI / 2.); } - -double CustomExactFunction2::val(double x) +double CustomExactFunction2::val(double x) { - return 1. - (exp(K*x) + exp(-K*x))/(exp(K) + exp(-K)); + return 1. - (exp(K*x) + exp(-K*x)) / (exp(K) + exp(-K)); } - -double CustomExactFunction2::dx(double x) + +double CustomExactFunction2::dx(double x) { - return -K*(exp(K*x) - exp(-K*x))/(exp(K) + exp(-K)); + return -K*(exp(K*x) - exp(-K*x)) / (exp(K) + exp(-K)); } - -double CustomExactFunction2::ddxx(double x) + +double CustomExactFunction2::ddxx(double x) { - return -K*K*(exp(K*x) + exp(-K*x))/(exp(K) + exp(-K)); + return -K*K*(exp(K*x) + exp(-K*x)) / (exp(K) + exp(-K)); } - CustomRightHandSide1::CustomRightHandSide1(double K, double d_u, double sigma) - : Hermes2DFunction(), d_u(d_u), sigma(sigma) + : Hermes2DFunction(), d_u(d_u), sigma(sigma) { cef1 = new CustomExactFunction1(); cef2 = new CustomExactFunction2(K); } -double CustomRightHandSide1::value(double x, double y) const +double CustomRightHandSide1::value(double x, double y) const { double Laplace_u = cef1->ddxx(x) * cef1->val(y) - + cef1->val(x) * cef1->ddxx(y); + + cef1->val(x) * cef1->ddxx(y); double u = cef1->val(x) * cef1->val(y); double v = cef2->val(x) * cef2->val(y); return -d_u * d_u * Laplace_u - u + sigma * v; } -Ord CustomRightHandSide1::value(Ord x, Ord y) const +Ord CustomRightHandSide1::value(Ord x, Ord y) const { return Ord(10); } -CustomRightHandSide1::~CustomRightHandSide1() -{ - delete cef1; +CustomRightHandSide1::~CustomRightHandSide1() +{ + delete cef1; delete cef2; } CustomRightHandSide2::CustomRightHandSide2(double K, double d_v) - : Hermes2DFunction(), d_v(d_v) + : Hermes2DFunction(), d_v(d_v) { cef1 = new CustomExactFunction1(); cef2 = new CustomExactFunction2(K); } -double CustomRightHandSide2::value(double x, double y) const +double CustomRightHandSide2::value(double x, double y) const { double Laplace_v = cef2->ddxx(x) * cef2->val(y) - + cef2->val(x) * cef2->ddxx(y); + + cef2->val(x) * cef2->ddxx(y); double u = cef1->val(x) * cef1->val(y); double v = cef2->val(x) * cef2->val(y); return -d_v*d_v * Laplace_v - u + v; } -Ord CustomRightHandSide2::value(Ord x, Ord y) const +Ord CustomRightHandSide2::value(Ord x, Ord y) const { return Ord(10); } -CustomRightHandSide2::~CustomRightHandSide2() -{ - delete cef1; +CustomRightHandSide2::~CustomRightHandSide2() +{ + delete cef1; delete cef2; } - ExactSolutionFitzHughNagumo1::ExactSolutionFitzHughNagumo1(MeshSharedPtr mesh) - : ExactSolutionScalar(mesh) + : ExactSolutionScalar(mesh) { cef1 = new CustomExactFunction1(); } -double ExactSolutionFitzHughNagumo1::value(double x, double y) const +double ExactSolutionFitzHughNagumo1::value(double x, double y) const { return cef1->val(x)*cef1->val(y); } -void ExactSolutionFitzHughNagumo1::derivatives(double x, double y, double& dx, double& dy) const +void ExactSolutionFitzHughNagumo1::derivatives(double x, double y, double& dx, double& dy) const { dx = cef1->dx(x)*cef1->val(y); dy = cef1->val(x)*cef1->dx(y); } -Ord ExactSolutionFitzHughNagumo1::ord(double x, double y) const +Ord ExactSolutionFitzHughNagumo1::ord(double x, double y) const { return Ord(10); } -ExactSolutionFitzHughNagumo1::~ExactSolutionFitzHughNagumo1() +ExactSolutionFitzHughNagumo1::~ExactSolutionFitzHughNagumo1() { delete cef1; } MeshFunction* ExactSolutionFitzHughNagumo1::clone() const { - return new ExactSolutionFitzHughNagumo1(this->mesh); + return new ExactSolutionFitzHughNagumo1(this->mesh); } - ExactSolutionFitzHughNagumo2::ExactSolutionFitzHughNagumo2(MeshSharedPtr mesh, double K) - : ExactSolutionScalar(mesh), K(K) + : ExactSolutionScalar(mesh), K(K) { cef2 = new CustomExactFunction2(K); } MeshFunction* ExactSolutionFitzHughNagumo2::clone() const { - return new ExactSolutionFitzHughNagumo2(this->mesh, this->K); + return new ExactSolutionFitzHughNagumo2(this->mesh, this->K); } -double ExactSolutionFitzHughNagumo2::value(double x, double y) const +double ExactSolutionFitzHughNagumo2::value(double x, double y) const { return cef2->val(x)*cef2->val(y); } -void ExactSolutionFitzHughNagumo2::derivatives(double x, double y, double& dx, double& dy) const +void ExactSolutionFitzHughNagumo2::derivatives(double x, double y, double& dx, double& dy) const { dx = cef2->dx(x)*cef2->val(y); dy = cef2->val(x)*cef2->dx(y); } -Ord ExactSolutionFitzHughNagumo2::ord(double x, double y) const +Ord ExactSolutionFitzHughNagumo2::ord(double x, double y) const { return Ord(10); } -ExactSolutionFitzHughNagumo2::~ExactSolutionFitzHughNagumo2() +ExactSolutionFitzHughNagumo2::~ExactSolutionFitzHughNagumo2() { delete cef2; } double CustomResidual1::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const -{ - double result = 0; - for (int i = 0; i < n; i++) - { - result += wt[i] * ( d_u*d_u * (u_ext[0]->dx[i]*v->dx[i] + u_ext[0]->dy[i]*v->dy[i]) - - u_ext[0]->val[i]*v->val[i] - + sigma*u_ext[1]->val[i]*v->val[i] - - g1->value(e->x[i], e->y[i])*v->val[i] - ); - } - - return result; + GeomVol *e, Func **ext) const +{ + double result = 0; + for (int i = 0; i < n; i++) + { + result += wt[i] * (d_u*d_u * (u_ext[0]->dx[i] * v->dx[i] + u_ext[0]->dy[i] * v->dy[i]) + - u_ext[0]->val[i] * v->val[i] + + sigma*u_ext[1]->val[i] * v->val[i] + - g1->value(e->x[i], e->y[i])*v->val[i] + ); + } + + return result; } Ord CustomResidual1::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return Ord(20); } -VectorFormVol* CustomResidual1::clone() const +VectorFormVol* CustomResidual1::clone() const { return new CustomResidual1(this->d_u, this->sigma, new CustomRightHandSide1(g1->cef2->K, this->d_u, this->sigma)); } double CustomResidual2::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const -{ - double result = 0; - for (int i = 0; i < n; i++) - { - result += wt[i] * ( d_v*d_v * (u_ext[1]->dx[i]*v->dx[i] + u_ext[1]->dy[i]*v->dy[i]) - - u_ext[0]->val[i]*v->val[i] - + u_ext[1]->val[i]*v->val[i] - - g2->value(e->x[i], e->y[i])*v->val[i] - ); - } - - return result; + GeomVol *e, Func **ext) const +{ + double result = 0; + for (int i = 0; i < n; i++) + { + result += wt[i] * (d_v*d_v * (u_ext[1]->dx[i] * v->dx[i] + u_ext[1]->dy[i] * v->dy[i]) + - u_ext[0]->val[i] * v->val[i] + + u_ext[1]->val[i] * v->val[i] + - g2->value(e->x[i], e->y[i])*v->val[i] + ); } + return result; +} + Ord CustomResidual2::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return Ord(20); -} +} -VectorFormVol* CustomResidual2::clone() const +VectorFormVol* CustomResidual2::clone() const { return new CustomResidual2(this->d_v, new CustomRightHandSide2(g2->cef2->K, g2->d_v)); } -CustomWeakForm::CustomWeakForm(CustomRightHandSide1* g1, CustomRightHandSide2* g2) : WeakForm(2) +CustomWeakForm::CustomWeakForm(CustomRightHandSide1* g1, CustomRightHandSide2* g2) : WeakForm(2) { // Jacobian. add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion(0, 0, HERMES_ANY, new Hermes1DFunction(g1->d_u * g1->d_u))); @@ -219,4 +215,4 @@ CustomWeakForm::CustomWeakForm(CustomRightHandSide1* g1, CustomRightHandSide2* g // Residual. add_vector_form(new CustomResidual1(g1->d_u, g1->sigma, g1)); add_vector_form(new CustomResidual2(g2->d_v, g2)); -} +} \ No newline at end of file diff --git a/hermes2d/test_examples/06-system-adapt/definitions.h b/hermes2d/test_examples/06-system-adapt/definitions.h index 0cf0a6b60b..571ae86594 100644 --- a/hermes2d/test_examples/06-system-adapt/definitions.h +++ b/hermes2d/test_examples/06-system-adapt/definitions.h @@ -116,10 +116,10 @@ class CustomResidual1 : public VectorFormVol : VectorFormVol(0), d_u(d_u), sigma(sigma), g1(g1) {}; virtual double value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; @@ -136,10 +136,10 @@ class CustomResidual2 : public VectorFormVol : VectorFormVol(1), d_v(d_v), g2(g2) {}; virtual double value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const; diff --git a/hermes2d/test_examples/06-system-adapt/main.cpp b/hermes2d/test_examples/06-system-adapt/main.cpp index 9616802538..027f18f547 100644 --- a/hermes2d/test_examples/06-system-adapt/main.cpp +++ b/hermes2d/test_examples/06-system-adapt/main.cpp @@ -45,7 +45,7 @@ const int INIT_REF_BDY = 5; const bool MULTI = true; // This is a quantitative parameter of the adapt(...) function and // it has different meanings for various adaptive strategies. -const double THRESHOLD = 0.5; +const double THRESHOLD = 0.85; // Error calculation & adaptivity. DefaultErrorCalculator errorCalculator(RelativeErrorToGlobalNorm, 2); @@ -56,7 +56,7 @@ Adapt adaptivity(&errorCalculator, &stoppingCriterion); // Predefined list of element refinement candidates. const CandList CAND_LIST = H2D_HP_ANISO; // Stopping criterion for adaptivity. -const double ERR_STOP = 1e-1; +const double ERR_STOP = 1e-3; // Problem parameters. const double D_u = 1; @@ -95,7 +95,7 @@ int main(int argc, char* argv[]) CustomRightHandSide2 g2(K, D_v); // Initialize the weak formulation. - CustomWeakForm wf(&g1, &g2); + WeakFormSharedPtr wf(new CustomWeakForm(&g1, &g2)); // Initialize boundary conditions DefaultEssentialBCConst bc_u("Bdy", 0.0); @@ -106,12 +106,14 @@ int main(int argc, char* argv[]) // Create H1 spaces with default shapeset for both displacement components. SpaceSharedPtr u_space(new H1Space(u_mesh, &bcs_u, P_INIT_U)); SpaceSharedPtr v_space(new H1Space(MULTI ? v_mesh : u_mesh, &bcs_v, P_INIT_V)); + std::vector > spaces({ u_space, v_space }); + int ndof = Space::get_num_dofs(spaces); // Initialize coarse and reference mesh solutions. MeshFunctionSharedPtr u_sln(new Solution()), v_sln(new Solution()), u_ref_sln(new Solution()), v_ref_sln(new Solution()); - Hermes::vector > slns(u_sln, v_sln); - Hermes::vector > ref_slns(u_ref_sln, v_ref_sln); - Hermes::vector > exact_slns(exact_u, exact_v); + std::vector > slns({ u_sln, v_sln }); + std::vector > ref_slns({ u_ref_sln, v_ref_sln }); + std::vector > exact_slns({ exact_u, exact_v }); // Initialize refinement selector. H1ProjBasedSelector selector(CAND_LIST); @@ -130,7 +132,7 @@ int main(int argc, char* argv[]) SimpleGraph graph_dof_exact, graph_cpu_exact; NewtonSolver newton; - newton.set_weak_formulation(&wf); + newton.set_weak_formulation(wf); // Adaptivity loop: int as = 1; @@ -139,7 +141,7 @@ int main(int argc, char* argv[]) { Hermes::Mixins::Loggable::Static::info("---- Adaptivity step %d:", as); - // Construct globally refined reference mesh and setup reference space-> + // Construct globally refined reference mesh and setup reference space. Mesh::ReferenceMeshCreator u_ref_mesh_creator(u_mesh); MeshSharedPtr u_ref_mesh = u_ref_mesh_creator.create_ref_mesh(); Mesh::ReferenceMeshCreator v_ref_mesh_creator(v_mesh); @@ -148,12 +150,10 @@ int main(int argc, char* argv[]) SpaceSharedPtr u_ref_space = u_ref_space_creator.create_ref_space(); Space::ReferenceSpaceCreator v_ref_space_creator(v_space, MULTI ? v_ref_mesh : u_ref_mesh); SpaceSharedPtr v_ref_space = v_ref_space_creator.create_ref_space(); + std::vector > ref_spaces({ u_ref_space, v_ref_space }); + newton.set_spaces(ref_spaces); - Hermes::vector > ref_spaces_const(u_ref_space, v_ref_space); - - newton.set_spaces(ref_spaces_const); - - int ndof_ref = Space::get_num_dofs(ref_spaces_const); + int ndof_ref = Space::get_num_dofs(ref_spaces); // Initialize reference problem. Hermes::Mixins::Loggable::Static::info("Solving on reference mesh."); @@ -176,11 +176,11 @@ int main(int argc, char* argv[]) } // Translate the resulting coefficient vector into the instance of Solution. - Solution::vector_to_solutions(newton.get_sln_vector(), ref_spaces_const, Hermes::vector >(u_ref_sln, v_ref_sln)); + Solution::vector_to_solutions(newton.get_sln_vector(), ref_spaces, ref_slns); // Project the fine mesh solution onto the coarse mesh. Hermes::Mixins::Loggable::Static::info("Projecting reference solution on coarse mesh."); - OGProjection ogProjection; ogProjection.project_global(Hermes::vector >(u_space, v_space), ref_slns, slns); + OGProjection ogProjection; ogProjection.project_global(spaces, ref_slns, slns); cpu_time.tick(); @@ -194,17 +194,17 @@ int main(int argc, char* argv[]) Hermes::Mixins::Loggable::Static::info("Calculating error estimate and exact error."); errorCalculator.calculate_errors(slns, exact_slns, false); double err_exact_rel_total = errorCalculator.get_total_error_squared() * 100; - Hermes::vector err_exact_rel; + std::vector err_exact_rel; err_exact_rel.push_back(errorCalculator.get_error_squared(0) * 100); err_exact_rel.push_back(errorCalculator.get_error_squared(1) * 100); errorCalculator.calculate_errors(slns, ref_slns, true); double err_est_rel_total = errorCalculator.get_total_error_squared() * 100; - Hermes::vector err_est_rel; + std::vector err_est_rel; err_est_rel.push_back(errorCalculator.get_error_squared(0) * 100); err_est_rel.push_back(errorCalculator.get_error_squared(1) * 100); - adaptivity.set_spaces(Hermes::vector >(u_space, v_space)); + adaptivity.set_spaces(spaces); // Time measurement. cpu_time.tick(); @@ -217,31 +217,30 @@ int main(int argc, char* argv[]) v_space->get_num_dofs(), v_ref_space->get_num_dofs()); Hermes::Mixins::Loggable::Static::info("err_est_rel[1]: %g%%, err_exact_rel[1]: %g%%", err_est_rel[1], err_exact_rel[1]); Hermes::Mixins::Loggable::Static::info("ndof_coarse_total: %d, ndof_fine_total: %d", - Space::get_num_dofs(Hermes::vector >(u_space, v_space)), - Space::get_num_dofs(ref_spaces_const)); + Space::get_num_dofs(spaces), + Space::get_num_dofs(ref_spaces)); Hermes::Mixins::Loggable::Static::info("err_est_rel_total: %g%%, err_est_exact_total: %g%%", err_est_rel_total, err_exact_rel_total); // Add entry to DOF and CPU convergence graphs. - graph_dof_est.add_values(Space::get_num_dofs(Hermes::vector >(u_space, v_space)), + graph_dof_est.add_values(Space::get_num_dofs(spaces), err_est_rel_total); graph_dof_est.save("conv_dof_est.dat"); graph_cpu_est.add_values(cpu_time.accumulated(), err_est_rel_total); graph_cpu_est.save("conv_cpu_est.dat"); - graph_dof_exact.add_values(Space::get_num_dofs(Hermes::vector >(u_space, v_space)), + graph_dof_exact.add_values(Space::get_num_dofs(spaces), err_exact_rel_total); graph_dof_exact.save("conv_dof_exact.dat"); graph_cpu_exact.add_values(cpu_time.accumulated(), err_exact_rel_total); graph_cpu_exact.save("conv_cpu_exact.dat"); - // If err_est too large, adapt the mesh-> + // If err_est too large, adapt the mesh. if (err_est_rel_total < ERR_STOP) done = true; else { Hermes::Mixins::Loggable::Static::info("Adapting coarse mesh."); - Hermes::vector *> selectors(&selector, &selector); - done = adaptivity.adapt(selectors); + done = adaptivity.adapt({ &selector, &selector }); } // Increase counter. @@ -253,4 +252,4 @@ int main(int argc, char* argv[]) // Wait for all views to be closed. Views::View::wait(); return 0; -} +} \ No newline at end of file diff --git a/hermes2d/test_examples/07-newton-heat-rk/definitions.cpp b/hermes2d/test_examples/07-newton-heat-rk/definitions.cpp index 1a02e460a0..63fe77d4e2 100644 --- a/hermes2d/test_examples/07-newton-heat-rk/definitions.cpp +++ b/hermes2d/test_examples/07-newton-heat-rk/definitions.cpp @@ -1,55 +1,50 @@ #include "definitions.h" CustomWeakFormHeatRK::CustomWeakFormHeatRK(std::string bdy_air, double alpha, double lambda, double heatcap, double rho, - double* current_time_ptr, double temp_init, double t_final) : Hermes::Hermes2D::WeakForm(2) + double temp_init, double t_final) : Hermes::Hermes2D::WeakForm(1) { - for(int i = 0; i < this->neq; i++) - { - // Jacobian volumetric part. - add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion(i, i, HERMES_ANY, new Hermes1DFunction(-lambda / (heatcap * rho)))); + add_matrix_form(new WeakFormsH1::DefaultJacobianDiffusion(0, 0, HERMES_ANY, new Hermes1DFunction(-lambda / (heatcap * rho)))); // Jacobian surface part. - add_matrix_form_surf(new WeakFormsH1::DefaultMatrixFormSurf(i, i, bdy_air, new Hermes2DFunction(-alpha / (heatcap * rho)))); + add_matrix_form_surf(new WeakFormsH1::DefaultMatrixFormSurf(0, 0, bdy_air, new Hermes2DFunction(-alpha / (heatcap * rho)))); // Residual - volumetric. - add_vector_form(new WeakFormsH1::DefaultResidualDiffusion(i, HERMES_ANY, new Hermes1DFunction(-lambda / (heatcap * rho)))); + add_vector_form(new WeakFormsH1::DefaultResidualDiffusion(0, HERMES_ANY, new Hermes1DFunction(-lambda / (heatcap * rho)))); // Residual - surface. - add_vector_form_surf(new CustomFormResidualSurf(i, this->neq, bdy_air, alpha, rho, heatcap, - current_time_ptr, temp_init, t_final)); - } + add_vector_form_surf(new CustomFormResidualSurf(0, bdy_air, alpha, rho, heatcap, temp_init, t_final)); } template -Scalar CustomWeakFormHeatRK::CustomFormResidualSurf::vector_form_surf(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const +Scalar CustomWeakFormHeatRK::CustomFormResidualSurf::vector_form_surf(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, Func **ext) const { Scalar T_ext = Scalar(temp_ext(get_current_stage_time())); Scalar result = Scalar(0); for (int pt_i = 0; pt_i < n; pt_i++) { - result += wt[pt_i] * (T_ext - u_ext[this->i % this->original_neq]->val[pt_i]) * v->val[pt_i]; + result += wt[pt_i] * (T_ext - u_ext[this->previous_iteration_space_index]->val[pt_i]) * v->val[pt_i]; } return alpha / (rho * heatcap) * result; } -double CustomWeakFormHeatRK::CustomFormResidualSurf::value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, - Func **ext) const +double CustomWeakFormHeatRK::CustomFormResidualSurf::value(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, + Func **ext) const { double T_ext = temp_ext(get_current_stage_time()); double result = 0.; for (int pt_i = 0; pt_i < n; pt_i++) { - result += wt[pt_i] * (T_ext - u_ext[this->i % this->original_neq]->val[pt_i]) * v->val[pt_i]; + result += wt[pt_i] * (T_ext - u_ext[this->previous_iteration_space_index]->val[pt_i]) * v->val[pt_i]; } return alpha / (rho * heatcap) * result; } -Ord CustomWeakFormHeatRK::CustomFormResidualSurf::ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const +Ord CustomWeakFormHeatRK::CustomFormResidualSurf::ord(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, Func **ext) const { return vector_form_surf(n, wt, u_ext, v, e, ext); } @@ -62,5 +57,5 @@ VectorFormSurf* CustomWeakFormHeatRK::CustomFormResidualSurf::clone() co template Real CustomWeakFormHeatRK::CustomFormResidualSurf::temp_ext(Real t) const { - return temp_init + 10. * Hermes::sin(2*M_PI*t/t_final); + return temp_init + 10. * Hermes::sin(2 * M_PI*t / t_final); } \ No newline at end of file diff --git a/hermes2d/test_examples/07-newton-heat-rk/definitions.h b/hermes2d/test_examples/07-newton-heat-rk/definitions.h index f70cd9f683..cd94ca9ce1 100644 --- a/hermes2d/test_examples/07-newton-heat-rk/definitions.h +++ b/hermes2d/test_examples/07-newton-heat-rk/definitions.h @@ -8,41 +8,39 @@ using namespace Hermes::Hermes2D; class CustomWeakFormHeatRK : public WeakForm { public: - CustomWeakFormHeatRK(std::string bdy_air, double alpha, double lambda, double heatcap, double rho, - double* current_time_ptr, double temp_init, double t_final); + CustomWeakFormHeatRK(std::string bdy_air, double alpha, double lambda, double heatcap, double rho, + double temp_init, double t_final); private: - // This form is custom since it contains time-dependent exterior temperature. - class CustomFormResidualSurf : public VectorFormSurf - { - private: - double h; - public: - CustomFormResidualSurf(int i, int original_neq, std::string area, double alpha, double rho, - double heatcap, double* current_time_ptr, double temp_init, double t_final) - : VectorFormSurf(i), alpha(alpha), rho(rho), - heatcap(heatcap), current_time_ptr(current_time_ptr), - temp_init(temp_init), t_final(t_final), original_neq(original_neq) - { - this->set_area(area); - }; - - template - Scalar vector_form_surf(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; - - virtual double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, - Func **ext) const; - - virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; - - virtual VectorFormSurf* clone() const; - - // Time-dependent exterior temperature. - template - Real temp_ext(Real t) const; - - // Members. - double alpha, rho, heatcap, *current_time_ptr, temp_init, t_final; - int original_neq; - }; + // This form is custom since it contains time-dependent exterior temperature. + class CustomFormResidualSurf : public VectorFormSurf + { + private: + double h; + public: + CustomFormResidualSurf(int i, std::string area, double alpha, double rho, + double heatcap, double temp_init, double t_final) + : VectorFormSurf(i), alpha(alpha), rho(rho), + heatcap(heatcap), temp_init(temp_init), t_final(t_final) + { + this->set_area(area); + }; + + template + Scalar vector_form_surf(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, Func **ext) const; + + virtual double value(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, + Func **ext) const; + + virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, Func **ext) const; + + virtual VectorFormSurf* clone() const; + + // Time-dependent exterior temperature. + template + Real temp_ext(Real t) const; + + // Members. + double alpha, rho, heatcap, temp_init, t_final; + }; }; \ No newline at end of file diff --git a/hermes2d/test_examples/07-newton-heat-rk/main.cpp b/hermes2d/test_examples/07-newton-heat-rk/main.cpp index 4be5aba972..fee614b777 100644 --- a/hermes2d/test_examples/07-newton-heat-rk/main.cpp +++ b/hermes2d/test_examples/07-newton-heat-rk/main.cpp @@ -30,127 +30,122 @@ // // The following parameters can be changed: -const bool REUSE_SOLUTION = false; -const int P_INIT = 2; // Polynomial degree of all mesh elements. -const int INIT_REF_NUM = 1; // Number of initial uniform mesh refinements. -const int INIT_REF_NUM_BDY = 1; // Number of initial uniform mesh refinements towards the boundary. -double time_step = 3e+2; // Time step in seconds. -const double NEWTON_TOL = 1e-5; // Stopping criterion for the Newton's method. -const int max_allowed_iterations = 100; // Maximum allowed number of Newton iterations. - -// Choose one of the following time-integration methods, or define your own Butcher's table. The last number -// in the name of each method is its order. The one before last, if present, is the number of stages. -// Explicit methods: -// Explicit_RK_1, Explicit_RK_2, Explicit_RK_3, Explicit_RK_4. -// Implicit methods: -// Implicit_RK_1, Implicit_Crank_Nicolson_2_2, Implicit_SIRK_2_2, Implicit_ESIRK_2_2, Implicit_SDIRK_2_2, -// Implicit_Lobatto_IIIA_2_2, Implicit_Lobatto_IIIB_2_2, Implicit_Lobatto_IIIC_2_2, Implicit_Lobatto_IIIA_3_4, -// Implicit_Lobatto_IIIB_3_4, Implicit_Lobatto_IIIC_3_4, Implicit_Radau_IIA_3_5, Implicit_SDIRK_5_4. -// Embedded explicit methods: -// Explicit_HEUN_EULER_2_12_embedded, Explicit_BOGACKI_SHAMPINE_4_23_embedded, Explicit_FEHLBERG_6_45_embedded, -// Explicit_CASH_KARP_6_45_embedded, Explicit_DORMAND_PRINCE_7_45_embedded. -// Embedded implicit methods: -// Implicit_SDIRK_CASH_3_23_embedded, Implicit_ESDIRK_TRBDF2_3_23_embedded, Implicit_ESDIRK_TRX2_3_23_embedded, -// Implicit_SDIRK_BILLINGTON_3_23_embedded, Implicit_SDIRK_CASH_5_24_embedded, Implicit_SDIRK_CASH_5_34_embedded, -// Implicit_DIRK_ISMAIL_7_45_embedded. - -ButcherTableType butcher_table_type = Implicit_RK_1; +// Polynomial degree of all mesh elements. +const int P_INIT = 1; +// Number of initial uniform mesh refinements. +const int INIT_REF_NUM = 3; +// Number of initial uniform mesh refinements towards the boundary. +const int INIT_REF_NUM_BDY = 2; +// Time step in seconds. +double time_step = 1e+2; +// Stopping criterion for the Newton's method. +const double NEWTON_TOL = 1e-5; +// Damping factor for the Newton's method. +const double NEWTON_DF = .5; +// Maximum allowed number of Newton iterations. +const int NEWTON_MAX_ITER = 100; + +ButcherTableType butcher_table_type = Explicit_RK_1; +//ButcherTableType butcher_table_type = Explicit_RK_3; +//ButcherTableType butcher_table_type = Implicit_RK_1; +//ButcherTableType butcher_table_type = Implicit_SDIRK_CASH_3_23_embedded; +//ButcherTableType butcher_table_type = Implicit_SDIRK_CASH_5_34_embedded; // Problem parameters. -const double TEMP_INIT = 10; // Temperature of the ground (also initial temperature). -const double ALPHA = 10; // Heat flux coefficient for Newton's boundary condition. -const double LAMBDA = 1e2; // Thermal conductivity of the material. -const double HEATCAP = 1e2; // Heat capacity. -const double RHO = 3000; // Material density. -const double T_FINAL = time_step * 2; // Length of time interval (24 hours) in seconds. +// Temperature of the ground (also initial temperature). +const double TEMP_INIT = 10; +// Heat flux coefficient for Newton's boundary condition. +const double ALPHA = 10; +// Thermal conductivity of the material. +const double LAMBDA = 1e2; +// Heat capacity. +const double HEATCAP = 1e2; +// Material density. +const double RHO = 3000; +// Length of time interval (24 hours) in seconds. +const double T_FINAL = 86400; int main(int argc, char* argv[]) { - // Choose a Butcher's table or define your own. - ButcherTable bt(butcher_table_type); - - // Initialize the time. - double current_time = 0; - - // mesh-> - MeshSharedPtr mesh(new Mesh); - - // Init mesh-> - MeshReaderH2D mloader; - mloader.load("cathedral.mesh", mesh); - - // Perform initial mesh refinements. - for(int i = 0; i < INIT_REF_NUM; i++) - mesh->refine_all_elements(); - mesh->refine_towards_boundary("Boundary_air", INIT_REF_NUM_BDY); - mesh->refine_towards_boundary("Boundary_ground", INIT_REF_NUM_BDY); - - // Initialize boundary conditions. - Hermes::Hermes2D::DefaultEssentialBCConst bc_essential("Boundary_ground", TEMP_INIT); - Hermes::Hermes2D::EssentialBCs bcs(&bc_essential); - - // space-> - SpaceSharedPtr space1(new H1Space(mesh, &bcs, P_INIT)); - SpaceSharedPtr space2(new H1Space(mesh, &bcs, P_INIT + 1)); - Hermes::vector > spaces(space1, space2); - - // Solution pointer. - MeshFunctionSharedPtr sln_time_prev1(new ConstantSolution(mesh, TEMP_INIT)); - MeshFunctionSharedPtr sln_time_prev2(new ConstantSolution(mesh, TEMP_INIT)); - Hermes::vector > sln_time_prev(sln_time_prev1, sln_time_prev2); - - MeshFunctionSharedPtr sln_time_new1(new Solution(mesh)); - MeshFunctionSharedPtr sln_time_new2(new Solution(mesh)); - Hermes::vector > sln_time_new(sln_time_new1, sln_time_new2); - - CustomWeakFormHeatRK wf("Boundary_air", ALPHA, LAMBDA, HEATCAP, RHO, - ¤t_time, TEMP_INIT, T_FINAL); - - // Initialize views. - Hermes::Hermes2D::Views::ScalarView Tview("Temperature", new Hermes::Hermes2D::Views::WinGeom(0, 0, 450, 600)); - Tview.set_min_max_range(0, 20); - Tview.fix_scale_width(30); - - // Initialize Runge-Kutta time stepping. - RungeKutta runge_kutta(&wf, spaces, &bt); - runge_kutta.set_tolerance(NEWTON_TOL); - runge_kutta.set_verbose_output(true); - runge_kutta.set_time_step(time_step); - - // Iteration number. - int iteration = 0; - - // Time stepping loop: - do + // Choose a Butcher's table or define your own. + ButcherTable bt(butcher_table_type); + + // Init mesh. + MeshSharedPtr mesh(new Mesh); + MeshReaderH2D mloader; + mloader.load("cathedral.mesh", mesh); + + // Perform initial mesh refinements. + for (int i = 0; i < INIT_REF_NUM; i++) + mesh->refine_all_elements(); + mesh->refine_towards_boundary("Boundary_air", INIT_REF_NUM_BDY); + mesh->refine_towards_boundary("Boundary_ground", INIT_REF_NUM_BDY); + + // Initialize space & boundary conditions. + Hermes::Hermes2D::DefaultEssentialBCConst bc_essential("Boundary_ground", TEMP_INIT); + Hermes::Hermes2D::EssentialBCs bcs(&bc_essential); + SpaceSharedPtr space(new H1Space(mesh, &bcs, P_INIT)); + + // Solution pointer. + MeshFunctionSharedPtr sln_time_prev(new ConstantSolution(mesh, TEMP_INIT)); + MeshFunctionSharedPtr sln_time_new(new Solution(mesh)); + MeshFunctionSharedPtr time_error_fn(new ZeroSolution(mesh)); + + // Weak formulation. + WeakFormSharedPtr wf(new CustomWeakFormHeatRK("Boundary_air", ALPHA, LAMBDA, HEATCAP, RHO, TEMP_INIT, T_FINAL)); + + // Initialize views. + Hermes::Hermes2D::Views::ScalarView Eview("Time error", new Hermes::Hermes2D::Views::WinGeom(500, 0, 450, 600)); + Hermes::Hermes2D::Views::ScalarView Tview("Temperature", new Hermes::Hermes2D::Views::WinGeom(0, 0, 450, 600)); + Tview.set_min_max_range(0, 20); + Tview.fix_scale_width(30); + + // Initialize Runge-Kutta time stepping. + RungeKutta runge_kutta(wf, space, &bt); + runge_kutta.set_newton_tolerance(NEWTON_TOL); + runge_kutta.set_newton_damping_coeff(NEWTON_DF); + runge_kutta.set_verbose_output(true); + runge_kutta.set_time_step(time_step); + runge_kutta.set_newton_max_allowed_iterations(NEWTON_MAX_ITER); + + // Time stepping loop: + // - Initialize the time. + double current_time = 0; + do + { + runge_kutta.set_time(current_time); + if (bt.is_embedded()) + runge_kutta.rk_time_step_newton(sln_time_prev, sln_time_new, time_error_fn); + else + runge_kutta.rk_time_step_newton(sln_time_prev, sln_time_new); + + // Show the new_ time level solution. + char title[100]; + sprintf(title, "Time %3.2f s", current_time); + Tview.set_title(title); + Tview.show(sln_time_new); + + // Copy solution for the new_ time step. + sln_time_prev->copy(sln_time_new); + + // Time error + if (bt.is_embedded()) { - // Perform one Runge-Kutta time step according to the selected Butcher's table. - try - { - runge_kutta.set_time(current_time); - runge_kutta.rk_time_step_newton(sln_time_prev, sln_time_new); - } - catch(Exceptions::Exception& e) - { - e.print_msg(); - } - - // Show the new_ time level solution. - char title[100]; - sprintf(title, "Time %3.2f s", current_time); - Tview.set_title(title); - Tview.show(sln_time_new2); - - // Copy solution for the new_ time step. - sln_time_prev1->copy(sln_time_new1); - sln_time_prev2->copy(sln_time_new2); - - // Increase current time and time step counter. - current_time += time_step; - iteration++; + Eview.show(time_error_fn); + DefaultNormCalculator normCalculator(1); + normCalculator.calculate_norm(time_error_fn); + double time_error_norm = normCalculator.get_total_norm_squared(); + normCalculator.calculate_norm(sln_time_new); + double sln_norm = normCalculator.get_total_norm_squared(); + + Hermes::Mixins::Loggable::Static::info("\tRelative time error: %g%%.", (time_error_norm / sln_norm) * 100.); } - while (current_time < T_FINAL); - // Wait for the view to be closed. - Hermes::Hermes2D::Views::View::wait(); - return 0; -} + // Increase current time and time step counter. + current_time += time_step; + } while (current_time < T_FINAL); + + // Wait for the view to be closed. + Hermes::Hermes2D::Views::View::wait(); + return 0; +} \ No newline at end of file diff --git a/hermes2d/test_examples/08-nonlinearity/definitions.cpp b/hermes2d/test_examples/08-nonlinearity/definitions.cpp index 43658bbc89..5a6418c970 100644 --- a/hermes2d/test_examples/08-nonlinearity/definitions.cpp +++ b/hermes2d/test_examples/08-nonlinearity/definitions.cpp @@ -1,6 +1,6 @@ #include "definitions.h" -CustomNonlinearity::CustomNonlinearity(double alpha): Hermes1DFunction() +CustomNonlinearity::CustomNonlinearity(double alpha) : Hermes1DFunction() { this->is_const = false; this->alpha = alpha; @@ -27,34 +27,33 @@ Ord CustomNonlinearity::derivative(Ord u) const return Ord(10); } -double CustomInitialCondition::value(double x, double y) const +double CustomInitialCondition::value(double x, double y) const { - return (x+10) * (y+10) / 100. + 2; + return (x + 10) * (y + 10) / 100. + 2; } -void CustomInitialCondition::derivatives(double x, double y, double& dx, double& dy) const -{ - dx = (y+10) / 100.; - dy = (x+10) / 100.; +void CustomInitialCondition::derivatives(double x, double y, double& dx, double& dy) const +{ + dx = (y + 10) / 100.; + dy = (x + 10) / 100.; } -Ord CustomInitialCondition::ord(double x, double y) const +Ord CustomInitialCondition::ord(double x, double y) const { return Hermes::Ord(x*y); } - + MeshFunction* CustomInitialCondition::clone() const { return new CustomInitialCondition(this->mesh); } -EssentialBoundaryCondition::EssentialBCValueType CustomEssentialBCNonConst::get_value_type() const -{ - return EssentialBoundaryCondition::BC_FUNCTION; +EssentialBCValueType CustomEssentialBCNonConst::get_value_type() const +{ + return BC_FUNCTION; } -double CustomEssentialBCNonConst::value(double x, double y, double n_x, double n_y, - double t_x, double t_y) const +double CustomEssentialBCNonConst::value(double x, double y) const { - return (x+10) * (y+10) / 100.; -} + return (x + 10) * (y + 10) / 100.; +} \ No newline at end of file diff --git a/hermes2d/test_examples/08-nonlinearity/definitions.h b/hermes2d/test_examples/08-nonlinearity/definitions.h index 42c57e8185..1f9ed260d9 100644 --- a/hermes2d/test_examples/08-nonlinearity/definitions.h +++ b/hermes2d/test_examples/08-nonlinearity/definitions.h @@ -48,15 +48,14 @@ class CustomEssentialBCNonConst : public EssentialBoundaryCondition { public: CustomEssentialBCNonConst(std::string marker) - : EssentialBoundaryCondition(Hermes::vector()) + : EssentialBoundaryCondition(std::vector()) { this->markers.push_back(marker); } virtual EssentialBCValueType get_value_type() const; - virtual double value(double x, double y, double n_x, double n_y, - double t_x, double t_y) const; + virtual double value(double x, double y) const; }; diff --git a/hermes2d/test_examples/08-nonlinearity/main.cpp b/hermes2d/test_examples/08-nonlinearity/main.cpp index 407434f04f..c1162cf728 100644 --- a/hermes2d/test_examples/08-nonlinearity/main.cpp +++ b/hermes2d/test_examples/08-nonlinearity/main.cpp @@ -52,14 +52,14 @@ int main(int argc, char* argv[]) // Initialize the weak formulation CustomNonlinearity lambda(alpha); Hermes2DFunction src(-heat_src); - DefaultWeakFormPoisson wf(HERMES_ANY, &lambda, &src); + WeakFormSharedPtr wf(new DefaultWeakFormPoisson(HERMES_ANY, &lambda, &src)); // Initialize the FE problem. - DiscreteProblem dp(&wf, space); + DiscreteProblem dp(wf, space); - // Project the initial condition on the FE space to obtain initial + // Project the initial condition on the FE space to obtain initial // coefficient vector for the Newton's method. - // NOTE: If you want to start from the zero vector, just define + // NOTE: If you want to start from the zero vector, just define // coeff_vec to be a vector of ndof zeros (no projection is needed). Hermes::Mixins::Loggable::Static::info("Projecting to obtain initial vector for the Newton's method."); double* coeff_vec = new double[ndof]; @@ -118,5 +118,4 @@ int main(int argc, char* argv[]) // Wait for all views to be closed. View::wait(); return 0; -} - +} \ No newline at end of file diff --git a/hermes2d/test_examples/09-sparkgap/CMakeLists.txt b/hermes2d/test_examples/09-sparkgap/CMakeLists.txt new file mode 100644 index 0000000000..c02f202fdf --- /dev/null +++ b/hermes2d/test_examples/09-sparkgap/CMakeLists.txt @@ -0,0 +1,9 @@ +project(09-sparkgap) + +add_executable(${PROJECT_NAME} main.cpp) + +if(NOT MSVC) + set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_FLAGS ${HERMES_FLAGS}) +endif() + +target_link_libraries(${PROJECT_NAME} ${HERMES2D}) diff --git a/hermes2d/test_examples/09-sparkgap/main.cpp b/hermes2d/test_examples/09-sparkgap/main.cpp new file mode 100644 index 0000000000..e09843f591 --- /dev/null +++ b/hermes2d/test_examples/09-sparkgap/main.cpp @@ -0,0 +1,95 @@ +#include "hermes2d.h" + +using namespace Hermes; +using namespace Hermes::Hermes2D; +using namespace Hermes::Hermes2D::Views; +using namespace Hermes::Hermes2D::RefinementSelectors; + +// Problem parameters. +const double SRC = 1000.; +const std::vector SRC_BOUNDARY = { "0", "5" }; +const std::vector GND_BOUNDARY = { "7", "8" }; + +// Error calculation & adaptivity. +// This is a quantitative parameter of the adapt(...) function and +// it has different meanings for various adaptive strategies. +const double THRESHOLD = 0.75; +// Error calculator +DefaultErrorCalculator errorCalculator(RelativeErrorToGlobalNorm, 1); +// Stopping criterion for an adaptivity step. +AdaptStoppingCriterionSingleElement stoppingCriterion(THRESHOLD); +// Adaptivity processor class. +Adapt adaptivity(&errorCalculator, &stoppingCriterion); +// Selector with predefined list of element refinement candidates. +H1ProjBasedSelector selector(H2D_HP_ANISO); +// Stopping criterion for adaptivity. +const double ERR_STOP = 1e-8; + +int main(int argc, char* argv[]) +{ + // Load the mesh. + MeshSharedPtr mesh(new Mesh); + Hermes::Hermes2D::MeshReaderH2DXML mloader; + mloader.load("sparkgap.msh", mesh); + + // Initialize essential boundary conditions. + Hermes::Hermes2D::DefaultEssentialBCConst bc_essential_src(SRC_BOUNDARY, SRC); + Hermes::Hermes2D::DefaultEssentialBCConst bc_essential_gnd(GND_BOUNDARY, 0.); + Hermes::Hermes2D::EssentialBCs bcs({ &bc_essential_src, &bc_essential_gnd }); + + // Initialize space of the 3-rd order. + SpaceSharedPtr space(new Hermes::Hermes2D::H1Space(mesh, &bcs, 3)); + OrderView Oview("FE Space", new Hermes::Hermes2D::Views::WinGeom(100, 50, 600, 600)); + + // Initialize the weak formulation. + WeakFormSharedPtr wf(new WeakFormsH1::DefaultWeakFormLaplaceLinear(HERMES_ANY, HERMES_AXISYM_Y)); + + // Initialize the solution. + MeshFunctionSharedPtr sln(new Solution); + MeshFunctionSharedPtr ref_sln(new Solution); + + // Initialize the view. + Hermes::Hermes2D::Views::ScalarView Sview("Solution", new Hermes::Hermes2D::Views::WinGeom(750, 50, 600, 600)); + + // Initialize linear solver. + Hermes::Hermes2D::LinearSolver linear_solver(wf, space); + + adaptivity.set_space(space); + while (true) + { + // Construct globally refined reference mesh and setup reference space. + Mesh::ReferenceMeshCreator ref_mesh_creator(mesh); + MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh(); + Space::ReferenceSpaceCreator ref_space_creator(space, ref_mesh); + SpaceSharedPtr ref_space = ref_space_creator.create_ref_space(); + linear_solver.set_space(ref_space); + + // Solve the problem. + linear_solver.solve(); + + // Translate the solution vector into the previously initialized Solution. + Hermes::Hermes2D::Solution::vector_to_solution(linear_solver.get_sln_vector(), ref_space, ref_sln); + + // Visualize the solution. + Oview.show(ref_space); + Sview.show(ref_sln); + + // Project the reference solution to the coarse space in H1 norm for error calculation. + OGProjection::project_global(space, ref_sln, sln); + + // Calculate element errors and total error estimate. + errorCalculator.calculate_errors(sln, ref_sln); + double total_error_estimate = errorCalculator.get_total_error_squared() * 100; + Sview.set_title("Solution, spatial error: %g%%.", total_error_estimate); + + // If error is too large, adapt the (coarse) space. + if (total_error_estimate > ERR_STOP) + adaptivity.adapt(&selector); + else + break; + } + + // Wait for view to be closed. + Views::View::wait(); + return 0; +} \ No newline at end of file diff --git a/hermes2d/test_examples/09-sparkgap/sparkgap.msh b/hermes2d/test_examples/09-sparkgap/sparkgap.msh new file mode 100644 index 0000000000..44a79140c4 --- /dev/null +++ b/hermes2d/test_examples/09-sparkgap/sparkgap.msh @@ -0,0 +1,551 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hermes2d/test_examples/09b-sparkgap-adaptive/CMakeLists.txt b/hermes2d/test_examples/09b-sparkgap-adaptive/CMakeLists.txt new file mode 100644 index 0000000000..b813c96e03 --- /dev/null +++ b/hermes2d/test_examples/09b-sparkgap-adaptive/CMakeLists.txt @@ -0,0 +1,9 @@ +project(09b-sparkgap-adaptive) + +add_executable(${PROJECT_NAME} main.cpp) + +if(NOT MSVC) + set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_FLAGS ${HERMES_FLAGS}) +endif() + +target_link_libraries(${PROJECT_NAME} ${HERMES2D}) diff --git a/hermes2d/test_examples/09b-sparkgap-adaptive/main.cpp b/hermes2d/test_examples/09b-sparkgap-adaptive/main.cpp new file mode 100644 index 0000000000..e09843f591 --- /dev/null +++ b/hermes2d/test_examples/09b-sparkgap-adaptive/main.cpp @@ -0,0 +1,95 @@ +#include "hermes2d.h" + +using namespace Hermes; +using namespace Hermes::Hermes2D; +using namespace Hermes::Hermes2D::Views; +using namespace Hermes::Hermes2D::RefinementSelectors; + +// Problem parameters. +const double SRC = 1000.; +const std::vector SRC_BOUNDARY = { "0", "5" }; +const std::vector GND_BOUNDARY = { "7", "8" }; + +// Error calculation & adaptivity. +// This is a quantitative parameter of the adapt(...) function and +// it has different meanings for various adaptive strategies. +const double THRESHOLD = 0.75; +// Error calculator +DefaultErrorCalculator errorCalculator(RelativeErrorToGlobalNorm, 1); +// Stopping criterion for an adaptivity step. +AdaptStoppingCriterionSingleElement stoppingCriterion(THRESHOLD); +// Adaptivity processor class. +Adapt adaptivity(&errorCalculator, &stoppingCriterion); +// Selector with predefined list of element refinement candidates. +H1ProjBasedSelector selector(H2D_HP_ANISO); +// Stopping criterion for adaptivity. +const double ERR_STOP = 1e-8; + +int main(int argc, char* argv[]) +{ + // Load the mesh. + MeshSharedPtr mesh(new Mesh); + Hermes::Hermes2D::MeshReaderH2DXML mloader; + mloader.load("sparkgap.msh", mesh); + + // Initialize essential boundary conditions. + Hermes::Hermes2D::DefaultEssentialBCConst bc_essential_src(SRC_BOUNDARY, SRC); + Hermes::Hermes2D::DefaultEssentialBCConst bc_essential_gnd(GND_BOUNDARY, 0.); + Hermes::Hermes2D::EssentialBCs bcs({ &bc_essential_src, &bc_essential_gnd }); + + // Initialize space of the 3-rd order. + SpaceSharedPtr space(new Hermes::Hermes2D::H1Space(mesh, &bcs, 3)); + OrderView Oview("FE Space", new Hermes::Hermes2D::Views::WinGeom(100, 50, 600, 600)); + + // Initialize the weak formulation. + WeakFormSharedPtr wf(new WeakFormsH1::DefaultWeakFormLaplaceLinear(HERMES_ANY, HERMES_AXISYM_Y)); + + // Initialize the solution. + MeshFunctionSharedPtr sln(new Solution); + MeshFunctionSharedPtr ref_sln(new Solution); + + // Initialize the view. + Hermes::Hermes2D::Views::ScalarView Sview("Solution", new Hermes::Hermes2D::Views::WinGeom(750, 50, 600, 600)); + + // Initialize linear solver. + Hermes::Hermes2D::LinearSolver linear_solver(wf, space); + + adaptivity.set_space(space); + while (true) + { + // Construct globally refined reference mesh and setup reference space. + Mesh::ReferenceMeshCreator ref_mesh_creator(mesh); + MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh(); + Space::ReferenceSpaceCreator ref_space_creator(space, ref_mesh); + SpaceSharedPtr ref_space = ref_space_creator.create_ref_space(); + linear_solver.set_space(ref_space); + + // Solve the problem. + linear_solver.solve(); + + // Translate the solution vector into the previously initialized Solution. + Hermes::Hermes2D::Solution::vector_to_solution(linear_solver.get_sln_vector(), ref_space, ref_sln); + + // Visualize the solution. + Oview.show(ref_space); + Sview.show(ref_sln); + + // Project the reference solution to the coarse space in H1 norm for error calculation. + OGProjection::project_global(space, ref_sln, sln); + + // Calculate element errors and total error estimate. + errorCalculator.calculate_errors(sln, ref_sln); + double total_error_estimate = errorCalculator.get_total_error_squared() * 100; + Sview.set_title("Solution, spatial error: %g%%.", total_error_estimate); + + // If error is too large, adapt the (coarse) space. + if (total_error_estimate > ERR_STOP) + adaptivity.adapt(&selector); + else + break; + } + + // Wait for view to be closed. + Views::View::wait(); + return 0; +} \ No newline at end of file diff --git a/hermes2d/test_examples/09b-sparkgap-adaptive/sparkgap.msh b/hermes2d/test_examples/09b-sparkgap-adaptive/sparkgap.msh new file mode 100644 index 0000000000..44a79140c4 --- /dev/null +++ b/hermes2d/test_examples/09b-sparkgap-adaptive/sparkgap.msh @@ -0,0 +1,551 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hermes2d/test_examples/10-linear-advection-dg-adapt/definitions.cpp b/hermes2d/test_examples/10-linear-advection-dg-adapt/definitions.cpp index 272bdf765d..407c788625 100644 --- a/hermes2d/test_examples/10-linear-advection-dg-adapt/definitions.cpp +++ b/hermes2d/test_examples/10-linear-advection-dg-adapt/definitions.cpp @@ -2,11 +2,11 @@ CustomWeakForm::CustomWeakForm(std::string left_bottom_bnd_part, MeshSharedPtr mesh) : WeakForm(1), mesh(mesh) { - add_matrix_form(new CustomMatrixFormVol(0, 0)); - add_vector_form(new CustomVectorFormVol(0)); - add_matrix_form_surf(new CustomMatrixFormSurface(0, 0)); - add_matrix_form_DG(new CustomMatrixFormInterface(0, 0)); - add_vector_form_surf(new CustomVectorFormSurface(0, left_bottom_bnd_part)); + add_matrix_form(new CustomMatrixFormVol(0, 0)); + add_vector_form(new CustomVectorFormVol(0)); + add_matrix_form_surf(new CustomMatrixFormSurface(0, 0)); + add_matrix_form_DG(new CustomMatrixFormInterface(0, 0)); + add_vector_form_surf(new CustomVectorFormSurface(0, left_bottom_bnd_part)); } WeakForm* CustomWeakForm::clone() const @@ -16,7 +16,7 @@ WeakForm* CustomWeakForm::clone() const template Scalar CustomWeakForm::CustomMatrixFormVol::matrix_form(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -25,13 +25,13 @@ Scalar CustomWeakForm::CustomMatrixFormVol::matrix_form(int n, double *wt, Func< } double CustomWeakForm::CustomMatrixFormVol::value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); } Ord CustomWeakForm::CustomMatrixFormVol::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); } @@ -43,7 +43,7 @@ MatrixFormVol* CustomWeakForm::CustomMatrixFormVol::clone() const template Scalar CustomWeakForm::CustomVectorFormVol::vector_form(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -52,13 +52,13 @@ Scalar CustomWeakForm::CustomVectorFormVol::vector_form(int n, double *wt, Func< } double CustomWeakForm::CustomVectorFormVol::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return vector_form(n, wt, u_ext, v, e, ext); } Ord CustomWeakForm::CustomVectorFormVol::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return vector_form(n, wt, u_ext, v, e, ext); } @@ -76,7 +76,7 @@ Real CustomWeakForm::CustomVectorFormVol::F(Real x, Real y) const template Scalar CustomWeakForm::CustomMatrixFormSurface::matrix_form(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { Scalar result = Scalar(0); for (int i = 0; i < n; i++) @@ -89,13 +89,13 @@ Scalar CustomWeakForm::CustomMatrixFormSurface::matrix_form(int n, double *wt, F } double CustomWeakForm::CustomMatrixFormSurface::value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); } Ord CustomWeakForm::CustomMatrixFormSurface::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); } @@ -107,14 +107,14 @@ MatrixFormSurf* CustomWeakForm::CustomMatrixFormSurface::clone() const template Scalar CustomWeakForm::CustomMatrixFormInterface::matrix_form(int n, double *wt, DiscontinuousFunc** u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, - Geom *e, DiscontinuousFunc **ext) const + InterfaceGeom *e, DiscontinuousFunc **ext) const { Scalar result = Scalar(0); for (int i = 0; i < n; i++) { Real a_dot_n = static_cast(wf)->calculate_a_dot_v(e->x[i], e->y[i], e->nx[i], e->ny[i]); Real jump_v = (v->fn_central == nullptr ? -v->val_neighbor[i] : v->val[i]); - if(u->fn_central == nullptr) + if (u->fn_central == nullptr) result += wt[i] * static_cast(wf)->upwind_flux(Scalar(0), u->val_neighbor[i], a_dot_n) * jump_v; else result += wt[i] * static_cast(wf)->upwind_flux(u->val[i], Scalar(0), a_dot_n) * jump_v; @@ -123,13 +123,13 @@ Scalar CustomWeakForm::CustomMatrixFormInterface::matrix_form(int n, double *wt, } double CustomWeakForm::CustomMatrixFormInterface::value(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, - Geom *e, DiscontinuousFunc **ext) const + InterfaceGeom *e, DiscontinuousFunc **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); } Ord CustomWeakForm::CustomMatrixFormInterface::ord(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, - Geom *e, DiscontinuousFunc **ext) const + InterfaceGeom *e, DiscontinuousFunc **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); } @@ -140,7 +140,7 @@ MatrixFormDG* CustomWeakForm::CustomMatrixFormInterface::clone() const } double CustomWeakForm::CustomVectorFormSurface::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomSurf *e, Func **ext) const { double result = 0; for (int i = 0; i < n; i++) { @@ -152,7 +152,7 @@ double CustomWeakForm::CustomVectorFormSurface::value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const +Ord CustomWeakForm::CustomVectorFormSurface::ord(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, Func **ext) const { Ord result = Ord(0); for (int i = 0; i < n; i++) @@ -173,8 +173,8 @@ Real CustomWeakForm::CustomVectorFormSurface::F(Real x, Real y) const double CustomWeakForm::calculate_a_dot_v(double x, double y, double vx, double vy) const { - double norm = std::max(1e-12, std::sqrt(sqr(x) + sqr(y))); - return -y/norm*vx + x/norm*vy; + double norm = std::max(1e-12, std::sqrt(x*x + y*y)); + return -y / norm*vx + x / norm*vy; } Ord CustomWeakForm::calculate_a_dot_v(Ord x, Ord y, Ord vx, Ord vy) const diff --git a/hermes2d/test_examples/10-linear-advection-dg-adapt/definitions.h b/hermes2d/test_examples/10-linear-advection-dg-adapt/definitions.h index 0f331bbad9..2b9f8c78b8 100644 --- a/hermes2d/test_examples/10-linear-advection-dg-adapt/definitions.h +++ b/hermes2d/test_examples/10-linear-advection-dg-adapt/definitions.h @@ -20,11 +20,11 @@ class CustomWeakForm : public WeakForm CustomMatrixFormVol(int i, int j) : MatrixFormVol(i, j) {}; template - Scalar matrix_form(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const; + Scalar matrix_form(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const; - virtual double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const; + virtual double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const; - virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const; + virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomVol *e, Func **ext) const; MatrixFormVol* clone() const; }; @@ -35,11 +35,11 @@ class CustomWeakForm : public WeakForm CustomVectorFormVol(int i) : VectorFormVol(i) {}; template - Scalar vector_form(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + Scalar vector_form(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; - virtual double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + virtual double value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; - virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; VectorFormVol* clone() const; @@ -53,11 +53,11 @@ class CustomWeakForm : public WeakForm CustomMatrixFormSurface(int i, int j) : MatrixFormSurf(i, j) {}; template - Scalar matrix_form(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const; + Scalar matrix_form(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomSurf *e, Func **ext) const; - virtual double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const; + virtual double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomSurf *e, Func **ext) const; - virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, Geom *e, Func **ext) const; + virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, GeomSurf *e, Func **ext) const; MatrixFormSurf* clone() const; @@ -71,11 +71,11 @@ class CustomWeakForm : public WeakForm }; template - Scalar matrix_form(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, Geom *e, DiscontinuousFunc **ext) const; + Scalar matrix_form(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, InterfaceGeom *e, DiscontinuousFunc **ext) const; - virtual double value(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, Geom *e, DiscontinuousFunc **ext) const; + virtual double value(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, InterfaceGeom *e, DiscontinuousFunc **ext) const; - virtual Ord ord(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, Geom *e, DiscontinuousFunc **ext) const; + virtual Ord ord(int n, double *wt, DiscontinuousFunc **u_ext, DiscontinuousFunc *u, DiscontinuousFunc *v, InterfaceGeom *e, DiscontinuousFunc **ext) const; MatrixFormDG* clone() const; @@ -89,9 +89,9 @@ class CustomWeakForm : public WeakForm this->set_area(left_bottom_bnd_part); }; - virtual double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + virtual double value(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, Func **ext) const; - virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomSurf *e, Func **ext) const; VectorFormSurf* clone() const; diff --git a/hermes2d/test_examples/10-linear-advection-dg-adapt/main.cpp b/hermes2d/test_examples/10-linear-advection-dg-adapt/main.cpp index d2b76648ec..febecc8f6f 100644 --- a/hermes2d/test_examples/10-linear-advection-dg-adapt/main.cpp +++ b/hermes2d/test_examples/10-linear-advection-dg-adapt/main.cpp @@ -13,21 +13,25 @@ // The following parameters can be changed: // Number of initial uniform mesh refinements. -const int INIT_REF = 3; +const int INIT_REF = 1; // Initial polynomial degrees of mesh elements in vertical and horizontal directions. -const int P_INIT = 2; -// This is a quantitative parameter of the adapt(...) function and -// it has different meanings for various adaptive strategies. -const double THRESHOLD = 0.5; +int P_INIT = 1; +// Use Taylor shapeset - which does not have order > 2 implemented. +// This switches to h-adaptivity & turns on Vertex-based limiting. +bool USE_TAYLOR_SHAPESET = true; // Error calculation & adaptivity. +// This is a quantitative parameter of the adapt(...) function and +// it has different meanings for various adaptive strategies. +const double THRESHOLD = 0.75; +// Error calculator DefaultErrorCalculator errorCalculator(RelativeErrorToGlobalNorm, 1); // Stopping criterion for an adaptivity step. AdaptStoppingCriterionSingleElement stoppingCriterion(THRESHOLD); // Adaptivity processor class. Adapt adaptivity(&errorCalculator, &stoppingCriterion); // Predefined list of element refinement candidates. -const CandList CAND_LIST = H2D_H_ANISO; +const CandList CAND_LIST = USE_TAYLOR_SHAPESET ? H2D_H_ANISO : H2D_HP_ANISO; // Stopping criterion for adaptivity. const double ERR_STOP = 1e-2; @@ -43,7 +47,10 @@ int main(int argc, char* args[]) mesh->refine_all_elements(); // Create an L2 space. - SpaceSharedPtr fine_space(new L2Space(mesh, P_INIT, new L2ShapesetTaylor)); + // This is both coarse and fine for Taylor shapeset, coarse for standard Legendre. + SpaceSharedPtr space(new L2Space(mesh, USE_TAYLOR_SHAPESET ? std::max(P_INIT, 2) : P_INIT, (USE_TAYLOR_SHAPESET ? (Shapeset*)(new L2ShapesetTaylor) : (Shapeset*)(new L2ShapesetLegendre)))); + // Set this space to the AMR processor. + adaptivity.set_space(space); // Initialize refinement selector. L2ProjBasedSelector selector(CAND_LIST); @@ -53,69 +60,52 @@ int main(int argc, char* args[]) MeshFunctionSharedPtr refsln(new Solution); // Initialize the weak formulation. - CustomWeakForm wf("Bdy_bottom_left", mesh); + WeakFormSharedPtr wf(new CustomWeakForm("Bdy_bottom_left", mesh)); ScalarView view1("Solution", new WinGeom(900, 0, 450, 350)); view1.fix_scale_width(60); + view1.set_min_max_range(0., 1.); // Initialize linear solver. Hermes::Hermes2D::LinearSolver linear_solver; - linear_solver.set_weak_formulation(&wf); - - adaptivity.set_space(fine_space); + linear_solver.set_weak_formulation(wf); - int as = 1; bool done = false; + int adaptivity_step = 1; bool done = false; do { - // Construct globally refined reference mesh - // and setup reference space-> + // Construct globally refined reference mesh and setup reference space. Mesh::ReferenceMeshCreator ref_mesh_creator(mesh); MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh(); - - Space::ReferenceSpaceCreator refspace_creator(fine_space, ref_mesh, 0); + Space::ReferenceSpaceCreator refspace_creator(space, ref_mesh, USE_TAYLOR_SHAPESET ? 0 : 1); SpaceSharedPtr refspace = refspace_creator.create_ref_space(); - try - { - linear_solver.set_space(refspace); - linear_solver.solve(); - - if (P_INIT < 3) - { - PostProcessing::VertexBasedLimiter limiter(refspace, linear_solver.get_sln_vector(), P_INIT); - refsln = limiter.get_solution(); - } - else - { - Solution::vector_to_solution(linear_solver.get_sln_vector(), refspace, refsln); - } - - view1.show(refsln); - OGProjection::project_global(fine_space, refsln, sln, HERMES_L2_NORM); - } - catch (Exceptions::Exception& e) - { - std::cout << e.info(); - } - catch (std::exception& e) - { - std::cout << e.what(); - } + // Solve the problem on the reference space. + linear_solver.set_space(refspace); + linear_solver.solve(); + + // Get the Hermes2D Solution object from the solution vector. + Solution::vector_to_solution(linear_solver.get_sln_vector(), refspace, refsln); + + // Project the reference solution to the coarse space in L2 norm for error calculation. + OGProjection::project_global(space, refsln, sln, HERMES_L2_NORM); // Calculate element errors and total error estimate. errorCalculator.calculate_errors(sln, refsln); - double err_est_rel = errorCalculator.get_total_error_squared() * 100; + double total_error_estimate = errorCalculator.get_total_error_squared() * 100; - std::cout << "Error: " << err_est_rel << "%." << std::endl; + view1.show(refsln); - // If err_est_rel too large, adapt the mesh-> - if (err_est_rel < ERR_STOP) - done = true; + std::cout << "Elements: " << ref_mesh->get_num_active_elements() << ", Error: " << total_error_estimate << "%." << std::endl; + + // If error is too large, adapt the (coarse) space. + if (total_error_estimate > ERR_STOP) + adaptivity.adapt(&selector); else - done = adaptivity.adapt(&selector); - as++; + done = true; + + adaptivity_step++; } while (done == false); // Wait for keyboard or mouse input. View::wait(); return 0; -} +} \ No newline at end of file diff --git a/hermes2d/test_examples/10-linear-advection-dg-adapt/test/main.cpp b/hermes2d/test_examples/10-linear-advection-dg-adapt/test/main.cpp index 9c45b60a8d..fc15a95ecc 100644 --- a/hermes2d/test_examples/10-linear-advection-dg-adapt/test/main.cpp +++ b/hermes2d/test_examples/10-linear-advection-dg-adapt/test/main.cpp @@ -84,7 +84,7 @@ int main(int argc, char* args[]) CustomWeakForm wf("Bdy_bottom_left", mesh); // Initialize the FE problem. - DiscreteProblemLinear dp(&wf, space); + DiscreteProblemLinear dp(wf, space); // Initialize linear solver. Hermes::Hermes2D::LinearSolver linear_solver(&dp); diff --git a/hermes2d/test_examples/11-transient-adapt/definitions.cpp b/hermes2d/test_examples/11-transient-adapt/definitions.cpp index 8aed65e8e8..333bb93463 100644 --- a/hermes2d/test_examples/11-transient-adapt/definitions.cpp +++ b/hermes2d/test_examples/11-transient-adapt/definitions.cpp @@ -1,6 +1,6 @@ #include "definitions.h" -CustomNonlinearity::CustomNonlinearity(double alpha): Hermes1DFunction() +CustomNonlinearity::CustomNonlinearity(double alpha) : Hermes1DFunction() { this->is_const = false; this->alpha = alpha; @@ -12,7 +12,7 @@ double CustomNonlinearity::value(double u) const } Ord CustomNonlinearity::value(Ord u) const -{ +{ return Ord(10); } @@ -26,38 +26,37 @@ Ord CustomNonlinearity::derivative(Ord u) const return Ord(10); } -EssentialBCNonConst::EssentialBCNonConst(std::string marker) : EssentialBoundaryCondition(Hermes::vector()) +EssentialBCNonConst::EssentialBCNonConst(std::string marker) : EssentialBoundaryCondition(std::vector()) { markers.push_back(marker); } -EssentialBoundaryCondition::EssentialBCValueType EssentialBCNonConst::get_value_type() const -{ - return EssentialBoundaryCondition::BC_FUNCTION; +EssentialBCValueType EssentialBCNonConst::get_value_type() const +{ + return BC_FUNCTION; } -double EssentialBCNonConst::value(double x, double y, double n_x, double n_y, double t_x, double t_y) const +double EssentialBCNonConst::value(double x, double y) const { return (x + 10) * (y + 10) / 100.; } - -void CustomInitialCondition::derivatives (double x, double y, double& dx, double& dy) const +void CustomInitialCondition::derivatives(double x, double y, double& dx, double& dy) const { - dx = (y + 10)/100.; - dy = (x + 10)/100.; + dx = (y + 10) / 100.; + dy = (x + 10) / 100.; }; -double CustomInitialCondition::value (double x, double y) const +double CustomInitialCondition::value(double x, double y) const { return (x + 10) * (y + 10) / 100.; } -Ord CustomInitialCondition::ord(double x, double y) const +Ord CustomInitialCondition::ord(double x, double y) const { return Hermes::Ord((x + 10) * (y + 10) / 100.); } - + MeshFunction* CustomInitialCondition::clone() const { return new CustomInitialCondition(this->mesh); diff --git a/hermes2d/test_examples/11-transient-adapt/definitions.h b/hermes2d/test_examples/11-transient-adapt/definitions.h index 9aa155735d..26a51bc158 100644 --- a/hermes2d/test_examples/11-transient-adapt/definitions.h +++ b/hermes2d/test_examples/11-transient-adapt/definitions.h @@ -32,7 +32,7 @@ class EssentialBCNonConst : public EssentialBoundaryCondition virtual EssentialBCValueType get_value_type() const; - virtual double value(double x, double y, double n_x, double n_y, double t_x, double t_y) const; + virtual double value(double x, double y) const; }; /* Initial condition */ diff --git a/hermes2d/test_examples/11-transient-adapt/main.cpp b/hermes2d/test_examples/11-transient-adapt/main.cpp index 1751b5624e..b4b0c44979 100644 --- a/hermes2d/test_examples/11-transient-adapt/main.cpp +++ b/hermes2d/test_examples/11-transient-adapt/main.cpp @@ -6,8 +6,8 @@ using namespace RefinementSelectors; using namespace Views; // This example is derived from example P03-timedep/03-nonlinear -// and it shows how automatic adaptivity in space can be combined with -// arbitrary Runge-Kutta methods in time. The example uses fixed time +// and it shows how automatic adaptivity in space can be combined with +// arbitrary Runge-Kutta methods in time. The example uses fixed time // step size. // // For a list of available R-K methods see the file hermes_common/tables.h. @@ -18,7 +18,7 @@ using namespace Views; // Nonlinearity: lambda(u) = 1 + pow(u, alpha). // // Domain: square (-10, 10)^2. -// +// // BC: Nonconstant Dirichlet. // // IC: Custom initial condition matching the BC. @@ -32,7 +32,7 @@ const bool HERMES_VISUALIZATION = true; const int INIT_REF_NUM = 3; // Initial polynomial degree of all mesh elements. const int P_INIT = 1; -// Time step. +// Time step. double time_step = 0.05; // Time interval length. const double T_FINAL = 3.0; @@ -40,13 +40,13 @@ const double T_FINAL = 3.0; // Error calculation & adaptivity. // Every UNREF_FREQth time step the mesh is derefined. const int UNREF_FREQ = 2; -// 1... mesh reset to basemesh and poly degrees to P_INIT. +// 1... mesh reset to basemesh and poly degrees to P_INIT. // 2... one ref. layer shaved off, poly degrees reset to P_INIT. -// 3... one ref. layer shaved off, poly degrees decreased by one. +// 3... one ref. layer shaved off, poly degrees decreased by one. const int UNREF_METHOD = 3; // This is a quantitative parameter of the adapt(...) function and // it has different meanings for various adaptive strategies. -const double THRESHOLD = 0.3; +const double THRESHOLD = 0.75; DefaultErrorCalculator errorCalculator(RelativeErrorToGlobalNorm, 1); // Stopping criterion for an adaptivity step. AdaptStoppingCriterionSingleElement stoppingCriterion(THRESHOLD); @@ -61,7 +61,7 @@ const double ERR_STOP = 5e-2; // Stopping criterion for Newton on fine mesh-> const double NEWTON_TOL = 1e-5; // Maximum allowed number of Newton iterations. -const int max_allowed_iterations = 20; +const int NEWTON_MAX_ITER = 20; // Choose one of the following time-integration methods, or define your own Butcher's table. The last number // in the name of each method is its order. The one before last, if present, is the number of stages. @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) // Initialize the weak formulation CustomNonlinearity lambda(alpha); Hermes2DFunction f(heat_src); - CustomWeakFormPoisson wf(&lambda, &f); + WeakFormSharedPtr wf(new CustomWeakFormPoisson(&lambda, &f)); // Next time level solution. MeshFunctionSharedPtr sln_time_new(new Solution(mesh)); @@ -136,7 +136,7 @@ int main(int argc, char* argv[]) } // Initialize Runge-Kutta time stepping. - RungeKutta runge_kutta(&wf, space, &bt); + RungeKutta runge_kutta(wf, space, &bt); // Time stepping loop. double current_time = 0; int ts = 1; @@ -169,7 +169,7 @@ int main(int argc, char* argv[]) do { Hermes::Mixins::Loggable::Static::info("Time step %d, adaptivity step %d:", ts, as); - // Construct globally refined reference mesh and setup reference space-> + // Construct globally refined reference mesh and setup reference space. Mesh::ReferenceMeshCreator ref_mesh_creator(mesh); MeshSharedPtr ref_mesh = ref_mesh_creator.create_ref_mesh(); Space::ReferenceSpaceCreator ref_space_creator(space, ref_mesh); @@ -183,7 +183,7 @@ int main(int argc, char* argv[]) runge_kutta.set_verbose_output(true); runge_kutta.set_time(current_time); runge_kutta.set_time_step(time_step); - runge_kutta.set_tolerance(NEWTON_TOL); + runge_kutta.set_newton_tolerance(NEWTON_TOL); runge_kutta.rk_time_step_newton(sln_time_prev, sln_time_new); } catch (Exceptions::Exception& e) @@ -209,7 +209,7 @@ int main(int argc, char* argv[]) Hermes::Mixins::Loggable::Static::info("ndof_coarse: %d, ndof_ref: %d, err_est_rel: %g%%", Space::get_num_dofs(space), Space::get_num_dofs(ref_space), err_est_rel); - // If err_est too large, adapt the mesh-> + // If err_est too large, adapt the mesh. if (err_est_rel < ERR_STOP) done = true; else { @@ -243,4 +243,4 @@ int main(int argc, char* argv[]) if (HERMES_VISUALIZATION) View::wait(); return 0; -} +} \ No newline at end of file diff --git a/hermes2d/test_examples/12-picard/definitions.cpp b/hermes2d/test_examples/12-picard/definitions.cpp index 0eb72b003e..a601b9ff42 100644 --- a/hermes2d/test_examples/12-picard/definitions.cpp +++ b/hermes2d/test_examples/12-picard/definitions.cpp @@ -1,6 +1,6 @@ #include "definitions.h" -CustomNonlinearity::CustomNonlinearity(double alpha): Hermes1DFunction() +CustomNonlinearity::CustomNonlinearity(double alpha) : Hermes1DFunction() { this->is_const = false; this->alpha = alpha; @@ -16,9 +16,9 @@ Ord CustomNonlinearity::value(Ord u) const return Ord(10); } -CustomWeakFormPicard::CustomWeakFormPicard(MeshFunctionSharedPtr prev_iter_sln, - Hermes1DFunction* lambda, - Hermes2DFunction* f) +CustomWeakFormPicard::CustomWeakFormPicard(MeshFunctionSharedPtr prev_iter_sln, + Hermes1DFunction* lambda, + Hermes2DFunction* f) : WeakForm(1) { // Jacobian. @@ -30,24 +30,24 @@ CustomWeakFormPicard::CustomWeakFormPicard(MeshFunctionSharedPtr prev_it add_vector_form(vector_form); } -double CustomWeakFormPicard::CustomJacobian::value(int n, double *wt, Func *u_ext[], - Func *u, Func *v, - Geom *e, Func **ext) const +double CustomWeakFormPicard::CustomJacobian::value(int n, double *wt, Func *u_ext[], + Func *u, Func *v, + GeomVol *e, Func **ext) const { double result = 0; - for (int i = 0; i < n; i++) + for (int i = 0; i < n; i++) { result += wt[i] * lambda->value(u_ext[0]->val[i]) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]); } return result; } -Ord CustomWeakFormPicard::CustomJacobian::ord(int n, double *wt, Func *u_ext[], - Func *u, Func *v, - Geom *e, Func **ext) const +Ord CustomWeakFormPicard::CustomJacobian::ord(int n, double *wt, Func *u_ext[], + Func *u, Func *v, + GeomVol *e, Func **ext) const { Ord result = Ord(0); - for (int i = 0; i < n; i++) + for (int i = 0; i < n; i++) { result += wt[i] * lambda->value(u_ext[0]->val[i]) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]); } @@ -60,21 +60,21 @@ MatrixFormVol* CustomWeakFormPicard::CustomJacobian::clone() const } double CustomWeakFormPicard::CustomResidual::value(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { double result = 0; - for (int i = 0; i < n; i++) + for (int i = 0; i < n; i++) { result -= wt[i] * f->value(e->x[i], e->y[i]) * v->val[i]; } return result; } -Ord CustomWeakFormPicard::CustomResidual::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const +Ord CustomWeakFormPicard::CustomResidual::ord(int n, double *wt, Func *u_ext[], Func *v, + GeomVol *e, Func **ext) const { Ord result = Ord(0); - for (int i = 0; i < n; i++) + for (int i = 0; i < n; i++) { result += wt[i] * f->value(e->x[i], e->y[i]) * v->val[i]; } @@ -86,13 +86,12 @@ VectorFormVol* CustomWeakFormPicard::CustomResidual::clone() const return new CustomResidual(this->i, this->lambda, this->f); } -EssentialBoundaryCondition::EssentialBCValueType CustomEssentialBCNonConst::get_value_type() const +EssentialBCValueType CustomEssentialBCNonConst::get_value_type() const { - return EssentialBoundaryCondition::BC_FUNCTION; + return BC_FUNCTION; } -double CustomEssentialBCNonConst::value(double x, double y, double n_x, double n_y, - double t_x, double t_y) const +double CustomEssentialBCNonConst::value(double x, double y) const { - return (x+10) * (y+10) / 100.; -} + return (x + 10) * (y + 10) / 100.; +} \ No newline at end of file diff --git a/hermes2d/test_examples/12-picard/definitions.h b/hermes2d/test_examples/12-picard/definitions.h index 0d9aeff810..daebf0061e 100644 --- a/hermes2d/test_examples/12-picard/definitions.h +++ b/hermes2d/test_examples/12-picard/definitions.h @@ -37,10 +37,10 @@ class CustomWeakFormPicard : public WeakForm CustomJacobian(int i, int j, Hermes1DFunction* lambda) : MatrixFormVol(i, j), lambda(lambda) {}; virtual double value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; MatrixFormVol* clone() const; @@ -57,10 +57,10 @@ class CustomWeakFormPicard : public WeakForm } virtual double value(int n, double *wt, Func *u_ext[], - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; VectorFormVol* clone() const; @@ -76,13 +76,12 @@ class CustomEssentialBCNonConst : public EssentialBoundaryCondition { public: CustomEssentialBCNonConst(std::string marker) - : EssentialBoundaryCondition(Hermes::vector()) + : EssentialBoundaryCondition(std::vector()) { this->markers.push_back(marker); }; - virtual EssentialBoundaryCondition::EssentialBCValueType get_value_type() const; + virtual EssentialBCValueType get_value_type() const; - virtual double value(double x, double y, double n_x, double n_y, - double t_x, double t_y) const; + virtual double value(double x, double y) const; }; diff --git a/hermes2d/test_examples/12-picard/main.cpp b/hermes2d/test_examples/12-picard/main.cpp index 152906edb3..9206aa5522 100644 --- a/hermes2d/test_examples/12-picard/main.cpp +++ b/hermes2d/test_examples/12-picard/main.cpp @@ -6,7 +6,7 @@ using namespace RefinementSelectors; // This example uses the Picard's method to solve a nonlinear problem. -// Try to run this example with PICARD_NUM_LAST_ITER_USED = 1 for +// Try to run this example with PICARD_NUM_LAST_ITER_USED = 1 for // comparison (Anderson acceleration turned off).) // // PDE: Stationary heat transfer equation with nonlinear thermal @@ -35,11 +35,11 @@ const double INIT_COND_CONST = 3.0; MatrixSolverType matrix_solver = SOLVER_UMFPACK; // Picard's method. -// Number of last iterations used. +// Number of last iterations used. // 1... standard fixed point. // >1... Anderson acceleration. const int PICARD_NUM_LAST_ITER_USED = 4; -// 0 <= beta <= 1... parameter for the Anderson acceleration. +// 0 <= beta <= 1... parameter for the Anderson acceleration. const double PICARD_ANDERSON_BETA = 0.2; // Stopping criterion for the Picard's method. const double PICARD_TOL = 1e-3; @@ -76,14 +76,10 @@ int main(int argc, char* argv[]) // Initialize the weak formulation. CustomNonlinearity lambda(alpha); Hermes2DFunction src(-heat_src); - CustomWeakFormPicard wf(sln_prev_iter, &lambda, &src); - - // Initialize the FE problem. - DiscreteProblem dp(&wf, space); - dp.set_linear(); + WeakFormSharedPtr wf(new CustomWeakFormPicard(sln_prev_iter, &lambda, &src)); // Initialize the Picard solver. - PicardSolver picard(&dp); + PicardSolver picard(wf, space); picard.use_Anderson_acceleration(false); // Perform the Picard's iteration (Anderson acceleration on by default). @@ -104,7 +100,7 @@ int main(int argc, char* argv[]) std::cout << e.what(); } - // Translate the coefficient vector into a Solution. + // Translate the coefficient vector into a Solution. MeshFunctionSharedPtr sln(new Solution); Solution::vector_to_solution(picard.get_sln_vector(), space, sln); @@ -118,5 +114,4 @@ int main(int argc, char* argv[]) // Wait for all views to be closed. View::wait(); return 0; -} - +} \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/CMakeLists.txt b/hermes2d/test_examples/13-FCT/CMakeLists.txt index 2d9aa3e175..f97f1a8391 100644 --- a/hermes2d/test_examples/13-FCT/CMakeLists.txt +++ b/hermes2d/test_examples/13-FCT/CMakeLists.txt @@ -1,9 +1,11 @@ -project(13-FCT-solid_body_rotation) +if(WITH_UMFPACK) + project(13-FCT-solid_body_rotation) -add_executable(${PROJECT_NAME} main.cpp definitions.cpp lumped_projection.cpp hp_adapt.cpp highOrder.cpp lowOrder.cpp fct.cpp reg_estimator.cpp prev_solution.cpp) + add_executable(${PROJECT_NAME} main.cpp definitions.cpp lumped_projection.cpp hp_adapt.cpp highOrder.cpp lowOrder.cpp fct.cpp reg_estimator.cpp prev_solution.cpp) -if(NOT MSVC) - set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_FLAGS ${HERMES_FLAGS}) -endif() + if(NOT MSVC) + set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_FLAGS ${HERMES_FLAGS}) + endif() -target_link_libraries(${PROJECT_NAME} ${HERMES2D}) + target_link_libraries(${PROJECT_NAME} ${HERMES2D}) +endif(WITH_UMFPACK) diff --git a/hermes2d/test_examples/13-FCT/definitions.cpp b/hermes2d/test_examples/13-FCT/definitions.cpp index 3260dba893..fb954377d8 100644 --- a/hermes2d/test_examples/13-FCT/definitions.cpp +++ b/hermes2d/test_examples/13-FCT/definitions.cpp @@ -1,156 +1,141 @@ #include "definitions.h" -//---------------mass-matrix/tau----------- - CustomWeakFormMassmatrix::CustomWeakFormMassmatrix(double time_step) : WeakForm(1) - { - add_matrix_form(new CustomMatrixFormVolMassmatrix(0, 0, time_step)); - } - +// ---------------mass-matrix/tau----------- +CustomWeakFormMassmatrix::CustomWeakFormMassmatrix(double time_step) : WeakForm(1) +{ + add_matrix_form(new CustomMatrixFormVolMassmatrix(0, 0, time_step)); +} - template - Scalar CustomMatrixFormVolMassmatrix::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const - { - Scalar result = Scalar(0); - for (int i = 0; i < n; i++) - result += wt[i] * (u->val[i] * v->val[i])/time_step; - return result; - }; +template +Scalar CustomMatrixFormVolMassmatrix::matrix_form(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const +{ + Scalar result = Scalar(0); + for (int i = 0; i < n; i++) + result += wt[i] * (u->val[i] * v->val[i]) / time_step; + return result; +}; - double CustomMatrixFormVolMassmatrix::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const - { - return matrix_form(n, wt, u_ext, u, v, e, ext); - }; +double CustomMatrixFormVolMassmatrix::value(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const +{ + return matrix_form(n, wt, u_ext, u, v, e, ext); +}; - Ord CustomMatrixFormVolMassmatrix::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const - { - return matrix_form(n, wt, u_ext, u, v, e, ext); - }; +Ord CustomMatrixFormVolMassmatrix::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, + GeomVol *e, Func **ext) const +{ + return matrix_form(n, wt, u_ext, u, v, e, ext); +}; MatrixFormVol* CustomMatrixFormVolMassmatrix::clone() const { return new CustomMatrixFormVolMassmatrix(*this); } +// ---------------Convection----------- -//---------------Convection----------- - - CustomWeakFormConvection::CustomWeakFormConvection() : WeakForm(1) - { - add_matrix_form(new CustomMatrixFormVolConvection(0, 0)); - }; - - - template - Scalar CustomMatrixFormVolConvection::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const - { - Scalar result = Scalar(0); - for (int i = 0; i < n; i++) - result += -wt[i] * (v->val[i] *(u->dx[i] * (0.5- e->y[i]) + u->dy[i] * (e->x[i]-0.5) )); - return result; - - }; - - double CustomMatrixFormVolConvection::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const - { - return matrix_form(n, wt, u_ext, u, v, e, ext); - }; +CustomWeakFormConvection::CustomWeakFormConvection() : WeakForm(1) +{ + add_matrix_form(new CustomMatrixFormVolConvection(0, 0)); +}; - Ord CustomMatrixFormVolConvection::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const - { - return matrix_form(n, wt, u_ext, u, v, e, ext); - }; +template +Scalar CustomMatrixFormVolConvection::matrix_form(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const +{ + Scalar result = Scalar(0); + for (int i = 0; i < n; i++) + result += -wt[i] * (v->val[i] * (u->dx[i] * (0.5 - e->y[i]) + u->dy[i] * (e->x[i] - 0.5))); + return result; +}; - MatrixFormVol* CustomMatrixFormVolConvection::clone() const +double CustomMatrixFormVolConvection::value(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { - return new CustomMatrixFormVolConvection(*this); - } + return matrix_form(n, wt, u_ext, u, v, e, ext); +}; +Ord CustomMatrixFormVolConvection::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, + GeomVol *e, Func **ext) const +{ + return matrix_form(n, wt, u_ext, u, v, e, ext); +}; +MatrixFormVol* CustomMatrixFormVolConvection::clone() const +{ + return new CustomMatrixFormVolConvection(*this); +} -//------------------- Initial condition ---------------- +// ------------------- Initial condition ---------------- -void CustomInitialCondition::derivatives(double x, double y, double& dx, double& dy) const +void CustomInitialCondition::derivatives(double x, double y, double& dx, double& dy) const { - double radius = 0.; - //hump - double x_0 =0.25; - double y_0= 0.5; - radius = (1.0/0.15) * std::sqrt( std::pow((x-x_0),2.0) + std::pow((y-y_0),2.0)); - if( radius<= 1.0) - { - dx = -std::sin(radius*PI)/4.0*(PI/(0.15 * std::sqrt( std::pow((x-x_0),2.0) + std::pow((y-y_0),2.0))))*2*x; - dy = -std::sin(radius*PI)/4.0*(PI/(0.15 * std::sqrt( std::pow((x-x_0),2.0) + std::pow((y-y_0),2.0))))*2*y; - } - else - { - //cone - x_0 = 0.5; - y_0 = 0.25; - radius = 1.0/0.15 * std::sqrt( std::pow((x-x_0),2.0) + std::pow((y-y_0),2.0)); - if((radius< 1.0)&&(x!=x_0)) - { - dx = -(1.0/(0.15 * std::sqrt( std::pow((x-x_0),2.0) + std::pow((y-y_0),2.0))))*2*x; - dy = -(1.0/(0.15 * std::sqrt( std::pow((x-x_0),2.0) + std::pow((y-y_0),2.0))))*2*y; - } - else - { - dx=0.; dy=0.; - } - - } - - + // hump + double x_0 = 0.25; + double y_0 = 0.5; + radius = (1.0 / 0.15) * std::sqrt(std::pow((x - x_0), 2.0) + std::pow((y - y_0), 2.0)); + if (radius <= 1.0) + { + dx = -std::sin(radius*PI) / 4.0*(PI / (0.15 * std::sqrt(std::pow((x - x_0), 2.0) + std::pow((y - y_0), 2.0)))) * 2 * x; + dy = -std::sin(radius*PI) / 4.0*(PI / (0.15 * std::sqrt(std::pow((x - x_0), 2.0) + std::pow((y - y_0), 2.0)))) * 2 * y; + } + else + { + // cone + x_0 = 0.5; + y_0 = 0.25; + radius = 1.0 / 0.15 * std::sqrt(std::pow((x - x_0), 2.0) + std::pow((y - y_0), 2.0)); + if ((radius < 1.0) && (x != x_0)) + { + dx = -(1.0 / (0.15 * std::sqrt(std::pow((x - x_0), 2.0) + std::pow((y - y_0), 2.0)))) * 2 * x; + dy = -(1.0 / (0.15 * std::sqrt(std::pow((x - x_0), 2.0) + std::pow((y - y_0), 2.0)))) * 2 * y; + } + else + { + dx = 0.; dy = 0.; + } + } }; - double CustomInitialCondition::value(double x, double y) const +double CustomInitialCondition::value(double x, double y) const { - double result = 0.0; - double radius; - //hump - double x_0 =0.25; - double y_0= 0.5; - radius = (1.0/0.15) * std::sqrt( std::pow((x-x_0),2.0) + std::pow((y-y_0),2.0)); - if( radius<= 1.0) - { - result = (1.0+ std::cos(PI*radius))/4.0; - return result; - } - //slotted cylinder - x_0 = 0.5; - y_0 = 0.75; - radius = 1.0/0.15 * std::sqrt( std::pow((x-x_0),2.0) + std::pow((y-y_0),2.0)); - if(radius <= 1) - { - if(fabs((x-x_0))>= 0.025) return 1.0; - if(y>=0.85) return 1.0; - } - //cone - x_0 = 0.5; - y_0 = 0.25; - radius = 1.0/0.15 * std::sqrt( std::pow((x-x_0),2.0) + std::pow((y-y_0),2.0)); - if(radius<= 1.0) - { - result = 1.0-radius; - } - return result; + double radius; + // hump + double x_0 = 0.25; + double y_0 = 0.5; + radius = (1.0 / 0.15) * std::sqrt(std::pow((x - x_0), 2.0) + std::pow((y - y_0), 2.0)); + if (radius <= 1.0) + { + result = (1.0 + std::cos(PI*radius)) / 4.0; + return result; + } + // slotted cylinder + x_0 = 0.5; + y_0 = 0.75; + radius = 1.0 / 0.15 * std::sqrt(std::pow((x - x_0), 2.0) + std::pow((y - y_0), 2.0)); + if (radius <= 1) + { + if (fabs((x - x_0)) >= 0.025) return 1.0; + if (y >= 0.85) return 1.0; + } + // cone + x_0 = 0.5; + y_0 = 0.25; + radius = 1.0 / 0.15 * std::sqrt(std::pow((x - x_0), 2.0) + std::pow((y - y_0), 2.0)); + if (radius <= 1.0) + { + result = 1.0 - radius; + } + return result; }; - Ord CustomInitialCondition::ord(double x, double y) const - { - return Ord(10); - }; - MeshFunction* CustomInitialCondition::clone() const - { - return new CustomInitialCondition(this->mesh); - - } - - - +Ord CustomInitialCondition::ord(double x, double y) const +{ + return Ord(10); +}; +MeshFunction* CustomInitialCondition::clone() const +{ + return new CustomInitialCondition(this->mesh); +} \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/definitions.h b/hermes2d/test_examples/13-FCT/definitions.h index a82f2667b9..b6f5a264da 100644 --- a/hermes2d/test_examples/13-FCT/definitions.h +++ b/hermes2d/test_examples/13-FCT/definitions.h @@ -21,13 +21,13 @@ class CustomMatrixFormVolMassmatrix : public MatrixFormVol template Scalar matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual double value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; MatrixFormVol* clone() const; @@ -51,13 +51,13 @@ class CustomMatrixFormVolConvection : public MatrixFormVol template Scalar matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual double value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; MatrixFormVol* clone() const; }; diff --git a/hermes2d/test_examples/13-FCT/fct.cpp b/hermes2d/test_examples/13-FCT/fct.cpp index 37e6ea7638..ca36527532 100644 --- a/hermes2d/test_examples/13-FCT/fct.cpp +++ b/hermes2d/test_examples/13-FCT/fct.cpp @@ -3,58 +3,54 @@ Flux_Correction::Flux_Correction(double theta) { this->theta = theta; - fct = nullptr; - space =nullptr; - al = new AsmList; - P_plus= nullptr; P_minus= nullptr; Q_plus= nullptr; Q_minus= nullptr; R_plus= nullptr; R_minus= nullptr; + fct = nullptr; + space = nullptr; + al = new AsmList < double > ; + P_plus = nullptr; P_minus = nullptr; Q_plus = nullptr; Q_minus = nullptr; R_plus = nullptr; R_minus = nullptr; }; Flux_Correction::~Flux_Correction() { free(); delete al; - }; void Flux_Correction::free() { - if(P_plus!=nullptr) delete [] P_plus; - if(P_minus!=nullptr) delete [] P_minus; - if(Q_plus!=nullptr) delete [] Q_plus; - if(Q_minus!=nullptr) delete [] Q_minus; - if(R_plus!=nullptr) delete [] R_plus; - if(R_minus!=nullptr) delete [] R_minus; - if(fct!=nullptr) delete [] fct; - + if (P_plus != nullptr) delete[] P_plus; + if (P_minus != nullptr) delete[] P_minus; + if (Q_plus != nullptr) delete[] Q_plus; + if (Q_minus != nullptr) delete[] Q_minus; + if (R_plus != nullptr) delete[] R_plus; + if (R_minus != nullptr) delete[] R_minus; + if (fct != nullptr) delete[] fct; }; - - void Flux_Correction::init(SpaceSharedPtr new_space) { free(); - space = new_space; + space = new_space; int ndof = space->get_num_dofs(); - fct = new bool[ndof]; + fct = new bool[ndof]; P_plus = new double[ndof]; P_minus = new double[ndof]; - Q_plus = new double[ndof]; Q_minus = new double[ndof]; + Q_plus = new double[ndof]; Q_minus = new double[ndof]; R_plus = new double[ndof]; R_minus = new double[ndof]; - for(int i=0; iget_mesh()) - { - if((space->get_element_order(e->id)== H2D_MAKE_QUAD_ORDER(1, 1))||(space->get_element_order(e->id)==1)) + { + if ((space->get_element_order(e->id) == H2D_MAKE_QUAD_ORDER(1, 1)) || (space->get_element_order(e->id) == 1)) { - elem_id= e->id; + elem_id = e->id; for (unsigned int iv = 0; iv < e->get_nvert(); iv++) { - if(e->en[iv]->bnd) + if (e->en[iv]->bnd) continue; // Class for finding all neighbors of the element e on the mesh space->get_mesh(). @@ -63,373 +59,362 @@ void Flux_Correction::init(SpaceSharedPtr new_space) // Look for the neighbors over the edge iv. ns.set_active_edge(iv); // Iterate through the found neighbors. - for(unsigned int i = 0; i < ns.get_neighbors()->size(); i++) + for (unsigned int i = 0; i < ns.get_neighbors()->size(); i++) { id = ns.get_neighbors()->at(i)->id; - if((space->get_element_order(id)== H2D_MAKE_QUAD_ORDER(2, 2))||(space->get_element_order(id)==2)) + if ((space->get_element_order(id) == H2D_MAKE_QUAD_ORDER(2, 2)) || (space->get_element_order(id) == 2)) { - p2_neighbor =true; + p2_neighbor = true; break; } } - if(e->vn[iv]->is_constrained_vertex() ==true) - { - p2_neighbor =true; + if (e->vn[iv]->is_constrained_vertex() == true) + { + p2_neighbor = true; break; } } - if(p2_neighbor==false) + if (p2_neighbor == false) { space->get_element_assembly_list(e, al); for (unsigned int iv = 0; iv < e->get_nvert(); iv++) - { - int index = space->get_shapeset()->get_vertex_index(iv,HERMES_MODE_QUAD); + { + int index = space->get_shapeset()->get_vertex_index(iv, HERMES_MODE_QUAD); Node* vn = e->vn[iv]; if (space->get_element_order(elem_id) == 0) break; if (!vn->is_constrained_vertex()) - { - for(unsigned int j = 0; j < al->get_cnt(); j ++) - { - if((al->get_idx()[j]==index)&&(al->get_dof()[j]!=-1.0)) - { - if(fct[al->get_dof()[j]]==false) - fct[al->get_dof()[j]]=true; + { + for (unsigned int j = 0; j < al->get_cnt(); j++) + { + if ((al->get_idx()[j] == index) && (al->get_dof()[j] != -1.0)) + { + if (fct[al->get_dof()[j]] == false) + fct[al->get_dof()[j]] = true; } } } - } - } - else - p2_neighbor =false; + } + } + else + p2_neighbor = false; } } - } - - CSCMatrix* Flux_Correction::artificialDiffusion(CSCMatrix* conv_matrix) { - if(fct==nullptr) + if (fct == nullptr) throw Exceptions::Exception("fct-list=nullptr"); int size = conv_matrix->get_size(); int nnz = conv_matrix->get_nnz(); - double a,b; - CSCMatrix* diffusion = new CSCMatrix; - diffusion->create(size, nnz, conv_matrix->get_Ap(), conv_matrix->get_Ai(),conv_matrix->get_Ax()); - diffusion->zero(); + double a, b; + CSCMatrix* diffusion = new CSCMatrix < double > ; + diffusion->create(size, nnz, conv_matrix->get_Ap(), conv_matrix->get_Ai(), conv_matrix->get_Ax()); + diffusion->zero(); double* Ax = conv_matrix->get_Ax(); int* Ai = conv_matrix->get_Ai(); int* Ap = conv_matrix->get_Ap(); - for(int j = 0; jget(j,i); - if((a>=b)&&(a>0.0)) + a = -Ax[indx]; + b = -conv_matrix->get(j, i); + if ((a >= b) && (a > 0.0)) { - diffusion->add(j,i,a); - diffusion->add(i,j,a); - diffusion->add(j,j,-a); - diffusion->add(i,i,-a); + diffusion->add(j, i, a); + diffusion->add(i, j, a); + diffusion->add(j, j, -a); + diffusion->add(i, i, -a); } - else if((b>a)&&(b>0.0)) + else if ((b > a) && (b > 0.0)) { - diffusion->add(i,j,b); - diffusion->add(j,i,b); - diffusion->add(j,j,-b); - diffusion->add(i,i,-b); + diffusion->add(i, j, b); + diffusion->add(j, i, b); + diffusion->add(j, j, -b); + diffusion->add(i, i, -b); } } } } - return diffusion; - } - CSCMatrix* Flux_Correction::massLumping(CSCMatrix* mass_matrix) -{ - if(fct==nullptr) +{ + if (fct == nullptr) throw Exceptions::Exception("fct-list=nullptr"); - CSCMatrix* lumped_matrix = new CSCMatrix; //M_L + //M_L + CSCMatrix* lumped_matrix = new CSCMatrix < double > ; int size = mass_matrix->get_size(); int nnz = mass_matrix->get_nnz(); - lumped_matrix->create(size, nnz, mass_matrix->get_Ap(), mass_matrix->get_Ai(),mass_matrix->get_Ax()); + lumped_matrix->create(size, nnz, mass_matrix->get_Ap(), mass_matrix->get_Ai(), mass_matrix->get_Ax()); double* Ax = lumped_matrix->get_Ax(); int* Ai = lumped_matrix->get_Ai(); int* Ap = lumped_matrix->get_Ap(); - double a =0.0; + double a = 0.0; - for(int j = 0; jadd(i,i,a); - lumped_matrix->add(j,j,a); - lumped_matrix->add(i,j,-a); - lumped_matrix->add(j,i,-a); - } + lumped_matrix->add(i, i, a); + lumped_matrix->add(j, j, a); + lumped_matrix->add(i, j, -a); + lumped_matrix->add(j, i, -a); + } } } } return lumped_matrix; } - - //Assemble antidiffusive fluxes & limit these -void Flux_Correction::antidiffusiveFlux(CSCMatrix* mass_matrix,CSCMatrix* lumped_matrix,CSCMatrix* conv_matrix,CSCMatrix* diffusion,double* u_high, double* u_L, double* u_old,double* flux_scalar,double time_step,Regularity_Estimator* regEst) -{ - if(fct==nullptr) throw Exceptions::Exception("fct-list=nullptr"); +void Flux_Correction::antidiffusiveFlux(CSCMatrix* mass_matrix, CSCMatrix* lumped_matrix, CSCMatrix* conv_matrix, CSCMatrix* diffusion, double* u_high, double* u_L, double* u_old, double* flux_scalar, double time_step, Regularity_Estimator* regEst) +{ + if (fct == nullptr) throw Exceptions::Exception("fct-list=nullptr"); - int* smooth_dof =nullptr; - if(regEst!=nullptr) smooth_dof = regEst->get_smooth_dofs(space,u_L,mass_matrix); + int* smooth_dof = nullptr; + if (regEst != nullptr) smooth_dof = regEst->get_smooth_dofs(space, u_L, mass_matrix); int ndof = conv_matrix->get_size(); - double alpha,f, plus, minus,mass, diff; + double alpha, f, plus, minus, mass, diff; double* Ax_mass = mass_matrix->get_Ax(); int* Ai_mass = mass_matrix->get_Ai(); int* Ap_mass = mass_matrix->get_Ap(); - for(int i=0; iget(i,j); - f = (mass/time_step+ diff*theta)*(u_high[i]- u_high[j]) - -(mass/time_step - diff*(1.-theta)) *(u_old[i]- u_old[j]); - if( (f*(u_L[j]- u_L[i])) > 0.0) f = 0.0; //prelimiting step - if(f>0.0) - { - P_plus[i]+=f; - P_minus[j]-=f; + diff = diffusion->get(i, j); + f = (mass / time_step + diff*theta)*(u_high[i] - u_high[j]) + - (mass / time_step - diff*(1. - theta)) *(u_old[i] - u_old[j]); + //prelimiting step + if ((f*(u_L[j] - u_L[i])) > 0.0) f = 0.0; + if (f > 0.0) + { + P_plus[i] += f; + P_minus[j] -= f; } else if (f<0.0) { - P_minus[i]+=f; - P_plus[j]-=f; - } - f = lumped_matrix->get(i,i)*(u_L[j]-u_L[i])/time_step; - if(f>Q_plus[i]) Q_plus[i] = f; - if(fget(j,j)*(u_L[i]-u_L[j])/time_step; - if(f>Q_plus[j]) Q_plus[j] = f; - if(fget(i, i)*(u_L[j] - u_L[i]) / time_step; + if (f>Q_plus[i]) Q_plus[i] = f; + if (f < Q_minus[i]) Q_minus[i] = f; + f = lumped_matrix->get(j, j)*(u_L[i] - u_L[j]) / time_step; + if (f > Q_plus[j]) Q_plus[j] = f; + if (f < Q_minus[j]) Q_minus[j] = f; + } + } } - //Compute R - for(int i=0; i=1.0) R_plus[i]= 1.0; - else R_plus[i]= plus; - if(minus>=1.0) R_minus[i]= 1.0; - else R_minus[i]= minus; - if(smooth_dof!=nullptr) + if (fct[i] == false) continue; + plus = 1.0; minus = 1.0; + if (P_plus[i] != 0.0) plus = Q_plus[i] / P_plus[i]; + if (P_minus[i] != 0.0) minus = Q_minus[i] / P_minus[i]; + if (plus >= 1.0) R_plus[i] = 1.0; + else R_plus[i] = plus; + if (minus >= 1.0) R_minus[i] = 1.0; + else R_minus[i] = minus; + if (smooth_dof != nullptr) { - if(smooth_dof[i]==1){ R_plus[i]= 1.0;R_minus[i]= 1.0;} - } + if (smooth_dof[i] == 1){ R_plus[i] = 1.0; R_minus[i] = 1.0; } + } } //Compute alpha & f_i alpha = 1.0; - for(int j = 0; jget(i,j); - f = (mass/time_step+ diff*theta)*(u_high[i]- u_high[j]) - -(mass/time_step - diff*(1.-theta)) *(u_old[i]- u_old[j]); - if( (f*(u_L[j]- u_L[i])) > 0.0) f = 0.0; //prelimiting step - if(f>0.) - { - if(R_plus[i]>R_minus[j]) alpha = R_minus[j]; + diff = diffusion->get(i, j); + f = (mass / time_step + diff*theta)*(u_high[i] - u_high[j]) + - (mass / time_step - diff*(1. - theta)) *(u_old[i] - u_old[j]); + //prelimiting step + if ((f*(u_L[j] - u_L[i])) > 0.0) f = 0.0; + if (f > 0.) + { + if (R_plus[i] > R_minus[j]) alpha = R_minus[j]; else alpha = R_plus[i]; } - else if(f<0.) + else if (f < 0.) { - if(R_minus[i]>R_plus[j]) alpha = R_plus[j]; - else alpha = R_minus[i]; - } + if (R_minus[i] > R_plus[j]) alpha = R_plus[j]; + else alpha = R_minus[i]; + } flux_scalar[i] += alpha*f; - flux_scalar[j] -= alpha*f; + flux_scalar[j] -= alpha*f; } - } + } } - - } -//FCT for projection -void Flux_Correction::lumped_flux_limiter(CSCMatrix* mass_matrix,CSCMatrix* lumped_matrix, double* u_L, double* u_H, double time_step, int* smooth_dof) -{ - if(fct==nullptr) +//FCT for projection +void Flux_Correction::lumped_flux_limiter(CSCMatrix* mass_matrix, CSCMatrix* lumped_matrix, double* u_L, double* u_H, double time_step, int* smooth_dof) +{ + if (fct == nullptr) throw Exceptions::Exception("fct-list=nullptr"); int ndof = mass_matrix->get_size(); double* rhs = new double[ndof]; - lumped_matrix->multiply_with_vector(u_L, rhs, true); + lumped_matrix->multiply_with_vector(u_L, rhs, true); - double alpha,f, plus, minus,mass; + double alpha, f, plus, minus, mass; double* Ax_mass = mass_matrix->get_Ax(); int* Ai_mass = mass_matrix->get_Ai(); int* Ap_mass = mass_matrix->get_Ap(); - - for(int i=0; i 0.0) f = 0.0; //prelimiting step - if(f>0.0) - { - P_plus[i]+=f; - P_minus[j]-=f; + f = mass*(u_H[i] - u_H[j]); + //prelimiting step + if ((f*(u_L[j] - u_L[i])) > 0.0) f = 0.0; + if (f > 0.0) + { + P_plus[i] += f; + P_minus[j] -= f; } - else if(f<0.0) + else if (f<0.0) { - P_minus[i]+=f; - P_plus[j]-=f; - } - f = lumped_matrix->get(i,i)*(u_L[j]-u_L[i]); - if(f>Q_plus[i]) Q_plus[i] = f; - if(fget(j,j)*(u_L[i]-u_L[j]); - if(f>Q_plus[j]) Q_plus[j] = f; - if(fget(i, i)*(u_L[j] - u_L[i]); + if (f>Q_plus[i]) Q_plus[i] = f; + if (f < Q_minus[i]) Q_minus[i] = f; + f = lumped_matrix->get(j, j)*(u_L[i] - u_L[j]); + if (f > Q_plus[j]) Q_plus[j] = f; + if (f < Q_minus[j]) Q_minus[j] = f; } - } + } } - //Compute R - for(int i=0; i=1.0) R_plus[i]= 1.0; - else R_plus[i]= plus; - if(minus>=1.0) R_minus[i]= 1.0; - else R_minus[i]= minus; - if(smooth_dof!=nullptr) + if (fct[i] == false) continue; + plus = 1.0; minus = 1.0; + if (P_plus[i] != 0.0) plus = Q_plus[i] / P_plus[i]; + if (P_minus[i] != 0.0) minus = Q_minus[i] / P_minus[i]; + if (plus >= 1.0) R_plus[i] = 1.0; + else R_plus[i] = plus; + if (minus >= 1.0) R_minus[i] = 1.0; + else R_minus[i] = minus; + if (smooth_dof != nullptr) { - if(smooth_dof[i]==1){ R_plus[i]= 1.0;R_minus[i]= 1.0;} - } - } + if (smooth_dof[i] == 1){ R_plus[i] = 1.0; R_minus[i] = 1.0; } + } + } //Compute alpha & f_i alpha = 1.0; - for(int j = 0; j 0.0) f = 0.0; //prelimiting step - if(f>0.) - { - if(R_plus[i]>R_minus[j]) alpha = R_minus[j]; + f = mass*(u_H[i] - u_H[j]); + //prelimiting step + if ((f*(u_L[j] - u_L[i])) > 0.0) f = 0.0; + if (f > 0.) + { + if (R_plus[i] > R_minus[j]) alpha = R_minus[j]; else alpha = R_plus[i]; } - else if(f<0.) + else if (f < 0.) { - if(R_minus[i]>R_plus[j]) alpha = R_plus[j]; - else alpha = R_minus[i]; - } + if (R_minus[i] > R_plus[j]) alpha = R_plus[j]; + else alpha = R_minus[i]; + } rhs[i] += alpha*f; - rhs[j] -= alpha*f; - + rhs[j] -= alpha*f; } - } + } } - - - SimpleVector* vec_rhs = new SimpleVector(ndof); + SimpleVector* vec_rhs = new SimpleVector(ndof); vec_rhs->zero(); vec_rhs->add_vector(rhs); - double* sol =nullptr; - UMFPackLinearMatrixSolver* lowOrd = new UMFPackLinearMatrixSolver(lumped_matrix,vec_rhs); + double* sol = nullptr; + UMFPackLinearMatrixSolver* lowOrd = new UMFPackLinearMatrixSolver(lumped_matrix, vec_rhs); try { lowOrd->solve(); } - catch(Hermes::Exceptions::Exception e) + catch (Hermes::Exceptions::Exception e) { e.print_msg(); - } + } - for(int i=0; iget_sln_vector()[i]; + for (int i = 0; i < ndof; i++) u_L[i] = lowOrd->get_sln_vector()[i]; - delete lowOrd; + delete lowOrd; delete vec_rhs; - delete [] rhs; + delete[] rhs; } -void Flux_Correction::project_FCT(MeshFunctionSharedPtr sln,double* coeff_vec, double* coeff_vec_2,CSCMatrix* mass_matrix,CSCMatrix* lumped_matrix, double time_step,OGProjection* ogProjection, Lumped_Projection* lumpedProjection, Regularity_Estimator* regEst) +void Flux_Correction::project_FCT(MeshFunctionSharedPtr sln, double* coeff_vec, double* coeff_vec_2, CSCMatrix* mass_matrix, CSCMatrix* lumped_matrix, double time_step, OGProjection* ogProjection, Lumped_Projection* lumpedProjection, Regularity_Estimator* regEst) { - if(sln==nullptr) + if (sln == nullptr) throw Exceptions::Exception("project_FCT: sln=nullptr"); - int* smooth_dof =nullptr; + int* smooth_dof = nullptr; //low-order projection - lumpedProjection->project_lumped(space, sln, coeff_vec, lumped_matrix); - if(regEst!=nullptr) - smooth_dof = regEst->get_smooth_dofs(space,coeff_vec,mass_matrix); //=>in smooth elements no FCT needs to be applied - //high-order projection - ogProjection->project_global(space, sln, coeff_vec_2, HERMES_L2_NORM); - //calculation of fluxes, limiting & explicit correction - lumped_flux_limiter(mass_matrix, lumped_matrix, coeff_vec, coeff_vec_2,time_step,smooth_dof); -} - - + lumpedProjection->project_lumped(space, sln, coeff_vec, lumped_matrix); + if (regEst != nullptr) + //=>in smooth elements no FCT needs to be applied + smooth_dof = regEst->get_smooth_dofs(space, coeff_vec, mass_matrix); + //high-order projection + ogProjection->project_global(space, sln, coeff_vec_2, HERMES_L2_NORM); + //calculation of fluxes, limiting & explicit correction + lumped_flux_limiter(mass_matrix, lumped_matrix, coeff_vec, coeff_vec_2, time_step, smooth_dof); +} \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/highOrder.cpp b/hermes2d/test_examples/13-FCT/highOrder.cpp index 2e45b807cb..bd019cd311 100644 --- a/hermes2d/test_examples/13-FCT/highOrder.cpp +++ b/hermes2d/test_examples/13-FCT/highOrder.cpp @@ -2,72 +2,68 @@ using namespace Hermes; -High_Order::High_Order(double theta): theta(theta) +High_Order::High_Order(double theta) : theta(theta) { - highmat_rhs =new CSCMatrix ;; - high_matrix =new CSCMatrix ;; - u_H =nullptr; + highmat_rhs = new CSCMatrix < double > ;; + high_matrix = new CSCMatrix < double > ;; + u_H = nullptr; } High_Order::~High_Order() { - if(high_matrix!=nullptr) delete high_matrix; - if(highmat_rhs!=nullptr) delete highmat_rhs; - if(u_H!=nullptr) delete [] u_H; + if (high_matrix != nullptr) delete high_matrix; + if (highmat_rhs != nullptr) delete highmat_rhs; + if (u_H != nullptr) delete[] u_H; } -//high-order scheme: (M\tau -theta K) u_H = (M\tau + (1-theta) K) u_n +//high-order scheme: (M\tau -theta K) u_H = (M\tau + (1-theta) K) u_n // high_matrix = (M\tau -theta K); highmat_rhs = (M\tau + (1-theta) K); M/tau = mass_matrix; K = conv_matrix void High_Order::assemble_High_Order(CSCMatrix * conv_matrix, CSCMatrix * mass_matrix) { - if(high_matrix!=nullptr) + if (high_matrix != nullptr) high_matrix->free(); - if(highmat_rhs!=nullptr) + if (highmat_rhs != nullptr) highmat_rhs->free(); - high_matrix->create(conv_matrix->get_size(),conv_matrix->get_nnz(), conv_matrix->get_Ap(), conv_matrix->get_Ai(),conv_matrix->get_Ax()); + high_matrix->create(conv_matrix->get_size(), conv_matrix->get_nnz(), conv_matrix->get_Ap(), conv_matrix->get_Ai(), conv_matrix->get_Ax()); high_matrix->multiply_with_Scalar(-theta); - high_matrix->add_sparse_matrix(mass_matrix); - highmat_rhs->create(conv_matrix->get_size(),conv_matrix->get_nnz(), conv_matrix->get_Ap(), conv_matrix->get_Ai(),conv_matrix->get_Ax()); - if(theta!=0.) - highmat_rhs->multiply_with_Scalar((1.0-theta)); - highmat_rhs->add_sparse_matrix(mass_matrix); + high_matrix->add_sparse_matrix(mass_matrix); + highmat_rhs->create(conv_matrix->get_size(), conv_matrix->get_nnz(), conv_matrix->get_Ap(), conv_matrix->get_Ai(), conv_matrix->get_Ax()); + if (theta != 0.) + highmat_rhs->multiply_with_Scalar((1.0 - theta)); + highmat_rhs->add_sparse_matrix(mass_matrix); } -// (M\tau -theta K) u_H = (M\tau + (1-theta) K) u_n +// (M\tau -theta K) u_H = (M\tau + (1-theta) K) u_n double* High_Order::solve_High_Order(double* u_n) { int ndof = high_matrix->get_size(); - if((high_matrix==nullptr)||(highmat_rhs==nullptr) ) + if ((high_matrix == nullptr) || (highmat_rhs == nullptr)) throw Exceptions::Exception("matrices have to be calculated first, call High_Order::assemble_High_Order()."); - if(u_H!=nullptr) delete [] u_H; - u_H = new double[ndof]; + if (u_H != nullptr) delete[] u_H; + u_H = new double[ndof]; double* coeff_vec_2 = new double[ndof]; - SimpleVector * vec_rhs = new SimpleVector (ndof); + SimpleVector * vec_rhs = new SimpleVector(ndof); //----------vec_rhs = (M\tau + (1-theta) K) u_n -------- - highmat_rhs->multiply_with_vector(u_n, coeff_vec_2, true); + highmat_rhs->multiply_with_vector(u_n, coeff_vec_2, true); vec_rhs->add_vector(coeff_vec_2); //// Solve the linear system and if successful, obtain the solution. (M\tau -theta K) u_H = vec_rhs - UMFPackLinearMatrixSolver * highOrd = new UMFPackLinearMatrixSolver (high_matrix,vec_rhs); + UMFPackLinearMatrixSolver * highOrd = new UMFPackLinearMatrixSolver(high_matrix, vec_rhs); try { highOrd->solve(); } - catch(Hermes::Exceptions::Exception e) + catch (Hermes::Exceptions::Exception e) { e.print_msg(); - } + } - for(int i = 0; iget_sln_vector()[i]; + for (int i = 0; i < ndof; i++) u_H[i] = highOrd->get_sln_vector()[i]; delete highOrd; - delete [] coeff_vec_2; + delete[] coeff_vec_2; delete vec_rhs; return u_H; - - -} - - +} \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/hp_adapt.cpp b/hermes2d/test_examples/13-FCT/hp_adapt.cpp index 1ef2ab3e14..e20e3cc83c 100644 --- a/hermes2d/test_examples/13-FCT/hp_adapt.cpp +++ b/hermes2d/test_examples/13-FCT/hp_adapt.cpp @@ -5,26 +5,26 @@ bool refine_elem(SpaceSharedPtr space, Element* e, int ref) { bool refined = true; int order = space->get_element_order(e->id); - order = H2D_MAKE_QUAD_ORDER(1, 1); //non_smooth elements -> polynomial degree 1 + //non_smooth elements -> polynomial degree 1 + order = H2D_MAKE_QUAD_ORDER(1, 1); if (e->active) { - space->get_mesh()->refine_element_id(e->id); + space->get_mesh()->refine_element_id(e->id); for (int j = 0; j < 4; j++) space->set_element_order(e->sons[j]->id, order); } - if(ref>1) + if (ref > 1) { for (int j = 0; j < 4; j++) - refined = refine_elem(space, e->sons[j], ref-1); + refined = refine_elem(space, e->sons[j], ref - 1); } return refined; } - bool HPAdapt::adapt_smooth(int* smooth_elem, int max_p) -{ - if (this->num >1) +{ + if (this->num >1) throw Hermes::Exceptions::Exception("adapt_smooth: Only for one space ."); bool changed = false; SpaceSharedPtr space = this->spaces[0]; @@ -34,39 +34,38 @@ bool HPAdapt::adapt_smooth(int* smooth_elem, int max_p) // Just set the verbose output to true so that the next calls to this->info() produce output. this->set_verbose_output(true); this->info("Elements are being refined in HPAdapt::adapt_smooth()."); - + for_all_active_elements(e, space->get_mesh()) { - if(smooth_elem[e->id] == 1) //smooth => p increase - { - if(e->is_triangle()==true) + if (smooth_elem[e->id] == 1) //smooth => p increase + { + if (e->is_triangle() == true) { - order = space->get_element_order(e->id); + order = space->get_element_order(e->id); order++; - if(order>max_p) order = max_p; + if (order > max_p) order = max_p; space->set_element_order(e->id, order); } - else if(e->is_quad()==true) + else if (e->is_quad() == true) { v_ord = H2D_GET_V_ORDER(space->get_element_order(e->id)); h_ord = H2D_GET_H_ORDER(space->get_element_order(e->id)); - h_ord++; if(h_ord>max_p) h_ord =max_p; - v_ord++; if(v_ord>max_p) v_ord =max_p; + h_ord++; if (h_ord > max_p) h_ord = max_p; + v_ord++; if (v_ord > max_p) v_ord = max_p; order = H2D_MAKE_QUAD_ORDER(h_ord, v_ord); space->set_element_order(e->id, order); changed = true; - } + } } - else if((smooth_elem[e->id] == 0)||(smooth_elem[e->id] == 2)) //non-smooth=>h refine - changed = refine_elem(space, e, 1); + else if ((smooth_elem[e->id] == 0) || (smooth_elem[e->id] == 2)) //non-smooth=>h refine + changed = refine_elem(space, e, 1); } this->info("Assigning DOFs in HPAdapt::adapt_smooth()."); space->assign_dofs(); - if(changed==false) + if (changed == false) return false; - - return true; -} + return true; +} \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/lowOrder.cpp b/hermes2d/test_examples/13-FCT/lowOrder.cpp index 0808ecc169..d553ab506c 100644 --- a/hermes2d/test_examples/13-FCT/lowOrder.cpp +++ b/hermes2d/test_examples/13-FCT/lowOrder.cpp @@ -2,116 +2,114 @@ using namespace Hermes; -Low_Order::Low_Order(double theta): theta(theta) +Low_Order::Low_Order(double theta) : theta(theta) { - lowmat_rhs = new CSCMatrix ; - low_matrix = new CSCMatrix ; - u_L =nullptr; - rhs = nullptr; - u_new = nullptr; + lowmat_rhs = new CSCMatrix < double > ; + low_matrix = new CSCMatrix < double > ; + u_L = nullptr; + rhs = nullptr; + u_new = nullptr; } - Low_Order::~Low_Order() { - if(low_matrix!=nullptr) delete low_matrix; - if(lowmat_rhs!=nullptr) delete lowmat_rhs; - if(u_L!=nullptr) delete [] u_L; - if(rhs!=nullptr) delete [] rhs; - if(u_new!=nullptr) delete [] u_new; + if (low_matrix != nullptr) delete low_matrix; + if (lowmat_rhs != nullptr) delete lowmat_rhs; + if (u_L != nullptr) delete[] u_L; + if (rhs != nullptr) delete[] rhs; + if (u_new != nullptr) delete[] u_new; } - //low-order: (M_L/tau - theta (K+D)) u_n+1 = (M_L/tau - theta (K+D)) u_n //lowmat_rhs = (M_L/tau - theta (K+D)) u_n; low_matrix: (M_L/tau - theta (K+D)) ; M_L/tau = lumped_matrix; K = conv_matrix, D = diffusion -void Low_Order::assemble_Low_Order(CSCMatrix * conv_matrix,CSCMatrix* diffusion, CSCMatrix * lumped_matrix) +void Low_Order::assemble_Low_Order(CSCMatrix * conv_matrix, CSCMatrix* diffusion, CSCMatrix * lumped_matrix) { - if(low_matrix!=nullptr) low_matrix->free(); - if(lowmat_rhs!=nullptr) lowmat_rhs->free(); - - lowmat_rhs->create(conv_matrix->get_size(),conv_matrix->get_nnz(), conv_matrix->get_Ap(), conv_matrix->get_Ai(),conv_matrix->get_Ax()); - lowmat_rhs->add_sparse_matrix(diffusion); - low_matrix->create(lowmat_rhs->get_size(),lowmat_rhs->get_nnz(), lowmat_rhs->get_Ap(), lowmat_rhs->get_Ai(),lowmat_rhs->get_Ax()); - - //(-theta)(K+D) - if(theta==0) low_matrix->zero(); - else low_matrix->multiply_with_Scalar(-theta); - //(1-theta)(K+D) - if(theta ==1) lowmat_rhs->zero(); - else lowmat_rhs->multiply_with_Scalar((1.0-theta)); - //M_L/tau - theta(D+K) - low_matrix->add_sparse_matrix(lumped_matrix); - //M_L/tau+(1-theta)(K+D) - lowmat_rhs->add_sparse_matrix(lumped_matrix); + if (low_matrix != nullptr) low_matrix->free(); + if (lowmat_rhs != nullptr) lowmat_rhs->free(); + + lowmat_rhs->create(conv_matrix->get_size(), conv_matrix->get_nnz(), conv_matrix->get_Ap(), conv_matrix->get_Ai(), conv_matrix->get_Ax()); + lowmat_rhs->add_sparse_matrix(diffusion); + low_matrix->create(lowmat_rhs->get_size(), lowmat_rhs->get_nnz(), lowmat_rhs->get_Ap(), lowmat_rhs->get_Ai(), lowmat_rhs->get_Ax()); + + //(-theta)(K+D) + if (theta == 0) low_matrix->zero(); + else low_matrix->multiply_with_Scalar(-theta); + //(1-theta)(K+D) + if (theta == 1) lowmat_rhs->zero(); + else lowmat_rhs->multiply_with_Scalar((1.0 - theta)); + //M_L/tau - theta(D+K) + low_matrix->add_sparse_matrix(lumped_matrix); + //M_L/tau+(1-theta)(K+D) + lowmat_rhs->add_sparse_matrix(lumped_matrix); } // solve: (M_L/tau) u_L = (M_L/tau - theta (K+D)) u_n //lumped_matrix = M_L !!!!! -double* Low_Order::solve_Low_Order(CSCMatrix * lumped_matrix, double* u_n, double time_step ) +double* Low_Order::solve_Low_Order(CSCMatrix * lumped_matrix, double* u_n, double time_step) { - if((low_matrix==nullptr)||(lowmat_rhs==nullptr) ) - throw Exceptions::Exception("matrices have to be calculated first, call Low_Order::assemble_Low_Order."); - int ndof = low_matrix->get_size(); - if(u_L!=nullptr) delete [] u_L; - u_L = new double[ndof]; - if(rhs!=nullptr) delete [] rhs; - rhs = new double[ndof]; - SimpleVector* vec_rhs = new SimpleVector (ndof); - - lumped_matrix->multiply_with_Scalar(1./time_step); //M_L/tau - //----------vec_rhs = (M_L/tau - theta (K+D)) u_n -------- - lowmat_rhs->multiply_with_vector(u_n, rhs, true); - vec_rhs->add_vector(rhs); - -// Solve the linear system and if successful, obtain the solution. M_L/tau u^L= M_L/tau+ (1-theta)(K+D) u^n - UMFPackLinearMatrixSolver * lowOrd = new UMFPackLinearMatrixSolver (lumped_matrix,vec_rhs); - try{ - lowOrd->solve(); - } - catch(Hermes::Exceptions::Exception e) - { - e.print_msg(); - } - for(int i = 0; iget_sln_vector()[i]; - lumped_matrix->multiply_with_Scalar(time_step); // M_L - - delete lowOrd; - delete vec_rhs; - - return u_L; + if ((low_matrix == nullptr) || (lowmat_rhs == nullptr)) + throw Exceptions::Exception("matrices have to be calculated first, call Low_Order::assemble_Low_Order."); + int ndof = low_matrix->get_size(); + if (u_L != nullptr) delete[] u_L; + u_L = new double[ndof]; + if (rhs != nullptr) delete[] rhs; + rhs = new double[ndof]; + SimpleVector* vec_rhs = new SimpleVector(ndof); + + //M_L/tau + lumped_matrix->multiply_with_Scalar(1. / time_step); + //----------vec_rhs = (M_L/tau - theta (K+D)) u_n -------- + lowmat_rhs->multiply_with_vector(u_n, rhs, true); + vec_rhs->add_vector(rhs); + + // Solve the linear system and if successful, obtain the solution. M_L/tau u^L= M_L/tau+ (1-theta)(K+D) u^n + UMFPackLinearMatrixSolver * lowOrd = new UMFPackLinearMatrixSolver(lumped_matrix, vec_rhs); + try{ + lowOrd->solve(); + } + catch (Hermes::Exceptions::Exception e) + { + e.print_msg(); + } + for (int i = 0; i < ndof; i++) u_L[i] = lowOrd->get_sln_vector()[i]; + // M_L + lumped_matrix->multiply_with_Scalar(time_step); + delete lowOrd; + delete vec_rhs; + + return u_L; } //(M_L/tau - theta (K+D)) u_new_ = (M_L/tau - theta (K+D)) u_n + flux_correction -double* Low_Order::explicit_Correction(double* flux_correction ) +double* Low_Order::explicit_Correction(double* flux_correction) { - if((low_matrix==nullptr)||(lowmat_rhs==nullptr) ) - throw Exceptions::Exception("matrices have to be calculated first, call Low_Order::assemble_Low_Order."); - if(rhs ==nullptr) - throw Exceptions::Exception("rhs have to be calculated first, call Low_Order::solve_Low_Order() "); - if(u_new!=nullptr) delete [] u_new; - int ndof = low_matrix->get_size(); - u_new = new double[ndof]; - SimpleVector* vec_rhs = new SimpleVector (ndof); - //rhs = (M_L/tau - theta (K+D)) u_n - vec_rhs->add_vector(rhs); - vec_rhs->add_vector(flux_correction); - - // Solve the linear system and if successful, obtain the solution. (M_L/tau - theta (K+D)) u_new_ = rhs+flux_correction - UMFPackLinearMatrixSolver * newSol = new UMFPackLinearMatrixSolver (low_matrix,vec_rhs); - try{ - newSol->solve(); - } - catch(Hermes::Exceptions::Exception e) - { - e.print_msg(); - } - - for(int i = 0; iget_sln_vector()[i]; - - delete newSol; - delete vec_rhs; - - return u_new; -} + if ((low_matrix == nullptr) || (lowmat_rhs == nullptr)) + throw Exceptions::Exception("matrices have to be calculated first, call Low_Order::assemble_Low_Order."); + if (rhs == nullptr) + throw Exceptions::Exception("rhs have to be calculated first, call Low_Order::solve_Low_Order() "); + if (u_new != nullptr) delete[] u_new; + int ndof = low_matrix->get_size(); + u_new = new double[ndof]; + SimpleVector* vec_rhs = new SimpleVector(ndof); + //rhs = (M_L/tau - theta (K+D)) u_n + vec_rhs->add_vector(rhs); + vec_rhs->add_vector(flux_correction); + + // Solve the linear system and if successful, obtain the solution. (M_L/tau - theta (K+D)) u_new_ = rhs+flux_correction + UMFPackLinearMatrixSolver * newSol = new UMFPackLinearMatrixSolver(low_matrix, vec_rhs); + try{ + newSol->solve(); + } + catch (Hermes::Exceptions::Exception e) + { + e.print_msg(); + } + + for (int i = 0; i < ndof; i++) u_new[i] = newSol->get_sln_vector()[i]; + + delete newSol; + delete vec_rhs; + return u_new; +} \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/lumped_projection.cpp b/hermes2d/test_examples/13-FCT/lumped_projection.cpp index 7eeeb59a93..5cc1d3657e 100644 --- a/hermes2d/test_examples/13-FCT/lumped_projection.cpp +++ b/hermes2d/test_examples/13-FCT/lumped_projection.cpp @@ -1,107 +1,99 @@ #include "lumped_projection.h" - -void Lumped_Projection::project_internal(SpaceSharedPtr space, WeakForm* wf, double* target_vec, CSCMatrix* mat) +void Lumped_Projection::project_internal(SpaceSharedPtr space, WeakFormSharedPtr wf, double* target_vec, CSCMatrix* mat) { - - if(space == nullptr) printf("this->space == nullptr in Lumped_Projection::project_internal()."); + if (space == nullptr) printf("this->space == nullptr in Lumped_Projection::project_internal()."); // Get dimension of the space. int ndof = space->get_num_dofs(); - if(mat!=nullptr) if(mat->get_size()!=ndof) printf("matrix=%i, ndof=%i", mat->get_size(),ndof); + if (mat != nullptr) if (mat->get_size() != ndof) printf("matrix=%i, ndof=%i", mat->get_size(), ndof); // Initialize DiscreteProblem. DiscreteProblem* dp = new DiscreteProblem(wf, space); - CSCMatrix* matrix = new CSCMatrix; + CSCMatrix* matrix = new CSCMatrix < double > ; SimpleVector* rhs = new SimpleVector(ndof); - double* coeff_vec =nullptr; - if(mat==nullptr) //=> masslumping + double* coeff_vec = nullptr; + if (mat == nullptr) //=> masslumping { - CSCMatrix* lumped_matrix = new CSCMatrix; //M_L - dp->assemble(matrix, rhs); + //M_L + CSCMatrix* lumped_matrix = new CSCMatrix < double > ; + dp->assemble(matrix, rhs); int size = matrix->get_size(); double* diag = new double[size]; int nnz = matrix->get_nnz(); - int* row = new int[size]; - int* col = new int[size+1]; - for(int i = 0; iget_Ai()[i]] += matrix->get_Ax()[i]; - lumped_matrix->create(size, size, col, row, diag); - UMFPackLinearMatrixSolver* solver = new UMFPackLinearMatrixSolver(lumped_matrix,rhs); + for (int i = 0; i < nnz; i++) + diag[matrix->get_Ai()[i]] += matrix->get_Ax()[i]; + lumped_matrix->create(size, size, col, row, diag); + UMFPackLinearMatrixSolver* solver = new UMFPackLinearMatrixSolver(lumped_matrix, rhs); try { solver->solve(); } - catch(Hermes::Exceptions::Exception e) + catch (Hermes::Exceptions::Exception e) { e.print_msg(); } - coeff_vec = solver->get_sln_vector(); + coeff_vec = solver->get_sln_vector(); if (target_vec != nullptr) - for (int i=0; i < ndof; i++) + for (int i = 0; i < ndof; i++) target_vec[i] = coeff_vec[i]; delete solver; delete lumped_matrix; - delete [] diag; - delete [] row; - delete [] col; + delete[] diag; + delete[] row; + delete[] col; } else - { + { dp->assemble(rhs); - UMFPackLinearMatrixSolver* solver = new UMFPackLinearMatrixSolver(mat,rhs); + UMFPackLinearMatrixSolver* solver = new UMFPackLinearMatrixSolver(mat, rhs); try { solver->solve(); } - catch(Hermes::Exceptions::Exception e) + catch (Hermes::Exceptions::Exception e) { e.print_msg(); } - coeff_vec = solver->get_sln_vector(); + coeff_vec = solver->get_sln_vector(); if (target_vec != nullptr) - for (int i=0; i < ndof; i++) target_vec[i] = coeff_vec[i]; + for (int i = 0; i < ndof; i++) target_vec[i] = coeff_vec[i]; delete solver; } - delete matrix; delete rhs; delete dp; - - } -void Lumped_Projection::project_lumped( const SpaceSharedPtr space, MeshFunctionSharedPtr source_meshfn, - double* target_vec, CSCMatrix* mat ) +void Lumped_Projection::project_lumped(const SpaceSharedPtr space, MeshFunctionSharedPtr source_meshfn, + double* target_vec, CSCMatrix* mat) { // Sanity checks. if (target_vec == nullptr) throw Exceptions::NullException(3); // Define temporary projection weak form. - WeakForm* proj_wf = new WeakForm(1); + WeakFormSharedPtr proj_wf(new WeakForm(1)); proj_wf->set_ext(source_meshfn); - ProjectionLumpedMatrixFormVol* matrix_form = new ProjectionLumpedMatrixFormVol(0, 0); - ProjectionLumpedVectorFormVol* vector_form = new ProjectionLumpedVectorFormVol(0); - //ProjectionLumpedVectorFormVol* vector_form = new_ ProjectionLumpedVectorFormVol(0, source_meshfn); + ProjectionLumpedMatrixFormVol* matrix_form = new ProjectionLumpedMatrixFormVol(0, 0); + ProjectionLumpedVectorFormVol* vector_form = new ProjectionLumpedVectorFormVol(0); + //ProjectionLumpedVectorFormVol* vector_form = new_ ProjectionLumpedVectorFormVol(0, source_meshfn); proj_wf->add_matrix_form(matrix_form); proj_wf->add_vector_form(vector_form); // Call main function. project_internal(space, proj_wf, target_vec, mat); - - // Clean up. - delete proj_wf; - } \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/lumped_projection.h b/hermes2d/test_examples/13-FCT/lumped_projection.h index 4ce1b4545b..7d0d67cd34 100644 --- a/hermes2d/test_examples/13-FCT/lumped_projection.h +++ b/hermes2d/test_examples/13-FCT/lumped_projection.h @@ -19,7 +19,7 @@ class Lumped_Projection protected: - static void project_internal(SpaceSharedPtr space, WeakForm* wf, double* target_vec, CSCMatrix* mat = nullptr); + static void project_internal(SpaceSharedPtr space, WeakFormSharedPtr wf, double* target_vec, CSCMatrix* mat = nullptr); @@ -33,7 +33,7 @@ class Lumped_Projection } double value(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return lumped_projection_biform(n, wt, u_ext, u, v, e, ext); @@ -41,7 +41,7 @@ class Lumped_Projection } Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return lumped_projection_biform(n, wt, u_ext, u, v, e, ext); @@ -57,7 +57,7 @@ class Lumped_Projection template static SolFunctionDomain lumped_projection_biform(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) + Func *v, GeomVol *e, Func **ext) { SolFunctionDomain result = SolFunctionDomain(0); @@ -77,12 +77,12 @@ class Lumped_Projection ProjectionLumpedVectorFormVol(int i) : VectorFormVol(i) { //this->adapt_eval = false; - // this->ext = Hermes::vector*>(); + // this->ext = std::vector*>(); // this->ext.push_back(ext); } double value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { @@ -91,7 +91,7 @@ class Lumped_Projection } Hermes::Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { return lumped_projection_residual(n, wt, u_ext, v, e, ext); @@ -106,7 +106,7 @@ class Lumped_Projection template SolFunctionDomain lumped_projection_residual(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { SolFunctionDomain result = SolFunctionDomain(0); diff --git a/hermes2d/test_examples/13-FCT/main.cpp b/hermes2d/test_examples/13-FCT/main.cpp index e1ee8a35f5..b81949fe7b 100644 --- a/hermes2d/test_examples/13-FCT/main.cpp +++ b/hermes2d/test_examples/13-FCT/main.cpp @@ -9,7 +9,6 @@ #include "prev_solution.h" #include - using namespace RefinementSelectors; using namespace Hermes; using namespace Hermes::Hermes2D; @@ -21,34 +20,43 @@ using namespace Hermes::Hermes2D::Views; //After each full revolution the exact solution coincides with the initial data. // 1. Step: Low-order solution u^L : (M_L/tau -theta(K+D)) u^L = (M_L/tau + (1-theta)(K+D)) u^n -// 2. Step: antidiffusive fluxes: f_ij = (M_c)_ij (dt_u_L(i)- dt_u_L(j)) + D_ij (u_L(i)- u_L(j)); +// 2. Step: antidiffusive fluxes: f_ij = (M_c)_ij (dt_u_L(i)- dt_u_L(j)) + D_ij (u_L(i)- u_L(j)); // limiting: f_i = sum_(j!=i) alpha_ij f_ij -// 3. Step: explicit correction: M_L u^(n+1) = M_L u^L + tau * f - - +// 3. Step: explicit correction: M_L u^(n+1) = M_L u^L + tau * f -const int INIT_REF_NUM =3; // Number of initial refinements. -const int P_INIT = 1; // Initial polynomial degree. -const int P_MAX = 3; //Maximal polynomial degree. +// Number of initial refinements. +const int INIT_REF_NUM = 3; +// Initial polynomial degree. +const int P_INIT = 1; +//Maximal polynomial degree. +const int P_MAX = 3; -const double time_step = 1e-3; // Time step. -const double T_FINAL = 2*PI; // Time interval length. +// Time step. +const double time_step = 1e-3; +// Time interval length. +const double T_FINAL = 2 * PI; -const double EPS_smooth = 1e-5; //constant for the smoothness indicator (a a+eps<=b) -const double theta = 0.5; // theta-scheme for time (theta =0 -> explizit, theta=1 -> implizit) - -MatrixSolverType matrix_solver = SOLVER_UMFPACK; +//constant for the smoothness indicator (a a+eps<=b) +const double EPS_smooth = 1e-5; +// theta-scheme for time (theta =0 -> explizit, theta=1 -> implizit) +const double theta = 0.5; +MatrixSolverType matrix_solver = SOLVER_UMFPACK; // Adaptivity -const double THRESHOLD_UNREF = 0.001; // Unrefinement: error of all sons is smaller than THRESHOLD_UNREF times maximum element error -const int UNREF_FREQ = 1; // Every UNREF_FREQth time step the mesh is derefined. -const int UNREF_METHOD = 1; // 1... mesh reset to basemesh and poly degrees to P_INIT. +// Unrefinement: error of all sons is smaller than THRESHOLD_UNREF times maximum element error +const double THRESHOLD_UNREF = 0.001; +// Every UNREF_FREQth time step the mesh is derefined. +const int UNREF_FREQ = 1; +// 1... mesh reset to basemesh and poly degrees to P_INIT. +const int UNREF_METHOD = 1; // 2... one ref. layer shaved off, poly degrees reset to P_INIT. -// 3... one ref. layer shaved off, poly degrees decreased by one. -const double THRESHOLD = 0.75; // This is a quantitative parameter of the adapt(...) function and +// 3... one ref. layer shaved off, poly degrees decreased by one. +// This is a quantitative parameter of the adapt(...) function and +const double THRESHOLD = 0.75; // it has different meanings for various adaptive strategies (see below). -const int STRATEGY = 1; // Adaptive strategy: +// Adaptive strategy: +const int STRATEGY = 1; // STRATEGY = 0 ... refine elements until sqrt(THRESHOLD) times total // error is processed. If more elements have similar errors, refine // all to keep the mesh symmetric. @@ -57,38 +65,45 @@ const int STRATEGY = 1; // Adaptive strategy: // STRATEGY = 2 ... refine all elements whose error is larger // than THRESHOLD. // More adaptive strategies can be created in adapt_ortho_h1.cpp. -const CandList CAND_LIST = H2D_HP_ANISO; // Predefined list of element refinement candidates. Possible values are +// Predefined list of element refinement candidates. Possible values are +const CandList CAND_LIST = H2D_HP_ANISO; // H2D_P_ISO, H2D_P_ANISO, H2D_H_ISO, H2D_H_ANISO, H2D_HP_ISO, // H2D_HP_ANISO_H, H2D_HP_ANISO_P, H2D_HP_ANISO. // See the User Documentation for details. -const int MESH_REGULARITY = -1; // Maximum allowed level of hanging nodes: +// Maximum allowed level of hanging nodes: +const int MESH_REGULARITY = -1; // MESH_REGULARITY = -1 ... arbitrary level hanging nodes (default), // MESH_REGULARITY = 1 ... at most one-level hanging nodes, // MESH_REGULARITY = 2 ... at most two-level hanging nodes, etc. // Note that regular meshes are not supported, this is due to // their notoriously bad performance. -const double CONV_EXP = 1.0; // Default value is 1.0. This parameter influences the selection of +// Default value is 1.0. This parameter influences the selection of +const double CONV_EXP = 1.0; // cancidates in hp-adaptivity. See get_optimal_refinement() for details. -const double ERR_STOP = 0.1; // Stopping criterion for adaptivity (rel. error tolerance between the +// Stopping criterion for adaptivity (rel. error tolerance between the +const double ERR_STOP = 0.1; // fine mesh and coarse mesh solution in percent). -const int NDOF_STOP = 60000; // Adaptivity process stops when the number of degrees of freedom grows +// Adaptivity process stops when the number of degrees of freedom grows +const int NDOF_STOP = 60000; // over this limit. This is to prevent h-adaptivity to go on forever. -const int ADAPSTEP_MAX = 5; // max. numbers of adaptivity steps - +// max. numbers of adaptivity steps +const int ADAPSTEP_MAX = 5; //Visualization -const bool HERMES_VISUALIZATION = true; // Set to "false" to suppress Hermes OpenGL visualization. -const bool VTK_VISUALIZATION = false; // Set to "true" to enable VTK output. -const int VTK_FREQ = 1000; //Every VTK_FREQth time step the solution is saved as VTK output. +// Set to "false" to suppress Hermes OpenGL visualization. +const bool HERMES_VISUALIZATION = true; +// Set to "true" to enable VTK output. +const bool VTK_VISUALIZATION = false; +//Every VTK_FREQth time step the solution is saved as VTK output. +const int VTK_FREQ = 1000; // Boundary markers. const std::string BDY_IN = "inlet"; const std::string BDY_OUT = "no_bdry"; - int main(int argc, char* argv[]) -{ +{ // Load the mesh. MeshSharedPtr mesh(new Mesh), basemesh(new Mesh); MeshReaderH2D mloader; @@ -99,7 +114,7 @@ int main(int argc, char* argv[]) View::wait();*/ // Perform initial mesh refinements (optional). - for (int i=0; i < INIT_REF_NUM; i++) + for (int i = 0; i < INIT_REF_NUM; i++) basemesh->refine_all_elements(); mesh->copy(basemesh); @@ -108,7 +123,7 @@ int main(int argc, char* argv[]) EssentialBCs bcs(&bc_essential); // Create an H1 space with default shapeset. - SpaceSharedPtr space(new H1Space(mesh, &bcs, P_INIT)); + SpaceSharedPtr space(new H1Space(mesh, &bcs, P_INIT)); // Initialize solution of lower & higher order MeshFunctionSharedPtr low_sln(new Solution()), ref_sln(new Solution()), high_sln(new Solution()), sln(new Solution()); @@ -118,8 +133,8 @@ int main(int argc, char* argv[]) MeshFunctionSharedPtrinitial_condition(new CustomInitialCondition(mesh)); // Initialize the weak formulation. - CustomWeakFormMassmatrix massmatrix(time_step); - CustomWeakFormConvection convection; + WeakFormSharedPtr massmatrix(new CustomWeakFormMassmatrix(time_step)); + WeakFormSharedPtr convection(new CustomWeakFormConvection); // Initialize views. ScalarView sview("Solution", new WinGeom(0, 500, 500, 400)); @@ -136,11 +151,13 @@ int main(int argc, char* argv[]) H1ProjBasedSelector selector(CAND_LIST); //Initialize - CSCMatrix * mass_matrix = new CSCMatrix ; //M_c/tau - CSCMatrix * conv_matrix = new CSCMatrix ; //K - double* u_L = nullptr; - double* u_H =nullptr; - double* ref_sln_double =nullptr; + //M_c/tau + CSCMatrix * mass_matrix = new CSCMatrix < double > ; + //K + CSCMatrix * conv_matrix = new CSCMatrix < double > ; + double* u_L = nullptr; + double* u_H = nullptr; + double* ref_sln_double = nullptr; int ref_ndof, ndof; double err_est_rel_total; DefaultErrorCalculator error_calculator(RelativeErrorToGlobalNorm, 1); @@ -149,26 +166,26 @@ int main(int argc, char* argv[]) AdaptStoppingCriterionCumulative stoppingCriterion(THRESHOLD); adaptivity.set_strategy(&stoppingCriterion); - OGProjection ogProjection; - Lumped_Projection lumpedProjection; + OGProjection ogProjection; + Lumped_Projection lumpedProjection; Low_Order lowOrder(theta); High_Order highOrd(theta); Flux_Correction fluxCorrection(theta); Regularity_Estimator regEst(EPS_smooth); - DiscreteProblem dp_mass(&massmatrix, space); - DiscreteProblem dp_convection(&convection, space); + DiscreteProblem dp_mass(massmatrix, space); + DiscreteProblem dp_convection(convection, space); // Time stepping loop: - double current_time = 0.0; + double current_time = 0.0; int ts = 1; do - { + { Hermes::Mixins::Loggable::Static::info("Time step %d, time %3.5f", ts, current_time); - // Periodic global derefinement. - if ((ts > 1 && ts % UNREF_FREQ == 0)||(space->get_num_dofs() >= NDOF_STOP)) - { + // Periodic global derefinement. + if ((ts > 1 && ts % UNREF_FREQ == 0) || (space->get_num_dofs() >= NDOF_STOP)) + { Hermes::Mixins::Loggable::Static::info("Global mesh derefinement."); switch (UNREF_METHOD) { case 1: mesh->copy(basemesh); @@ -181,172 +198,170 @@ int main(int argc, char* argv[]) space->adjust_element_order(-1, -1, P_INIT, P_INIT); break; default: Exceptions::Exception("Wrong global derefinement method."); - } + } } - bool done = false; int as = 1; + bool done = false; int as = 1; space->assign_dofs(); - do + do { - Hermes::Mixins::Loggable::Static::info("Time step %i, adap_step %i", ts, as); - ndof = space->get_num_dofs(); + Hermes::Mixins::Loggable::Static::info("Time step %i, adap_step %i", ts, as); + ndof = space->get_num_dofs(); - ndof = space->get_num_dofs(); + ndof = space->get_num_dofs(); double* coeff_vec_smooth = new double[ndof]; - int* smooth_elem_ref; + int* smooth_elem_ref; - //smoothness-check for projected data + //smoothness-check for projected data Hermes::Mixins::Loggable::Static::info("Projecting..."); - if(ts==1) - ogProjection.project_global(space, initial_condition, coeff_vec_smooth, HERMES_L2_NORM); + if (ts == 1) + ogProjection.project_global(space, initial_condition, coeff_vec_smooth, HERMES_L2_NORM); else - ogProjection.project_global(space, u_prev_time, coeff_vec_smooth, HERMES_L2_NORM); + ogProjection.project_global(space, u_prev_time, coeff_vec_smooth, HERMES_L2_NORM); Hermes::Mixins::Loggable::Static::info("Calling get_smooth_elems()..."); - smooth_elem_ref = regEst.get_smooth_elems(space,coeff_vec_smooth); - // Construct reference mesh and setup reference space-> + smooth_elem_ref = regEst.get_smooth_elems(space, coeff_vec_smooth); + // Construct reference mesh and setup reference space. MeshSharedPtr ref_mesh(new Mesh); ref_mesh->copy(space->get_mesh()); Space::ReferenceSpaceCreator ref_space_creator(space, ref_mesh, 0); SpaceSharedPtr ref_space = ref_space_creator.create_ref_space(); - HPAdapt* adapting = new HPAdapt(ref_space); + HPAdapt* adapting = new HPAdapt(ref_space); - // increase p in smooth regions, h refine in non-smooth regions + // increase p in smooth regions, h refine in non-smooth regions Hermes::Mixins::Loggable::Static::info("Calling adapt_smooth()..."); - if(adapting->adapt_smooth(smooth_elem_ref, P_MAX) == false) - throw Exceptions::Exception("reference space couldn't be constructed"); + if (adapting->adapt_smooth(smooth_elem_ref, P_MAX) == false) + throw Exceptions::Exception("reference space couldn't be constructed"); delete adapting; - delete [] coeff_vec_smooth; - + delete[] coeff_vec_smooth; ref_ndof = ref_space->get_num_dofs(); Hermes::Mixins::Loggable::Static::info("Visualization..."); - if(HERMES_VISUALIZATION) + if (HERMES_VISUALIZATION) { - sprintf(title, "Ref_Mesh: Time %3.2f,timestep %i,as=%i,", current_time,ts,as); + sprintf(title, "Ref_Mesh: Time %3.2f,timestep %i,as=%i,", current_time, ts, as); ref_mview.set_title(title); ref_mview.show(ref_space); } - dp_mass.set_space(ref_space); dp_convection.set_space(ref_space); - fluxCorrection.init(ref_space); + fluxCorrection.init(ref_space); double* coeff_vec = new double[ref_ndof]; double* coeff_vec_2 = new double[ref_ndof]; - double* limited_flux = new double[ref_ndof]; - - - dp_mass.assemble(mass_matrix); //M_c/tau - dp_convection.assemble(conv_matrix, nullptr); //K - - //----------------------MassLumping & Artificial Diffusion -------------------------------------------------------------------- - CSCMatrix* lumped_matrix = fluxCorrection.massLumping(mass_matrix); // M_L/tau - CSCMatrix* diffusion = fluxCorrection.artificialDiffusion(conv_matrix); - - //-----------------Assembling of matrices --------------------------------------------------------------------- - lowOrder.assemble_Low_Order(conv_matrix,diffusion,lumped_matrix); - highOrd.assemble_High_Order(conv_matrix,mass_matrix); - - mass_matrix->multiply_with_Scalar(time_step); // massmatrix = M_C - lumped_matrix->multiply_with_Scalar(time_step); // M_L - - - //--------- Project the previous timestep solution on the FE space (FCT is applied )---------------- - // coeff_vec : FCT -Projection, coeff_vec_2: L2 Projection (ogProjection) - if(ts==1) - fluxCorrection.project_FCT(initial_condition, coeff_vec, coeff_vec_2,mass_matrix,lumped_matrix,time_step,&ogProjection,&lumpedProjection, ®Est); - else - fluxCorrection.project_FCT(u_prev_time, coeff_vec, coeff_vec_2,mass_matrix,lumped_matrix,time_step,&ogProjection,&lumpedProjection, ®Est); - //------------------------- lower order solution------------ - u_L = lowOrder.solve_Low_Order(lumped_matrix, coeff_vec,time_step); - //-------------high order solution (standard galerkin) ------ - u_H = highOrd.solve_High_Order(coeff_vec); - //------------------------------Assemble antidiffusive fluxes and limit these----------------------------------- - fluxCorrection.antidiffusiveFlux(mass_matrix,lumped_matrix,conv_matrix,diffusion,u_H, u_L,coeff_vec, limited_flux,time_step,®Est); - //-------------Compute final solution --------------- + double* limited_flux = new double[ref_ndof]; + + //M_c/tau + dp_mass.assemble(mass_matrix); + //K + dp_convection.assemble(conv_matrix, nullptr); + + //----------------------MassLumping & Artificial Diffusion -------------------------------------------------------------------- + // M_L/tau + CSCMatrix* lumped_matrix = fluxCorrection.massLumping(mass_matrix); + CSCMatrix* diffusion = fluxCorrection.artificialDiffusion(conv_matrix); + + //-----------------Assembling of matrices --------------------------------------------------------------------- + lowOrder.assemble_Low_Order(conv_matrix, diffusion, lumped_matrix); + highOrd.assemble_High_Order(conv_matrix, mass_matrix); + + // massmatrix = M_C + mass_matrix->multiply_with_Scalar(time_step); + // M_L + lumped_matrix->multiply_with_Scalar(time_step); + + //--------- Project the previous timestep solution on the FE space (FCT is applied )---------------- + // coeff_vec : FCT -Projection, coeff_vec_2: L2 Projection (ogProjection) + if (ts == 1) + fluxCorrection.project_FCT(initial_condition, coeff_vec, coeff_vec_2, mass_matrix, lumped_matrix, time_step, &ogProjection, &lumpedProjection, ®Est); + else + fluxCorrection.project_FCT(u_prev_time, coeff_vec, coeff_vec_2, mass_matrix, lumped_matrix, time_step, &ogProjection, &lumpedProjection, ®Est); + //------------------------- lower order solution------------ + u_L = lowOrder.solve_Low_Order(lumped_matrix, coeff_vec, time_step); + //-------------high order solution (standard galerkin) ------ + u_H = highOrd.solve_High_Order(coeff_vec); + //------------------------------Assemble antidiffusive fluxes and limit these----------------------------------- + fluxCorrection.antidiffusiveFlux(mass_matrix, lumped_matrix, conv_matrix, diffusion, u_H, u_L, coeff_vec, limited_flux, time_step, ®Est); + //-------------Compute final solution --------------- ref_sln_double = lowOrder.explicit_Correction(limited_flux); - Solution::vector_to_solution(ref_sln_double, ref_space, ref_sln); + Solution::vector_to_solution(ref_sln_double, ref_space, ref_sln); // Project the fine mesh solution onto the coarse mesh. - ogProjection.project_global(space, ref_sln, sln, HERMES_L2_NORM); + ogProjection.project_global(space, ref_sln, sln, HERMES_L2_NORM); // Calculate element errors and total error estimate. error_calculator.calculate_errors(sln, ref_sln); double err_est_rel_total = error_calculator.get_total_error_squared() * 100; // Report results. - Hermes::Mixins::Loggable::Static::info("ndof_coarse: %d, ndof_fine: %d, err_est_rel: %g%%", ndof,ref_ndof, err_est_rel_total); - // If err_est_rel too large, adapt the mesh-> - if((err_est_rel_total < ERR_STOP)||(as>=ADAPSTEP_MAX)) done = true; + Hermes::Mixins::Loggable::Static::info("ndof_coarse: %d, ndof_fine: %d, err_est_rel: %g%%", ndof, ref_ndof, err_est_rel_total); + // If err_est_rel too large, adapt the mesh. + if ((err_est_rel_total < ERR_STOP) || (as >= ADAPSTEP_MAX)) done = true; else { done = adaptivity.adapt(&selector); // Increase the counter of performed adaptivity steps. - if(done == false) as++; + if (done == false) as++; } - if(space->get_num_dofs() >= NDOF_STOP) + if (space->get_num_dofs() >= NDOF_STOP) done = true; - if(done) - { + if (done) + { u_prev_time->copy(ref_sln); } // Visualize the solution and mesh-> - if(HERMES_VISUALIZATION) + if (HERMES_VISUALIZATION) { - sprintf(title, "Ref-Loesung: Time %3.2f,timestep %i,as=%i,", current_time,ts,as); + sprintf(title, "Ref-Loesung: Time %3.2f,timestep %i,as=%i,", current_time, ts, as); sview.set_title(title); sview.show(ref_sln); - sprintf(title, "Mesh: Time %3.2f,timestep %i,as=%i,", current_time,ts,as); + sprintf(title, "Mesh: Time %3.2f,timestep %i,as=%i,", current_time, ts, as); mview.set_title(title); mview.show(space); } - if((VTK_VISUALIZATION) &&((done==true)&&(ts % VTK_FREQ == 0))) + if ((VTK_VISUALIZATION) && ((done == true) && (ts % VTK_FREQ == 0))) { // Output solution in VTK format. char filename[40]; - sprintf(filename, "solution-%i.vtk", ts ); - lin.save_solution_vtk(u_prev_time, filename, "solution", mode_3D); + sprintf(filename, "solution-%i.vtk", ts); + lin.save_solution_vtk(u_prev_time, filename, "solution", mode_3D); sprintf(filename, "ref_space_order-%i.vtk", ts); ord.save_orders_vtk(ref_space, filename); - sprintf(filename, "ref_mesh-%i.vtk", ts ); - ord.save_mesh_vtk(ref_space, filename); - } + sprintf(filename, "ref_mesh-%i.vtk", ts); + ord.save_mesh_vtk(ref_space, filename); + } // Clean up. - delete lumped_matrix; + delete lumped_matrix; delete diffusion; - delete [] coeff_vec_2; - delete [] coeff_vec; - delete [] limited_flux; - } - while (done == false); + delete[] coeff_vec_2; + delete[] coeff_vec; + delete[] limited_flux; + } while (done == false); // Update global time. current_time += time_step; // Increase time step counter ts++; - } - while (current_time < T_FINAL); + } while (current_time < T_FINAL); // Visualize the solution. - if(VTK_VISUALIZATION) { + if (VTK_VISUALIZATION) { lin.save_solution_vtk(u_prev_time, "end_solution.vtk", "solution", mode_3D); ord.save_mesh_vtk(space, "end_mesh"); ord.save_orders_vtk(space, "end_order.vtk"); } - delete mass_matrix; + delete mass_matrix; delete conv_matrix; // Wait for the view to be closed. View::wait(); return 0; -} - +} \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/prev_solution.cpp b/hermes2d/test_examples/13-FCT/prev_solution.cpp index fe01355f19..0eda8f6b61 100644 --- a/hermes2d/test_examples/13-FCT/prev_solution.cpp +++ b/hermes2d/test_examples/13-FCT/prev_solution.cpp @@ -1,35 +1,33 @@ #include "prev_solution.h" - - - void PrevSolution::set_own_mesh(const MeshSharedPtr mesh){ - if(this->mesh == mesh) - { - MeshSharedPtr new_mesh(new Mesh); - new_mesh->copy(mesh); - this->mesh = new_mesh; - own_mesh = true; - } - else - throw Hermes::Exceptions::Exception("Solution mesh unequal own_mesh."); - } - - MeshFunction* PrevSolution::clone(){ - if(this->get_type() == HERMES_SLN) - return Solution::clone(); - PrevSolution* sln = new PrevSolution(this->mesh); - return sln; - - }; - - - void PrevSolution::free() - { - if(mono_coeffs != nullptr) { delete [] mono_coeffs; mono_coeffs = nullptr; } - if(elem_orders != nullptr) { delete [] elem_orders; elem_orders = nullptr; } - if(dxdy_buffer != nullptr) { delete [] dxdy_buffer; dxdy_buffer = nullptr; } +void PrevSolution::set_own_mesh(const MeshSharedPtr mesh){ + if (this->mesh == mesh) + { + MeshSharedPtr new_mesh(new Mesh); + new_mesh->copy(mesh); + this->mesh = new_mesh; + own_mesh = true; + } + else + throw Hermes::Exceptions::Exception("Solution mesh unequal own_mesh."); +} + +MeshFunction* PrevSolution::clone(){ + if (this->get_type() == HERMES_SLN) + return Solution::clone(); + PrevSolution* sln = new PrevSolution(this->mesh); + return sln; +}; - for (int i = 0; i < this->num_components; i++) - if(elem_coeffs[i] != nullptr) - { delete [] elem_coeffs[i]; elem_coeffs[i] = nullptr; } +void PrevSolution::free() +{ + if (mono_coeffs != nullptr) { delete[] mono_coeffs; mono_coeffs = nullptr; } + if (elem_orders != nullptr) { delete[] elem_orders; elem_orders = nullptr; } + if (dxdy_buffer != nullptr) { delete[] dxdy_buffer; dxdy_buffer = nullptr; } + + for (int i = 0; i < this->num_components; i++) + if (elem_coeffs[i] != nullptr) + { + delete[] elem_coeffs[i]; elem_coeffs[i] = nullptr; } +} \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/reg_estimator.cpp b/hermes2d/test_examples/13-FCT/reg_estimator.cpp index a5ccd34b3b..37f43edbe3 100644 --- a/hermes2d/test_examples/13-FCT/reg_estimator.cpp +++ b/hermes2d/test_examples/13-FCT/reg_estimator.cpp @@ -1,154 +1,146 @@ #include "reg_estimator.h" -Regularity_Estimator::Regularity_Estimator(double epsilon): epsilon(epsilon), R_h_1(MeshFunctionSharedPtr(new Solution)), - R_h_2(MeshFunctionSharedPtr(new Solution)), sln(MeshFunctionSharedPtr(new Solution)) +Regularity_Estimator::Regularity_Estimator(double epsilon) : epsilon(epsilon), R_h_1(MeshFunctionSharedPtr(new Solution)), +R_h_2(MeshFunctionSharedPtr(new Solution)), sln(MeshFunctionSharedPtr(new Solution)) { - space =nullptr; - - smooth_elem_patch= nullptr; + space = nullptr; + + smooth_elem_patch = nullptr; smooth_dof = nullptr; - al = new AsmList; - rhs_1 =nullptr; - rhs_2=nullptr; - grad_1= new GradientReconstruction_1(sln); - grad_2= new GradientReconstruction_2(sln); + al = new AsmList < double > ; + rhs_1 = nullptr; + rhs_2 = nullptr; + grad_1 = WeakFormSharedPtr(new GradientReconstruction_1(sln)); + grad_2 = WeakFormSharedPtr(new GradientReconstruction_2(sln)); }; Regularity_Estimator::~Regularity_Estimator() { free(); - delete al; - delete grad_1; delete grad_2; + delete al; } void Regularity_Estimator::free() { - if(smooth_dof!=nullptr) delete [] smooth_dof; - if(smooth_elem_patch!=nullptr) delete [] smooth_elem_patch; - if(rhs_1 !=nullptr) delete rhs_1; - if(rhs_2 !=nullptr) delete rhs_2; - smooth_elem_patch= nullptr; + if (smooth_dof != nullptr) delete[] smooth_dof; + if (smooth_elem_patch != nullptr) delete[] smooth_elem_patch; + if (rhs_1 != nullptr) delete rhs_1; + if (rhs_2 != nullptr) delete rhs_2; + smooth_elem_patch = nullptr; smooth_dof = nullptr; - rhs_1 =nullptr; - rhs_2=nullptr; + rhs_1 = nullptr; + rhs_2 = nullptr; } void Regularity_Estimator::set_space(SpaceSharedPtr new_space) { - if(new_space == nullptr) + if (new_space == nullptr) throw Hermes::Exceptions::Exception("smoothness_indicator: set_space"); free(); space = new_space; - int ndof = space->get_num_dofs(); - smooth_dof = new int[ndof]; + int ndof = space->get_num_dofs(); + smooth_dof = new int[ndof]; smooth_elem_patch = new int[new_space->get_mesh()->get_max_element_id()]; rhs_1 = new SimpleVector(ndof); rhs_2 = new SimpleVector(ndof); } -int* Regularity_Estimator::get_smooth_elems(SpaceSharedPtr new_space,double* coeff_vec,CSCMatrix * mass_matrix) +int* Regularity_Estimator::get_smooth_elems(SpaceSharedPtr new_space, double* coeff_vec, CSCMatrix * mass_matrix) { - if(new_space == nullptr) throw Hermes::Exceptions::Exception("smoothness_indicator: space =nullptr"); - if(coeff_vec==nullptr) throw Hermes::Exceptions::Exception("smoothness_indicator: coeff_vec=nullptr"); - if(space!=new_space) + if (new_space == nullptr) throw Hermes::Exceptions::Exception("smoothness_indicator: space =nullptr"); + if (coeff_vec == nullptr) throw Hermes::Exceptions::Exception("smoothness_indicator: coeff_vec=nullptr"); + if (space != new_space) set_space(new_space); Solution::vector_to_solution(coeff_vec, space, sln); smoothness_indicator(mass_matrix); return smooth_elem_patch; } -int* Regularity_Estimator::get_smooth_dofs(SpaceSharedPtr new_space,double* coeff_vec,CSCMatrix * mass_matrix) +int* Regularity_Estimator::get_smooth_dofs(SpaceSharedPtr new_space, double* coeff_vec, CSCMatrix * mass_matrix) { - if(new_space == nullptr) throw Hermes::Exceptions::Exception("smoothness_indicator: space =nullptr"); - if(coeff_vec==nullptr) throw Hermes::Exceptions::Exception("smoothness_indicator: coeff_vec=nullptr"); - if(space!=new_space) + if (new_space == nullptr) throw Hermes::Exceptions::Exception("smoothness_indicator: space =nullptr"); + if (coeff_vec == nullptr) throw Hermes::Exceptions::Exception("smoothness_indicator: coeff_vec=nullptr"); + if (space != new_space) set_space(new_space); - Solution::vector_to_solution(coeff_vec, space, sln); + Solution::vector_to_solution(coeff_vec, space, sln); smoothness_indicator(mass_matrix); return smooth_dof; } - - //linear approximation of sln in the neighborhood of element e (at (x_i,y_i)) // u_h_hat = u_h (p_c) + R_h(p_c) *(p - p_c) // R_h = (R_h_1, R_h_2), p = (x,y) -double Regularity_Estimator::linear_approx(Element* e, double x_i, double y_i,double x_c, double y_c, MeshFunctionSharedPtr sln) +double Regularity_Estimator::linear_approx(Element* e, double x_i, double y_i, double x_c, double y_c, MeshFunctionSharedPtr sln) { //center of reference element double x_c_ref = 0.; - double y_c_ref = 0.; + double y_c_ref = 0.; double u_h_x_c = (dynamic_cast*>(sln.get()))->get_ref_value(e, x_c_ref, y_c_ref, 0, 0); - double u_h_hat = u_h_x_c + (dynamic_cast*>(R_h_1.get()))->get_ref_value(e, x_c_ref, y_c_ref, 0, 0)*(x_i-x_c)+(dynamic_cast*>(R_h_2.get()))->get_ref_value(e, x_c_ref, y_c_ref, 0, 0)*(y_i-y_c); + double u_h_hat = u_h_x_c + (dynamic_cast*>(R_h_1.get()))->get_ref_value(e, x_c_ref, y_c_ref, 0, 0)*(x_i - x_c) + (dynamic_cast*>(R_h_2.get()))->get_ref_value(e, x_c_ref, y_c_ref, 0, 0)*(y_i - y_c); return u_h_hat; } //linear approximation of the first component of the gradient in the neighborhood of element e (at (x_i,y_i)) // u_h_hat_1 = u_h_dx (p_c) + grad(R_h_1)(p_c) *(p - p_c) -double Regularity_Estimator::linear_approx_dx(Element* e, double x_i, double y_i,double x_c, double y_c,MeshFunctionSharedPtr sln) +double Regularity_Estimator::linear_approx_dx(Element* e, double x_i, double y_i, double x_c, double y_c, MeshFunctionSharedPtr sln) { - //center of reference element + //center of reference element double x_c_ref = 0.; - double y_c_ref = 0.; + double y_c_ref = 0.; double d_u_h_x_c = (dynamic_cast*>(sln.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 1); - double u_h_hat = d_u_h_x_c + (dynamic_cast*>(R_h_1.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 1)*(x_i-x_c) - + (dynamic_cast*>(R_h_1.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 2)*(y_i-y_c); + double u_h_hat = d_u_h_x_c + (dynamic_cast*>(R_h_1.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 1)*(x_i - x_c) + + (dynamic_cast*>(R_h_1.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 2)*(y_i - y_c); return u_h_hat; } //linear approximation of the second component of the gradient in the neighborhood of element e (at (x_i,y_i)) // u_h_hat_2 = u_h_dy (p_c) + grad(R_h_2)(p_c) *(p - p_c) -double Regularity_Estimator::linear_approx_dy(Element* e, double x_i, double y_i,double x_c, double y_c,MeshFunctionSharedPtr sln) +double Regularity_Estimator::linear_approx_dy(Element* e, double x_i, double y_i, double x_c, double y_c, MeshFunctionSharedPtr sln) { - - //center of reference element + //center of reference element double x_c_ref = 0.; - double y_c_ref = 0.; + double y_c_ref = 0.; double d_u_h_x_c = (dynamic_cast*>(sln.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 2); - double u_h_hat = d_u_h_x_c + (dynamic_cast*>(R_h_2.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 1)*(x_i-x_c) - +(dynamic_cast*>(R_h_2.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 2)*(y_i-y_c); + double u_h_hat = d_u_h_x_c + (dynamic_cast*>(R_h_2.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 1)*(x_i - x_c) + + (dynamic_cast*>(R_h_2.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 2)*(y_i - y_c); return u_h_hat; - } - void Regularity_Estimator::smoothness_indicator(CSCMatrix * mass_matrix) { - int ndof = space->get_num_dofs(); - if((mass_matrix!=nullptr)&&(mass_matrix->get_size() != ndof)) + int ndof = space->get_num_dofs(); + if ((mass_matrix != nullptr) && (mass_matrix->get_size() != ndof)) throw Hermes::Exceptions::Exception("smoothness_indicator: mass_matrix size unequal ndof"); + for (int i = 0; i < space->get_mesh()->get_max_element_id(); i++) smooth_elem_patch[i] = 4; - for(int i=0; iget_mesh()->get_max_element_id(); i++) smooth_elem_patch[i] = 4; - - DiscreteProblem * dp_1 = new DiscreteProblem (grad_1, space); - DiscreteProblem * dp_2 = new DiscreteProblem (grad_2, space); + DiscreteProblem * dp_1 = new DiscreteProblem(grad_1, space); + DiscreteProblem * dp_2 = new DiscreteProblem(grad_2, space); bool own_mass_matrix = false; - if(mass_matrix ==nullptr) + if (mass_matrix == nullptr) { - mass_matrix = new CSCMatrix ; - dp_1->assemble(mass_matrix,rhs_1); - own_mass_matrix = true; + mass_matrix = new CSCMatrix < double > ; + dp_1->assemble(mass_matrix, rhs_1); + own_mass_matrix = true; } - else + else dp_1->assemble(rhs_1); dp_2->assemble(rhs_2); - UMFPackLinearMatrixSolver * solver_1 = new UMFPackLinearMatrixSolver (mass_matrix,rhs_1); - UMFPackLinearMatrixSolver * solver_2 = new UMFPackLinearMatrixSolver (mass_matrix,rhs_2); - + UMFPackLinearMatrixSolver * solver_1 = new UMFPackLinearMatrixSolver(mass_matrix, rhs_1); + UMFPackLinearMatrixSolver * solver_2 = new UMFPackLinearMatrixSolver(mass_matrix, rhs_2); try{ solver_1->solve(); } - catch(Hermes::Exceptions::Exception e) + catch (Hermes::Exceptions::Exception e) { e.print_msg(); } @@ -156,192 +148,177 @@ void Regularity_Estimator::smoothness_indicator(CSCMatrix * mass_matrix) try{ solver_2->solve(); } - catch(Hermes::Exceptions::Exception e) + catch (Hermes::Exceptions::Exception e) { e.print_msg(); - } - + } - Solution ::vector_to_solution(solver_1->get_sln_vector() , space, R_h_1); //L2-proj of the first comp. of the gradient - Solution ::vector_to_solution(solver_2->get_sln_vector() , space, R_h_2); //L2-proj of the second comp. of the gradient + //L2-proj of the first comp. of the gradient + Solution ::vector_to_solution(solver_1->get_sln_vector(), space, R_h_1); + //L2-proj of the second comp. of the gradient + Solution ::vector_to_solution(solver_2->get_sln_vector(), space, R_h_2); - std::list* dof_elem_list = new std::list[ndof]; + std::list* dof_elem_list = new std::list[ndof]; double* u_c = new double[space->get_mesh()->get_max_element_id()]; double* d_u_c_dx = new double[space->get_mesh()->get_max_element_id()]; double* d_u_c_dy = new double[space->get_mesh()->get_max_element_id()]; //center of reference element double x_c_ref = 0.; - double y_c_ref = 0.; - Element* e =nullptr; + double y_c_ref = 0.; + Element* e = nullptr; int* index = new int[H2D_MAX_NUMBER_VERTICES]; - for(int i =0;iget_shapeset()->get_vertex_index(i,HERMES_MODE_QUAD); + for (int i = 0; i < H2D_MAX_NUMBER_VERTICES; i++) + index[i] = space->get_shapeset()->get_vertex_index(i, HERMES_MODE_QUAD); //determine value of the solution/gradient at the center of each element // for each dof determine list of elements for_all_active_elements(e, space->get_mesh()) { - u_c[e->id]= (dynamic_cast*>(sln.get()))->get_ref_value(e, x_c_ref, y_c_ref, 0, 0); - d_u_c_dx[e->id]= (dynamic_cast*>(sln.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 1); - d_u_c_dy[e->id]= (dynamic_cast*>(sln.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 2); + u_c[e->id] = (dynamic_cast*>(sln.get()))->get_ref_value(e, x_c_ref, y_c_ref, 0, 0); + d_u_c_dx[e->id] = (dynamic_cast*>(sln.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 1); + d_u_c_dy[e->id] = (dynamic_cast*>(sln.get()))->get_ref_value_transformed(e, x_c_ref, y_c_ref, 0, 2); space->get_element_assembly_list(e, al); for (unsigned int iv = 0; iv < e->get_nvert(); iv++) - { - for(unsigned int j = 0; j < al->get_cnt(); j ++) - { - if((al->get_idx()[j]==index[iv])&&(al->get_dof()[j]!=-1.0)) - dof_elem_list[al->get_dof()[j]].push_back(e->id); - + { + for (unsigned int j = 0; j < al->get_cnt(); j++) + { + if ((al->get_idx()[j] == index[iv]) && (al->get_dof()[j] != -1.0)) + dof_elem_list[al->get_dof()[j]].push_back(e->id); } - } - + } } //------------------------------------------------ - Node* vn=nullptr; - double x_c =0.; double y_c =0.; double u_h_x_c =0.; + Node* vn = nullptr; + double x_c = 0.; double y_c = 0.; double u_h_x_c = 0.; double* x = new double[H2D_MAX_NUMBER_VERTICES]; double* y = new double[H2D_MAX_NUMBER_VERTICES]; - double u_i; double u_dx ,u_dy; + double u_i; double u_dx, u_dy; double u_min, u_max, u_min_dx, u_min_dy, u_max_dx, u_max_dy; - std::list::iterator elem_id; - int smooth_fct_in_elem,smooth_dx_in_elem,smooth_dy_in_elem; - + std::list::iterator elem_id; + int smooth_fct_in_elem, smooth_dx_in_elem, smooth_dy_in_elem; - bool non_smooth = false; bool non_smooth_dx = false;bool non_smooth_dy = false; + bool non_smooth = false; bool non_smooth_dx = false; bool non_smooth_dy = false; for_all_active_elements(e, space->get_mesh()) { non_smooth = false; non_smooth_dx = false; non_smooth_dy = false; - smooth_fct_in_elem =1; //assume as smooth - smooth_dx_in_elem =1; - smooth_dy_in_elem =1; - smooth_elem_patch[e->id]=0; - space->get_element_assembly_list(e, al); + //assume as smooth + smooth_fct_in_elem = 1; + smooth_dx_in_elem = 1; + smooth_dy_in_elem = 1; + smooth_elem_patch[e->id] = 0; + space->get_element_assembly_list(e, al); x_c = 0.; y_c = 0.; for (unsigned int iv = 0; iv < e->get_nvert(); iv++) - { + { vn = e->vn[iv]; - x[iv]=vn->x; y[iv]=vn->y; //x/y-coord of nodes - x_c+= (vn->x); y_c+= (vn->y); // center + x[iv] = vn->x; y[iv] = vn->y; //x/y-coord of nodes + x_c += (vn->x); y_c += (vn->y); // center } - x_c/=e->get_nvert(); y_c/=e->get_nvert(); + x_c /= e->get_nvert(); y_c /= e->get_nvert(); for (unsigned int iv = 0; iv < e->get_nvert(); iv++) - { - for(unsigned int j = 0; j < al->get_cnt(); j ++) - { - if((al->get_idx()[j]==index[iv])&&(al->get_dof()[j]!=-1.0)) + { + for (unsigned int j = 0; j < al->get_cnt(); j++) + { + if ((al->get_idx()[j] == index[iv]) && (al->get_dof()[j] != -1.0)) { - u_i = linear_approx(e, x[iv], y[iv],x_c, y_c,sln); - u_dx = linear_approx_dx(e, x[iv], y[iv],x_c, y_c,sln); - u_dy = linear_approx_dy(e, x[iv], y[iv],x_c, y_c,sln); - u_min = u_c[e->id]; u_max =u_c[e->id]; - u_min_dx= d_u_c_dx[e->id]; u_max_dx= d_u_c_dx[e->id]; - u_min_dy= d_u_c_dy[e->id]; u_max_dy= d_u_c_dy[e->id]; - for(elem_id=dof_elem_list[al->get_dof()[j]].begin();elem_id!=dof_elem_list[al->get_dof()[j]].end();elem_id++) - { - if(u_c[*elem_id]>u_max) u_max = u_c[*elem_id]; - else if(u_c[*elem_id]u_max_dx) u_max_dx = d_u_c_dx[*elem_id]; - else if(d_u_c_dx[*elem_id]u_max_dy) u_max_dy = d_u_c_dy[*elem_id]; - else if(d_u_c_dy[*elem_id]id]; u_max = u_c[e->id]; + u_min_dx = d_u_c_dx[e->id]; u_max_dx = d_u_c_dx[e->id]; + u_min_dy = d_u_c_dy[e->id]; u_max_dy = d_u_c_dy[e->id]; + for (elem_id = dof_elem_list[al->get_dof()[j]].begin(); elem_id != dof_elem_list[al->get_dof()[j]].end(); elem_id++) + { + if (u_c[*elem_id] > u_max) u_max = u_c[*elem_id]; + else if (u_c[*elem_id]u_max_dx) u_max_dx = d_u_c_dx[*elem_id]; + else if (d_u_c_dx[*elem_id]u_max_dy) u_max_dy = d_u_c_dy[*elem_id]; + else if (d_u_c_dy[*elem_id]u_min+epsilon)&&(u_iu_min + epsilon) && (u_iu_min_dx+epsilon)&&(u_dxu_min_dx + epsilon) && (u_dxu_min_dy+epsilon)&&(u_dyu_min_dy + epsilon) && (u_dy < u_max_dy - epsilon)) non_smooth_dy = false; + else non_smooth_dy = true; break; } } - if(non_smooth == true) smooth_fct_in_elem=0; - if(non_smooth_dx == true) smooth_dx_in_elem=0; - if(non_smooth_dy == true) smooth_dy_in_elem=0; - if((non_smooth == true)&&(non_smooth_dx == true)&&(non_smooth_dy == true)) break; + if (non_smooth == true) smooth_fct_in_elem = 0; + if (non_smooth_dx == true) smooth_dx_in_elem = 0; + if (non_smooth_dy == true) smooth_dy_in_elem = 0; + if ((non_smooth == true) && (non_smooth_dx == true) && (non_smooth_dy == true)) break; } - if(std::max(smooth_fct_in_elem, std::min(smooth_dx_in_elem,smooth_dy_in_elem))==1) - smooth_elem_patch[e->id]=1; - - + if (std::max(smooth_fct_in_elem, std::min(smooth_dx_in_elem, smooth_dy_in_elem)) == 1) + smooth_elem_patch[e->id] = 1; } - - - for(int i =0; i sln) : WeakForm(1) -{ this->set_ext(sln); -add_matrix_form(new GradientReconstructionMatForm_1(0, 0)); -GradientReconstructionVectorForm_1* vector_form = new GradientReconstructionVectorForm_1(0); -add_vector_form(vector_form); +//R_H^1 +GradientReconstruction_1::GradientReconstruction_1(MeshFunctionSharedPtr sln) : WeakForm(1) +{ + this->set_ext(sln); + add_matrix_form(new GradientReconstructionMatForm_1(0, 0)); + GradientReconstructionVectorForm_1* vector_form = new GradientReconstructionVectorForm_1(0); + add_vector_form(vector_form); }; - - template -Scalar GradientReconstructionMatForm_1 ::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const +Scalar GradientReconstructionMatForm_1::matrix_form(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { - - Scalar result = Scalar(0); - for (int i = 0; i < n; i++) - result += wt[i] * (u->val[i] * v->val[i] ); + Scalar result = Scalar(0); + for (int i = 0; i < n; i++) + result += wt[i] * (u->val[i] * v->val[i]); return result; - }; -double GradientReconstructionMatForm_1 ::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const +double GradientReconstructionMatForm_1::value(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); }; -Ord GradientReconstructionMatForm_1 ::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const +Ord GradientReconstructionMatForm_1::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, + GeomVol *e, Func **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); }; @@ -352,20 +329,19 @@ MatrixFormVol* GradientReconstructionMatForm_1::clone() const } template -Scalar GradientReconstructionVectorForm_1::vector_form(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const { +Scalar GradientReconstructionVectorForm_1::vector_form(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { Scalar result = Scalar(0); Func* u_h = ext[0]; - for (int i = 0; i < n; i++) - result += wt[i]*(v->val[i]*u_h->dx[i]); + for (int i = 0; i < n; i++) + result += wt[i] * (v->val[i] * u_h->dx[i]); return result; - }; -double GradientReconstructionVectorForm_1::value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const { +double GradientReconstructionVectorForm_1::value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { return vector_form(n, wt, u_ext, v, e, ext); }; -Ord GradientReconstructionVectorForm_1::ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const +Ord GradientReconstructionVectorForm_1::ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { return vector_form(n, wt, u_ext, v, e, ext); }; @@ -375,7 +351,7 @@ VectorFormVol* GradientReconstructionVectorForm_1::clone() const } //R_H^2 -GradientReconstruction_2::GradientReconstruction_2( MeshFunctionSharedPtr sln) : WeakForm(1) +GradientReconstruction_2::GradientReconstruction_2(MeshFunctionSharedPtr sln) : WeakForm(1) { this->set_ext(sln); add_matrix_form(new GradientReconstructionMatForm_2(0, 0)); @@ -383,25 +359,23 @@ GradientReconstruction_2::GradientReconstruction_2( MeshFunctionSharedPtr -Scalar GradientReconstructionMatForm_2 ::matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const +Scalar GradientReconstructionMatForm_2::matrix_form(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { - Scalar result = Scalar(0); - for (int i = 0; i < n; i++) - result += wt[i] * (u->val[i] * v->val[i] ); + Scalar result = Scalar(0); + for (int i = 0; i < n; i++) + result += wt[i] * (u->val[i] * v->val[i]); return result; }; -double GradientReconstructionMatForm_2 ::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const +double GradientReconstructionMatForm_2::value(int n, double *wt, Func *u_ext[], Func *u, + Func *v, GeomVol *e, Func **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); }; -Ord GradientReconstructionMatForm_2 ::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const +Ord GradientReconstructionMatForm_2::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, + GeomVol *e, Func **ext) const { return matrix_form(n, wt, u_ext, u, v, e, ext); }; @@ -412,20 +386,19 @@ MatrixFormVol* GradientReconstructionMatForm_2::clone() const } template -Scalar GradientReconstructionVectorForm_2::vector_form(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const { +Scalar GradientReconstructionVectorForm_2::vector_form(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { Scalar result = Scalar(0); Func* u_h = ext[0]; - for (int i = 0; i < n; i++) - result += wt[i]*(v->val[i]*u_h->dy[i]); + for (int i = 0; i < n; i++) + result += wt[i] * (v->val[i] * u_h->dy[i]); return result; - }; -double GradientReconstructionVectorForm_2::value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const { +double GradientReconstructionVectorForm_2::value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { return vector_form(n, wt, u_ext, v, e, ext); }; -Ord GradientReconstructionVectorForm_2::ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const +Ord GradientReconstructionVectorForm_2::ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const { return vector_form(n, wt, u_ext, v, e, ext); }; @@ -433,6 +406,4 @@ Ord GradientReconstructionVectorForm_2::ord(int n, double *wt, Func *u_ext[ VectorFormVol* GradientReconstructionVectorForm_2::clone() const { return new GradientReconstructionVectorForm_2(*this); -} - - +} \ No newline at end of file diff --git a/hermes2d/test_examples/13-FCT/reg_estimator.h b/hermes2d/test_examples/13-FCT/reg_estimator.h index fa014d2a4e..89cba03760 100644 --- a/hermes2d/test_examples/13-FCT/reg_estimator.h +++ b/hermes2d/test_examples/13-FCT/reg_estimator.h @@ -23,14 +23,14 @@ class GradientReconstructionMatForm_1 : public MatrixFormVol template Scalar matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual double value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; MatrixFormVol* clone() const; }; @@ -42,12 +42,12 @@ class GradientReconstructionVectorForm_1 : public VectorFormVol GradientReconstructionVectorForm_1(int i) : VectorFormVol(i) { } template - Scalar vector_form(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const ; + Scalar vector_form(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; - virtual double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + virtual double value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; - virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; VectorFormVol* clone() const; }; @@ -68,14 +68,14 @@ class GradientReconstructionMatForm_2 : public MatrixFormVol template Scalar matrix_form(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual double value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; MatrixFormVol* clone() const; }; @@ -86,12 +86,12 @@ class GradientReconstructionVectorForm_2 : public VectorFormVol GradientReconstructionVectorForm_2(int i) : VectorFormVol(i) { } template - Scalar vector_form(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const ; + Scalar vector_form(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; - virtual double value(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + virtual double value(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; - virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, Geom *e, Func **ext) const; + virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, GeomVol *e, Func **ext) const; VectorFormVol* clone() const; }; @@ -133,8 +133,8 @@ class Regularity_Estimator MeshFunctionSharedPtr sln; MeshFunctionSharedPtr R_h_1; MeshFunctionSharedPtr R_h_2; - GradientReconstruction_1* grad_1; - GradientReconstruction_2* grad_2; + WeakFormSharedPtr grad_1; + WeakFormSharedPtr grad_2; SpaceSharedPtr space; SimpleVector * rhs_1; SimpleVector * rhs_2; diff --git a/hermes2d/test_examples/14-error-calculation/definitions.cpp b/hermes2d/test_examples/14-error-calculation/definitions.cpp index b26f36d6d8..93be8a5e06 100644 --- a/hermes2d/test_examples/14-error-calculation/definitions.cpp +++ b/hermes2d/test_examples/14-error-calculation/definitions.cpp @@ -16,61 +16,60 @@ static double custom_fn(int n, double *wt, DiscontinuousFunc *u, Discont return result; } -CustomNormFormVol::CustomNormFormVol(int i, int j) : NormFormVol(i, j) +CustomNormFormVol::CustomNormFormVol(int i, int j) : NormFormVol(i, j, CoarseSolutions) { this->set_area(HERMES_ANY); } -CustomNormFormSurf::CustomNormFormSurf(int i, int j) : NormFormSurf(i, j) +CustomNormFormSurf::CustomNormFormSurf(int i, int j) : NormFormSurf(i, j, CoarseSolutions) { this->set_area(HERMES_ANY); } -CustomNormFormDG::CustomNormFormDG(int i, int j) : NormFormDG(i, j) +CustomNormFormDG::CustomNormFormDG(int i, int j) : NormFormDG(i, j, CoarseSolutions) { } -double CustomNormFormVol::value(int n, double *wt, Func *u, Func *v, Geom *e) const +double CustomNormFormVol::value(int n, double *wt, Func *u, Func *v, GeomVol *e) const { return custom_fn(n, wt, u, v); } -double CustomNormFormSurf::value(int n, double *wt, Func *u, Func *v, Geom *e) const +double CustomNormFormSurf::value(int n, double *wt, Func *u, Func *v, GeomSurf *e) const { return custom_fn(n, wt, u, v); } -double CustomNormFormDG::value(int n, double *wt, DiscontinuousFunc *u, DiscontinuousFunc *v, Geom *e) const +double CustomNormFormDG::value(int n, double *wt, DiscontinuousFunc *u, DiscontinuousFunc *v, GeomSurf *e) const { return custom_fn(n, wt, u, v); } - CustomExactSolutionScalar::CustomExactSolutionScalar(MeshSharedPtr mesh) - : ExactSolutionScalar(mesh) + : ExactSolutionScalar(mesh) { } -double CustomExactSolutionScalar::value(double x, double y) const +double CustomExactSolutionScalar::value(double x, double y) const { - if(this->element_id == 1 || this->element_id == 3) + if (this->element_id == 1 || this->element_id == 3) return 0.0; else return 2.0; } -void CustomExactSolutionScalar::derivatives(double x, double y, double& dx, double& dy) const +void CustomExactSolutionScalar::derivatives(double x, double y, double& dx, double& dy) const { dx = 0.0; dy = 0.0; } -Ord CustomExactSolutionScalar::ord(double x, double y) const +Ord CustomExactSolutionScalar::ord(double x, double y) const { return Ord(1); } -CustomExactSolutionScalar::~CustomExactSolutionScalar() +CustomExactSolutionScalar::~CustomExactSolutionScalar() { } diff --git a/hermes2d/test_examples/14-error-calculation/definitions.h b/hermes2d/test_examples/14-error-calculation/definitions.h index c426652c7f..bed408e85a 100644 --- a/hermes2d/test_examples/14-error-calculation/definitions.h +++ b/hermes2d/test_examples/14-error-calculation/definitions.h @@ -9,7 +9,7 @@ class CustomNormFormVol : public NormFormVol public: CustomNormFormVol(int i, int j); - virtual double value(int n, double *wt, Func *u, Func *v, Geom *e) const; + virtual double value(int n, double *wt, Func *u, Func *v, GeomVol *e) const; }; class CustomNormFormSurf : public NormFormSurf @@ -17,7 +17,7 @@ class CustomNormFormSurf : public NormFormSurf public: CustomNormFormSurf(int i, int j); - virtual double value(int n, double *wt, Func *u, Func *v, Geom *e) const; + virtual double value(int n, double *wt, Func *u, Func *v, GeomSurf *e) const; }; class CustomNormFormDG : public NormFormDG @@ -25,7 +25,7 @@ class CustomNormFormDG : public NormFormDG public: CustomNormFormDG(int i, int j); - virtual double value(int n, double *wt, DiscontinuousFunc *u, DiscontinuousFunc *v, Geom *e) const; + virtual double value(int n, double *wt, DiscontinuousFunc *u, DiscontinuousFunc *v, GeomSurf *e) const; }; /* diff --git a/hermes2d/test_examples/14-error-calculation/main.cpp b/hermes2d/test_examples/14-error-calculation/main.cpp index 8a2cd932c1..a3fa21fb4a 100644 --- a/hermes2d/test_examples/14-error-calculation/main.cpp +++ b/hermes2d/test_examples/14-error-calculation/main.cpp @@ -19,14 +19,14 @@ int main(int argc, char* argv[]) EssentialBCs bcs_fine(&bc_fine); // Create an H1 space with default shapeset. - SpaceSharedPtr space_coarse(new H1Space(mesh_coarse, &bcs_coarse, 1)); - SpaceSharedPtr space_fine(new H1Space(mesh_fine, &bcs_fine, 1)); + SpaceSharedPtr space_coarse(new H1Space(mesh_coarse, &bcs_coarse, 2)); + SpaceSharedPtr space_fine(new H1Space(mesh_fine, &bcs_fine, 3)); - // Translate the coefficient vector into a Solution. + // Translate the coefficient vector into a Solution. MeshFunctionSharedPtr fn_coarse(new ConstantSolution(mesh_coarse, 1.0)); MeshFunctionSharedPtr fn_fine_const(new ConstantSolution(mesh_fine, 2.0)); MeshFunctionSharedPtr fn_fine_non_const(new CustomExactSolutionScalar(mesh_fine)); - + #ifdef CUSTOM_DEBUG // Visualise the solution and mesh. ScalarView s_view; @@ -39,9 +39,9 @@ int main(int argc, char* argv[]) #endif ErrorCalculator errorCalculator(AbsoluteError); - errorCalculator.add_error_form(new CustomNormFormVol(0,0)); - errorCalculator.add_error_form(new CustomNormFormSurf(0,0)); - errorCalculator.add_error_form(new CustomNormFormDG(0,0)); + errorCalculator.add_error_form(new CustomNormFormVol(0, 0)); + errorCalculator.add_error_form(new CustomNormFormSurf(0, 0)); + errorCalculator.add_error_form(new CustomNormFormDG(0, 0)); errorCalculator.calculate_errors(fn_coarse, fn_fine_const); @@ -49,7 +49,7 @@ int main(int argc, char* argv[]) std::cout << "Total error const: " << errorCalculator.get_total_error_squared() << std::endl; #endif - if(std::abs(errorCalculator.get_total_error_squared() - 5.0) > 1e-10) + if (std::abs(errorCalculator.get_total_error_squared() - 5.0) > 1e-10) return -1; errorCalculator.calculate_errors(fn_coarse, fn_fine_non_const); @@ -58,8 +58,11 @@ int main(int argc, char* argv[]) std::cout << "Total error nonconst: " << errorCalculator.get_total_error_squared() << std::endl; #endif - if(std::abs(errorCalculator.get_total_error_squared() - 13.0) > 1e-10) + if (std::abs(errorCalculator.get_total_error_squared() - 13.0) > 1e-10) + { + std::cout << "Failure!"; return -1; + } std::cout << "Success!"; return 0; diff --git a/hermes2d/test_examples/09-trilinos-nonlinear/CMakeLists.txt b/hermes2d/test_examples/14-trilinos-nonlinear/CMakeLists.txt similarity index 87% rename from hermes2d/test_examples/09-trilinos-nonlinear/CMakeLists.txt rename to hermes2d/test_examples/14-trilinos-nonlinear/CMakeLists.txt index da08995803..0e4ad33d58 100644 --- a/hermes2d/test_examples/09-trilinos-nonlinear/CMakeLists.txt +++ b/hermes2d/test_examples/14-trilinos-nonlinear/CMakeLists.txt @@ -1,4 +1,4 @@ -project(09-trilinos-nonlinear) +project(14-trilinos-nonlinear) add_executable(${PROJECT_NAME} main.cpp definitions.cpp) diff --git a/hermes2d/test_examples/09-trilinos-nonlinear/definitions.cpp b/hermes2d/test_examples/14-trilinos-nonlinear/definitions.cpp similarity index 60% rename from hermes2d/test_examples/09-trilinos-nonlinear/definitions.cpp rename to hermes2d/test_examples/14-trilinos-nonlinear/definitions.cpp index 1575a4f9b5..cf20838df1 100644 --- a/hermes2d/test_examples/09-trilinos-nonlinear/definitions.cpp +++ b/hermes2d/test_examples/14-trilinos-nonlinear/definitions.cpp @@ -2,12 +2,12 @@ double CustomRightHandSide::value(double x, double y) const { - return - kx(x, y) * dudx(x, y) - ky(x, y) * dudy(x, y) - k(x, y) * (dudxx(x, y) + dudyy(x, y)); + return -kx(x, y) * dudx(x, y) - ky(x, y) * dudy(x, y) - k(x, y) * (dudxx(x, y) + dudyy(x, y)); } Ord CustomRightHandSide::ord(Ord x, Ord y) const { - return - kx(x, y) * dudx(x, y) - ky(x, y) * dudy(x, y) - k(x, y) * (dudxx(x, y) + dudyy(x, y)); + return -kx(x, y) * dudx(x, y) - ky(x, y) * dudy(x, y) - k(x, y) * (dudxx(x, y) + dudyy(x, y)); } template @@ -19,31 +19,31 @@ Real CustomRightHandSide::u(Real x, Real y) const template Real CustomRightHandSide::dudx(Real x, Real y) const { - return (1- 2*x) * y * (1 - y); + return (1 - 2 * x) * y * (1 - y); } template Real CustomRightHandSide::dudy(Real x, Real y) const { - return (1- 2*y) * x * (1 - x); + return (1 - 2 * y) * x * (1 - x); } template Real CustomRightHandSide::dudxx(Real x, Real y) const { - return -2.0 * (y-y*y); + return -2.0 * (y - y*y); } template Real CustomRightHandSide::dudyy(Real x, Real y) const { - return -2.0 * (x-x*x); + return -2.0 * (x - x*x); } template Real CustomRightHandSide::dudxy(Real x, Real y) const { - return (1- 2*y) * (1 - 2*x); + return (1 - 2 * y) * (1 - 2 * x); } template @@ -56,95 +56,95 @@ template Real CustomRightHandSide::kx(Real x, Real y) const { return -0.5 * Hermes::pow(1.0 + sqr(dudx(x, y)) + sqr(dudy(x, y)), -1.5) * - (2.0 * dudx(x, y) * dudxx(x, y) + 2.0 * dudy(x, y) * dudxy(x, y)); + (2.0 * dudx(x, y) * dudxx(x, y) + 2.0 * dudy(x, y) * dudxy(x, y)); } template Real CustomRightHandSide::ky(Real x, Real y) const { return -0.5 * Hermes::pow(1.0 + sqr(dudx(x, y)) + sqr(dudy(x, y)), -1.5) * - (2.0 * dudx(x, y) * dudxy(x, y) + 2.0 * dudy(x, y) * dudyy(x, y)); + (2.0 * dudx(x, y) * dudxy(x, y) + 2.0 * dudy(x, y) * dudyy(x, y)); } double CustomExactSolution::value(double x, double y) const { - return x * y * (1-x) * (1-y); + return x * y * (1 - x) * (1 - y); } -void CustomExactSolution::derivatives (double x, double y, double& dx, double& dy) const +void CustomExactSolution::derivatives(double x, double y, double& dx, double& dy) const { - dx = (1- 2*x) * y * (1 - y); - dy = (1- 2*y) * x * (1 - x); + dx = (1 - 2 * x) * y * (1 - y); + dy = (1 - 2 * y) * x * (1 - x); } Ord CustomExactSolution::ord(double x, double y) const { - return Hermes::Ord((1- 2*x) * y * (1 - y)); + return Hermes::Ord((1 - 2 * x) * y * (1 - y)); } CustomWeakForm::CustomWeakForm(bool JFNK, bool precondition_jacobian, bool precondition_jacobian_approx) : WeakForm(1, JFNK) { // Jacobian forms - volumetric. - if(!JFNK || precondition_jacobian) + if (!JFNK || precondition_jacobian) add_matrix_form(new JacobianFormVol(0, 0)); // Residual forms - volumetric. add_vector_form(new ResidualFormVol(0, new CustomRightHandSide())); // Preconditioning form. - if(JFNK && precondition_jacobian_approx) + if (JFNK && precondition_jacobian_approx) add_matrix_form(new PrecondFormVol(0, 0)); } double CustomWeakForm::JacobianFormVol::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { double result = 0; for (int i = 0; i < n; i++) - result += wt[i] * ( -2.75 * Hermes::pow(1.0 + sqr(u_ext[0]->dx[i]) + sqr(u_ext[0]->dy[i]), -1.5) * - (2.0 * u_ext[0]->dx[i] * u->dx[i] + 2.0 * u_ext[0]->dx[i] * u->dx[i]) - * (u_ext[0]->dx[i] * v->dx[i] + u_ext[0]->dy[i] * v->dy[i]) + - (Hermes::pow(1.0 + sqr(u_ext[0]->dx[i]) + sqr(u_ext[0]->dy[i]), -0.5)) - * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]) ); + result += wt[i] * (-2.75 * Hermes::pow(1.0 + sqr(u_ext[0]->dx[i]) + sqr(u_ext[0]->dy[i]), -1.5) * + (2.0 * u_ext[0]->dx[i] * u->dx[i] + 2.0 * u_ext[0]->dx[i] * u->dx[i]) + * (u_ext[0]->dx[i] * v->dx[i] + u_ext[0]->dy[i] * v->dy[i]) + + (Hermes::pow(1.0 + sqr(u_ext[0]->dx[i]) + sqr(u_ext[0]->dy[i]), -0.5)) + * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i])); return result; } Ord CustomWeakForm::JacobianFormVol::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { // Returning the sum of the degrees of the basis and test function plus two. return Ord(10); } double CustomWeakForm::ResidualFormVol::value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { Func* u = u_ext[0]; double result = 0; for (int i = 0; i < n; i++) result += wt[i] * ((Hermes::pow(1.0 + sqr(u->dx[i]) + sqr(u->dy[i]), -0.5)) * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]) - - rhs->value(e->x[i], e->y[i]) * v->val[i] ); + - rhs->value(e->x[i], e->y[i]) * v->val[i]); return result; } Ord CustomWeakForm::ResidualFormVol::ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { // Returning the sum of the degrees of the test function and solution plus two. return Ord(10); } double CustomWeakForm::PrecondFormVol::value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const + Func *v, GeomVol *e, Func **ext) const { double result = 0; for (int i = 0; i < n; i++) - result += wt[i] * ( u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]); + result += wt[i] * (u->dx[i] * v->dx[i] + u->dy[i] * v->dy[i]); return result; } Ord CustomWeakForm::PrecondFormVol::ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const + GeomVol *e, Func **ext) const { // Returning the sum of the degrees of the basis and test function plus two. return Ord(10); diff --git a/hermes2d/test_examples/09-trilinos-nonlinear/definitions.h b/hermes2d/test_examples/14-trilinos-nonlinear/definitions.h similarity index 87% rename from hermes2d/test_examples/09-trilinos-nonlinear/definitions.h rename to hermes2d/test_examples/14-trilinos-nonlinear/definitions.h index f7c4c90762..b92b284190 100644 --- a/hermes2d/test_examples/09-trilinos-nonlinear/definitions.h +++ b/hermes2d/test_examples/14-trilinos-nonlinear/definitions.h @@ -47,6 +47,8 @@ class CustomExactSolution : public ExactSolutionScalar virtual void derivatives (double x, double y, double& dx, double& dy) const; virtual Ord ord(double x, double y) const; + + MeshFunction* clone() const { return new CustomExactSolution(mesh); } }; /* Weak form */ @@ -67,10 +69,10 @@ class CustomWeakForm : public WeakForm }; virtual double value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const { return new JacobianFormVol(i, j); } }; @@ -81,10 +83,10 @@ class CustomWeakForm : public WeakForm ResidualFormVol(int i, CustomRightHandSide* rhs) : VectorFormVol(i), rhs(rhs) {}; virtual double value(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual VectorFormVol* clone() const { return new ResidualFormVol(i, rhs); } private: @@ -101,10 +103,10 @@ class CustomWeakForm : public WeakForm }; virtual double value(int n, double *wt, Func *u_ext[], Func *u, - Func *v, Geom *e, Func **ext) const; + Func *v, GeomVol *e, Func **ext) const; virtual Ord ord(int n, double *wt, Func *u_ext[], Func *u, Func *v, - Geom *e, Func **ext) const; + GeomVol *e, Func **ext) const; virtual MatrixFormVol* clone() const { return new PrecondFormVol(i, j); } }; diff --git a/hermes2d/test_examples/09-trilinos-nonlinear/main.cpp b/hermes2d/test_examples/14-trilinos-nonlinear/main.cpp similarity index 62% rename from hermes2d/test_examples/09-trilinos-nonlinear/main.cpp rename to hermes2d/test_examples/14-trilinos-nonlinear/main.cpp index b3fda72045..3407c6ca99 100644 --- a/hermes2d/test_examples/09-trilinos-nonlinear/main.cpp +++ b/hermes2d/test_examples/14-trilinos-nonlinear/main.cpp @@ -1,4 +1,4 @@ -#include "definitions.h" +#include "definitions.h" using namespace Teuchos; @@ -39,14 +39,14 @@ const char* preconditioner = "least-squares"; // Name of the preconditioner // Possibilities: none, jacobi, neumann, least-squares, or a // preconditioner from IFPACK (see solver/aztecoo.h) // NOX parameters. -unsigned message_type = 0;//NOX::Utils::Error | NOX::Utils::Warning | NOX::Utils::OuterIteration | NOX::Utils::InnerIteration | NOX::Utils::Parameters | NOX::Utils::LinearSolverDetails; +unsigned message_type = NOX::Utils::Error | NOX::Utils::Warning | NOX::Utils::OuterIteration | NOX::Utils::InnerIteration | NOX::Utils::Parameters | NOX::Utils::LinearSolverDetails; // NOX error messages, see NOX_Utils.h. -double ls_tolerance = 1e-5; // Tolerance for linear system. -unsigned flag_absresid = 0; // Flag for absolute value of the residuum. +double ls_tolerance = 1e-2; // Tolerance for linear system. +unsigned flag_absresid = 1; // Flag for absolute value of the residuum. double abs_resid = 1.0e-8; // Tolerance for absolute value of the residuum. -unsigned flag_relresid = 1; // Flag for relative value of the residuum. -double rel_resid = 1.0e-8; // Tolerance for relative value of the residuum. +unsigned flag_relresid = 0; // Flag for relative value of the residuum. +double rel_resid = 1.0e-2; // Tolerance for relative value of the residuum. int max_iters = 100; // Max number of iterations. // Error calculation & adaptivity. @@ -54,8 +54,6 @@ DefaultErrorCalculator errorCalculator(RelativeErrorToGl int main(int argc, char* argv[]) { - HermesCommonApi.set_integral_param_value(numThreads, 1); - // Load the mesh. MeshSharedPtr mesh(new Mesh); MeshReaderH2D mloader; @@ -70,53 +68,22 @@ int main(int argc, char* argv[]) EssentialBCs bcs(&bc); // Create an H1 space with default shapeset. - SpaceSharedPtr space1(new H1Space(mesh, &bcs, P_INIT)); - SpaceSharedPtr space2(new H1Space(mesh, &bcs, P_INIT)); - int ndof = Space::get_num_dofs(space1); - - // Initialize weak formulation, - CustomWeakForm wf1; - - // Initialize the discrete problem. - DiscreteProblem dp1(&wf1, space1); + SpaceSharedPtr space(new H1Space(mesh, &bcs, P_INIT)); // Perform Newton's iteration and translate the resulting coefficient vector into a Solution. - MeshFunctionSharedPtr sln1(new Hermes::Hermes2D::Solution()); - MeshFunctionSharedPtr sln2(new Hermes::Hermes2D::Solution()); - - Hermes::Hermes2D::NewtonSolver newton(&dp1); - newton.set_verbose_output(true); - try - { - newton.solve(); - } - catch (Hermes::Exceptions::Exception& e) - { - e.print_msg(); - } - - Solution::vector_to_solution(newton.get_sln_vector(), space1, sln1); - - // Show UMFPACK solution. - Views::ScalarView view1("Solution 1", new Views::WinGeom(0, 0, 500, 400)); - view1.show(sln1); - Views::View::wait(); + MeshFunctionSharedPtr sln(new Hermes::Hermes2D::Solution()); MeshFunctionSharedPtr ex(new CustomExactSolution(mesh)); - // TRILINOS PART: - // Initialize the weak formulation for Trilinos. - CustomWeakForm wf2(JFNK, PRECOND == 1, PRECOND == 2); - - // Initialize DiscreteProblem. - DiscreteProblemNOX dp2(&wf2, space2); + WeakFormSharedPtr wf(new CustomWeakForm(JFNK, PRECOND == 1, PRECOND == 2)); // Initialize the NOX solver with the vector "coeff_vec". - NewtonSolverNOX nox_solver(&dp2); + NewtonSolverNOX nox_solver(wf, space); + nox_solver.set_verbose_output(true); nox_solver.set_output_flags(message_type); nox_solver.set_ls_tolerance(ls_tolerance); - nox_solver.set_conv_rel_resid(rel_resid); + nox_solver.set_conv_abs_resid(abs_resid); nox_solver.set_conv_iters(max_iters); // Choose preconditioning. @@ -130,23 +97,17 @@ int main(int argc, char* argv[]) // Solve the nonlinear problem using NOX. try { - nox_solver.solve(NULL); + nox_solver.solve(ex); } catch (Hermes::Exceptions::Exception& e) { e.print_msg(); } - Solution::vector_to_solution(nox_solver.get_sln_vector(), space2, sln2); - - // Calculate error. - errorCalculator.calculate_errors(sln1, ex); - double rel_err_1 = errorCalculator.get_error_squared(0) * 100; - errorCalculator.calculate_errors(sln2, ex); - double rel_err_2 = errorCalculator.get_error_squared(0) * 100; + Solution::vector_to_solution(nox_solver.get_sln_vector(), space, sln); // Show NOX solution. - Views::ScalarView view2("Solution 2", new Views::WinGeom(510, 0, 500, 400)); - view2.show(sln2); + Views::ScalarView view("Solution 2", new Views::WinGeom(510, 0, 500, 400)); + view.show(sln); // Wait for all views to be closed. Views::View::wait(); diff --git a/hermes2d/test_examples/09-trilinos-nonlinear/square.mesh b/hermes2d/test_examples/14-trilinos-nonlinear/square.mesh similarity index 100% rename from hermes2d/test_examples/09-trilinos-nonlinear/square.mesh rename to hermes2d/test_examples/14-trilinos-nonlinear/square.mesh diff --git a/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/CMakeLists.txt b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/CMakeLists.txt new file mode 100644 index 0000000000..6c2afcfcf2 --- /dev/null +++ b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/CMakeLists.txt @@ -0,0 +1,9 @@ +project(15-adaptivity-matrix-reuse-simple) + +add_executable(${PROJECT_NAME} main.cpp definitions.cpp) + +if(NOT MSVC) + set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_FLAGS ${HERMES_FLAGS}) +endif() + +target_link_libraries(${PROJECT_NAME} ${HERMES2D}) diff --git a/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/definitions.cpp b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/definitions.cpp new file mode 100644 index 0000000000..fbb68cce9e --- /dev/null +++ b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/definitions.cpp @@ -0,0 +1,20 @@ +#include "definitions.h" + +/* Weak forms */ + +CustomWeakFormPoisson::CustomWeakFormPoisson(Hermes::Hermes2DFunction* src_term) : Hermes::Hermes2D::WeakForm(1) +{ + // Jacobian forms. + add_matrix_form(new Hermes::Hermes2D::WeakFormsH1::DefaultMatrixFormDiffusion(0, 0)); + add_matrix_form(new Hermes::Hermes2D::WeakFormsH1::DefaultMatrixFormDiffusion(0, 0)); + add_matrix_form(new Hermes::Hermes2D::WeakFormsH1::DefaultMatrixFormDiffusion(0, 0)); + add_matrix_form(new Hermes::Hermes2D::WeakFormsH1::DefaultMatrixFormDiffusion(0, 0)); + add_matrix_form(new Hermes::Hermes2D::WeakFormsH1::DefaultMatrixFormDiffusion(0, 0)); + + // Residual forms. + add_vector_form(new Hermes::Hermes2D::WeakFormsH1::DefaultVectorFormVol(0, Hermes::HERMES_ANY, src_term)); + add_vector_form(new Hermes::Hermes2D::WeakFormsH1::DefaultVectorFormVol(0, Hermes::HERMES_ANY, src_term)); + add_vector_form(new Hermes::Hermes2D::WeakFormsH1::DefaultVectorFormVol(0, Hermes::HERMES_ANY, src_term)); + add_vector_form(new Hermes::Hermes2D::WeakFormsH1::DefaultVectorFormVol(0, Hermes::HERMES_ANY, src_term)); + add_vector_form(new Hermes::Hermes2D::WeakFormsH1::DefaultVectorFormVol(0, Hermes::HERMES_ANY, src_term)); +}; \ No newline at end of file diff --git a/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/definitions.h b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/definitions.h new file mode 100644 index 0000000000..19c4ecbb0e --- /dev/null +++ b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/definitions.h @@ -0,0 +1,11 @@ +#include "hermes2d.h" + +/* Weak forms */ +using namespace Hermes; +using namespace Hermes::Hermes2D; + +class CustomWeakFormPoisson : public Hermes::Hermes2D::WeakForm +{ +public: + CustomWeakFormPoisson(Hermes::Hermes2DFunction* src_term); +}; diff --git a/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/domain.xml b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/domain.xml new file mode 100644 index 0000000000..ea939bd06a --- /dev/null +++ b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/domain.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/init.xml b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/init.xml new file mode 100644 index 0000000000..8ec0f3c385 --- /dev/null +++ b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/init.xml @@ -0,0 +1 @@ +01234567891011121314153233343536373839404401234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257333435364250515253545557580123456789101132373839404143444556012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625712131415161718192021222324252627282930313334353642464748495859606162012345678910113237383940414344455051525354555657 \ No newline at end of file diff --git a/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/main.cpp b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/main.cpp new file mode 100644 index 0000000000..77d8cf5673 --- /dev/null +++ b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/main.cpp @@ -0,0 +1,146 @@ +#include "definitions.h" + +using namespace Hermes; +using namespace Hermes::Hermes2D; +using namespace Hermes::Hermes2D::Views; +using namespace Hermes::Hermes2D::RefinementSelectors; + +// Uniform polynomial degree of mesh elements. +const int P_INIT = 3; +// Number of initial uniform mesh refinements. +const int INIT_REF_NUM = 0; + +// Problem parameters. +// Thermal cond. of Al for temperatures around 20 deg Celsius. +const double LAMBDA_AL = 236.0; +// Thermal cond. of Cu for temperatures around 20 deg Celsius. +const double LAMBDA_CU = 386.0; +// Volume heat sources generated (for example) by electric current. +const double VOLUME_HEAT_SRC = 5; +// Fixed temperature on the boundary. +const double FIXED_BDY_TEMP = 20; + +/// Custom selector, selects the appropriate elements +class CustomSelector : public Selector < double > +{ +public: + /// Constructor. + CustomSelector() : Selector() + { + }; + + CustomSelector(std::vector element_ids) : Selector(), element_ids(element_ids) + { + }; + + virtual bool select_refinement(Element* element, int quad_order, MeshFunction* rsln, ElementToRefine& refinement) + { + for (unsigned short i = 0; i < this->element_ids.size(); i++) + if (element->id == this->element_ids[i]) + { + refinement.split = H2D_REFINEMENT_H; + refinement.refinement_polynomial_order[0] = refinement.refinement_polynomial_order[1] = refinement.refinement_polynomial_order[2] = refinement.refinement_polynomial_order[3] = P_INIT; + return true; + } + return false; + } + + std::vector element_ids; +}; + +#define ADAPT_SOLVER + +int main(int argc, char* argv[]) +{ + //HermesCommonApi.set_integral_param_value(numThreads, 1); + //HermesCommonApi.set_integral_param_value(matrixSolverType, SOLVER_PARALUTION_ITERATIVE); + //HermesCommonApi.set_integral_param_value(matrixSolverType, SOLVER_MUMPS); + + // Load the mesh. + MeshSharedPtr mesh(new Mesh); + Hermes::Hermes2D::MeshReaderH2DXML mloader; + mloader.load("quad.xml", mesh); + + // Refine all elements, do it INIT_REF_NUM-times. + for (unsigned int i = 0; i < INIT_REF_NUM; i++) + mesh->refine_all_elements(); + + // Initialize essential boundary conditions. + Hermes::Hermes2D::DefaultEssentialBCConst bc_essential(std::vector({ "0", "1", "2" }), FIXED_BDY_TEMP); + Hermes::Hermes2D::EssentialBCs bcs(&bc_essential); + + // Initialize space-> + SpaceSharedPtr space(new Hermes::Hermes2D::H1Space(mesh, &bcs, P_INIT)); + + std::cout << "Ndofs: " << space->get_num_dofs() << std::endl; + + // Weak Form + WeakFormSharedPtr wf(new CustomWeakFormPoisson(new Hermes::Hermes2DFunction(VOLUME_HEAT_SRC))); + +#ifdef ADAPT_SOLVER + DefaultErrorCalculator errorCalculator(CalculatedErrorType::RelativeErrorToGlobalNorm, 1); + AdaptStoppingCriterionSingleElement criterion(0.); + CustomSelector selector; + for (int i = 0; i < 10000; i++) + { + selector.element_ids.push_back(0); + selector.element_ids.push_back(3); + selector.element_ids.push_back(4); + selector.element_ids.push_back(8); + selector.element_ids.push_back(11); + selector.element_ids.push_back(19); + } + AdaptSolverCriterionFixed global_criterion(22); + + AdaptSolver > adaptSolver(space, wf, &errorCalculator, &criterion, &selector, &global_criterion); + + adaptSolver.switch_visualization(true, false); + adaptSolver.set_verbose_output(true); + adaptSolver.solve(hpAdaptivity); + +#else + + LinearSolver solver(wf, space); + //solver.set_matrix_export_format(EXPORT_FORMAT_MATLAB_SIMPLE); + //solver.output_matrix(); + solver.solve(); + MeshFunctionSharedPtr sln(new Solution); + Solution::vector_to_solution(solver.get_sln_vector(), space, sln); + + ScalarView s; + s.get_linearizer()->set_criterion(LinearizerCriterionFixed(3)); + s.show(sln); + + MeshSharedPtr meshf(new Mesh); + meshf->copy(mesh); + SpaceSharedPtr spacef(new H1Space(meshf, &bcs, 1)); + spacef->set_element_order(1, 5); + spacef->set_element_order(2, 2); + spacef->set_element_order(3, 2); + spacef->set_element_order(4, 2); + spacef->set_element_order(5, 2); + spacef->assign_dofs(); + + BaseView bf("Fine space"); + bf.get_linearizer()->set_criterion(LinearizerCriterionFixed(3)); + bf.show(spacef); + + WeakFormSharedPtr wff(new WeakFormsH1::DefaultWeakFormPoissonLinear(HERMES_ANY, new Hermes2DFunction(13.0))); + + LinearSolver solverf(wff, spacef); + solverf.set_matrix_export_format(EXPORT_FORMAT_MATLAB_SIMPLE); + solverf.output_matrix(); + solverf.solve(); + + MeshFunctionSharedPtr slnf(new Solution); + + Solution::vector_to_solution(solverf.get_sln_vector(), spacef, slnf); + + ScalarView sf; + sf.get_linearizer()->set_criterion(LinearizerCriterionFixed(3)); + sf.show(slnf); + +#endif + View::wait(); + return 0; +} \ No newline at end of file diff --git a/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/quad.xml b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/quad.xml new file mode 100644 index 0000000000..856b53eec3 --- /dev/null +++ b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/quad.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/triangle.xml b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/triangle.xml new file mode 100644 index 0000000000..2240d81b5b --- /dev/null +++ b/hermes2d/test_examples/15-adaptivity-matrix-reuse-simple/triangle.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/CMakeLists.txt b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/CMakeLists.txt new file mode 100644 index 0000000000..289b55bd40 --- /dev/null +++ b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/CMakeLists.txt @@ -0,0 +1,9 @@ +project(17-adaptivity-matrix-reuse-layer-interior) + +add_executable(${PROJECT_NAME} main.cpp definitions.cpp) + +if(NOT MSVC) + set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_FLAGS ${HERMES_FLAGS}) +endif() + +target_link_libraries(${PROJECT_NAME} ${HERMES2D}) diff --git a/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/definitions.cpp b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/definitions.cpp new file mode 100644 index 0000000000..c4eda76b0e --- /dev/null +++ b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/definitions.cpp @@ -0,0 +1,37 @@ +#include "definitions.h" + +double CustomExactSolution::value(double x, double y) const +{ + return Hermes::atan(slope * (Hermes::sqrt(Hermes::sqr(x - 1.25) + Hermes::sqr(y + 0.25)) - M_PI / 3)); +} + +void CustomExactSolution::derivatives(double x, double y, double& dx, double& dy) const +{ + double t = Hermes::sqrt(Hermes::sqr(x - 1.25) + Hermes::sqr(y + 0.25)); + double u = t * (Hermes::sqr(slope) * Hermes::sqr(t - M_PI / 3) + 1); + dx = slope * (x - 1.25) / u; + dy = slope * (y + 0.25) / u; +} + +Ord CustomExactSolution::ord(double x, double y) const +{ + return Ord(20); +} + +double CustomFunction::value(double x, double y) const +{ + double t2 = Hermes::sqr(y + 0.25) + Hermes::sqr(x - 1.25); + double t = Hermes::sqrt(t2); + double u = (Hermes::sqr(M_PI - 3.0*t) * Hermes::sqr(slope) + 9.0); + + return (27.0 / 2.0 * Hermes::sqr(2.0*y + 0.5) * (M_PI - 3.0*t) * Hermes::pow(slope, 3.0) / (Hermes::sqr(u) * t2) + + 27.0 / 2.0 * Hermes::sqr(2.0*x - 2.5) * (M_PI - 3.0*t) * Hermes::pow(slope, 3.0) / (Hermes::sqr(u) * t2) + - 9.0 / 4.0 * Hermes::sqr(2.0*y + 0.5) * slope / (u * Hermes::pow(t, 3.0)) + - 9.0 / 4.0 * Hermes::sqr(2.0*x - 2.5) * slope / (u * Hermes::pow(t, 3.0)) + 18.0 * slope / (u * t) + ); +} + +Ord CustomFunction::value(Ord x, Ord y) const +{ + return Ord(20); +} \ No newline at end of file diff --git a/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/definitions.h b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/definitions.h new file mode 100644 index 0000000000..79e669505a --- /dev/null +++ b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/definitions.h @@ -0,0 +1,41 @@ +#include "hermes2d.h" + +using namespace Hermes; +using namespace Hermes::Hermes2D; +using namespace WeakFormsH1; +using Hermes::Ord; + +/* Exact solution */ + +class CustomExactSolution : public ExactSolutionScalar +{ +public: + CustomExactSolution(MeshSharedPtr mesh, double slope) + : ExactSolutionScalar(mesh), slope(slope) {}; + + virtual double value (double x, double y) const; + + virtual void derivatives (double x, double y, double& dx, double& dy) const; + + virtual Ord ord (double x, double y) const; + + MeshFunction* clone() const { return new CustomExactSolution(mesh, slope); } + + double slope; +}; + +/* Custom function f */ + +class CustomFunction: public Hermes::Hermes2DFunction +{ +public: + CustomFunction(double slope) + : Hermes::Hermes2DFunction(), slope(slope) {}; + + virtual double value(double x, double y) const; + + virtual Ord value(Ord x, Ord y) const; + + double slope; +}; + diff --git a/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/main.cpp b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/main.cpp new file mode 100644 index 0000000000..e2eeeb333c --- /dev/null +++ b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/main.cpp @@ -0,0 +1,63 @@ +#include "definitions.h" + +using namespace Hermes; +using namespace Hermes::Hermes2D; +using namespace Hermes::Hermes2D::Views; +using namespace Hermes::Hermes2D::RefinementSelectors; + +// Initial polynomial degree of mesh elements. +const int P_INIT = 2; +// Number of initial uniform mesh refinements. +const int INIT_REF_NUM = 3; + +// Problem parameters. +// Slope of the layer. +double slope = 30; + +int main(int argc, char* argv[]) +{ + // Load the mesh. + MeshSharedPtr mesh(new Mesh); + MeshReaderH2D mloader; + // Quadrilaterals. + mloader.load("square_quad.mesh", mesh); + + // Perform initial mesh refinements. + for (int i = 0; i < INIT_REF_NUM; i++) + mesh->refine_all_elements(); + + // Define exact solution. + MeshFunctionSharedPtr exact_sln(new CustomExactSolution(mesh, slope)); + + // Define custom function f. + CustomFunction f(slope); + + // Initialize the weak formulation. + Hermes::Hermes1DFunction lambda(1.0); + WeakFormSharedPtr wf(new DefaultWeakFormPoissonLinear(HERMES_ANY, &f)); + + // Initialize boundary conditions + DefaultEssentialBCNonConst bc_essential("Bdy", exact_sln); + EssentialBCs bcs(&bc_essential); + + // Create an H1 space with default shapeset. + SpaceSharedPtr space(new H1Space(mesh, &bcs, P_INIT)); + + // Initialize approximate solution. + MeshFunctionSharedPtr sln(new Solution()); + + // Initialize refinement selector. + H1ProjBasedSelector selector(H2D_HP_ANISO); + + DefaultErrorCalculator errorCalculator(CalculatedErrorType::RelativeErrorToGlobalNorm, 1); + AdaptStoppingCriterionCumulative criterion(0.3); + + AdaptSolverCriterionFixed global_criterion(20); + + AdaptSolver > adaptSolver(space, wf, &errorCalculator, &criterion, &selector, &global_criterion); + + adaptSolver.switch_visualization(true, false); + adaptSolver.set_verbose_output(true); + adaptSolver.solve(hpAdaptivity); + return 0; +} \ No newline at end of file diff --git a/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/square_quad.mesh b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/square_quad.mesh new file mode 100644 index 0000000000..f81e678ee7 --- /dev/null +++ b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/square_quad.mesh @@ -0,0 +1,18 @@ +vertices = [ + [ 0, 0 ], + [ 1, 0 ], + [ 1, 1 ], + [ 0, 1 ] +] + +elements = [ + [ 2, 3, 0, 1, "Mat" ] +] + +boundaries = [ + [ 2, 3, "Bdy" ], + [ 3, 0, "Bdy" ], + [ 0, 1, "Bdy" ], + [ 1, 2, "Bdy" ] +] + diff --git a/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/square_tri.mesh b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/square_tri.mesh new file mode 100644 index 0000000000..f13fecbfb1 --- /dev/null +++ b/hermes2d/test_examples/16-adaptivity-matrix-reuse-layer-interior/square_tri.mesh @@ -0,0 +1,19 @@ +vertices = [ + [ 0, 0 ], + [ 1, 0 ], + [ 1, 1 ], + [ 0, 1 ] +] + +elements = [ + [ 1, 2, 0, "Mat" ], + [ 3, 0, 2, "Mat" ] +] + +boundaries = [ + [ 1, 2, "Bdy" ], + [ 0, 1, "Bdy" ], + [ 3, 0, "Bdy" ], + [ 2, 3, "Bdy" ] +] + diff --git a/hermes2d/test_examples/CMakeLists.txt b/hermes2d/test_examples/CMakeLists.txt index 1c21b0d5b9..8878456989 100644 --- a/hermes2d/test_examples/CMakeLists.txt +++ b/hermes2d/test_examples/CMakeLists.txt @@ -16,9 +16,9 @@ add_subdirectory("07-newton-heat-rk") add_subdirectory("08-nonlinearity") -IF(WITH_TRILINOS) - add_subdirectory("09-trilinos-nonlinear") -ENDIF(WITH_TRILINOS) +add_subdirectory("09-sparkgap") + +add_subdirectory("09b-sparkgap-adaptive") add_subdirectory("10-linear-advection-dg-adapt") @@ -28,4 +28,10 @@ add_subdirectory("12-picard") add_subdirectory("13-FCT") -add_subdirectory("14-error-calculation") \ No newline at end of file +IF(WITH_TRILINOS) + add_subdirectory("14-trilinos-nonlinear") +ENDIF(WITH_TRILINOS) + +# add_subdirectory("15-adaptivity-matrix-reuse-simple") + +# add_subdirectory("16-adaptivity-matrix-reuse-layer-interior") \ No newline at end of file diff --git a/hermes_common/CMakeLists.txt b/hermes_common/CMakeLists.txt index a27b5625ac..a6de787cae 100644 --- a/hermes_common/CMakeLists.txt +++ b/hermes_common/CMakeLists.txt @@ -70,7 +70,6 @@ project(hermes_common) include/data_structures/array.h include/data_structures/range.h include/data_structures/table.h - include/data_structures/hermes_vector.h include/solvers/matrix_solver.h include/solvers/linear_matrix_solver.h include/solvers/nonlinear_matrix_solver.h @@ -179,7 +178,6 @@ project(hermes_common) include/data_structures/array.h include/data_structures/range.h include/data_structures/table.h - include/data_structures/hermes_vector.h ) SOURCE_GROUP( @@ -204,6 +202,13 @@ project(hermes_common) # Add a target for a specified version of the Hermes library (REAL/COMPLEX, RELEASE/DEBUG), # and set its build properties (compile and link flags, installation directories). macro(BUILD_COMMON_LIB HERMES_COMMON_LIB BUILD_FLAGS) + + if(${CMAKE_CL_64}) + if(WITH_MUMPS) + LINK_DIRECTORIES(${IFCONSOL_LIB_DIRECTORY}) + endif() + endif() + if(${HERMES_STATIC_LIBS}) add_library(${HERMES_COMMON_LIB} ${SRC} ${HEADERS}) else() @@ -219,7 +224,6 @@ project(hermes_common) # options. Linking of optional libraries for the different Hermeses ({1, 2, 3}D) # is controled in their respective CMakeLists.txt. Note that for unselected # TPL's, the respective variables will be empty. - target_link_libraries( ${HERMES_COMMON_LIB} ${EXODUSII_LIBRARIES} ${HDF5_LIBRARY} @@ -240,6 +244,7 @@ project(hermes_common) ${F2C_LIBRARY} ${PJLIB_LIBRARY} ${BFD_LIBRARY} + ${LIBIBERTY_LIBRARY} ${BSON_LIBRARY} ${MATIO_LIBRARY} ${WINBLAS_LIBRARY} @@ -294,4 +299,5 @@ project(hermes_common) install(FILES ${INC_SOLVER_INTERFACES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes_common/solvers/interfaces) install(FILES ${INC_STRUCTURES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes_common/data_structures) install(FILES ${INC_ALGEBRA} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes_common/algebra) - install(FILES ${INC_UTIL} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes_common/util) \ No newline at end of file + install(FILES ${INC_UTIL} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/hermes_common/util) + \ No newline at end of file diff --git a/hermes_common/Doxyfile b/hermes_common/Doxyfile index 6dd16c4825..bc965f2a3c 100644 --- a/hermes_common/Doxyfile +++ b/hermes_common/Doxyfile @@ -687,7 +687,7 @@ HTML_OUTPUT = html # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. -HTML_FILE_EXTENSION = .php +HTML_FILE_EXTENSION = .html HTML_DYNAMIC_SECTIONS = YES diff --git a/hermes_common/include/algebra/algebra_mixins.h b/hermes_common/include/algebra/algebra_mixins.h index 8102db5402..86bc90d8b0 100644 --- a/hermes_common/include/algebra/algebra_mixins.h +++ b/hermes_common/include/algebra/algebra_mixins.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -57,7 +57,7 @@ namespace Hermes /// Sets this instance to output the matrix in several first iterations. /// \param[in] only_last_iteration If true, only the last iteration is outputted, and the next parameter is ignored. /// \param[in] firstIterations Only during so many first iterations. Default: -1 meaning, that during all iterations, the matrix will be saved. - void output_matrix(bool only_last_iteration = true, int firstIterations = -1); + void output_matrix(bool only_last_iteration = false, int firstIterations = -1); /// Sets this instance to output matrix entries even though they are zero or not. void set_print_zero_matrix_entries(bool to_set); /// Sets filename for the matrix @@ -77,7 +77,7 @@ namespace Hermes /// Sets this instance to output the rhs in several first iterations. /// \param[in] only_last_iteration If true, only the last iteration is outputted, and the next parameter is ignored. /// \param[in] firstIterations Only during so many first iterations. Default: -1 meaning, that during all iterations, the rhs will be saved. - void output_rhs(bool only_last_iteration = true, int firstIterations = -1); + void output_rhs(bool only_last_iteration = false, int firstIterations = -1); /// Sets filename for the rhs /// Default: Rhs_'iteration number' with the ".m" extension in the case of matlab format. /// \param[in] name sets the main part of the name, i.e. replacement for "Rhs_" in the default name. diff --git a/hermes_common/include/algebra/algebra_utilities.h b/hermes_common/include/algebra/algebra_utilities.h index 7ce81fb4c3..467c0aac38 100644 --- a/hermes_common/include/algebra/algebra_utilities.h +++ b/hermes_common/include/algebra/algebra_utilities.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -76,8 +76,9 @@ namespace Hermes EXPORT_FORMAT_MATRIX_MARKET = 3, #ifdef WITH_BSON /// \brief Own binary BSON-based import-export - EXPORT_FORMAT_BSON = 2 + EXPORT_FORMAT_BSON = 2, #endif + EXPORT_FORMAT_MATLAB_SIMPLE = 5 }; } } diff --git a/hermes_common/include/algebra/cs_matrix.h b/hermes_common/include/algebra/cs_matrix.h index 6c9729d42d..e8919de792 100644 --- a/hermes_common/include/algebra/cs_matrix.h +++ b/hermes_common/include/algebra/cs_matrix.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -32,7 +32,7 @@ namespace Hermes /// \brief General CS Matrix class. /// Either row- or column- specific (see subclassses). template - class HERMES_API CSMatrix : public SparseMatrix + class HERMES_API CSMatrix : public SparseMatrix < Scalar > { public: /// Creates matrix in CS format using size, nnz, and the three arrays. @@ -44,7 +44,7 @@ namespace Hermes void create(unsigned int size, unsigned int nnz, int* ap, int* ai, Scalar* ax); /// Finds the correct position to insert / retrieve elements. - static int find_position(int *Ai, int Alen, int idx); + static int find_position(int *Ai, int Alen, unsigned int idx); /// \brief Default constructor. CSMatrix(); @@ -60,7 +60,7 @@ namespace Hermes /// Main addition method. /// Virtual - the method body is 1:1 for CSCMatrix, inverted for CSR. virtual void add(unsigned int Ai_data_index, unsigned int Ai_index, Scalar v); - + /// Main get method. /// Virtual - the method body is 1:1 for CSCMatrix, inverted for CSR. virtual Scalar get(unsigned int Ai_data_index, unsigned int Ai_index) const; @@ -80,12 +80,12 @@ namespace Hermes /// Utility version /// \See MatrixRhsImportExport::export_to_file. void export_to_file(const char *filename, const char *var_name, MatrixExportFormat fmt, char* number_format = "%lf", bool invert_storage = false); - + /// Reading matrix /// Utility version /// \See Matrix::import_from_file. void import_from_file(const char *filename, const char *var_name, MatrixExportFormat fmt, bool invert_storage = false); - + /// Utility method. virtual unsigned int get_nnz() const; /// Utility method. @@ -128,7 +128,7 @@ namespace Hermes /// (can be used in umfpack, in that case use the /// CSCMatrix subclass, or with EigenSolver, or anything else). template - class HERMES_API CSCMatrix : public CSMatrix + class HERMES_API CSCMatrix : public CSMatrix < Scalar > { public: /// \brief Default constructor. @@ -151,14 +151,14 @@ namespace Hermes virtual void import_from_file(const char *filename, const char *var_name, MatrixExportFormat fmt); /// Duplicates a matrix (including allocation). - virtual CSMatrix* duplicate() const; + SparseMatrix* duplicate() const; }; /// \brief General CSR Matrix class. /// (can be used in umfpack, in that case use the /// CSCMatrix subclass, or with EigenSolver, or anything else). template - class HERMES_API CSRMatrix : public CSMatrix + class HERMES_API CSRMatrix : public CSMatrix < Scalar > { public: /// \brief Default constructor. @@ -179,7 +179,7 @@ namespace Hermes void import_from_file(const char *filename, const char *var_name, MatrixExportFormat fmt); /// Duplicates a matrix (including allocation). - virtual SparseMatrix* duplicate() const; + SparseMatrix* duplicate() const; /// Important - normal SparseMatrix has the pages structure suitable for CSC matrix, so we need /// to override the structure creation here. diff --git a/hermes_common/include/algebra/dense_matrix_operations.h b/hermes_common/include/algebra/dense_matrix_operations.h index f3fc91efcb..fc49fae3a3 100644 --- a/hermes_common/include/algebra/dense_matrix_operations.h +++ b/hermes_common/include/algebra/dense_matrix_operations.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -141,8 +141,8 @@ namespace Hermes // write contents for (int j = 0; j < m; j++) - for (int i = Ap[j]; i < Ap[j + 1]; i++) - fout << j + 1 << " " << Ai[i] + 1 << " " << Ax[i] << std::endl; + for (int i = Ap[j]; i < Ap[j + 1]; i++) + fout << j + 1 << " " << Ai[i] + 1 << " " << Ax[i] << std::endl; // finish fout.close(); @@ -155,17 +155,17 @@ namespace Hermes { unsigned int min = std::min(m, n); for (unsigned int i = 0; i < min; i++) - for (unsigned int j = i + 1; j < min; j++) - std::swap(matrix[i][j], matrix[j][i]); + for (unsigned int j = i + 1; j < min; j++) + std::swap(matrix[i][j], matrix[j][i]); if (m < n) - for (unsigned int i = 0; i < m; i++) - for (unsigned int j = m; j < n; j++) - matrix[j][i] = matrix[i][j]; + for (unsigned int i = 0; i < m; i++) + for (unsigned int j = m; j < n; j++) + matrix[j][i] = matrix[i][j]; else if (n < m) - for (unsigned int i = n; i < m; i++) - for (unsigned int j = 0; j < n; j++) - matrix[j][i] = matrix[i][j]; + for (unsigned int i = n; i < m; i++) + for (unsigned int j = 0; j < n; j++) + matrix[j][i] = matrix[i][j]; } /// Transposes an m by n matrix. If m != n, the array matrix in fact has to be @@ -174,23 +174,23 @@ namespace Hermes void transpose(T *matrix, unsigned int m, unsigned int n, unsigned int size) { unsigned int min = std::min(m, n); - for (int i = 0; i < min; i++) + for (unsigned int i = 0; i < min; i++) { - for (int j = i + 1; j < min; j++) + for (unsigned int j = i + 1; j < min; j++) { std::swap(matrix[i * size + j], matrix[j * size + i]); } } if (m < n) - for (unsigned int i = 0; i < m; i++) - for (unsigned int j = m; j < n; j++) - matrix[j * size + i] = matrix[i * size + j]; + for (unsigned int i = 0; i < m; i++) + for (unsigned int j = m; j < n; j++) + matrix[j * size + i] = matrix[i * size + j]; else if (n < m) - for (unsigned int i = n; i < m; i++) - for (unsigned int j = 0; j < n; j++) - matrix[j * size + i] = matrix[i * size + j]; + for (unsigned int i = n; i < m; i++) + for (unsigned int j = 0; j < n; j++) + matrix[j * size + i] = matrix[i * size + j]; } /// Changes the sign of a matrix @@ -198,19 +198,19 @@ namespace Hermes void change_sign(T **matrix, unsigned int m, unsigned int n) { for (unsigned int i = 0; i < m; i++) - for (unsigned int j = 0; j < n; j++) - matrix[i][j] = -matrix[i][j]; + for (unsigned int j = 0; j < n; j++) + matrix[i][j] = -matrix[i][j]; } /// Changes the sign of an array template void change_sign(T *matrix, unsigned int m, unsigned int n, unsigned int size) { for (unsigned int i = 0; i < m; i++) - for (unsigned int j = 0; j < n; j++) - { + for (unsigned int j = 0; j < n; j++) + { int local_matrix_index_array = i * size + j; matrix[local_matrix_index_array] = -matrix[local_matrix_index_array]; - } + } } /// Given a matrix a[n][n], this routine replaces it by the LU decomposition of a rowwise @@ -219,8 +219,8 @@ namespace Hermes /// pivoting; d is output as +-1 depending on whether the number of row interchanges was even /// or odd, respectively. This routine is used in combination with lubksb to solve linear equations /// or invert a matrix. - template - HERMES_API void ludcmp(T **a, int n, int *indx, double *d); + template + HERMES_API void ludcmp(T **a, Int n, Int *indx, double *d); /// Solves the set of n linear equations AX = B. Here a[n][n] is input, not as the matrix /// A but rather as its LU decomposition, determined by the routine ludcmp. indx[n] is input @@ -229,15 +229,15 @@ namespace Hermes /// and can be left in place for successive calls with different right-hand sides b. This routine takes /// into account the possibility that b will begin with many zero elements, so it is efficient for use /// in matrix inversion. - template - HERMES_API void lubksb(T **a, int n, int *indx, S *b); + template + HERMES_API void lubksb(T **a, Int n, Int *indx, S *b); /// Given a positive-definite symmetric matrix a[n][n], this routine constructs its Cholesky /// decomposition, A = L*L^T . On input, only the upper triangle of a need be given; it is not /// modified. The Cholesky factor L is returned in the lower triangle of a, except for its diagonal /// elements which are returned in p[n]. - template - HERMES_API void choldc(T **a, int n, T p[]); + template + HERMES_API void choldc(T **a, Int n, T p[]); /// Solves the set of n linear equations A*x = b, where a is a positive-definite symmetric matrix. /// a[n][n] and p[n] are input as the output of the routine choldc. Only the lower @@ -246,8 +246,8 @@ namespace Hermes /// for successive calls with different right-hand sides b. b is not modified unless you identify b and /// x in the calling sequence, which is allowed. The right-hand side b can be complex, in which case /// the solution x is also complex. - template - void cholsl(double **a, int n, double p[], T b[], T x[]) + template + void cholsl(double **a, Int n, double p[], T b[], T x[]) { int i, k; T sum; diff --git a/hermes_common/include/algebra/matrix.h b/hermes_common/include/algebra/matrix.h index 9dd951e9bc..a2ee5935ea 100644 --- a/hermes_common/include/algebra/matrix.h +++ b/hermes_common/include/algebra/matrix.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -33,7 +33,7 @@ namespace Hermes { /// \brief General (abstract) matrix representation in Hermes. template - class HERMES_API Matrix : public Hermes::Mixins::Loggable, public Algebra::Mixins::MatrixRhsImportExport + class HERMES_API Matrix : public Hermes::Mixins::Loggable, public Algebra::Mixins::MatrixRhsImportExport < Scalar > { public: /// constructor of matrix @@ -93,18 +93,18 @@ namespace Hermes virtual unsigned int get_size() const; protected: - unsigned int size; ///< matrix size + /// matrix size + unsigned int size; }; /// \brief General (abstract) sparse matrix representation in Hermes. template - class HERMES_API SparseMatrix : public Matrix { + class HERMES_API SparseMatrix : public Matrix < Scalar > { public: SparseMatrix(); /// Constructor of sparse matrix /// @param[in] size size of matrix SparseMatrix(unsigned int size); - SparseMatrix(const SparseMatrix& mat); virtual ~SparseMatrix(); /// prepare memory @@ -178,29 +178,32 @@ namespace Hermes /// Get fill-in. virtual double get_fill_in() const = 0; - unsigned row_storage : 1; ///< \todo document - unsigned col_storage : 1; ///< \todo document - /// get number of nonzero numbers in matrix /// @return number of nonzero numbers in matrix virtual unsigned int get_nnz() const; protected: /// Size of page (max number of indices stored in one page). - static const int PAGE_SIZE = 62; + /// DO NOT CHANGE, otherwise the data types in Page struct needs to be revisited. + static const int PAGE_SIZE = 100; /// Structure for storing indices in sparse matrix struct Page { + Page(bool dyn_stored_ = false) : dyn_stored(dyn_stored_), next(nullptr), count(0) { + }; /// number of indices stored - int count; - /// buffer for storring indices + unsigned char count; + /// buffer for storing indices int idx[PAGE_SIZE]; /// pointer to next page Page *next; + /// this page is stored in the dynamically allocated part. + bool dyn_stored; }; /// array of pages with indices array. Each field of arra contains pages for one column - Page **pages; + Page *pages; + Page **next_pages; /// gather all pages in the buffer, delete them, sort buffer and remove duplicities /// @param[in] page first page with indices @@ -212,9 +215,6 @@ namespace Hermes /// get number of indices in all pages /// @return number of indices int get_num_indices(); - - /// mem stat - int mem_size; }; /// \brief Function returning a matrix according to the users's choice. diff --git a/hermes_common/include/algebra/vector.h b/hermes_common/include/algebra/vector.h index aa48674c86..335ce4551f 100644 --- a/hermes_common/include/algebra/vector.h +++ b/hermes_common/include/algebra/vector.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -33,7 +33,7 @@ namespace Hermes { /// \brief General (abstract) vector representation in Hermes. template - class HERMES_API Vector : public Hermes::Mixins::Loggable, public Algebra::Mixins::MatrixRhsImportExport + class HERMES_API Vector : public Hermes::Mixins::Loggable, public Algebra::Mixins::MatrixRhsImportExport < Scalar > { public: /// Default constructor. @@ -57,6 +57,9 @@ namespace Hermes /// @param[in] idx - index which to obtain the value from virtual Scalar get(unsigned int idx) const = 0; + /// Duplicate vector (including allocation). + virtual Vector* duplicate() const = 0; + /// Extract vector values into user-provided array. /// @param[out] v - array which will contain extracted values virtual void extract(Scalar *v) const = 0; @@ -89,6 +92,11 @@ namespace Hermes /// Add a vector. virtual Vector* add_vector(Scalar* vec); + /// Subtract a vector. + virtual Vector* subtract_vector(Vector* vec); + /// Subtract a vector. + virtual Vector* subtract_vector(Scalar* vec); + /// update subset of the elements /// /// @param[in] n - number of positions to update @@ -97,7 +105,7 @@ namespace Hermes virtual void add(unsigned int n, unsigned int *idx, Scalar *y) = 0; /// Get vector length. - unsigned int get_size() const {return this->size;} + unsigned int get_size() const { return this->size; } protected: /// size of vector unsigned int size; @@ -105,7 +113,7 @@ namespace Hermes /** \brief Vector used with MUMPS solver */ template - class HERMES_API SimpleVector : public Vector + class HERMES_API SimpleVector : public Vector < Scalar > { public: SimpleVector(); @@ -118,11 +126,17 @@ namespace Hermes virtual void extract(Scalar *v) const; virtual void zero(); virtual Vector* change_sign(); + + /// Duplicates a matrix (including allocation). + Vector* duplicate() const; + virtual void set(unsigned int idx, Scalar y); virtual void add(unsigned int idx, Scalar y); virtual void add(unsigned int n, unsigned int *idx, Scalar *y); virtual Vector* add_vector(Vector* vec); virtual Vector* add_vector(Scalar* vec); + virtual Vector* subtract_vector(Vector* vec); + virtual Vector* subtract_vector(Scalar* vec); virtual Vector* set_vector(Vector* vec); virtual Vector* set_vector(Scalar* vec); diff --git a/hermes_common/include/api.h b/hermes_common/include/api.h index 99ebcf1da4..75c3d23eee 100644 --- a/hermes_common/include/api.h +++ b/hermes_common/include/api.h @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -51,7 +51,7 @@ namespace Hermes /// Setter handler type. /// Serve for a custom reaction to some parameter settings. /// Such a handler must be registered in the map setter_handlers. - typedef void (*SetterHandler)(); + typedef void(*SetterHandler)(); protected: /// Parameter class, representing one parameter. diff --git a/hermes_common/include/common.h b/hermes_common/include/common.h index 374acff5c4..ce01e70e0b 100644 --- a/hermes_common/include/common.h +++ b/hermes_common/include/common.h @@ -20,6 +20,7 @@ #define __HERMES_COMMON_COMMON_H #include +#include #include #include @@ -28,9 +29,11 @@ #include #include #include +#include #include #include -#include +#include +#include #include #include @@ -48,7 +51,6 @@ #endif #include #include -#include #include #include #include @@ -77,6 +79,7 @@ #ifdef WITH_OPENMP #include #else +inline int omp_get_max_threads() { return 1; } inline int omp_get_num_threads() { return 1; } inline int omp_get_thread_num() { return 0; } #endif @@ -85,7 +88,6 @@ inline int omp_get_thread_num() { return 0; } #include "pjlib.h" #endif - /// Int types handling. #ifdef JU_WIN typedef __int8 int8_t; @@ -217,8 +219,38 @@ namespace Hermes // For internal use. const int HERMES_ANY_INT = -1234; + namespace Exceptions + { + class NullException; + class LengthException; + } + namespace Helpers { + /// Check for nullptr. + template + inline void check_for_null(T instance) + { + if (!instance) + throw Hermes::Exceptions::NullException(); + } + + /// Check length of a vector. + template + inline void check_length(const std::vector& instance, const unsigned int length) + { + if (instance.size() != length) + throw Hermes::Exceptions::LengthException(instance.size(), length); + } + + /// Check length of a vector. + template + inline void check_length(const std::vector& instanceT, const std::vector& instanceU) + { + if (instanceT.size() != instanceU.size()) + throw Hermes::Exceptions::LengthException(); + } + /// Number printers. inline void fprint_num(FILE*f, double x, char* number_format) { @@ -253,13 +285,13 @@ namespace Hermes }; template<> - struct TypeIsReal + struct TypeIsReal < double > { static const bool value = true; }; template<> - struct TypeIsComplex > + struct TypeIsComplex < std::complex > { static const bool value = true; }; diff --git a/hermes_common/include/data_structures/array.h b/hermes_common/include/data_structures/array.h index 06b799789f..9f36d195a0 100644 --- a/hermes_common/include/data_structures/array.h +++ b/hermes_common/include/data_structures/array.h @@ -35,18 +35,19 @@ namespace Hermes /// members 'id' and 'unused' in order to be usable by this class. /// \todo Is this dimension independent? +#define HERMES_PAGE_BITS 8 +#define HERMES_PAGE_SIZE (1 << HERMES_PAGE_BITS) +#define HERMES_PAGE_MASK (HERMES_PAGE_SIZE - 1) + template class Array { protected: - TYPE** pages; ///< \todo standard array for maximum access speed + /// \todo standard array for maximum access speed + TYPE** pages; int* unused; - int page_count, size, nitems, unused_size, nunused; + unsigned int page_count, size, nitems, unused_size, nunused; bool append_only; - - static const int HERMES_PAGE_BITS = 8; - static const int HERMES_PAGE_SIZE = 1 << HERMES_PAGE_BITS; - static const int HERMES_PAGE_MASK = HERMES_PAGE_SIZE - 1; public: Array(int initial_page_count = 0) : pages(nullptr), unused(nullptr) @@ -122,7 +123,7 @@ namespace Hermes this->append_only = append_only; } - /// Wrapper function for Hermes::vector::add() for compatibility purposes. + /// Wrapper function for std::vector::add() for compatibility purposes. int add(TYPE item) { TYPE* ptr = this->add(); @@ -279,7 +280,6 @@ namespace Hermes TYPE& get(int id) const { return pages[id >> HERMES_PAGE_BITS][id & HERMES_PAGE_MASK]; } TYPE& operator[] (int id) const { return get(id); } - }; /// \brief A light version of the array. @@ -385,7 +385,6 @@ namespace Hermes { return pages[id >> page_bits][id & page_mask]; } - }; } #endif diff --git a/hermes_common/include/data_structures/hermes_vector.h b/hermes_common/include/data_structures/hermes_vector.h deleted file mode 100644 index 582d896765..0000000000 --- a/hermes_common/include/data_structures/hermes_vector.h +++ /dev/null @@ -1,160 +0,0 @@ -// This file is part of HermesCommon -// -// Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. -// -// Hermes2D is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the License, -// or (at your option) any later version. -// -// Hermes2D 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 Hermes2D; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -/*! \file vector.h -\brief Base class for representations of vectors for different solvers. -*/ -#ifndef __HERMES_COMMON_HERMES_VECTOR_H -#define __HERMES_COMMON_HERMES_VECTOR_H - -#include "common.h" -#include "exceptions.h" - -namespace Hermes -{ - /// A vector of values. - /** This class is used to pass a variable number of parameters in a type-safe fashion. - * \par Suggested Use - * Let us assume a function foo(Hermes::vector&) and instances sln1-sln3 of a class Solution. Then, - * - 2 up to 10 parameters: foo(Hermes::vector(&sln1, &sln2, &sln3)); - * - more than 15 parameters: Fill the instance similarly to STL vector (std::vector). - * If needed, the one-parameter version of foo must be created separately, without using Hermes::vector. - */ - template - class vector : public std::vector - { - public: - /// A default constructor. Creates an empty vector. - vector() { }; - /// Default std::vector constructor. - vector(int size) { this->reserve(size); }; - /// 1 parameters constructor. - /// Problematic when passing as an argument, not for use. - //vector(const T& a) { this->reserve(1); this->push_back(a);}; - /// 2 parameters constructor. - vector(const T& a, const T& b) { this->reserve(2); this->push_back(a); this->push_back(b); }; - /// 3 parameters constructor. - vector(const T& a, const T& b, const T& c) { this->reserve(3); this->push_back(a); this->push_back(b); this->push_back(c); }; - /// 4 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d) { this->reserve(4); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); }; - /// 5 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e) { this->reserve(5); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); }; - /// 6 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f) { this->reserve(6); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); }; - /// 7 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g) { this->reserve(7); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); this->push_back(g); }; - /// 8 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h) { this->reserve(8); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); this->push_back(g); this->push_back(h); }; - /// 9 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i) { this->reserve(9); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); this->push_back(g); this->push_back(h); this->push_back(i); }; - /// 10 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j) { this->reserve(10); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); this->push_back(g); this->push_back(h); this->push_back(i); this->push_back(j); }; - /// 11 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k) { this->reserve(11); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); this->push_back(g); this->push_back(h); this->push_back(i); this->push_back(j); this->push_back(k);}; - /// 12 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k, const T& l) { this->reserve(12); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); this->push_back(g); this->push_back(h); this->push_back(i); this->push_back(j); this->push_back(k); this->push_back(l);}; - /// 13 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k, const T& l, const T& m) { this->reserve(13); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); this->push_back(g); this->push_back(h); this->push_back(i); this->push_back(j); this->push_back(k); this->push_back(l); this->push_back(m);}; - /// 14 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k, const T& l, const T& m, const T& n) { this->reserve(14); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); this->push_back(g); this->push_back(h); this->push_back(i); this->push_back(j); this->push_back(k); this->push_back(l); this->push_back(m); this->push_back(n);}; - /// 15 parameters constructor. - vector(const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k, const T& l, const T& m, const T& n, const T& o) { this->reserve(15); this->push_back(a); this->push_back(b); this->push_back(c); this->push_back(d); this->push_back(e); this->push_back(f); this->push_back(g); this->push_back(h); this->push_back(i); this->push_back(j); this->push_back(k); this->push_back(l); this->push_back(m); this->push_back(n); this->push_back(o);}; - - // Look up an integer number in an array. - int find_index_slow(const T& x) { - for (int i=0; i < this->size(); i++) { - if((*this)[i] == x) - return i; - } - throw Hermes::Exceptions::Exception("Index not found"); - } - - // Returns maximum of the vector in case of T == int. - int max() { - if(this->size() == 0) - throw Hermes::Exceptions::Exception("Empty vector"); - int m; - if(typeid((*this)[0]) != typeid(m)) - throw Hermes::Exceptions::Exception("vector::max() called and T != int."); - m = (int)(*this)[0]; - for (unsigned int i=1; i < this->size(); i++) - if((int)(*this)[i] > m) - m = (int)(*this)[i]; - return m; - } - - // Returns minimum of the vector in case of T == int. - int min() { - if(this->size() == 0) - throw Hermes::Exceptions::Exception("Empty vector"); - int m; - if(typeid((*this)[0]) != typeid(m)) - throw Hermes::Exceptions::Exception("vector::max() called and T != int."); - m = (int)(*this)[0]; - for (unsigned int i=1; i < this->size(); i++) - if((int)(*this)[i] < m) - m = (int)(*this)[i]; - return m; - } - - // Look up an integer number in an array. - // This prepares a permut array, so subsequent calls are very fast - int find_index(int x, bool throw_exception=true) { - if(this->size() == 0) { - if(throw_exception) { - throw Hermes::Exceptions::Exception("Empty vector"); - } - else return -1; - } - int idx; - if(typeid((*this)[0]) != typeid(idx)) - throw Hermes::Exceptions::Exception("vector::find_index() called and T != int."); - - if(this->_permut.size() == 0) { - // Initialize the permut array - this->_min = this->min(); - this->_max = this->max(); - for (int i=0; i < (int)this->_max+1; i++) this->_permut.push_back(-1); - for (unsigned int i=0; i < this->size(); i++) this->_permut[(int)(*this)[i]] = i; - } - if(((int)this->_min <= x) && (x <= (int)this->_max)) - idx = this->_permut[x]; - else - idx = -1; - if(idx == -1) { - if(throw_exception) - throw Hermes::Exceptions::Exception("Index in the vector not found"); - else - return -1; - } - return idx; - } - - void print() { - printf("["); - for (int i=0; i < this->size(); i++) printf("%d ", (*this)[i]); - printf("]\n"); - } - - private: - std::vector _permut; - int _min, _max; - }; -} // namespace Hermes - -#endif \ No newline at end of file diff --git a/hermes_common/include/data_structures/table.h b/hermes_common/include/data_structures/table.h index 285b87b390..f98ba00f0b 100644 --- a/hermes_common/include/data_structures/table.h +++ b/hermes_common/include/data_structures/table.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -118,13 +118,15 @@ namespace Hermes bool is_diagonally_implicit(); bool is_fully_implicit(); bool is_embedded(); - void switch_B_rows(); ///< For experimental purposes. Switches the B and B2 rows. B2 row - ///< must be nonzero, otherwise error is thrown. + /// For experimental purposes. Switches the B and B2 rows. B2 row + /// must be nonzero, otherwise error is thrown. + void switch_B_rows(); protected: double* B; - double* B2; ///< This is the second B-row for adaptivity based - ///< on embedded R-K methods. + /// This is the second B-row for adaptivity based + double* B2; + /// on embedded R-K methods. double* C; }; } diff --git a/hermes_common/include/exceptions.h b/hermes_common/include/exceptions.h index b8ee812375..4a67b38659 100644 --- a/hermes_common/include/exceptions.h +++ b/hermes_common/include/exceptions.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -41,7 +41,7 @@ namespace Hermes /// { /// ... /// throw Hermes::Exceptions::Exception("this is an exception message"); - /// } + /// } /// catch(Hermes::Exceptions::Exception& e) /// { /// e.print_msg(); @@ -101,21 +101,23 @@ namespace Hermes class HERMES_API NullException : public Exception { public: + /// Constructor - simple. + NullException(); /// Constructor /// \param[in] paramnIdx index of null parameter. - NullException(int param_idx); + NullException(unsigned int param_idx); /// Null item is passed in vector or array. /// \param[in] paramnIdx index of parameter. /// \param[in] elementIdx index of null item in array parameter. - NullException(int param_idx, int item_idx); + NullException(unsigned int param_idx, unsigned int item_idx); /// \return index of null parameter. - int get_param_idx() const; + unsigned int get_param_idx() const; /// \return index of null item in array parameter. Returns -1 if bad parrameter is not array with null item. - int get_item_idx() const; + unsigned int get_item_idx() const; virtual ~NullException() throw() {}; NullException(const NullException & e); private: - int param_idx, item_idx; + unsigned int param_idx, item_idx; }; /// \brief Parameter length parameter exception. @@ -124,29 +126,35 @@ namespace Hermes class HERMES_API LengthException : public Exception { public: + /// Two parameters do not have equal length. + LengthException(); + /// A parameter has wrong length - simple case. + /// \param[in] wrong actual length of parameter. + /// \param[in] right right length of parameter. + LengthException(unsigned int wrong, unsigned int right); /// One parameter has wrong length. /// \param[in] paramnIdx index wrong parameter. /// \param[in] wrong actual length of parameter. /// \param[in] right right length of parameter. - LengthException(int param_idx, int wrong, int right); + LengthException(unsigned int param_idx, unsigned int wrong, unsigned int right); /// Two parameters should have same length and they dont have. /// \param[in] fstParamnIdx index first parameter. /// \param[in] sndParamnIdx index second parameter. /// \param[in] first actual length of first parameter. /// \param[in] second actual length of second parameter. - LengthException(int fst_param_idx, int snd_param_idx, int first, int second); + LengthException(unsigned int fst_param_idx, unsigned int snd_param_idx, unsigned int first, unsigned int second); /// \return index of first wrong parameter. - int get_first_param_idx() const; + unsigned int get_first_param_idx() const; /// \return index of second wrong parameter. Returns -1 when only one parameter is wrong. - int get_second_param_idx() const; + unsigned int get_second_param_idx() const; /// \return length of first parameter. - int get_first_length() const; + unsigned int get_first_length() const; /// \return expected length of first parameter. - int get_expected_length() const; + unsigned int get_expected_length() const; virtual ~LengthException() throw() {}; LengthException(const LengthException & e); private: - int fst_param_idx, snd_param_idx, wrong, right; + unsigned int fst_param_idx, snd_param_idx, wrong, right; }; /// \brief Linear solver failed. diff --git a/hermes_common/include/hermes_common.h b/hermes_common/include/hermes_common.h index 45a00b6841..065b240d3d 100644 --- a/hermes_common/include/hermes_common.h +++ b/hermes_common/include/hermes_common.h @@ -39,11 +39,9 @@ #include "solvers/precond.h" #include "solvers/interfaces/precond_ifpack.h" #include "solvers/interfaces/precond_ml.h" -#include "solvers/eigensolver.h" #include "hermes_function.h" #include "util/compat.h" #include "util/callstack.h" -#include "data_structures/hermes_vector.h" #include "data_structures/table.h" #include "data_structures/array.h" #include "data_structures/range.h" diff --git a/hermes_common/include/hermes_function.h b/hermes_common/include/hermes_function.h index 5a240a373b..a3df7634d5 100644 --- a/hermes_common/include/hermes_function.h +++ b/hermes_common/include/hermes_function.h @@ -25,7 +25,8 @@ namespace Hermes { struct HERMES_API SplineCoeff { - double a, b, c, d; // four coefficients of a cubic spline. + // four coefficients of a cubic spline. + double a, b, c, d; }; /// Generic class for functions of one variable. diff --git a/hermes_common/include/mixins.h b/hermes_common/include/mixins.h index a647cec282..b74e30300c 100644 --- a/hermes_common/include/mixins.h +++ b/hermes_common/include/mixins.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -23,258 +23,294 @@ #define __HERMES_COMMON_MIXINS_H #include "common.h" -#include "data_structures/hermes_vector.h" #include "exceptions.h" #include "api.h" namespace Hermes { - /** \defgroup g_mixins Mixins - * \brief Mixins are utility classes used for all kinds of other classes. - * - * Mixin classes provide a single piece of functionality. - * - */ - - /// \ingroup g_mixins - /// \brief Namespace for mixin classes. - /// These classes always serve one particular purpose that multiple classes of the entire Hermes library - /// could use - logging, time measurement, ... - namespace Mixins - { - /// \ingroup g_mixins - /// Mixin that allows for asking about the instance state (ok / not ok). - class HERMES_API StateQueryable - { - public: - /// Ask if the instance is fine. - virtual bool isOkay() const = 0; - - /// Get class name, for the purpose of messaging. - virtual std::string getClassName() const = 0; - - /// Method to handle the state. - void check() const; - }; - - /// \brief Class the output of which is loggable, i.e. that uses functionality of info(), warn() - /// Contains the class Static with the following usage: - /// Anywhere in your program you can write Hermes::Mixins::Loggable::Static::info("whatever you want to output"). - class HERMES_API Loggable - { - private: - typedef void(*callbackFn)(const char*); - - public: - Loggable(bool verbose_output = false, callbackFn verbose_callback = nullptr); - - void set_logFile_name(const char* filename); - void set_logFile_name(std::string filename); - static void set_static_logFile_name(const char* filename); - static void set_static_logFile_name(std::string filename); - - void info(const char* msg, ...) const; - void info_if(bool cond, const char* msg, ...) const; - void warn(const char* msg, ...) const; - void warn_if(bool cond, const char* msg, ...) const; - void error(const char* msg, ...) const; - void error_if(bool cond, const char* msg, ...) const; - - /// Sets the attribute verbose_output to the paramater option passed. - /// \todo Use this in solvers etc. - virtual void set_verbose_output(bool to_set); - - /// Returns the current value of verbose_output; - bool get_verbose_output() const; - - /// Provides a callback for logging. - /// \param[in] callback Function to be called for the messaging when verbose_output is set to yes. - /// \todo Use this in solvers etc. - virtual void set_verbose_callback(callbackFn callback); - - /// Returns the current value of verbose_callback; - callbackFn get_verbose_callback() const; - - /// For static logging. - class HERMES_API Static - { - public: - static void info(const char* msg, ...); - static void warn(const char* msg, ...); - static void error(const char* msg, ...); - }; - - /// Logfile name. - char* logFileName; - static char* staticLogFileName; - protected: - - /* file operations */ - void hermes_fwrite(const void* ptr, size_t size, size_t nitems, FILE* stream) const; - void hermes_fread(void* ptr, size_t size, size_t nitems, FILE* stream) const; - - private: - /// Writes a fancy formatted text to a console. \internal \ingroup g_logging - /** \param[in] code An event code, e.g., ::HERMES_EC_ERROR. - * \param[in] text A message. A C-style string. - * \return True if the message was written. False if it failed due to some reasone. */ - bool write_console(const char code, const char* text) const; - - /// Info about a log record. Used for output log function. \internal - class HERMES_API HermesLogEventInfo - { - public: - HermesLogEventInfo(const char code, const char* src_function, const char* src_file, const int src_line); - const char code; ///< An event code character. For defails see event characters, e.g., ::HERMES_EC_ERROR - const char* src_function; ///< A name of a function/method at which the event was generated. - const char* src_file; ///< A source file at which the event was generated. - const int src_line; ///< A line in the source file at which the event was generated. - }; - - HermesLogEventInfo* hermes_build_log_info(char event) const; - - static std::map logger_written; - - /// \brief Logs an event if the condition is true. \internal - /** Used by all even logging macros. Since this function returns a copy of the parameter cond, - * it can be used to call a function hermes2d_exit_if() or a function(). Thanks to that, the macro - * behaves as a function rather than a block of code. Also, this allows a debugger to a particular - * code. - * \param[in] code Code of the message. - * \param[in] msg A message. */ - void hermes_log_message(const char code, const char* msg) const; - - /// Verbose output. - /// Set to 'true' by default. - bool verbose_output; - - /// Verbose callback. - callbackFn verbose_callback; - }; - - /// \brief Class using time measurement - /// Can be used directly (is not abstract), so one can use e.g. this in a program: - /// Mixins::TimeMeasurable time; - /// time.tick(); - /// <-- do whatever you want to measure execution time of --> - /// std::cout << "Whatever took " << time.last() << "seconds to execute."; - class HERMES_API TimeMeasurable - { - public: - TimeMeasurable(const char *name = nullptr); ///< Constructs internal structures and starts measuring. - - /// Tick type. Used by the class Hermes::TimePeriod. - enum TimerPeriodTickType - { - HERMES_ACCUMULATE, ///< Accumulate a period between ticks. - HERMES_SKIP ///< Skip period between ticks, i.e., do not accumulate it. - }; - - const TimeMeasurable& reset(); ///< Resets accumulated time. - const TimeMeasurable& tick_reset(); ///< Starts a new_ period and resets accumulated time. - const TimeMeasurable& tick(TimeMeasurable::TimerPeriodTickType type = HERMES_ACCUMULATE); ///< Starts/ends a new_ period. - - /// Returns a name of the time period if any. - const std::string& name() const; - - /// Returns accumulated time (in seconds). - double accumulated() const; - - /// Returns accumulated time in human readable form. - std::string accumulated_str() const; - - /// Returns last measured period (in seconds). - /** \return Returns the length of the last measured time period. -1 if period was skipped. */ - double last() const; - - /// Returns last measured period in human readable form. - std::string last_str() const; - - private: + /** \defgroup g_mixins Mixins + * \brief Mixins are utility classes used for all kinds of other classes. + * + * Mixin classes provide a single piece of functionality. + * + */ + + /// \ingroup g_mixins + /// \brief Namespace for mixin classes. + /// These classes always serve one particular purpose that multiple classes of the entire Hermes library + /// could use - logging, time measurement, ... + namespace Mixins + { + /// \ingroup g_mixins + /// Mixin that allows for asking about the instance state (ok / not ok). + class HERMES_API StateQueryable + { + public: + /// Ask if the instance is fine. + virtual bool isOkay() const = 0; + + /// Get class name, for the purpose of messaging. + virtual std::string getClassName() const = 0; + + /// Method to handle the state. + void check() const; + }; + + /// \brief Class the output of which is loggable, i.e. that uses functionality of info(), warn() + /// Contains the class Static with the following usage: + /// Anywhere in your program you can write Hermes::Mixins::Loggable::Static::info("whatever you want to output"). + class HERMES_API Loggable + { + private: + typedef void(*callbackFn)(const char*); + + public: + Loggable(bool verbose_output = false, callbackFn verbose_callback = NULL, bool add_newline = true); + + void set_file_output_only(bool onOff); + /// Sets the addition of a time stamp on each line in the log file. By default it is on. + void set_timestamps(bool onOff); + /// Sets the logFile being always erased before logging. + void set_erase_on_beginning(bool onOff); + void set_logFile_name(const char* filename); + void set_logFile_name(std::string filename); + static void set_static_logFile_name(const char* filename); + static void set_static_logFile_name(std::string filename); + + void info(const char* msg, ...) const; + void info_if(bool cond, const char* msg, ...) const; + void warn(const char* msg, ...) const; + void warn_if(bool cond, const char* msg, ...) const; + void error(const char* msg, ...) const; + void error_if(bool cond, const char* msg, ...) const; + + /// Sets the attribute verbose_output to the paramater option passed. + /// \todo Use this in solvers etc. + virtual void set_verbose_output(bool to_set); + + /// Returns the current value of verbose_output; + bool get_verbose_output() const; + + /// Provides a callback for logging. + /// \param[in] callback Function to be called for the messaging when verbose_output is set to yes. + /// \todo Use this in solvers etc. + virtual void set_verbose_callback(callbackFn callback); + + /// Returns the current value of verbose_callback; + callbackFn get_verbose_callback() const; + + /// For static logging. + class HERMES_API Static + { + public: + static void info(const char* msg, ...); + static void warn(const char* msg, ...); + static void error(const char* msg, ...); + }; + + /// Logfile name. + char* logFileName; + static char* staticLogFileName; + protected: + + /* file operations */ + void hermes_fwrite(const void* ptr, size_t size, size_t nitems, FILE* stream) const; + void hermes_fread(void* ptr, size_t size, size_t nitems, FILE* stream) const; + + private: + /// Writes a fancy formatted text to a console. \internal \ingroup g_logging + /** \param[in] code An event code, e.g., ::HERMES_EC_ERROR. + * \param[in] text A message. A C-style string. + * \return True if the message was written. False if it failed due to some reasone. */ + bool write_console(const char code, const char* text) const; + + /// Info about a log record. Used for output log function. \internal + class HERMES_API HermesLogEventInfo + { + public: + HermesLogEventInfo(const char code, const char* src_function, const char* src_file, const int src_line); + /// An event code character. For defails see event characters, e.g., ::HERMES_EC_ERROR + const char code; + /// A name of a function/method at which the event was generated. + const char* src_function; + /// A source file at which the event was generated. + const char* src_file; + /// A line in the source file at which the event was generated. + const int src_line; + }; + + HermesLogEventInfo* hermes_build_log_info(char event) const; + + static std::map logger_written; + + /// \brief Logs an event if the condition is true. \internal + /** Used by all even logging macros. Since this function returns a copy of the parameter cond, + * it can be used to call a function hermes2d_exit_if() or a function(). Thanks to that, the macro + * behaves as a function rather than a block of code. Also, this allows a debugger to a particular + * code. + * \param[in] code Code of the message. + * \param[in] msg A message. */ + void hermes_log_message(const char code, const char* msg) const; + + /// Verbose output. + /// Set to 'true' by default. + bool verbose_output; + + /// Only output to file - not to console. + bool file_output_only; + + /// Verbose callback. + callbackFn verbose_callback; + + /// Print timestampts. + bool print_timestamps; + + /// Erase the file on the beginning. + bool erase_on_beginning; + + /// Internal. + bool log_file_written; + + bool add_newline; + }; + + /// \brief Class using time measurement + /// Can be used directly (is not abstract), so one can use e.g. this in a program: + /// Mixins::TimeMeasurable time; + /// time.tick(); + /// <-- do whatever you want to measure execution time of --> + /// std::cout << "Whatever took " << time.last() << "seconds to execute."; + class HERMES_API TimeMeasurable + { + public: + /// Constructs internal structures and starts measuring. + TimeMeasurable(const char *name = nullptr); + + TimeMeasurable(const TimeMeasurable& other); + + /// Tick type. Used by the class Hermes::TimePeriod. + enum TimerPeriodTickType + { + HERMES_ACCUMULATE, ///< Accumulate a period between ticks. + HERMES_SKIP ///< Skip period between ticks, i.e., do not accumulate it. + }; + + /// Resets accumulated time. + const TimeMeasurable& reset(); + /// Starts a new_ period and resets accumulated time. + const TimeMeasurable& tick_reset(); + /// Starts/ends a new_ period. + const TimeMeasurable& tick(TimeMeasurable::TimerPeriodTickType type = HERMES_ACCUMULATE); + + /// Returns a name of the time period if any. + const std::string& name() const; + + /// Returns accumulated time (in seconds). + double accumulated() const; + + /// Returns accumulated time in human readable form. + std::string accumulated_str() const; + + /// Returns last measured period (in seconds). + /** \return Returns the length of the last measured time period. -1 if period was skipped. */ + double last() const; + + /// Returns last measured period in human readable form. + std::string last_str() const; + + private: #ifdef _WINDOWS //Windows - typedef uint64_t SysTime; - double frequency; ///< Frequency of the performance timer. If zero, no hi-res timer is supported. (Win32 only) + typedef uint64_t SysTime; + /// Frequency of the performance timer. If zero, no hi-res timer is supported. (Win32 only) + double frequency; #else //Linux - typedef timespec SysTime; + typedef timespec SysTime; #endif - const std::string period_name; ///< Name of the timer (can be empty) - double last_period; ///< Time of the last measured period. - SysTime last_time; ///< Time when the timer was started/resumed (in platform-dependent units). - double accum; ///< Time accumulator (in seconds). - - SysTime get_time() const; ///< Returns current time (in platform-dependent units). - double period_in_seconds(const SysTime& begin, const SysTime& end) const; ///< Calculates distance between times (in platform specific units) and returns it in seconds. - std::string to_string(const double time) const; ///< Converts time from seconds to human readable form. - }; - - /// \brief Class that allows overriding integration order in its discrete problems - /// Internal - class HERMES_API IntegrableWithGlobalOrder - { - public: - IntegrableWithGlobalOrder(); - /// \todo Use this in solvers etc. - virtual void set_global_integration_order(unsigned int order); - bool global_integration_order_set; - unsigned int global_integration_order; - }; - - /// \brief Class that allows overriding integration order in its discrete problems - /// Internal - class HERMES_API SettableComputationTime - { - public: - SettableComputationTime(); - /// set time information for time-dependent problems. - virtual void set_time(double time); - virtual void set_time_step(double time_step); - double time; - double time_step; - }; - - /// \brief Class that allows for attaching any method to particular parts of its functionality. - /// Internal - class HERMES_API OutputAttachable - { - public: - OutputAttachable(); - /// \return Whether or not should the processing continue. - virtual bool on_initialization(); - /// \return Whether or not should the processing continue. - virtual bool on_step_begin(); - /// \return Whether or not should the processing continue. - virtual bool on_initial_step_end(); - /// \return Whether or not should the processing continue. - virtual bool on_step_end(); - /// \return Whether or not should the processing continue. - virtual bool on_finish(); - - template - class Parameter - { - private: - T* value; - friend class OutputAttachable; - }; - - template - const T& get_parameter_value(const Parameter& parameter); - - template - T& get_parameter_value(Parameter& parameter); - - protected: - template - void set_parameter_value(Parameter& parameter, T* value); - }; - } - - typedef Hermes::Mixins::OutputAttachable::Parameter OutputParameterUnsignedInt; - typedef Hermes::Mixins::OutputAttachable::Parameter OutputParameterDouble; - typedef Hermes::Mixins::OutputAttachable::Parameter OutputParameterBool; - - typedef Hermes::Mixins::OutputAttachable::Parameter > OutputParameterUnsignedIntVector; - typedef Hermes::Mixins::OutputAttachable::Parameter > OutputParameterDoubleVector; - typedef Hermes::Mixins::OutputAttachable::Parameter > OutputParameterBoolVector; + /// Name of the timer (can be empty) + std::string period_name; + /// Time of the last measured period. + double last_period; + /// Time when the timer was started/resumed (in platform-dependent units). + SysTime last_time; + /// Time accumulator (in seconds). + double accum; + + /// Returns current time (in platform-dependent units). + SysTime get_time() const; + /// Calculates distance between times (in platform specific units) and returns it in seconds. + double period_in_seconds(const SysTime& begin, const SysTime& end) const; + /// Converts time from seconds to human readable form. + std::string to_string(const double time) const; + }; + + /// \brief Class that allows overriding integration order in its discrete problems + /// Internal + class HERMES_API IntegrableWithGlobalOrder + { + public: + IntegrableWithGlobalOrder(); + /// \todo Use this in solvers etc. + virtual void set_global_integration_order(unsigned int order); + bool global_integration_order_set; + unsigned int global_integration_order; + }; + + /// \brief Class that allows overriding integration order in its discrete problems + /// Internal + class HERMES_API SettableComputationTime + { + public: + SettableComputationTime(); + /// set time information for time-dependent problems. + virtual void set_time(double time); + virtual void set_time_step(double time_step); + double time; + double time_step; + }; + + /// \brief Class that allows for attaching any method to particular parts of its functionality. + /// Internal + class HERMES_API OutputAttachable + { + public: + OutputAttachable(); + /// \return Whether or not should the processing continue. + virtual bool on_initialization(); + /// \return Whether or not should the processing continue. + virtual bool on_step_begin(); + /// \return Whether or not should the processing continue. + virtual bool on_initial_step_end(); + /// \return Whether or not should the processing continue. + virtual bool on_step_end(); + /// \return Whether or not should the processing continue. + virtual bool on_finish(); + + template + class Parameter + { + private: + T* value; + friend class OutputAttachable; + }; + + template + const T& get_parameter_value(const Parameter& parameter); + + template + T& get_parameter_value(Parameter& parameter); + + protected: + template + void set_parameter_value(Parameter& parameter, T* value); + }; + } + + typedef Hermes::Mixins::OutputAttachable::Parameter OutputParameterUnsignedInt; + typedef Hermes::Mixins::OutputAttachable::Parameter OutputParameterDouble; + typedef Hermes::Mixins::OutputAttachable::Parameter OutputParameterBool; + + typedef Hermes::Mixins::OutputAttachable::Parameter > OutputParameterUnsignedIntVector; + typedef Hermes::Mixins::OutputAttachable::Parameter > OutputParameterDoubleVector; + typedef Hermes::Mixins::OutputAttachable::Parameter > OutputParameterBoolVector; } #endif diff --git a/hermes_common/include/ord.h b/hermes_common/include/ord.h index 99a31b6a15..3b279b7da7 100644 --- a/hermes_common/include/ord.h +++ b/hermes_common/include/ord.h @@ -71,7 +71,7 @@ namespace Hermes bool operator>(std::complex d); bool operator<(const Ord &o); bool operator>(const Ord &o); - + friend std::ostream & operator<< (std::ostream& os, const Ord& ord) { os << "Integration order: " << ord.get_order() << std::endl; diff --git a/hermes_common/include/solvers/eigensolver.h b/hermes_common/include/solvers/eigensolver.h deleted file mode 100644 index eef3392afb..0000000000 --- a/hermes_common/include/solvers/eigensolver.h +++ /dev/null @@ -1,92 +0,0 @@ -// This file is part of HermesCommon -// -// Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. -// -// Hermes2D is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the License, -// or (at your option) any later version. -// -// Hermes2D 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 Hermes2D; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -/*! \file eigensolver.h - \brief class for solving Eigenproblems. Currently using Python. -*/ -#ifndef __HERMES_EIGENSOLVER_H -#define __HERMES_EIGENSOLVER_H - -#include "config.h" -#ifdef WITH_PYTHON - -#include "matrix.h" - -#include "python_API/python_api.h" - -// RCP -#ifndef WITH_TRILINOS -#include "Teuchos_RCP.hpp" -#else -#include "Teuchos_RCP.hpp" -#endif - -namespace Hermes -{ - -using Teuchos::RCP; -using Teuchos::Ptr; -using Teuchos::rcp; -using Teuchos::null; - - -template -class HERMES_API EigenSolver -{ -public: - EigenSolver(const RCP > &A, const RCP > &B); - - - // Solves for 'n_eigs' eigenvectors, around the 'target_value'. Use - // 'get_eigenvalue' and 'get_eigenvector' to retrieve the - // eigenvalues/eigenvectors: - void solve(int n_eigs = 4, double target_value = -1, double tol = 1e-6, - int max_iter = 150); - - // Returns the number of calculated eigenvalues - int get_n_eigs() - { - return this->n_eigs; - } - // Returns the i-th eigenvalue - double get_eigenvalue(int i); - // Returns the i-th eigenvector. A pointer will be returned into an - // internal array, as well as the size of the vector. You don't own the - // memory and it will be deallocated once the EigenSolver() class is - // deleted. You need to make a copy of it if you want to store it - // permanently. - void get_eigenvector(int i, double **vec, int *n); - - void print_eigenvalues() - { - printf("Eigenvalues:\n"); - for (int i = 0; i < this->get_n_eigs(); i++) - printf("%3d: %f\n", i, this->get_eigenvalue(i)); - } - -private: - RCP > A, B; - int n_eigs; - Python p; -}; - -} - -#endif - -#endif diff --git a/hermes_common/include/solvers/interfaces/amesos_solver.h b/hermes_common/include/solvers/interfaces/amesos_solver.h index c12839df73..1f18b7cacc 100644 --- a/hermes_common/include/solvers/interfaces/amesos_solver.h +++ b/hermes_common/include/solvers/interfaces/amesos_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -35,9 +35,8 @@ namespace Hermes { /// \brief Encapsulation of Amesos linear solver. /// - /// @ingroup solvers template - class HERMES_API AmesosSolver : public DirectSolver + class HERMES_API AmesosSolver : public DirectSolver < Scalar > { public: static bool is_available(const char *name); @@ -49,6 +48,7 @@ namespace Hermes AmesosSolver(const char *solver_type, EpetraMatrix *m, EpetraVector *rhs); + void free(); virtual ~AmesosSolver(); virtual void solve(); virtual int get_matrix_size(); diff --git a/hermes_common/include/solvers/interfaces/aztecoo_solver.h b/hermes_common/include/solvers/interfaces/aztecoo_solver.h index a5db9f12d6..9ceab83f71 100644 --- a/hermes_common/include/solvers/interfaces/aztecoo_solver.h +++ b/hermes_common/include/solvers/interfaces/aztecoo_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -36,12 +36,12 @@ namespace Hermes { /// \brief Encapsulation of AztecOO linear solver. /// - /// @ingroup solvers template - class HERMES_API AztecOOSolver : public IterSolver + class HERMES_API AztecOOSolver : public IterSolver < Scalar > { public: AztecOOSolver(EpetraMatrix *m, EpetraVector *rhs); + void free(); virtual ~AztecOOSolver(); /// Set the type of the solver @@ -67,7 +67,7 @@ namespace Hermes virtual void use_node_wise_ordering(unsigned int num_pdes); virtual void use_equations_wise_ordering(); - virtual void solve(); + virtual void solve(); virtual void solve(Scalar* initial_guess); virtual int get_matrix_size(); @@ -82,7 +82,8 @@ namespace Hermes void set_param(int param, double value); protected: - AztecOO aztec; ///< Instance of the Aztec solver. + /// Instance of the Aztec solver. + AztecOO aztec; EpetraMatrix *m; EpetraVector *rhs; diff --git a/hermes_common/include/solvers/interfaces/epetra.h b/hermes_common/include/solvers/interfaces/epetra.h index 522c175ae6..2cee6ea3b5 100644 --- a/hermes_common/include/solvers/interfaces/epetra.h +++ b/hermes_common/include/solvers/interfaces/epetra.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -27,6 +27,7 @@ #define EPETRA_NO_64BIT_GLOBAL_INDICES #include "algebra/matrix.h" #include "algebra/vector.h" +#include "util/memory_handling.h" #include #include #include @@ -35,6 +36,7 @@ #include #include #include +#include namespace Hermes { @@ -55,7 +57,7 @@ namespace Hermes namespace Algebra { template - class HERMES_API EpetraMatrix : public SparseMatrix + class HERMES_API EpetraMatrix : public SparseMatrix < Scalar > { public: EpetraMatrix(); @@ -76,11 +78,11 @@ namespace Hermes virtual void add(unsigned int m, unsigned int n, Scalar v); virtual void multiply_with_vector(Scalar* vector_in, Scalar*& vector_out, bool vector_out_initialized = false) const; virtual void multiply_with_Scalar(Scalar value); - + virtual void add_sparse_matrix(SparseMatrix* mat); EpetraMatrix* duplicate() { return new EpetraMatrix(*this); } - + virtual void add(unsigned int m, unsigned int n, Scalar *mat, int *rows, int *cols, const int size); using Matrix::export_to_file; virtual void export_to_file(const char *filename, const char *var_name, MatrixExportFormat fmt, char* number_format = "%lf"); @@ -94,17 +96,17 @@ namespace Hermes Epetra_CrsGraph *grph; /// \brief Imaginary part of the matrix, mat holds the real part. Epetra_CrsMatrix *mat_im; - + bool owner; - friend class Hermes::Solvers::AmesosSolver; - friend class Hermes::Solvers::AztecOOSolver; - friend class Hermes::Preconditioners::IfpackPrecond; - friend class Hermes::Preconditioners::MlPrecond; + friend class Hermes::Solvers::AmesosSolver < Scalar > ; + friend class Hermes::Solvers::AztecOOSolver < Scalar > ; + friend class Hermes::Preconditioners::IfpackPrecond < Scalar > ; + friend class Hermes::Preconditioners::MlPrecond < Scalar > ; }; template - class HERMES_API EpetraVector : public Vector + class HERMES_API EpetraVector : public Vector < Scalar > { public: EpetraVector(); @@ -116,6 +118,8 @@ namespace Hermes virtual Scalar get(unsigned int idx) const; virtual void extract(Scalar *v) const; virtual void zero(); + /// Duplicates a matrix (including allocation). + Vector* duplicate() const; virtual Vector* change_sign(); virtual void set(unsigned int idx, Scalar y); virtual void add(unsigned int idx, Scalar y); @@ -130,8 +134,8 @@ namespace Hermes Epetra_Vector *vec_im; bool owner; - friend class Hermes::Solvers::AmesosSolver; - friend class Hermes::Solvers::AztecOOSolver; + friend class Hermes::Solvers::AmesosSolver < Scalar > ; + friend class Hermes::Solvers::AztecOOSolver < Scalar > ; }; } } diff --git a/hermes_common/include/solvers/interfaces/mumps_solver.h b/hermes_common/include/solvers/interfaces/mumps_solver.h index b0c55b0bab..f13eac19a5 100644 --- a/hermes_common/include/solvers/interfaces/mumps_solver.h +++ b/hermes_common/include/solvers/interfaces/mumps_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -53,7 +53,7 @@ namespace Hermes /** Type for storing number in Mumps complex structures */ template <> - struct mumps_type > + struct mumps_type < std::complex > { /** Type for storing mumps struct in Mumps complex structures */ typedef ZMUMPS_STRUC_C mumps_struct; @@ -63,7 +63,7 @@ namespace Hermes /** Type for storing number in Mumps real structures */ template <> - struct mumps_type + struct mumps_type < double > { /** Type for storing mumps struct in Mumps real structures */ typedef DMUMPS_STRUC_C mumps_struct; @@ -74,7 +74,7 @@ namespace Hermes /** \brief Matrix used with MUMPS solver */ /// Important: MUMPS is indexing from 1 template - class MumpsMatrix : public CSCMatrix + class MumpsMatrix : public CSCMatrix < Scalar > { public: MumpsMatrix(); @@ -110,11 +110,14 @@ namespace Hermes CSMatrix* duplicate() const; protected: - int *irn; ///< Row indices. - int *jcn; ///< Column indices. - typename mumps_type::mumps_Scalar *Ax; ///< Matrix entries (column-wise). - - friend class Solvers::MumpsSolver; + /// Row indices. + int *irn; + /// Column indices. + int *jcn; + /// Matrix entries (column-wise). + typename mumps_type::mumps_Scalar *Ax; + + friend class Solvers::MumpsSolver < Scalar > ; template friend SparseMatrix* create_matrix(); }; } @@ -123,9 +126,8 @@ namespace Hermes { /// Encapsulation of MUMPS linear solver. /// - /// @ingroup solvers template - class HERMES_API MumpsSolver : public DirectSolver + class HERMES_API MumpsSolver : public DirectSolver < Scalar > { public: /// Constructor of MumpsSolver. @@ -157,7 +159,8 @@ namespace Hermes /// \sa #check_status() bool reinit(); private: - void mumps_c(typename mumps_type::mumps_struct * param); //wrapper around dmums_c or zmumps_c + //wrapper around dmums_c or zmumps_c + void mumps_c(typename mumps_type::mumps_struct * param); /// True if solver is inited. bool inited; diff --git a/hermes_common/include/solvers/interfaces/paralution_solver.h b/hermes_common/include/solvers/interfaces/paralution_solver.h index ac0a7c2fac..c29c32d69c 100644 --- a/hermes_common/include/solvers/interfaces/paralution_solver.h +++ b/hermes_common/include/solvers/interfaces/paralution_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -19,7 +19,7 @@ /*! \file paralution_solver.h \brief PARALUTION solver interface. */ -#ifndef __HERMES_COMMON_PARALUTION_SOLVER_H_ +#ifndef __HERMES_COMMON_PARALUTION_SOLVER_H_ #define __HERMES_COMMON_PARALUTION_SOLVER_H_ #include "config.h" #ifdef WITH_PARALUTION @@ -52,7 +52,7 @@ namespace Hermes /// \brief General Paralution matrix. template - class HERMES_API ParalutionMatrix : public CSRMatrix + class HERMES_API ParalutionMatrix : public CSRMatrix < Scalar > { public: /// \brief Default constructor. @@ -73,9 +73,9 @@ namespace Hermes template friend SparseMatrix* create_matrix(); }; - /// \brief Class representing the vector for UMFPACK. + /// \brief Class representing the vector for PARALUTION. template - class HERMES_API ParalutionVector : public SimpleVector + class HERMES_API ParalutionVector : public SimpleVector < Scalar > { public: /// Default constructor. @@ -99,9 +99,8 @@ namespace Hermes { /// \brief A PARALUTION preconditioner. /// - /// @ingroup preconds template - class ParalutionPrecond : public Hermes::Preconditioners::Precond + class ParalutionPrecond : public Hermes::Preconditioners::Precond < Scalar > { public: /// Constructor. @@ -156,9 +155,8 @@ namespace Hermes /// \brief ABSTRACT class containing common functionality of both PARALUTION iterative and AMG linear solver. /// - /// @ingroup Solvers template - class HERMES_API AbstractParalutionLinearMatrixSolver : public virtual LoopSolver + class HERMES_API AbstractParalutionLinearMatrixSolver : public virtual LoopSolver < Scalar > { public: virtual void solve(Scalar* initial_guess); @@ -170,13 +168,11 @@ namespace Hermes /// Get the residual value. virtual double get_residual_norm(); - /// Sets the verboseness. - virtual void set_verbose_output(bool to_set); - /// Utility. virtual int get_matrix_size(); - void free(); + /// Free this instance. + virtual void free(); protected: /// Constructor of Abstract PARALUTION solver. @@ -215,12 +211,10 @@ namespace Hermes template friend class AMGParalutionLinearMatrixSolver; }; - /// \brief Encapsulation of PARALUTION iterative linear solver. /// - /// @ingroup Solvers template - class HERMES_API IterativeParalutionLinearMatrixSolver : public AbstractParalutionLinearMatrixSolver, public virtual IterSolver + class HERMES_API IterativeParalutionLinearMatrixSolver : public AbstractParalutionLinearMatrixSolver, public virtual IterSolver < Scalar > { public: /// Constructor of Iterative PARALUTION solver. @@ -237,6 +231,9 @@ namespace Hermes /// Set internal solver for the current solution. virtual void init_internal_solver(); + /// Free this instance. + void free(); + virtual void set_precond(Precond *pc); // Linear Solver creation. @@ -249,9 +246,8 @@ namespace Hermes /// \brief Encapsulation of PARALUTION AMG linear solver. /// - /// @ingroup Solvers template - class HERMES_API AMGParalutionLinearMatrixSolver : public AbstractParalutionLinearMatrixSolver, public virtual AMGSolver + class HERMES_API AMGParalutionLinearMatrixSolver : public AbstractParalutionLinearMatrixSolver, public virtual AMGSolver < Scalar > { public: /// Constructor of UMFPack solver. diff --git a/hermes_common/include/solvers/interfaces/petsc_solver.h b/hermes_common/include/solvers/interfaces/petsc_solver.h index 6e95a6b031..7a1e7b2d8a 100644 --- a/hermes_common/include/solvers/interfaces/petsc_solver.h +++ b/hermes_common/include/solvers/interfaces/petsc_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -22,10 +22,13 @@ #ifndef __HERMES_COMMON_PETSC_SOLVER_H_ #define __HERMES_COMMON_PETSC_SOLVER_H_ +#include "config.h" + #include "algebra/matrix.h" #include "solvers/linear_matrix_solver.h" #ifdef WITH_PETSC + #include #include #include @@ -45,7 +48,7 @@ namespace Hermes { /// \brief Wrapper of PETSc matrix, to store matrices used with PETSc in its native format. template - class PetscMatrix : public SparseMatrix + class PetscMatrix : public SparseMatrix < Scalar > { public: PetscMatrix(); @@ -57,11 +60,8 @@ namespace Hermes virtual Scalar get(unsigned int m, unsigned int n) const; virtual void zero(); virtual void add(unsigned int m, unsigned int n, Scalar v); - virtual void add_to_diagonal(Scalar v); - virtual void add(unsigned int m, unsigned int n, Scalar *mat, int *rows, int *cols); using Matrix::export_to_file; virtual void export_to_file(const char *filename, const char *var_name, MatrixExportFormat fmt, char* number_format = "%lf"); - virtual unsigned int get_matrix_size() const; virtual unsigned int get_nnz() const; virtual double get_fill_in() const; @@ -81,7 +81,7 @@ namespace Hermes /// @todo same input parameters acts differen as in superlu void create(unsigned int size, unsigned int nnz, int* ap, int* ai, Scalar* ax); // Duplicates a matrix (including allocation). - PetscMatrix* duplicate(); + PetscMatrix* duplicate() const; protected: /// Add matrix - PETSc. /// @param[in] mat matrix to be added @@ -94,13 +94,13 @@ namespace Hermes /// Is matrix inited (allocated)? bool inited; - friend class Solvers::PetscLinearMatrixSolver; + friend class Solvers::PetscLinearMatrixSolver < Scalar > ; }; /// Wrapper of PETSc vector, to store vectors used with PETSc in its native format. /// template - class PetscVector : public Vector + class PetscVector : public Vector < Scalar > { public: PetscVector(); @@ -128,16 +128,15 @@ namespace Hermes /// Is vector initiated (allocated)? bool inited; - friend class Solvers::PetscLinearMatrixSolver; + friend class Solvers::PetscLinearMatrixSolver < Scalar > ; }; } namespace Solvers { /// Encapsulation of PETSc linear solver. /// - /// @ingroup solvers template - class HERMES_API PetscLinearMatrixSolver : public DirectSolver + class HERMES_API PetscLinearMatrixSolver : public DirectSolver < Scalar > { public: PetscLinearMatrixSolver(PetscMatrix *mat, PetscVector *rhs); @@ -154,4 +153,4 @@ namespace Hermes } } #endif -#endif \ No newline at end of file +#endif diff --git a/hermes_common/include/solvers/interfaces/precond_ifpack.h b/hermes_common/include/solvers/interfaces/precond_ifpack.h index 23c7db0930..f868393741 100644 --- a/hermes_common/include/solvers/interfaces/precond_ifpack.h +++ b/hermes_common/include/solvers/interfaces/precond_ifpack.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -35,9 +35,8 @@ namespace Hermes using namespace Hermes::Solvers; /// \brief Preconditioners built on IFPACK. /// - /// @ingroup preconds template - class HERMES_API IfpackPrecond: public EpetraPrecond + class HERMES_API IfpackPrecond : public EpetraPrecond < Scalar > { public: /// Constructor for relaxation methods. @@ -80,12 +79,13 @@ namespace Hermes Ifpack_Preconditioner *prec; Teuchos::ParameterList ilist; EpetraMatrix *mat; - unsigned owner:1; - const char *cls; // class of the preconditioner + unsigned owner : 1; + // class of the preconditioner + const char *cls; const char *type; int overlap; - friend class AztecOOSolver; + friend class AztecOOSolver < Scalar > ; }; } } diff --git a/hermes_common/include/solvers/interfaces/precond_ml.h b/hermes_common/include/solvers/interfaces/precond_ml.h index 91cdc0f0a4..1fed92ff94 100644 --- a/hermes_common/include/solvers/interfaces/precond_ml.h +++ b/hermes_common/include/solvers/interfaces/precond_ml.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -34,9 +34,8 @@ namespace Hermes using namespace Hermes::Solvers; /// \brief Preconditioners built on ML. /// - /// @ingroup preconds template - class HERMES_API MlPrecond : public EpetraPrecond + class HERMES_API MlPrecond : public EpetraPrecond < Scalar > { public: /// @param[in] type - type of the preconditioner[ sa | dd ] @@ -74,9 +73,9 @@ namespace Hermes ML_Epetra::MultiLevelPreconditioner *prec; Teuchos::ParameterList mlist; EpetraMatrix *mat; - unsigned owner:1; + unsigned owner : 1; - friend class AztecOOSolver; + friend class AztecOOSolver < Scalar > ; }; } } diff --git a/hermes_common/include/solvers/interfaces/superlu_solver.h b/hermes_common/include/solvers/interfaces/superlu_solver.h index 8c63a77796..c04da1465e 100644 --- a/hermes_common/include/solvers/interfaces/superlu_solver.h +++ b/hermes_common/include/solvers/interfaces/superlu_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -74,7 +74,7 @@ namespace Hermes /** Type for storing number in SuperLU real structures */ template<> - struct SuperLuType + struct SuperLuType < double > { /** Type for storing scalar number in SuperLU real structures */ typedef double Scalar; @@ -82,7 +82,7 @@ namespace Hermes /** Type for storing number in SuperLU complex structures */ template<> - struct SuperLuType > + struct SuperLuType < std::complex > { /** Type for storing scalar number in SuperLU complex structures */ typedef struct { double r, i; } Scalar; @@ -97,9 +97,8 @@ namespace Hermes { /// Encapsulation of SUPERLU linear solver. /// - /// @ingroup solvers template - class HERMES_API SuperLUSolver : public DirectSolver + class HERMES_API SuperLUSolver : public DirectSolver < Scalar > { public: /// Constructor of SuperLU solver. @@ -119,9 +118,12 @@ namespace Hermes /// Right hand side vector. SimpleVector *rhs; - bool has_A, has_B; ///< Have the native SuperLU matrices been created? - bool inited; ///< Have the factorization structures been allocated? - bool A_changed; ///< Indicates that the system matrix has been changed. + /// Have the native SuperLU matrices been created? + bool has_A, has_B; + /// Have the factorization structures been allocated? + bool inited; + /// Indicates that the system matrix has been changed. + bool A_changed; // internally during factorization or externally by // the user. @@ -139,13 +141,20 @@ namespace Hermes void free_matrix(); void free_rhs(); - SuperMatrix A, B; ///< Native SuperLU representations of 'm' and 'rhs'. - SuperMatrix L, U; ///< L/U factors of A. - double *R, *C; ///< Row/column scaling factors of A. - int *perm_r; ///< Row permutations from partial pivoting. - int *perm_c; ///< Column permutations to reduce fill-in ( = > matrix Pc). - int *etree; ///< Elimination tree of Pc'*A'*A*Pc. - slu_options_t options; ///< Structure holding the input options for the solver. + /// Native SuperLU representations of 'm' and 'rhs'. + SuperMatrix A, B; + /// L/U factors of A. + SuperMatrix L, U; + /// Row/column scaling factors of A. + double *R, *C; + /// Row permutations from partial pivoting. + int *perm_r; + /// Column permutations to reduce fill-in ( = > matrix Pc). + int *perm_c; + /// Elimination tree of Pc'*A'*A*Pc. + int *etree; + /// Structure holding the input options for the solver. + slu_options_t options; private: #ifndef SLU_MT @@ -158,10 +167,13 @@ namespace Hermes #endif //SLU_MT #ifndef SLU_MT - char equed[1]; ///< Form of equilibration that was done on A. + /// Form of equilibration that was done on A. + char equed[1]; #else - equed_t equed; ///< Form of equilibration that was done on A. - SuperMatrix AC; ///< Matrix A permuted by perm_c. + /// Form of equilibration that was done on A. + equed_t equed; + /// Matrix A permuted by perm_c. + SuperMatrix AC; #endif //SLU_MT template friend LinearMatrixSolver* create_linear_solver(Matrix* matrix, Vector* rhs, bool use_direct_solver = false); }; diff --git a/hermes_common/include/solvers/interfaces/umfpack_solver.h b/hermes_common/include/solvers/interfaces/umfpack_solver.h index ee445ece76..65abbe2d97 100644 --- a/hermes_common/include/solvers/interfaces/umfpack_solver.h +++ b/hermes_common/include/solvers/interfaces/umfpack_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -19,7 +19,7 @@ /*! \file umfpack_solver.h \brief UMFPACK solver interface. */ -#ifndef __HERMES_COMMON_UMFPACK_SOLVER_H_ +#ifndef __HERMES_COMMON_UMFPACK_SOLVER_H_ #define __HERMES_COMMON_UMFPACK_SOLVER_H_ #include "config.h" #ifdef WITH_UMFPACK @@ -44,9 +44,8 @@ namespace Hermes { /// \brief Encapsulation of UMFPACK linear solver. /// - /// @ingroup Solvers template - class HERMES_API UMFPackLinearMatrixSolver : public DirectSolver + class HERMES_API UMFPackLinearMatrixSolver : public DirectSolver < Scalar > { public: /// Constructor of UMFPack solver. @@ -66,7 +65,8 @@ namespace Hermes /// \brief Reusable factorization information (A denotes matrix represented by the pointer 'm'). /// Reordering of matrix A to reduce fill-in during factorization. void *symbolic; - void *numeric; ///< LU factorization of matrix A. + /// LU factorization of matrix A. + void *numeric; /// \todo document void free_factorization_data(); diff --git a/hermes_common/include/solvers/linear_matrix_solver.h b/hermes_common/include/solvers/linear_matrix_solver.h index 1f21f6944e..a53c943413 100644 --- a/hermes_common/include/solvers/linear_matrix_solver.h +++ b/hermes_common/include/solvers/linear_matrix_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -106,6 +106,7 @@ namespace Hermes IterSolver* as_IterSolver() const; AMGSolver* as_AMGSolver() const; virtual ~LinearMatrixSolver(); + virtual void free() = 0; /// Solve. /// @return true on succes @@ -169,7 +170,7 @@ namespace Hermes /// \brief Special-purpose abstract class for using external solvers. /// For examples implementation, see the class SimpleExternalSolver. template - class HERMES_API ExternalSolver : public LinearMatrixSolver, public Algebra::Mixins::MatrixRhsOutput + class HERMES_API ExternalSolver : public LinearMatrixSolver, public Algebra::Mixins::MatrixRhsOutput < Scalar > { public: typedef ExternalSolver* (*creation)(CSCMatrix *m, SimpleVector *rhs); @@ -195,7 +196,7 @@ namespace Hermes /// \brief An example class for using external solvers that run a command and store the result in a file. template - class HERMES_API SimpleExternalSolver : public ExternalSolver + class HERMES_API SimpleExternalSolver : public ExternalSolver < Scalar > { public: SimpleExternalSolver(CSCMatrix *m, SimpleVector *rhs); @@ -212,7 +213,7 @@ namespace Hermes /// \brief Base class for defining interface for direct linear solvers. /// Internal, though utilizable for defining interfaces to other algebraic packages. template - class HERMES_API DirectSolver : public LinearMatrixSolver + class HERMES_API DirectSolver : public LinearMatrixSolver < Scalar > { public: DirectSolver(SparseMatrix* matrix, Vector* rhs); @@ -235,7 +236,7 @@ namespace Hermes /// \brief Abstract middle-class for solvers that work in a loop of a kind (iterative, multigrid, ...) template - class HERMES_API LoopSolver : public LinearMatrixSolver + class HERMES_API LoopSolver : public LinearMatrixSolver < Scalar > { public: LoopSolver(SparseMatrix* matrix, Vector* rhs); @@ -283,7 +284,7 @@ namespace Hermes /// \brief Abstract class for defining interface for iterative solvers. /// Internal, though utilizable for defining interfaces to other algebraic packages. template - class HERMES_API IterSolver : public virtual LoopSolver + class HERMES_API IterSolver : public virtual LoopSolver < Scalar > { public: IterSolver(SparseMatrix* matrix, Vector* rhs); @@ -306,7 +307,7 @@ namespace Hermes /// \brief Abstract class for defining interface for Algebraic Multigrid solvers. /// Internal, though utilizable for defining interfaces to other algebraic packages. template - class HERMES_API AMGSolver : public virtual LoopSolver + class HERMES_API AMGSolver : public virtual LoopSolver < Scalar > { public: AMGSolver(SparseMatrix* matrix, Vector* rhs); diff --git a/hermes_common/include/solvers/matrix_solver.h b/hermes_common/include/solvers/matrix_solver.h index 2bb7da4b21..d513206dd8 100644 --- a/hermes_common/include/solvers/matrix_solver.h +++ b/hermes_common/include/solvers/matrix_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -45,10 +45,10 @@ namespace Hermes PeakMemoryUsage = 1, Flops = 2 }; - - /// Return the solution vector. + + /// Return the solution vector. virtual Scalar *get_sln_vector(); - + /// Sets the jacobian to be constant, i.e. reused whenever possible. void set_jacobian_constant(bool to_set = true); @@ -58,7 +58,7 @@ namespace Hermes /// \TODO This is not used now. /// Set Reporting of UMFPACK numerical factorization data provided the used matrix solver is UMFPACK. virtual void set_UMFPACK_output(bool to_set = true, bool with_output = false); - + /// \TODO This is not used now. /// Get UMFPACK numerical factorization data provided the used matrix solver is UMFPACK virtual double get_UMFPACK_reporting_data(UMFPACK_reporting_data_value data_value); @@ -72,16 +72,19 @@ namespace Hermes /// Verbose output. virtual void set_verbose_output(bool to_set); + /// The solution vector. + Scalar* sln_vector; + protected: /// Linear solver. Hermes::Solvers::LinearMatrixSolver* linear_matrix_solver; - + /// Jacobian can be reused if possible. bool constant_jacobian; /// Jacobian is ready to be reused if desirable. bool jacobian_reusable; - + /// Number of equations. int problem_size; @@ -96,8 +99,6 @@ namespace Hermes /// Data for UMFPACK reporting. double UMFPACK_reporting_data[3]; #endif - /// The solution vector. - Scalar* sln_vector; }; } } diff --git a/hermes_common/include/solvers/newton_matrix_solver.h b/hermes_common/include/solvers/newton_matrix_solver.h index 2e51747320..b2a66e91f3 100644 --- a/hermes_common/include/solvers/newton_matrix_solver.h +++ b/hermes_common/include/solvers/newton_matrix_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -29,7 +29,7 @@ namespace Hermes namespace Solvers { template - class HERMES_API NewtonMatrixSolver : public NonlinearMatrixSolver + class HERMES_API NewtonMatrixSolver : public NonlinearMatrixSolver < Scalar > { public: NewtonMatrixSolver(); @@ -37,7 +37,7 @@ namespace Hermes protected: virtual double update_solution_return_change_norm(Scalar* linear_system_solution); - + /// Find out the convergence state. virtual NonlinearConvergenceState get_convergence_state(); diff --git a/hermes_common/include/solvers/nonlinear_convergence_measurement.h b/hermes_common/include/solvers/nonlinear_convergence_measurement.h index ffa25d9751..6f313da67f 100644 --- a/hermes_common/include/solvers/nonlinear_convergence_measurement.h +++ b/hermes_common/include/solvers/nonlinear_convergence_measurement.h @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published diff --git a/hermes_common/include/solvers/nonlinear_matrix_solver.h b/hermes_common/include/solvers/nonlinear_matrix_solver.h index 629d87bcde..94fcdd7b6b 100644 --- a/hermes_common/include/solvers/nonlinear_matrix_solver.h +++ b/hermes_common/include/solvers/nonlinear_matrix_solver.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -37,18 +37,17 @@ namespace Hermes { /// Convergence measurement strategies. /// Count of the types - for solver to hold arrays of such a length. - const int NonlinearConvergenceMeasurementTypeCount = 7; + const int NonlinearConvergenceMeasurementTypeCount = 6; /// This specifies the quantity that is compared to newton_tolerance (settable by set_tolerance()). enum NonlinearConvergenceMeasurementType { - ResidualNormRelativeToInitial = 0x0001, - ResidualNormRelativeToPrevious = 0x0002, - ResidualNormRatioToInitial = 0x0004, - ResidualNormRatioToPrevious = 0x0008, - ResidualNormAbsolute = 0x0010, - SolutionChangeAbsolute = 0x0020, - SolutionChangeRelative = 0x0040 + ResidualNormRelativeToPrevious = 0x0001, + ResidualNormRatioToInitial = 0x0002, + ResidualNormRatioToPrevious = 0x0004, + ResidualNormAbsolute = 0x0008, + SolutionChangeAbsolute = 0x0010, + SolutionChangeRelative = 0x0020 }; /// Nonlinear Convergence state. @@ -109,7 +108,7 @@ namespace Hermes /// Default: default is the automatic damping, default coefficient if manual damping used is set by this method. /// \param[in] onOff on(true)-manual damping, off(false)-automatic damping. /// \param[in] coeff The (perpetual) damping coefficient in the case of manual damping. Ignored in the case of automatic damping. - void set_manual_damping_coeff(bool onOff, double coeff); + void set_manual_damping_coeff(bool onOff, double coeff = .0); /// Make the automatic damping start with this coefficient. /// This will also be the top bound for the coefficient. @@ -190,8 +189,8 @@ namespace Hermes #pragma endregion virtual void assemble_residual(bool store_previous_residual) = 0; - virtual void assemble_jacobian(bool store_previous_jacobian) = 0; - virtual void assemble(bool store_previous_jacobian, bool store_previous_residual) = 0; + virtual bool assemble_jacobian(bool store_previous_jacobian) = 0; + virtual bool assemble(bool store_previous_jacobian, bool store_previous_residual) = 0; /// \return Whether or not should the processing continue. virtual void on_damping_factor_updated(); @@ -301,7 +300,7 @@ namespace Hermes Scalar* previous_sln_vector; bool use_initial_guess_for_iterative_solvers; - friend class NonlinearConvergenceMeasurement; + friend class NonlinearConvergenceMeasurement < Scalar >; }; } diff --git a/hermes_common/include/solvers/picard_matrix_solver.h b/hermes_common/include/solvers/picard_matrix_solver.h index 37738a8b1c..d11e80a528 100644 --- a/hermes_common/include/solvers/picard_matrix_solver.h +++ b/hermes_common/include/solvers/picard_matrix_solver.h @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -30,7 +30,7 @@ namespace Hermes { /// See H2D: PicardSolver. template - class HERMES_API PicardMatrixSolver : public NonlinearMatrixSolver + class HERMES_API PicardMatrixSolver : public NonlinearMatrixSolver < Scalar > { public: PicardMatrixSolver(); @@ -42,11 +42,11 @@ namespace Hermes /// Turn on / off the Anderson acceleration. By default it is off. void use_Anderson_acceleration(bool to_set); - /// Set how many last vectors will be used for Anderson acceleration. See the details about the Anderson acceleration for + /// Set how many last vectors will be used for Anderson acceleration. See the details about the Anderson acceleration for /// explanation of this parameter. void set_num_last_vector_used(int num); - /// Set the Anderson beta coefficient. See the details about the Anderson acceleration for + /// Set the Anderson beta coefficient. See the details about the Anderson acceleration for /// explanation of this parameter. void set_anderson_beta(double beta); #pragma endregion diff --git a/hermes_common/include/solvers/precond.h b/hermes_common/include/solvers/precond.h index d23778a12d..8d21f8da2a 100644 --- a/hermes_common/include/solvers/precond.h +++ b/hermes_common/include/solvers/precond.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -38,7 +38,6 @@ namespace Hermes /// Namespace containing objects for preconditioners. namespace Preconditioners { - /// @ingroup preconds /// The preconditioner type. enum PreconditionerType { @@ -54,7 +53,6 @@ namespace Hermes /// \brief Abstract class to define interface for preconditioners. /// - /// @ingroup preconds template class Precond { @@ -64,9 +62,8 @@ namespace Hermes /// \brief Abstract class for Epetra preconditioners. /// - /// @ingroup preconds template - class EpetraPrecond : public Precond + class EpetraPrecond : public Precond < Scalar > #ifdef HAVE_EPETRA , public Epetra_Operator #endif diff --git a/hermes_common/include/util/callstack.h b/hermes_common/include/util/callstack.h index 8a314a66b7..db9021e4cd 100644 --- a/hermes_common/include/util/callstack.h +++ b/hermes_common/include/util/callstack.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -18,33 +18,35 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file callstack.h \brief File containing functionality for investigating call stack. -*/ + */ #ifndef __HERMES_COMMON_CALLSTACK_H_ #define __HERMES_COMMON_CALLSTACK_H_ #include "util/compat.h" #include "common.h" #ifdef WITH_WINDOWS_STACKWALKER - #ifdef _WINDOWS - #include - #include "StackWalker.h" - - /// A windows stack walker implementation - /// Usage: - /// MyStackWalker sw; - /// sw.ShowCallstack(); - class MyStackWalker : public StackWalker - { - public: - MyStackWalker() : StackWalker(StackWalker::RetrieveSymbol & StackWalker::RetrieveLine, nullptr, GetCurrentProcessId(), GetCurrentProcess()) - { - int a = 1; - } - protected: - virtual void OnOutput(LPCSTR szText) - { printf(szText);} - }; +#ifdef _WINDOWS +#include +#include "StackWalker.h" - #endif +/// A windows stack walker implementation +/// Usage: +/// MyStackWalker sw; +/// sw.ShowCallstack(); +class MyStackWalker : public StackWalker +{ +public: + MyStackWalker() : StackWalker(StackWalker::RetrieveSymbol & StackWalker::RetrieveLine, nullptr, GetCurrentProcessId(), GetCurrentProcess()) + { + int a = 1; + } +protected: + virtual void OnOutput(LPCSTR szText) + { + printf(szText); + } +}; + +#endif #endif #endif \ No newline at end of file diff --git a/hermes_common/include/util/compat.h b/hermes_common/include/util/compat.h index 59a977c3a4..e4703553fe 100644 --- a/hermes_common/include/util/compat.h +++ b/hermes_common/include/util/compat.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -29,43 +29,43 @@ #ifndef HAVE_FMEMOPEN /// Implementation of GNU fmemopen. Intended to be used if the current platform does not support it. -FILE *fmemopen (void *buf, size_t size, const char *opentype); +FILE *fmemopen(void *buf, size_t size, const char *opentype); #endif // Windows DLL export/import definitions. #if defined (HERMES_STATIC_LIBS) - #define HERMES_API +#define HERMES_API #else - #if defined (AGROS) - #if defined (HERMES_FOR_AGROS) - #define HERMES_API __declspec(dllexport) - #else - #define HERMES_API __declspec(dllimport) - #endif - #else - #if defined(WIN32) || defined(_WINDOWS) - // Visual Studio 2010. - #if defined(EXPORT_HERMES_DLL) - // when building DLL (target project defines this macro) - #define HERMES_API __declspec(dllexport) - #else - // when using the DLL by a client project - #define HERMES_API __declspec(dllimport) - #endif - #else - #define HERMES_API - #endif - #endif +#if defined (AGROS) +#if defined (HERMES_FOR_AGROS) +#define HERMES_API __declspec(dllexport) +#else +#define HERMES_API __declspec(dllimport) +#endif +#else +#if defined(WIN32) || defined(_WINDOWS) +// Visual Studio 2010. +#if defined(EXPORT_HERMES_DLL) +// when building DLL (target project defines this macro) +#define HERMES_API __declspec(dllexport) +#else +// when using the DLL by a client project +#define HERMES_API __declspec(dllimport) +#endif +#else +#define HERMES_API +#endif +#endif #endif #if defined(WIN32) || defined(_WINDOWS) #ifdef HERMES_COMMON - #define HERMES_COMMON_API __declspec(dllexport) +#define HERMES_COMMON_API __declspec(dllexport) #else - #define HERMES_COMMON_API __declspec(dllimport) +#define HERMES_COMMON_API __declspec(dllimport) #endif #else - #define HERMES_COMMON_API +#define HERMES_COMMON_API #endif #ifndef HAVE_STRCASECMP @@ -73,12 +73,12 @@ FILE *fmemopen (void *buf, size_t size, const char *opentype); #endif #ifdef __GNUC__ - #define NORETURN __attribute__((noreturn)) +#define NORETURN __attribute__((noreturn)) #else - #define NORETURN - #ifndef __attribute__ - #define __attribute__(x) - #endif +#define NORETURN +#ifndef __attribute__ +#define __attribute__(x) +#endif #endif // If C++ 11 is not supported diff --git a/hermes_common/include/util/memory_handling.h b/hermes_common/include/util/memory_handling.h index 4eea9901c9..ee47609a60 100644 --- a/hermes_common/include/util/memory_handling.h +++ b/hermes_common/include/util/memory_handling.h @@ -97,7 +97,7 @@ namespace Hermes if (size == 0) return nullptr; ArrayItem* new_array; - if (force_malloc && std::is_pod::value) + if (force_malloc) new_array = (ArrayItem*)calloc(size, sizeof(ArrayItem)); else { @@ -124,7 +124,7 @@ namespace Hermes if (size == 0) return nullptr; ArrayItem* new_array; - if (force_malloc && std::is_pod::value) + if (force_malloc) new_array = (ArrayItem*)calloc(size, sizeof(ArrayItem)); else { @@ -149,8 +149,10 @@ namespace Hermes { if (size == 0) return nullptr; + ArrayItem* new_array; - if (force_malloc && std::is_pod::value) + + if (force_malloc) new_array = (ArrayItem*)malloc(size * sizeof(ArrayItem)); else #ifdef WITH_PJLIB @@ -175,7 +177,7 @@ namespace Hermes if (size == 0) return nullptr; ArrayItem* new_array; - if (force_malloc && std::is_pod::value) + if (force_malloc) new_array = (ArrayItem*)malloc(size * sizeof(ArrayItem)); else #ifdef WITH_PJLIB @@ -199,7 +201,7 @@ namespace Hermes return nullptr; ArrayItem* new_array; #ifdef WITH_PJLIB - new_array = (ArrayItem*)hermesCommonGlobalPoolCache.pool_alloc(size * sizeof(ArrayItem)); + new_array = (ArrayItem*)hermesCommonGlobalPoolCache.pool_alloc(size * sizeof(ArrayItem)); #else new_array = (ArrayItem*)malloc(size); #endif @@ -237,6 +239,7 @@ namespace Hermes template ArrayItem* realloc_with_check(ArrayItem*& original_array, int new_size, Caller* const caller) { + int array_item_size = sizeof(ArrayItem); if (new_size == 0) return nullptr; @@ -246,7 +249,7 @@ namespace Hermes else { caller->free(); - throw Hermes::Exceptions::Exception("Hermes::realloc_with_check() failed to reallocate %i bytes.", new_size * sizeof(ArrayItem)); + throw Hermes::Exceptions::Exception("Hermes::realloc_with_check() failed to reallocate %i bytes.", new_size * array_item_size); return nullptr; } } @@ -254,6 +257,7 @@ namespace Hermes template ArrayItem* realloc_with_check(ArrayItem*& original_array, int new_size) { + int array_item_size = sizeof(ArrayItem); if (new_size == 0) return nullptr; @@ -262,7 +266,7 @@ namespace Hermes return original_array = new_array; else { - throw Hermes::Exceptions::Exception("Hermes::realloc_with_check() failed to reallocate %i bytes.", new_size * sizeof(ArrayItem)); + throw Hermes::Exceptions::Exception("Hermes::realloc_with_check() failed to reallocate %i bytes.", new_size * array_item_size); return nullptr; } } diff --git a/hermes_common/include/util/qsort.h b/hermes_common/include/util/qsort.h index 0dea0d764a..ab22407486 100644 --- a/hermes_common/include/util/qsort.h +++ b/hermes_common/include/util/qsort.h @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -18,7 +18,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file qsort.h \brief The QuickSort routine from glibc-2.5 modified for sorting int arrays. -*/ + */ #include "util/compat.h" template diff --git a/hermes_common/src/algebra/algebra_mixins.cpp b/hermes_common/src/algebra/algebra_mixins.cpp index 5838dc40ed..9ffd603b7c 100644 --- a/hermes_common/src/algebra/algebra_mixins.cpp +++ b/hermes_common/src/algebra/algebra_mixins.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -82,7 +82,6 @@ namespace Hermes if (rhs == nullptr) return; - if (this->output_rhsOn) { char* fileName = malloc_with_check(this->RhsFilename.length() + 5); @@ -204,10 +203,10 @@ namespace Hermes this->import_from_file(filename.c_str(), var_name.c_str(), fmt); } - template HERMES_API class MatrixRhsOutput; - template HERMES_API class MatrixRhsOutput >; - template HERMES_API class MatrixRhsImportExport; - template HERMES_API class MatrixRhsImportExport >; + template HERMES_API class MatrixRhsOutput < double > ; + template HERMES_API class MatrixRhsOutput < std::complex > ; + template HERMES_API class MatrixRhsImportExport < double > ; + template HERMES_API class MatrixRhsImportExport < std::complex > ; } } -} +} \ No newline at end of file diff --git a/hermes_common/src/algebra/cs_matrix.cpp b/hermes_common/src/algebra/cs_matrix.cpp index 9acff17d94..31dae72a89 100644 --- a/hermes_common/src/algebra/cs_matrix.cpp +++ b/hermes_common/src/algebra/cs_matrix.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -47,20 +47,18 @@ namespace Hermes } template - int CSMatrix::find_position(int *Ai, int Alen, int idx) + int CSMatrix::find_position(int *Ai, int Alen, unsigned int idx) { - assert(Ai != nullptr); - assert(Alen > 0); - assert(idx >= 0); - register int lo = 0, hi = Alen - 1, mid; while (true) { mid = (lo + hi) >> 1; - if (idx < Ai[mid]) hi = mid - 1; - else if (idx > Ai[mid]) lo = mid + 1; + if (idx < Ai[mid]) + hi = mid - 1; + else if (idx > Ai[mid]) + lo = mid + 1; else break; // Sparse matrix entry not found (raise an error when trying to add @@ -102,8 +100,6 @@ namespace Hermes template void CSMatrix::alloc() { - assert(this->pages != nullptr); - // initialize the arrays Ap and Ai Ap = malloc_with_check, int>(this->size + 1, this); int aisize = this->get_num_indices(); @@ -115,12 +111,12 @@ namespace Hermes for (i = 0; i < this->size; i++) { Ap[i] = pos; - pos += this->sort_and_store_indices(this->pages[i], Ai + pos, Ai + aisize); + pos += this->sort_and_store_indices(&this->pages[i], Ai + pos, Ai + aisize); } - Ap[i] = pos; + Ap[this->size] = pos; free_with_check(this->pages); - this->pages = nullptr; + free_with_check(this->next_pages); nnz = Ap[this->size]; @@ -130,8 +126,7 @@ namespace Hermes template void CSMatrix::alloc_data() { - Ax = malloc_with_check, Scalar>(nnz, this); - memset(Ax, 0, sizeof(Scalar)* nnz); + Ax = calloc_with_check, Scalar>(nnz, this); } template @@ -247,7 +242,7 @@ namespace Hermes } else { - for (int i = 0; i < csMatrix->get_size(); i++) + for (unsigned short i = 0; i < csMatrix->get_size(); i++) { int index = csMatrix->Ap[i]; for (int j = 0; j < csMatrix->Ap[i + 1] - index; j++) @@ -379,118 +374,139 @@ namespace Hermes { case EXPORT_FORMAT_MATRIX_MARKET: { - FILE* file = fopen(filename, "w"); - if (!file) - throw Exceptions::IOException(Exceptions::IOException::Write, filename); - if (Hermes::Helpers::TypeIsReal::value) - fprintf(file, "%%%%MatrixMarket matrix coordinate real general\n"); - else - fprintf(file, "%%%%MatrixMarket matrix coordinate complex general\n"); - - fprintf(file, "%d %d %d\n", this->size, this->size, this->nnz); - - if (invert_storage) - this->switch_orientation(); - for (unsigned int j = 0; j < this->size; j++) - { - for (int i = Ap[j]; i < Ap[j + 1]; i++) - { - Hermes::Helpers::fprint_coordinate_num(file, i_coordinate(Ai[i] + 1, j + 1, invert_storage), j_coordinate(Ai[i] + 1, j + 1, invert_storage), Ax[i], number_format); - fprintf(file, "\n"); - } - } - if (invert_storage) - this->switch_orientation(); - - fclose(file); + FILE* file = fopen(filename, "w"); + if (!file) + throw Exceptions::IOException(Exceptions::IOException::Write, filename); + if (Hermes::Helpers::TypeIsReal::value) + fprintf(file, "%%%%MatrixMarket matrix coordinate real general\n"); + else + fprintf(file, "%%%%MatrixMarket matrix coordinate complex general\n"); + + fprintf(file, "%d %d %d\n", this->size, this->size, this->nnz); + + if (invert_storage) + this->switch_orientation(); + for (unsigned int j = 0; j < this->size; j++) + { + for (int i = Ap[j]; i < Ap[j + 1]; i++) + { + Hermes::Helpers::fprint_coordinate_num(file, i_coordinate(Ai[i] + 1, j + 1, invert_storage), j_coordinate(Ai[i] + 1, j + 1, invert_storage), Ax[i], number_format); + fprintf(file, "\n"); + } + } + if (invert_storage) + this->switch_orientation(); + + fclose(file); } break; case EXPORT_FORMAT_MATLAB_MATIO: { #ifdef WITH_MATIO - mat_sparse_t sparse; - sparse.nzmax = this->nnz; - if (invert_storage) - this->switch_orientation(); - - sparse.nir = this->nnz; - sparse.ir = Ai; - sparse.njc = this->size + 1; - sparse.jc = (int *)Ap; - sparse.ndata = this->nnz; - - size_t dims[2]; - dims[0] = this->size; - dims[1] = this->size; - - mat_t *mat = Mat_CreateVer(filename, "", MAT_FT_MAT5); - - matvar_t *matvar; - - // For complex. No allocation here. - double* Ax_re = nullptr; - double* Ax_im = nullptr; - - // For real. - if (Hermes::Helpers::TypeIsReal::value) - { - sparse.data = Ax; - matvar = Mat_VarCreate(var_name, MAT_C_SPARSE, MAT_T_DOUBLE, 2, dims, &sparse, MAT_F_DONT_COPY_DATA); - } - else - { - // For complex. - Ax_re = malloc_with_check, double>(this->nnz, this); - Ax_im = malloc_with_check, double>(this->nnz, this); - struct mat_complex_split_t z = { Ax_re, Ax_im }; - - for (int i = 0; i < this->nnz; i++) - { - Ax_re[i] = ((std::complex)(this->Ax[i])).real(); - Ax_im[i] = ((std::complex)(this->Ax[i])).imag(); - sparse.data = &z; - } - matvar = Mat_VarCreate(var_name, MAT_C_SPARSE, MAT_T_DOUBLE, 2, dims, &sparse, MAT_F_DONT_COPY_DATA | MAT_F_COMPLEX); - } - - if (matvar) - { - Mat_VarWrite(mat, matvar, MAT_COMPRESSION_ZLIB); - Mat_VarFree(matvar); - } - if (invert_storage) - this->switch_orientation(); - free_with_check(Ax_re); - free_with_check(Ax_im); - Mat_Close(mat); - - if (!matvar) - throw Exceptions::IOException(Exceptions::IOException::Write, filename); + mat_sparse_t sparse; + sparse.nzmax = this->nnz; + if (invert_storage) + this->switch_orientation(); + + sparse.nir = this->nnz; + sparse.ir = this->Ai; + sparse.njc = this->size + 1; + sparse.jc = (int *)this->Ap; + sparse.ndata = this->nnz; + + size_t dims[2]; + dims[0] = this->size; + dims[1] = this->size; + + mat_t *mat = Mat_CreateVer(filename, "", MAT_FT_MAT5); + + matvar_t *matvar; + + // For complex. No allocation here. + double* Ax_re = nullptr; + double* Ax_im = nullptr; + + // For real. + if (Hermes::Helpers::TypeIsReal::value) + { + sparse.data = Ax; + matvar = Mat_VarCreate(var_name, MAT_C_SPARSE, MAT_T_DOUBLE, 2, dims, &sparse, MAT_F_DONT_COPY_DATA); + } + else + { + // For complex. + Ax_re = malloc_with_check, double>(this->nnz, this); + Ax_im = malloc_with_check, double>(this->nnz, this); + struct mat_complex_split_t z = { Ax_re, Ax_im }; + + for (int i = 0; i < this->nnz; i++) + { + Ax_re[i] = ((std::complex)(this->Ax[i])).real(); + Ax_im[i] = ((std::complex)(this->Ax[i])).imag(); + sparse.data = &z; + } + matvar = Mat_VarCreate(var_name, MAT_C_SPARSE, MAT_T_DOUBLE, 2, dims, &sparse, MAT_F_DONT_COPY_DATA | MAT_F_COMPLEX); + } + + if (matvar) + { + Mat_VarWrite(mat, matvar, MAT_COMPRESSION_ZLIB); + Mat_VarFree(matvar); + } + if (invert_storage) + this->switch_orientation(); + free_with_check(Ax_re); + free_with_check(Ax_im); + Mat_Close(mat); + + if (!matvar) + throw Exceptions::IOException(Exceptions::IOException::Write, filename); #endif } break; case EXPORT_FORMAT_PLAIN_ASCII: { - FILE* file = fopen(filename, "w"); - if (!file) - throw Exceptions::IOException(Exceptions::IOException::Write, filename); - - if (invert_storage) - this->switch_orientation(); - for (unsigned int j = 0; j < this->size; j++) - { - for (int i = Ap[j]; i < Ap[j + 1]; i++) - { - Helpers::fprint_coordinate_num(file, i_coordinate(Ai[i], j, invert_storage), j_coordinate(Ai[i], j, invert_storage), Ax[i], number_format); - fprintf(file, "\n"); - } - } - if (invert_storage) - this->switch_orientation(); - - fclose(file); + FILE* file = fopen(filename, "w"); + if (!file) + throw Exceptions::IOException(Exceptions::IOException::Write, filename); + + if (invert_storage) + this->switch_orientation(); + for (unsigned int j = 0; j < this->size; j++) + { + for (int i = Ap[j]; i < Ap[j + 1]; i++) + { + Helpers::fprint_coordinate_num(file, i_coordinate(Ai[i], j, invert_storage), j_coordinate(Ai[i], j, invert_storage), Ax[i], number_format); + fprintf(file, "\n"); + } + } + if (invert_storage) + this->switch_orientation(); + + fclose(file); + } + break; + + case EXPORT_FORMAT_MATLAB_SIMPLE: + { + FILE* file = fopen(filename, "w"); + if (invert_storage) + this->switch_orientation(); + fprintf(file, "%% Size: %dx%d\n%% Nonzeros: %d\ntemp = zeros(%d, 3);\ntemp =[\n", + this->size, this->size, nnz, nnz); + for (unsigned int j = 0; j < this->size; j++) + for (int i = Ap[j]; i < Ap[j + 1]; i++) + { + fprintf(file, "%d %d ", Ai[i] + 1, j + 1); + Hermes::Helpers::fprint_num(file, Ax[i], number_format); + fprintf(file, "\n"); + } + fprintf(file, "];\n"); + if (invert_storage) + this->switch_orientation(); + fclose(file); } break; #ifdef WITH_BSON @@ -577,55 +593,55 @@ namespace Hermes case EXPORT_FORMAT_MATLAB_MATIO: { #ifdef WITH_MATIO - mat_t *matfp; - matvar_t *matvar; - - matfp = Mat_Open(filename, MAT_ACC_RDONLY); - - if (!matfp) - throw Exceptions::IOException(Exceptions::IOException::Read, filename); - - matvar = Mat_VarRead(matfp, var_name); - - if (matvar) - { - mat_sparse_t *sparse = (mat_sparse_t *)matvar->data; - - this->nnz = sparse->nir; - this->Ax = malloc_with_check, Scalar>(this->nnz, this); - this->Ai = malloc_with_check, int>(this->nnz, this); - this->size = sparse->njc; - this->Ap = malloc_with_check, int>(this->size + 1, this); - - void* data = nullptr; - if (Hermes::Helpers::TypeIsReal::value) - data = sparse->data; - else - { - std::complex* complex_data = malloc_with_check, std::complex >(this->nnz, this); - double* real_array = (double*)((mat_complex_split_t*)sparse->data)->Re; - double* imag_array = (double*)((mat_complex_split_t*)sparse->data)->Im; - for (int i = 0; i < this->nnz; i++) - complex_data[i] = std::complex(real_array[i], imag_array[i]); - data = (void*)complex_data; - } - memcpy(this->Ax, data, this->nnz * sizeof(Scalar)); - if (!Hermes::Helpers::TypeIsReal::value) - free_with_check(data); - memcpy(this->Ap, sparse->jc, this->size * sizeof(int)); - this->Ap[this->size] = this->nnz; - memcpy(this->Ai, sparse->ir, this->nnz * sizeof(int)); - - if (invert_storage) - this->switch_orientation(); - } - - Mat_Close(matfp); - - if (!matvar) - throw Exceptions::IOException(Exceptions::IOException::Read, filename); + mat_t *matfp; + matvar_t *matvar; + + matfp = Mat_Open(filename, MAT_ACC_RDONLY); + + if (!matfp) + throw Exceptions::IOException(Exceptions::IOException::Read, filename); + + matvar = Mat_VarRead(matfp, var_name); + + if (matvar) + { + mat_sparse_t *sparse = (mat_sparse_t *)matvar->data; + + this->nnz = sparse->nir; + this->Ax = malloc_with_check, Scalar>(this->nnz, this); + this->Ai = malloc_with_check, int>(this->nnz, this); + this->size = sparse->njc; + this->Ap = malloc_with_check, int>(this->size + 1, this); + + void* data = nullptr; + if (Hermes::Helpers::TypeIsReal::value) + data = sparse->data; + else + { + std::complex* complex_data = malloc_with_check, std::complex >(this->nnz, this); + double* real_array = (double*)((mat_complex_split_t*)sparse->data)->Re; + double* imag_array = (double*)((mat_complex_split_t*)sparse->data)->Im; + for (int i = 0; i < this->nnz; i++) + complex_data[i] = std::complex(real_array[i], imag_array[i]); + data = (void*)complex_data; + } + memcpy(this->Ax, data, this->nnz * sizeof(Scalar)); + if (!Hermes::Helpers::TypeIsReal::value) + free_with_check(data); + memcpy(this->Ap, sparse->jc, this->size * sizeof(int)); + this->Ap[this->size] = this->nnz; + memcpy(this->Ai, sparse->ir, this->nnz * sizeof(int)); + + if (invert_storage) + this->switch_orientation(); + } + + Mat_Close(matfp); + + if (!matvar) + throw Exceptions::IOException(Exceptions::IOException::Read, filename); #else - throw Exceptions::Exception("MATIO not included."); + throw Exceptions::Exception("MATIO not included."); #endif } break; @@ -636,72 +652,72 @@ namespace Hermes #ifdef WITH_BSON case EXPORT_FORMAT_BSON: { - FILE *fpr; - fpr = fopen(filename, "rb"); - - // file size: - fseek(fpr, 0, SEEK_END); - int size = ftell(fpr); - rewind(fpr); - - // allocate memory to contain the whole file: - char *datar = malloc_with_check(size); - fread(datar, size, 1, fpr); - fclose(fpr); - - bson br; - bson_init_finished_data(&br, datar, 0); - - bson_iterator it; - bson sub; - bson_find(&it, &br, "size"); - this->size = bson_iterator_int(&it); - bson_find(&it, &br, "nnz"); - this->nnz = bson_iterator_int(&it); - - this->Ap = malloc_with_check, int>(this->size + 1, this); - this->Ai = malloc_with_check, int>(nnz, this); - this->Ax = malloc_with_check, Scalar>(nnz, this); - - // coeffs - bson_iterator it_coeffs; - bson_find(&it_coeffs, &br, "Ap"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - int index_coeff = 0; - while (bson_iterator_next(&it)) - this->Ap[index_coeff++] = bson_iterator_int(&it); - this->Ap[this->size] = this->nnz; - - bson_find(&it_coeffs, &br, "Ai"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - index_coeff = 0; - while (bson_iterator_next(&it)) - this->Ai[index_coeff++] = bson_iterator_int(&it); - - bson_find(&it_coeffs, &br, "Ax"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - index_coeff = 0; - while (bson_iterator_next(&it)) - this->Ax[index_coeff++] = bson_iterator_double(&it); - - if (!Hermes::Helpers::TypeIsReal::value) - { - bson_find(&it_coeffs, &br, "Ax-imag"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - index_coeff = 0; - while (bson_iterator_next(&it)) - ((std::complex)this->Ax[index_coeff++]).imag(bson_iterator_double(&it)); - } - - if (invert_storage) - this->switch_orientation(); - - bson_destroy(&br); - free_with_check(datar); + FILE *fpr; + fpr = fopen(filename, "rb"); + + // file size: + fseek(fpr, 0, SEEK_END); + int size = ftell(fpr); + rewind(fpr); + + // allocate memory to contain the whole file: + char *datar = malloc_with_check(size); + fread(datar, size, 1, fpr); + fclose(fpr); + + bson br; + bson_init_finished_data(&br, datar, 0); + + bson_iterator it; + bson sub; + bson_find(&it, &br, "size"); + this->size = bson_iterator_int(&it); + bson_find(&it, &br, "nnz"); + this->nnz = bson_iterator_int(&it); + + this->Ap = malloc_with_check, int>(this->size + 1, this); + this->Ai = malloc_with_check, int>(nnz, this); + this->Ax = malloc_with_check, Scalar>(nnz, this); + + // coeffs + bson_iterator it_coeffs; + bson_find(&it_coeffs, &br, "Ap"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + int index_coeff = 0; + while (bson_iterator_next(&it)) + this->Ap[index_coeff++] = bson_iterator_int(&it); + this->Ap[this->size] = this->nnz; + + bson_find(&it_coeffs, &br, "Ai"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + index_coeff = 0; + while (bson_iterator_next(&it)) + this->Ai[index_coeff++] = bson_iterator_int(&it); + + bson_find(&it_coeffs, &br, "Ax"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + index_coeff = 0; + while (bson_iterator_next(&it)) + this->Ax[index_coeff++] = bson_iterator_double(&it); + + if (!Hermes::Helpers::TypeIsReal::value) + { + bson_find(&it_coeffs, &br, "Ax-imag"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + index_coeff = 0; + while (bson_iterator_next(&it)) + ((std::complex)this->Ax[index_coeff++]).imag(bson_iterator_double(&it)); + } + + if (invert_storage) + this->switch_orientation(); + + bson_destroy(&br); + free_with_check(datar); } #endif break; @@ -721,7 +737,7 @@ namespace Hermes } template - CSMatrix* CSCMatrix::duplicate() const + SparseMatrix* CSCMatrix::duplicate() const { CSCMatrix* new_matrix = new CSCMatrix(); new_matrix->create(this->get_size(), this->get_nnz(), this->get_Ap(), this->get_Ai(), this->get_Ax()); @@ -764,14 +780,21 @@ namespace Hermes template void CSRMatrix::pre_add_ij(unsigned int row, unsigned int col) { - if (this->pages[row] == nullptr || this->pages[row]->count >= SparseMatrix::PAGE_SIZE) + if (this->pages[row].count >= SparseMatrix::PAGE_SIZE) { - typename SparseMatrix::Page *new_page = new typename SparseMatrix::Page; - new_page->count = 0; - new_page->next = this->pages[row]; - this->pages[row] = new_page; + typename SparseMatrix::Page* final_page = &(this->pages[row]); + while (final_page->next != nullptr && final_page->count >= SparseMatrix::PAGE_SIZE) + final_page = final_page->next; + + if (final_page->next == nullptr && final_page->count >= SparseMatrix::PAGE_SIZE) + { + final_page->next = new typename SparseMatrix::Page(true); + final_page = final_page->next; + } + final_page->idx[final_page->count++] = col; } - this->pages[row]->idx[this->pages[row]->count++] = col; + else + this->pages[row].idx[this->pages[row].count++] = col; } template @@ -784,11 +807,11 @@ namespace Hermes } } -template class HERMES_API Hermes::Algebra::CSMatrix; -template class HERMES_API Hermes::Algebra::CSMatrix >; +template class HERMES_API Hermes::Algebra::CSMatrix < double > ; +template class HERMES_API Hermes::Algebra::CSMatrix < std::complex > ; -template class HERMES_API Hermes::Algebra::CSCMatrix; -template class HERMES_API Hermes::Algebra::CSCMatrix >; +template class HERMES_API Hermes::Algebra::CSCMatrix < double > ; +template class HERMES_API Hermes::Algebra::CSCMatrix < std::complex > ; -template class HERMES_API Hermes::Algebra::CSRMatrix; -template class HERMES_API Hermes::Algebra::CSRMatrix >; +template class HERMES_API Hermes::Algebra::CSRMatrix < double > ; +template class HERMES_API Hermes::Algebra::CSRMatrix < std::complex > ; diff --git a/hermes_common/src/algebra/dense_matrix_operations.cpp b/hermes_common/src/algebra/dense_matrix_operations.cpp index e34fd025bb..daef7798e0 100644 --- a/hermes_common/src/algebra/dense_matrix_operations.cpp +++ b/hermes_common/src/algebra/dense_matrix_operations.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -29,10 +29,10 @@ namespace Hermes { namespace DenseMatrixOperations { - template - void ludcmp(T **a, int n, int *indx, double *d) + template + void ludcmp(T **a, Int n, Int *indx, double *d) { - int i, imax = 0, j, k; + Int i, imax = 0, j, k; T big, dum, sum, temp; T *vv = malloc_with_check(n); @@ -96,10 +96,11 @@ namespace Hermes free_with_check(vv); } - template - void lubksb(T **a, int n, int *indx, S *b) + template + void lubksb(T **a, Int n, Int *indx, S *b) { - int i, ip, j; + Int ip, j; + int i; S sum; for (i = 0; i < n; i++) @@ -120,17 +121,21 @@ namespace Hermes } } - template - void choldc(T **a, int n, T p[]) + template + void choldc(T **a, Int n, T p[]) { - int i, j, k; + Int i, j, k; for (i = 0; i < n; i++) { for (j = i; j < n; j++) { T sum = a[i][j]; k = i; - while (--k >= 0) sum -= a[i][k] * a[j][k]; + while (k > 0) + { + sum -= a[i][k - 1] * a[j][k - 1]; + k--; + } if (i == j) { if ((std::complex(sum)).real() <= 0.0) @@ -142,13 +147,35 @@ namespace Hermes } } - template HERMES_API void ludcmp(double **a, int n, int *indx, double *d); - template HERMES_API void ludcmp >(std::complex **a, int n, int *indx, double *d); - template HERMES_API void lubksb >(double **a, int n, int *indx, std::complex *d); - template HERMES_API void lubksb(double **a, int n, int *indx, double *d); - template HERMES_API void lubksb, std::complex >(std::complex **a, int n, int *indx, std::complex *d); - template HERMES_API void choldc(double **a, int n, double p[]); - template HERMES_API void choldc >(std::complex **a, int n, std::complex p[]); + template HERMES_API void ludcmp(double **a, int n, int *indx, double *d); + template HERMES_API void ludcmp, int>(std::complex **a, int n, int *indx, double *d); + + template HERMES_API void ludcmp(double **a, unsigned short n, unsigned short *indx, double *d); + template HERMES_API void ludcmp, unsigned short>(std::complex **a, unsigned short n, unsigned short *indx, double *d); + + template HERMES_API void ludcmp(double **a, unsigned char n, unsigned char *indx, double *d); + template HERMES_API void ludcmp, unsigned char>(std::complex **a, unsigned char n, unsigned char *indx, double *d); + + template HERMES_API void lubksb, int>(double **a, int n, int *indx, std::complex *d); + template HERMES_API void lubksb(double **a, int n, int *indx, double *d); + template HERMES_API void lubksb, std::complex, int>(std::complex **a, int n, int *indx, std::complex *d); + + template HERMES_API void lubksb, unsigned short>(double **a, unsigned short n, unsigned short *indx, std::complex *d); + template HERMES_API void lubksb(double **a, unsigned short n, unsigned short *indx, double *d); + template HERMES_API void lubksb, std::complex, unsigned short>(std::complex **a, unsigned short n, unsigned short *indx, std::complex *d); + + template HERMES_API void lubksb, unsigned char>(double **a, unsigned char n, unsigned char *indx, std::complex *d); + template HERMES_API void lubksb(double **a, unsigned char n, unsigned char *indx, double *d); + template HERMES_API void lubksb, std::complex, unsigned char>(std::complex **a, unsigned char n, unsigned char *indx, std::complex *d); + + template HERMES_API void choldc(double **a, int n, double p[]); + template HERMES_API void choldc, int>(std::complex **a, int n, std::complex p[]); + + template HERMES_API void choldc(double **a, unsigned short n, double p[]); + template HERMES_API void choldc, unsigned short>(std::complex **a, unsigned short n, std::complex p[]); + + template HERMES_API void choldc(double **a, unsigned char n, double p[]); + template HERMES_API void choldc, unsigned char>(std::complex **a, unsigned char n, std::complex p[]); } } -} +} \ No newline at end of file diff --git a/hermes_common/src/algebra/matrix.cpp b/hermes_common/src/algebra/matrix.cpp index 3e45bf9628..ee8052e990 100644 --- a/hermes_common/src/algebra/matrix.cpp +++ b/hermes_common/src/algebra/matrix.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -64,10 +64,10 @@ namespace Hermes { if (!vector_out_initialized) vector_out = malloc_with_check(this->size); - for (int i = 0; i < this->size; i++) + for (unsigned int i = 0; i < this->size; i++) { vector_out[i] = Scalar(0.); - for (int j = 0; j < this->size; j++) + for (unsigned int j = 0; j < this->size; j++) vector_out[i] += this->get(i, j) * vector_in[j]; } } @@ -84,16 +84,35 @@ namespace Hermes return this->size; }; - template - void Matrix::add(unsigned int m, unsigned int n, Scalar *mat, int *rows, int *cols, const int size) + template<> + void Matrix::add(unsigned int m, unsigned int n, double *mat, int *rows, int *cols, const int size) { for (unsigned int i = 0; i < m; i++) { for (unsigned int j = 0; j < n; j++) { - if (rows[i] >= 0 && cols[j] >= 0) // not Dir. dofs. + double entry = mat[i * size + j]; + if (entry != 0.) { - add(rows[i], cols[j], mat[i * size + j]); + if (rows[i] >= 0 && cols[j] >= 0) // not Dir. dofs. + add(rows[i], cols[j], entry); + } + } + } + } + + template<> + void Matrix >::add(unsigned int m, unsigned int n, std::complex* mat, int *rows, int *cols, const int size) + { + for (unsigned int i = 0; i < m; i++) + { + for (unsigned int j = 0; j < n; j++) + { + std::complex entry = mat[i * size + j]; + if (entry != 0.) + { + if (rows[i] >= 0 && cols[j] >= 0) // not Dir. dofs. + add(rows[i], cols[j], mat[i * size + j]); } } } @@ -103,8 +122,7 @@ namespace Hermes SparseMatrix::SparseMatrix() : Matrix() { pages = nullptr; - row_storage = false; - col_storage = false; + next_pages = nullptr; } template @@ -112,38 +130,7 @@ namespace Hermes { this->size = size; pages = nullptr; - - row_storage = false; - col_storage = false; - } - - template - SparseMatrix::SparseMatrix(const SparseMatrix& mat) - { - this->size = mat.get_size(); - - if (mat.pages) - { - this->pages = malloc_with_check, Page *>(this->size, this); - memset(this->pages, 0, this->size * sizeof(Page *)); - - for (int col = 0; col < this->size; col++) - { - Page *page = mat.pages[col]; - Page *new_page = new Page; - new_page->count = page->count; - memcpy(new_page->idx, page->idx, sizeof(int)* page->count); - new_page->next = this->pages[col]; - this->pages[col] = new_page; - } - } - else - { - this->pages = nullptr; - } - - row_storage = false; - col_storage = false; + next_pages = nullptr; } template @@ -157,11 +144,15 @@ namespace Hermes { if (pages) { - for (unsigned int i = 0; i < this->size; i++) - if (pages[i]) - delete pages[i]; free_with_check(pages); } + + if (next_pages) + { + for (unsigned int i = 0; i < this->size; i++) + delete next_pages[i]; + free_with_check(next_pages); + } } template @@ -244,22 +235,27 @@ namespace Hermes void SparseMatrix::prealloc(unsigned int n) { this->size = n; - - pages = malloc_with_check, Page *>(n, this); - memset(pages, 0, n * sizeof(Page *)); + pages = malloc_with_check, Page>(n, this); } template void SparseMatrix::pre_add_ij(unsigned int row, unsigned int col) { - if (pages[col] == nullptr || pages[col]->count >= PAGE_SIZE) + if (pages[col].count >= PAGE_SIZE) { - Page *new_page = new Page; - new_page->count = 0; - new_page->next = pages[col]; - pages[col] = new_page; + Page* final_page = &(pages[col]); + while (final_page->next != nullptr && final_page->count >= PAGE_SIZE) + final_page = final_page->next; + + if (final_page->next == nullptr && final_page->count >= PAGE_SIZE) + { + final_page->next = new Page(true); + final_page = final_page->next; + } + final_page->idx[final_page->count++] = row; } - pages[col]->idx[pages[col]->count++] = row; + else + pages[col].idx[pages[col].count++] = row; } template @@ -273,15 +269,16 @@ namespace Hermes end += page->count; Page *tmp = page; page = page->next; - delete tmp; + if (tmp->dyn_stored) + delete tmp; } // sort the indices and remove duplicities qsort_int(buffer, end - buffer); int *q = buffer; for (int *p = buffer, last = -1; p < end; p++) - if (*p != last) - *q++ = last = *p; + if (*p != last) + *q++ = last = *p; return q - buffer; } @@ -291,8 +288,8 @@ namespace Hermes { int total = 0; for (unsigned int i = 0; i < this->size; i++) - for (Page *page = pages[i]; page != nullptr; page = page->next) - total += page->count; + for (Page *page = &pages[i]; page != nullptr; page = page->next) + total += page->count; return total; } @@ -304,78 +301,78 @@ namespace Hermes { case Hermes::SOLVER_EXTERNAL: { - return new CSCMatrix; + return new CSCMatrix < double > ; } case Hermes::SOLVER_AMESOS: { #if defined HAVE_AMESOS && defined HAVE_EPETRA - return new EpetraMatrix; + return new EpetraMatrix < double > ; #else - throw Hermes::Exceptions::Exception("Amesos not installed."); + throw Hermes::Exceptions::Exception("Amesos not installed."); #endif - break; + break; } case Hermes::SOLVER_AZTECOO: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); #if defined HAVE_AZTECOO && defined HAVE_EPETRA - return new EpetraMatrix; + return new EpetraMatrix < double > ; #else - throw Hermes::Exceptions::Exception("AztecOO not installed."); + throw Hermes::Exceptions::Exception("AztecOO not installed."); #endif - break; + break; } case Hermes::SOLVER_MUMPS: { #ifdef WITH_MUMPS - return new MumpsMatrix; + return new MumpsMatrix < double > ; #else - throw Hermes::Exceptions::Exception("MUMPS not installed."); + throw Hermes::Exceptions::Exception("MUMPS not installed."); #endif - break; + break; } case Hermes::SOLVER_PETSC: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); #ifdef WITH_PETSC - return new PetscMatrix; + return new PetscMatrix < double > ; #else - throw Hermes::Exceptions::Exception("PETSc not installed."); + throw Hermes::Exceptions::Exception("PETSc not installed."); #endif - break; + break; } case Hermes::SOLVER_UMFPACK: { #ifdef WITH_UMFPACK - return new CSCMatrix; + return new CSCMatrix < double > ; #else - throw Hermes::Exceptions::Exception("UMFPACK was not installed."); + throw Hermes::Exceptions::Exception("UMFPACK was not installed."); #endif - break; + break; } case Hermes::SOLVER_PARALUTION_ITERATIVE: case Hermes::SOLVER_PARALUTION_AMG: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); #ifdef WITH_PARALUTION - return new ParalutionMatrix; + return new ParalutionMatrix < double > ; #else - throw Hermes::Exceptions::Exception("PARALUTION was not installed."); + throw Hermes::Exceptions::Exception("PARALUTION was not installed."); #endif - break; + break; } case Hermes::SOLVER_SUPERLU: { #ifdef WITH_SUPERLU - return new CSCMatrix; + return new CSCMatrix < double > ; #else - throw Hermes::Exceptions::Exception("SuperLU was not installed."); + throw Hermes::Exceptions::Exception("SuperLU was not installed."); #endif - break; + break; } default: throw Hermes::Exceptions::Exception("Unknown matrix solver requested in create_matrix()."); @@ -390,77 +387,77 @@ namespace Hermes { case Hermes::SOLVER_EXTERNAL: { - return new CSCMatrix >; + return new CSCMatrix < std::complex > ; } case Hermes::SOLVER_AMESOS: { #if defined HAVE_AMESOS && defined HAVE_EPETRA - return new EpetraMatrix >; + return new EpetraMatrix < std::complex > ; #else - throw Hermes::Exceptions::Exception("Amesos not installed."); + throw Hermes::Exceptions::Exception("Amesos not installed."); #endif - break; + break; } case Hermes::SOLVER_AZTECOO: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); #if defined HAVE_AZTECOO && defined HAVE_EPETRA - return new EpetraMatrix >; + return new EpetraMatrix < std::complex > ; #else - throw Hermes::Exceptions::Exception("AztecOO not installed."); + throw Hermes::Exceptions::Exception("AztecOO not installed."); #endif - break; + break; } case Hermes::SOLVER_MUMPS: { #ifdef WITH_MUMPS - return new MumpsMatrix >; + return new MumpsMatrix < std::complex > ; #else - throw Hermes::Exceptions::Exception("MUMPS not installed."); + throw Hermes::Exceptions::Exception("MUMPS not installed."); #endif - break; + break; } case Hermes::SOLVER_PETSC: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); #ifdef WITH_PETSC - return new PetscMatrix >; + return new PetscMatrix < std::complex > ; #else - throw Hermes::Exceptions::Exception("PETSc not installed."); + throw Hermes::Exceptions::Exception("PETSc not installed."); #endif - break; + break; } case Hermes::SOLVER_UMFPACK: { #ifdef WITH_UMFPACK - return new CSCMatrix >; + return new CSCMatrix < std::complex > ; #else - throw Hermes::Exceptions::Exception("UMFPACK was not installed."); + throw Hermes::Exceptions::Exception("UMFPACK was not installed."); #endif - break; + break; } case Hermes::SOLVER_PARALUTION_ITERATIVE: case Hermes::SOLVER_PARALUTION_AMG: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); #ifdef WITH_PARALUTION - throw Hermes::Exceptions::Exception("PARALUTION works only for real problems."); + throw Hermes::Exceptions::Exception("PARALUTION works only for real problems."); #else - throw Hermes::Exceptions::Exception("PARALUTION was not installed."); + throw Hermes::Exceptions::Exception("PARALUTION was not installed."); #endif - break; + break; } case Hermes::SOLVER_SUPERLU: { #ifdef WITH_SUPERLU - return new CSCMatrix >; + return new CSCMatrix < std::complex > ; #else - throw Hermes::Exceptions::Exception("SuperLU was not installed."); + throw Hermes::Exceptions::Exception("SuperLU was not installed."); #endif - break; + break; } default: throw Hermes::Exceptions::Exception("Unknown matrix solver requested in create_matrix()."); @@ -468,11 +465,10 @@ namespace Hermes return nullptr; } + template class Matrix < double > ; + template class Matrix < std::complex > ; - template class Matrix; - template class Matrix >; - - template class SparseMatrix; - template class SparseMatrix >; + template class SparseMatrix < double > ; + template class SparseMatrix < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes_common/src/algebra/vector.cpp b/hermes_common/src/algebra/vector.cpp index 0ac94c1909..0586959b15 100644 --- a/hermes_common/src/algebra/vector.cpp +++ b/hermes_common/src/algebra/vector.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -103,6 +103,23 @@ namespace Hermes return this; } + template + Vector* Vector::subtract_vector(Hermes::Algebra::Vector* vec) + { + assert(this->get_size() == vec->get_size()); + for (unsigned int i = 0; i < this->get_size(); i++) + this->add(i, -vec->get(i)); + return this; + } + + template + Vector* Vector::subtract_vector(Scalar* vec) + { + for (unsigned int i = 0; i < this->get_size(); i++) + this->add(i, -vec[i]); + return this; + } + template void SimpleVector::export_to_file(const char *filename, const char *var_name, MatrixExportFormat fmt, char* number_format) { @@ -113,127 +130,128 @@ namespace Hermes { case EXPORT_FORMAT_MATRIX_MARKET: { - FILE* file = fopen(filename, "w"); - if (!file) - throw Exceptions::IOException(Exceptions::IOException::Write, filename); - if (Hermes::Helpers::TypeIsReal::value) - fprintf(file, "%%%%MatrixMarket matrix coordinate real general\n"); - else - fprintf(file, "%%%%MatrixMarket matrix coordinate complex general\n"); - - fprintf(file, "%d 1 %d\n", this->size, this->size); - - for (unsigned int j = 0; j < this->size; j++) - { - Hermes::Helpers::fprint_coordinate_num(file, j + 1, 1, v[j], number_format); - fprintf(file, "\n"); - } - - fclose(file); + FILE* file = fopen(filename, "w"); + if (!file) + throw Exceptions::IOException(Exceptions::IOException::Write, filename); + if (Hermes::Helpers::TypeIsReal::value) + fprintf(file, "%%%%MatrixMarket matrix coordinate real general\n"); + else + fprintf(file, "%%%%MatrixMarket matrix coordinate complex general\n"); + + fprintf(file, "%d 1 %d\n", this->size, this->size); + + for (unsigned int j = 0; j < this->size; j++) + { + Hermes::Helpers::fprint_coordinate_num(file, j + 1, 1, v[j], number_format); + fprintf(file, "\n"); + } + + fclose(file); } break; case EXPORT_FORMAT_MATLAB_MATIO: { #ifdef WITH_MATIO - size_t dims[2]; - dims[0] = this->size; - dims[1] = 1; - - mat_t *mat = Mat_CreateVer(filename, "", MAT_FT_MAT5); - matvar_t *matvar; - - // For complex. - double* v_re = nullptr; - double* v_im = nullptr; - - void* data; - if (Hermes::Helpers::TypeIsReal::value) - { - data = v; - matvar = Mat_VarCreate(var_name, MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, data, MAT_F_DONT_COPY_DATA); - } - else - { - v_re = malloc_with_check, double>(this->size, this); - v_im = malloc_with_check, double>(this->size, this); - struct mat_complex_split_t z = { v_re, v_im }; - - for (int i = 0; i < this->size; i++) - { - v_re[i] = ((std::complex)(this->v[i])).real(); - v_im[i] = ((std::complex)(this->v[i])).imag(); - data = &z; - } - matvar = Mat_VarCreate(var_name, MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, data, MAT_F_DONT_COPY_DATA | MAT_F_COMPLEX); - } - - if (matvar) - { - Mat_VarWrite(mat, matvar, MAT_COMPRESSION_ZLIB); - Mat_VarFree(matvar); - } - - free_with_check(v_re); - free_with_check(v_im); - Mat_Close(mat); - - if (!matvar) - throw Exceptions::IOException(Exceptions::IOException::Write, filename); + size_t dims[2]; + dims[0] = this->size; + dims[1] = 1; + + mat_t *mat = Mat_CreateVer(filename, "", MAT_FT_MAT5); + matvar_t *matvar; + + // For complex. + double* v_re = nullptr; + double* v_im = nullptr; + + void* data; + if (Hermes::Helpers::TypeIsReal::value) + { + data = v; + matvar = Mat_VarCreate(var_name, MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, data, MAT_F_DONT_COPY_DATA); + } + else + { + v_re = malloc_with_check, double>(this->size, this); + v_im = malloc_with_check, double>(this->size, this); + struct mat_complex_split_t z = { v_re, v_im }; + + for (int i = 0; i < this->size; i++) + { + v_re[i] = ((std::complex)(this->v[i])).real(); + v_im[i] = ((std::complex)(this->v[i])).imag(); + data = &z; + } + matvar = Mat_VarCreate(var_name, MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, data, MAT_F_DONT_COPY_DATA | MAT_F_COMPLEX); + } + + if (matvar) + { + Mat_VarWrite(mat, matvar, MAT_COMPRESSION_ZLIB); + Mat_VarFree(matvar); + } + + free_with_check(v_re); + free_with_check(v_im); + Mat_Close(mat); + + if (!matvar) + throw Exceptions::IOException(Exceptions::IOException::Write, filename); #else - throw Exceptions::Exception("MATIO not included."); + throw Exceptions::Exception("MATIO not included."); #endif } break; case EXPORT_FORMAT_PLAIN_ASCII: + case EXPORT_FORMAT_MATLAB_SIMPLE: { - FILE* file = fopen(filename, "w"); - if (!file) - throw Exceptions::IOException(Exceptions::IOException::Write, filename); - for (unsigned int i = 0; i < this->size; i++) - { - Hermes::Helpers::fprint_num(file, v[i], number_format); - fprintf(file, "\n"); - } - fclose(file); + FILE* file = fopen(filename, "w"); + if (!file) + throw Exceptions::IOException(Exceptions::IOException::Write, filename); + for (unsigned int i = 0; i < this->size; i++) + { + Hermes::Helpers::fprint_num(file, v[i], number_format); + fprintf(file, "\n"); + } + fclose(file); } break; #ifdef WITH_BSON case EXPORT_FORMAT_BSON: { - // Init bson - bson bw; - bson_init(&bw); - - // Matrix size. - bson_append_int(&bw, "size", this->size); - - bson_append_start_array(&bw, "v"); - for (unsigned int i = 0; i < this->size; i++) - bson_append_double(&bw, "v_i", real(this->v[i])); - bson_append_finish_array(&bw); - - if (!Hermes::Helpers::TypeIsReal::value) - { - bson_append_start_array(&bw, "v-imag"); - for (unsigned int i = 0; i < this->size; i++) - bson_append_double(&bw, "v_i", imag(this->v[i])); - bson_append_finish_array(&bw); - } - - // Done. - bson_finish(&bw); - - // Write to disk. - FILE *fpw; - fpw = fopen(filename, "wb"); - const char *dataw = (const char *)bson_data(&bw); - fwrite(dataw, bson_size(&bw), 1, fpw); - fclose(fpw); - - bson_destroy(&bw); + // Init bson + bson bw; + bson_init(&bw); + + // Matrix size. + bson_append_int(&bw, "size", this->size); + + bson_append_start_array(&bw, "v"); + for (unsigned int i = 0; i < this->size; i++) + bson_append_double(&bw, "v_i", real(this->v[i])); + bson_append_finish_array(&bw); + + if (!Hermes::Helpers::TypeIsReal::value) + { + bson_append_start_array(&bw, "v-imag"); + for (unsigned int i = 0; i < this->size; i++) + bson_append_double(&bw, "v_i", imag(this->v[i])); + bson_append_finish_array(&bw); + } + + // Done. + bson_finish(&bw); + + // Write to disk. + FILE *fpw; + fpw = fopen(filename, "wb"); + const char *dataw = (const char *)bson_data(&bw); + fwrite(dataw, bson_size(&bw), 1, fpw); + fclose(fpw); + + bson_destroy(&bw); } #endif } @@ -246,22 +264,22 @@ namespace Hermes { case EXPORT_FORMAT_PLAIN_ASCII: { - std::vector data; - std::ifstream input(filename); - if (input.bad()) - throw Exceptions::IOException(Exceptions::IOException::Read, filename); - std::string lineData; - - while (getline(input, lineData)) - { - Scalar d; - std::stringstream lineStream(lineData); - lineStream >> d; - data.push_back(d); - } - - this->alloc(data.size()); - memcpy(this->v, &data[0], sizeof(Scalar)*data.size()); + std::vector data; + std::ifstream input(filename); + if (input.bad()) + throw Exceptions::IOException(Exceptions::IOException::Read, filename); + std::string lineData; + + while (getline(input, lineData)) + { + Scalar d; + std::stringstream lineStream(lineData); + lineStream >> d; + data.push_back(d); + } + + this->alloc(data.size()); + memcpy(this->v, &data[0], sizeof(Scalar)*data.size()); } break; case EXPORT_FORMAT_MATLAB_MATIO: @@ -308,54 +326,53 @@ namespace Hermes #ifdef WITH_BSON case EXPORT_FORMAT_BSON: { - FILE *fpr; - fpr = fopen(filename, "rb"); - - // file size: - fseek(fpr, 0, SEEK_END); - int size = ftell(fpr); - rewind(fpr); - - // allocate memory to contain the whole file: - char *datar = malloc_with_check(size); - fread(datar, size, 1, fpr); - fclose(fpr); - - bson br; - bson_init_finished_data(&br, datar, 0); - - bson_iterator it; - bson sub; - bson_find(&it, &br, "size"); - this->size = bson_iterator_int(&it); - - this->v = malloc_with_check, Scalar>(this->size, this); - - bson_iterator it_coeffs; - bson_find(&it_coeffs, &br, "v"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - int index_coeff = 0; - while (bson_iterator_next(&it)) - this->v[index_coeff++] = bson_iterator_double(&it); - - if (!Hermes::Helpers::TypeIsReal::value) - { - bson_find(&it_coeffs, &br, "v-imag"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - index_coeff = 0; - while (bson_iterator_next(&it)) - ((std::complex)this->v[index_coeff++]).imag(bson_iterator_double(&it)); - } - - bson_destroy(&br); - free_with_check(datar); + FILE *fpr; + fpr = fopen(filename, "rb"); + + // file size: + fseek(fpr, 0, SEEK_END); + int size = ftell(fpr); + rewind(fpr); + + // allocate memory to contain the whole file: + char *datar = malloc_with_check(size); + fread(datar, size, 1, fpr); + fclose(fpr); + + bson br; + bson_init_finished_data(&br, datar, 0); + + bson_iterator it; + bson sub; + bson_find(&it, &br, "size"); + this->size = bson_iterator_int(&it); + + this->v = malloc_with_check, Scalar>(this->size, this); + + bson_iterator it_coeffs; + bson_find(&it_coeffs, &br, "v"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + int index_coeff = 0; + while (bson_iterator_next(&it)) + this->v[index_coeff++] = bson_iterator_double(&it); + + if (!Hermes::Helpers::TypeIsReal::value) + { + bson_find(&it_coeffs, &br, "v-imag"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + index_coeff = 0; + while (bson_iterator_next(&it)) + ((std::complex)this->v[index_coeff++]).imag(bson_iterator_double(&it)); + } + + bson_destroy(&br); + free_with_check(datar); } break; #endif } - } template @@ -431,12 +448,14 @@ namespace Hermes { this->v[idx] = y; } - template<> void SimpleVector::add(unsigned int idx, double y) { + if(y != 0.0) + { #pragma omp atomic - this->v[idx] += y; + this->v[idx] += y; + } } template<> @@ -459,6 +478,14 @@ namespace Hermes return this->v[idx]; } + template + Vector* SimpleVector::duplicate() const + { + SimpleVector* new_vector = new SimpleVector(this->size); + new_vector->set_vector(this->v); + return new_vector; + } + template void SimpleVector::extract(Scalar *v) const { @@ -466,20 +493,36 @@ namespace Hermes } template - Vector* SimpleVector::add_vector(Vector* vec) + Vector* SimpleVector::subtract_vector(Vector* vec) { assert(this->get_size() == vec->get_size()); - for (unsigned int i = 0; i < this->get_size(); i++) - this->add(i, vec->get(i)); + for (unsigned int i = 0; i < this->size; i++) + this->v[i] -= vec->get(i); return this; + } + template + Vector* SimpleVector::subtract_vector(Scalar* vec) + { + for (unsigned int i = 0; i < this->size; i++) + this->v[i] -= vec[i]; + return this; + } + + template + Vector* SimpleVector::add_vector(Vector* vec) + { + assert(this->get_size() == vec->get_size()); + for (unsigned int i = 0; i < this->size; i++) + this->v[i] += vec->get(i); + return this; } template Vector* SimpleVector::add_vector(Scalar* vec) { for (unsigned int i = 0; i < this->get_size(); i++) - this->add(i, vec[i]); + this->v[i] += vec[i]; return this; } @@ -490,77 +533,77 @@ namespace Hermes { case Hermes::SOLVER_EXTERNAL: { - return new SimpleVector; + return new SimpleVector < double > ; } case Hermes::SOLVER_AMESOS: { #if defined HAVE_AMESOS && defined HAVE_EPETRA - return new EpetraVector; + return new EpetraVector < double > ; #else - throw Hermes::Exceptions::Exception("Amesos not installed."); + throw Hermes::Exceptions::Exception("Amesos not installed."); #endif - break; + break; } case Hermes::SOLVER_AZTECOO: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); #if defined HAVE_AZTECOO && defined HAVE_EPETRA - return new EpetraVector; + return new EpetraVector < double > ; #else - throw Hermes::Exceptions::Exception("AztecOO not installed."); + throw Hermes::Exceptions::Exception("AztecOO not installed."); #endif - break; + break; } case Hermes::SOLVER_MUMPS: { #ifdef WITH_MUMPS - return new SimpleVector; + return new SimpleVector < double > ; #else - throw Hermes::Exceptions::Exception("MUMPS was not installed."); + throw Hermes::Exceptions::Exception("MUMPS was not installed."); #endif - break; + break; } case Hermes::SOLVER_PETSC: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); #ifdef WITH_PETSC - return new PetscVector; + return new PetscVector < double > ; #else - throw Hermes::Exceptions::Exception("PETSc not installed."); + throw Hermes::Exceptions::Exception("PETSc not installed."); #endif - break; + break; } case Hermes::SOLVER_UMFPACK: { #ifdef WITH_UMFPACK - return new SimpleVector; + return new SimpleVector < double > ; #else - throw Hermes::Exceptions::Exception("UMFPACK was not installed."); + throw Hermes::Exceptions::Exception("UMFPACK was not installed."); #endif - break; + break; } case Hermes::SOLVER_PARALUTION_ITERATIVE: case Hermes::SOLVER_PARALUTION_AMG: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); #ifdef WITH_PARALUTION - return new ParalutionVector; + return new ParalutionVector < double > ; #else - throw Hermes::Exceptions::Exception("PARALUTION was not installed."); + throw Hermes::Exceptions::Exception("PARALUTION was not installed."); #endif - break; + break; } case Hermes::SOLVER_SUPERLU: { #ifdef WITH_SUPERLU - return new SimpleVector; + return new SimpleVector < double > ; #else - throw Hermes::Exceptions::Exception("SuperLU was not installed."); + throw Hermes::Exceptions::Exception("SuperLU was not installed."); #endif - break; + break; } default: throw Hermes::Exceptions::Exception("Unknown matrix solver requested in create_vector()."); @@ -575,79 +618,79 @@ namespace Hermes { case Hermes::SOLVER_EXTERNAL: { - return new SimpleVector >; + return new SimpleVector < std::complex > ; } case Hermes::SOLVER_AMESOS: { #if defined HAVE_AMESOS && defined HAVE_EPETRA - return new EpetraVector >; + return new EpetraVector < std::complex > ; #else - throw Hermes::Exceptions::Exception("Amesos not installed."); + throw Hermes::Exceptions::Exception("Amesos not installed."); #endif - break; + break; } case Hermes::SOLVER_AZTECOO: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); #if defined HAVE_AZTECOO && defined HAVE_EPETRA - return new EpetraVector >; + return new EpetraVector < std::complex > ; #else - throw Hermes::Exceptions::Exception("AztecOO not installed."); + throw Hermes::Exceptions::Exception("AztecOO not installed."); #endif - break; + break; } case Hermes::SOLVER_MUMPS: { #ifdef WITH_MUMPS - return new SimpleVector >; + return new SimpleVector < std::complex > ; #else - throw Hermes::Exceptions::Exception("MUMPS was not installed."); + throw Hermes::Exceptions::Exception("MUMPS was not installed."); #endif - break; + break; } case Hermes::SOLVER_PETSC: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); #ifdef WITH_PETSC - return new PetscVector >; + return new PetscVector < std::complex > ; #else - throw Hermes::Exceptions::Exception("PETSc not installed."); + throw Hermes::Exceptions::Exception("PETSc not installed."); #endif - break; + break; } case Hermes::SOLVER_UMFPACK: { #ifdef WITH_UMFPACK - return new SimpleVector >; + return new SimpleVector < std::complex > ; #else - throw Hermes::Exceptions::Exception("UMFPACK was not installed."); + throw Hermes::Exceptions::Exception("UMFPACK was not installed."); #endif - break; + break; } case Hermes::SOLVER_PARALUTION_ITERATIVE: case Hermes::SOLVER_PARALUTION_AMG: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); #ifdef WITH_PARALUTION - throw Hermes::Exceptions::Exception("PARALUTION works only for real problems."); + throw Hermes::Exceptions::Exception("PARALUTION works only for real problems."); #else - throw Hermes::Exceptions::Exception("PARALUTION was not installed."); + throw Hermes::Exceptions::Exception("PARALUTION was not installed."); #endif - break; + break; } case Hermes::SOLVER_SUPERLU: { #ifdef WITH_SUPERLU - return new SimpleVector >; + return new SimpleVector < std::complex > ; #else - throw Hermes::Exceptions::Exception("SuperLU was not installed."); + throw Hermes::Exceptions::Exception("SuperLU was not installed."); #endif - break; + break; } default: throw Hermes::Exceptions::Exception("Unknown matrix solver requested in create_vector()."); @@ -655,10 +698,10 @@ namespace Hermes return nullptr; } - template class Vector; - template class Vector >; + template class Vector < double > ; + template class Vector < std::complex > ; - template class SimpleVector; - template class SimpleVector >; + template class SimpleVector < double > ; + template class SimpleVector < std::complex > ; } } diff --git a/hermes_common/src/api.cpp b/hermes_common/src/api.cpp index 8865368f89..3d992510f1 100644 --- a/hermes_common/src/api.cpp +++ b/hermes_common/src/api.cpp @@ -1,7 +1,7 @@ // This file is part of Hermes2D // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -70,7 +70,7 @@ namespace Hermes #ifdef _DEBUG this->parameters.insert(std::pair(Hermes::showInternalWarnings, new Parameter(1))); #else - this->parameters.insert(std::pair (Hermes::showInternalWarnings, new Parameter(0))); + this->parameters.insert(std::pair(Hermes::showInternalWarnings, new Parameter(0))); #endif this->parameters.insert(std::pair(Hermes::useAccelerators, new Parameter(1))); this->parameters.insert(std::pair(Hermes::checkMeshesOnLoad, new Parameter(1))); @@ -106,6 +106,11 @@ namespace Hermes int Api::get_integral_param_value(HermesCommonApiParam param) { + if (this->parameters.empty()) + { + Hermes::Api temp_api; + return temp_api.get_integral_param_value(param); + } if (this->parameters.find(param) == parameters.end()) throw Hermes::Exceptions::Exception("Wrong Hermes::Api parameter name:%i", param); if (this->parameters.find(param)->second->user_set) @@ -152,4 +157,4 @@ namespace Hermes #else Hermes::Api HermesCommonApi; #endif -} +} \ No newline at end of file diff --git a/hermes_common/src/data_structures/range.cpp b/hermes_common/src/data_structures/range.cpp index 654ae72004..d108d003c7 100644 --- a/hermes_common/src/data_structures/range.cpp +++ b/hermes_common/src/data_structures/range.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -46,38 +46,38 @@ namespace Hermes bool Range::is_in_closed(const Range& range) const { - return (range.lower_bound >= lower_bound && range.upper_bound <= upper_bound); + return (this->empty() ? false : (range.lower_bound >= lower_bound && range.upper_bound <= upper_bound)); } bool Range::is_in_closed(const int& value) const { - return (value >= lower_bound && value <= upper_bound); + return (this->empty() ? false : (value >= lower_bound && value <= upper_bound)); } bool Range::is_in_open(const int& value) const { - return (value > lower_bound && value < upper_bound); + return (this->empty() ? false : (value > lower_bound && value < upper_bound)); } void Range::enlarge_to_include(const int& value) { - if(empty_range) { + if (empty_range) { lower_bound = upper_bound = value; empty_range = false; } else { - if(lower_bound > value) + if (lower_bound > value) lower_bound = value; - if(upper_bound < value) + if (upper_bound < value) upper_bound = value; } } Range Range::make_envelope(const Range& a, const Range& b) { - if(a.empty()) + if (a.empty()) return b; - else if(b.empty()) + else if (b.empty()) return a; else return Range(std::min(a.lower(), b.lower()), std::max(a.upper(), b.upper())); diff --git a/hermes_common/src/data_structures/table.cpp b/hermes_common/src/data_structures/table.cpp index 298d114026..60422876ca 100644 --- a/hermes_common/src/data_structures/table.cpp +++ b/hermes_common/src/data_structures/table.cpp @@ -759,7 +759,7 @@ namespace Hermes bool result = true; for (unsigned int i = 0; i < size; i++) { - for (unsigned int j = 0; j= i && fabs(val_ij) > Hermes::HermesSqrtEpsilon) result = false; diff --git a/hermes_common/src/exceptions.cpp b/hermes_common/src/exceptions.cpp index 8c53f7bbb4..bc4f158523 100644 --- a/hermes_common/src/exceptions.cpp +++ b/hermes_common/src/exceptions.cpp @@ -66,7 +66,6 @@ namespace Hermes return this->message.str(); } - IOException::IOException(ReadWrite readWrite, const char* filename_) : Exception(), readWrite(readWrite) { std::stringstream ss; @@ -84,8 +83,12 @@ namespace Hermes this->filename = e.filename; } + NullException::NullException() : Exception() + { + this->message << "A pointer is invalid (nullptr)"; + } - NullException::NullException(int param_idx) : Exception() + NullException::NullException(unsigned int param_idx) : Exception() { this->param_idx = param_idx; this->item_idx = -1; @@ -93,7 +96,7 @@ namespace Hermes this->message << "Parameter number " << param_idx << " is nullptr"; } - NullException::NullException(int param_idx, int item_idx) : Exception() + NullException::NullException(unsigned int param_idx, unsigned int item_idx) : Exception() { this->param_idx = param_idx; this->item_idx = item_idx; @@ -101,12 +104,12 @@ namespace Hermes this->message << "Element number " << item_idx << " of parameter number " << param_idx << " is nullptr"; } - int NullException::get_param_idx() const + unsigned int NullException::get_param_idx() const { return param_idx; } - int NullException::get_item_idx() const + unsigned int NullException::get_item_idx() const { return item_idx; } @@ -119,7 +122,21 @@ namespace Hermes item_idx = e.get_item_idx(); } - LengthException::LengthException(int param_idx, int wrong, int right) : Exception() + LengthException::LengthException() : Exception() + { + this->message.clear(); + this->message << "Two instances do not have the same length and they should"; + } + + LengthException::LengthException(unsigned int wrong, unsigned int right) : Exception() + { + this->wrong = wrong; + this->right = right; + this->message.clear(); + this->message << "An instance has length " << wrong << " and should have " << right; + } + + LengthException::LengthException(unsigned int param_idx, unsigned int wrong, unsigned int right) : Exception() { fst_param_idx = param_idx; this->wrong = wrong; @@ -129,7 +146,7 @@ namespace Hermes this->message << "Parameter number " << fst_param_idx << " have length " << wrong << " and should have " << right; } - LengthException::LengthException(int fst_param_idx, int snd_param_idx, int first, int second) : Exception() + LengthException::LengthException(unsigned int fst_param_idx, unsigned int snd_param_idx, unsigned int first, unsigned int second) : Exception() { this->fst_param_idx = fst_param_idx; this->snd_param_idx = snd_param_idx; @@ -139,22 +156,22 @@ namespace Hermes this->message << "Parameter number " << fst_param_idx << " have length " << wrong << " and parameter number " << snd_param_idx << " have length " << right << " The lengths should be same."; } - int LengthException::get_first_param_idx() const + unsigned int LengthException::get_first_param_idx() const { return fst_param_idx; } - int LengthException::get_second_param_idx() const + unsigned int LengthException::get_second_param_idx() const { return snd_param_idx; } - int LengthException::get_first_length() const + unsigned int LengthException::get_first_length() const { return wrong; } - int LengthException::get_expected_length() const + unsigned int LengthException::get_expected_length() const { return right; } diff --git a/hermes_common/src/hermes_function.cpp b/hermes_common/src/hermes_function.cpp index b38dd4f7bb..f27f092709 100644 --- a/hermes_common/src/hermes_function.cpp +++ b/hermes_common/src/hermes_function.cpp @@ -51,7 +51,7 @@ namespace Hermes template<> double Hermes1DFunction::value(double x) const { - if(this->is_const) + if (this->is_const) return const_value; else { @@ -62,7 +62,7 @@ namespace Hermes template<> std::complex Hermes1DFunction >::value(std::complex x) const { - if(this->is_const) + if (this->is_const) return const_value; else { @@ -74,7 +74,7 @@ namespace Hermes template Ord Hermes1DFunction::value(Ord x) const { - if(this->is_const) + if (this->is_const) return Ord(0); else { @@ -86,7 +86,7 @@ namespace Hermes template<> double Hermes1DFunction::derivative(double x) const { - if(this->is_const) + if (this->is_const) return 0.0; else { @@ -97,7 +97,7 @@ namespace Hermes template<> std::complex Hermes1DFunction >::derivative(std::complex x) const { - if(this->is_const) + if (this->is_const) return std::complex(0.0, 0.0); else { @@ -109,7 +109,7 @@ namespace Hermes template Ord Hermes1DFunction::derivative(Ord x) const { - if(this->is_const) + if (this->is_const) return Ord(0); else { @@ -134,7 +134,7 @@ namespace Hermes template<> double Hermes2DFunction::value(double x, double y) const { - if(this->is_const) + if (this->is_const) return const_value; else { @@ -146,7 +146,7 @@ namespace Hermes template<> std::complex Hermes2DFunction >::value(std::complex x, std::complex y) const { - if(this->is_const) + if (this->is_const) return const_value; else { @@ -158,7 +158,7 @@ namespace Hermes template Ord Hermes2DFunction::value(Ord x, Ord y) const { - if(this->is_const) + if (this->is_const) return Ord(0); else { @@ -170,7 +170,7 @@ namespace Hermes template<> double Hermes2DFunction::derivative_x(double x, double y) const { - if(this->is_const) + if (this->is_const) return 0.0; else { @@ -181,7 +181,7 @@ namespace Hermes template<> std::complex Hermes2DFunction >::derivative_x(std::complex x, std::complex y) const { - if(this->is_const) + if (this->is_const) return std::complex(0.0, 0.0); else { @@ -193,7 +193,7 @@ namespace Hermes template Ord Hermes2DFunction::derivative_x(Ord x, Ord y) const { - if(this->is_const) + if (this->is_const) return Ord(0); else { @@ -205,7 +205,7 @@ namespace Hermes template<> double Hermes2DFunction::derivative_y(double x, double y) const { - if(this->is_const) + if (this->is_const) return 0.0; else { @@ -216,7 +216,7 @@ namespace Hermes template<> std::complex Hermes2DFunction >::derivative_y(std::complex x, std::complex y) const { - if(this->is_const) + if (this->is_const) return std::complex(0.0, 0.0); else { @@ -228,7 +228,7 @@ namespace Hermes template Ord Hermes2DFunction::derivative_y(Ord x, Ord y) const { - if(this->is_const) + if (this->is_const) return Ord(0); else { @@ -253,7 +253,7 @@ namespace Hermes template<> double Hermes3DFunction::value(double x, double y, double z) const { - if(this->is_const) + if (this->is_const) return 0.0; else { @@ -264,7 +264,7 @@ namespace Hermes template<> std::complex Hermes3DFunction >::value(std::complex x, std::complex y, std::complex z) const { - if(this->is_const) + if (this->is_const) return std::complex(0.0, 0.0); else { @@ -276,7 +276,7 @@ namespace Hermes template Ord Hermes3DFunction::value(Ord x, Ord y, Ord z) const { - if(this->is_const) + if (this->is_const) return Ord(0); else { @@ -288,7 +288,7 @@ namespace Hermes template<> double Hermes3DFunction::derivative_x(double x, double y, double z) const { - if(this->is_const) + if (this->is_const) return 0.0; else { @@ -299,7 +299,7 @@ namespace Hermes template<> std::complex Hermes3DFunction >::derivative_x(std::complex x, std::complex y, std::complex z) const { - if(this->is_const) + if (this->is_const) return std::complex(0.0, 0.0); else { @@ -311,7 +311,7 @@ namespace Hermes template Ord Hermes3DFunction::derivative_x(Ord x, Ord y, Ord z) const { - if(this->is_const) + if (this->is_const) return Ord(0); else { @@ -323,7 +323,7 @@ namespace Hermes template<> double Hermes3DFunction::derivative_y(double x, double y, double z) const { - if(this->is_const) + if (this->is_const) return 0.0; else { @@ -334,7 +334,7 @@ namespace Hermes template<> std::complex Hermes3DFunction >::derivative_y(std::complex x, std::complex y, std::complex z) const { - if(this->is_const) + if (this->is_const) return std::complex(0.0, 0.0); else { @@ -346,7 +346,7 @@ namespace Hermes template Ord Hermes3DFunction::derivative_y(Ord x, Ord y, Ord z) const { - if(this->is_const) + if (this->is_const) return Ord(0); else { @@ -358,7 +358,7 @@ namespace Hermes template<> double Hermes3DFunction::derivative_z(double x, double y, double z) const { - if(this->is_const) + if (this->is_const) return 0.0; else { @@ -369,7 +369,7 @@ namespace Hermes template<> std::complex Hermes3DFunction >::derivative_z(std::complex x, std::complex y, std::complex z) const { - if(this->is_const) + if (this->is_const) return std::complex(0.0, 0.0); else { @@ -381,7 +381,7 @@ namespace Hermes template Ord Hermes3DFunction::derivative_z(Ord x, Ord y, Ord z) const { - if(this->is_const) + if (this->is_const) return Ord(0); else { @@ -390,10 +390,10 @@ namespace Hermes } }; - template class HERMES_API Hermes1DFunction; - template class HERMES_API Hermes1DFunction >; - template class HERMES_API Hermes2DFunction; - template class HERMES_API Hermes2DFunction >; - template class HERMES_API Hermes3DFunction; - template class HERMES_API Hermes3DFunction >; -} + template class HERMES_API Hermes1DFunction < double > ; + template class HERMES_API Hermes1DFunction < std::complex > ; + template class HERMES_API Hermes2DFunction < double > ; + template class HERMES_API Hermes2DFunction < std::complex > ; + template class HERMES_API Hermes3DFunction < double > ; + template class HERMES_API Hermes3DFunction < std::complex > ; +} \ No newline at end of file diff --git a/hermes_common/src/mixins.cpp b/hermes_common/src/mixins.cpp index 7f1dbd4609..17f8cbe55a 100644 --- a/hermes_common/src/mixins.cpp +++ b/hermes_common/src/mixins.cpp @@ -36,9 +36,15 @@ namespace Hermes char* Loggable::staticLogFileName = nullptr; - std::map Loggable::logger_written; - - Loggable::Loggable(bool verbose_output, callbackFn verbose_callback) : verbose_output(verbose_output), verbose_callback(verbose_callback), logFileName(nullptr) + Loggable::Loggable(bool verbose_output, callbackFn verbose_callback, bool add_newline) : + verbose_output(verbose_output), + verbose_callback(verbose_callback), + logFileName(NULL), + print_timestamps(true), + erase_on_beginning(false), + file_output_only(false), + log_file_written(false), + add_newline(add_newline) { } @@ -46,7 +52,7 @@ namespace Hermes { free_with_check(this->logFileName); int strlength = std::strlen(filename); - this->logFileName = malloc_with_check(strlength); + this->logFileName = malloc_with_check(strlength + 1); strcpy(this->logFileName, filename); } @@ -59,7 +65,7 @@ namespace Hermes { free_with_check(Loggable::staticLogFileName); int strlength = std::strlen(filename); - Loggable::staticLogFileName = malloc_with_check(strlength); + Loggable::staticLogFileName = malloc_with_check(strlength + 1); strcpy(Loggable::staticLogFileName, filename); } @@ -68,6 +74,11 @@ namespace Hermes Loggable::set_static_logFile_name(filename.c_str()); } + void Loggable::set_file_output_only(bool onOff) + { + this->file_output_only = onOff; + } + bool Loggable::get_verbose_output() const { return this->verbose_output; @@ -123,7 +134,7 @@ namespace Hermes printf("\033[%dm", console_attrs + 30); //emphasize and console bold - if(console_bold) + if (console_bold) printf("\033[1m"); //print text and reset settings @@ -177,7 +188,7 @@ namespace Hermes printf("\033[%dm", console_attrs + 30); //emphasize and console bold - if(console_bold) + if (console_bold) printf("\033[1m"); //print text and reset settings @@ -231,7 +242,7 @@ namespace Hermes printf("\033[%dm", console_attrs + 30); //emphasize and console bold - if(console_bold) + if (console_bold) printf("\033[1m"); //print text and reset settings @@ -414,7 +425,7 @@ namespace Hermes //console color code int console_attrs = 0; bool console_bold = false; - switch(code) + switch (code) { case HERMES_EC_WARNING: console_attrs |= FOREGROUND_RED | FOREGROUND_GREEN; break; case HERMES_EC_INFO: console_bold = true; break; @@ -424,7 +435,7 @@ namespace Hermes printf("\033[%dm", console_attrs + 30); //emphasize and console bold - if(console_bold) + if (console_bold) printf("\033[1m"); //print text and reset settings @@ -458,14 +469,30 @@ namespace Hermes : code(code), src_function(src_function), src_file(src_file), src_line(src_line) {} + void Loggable::set_timestamps(bool onOff) + { + this->print_timestamps = onOff; + } + + void Loggable::set_erase_on_beginning(bool onOff) + { + this->erase_on_beginning = onOff; + } + void Loggable::hermes_log_message(const char code, const char* msg) const { #pragma omp critical (hermes_log_message) { //print the message - if (!write_console(code, msg)) - printf("%s", msg); //safe fallback - printf("\n"); //write a new_ line + if (!this->file_output_only) + { + if (!write_console(code, msg)) + //safe fallback + printf("%s", msg); + + //write a new line + printf("\n"); + } HermesLogEventInfo* info = this->hermes_build_log_info(code); @@ -473,28 +500,44 @@ namespace Hermes char* log_file_name = (this->logFileName ? this->logFileName : Loggable::staticLogFileName); if (log_file_name) { - FILE* file = fopen(log_file_name, "at"); - if (file != nullptr) + FILE* file; + if (this->erase_on_beginning && !this->log_file_written) + file = fopen(log_file_name, "wt"); + else + file = fopen(log_file_name, "at"); + if (file != NULL) { //check whether log file was already written - std::map::const_iterator found = logger_written.find(log_file_name); - if (found == logger_written.end()) { //first write, write delimited to a file - logger_written[log_file_name] = true; - fprintf(file, "\n"); - for (int i = 0; i < HERMES_LOG_FILE_DELIM_SIZE; i++) - fprintf(file, "-"); - fprintf(file, "\n\n"); + if (!log_file_written) + { + //first write, write delimited to a file + (const_cast(this))->log_file_written = true; + if (!this->erase_on_beginning) + { + fprintf(file, "\n"); + for (int i = 0; i < HERMES_LOG_FILE_DELIM_SIZE; i++) + fprintf(file, "-"); + fprintf(file, "\n\n"); + } } - //get time - time_t now; - time(&now); - struct tm* now_tm = gmtime(&now); - char time_buf[BUF_SZ]; - strftime(time_buf, BUF_SZ, "%y%m%d-%H:%M", now_tm); + if (print_timestamps) + { + //get time + time_t now; + time(&now); + struct tm* now_tm = gmtime(&now); + char time_buf[BUF_SZ]; + strftime(time_buf, BUF_SZ, "%y%m%d-%H:%M", now_tm); + //write + fprintf(file, "%s\t%s", time_buf, msg); + } + else + fprintf(file, "%s", msg); + + if (this->add_newline) + fprintf(file, "\n"); - //write - fprintf(file, "%s\t%s\n", time_buf, msg); fclose(file); if (this->verbose_callback != nullptr) @@ -516,8 +559,6 @@ namespace Hermes this->verbose_callback = callback; } - - TimeMeasurable::TimeMeasurable(const char *name) : period_name(name == nullptr ? "unnamed" : name) { //initialization @@ -531,6 +572,17 @@ namespace Hermes tick_reset(); } + TimeMeasurable::TimeMeasurable(const TimeMeasurable& other) + { +#ifdef _WINDOWS //Windows + this->frequency = other.frequency; +#endif + this->period_name = other.period_name; + this->last_period = other.last_period; + this->last_time = other.last_time; + this->accum = other.accum; + } + TimeMeasurable::SysTime TimeMeasurable::get_time() const { #ifdef _WINDOWS //Windows @@ -566,7 +618,7 @@ namespace Hermes #else //Linux int sec_corr = 0; long period_nsec = end.tv_nsec - begin.tv_nsec; - if(period_nsec < 0) + if (period_nsec < 0) { sec_corr += -1; period_nsec += 1000000000UL; @@ -725,22 +777,22 @@ namespace Hermes template HERMES_API const unsigned int& OutputAttachable::get_parameter_value(const Parameter& parameter); template HERMES_API const double& OutputAttachable::get_parameter_value(const Parameter& parameter); template HERMES_API const bool& OutputAttachable::get_parameter_value(const Parameter& parameter); - template HERMES_API const Hermes::vector& OutputAttachable::get_parameter_value >(const Parameter >& parameter); - template HERMES_API const Hermes::vector& OutputAttachable::get_parameter_value >(const Parameter >& parameter); - template HERMES_API const Hermes::vector& OutputAttachable::get_parameter_value >(const Parameter >& parameter); + template HERMES_API const std::vector& OutputAttachable::get_parameter_value >(const Parameter >& parameter); + template HERMES_API const std::vector& OutputAttachable::get_parameter_value >(const Parameter >& parameter); + template HERMES_API const std::vector& OutputAttachable::get_parameter_value >(const Parameter >& parameter); template HERMES_API unsigned int& OutputAttachable::get_parameter_value(Parameter& parameter); template HERMES_API double& OutputAttachable::get_parameter_value(Parameter& parameter); template HERMES_API bool& OutputAttachable::get_parameter_value(Parameter& parameter); - template HERMES_API Hermes::vector& OutputAttachable::get_parameter_value >(Parameter >& parameter); - template HERMES_API Hermes::vector& OutputAttachable::get_parameter_value >(Parameter >& parameter); - template HERMES_API Hermes::vector& OutputAttachable::get_parameter_value >(Parameter >& parameter); + template HERMES_API std::vector& OutputAttachable::get_parameter_value >(Parameter >& parameter); + template HERMES_API std::vector& OutputAttachable::get_parameter_value >(Parameter >& parameter); + template HERMES_API std::vector& OutputAttachable::get_parameter_value >(Parameter >& parameter); template HERMES_API void OutputAttachable::set_parameter_value(Parameter& parameter, unsigned int* value); template HERMES_API void OutputAttachable::set_parameter_value(Parameter& parameter, double* value); template HERMES_API void OutputAttachable::set_parameter_value(Parameter& parameter, bool* value); - template HERMES_API void OutputAttachable::set_parameter_value >(Parameter >& parameter, Hermes::vector* value); - template HERMES_API void OutputAttachable::set_parameter_value >(Parameter >& parameter, Hermes::vector* value); - template HERMES_API void OutputAttachable::set_parameter_value >(Parameter >& parameter, Hermes::vector* value); + template HERMES_API void OutputAttachable::set_parameter_value >(Parameter >& parameter, std::vector* value); + template HERMES_API void OutputAttachable::set_parameter_value >(Parameter >& parameter, std::vector* value); + template HERMES_API void OutputAttachable::set_parameter_value >(Parameter >& parameter, std::vector* value); } -} +} \ No newline at end of file diff --git a/hermes_common/src/ord.cpp b/hermes_common/src/ord.cpp index 98e0b747b8..797db919bd 100644 --- a/hermes_common/src/ord.cpp +++ b/hermes_common/src/ord.cpp @@ -20,13 +20,13 @@ namespace Hermes { - Ord::Ord(): order(0) {} - Ord::Ord(int o): order(o) {} - Ord::Ord(double o): order(0) {} + Ord::Ord() : order(0) {} + Ord::Ord(int o) : order(o) {} + Ord::Ord(double o) : order(0) {} int Ord::get_order() const { return order; } - Ord Ord::get_max_order() {return Ord(30);} + Ord Ord::get_max_order() { return Ord(30); } Ord Ord::operator+ (const Ord &o) { return Ord(std::max(this->order, o.order)); } Ord Ord::operator+ (double d) { return *this; } @@ -70,7 +70,7 @@ namespace Hermes Ord operator-(const std::complex &a, const Ord &b) { return b; } Ord operator-(const Ord &a) { return a; } - Ord pow(const Ord &a, const double &b) { return Ord((int) ceil(fabs(b)) * a.get_order()); } + Ord pow(const Ord &a, const double &b) { return Ord((int)ceil(fabs(b)) * a.get_order()); } Ord sqrt(const Ord &a) { return a; } Ord sqr(const Ord &a) { return Ord(2 * a.get_order()); } Ord conj(const Ord &a) { return a; } diff --git a/hermes_common/src/solvers/interfaces/amesos_solver.cpp b/hermes_common/src/solvers/interfaces/amesos_solver.cpp index fdd17bdac1..1c0fa00e3c 100644 --- a/hermes_common/src/solvers/interfaces/amesos_solver.cpp +++ b/hermes_common/src/solvers/interfaces/amesos_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -43,10 +43,20 @@ namespace Hermes // return new_ Amesos_Klu(LinearProblem); ) } + template + void AmesosSolver::free() + { + if (solver) + { + delete solver; + solver = nullptr; + } + } + template AmesosSolver::~AmesosSolver() { - delete solver; + this->free(); } template @@ -86,18 +96,18 @@ namespace Hermes Epetra_Vector x(*rhs->std_map); problem.SetLHS(&x); - if(!setup_factorization()) + if (!setup_factorization()) this->warn("AmesosSolver: LU factorization could not be completed"); int status = solver->Solve(); - if(status != 0) + if (status != 0) throw Hermes::Exceptions::Exception("AmesosSolver: Solution failed."); this->tick(); this->time = this->accumulated(); free_with_check(this->sln); - this->sln = malloc_with_check(m->size, this); + this->sln = malloc_with_check, double>(m->size, this); // copy the solution into sln vector memset(this->sln, 0, m->size * sizeof(double)); @@ -115,18 +125,18 @@ namespace Hermes throw Hermes::Exceptions::Exception("AmesosSolver::solve() not yet implemented for complex problems"); - if(!setup_factorization()) + if (!setup_factorization()) this->warn("AmesosSolver: LU factorization could not be completed"); int status = solver->Solve(); - if(status != 0) + if (status != 0) throw Hermes::Exceptions::Exception("AmesosSolver: Solution failed."); this->tick(); this->time = this->accumulated(); free_with_check(this->sln); - this->sln = malloc_with_check(m->size, this); + this->sln = malloc_with_check >, std::complex>(m->size, this); // copy the solution into sln vector memset(this->sln, 0, m->size * sizeof(std::complex)); } @@ -136,19 +146,19 @@ namespace Hermes { // Perform both factorization phases for the first time. int eff_fact_scheme; - if(this->reuse_scheme != HERMES_CREATE_STRUCTURE_FROM_SCRATCH && + if (this->reuse_scheme != HERMES_CREATE_STRUCTURE_FROM_SCRATCH && solver->NumSymbolicFact() == 0 && solver->NumNumericFact() == 0) eff_fact_scheme = HERMES_CREATE_STRUCTURE_FROM_SCRATCH; else eff_fact_scheme = this->reuse_scheme; int status; - switch(eff_fact_scheme) + switch (eff_fact_scheme) { case HERMES_CREATE_STRUCTURE_FROM_SCRATCH: //debug_log("Factorizing symbolically."); status = solver->SymbolicFactorization(); - if(status != 0) + if (status != 0) { this->warn("Symbolic factorization failed."); return false; @@ -157,7 +167,7 @@ namespace Hermes case HERMES_REUSE_MATRIX_REORDERING: case HERMES_REUSE_MATRIX_REORDERING_AND_SCALING: status = solver->NumericFactorization(); - if(status != 0) + if (status != 0) { this->warn("Numeric factorization failed."); return false; @@ -167,8 +177,8 @@ namespace Hermes return true; } - template class HERMES_API AmesosSolver; - template class HERMES_API AmesosSolver >; + template class HERMES_API AmesosSolver < double > ; + template class HERMES_API AmesosSolver < std::complex > ; } } #endif \ No newline at end of file diff --git a/hermes_common/src/solvers/interfaces/aztecoo_solver.cpp b/hermes_common/src/solvers/interfaces/aztecoo_solver.cpp index 7618a0c82f..11a5771653 100644 --- a/hermes_common/src/solvers/interfaces/aztecoo_solver.cpp +++ b/hermes_common/src/solvers/interfaces/aztecoo_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -23,7 +23,9 @@ #ifdef HAVE_AZTECOO #include "aztecoo_solver.h" #include "callstack.h" +#ifdef HAVE_KOMPLEX #include "Komplex_LinearProblem.h" +#endif namespace Hermes { @@ -32,14 +34,20 @@ namespace Hermes template AztecOOSolver::AztecOOSolver(EpetraMatrix *m, EpetraVector *rhs) : IterSolver(m, rhs), LoopSolver(m, rhs), m(m), rhs(rhs), final_matrix(nullptr), P(nullptr), Q(nullptr), row_perm(nullptr), col_perm(nullptr) - { + { pc = nullptr; } + template + void AztecOOSolver::free() + { + this->free_permutation_data(); + } + template AztecOOSolver::~AztecOOSolver() { - free_permutation_data(); + this->free(); } template @@ -63,13 +71,13 @@ namespace Hermes void AztecOOSolver::set_solver(const char *name) { int az_solver; - if(name) + if (name) { - if(strcasecmp(name, "gmres") == 0) az_solver = AZ_gmres; - else if(strcasecmp(name, "cg") == 0) az_solver = AZ_cg; - else if(strcasecmp(name, "cgs") == 0) az_solver = AZ_cgs; - else if(strcasecmp(name, "tfqmr") == 0) az_solver = AZ_tfqmr; - else if(strcasecmp(name, "bicgstab") == 0) az_solver = AZ_bicgstab; + if (strcasecmp(name, "gmres") == 0) az_solver = AZ_gmres; + else if (strcasecmp(name, "cg") == 0) az_solver = AZ_cg; + else if (strcasecmp(name, "cgs") == 0) az_solver = AZ_cgs; + else if (strcasecmp(name, "tfqmr") == 0) az_solver = AZ_tfqmr; + else if (strcasecmp(name, "bicgstab") == 0) az_solver = AZ_bicgstab; else az_solver = AZ_gmres; } else @@ -105,21 +113,22 @@ namespace Hermes void AztecOOSolver::set_precond(const char *name) { int az_precond; - if(name) + if (name) { - if(strcasecmp(name, "none") == 0) + if (strcasecmp(name, "none") == 0) az_precond = AZ_none; - else if(strcasecmp(name, "jacobi") == 0) + else if (strcasecmp(name, "jacobi") == 0) az_precond = AZ_Jacobi; - else if(strcasecmp(name, "neumann") == 0) + else if (strcasecmp(name, "neumann") == 0) az_precond = AZ_Neumann; - else if(strcasecmp(name, "least-squares") == 0) + else if (strcasecmp(name, "least-squares") == 0) az_precond = AZ_ls; else az_precond = AZ_none; } else - az_precond = AZ_none; //asi by to melo byt nastaveno + //asi by to melo byt nastaveno + az_precond = AZ_none; this->precond_yes = (az_precond != AZ_none); aztec.SetAztecOption(AZ_precond, az_precond); @@ -146,7 +155,7 @@ namespace Hermes aztec.SetAztecOption(AZ_pre_calc, AZ_reuse); else if (reuse_scheme == HERMES_REUSE_MATRIX_REORDERING) aztec.SetAztecOption(AZ_pre_calc, AZ_recalc); - else + else aztec.SetAztecOption(AZ_pre_calc, AZ_calc); */ } @@ -158,15 +167,15 @@ namespace Hermes } template - void AztecOOSolver::use_node_wise_ordering(unsigned int num_pdes) - { + void AztecOOSolver::use_node_wise_ordering(unsigned int num_pdes) + { LinearMatrixSolver::use_node_wise_ordering(num_pdes); this->free_permutation_data(); } template - void AztecOOSolver::use_equations_wise_ordering() - { + void AztecOOSolver::use_equations_wise_ordering() + { LinearMatrixSolver::use_equations_wise_ordering(); this->free_permutation_data(); } @@ -175,12 +184,12 @@ namespace Hermes void AztecOOSolver::create_permutation_vectors() { int ndof = m->size; - int ndof_per_pde = ndof/this->n_eq; + int ndof_per_pde = ndof / this->n_eq; int j = 0, jc = 0; int k = 0, kc = 0; - this->row_perm = malloc_with_check(ndof, this); - this->col_perm = malloc_with_check(ndof, this); + this->row_perm = malloc_with_check, int>(ndof, this); + this->col_perm = malloc_with_check, int>(ndof, this); for (int i = 0; i < ndof; i++) { @@ -211,7 +220,8 @@ namespace Hermes assert(m->size == rhs->size); // no output - aztec.SetAztecOption(AZ_output, AZ_summary); // AZ_all | AZ_warnings | AZ_last | AZ_summary + // AZ_all | AZ_warnings | AZ_last | AZ_summary + aztec.SetAztecOption(AZ_output, AZ_summary); // setup the problem if (reuse_scheme == HERMES_CREATE_STRUCTURE_FROM_SCRATCH) @@ -226,16 +236,16 @@ namespace Hermes // NOTE: RowMap() == RangeMap() == ColMap() == DomainMap() P = new EpetraExt::Permutation(Copy, m->mat->RowMap(), row_perm); - Q = new EpetraExt::Permutation(Copy, m->mat->ColMap(), col_perm); + Q = new EpetraExt::Permutation(Copy, m->mat->ColMap(), col_perm); - final_matrix = new EpetraMatrix((*P)((*Q)(*m->mat,true))); + final_matrix = new EpetraMatrix((*P)((*Q)(*m->mat, true))); - // NOTE: According to Trilinos docs, final_matrix should be fill_completed by now. However, when row permutation is performed, + // NOTE: According to Trilinos docs, final_matrix should be fill_completed by now. However, when row permutation is performed, // the input matrix is not finalized (unlike the case of column permutation) - this may possibly be a bug in Trilinos. // Also, when doing a row permutation, all maps of the source matrix are set to a temporary permutation // map in order to export the values from the source matrix to the target matrix in a permuted way. Then, // according to code documentation in EpetraExt_Permutation_impl.h, the row indexing for the new_ permuted - // matrix (specified by the target matrix' RowMap_) is set to the original indexing (the original matrix' + // matrix (specified by the target matrix' RowMap_) is set to the original indexing (the original matrix' // RowMap_). However, the other maps of the new_ matrix are not reset (and still point to the temporary // permutation map), which causes another set of problems. Hence, replaceMap() implementation in EpetraExt_Permutation_impl.h // has to be changed to call FillComplete with correct maps as input (calling FillComplete here doesn't suffice, since it @@ -248,10 +258,12 @@ namespace Hermes aztec.SetUserMatrix(final_matrix->mat); } - EpetraExt::Permutation Pv(Copy, rhs->vec->Map(), row_perm); - Epetra_Vector *final_rhs; + Epetra_Vector *final_rhs; if (row_perm) + { + EpetraExt::Permutation Pv(Copy, rhs->vec->Map(), row_perm); final_rhs = Pv(*rhs->vec)(0); + } else final_rhs = rhs->vec; @@ -260,12 +272,12 @@ namespace Hermes Epetra_Vector x(final_matrix->mat->DomainMap()); aztec.SetLHS(&x); - if(pc != nullptr) + if (pc != nullptr) { - if(reuse_scheme == HERMES_CREATE_STRUCTURE_FROM_SCRATCH) + if (reuse_scheme == HERMES_CREATE_STRUCTURE_FROM_SCRATCH) //if(aztec.GetAztecOption(AZ_pre_calc) == AZ_calc) { - pc->create(final_matrix); + pc->create(final_matrix); pc->compute(); aztec.SetPrecOperator(pc->get_obj()); } @@ -280,7 +292,7 @@ namespace Hermes #ifdef HAVE_ML ML_Epetra::MultiLevelPreconditioner* op_ml = dynamic_cast(pc->get_obj()); assert(op_ml->IsPreconditionerComputed()); -#endif +#endif } } @@ -291,17 +303,17 @@ namespace Hermes this->time = this->accumulated(); free_with_check(this->sln); - this->sln = malloc_with_check(final_matrix->size, this); + this->sln = malloc_with_check, double>(final_matrix->size, this); + memset(this->sln, 0, final_matrix->size * sizeof(double)); // copy the solution into sln vector if (col_perm) for (unsigned int i = 0; i < final_matrix->size; i++) this->sln[i] = x[col_perm[i]]; else - for (unsigned int i = 0; i < final_matrix->size; i++) this->sln[i] = x[i]; + for (unsigned int i = 0; i < final_matrix->size; i++) this->sln[i] = x[i]; } - template<> void AztecOOSolver::solve(double *initial_guess) { @@ -310,7 +322,8 @@ namespace Hermes assert(m->size == rhs->size); // no output - aztec.SetAztecOption(AZ_output, AZ_summary); // AZ_all | AZ_warnings | AZ_last | AZ_summary + // AZ_all | AZ_warnings | AZ_last | AZ_summary + aztec.SetAztecOption(AZ_output, AZ_summary); if (this->get_verbose_output()) aztec.SetAztecOption(AZ_output, AZ_all); @@ -328,16 +341,16 @@ namespace Hermes // NOTE: RowMap() == RangeMap() == ColMap() == DomainMap() P = new EpetraExt::Permutation(Copy, m->mat->RowMap(), row_perm); - Q = new EpetraExt::Permutation(Copy, m->mat->ColMap(), col_perm); + Q = new EpetraExt::Permutation(Copy, m->mat->ColMap(), col_perm); - final_matrix = new EpetraMatrix((*P)((*Q)(*m->mat,true))); + final_matrix = new EpetraMatrix((*P)((*Q)(*m->mat, true))); - // NOTE: According to Trilinos docs, final_matrix should be fill_completed by now. However, when row permutation is performed, + // NOTE: According to Trilinos docs, final_matrix should be fill_completed by now. However, when row permutation is performed, // the input matrix is not finalized (unlike the case of column permutation) - this may possibly be a bug in Trilinos. // Also, when doing a row permutation, all maps of the source matrix are set to a temporary permutation // map in order to export the values from the source matrix to the target matrix in a permuted way. Then, // according to code documentation in EpetraExt_Permutation_impl.h, the row indexing for the new_ permuted - // matrix (specified by the target matrix' RowMap_) is set to the original indexing (the original matrix' + // matrix (specified by the target matrix' RowMap_) is set to the original indexing (the original matrix' // RowMap_). However, the other maps of the new_ matrix are not reset (and still point to the temporary // permutation map), which causes another set of problems. Hence, replaceMap() implementation in EpetraExt_Permutation_impl.h // has to be changed to call FillComplete with correct maps as input (calling FillComplete here doesn't suffice, since it @@ -350,10 +363,12 @@ namespace Hermes aztec.SetUserMatrix(final_matrix->mat); } - EpetraExt::Permutation Pv(Copy, rhs->vec->Map(), row_perm); - Epetra_Vector *final_rhs; + Epetra_Vector *final_rhs; if (row_perm) + { + EpetraExt::Permutation Pv(Copy, rhs->vec->Map(), row_perm); final_rhs = Pv(*rhs->vec)(0); + } else final_rhs = rhs->vec; @@ -373,12 +388,12 @@ namespace Hermes aztec.SetLHS(&x); - if(pc != nullptr) + if (pc != nullptr) { - if(reuse_scheme == HERMES_CREATE_STRUCTURE_FROM_SCRATCH) + if (reuse_scheme == HERMES_CREATE_STRUCTURE_FROM_SCRATCH) //if(aztec.GetAztecOption(AZ_pre_calc) == AZ_calc) { - pc->create(final_matrix); + pc->create(final_matrix); pc->compute(); aztec.SetPrecOperator(pc->get_obj()); } @@ -393,7 +408,7 @@ namespace Hermes #ifdef HAVE_ML ML_Epetra::MultiLevelPreconditioner* op_ml = dynamic_cast(pc->get_obj()); assert(op_ml->IsPreconditionerComputed()); -#endif +#endif } } @@ -404,25 +419,26 @@ namespace Hermes this->time = this->accumulated(); free_with_check(this->sln); - this->sln = malloc_with_check(final_matrix->size, this); + this->sln = malloc_with_check, double>(final_matrix->size, this); memset(this->sln, 0, final_matrix->size * sizeof(double)); // copy the solution into sln vector if (col_perm) for (unsigned int i = 0; i < final_matrix->size; i++) this->sln[i] = x[col_perm[i]]; else - for (unsigned int i = 0; i < final_matrix->size; i++) this->sln[i] = x[i]; + for (unsigned int i = 0; i < final_matrix->size; i++) this->sln[i] = x[i]; } - template<> void AztecOOSolver >::solve() { +#ifdef HAVE_KOMPLEX assert(m != nullptr); assert(rhs != nullptr); assert(m->size == rhs->size); // no output - aztec.SetAztecOption(AZ_output, AZ_none); // AZ_all | AZ_warnings | AZ_last | AZ_summary + // AZ_all | AZ_warnings | AZ_last | AZ_summary + aztec.SetAztecOption(AZ_output, AZ_none); double c0r = 1.0, c0i = 0.0; double c1r = 0.0, c1i = 1.0; @@ -432,7 +448,7 @@ namespace Hermes Komplex_LinearProblem kp(c0r, c0i, *m->mat, c1r, c1i, *m->mat_im, xr, xi, *rhs->vec, *rhs->vec_im); Epetra_LinearProblem *lp = kp.KomplexProblem(); - aztec.SetProblem(*lp,true); + aztec.SetProblem(*lp, true); // solve it aztec.Iterate(this->max_iters, this->tolerance); @@ -440,23 +456,26 @@ namespace Hermes kp.ExtractSolution(xr, xi); free_with_check(this->sln); - this->sln = malloc_with_check(m->size, this); + this->sln = malloc_with_check >, std::complex >(m->size, this); memset(this->sln, 0, m->size * sizeof(std::complex)); // copy the solution into sln vector for (unsigned int i = 0; i < m->size; i++) this->sln[i] = std::complex(xr[i], xi[i]); +#endif } template<> void AztecOOSolver >::solve(std::complex* initial_guess) { +#ifdef HAVE_KOMPLEX assert(m != nullptr); assert(rhs != nullptr); assert(m->size == rhs->size); // no output - aztec.SetAztecOption(AZ_output, AZ_none); // AZ_all | AZ_warnings | AZ_last | AZ_summary + // AZ_all | AZ_warnings | AZ_last | AZ_summary + aztec.SetAztecOption(AZ_output, AZ_none); double c0r = 1.0, c0i = 0.0; double c1r = 0.0, c1i = 1.0; @@ -475,7 +494,7 @@ namespace Hermes Komplex_LinearProblem kp(c0r, c0i, *m->mat, c1r, c1i, *m->mat_im, xr, xi, *rhs->vec, *rhs->vec_im); Epetra_LinearProblem *lp = kp.KomplexProblem(); - aztec.SetProblem(*lp,true); + aztec.SetProblem(*lp, true); // solve it aztec.Iterate(this->max_iters, this->tolerance); @@ -483,12 +502,13 @@ namespace Hermes kp.ExtractSolution(xr, xi); free_with_check(this->sln); - this->sln = malloc_with_check(m->size, this); + this->sln = malloc_with_check >, std::complex >(m->size, this); memset(this->sln, 0, m->size * sizeof(std::complex)); // copy the solution into sln vector for (unsigned int i = 0; i < m->size; i++) this->sln[i] = std::complex(xr[i], xi[i]); +#endif } template @@ -503,8 +523,8 @@ namespace Hermes return aztec.TrueResidual(); } - template class HERMES_API AztecOOSolver; - template class HERMES_API AztecOOSolver >; + template class HERMES_API AztecOOSolver < double > ; + template class HERMES_API AztecOOSolver < std::complex > ; } } #endif \ No newline at end of file diff --git a/hermes_common/src/solvers/interfaces/epetra.cpp b/hermes_common/src/solvers/interfaces/epetra.cpp index c6e46a3a81..5e02d738b6 100644 --- a/hermes_common/src/solvers/interfaces/epetra.cpp +++ b/hermes_common/src/solvers/interfaces/epetra.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -39,9 +39,6 @@ namespace Hermes this->grph = nullptr; this->std_map = nullptr; this->owner = true; - - this->row_storage = true; - this->col_storage = false; } template @@ -57,9 +54,6 @@ namespace Hermes this->grph = new Epetra_CrsGraph(this->mat->Graph()); this->std_map = new Epetra_BlockMap(this->grph->Map()); this->owner = true; - - this->row_storage = true; - this->col_storage = false; } template @@ -72,9 +66,6 @@ namespace Hermes this->grph = const_cast(&this->mat->Graph()); this->std_map = const_cast(&this->grph->Map()); this->owner = false; - - this->row_storage = true; - this->col_storage = false; } template @@ -90,6 +81,9 @@ namespace Hermes // alloc trilinos structs std_map = new Epetra_Map(n, 0, seq_comm); grph = new Epetra_CrsGraph(Copy, *std_map, 0); + mat = new Epetra_CrsMatrix(Copy, *grph); + if (Hermes::Helpers::TypeIsComplex::value) + mat_im = new Epetra_CrsMatrix(Copy, *grph); } template @@ -112,21 +106,21 @@ namespace Hermes mat_im->FillComplete(); } - template<> - void EpetraMatrix::alloc() + template + void EpetraMatrix::alloc() { // create the matrix grph->FillComplete(); + if (mat) + delete mat; mat = new Epetra_CrsMatrix(Copy, *grph); - } - template<> - void EpetraMatrix >::alloc() - { - grph->FillComplete(); - // create the matrix - mat = new Epetra_CrsMatrix(Copy, *grph); - mat_im = new Epetra_CrsMatrix(Copy, *grph); + if (Hermes::Helpers::TypeIsComplex::value) + { + if (mat_im) + delete mat_im; + mat_im = new Epetra_CrsMatrix(Copy, *grph); + } } template<> @@ -156,12 +150,12 @@ namespace Hermes Scalar EpetraMatrix::get(unsigned int m, unsigned int n) const { int n_entries = mat->NumGlobalEntries(m); - Hermes::vector vals(n_entries); - Hermes::vector idxs(n_entries); + std::vector vals(n_entries); + std::vector idxs(n_entries); mat->ExtractGlobalRowCopy(m, n_entries, n_entries, &vals[0], &idxs[0]); for (int i = 0; i < n_entries; i++) - if (idxs[i] == (int)n) - return vals[i]; + if (idxs[i] == (int)n) + return vals[i]; return 0.0; } @@ -174,7 +168,7 @@ namespace Hermes template void EpetraMatrix::extract_row_copy(unsigned int row, unsigned int len, unsigned int &n_entries, double *vals, unsigned int *idxs) { - int* idxs_to_pass = malloc_with_check(len, this); + int* idxs_to_pass = malloc_with_check, int>(len, this); for (unsigned int i = 0; i < len; i++) idxs_to_pass[i] = idxs[i]; int n_entries_to_pass = n_entries; @@ -203,7 +197,7 @@ namespace Hermes int n_to_pass = n; #pragma omp critical (EpetraMatrixAdd) { - int ierr = mat->SumIntoGlobalValues(m, 1, &v, &n_to_pass); + int ierr = mat->SumIntoMyValues(m, 1, &v, &n_to_pass); if (ierr != 0) throw Hermes::Exceptions::Exception("Failed to insert into Epetra matrix"); } @@ -217,11 +211,11 @@ namespace Hermes { // ignore zero values double v_r = std::real(v); int n_to_pass = n; - int ierr = mat->SumIntoGlobalValues(m, 1, &v_r, &n_to_pass); + int ierr = mat->SumIntoMyValues(m, 1, &v_r, &n_to_pass); if (ierr != 0) throw Hermes::Exceptions::Exception("Failed to insert into Epetra matrix"); assert(ierr == 0); double v_i = std::imag(v); - ierr = mat_im->SumIntoGlobalValues(m, 1, &v_i, &n_to_pass); + ierr = mat_im->SumIntoMyValues(m, 1, &v_i, &n_to_pass); assert(ierr == 0); } } @@ -245,9 +239,9 @@ namespace Hermes void EpetraMatrix::add(unsigned int m, unsigned int n, Scalar *mat, int *rows, int *cols, const int size) { for (unsigned int i = 0; i < m; i++) // rows - for (unsigned int j = 0; j < n; j++) // cols - if (rows[i] >= 0 && cols[j] >= 0) // not Dir. dofs. - add(rows[i], cols[j], mat[i * size + j]); + for (unsigned int j = 0; j < n; j++) // cols + if (rows[i] >= 0 && cols[j] >= 0) // not Dir. dofs. + add(rows[i], cols[j], mat[i * size + j]); } template<> @@ -276,15 +270,17 @@ namespace Hermes template<> void EpetraMatrix::export_to_file(const char *filename, const char *var_name, MatrixExportFormat fmt, char* number_format) { - throw Exceptions::MethodNotImplementedException("EpetraMatrix::export_to_file"); - /* + FILE* file; switch (fmt) { - case DF_MATLAB_SPARSE: + case EXPORT_FORMAT_MATLAB_SIMPLE: case EXPORT_FORMAT_PLAIN_ASCII: - EpetraExt::RowMatrixToHandle(file, *this->mat); + file = fopen(filename, "w"); + EpetraExt::RowMatrixToHandle(file, *this->mat); + fclose(file); + default: + throw Exceptions::MethodNotImplementedException("EpetraMatrix::export_to_file"); } - */ } template<> @@ -340,11 +336,16 @@ namespace Hermes template void EpetraVector::alloc(unsigned int n) { - free(); - this->size = n; - std_map = new Epetra_Map(this->size, 0, seq_comm); - vec = new Epetra_Vector(*std_map); - vec_im = new Epetra_Vector(*std_map); + if (this->owner) + { + free(); + this->size = n; + std_map = new Epetra_Map(this->size, 0, seq_comm); + vec = new Epetra_Vector(*std_map); + vec_im = new Epetra_Vector(*std_map); + } + else + assert(this->get_size() == n); zero(); } @@ -353,7 +354,7 @@ namespace Hermes { for (unsigned int i = 0; i < this->size; i++) (*vec)[i] = 0.0; if (vec_im) - for (unsigned int i = 0; i < this->size; i++) (*vec_im)[i] = 0.0; + for (unsigned int i = 0; i < this->size; i++) (*vec_im)[i] = 0.0; } template @@ -366,6 +367,19 @@ namespace Hermes return this; } + template + Vector* EpetraVector::duplicate() const + { + EpetraVector* new_vector = new EpetraVector(); + new_vector->size = this->get_size(); + + new_vector->vec = new Epetra_Vector(*this->vec); + new_vector->std_map = new Epetra_BlockMap(*this->std_map); + new_vector->vec_im = new Epetra_Vector(*this->vec_im); + + return new_vector; + } + template void EpetraVector::free() { @@ -420,7 +434,8 @@ namespace Hermes template void EpetraVector::extract(Scalar *v) const { - vec->ExtractCopy((double *)v); ///< \todo this can't be used with complex numbers + /// \todo this can't be used with complex numbers + vec->ExtractCopy((double *)v); } template @@ -432,16 +447,17 @@ namespace Hermes EpetraExt::VectorToMatrixMarketFile(filename, *this->vec); return; case EXPORT_FORMAT_MATLAB_MATIO: + case EXPORT_FORMAT_MATLAB_SIMPLE: case EXPORT_FORMAT_PLAIN_ASCII: EpetraExt::VectorToMatlabFile(filename, *this->vec); return; } } - template class HERMES_API EpetraMatrix; - template class HERMES_API EpetraMatrix >; - template class HERMES_API EpetraVector; - template class HERMES_API EpetraVector >; + template class HERMES_API EpetraMatrix < double > ; + template class HERMES_API EpetraMatrix < std::complex > ; + template class HERMES_API EpetraVector < double > ; + template class HERMES_API EpetraVector < std::complex > ; } } #endif \ No newline at end of file diff --git a/hermes_common/src/solvers/interfaces/mumps_solver.cpp b/hermes_common/src/solvers/interfaces/mumps_solver.cpp index 3e4a7fe5bc..a7329d2b1c 100644 --- a/hermes_common/src/solvers/interfaces/mumps_solver.cpp +++ b/hermes_common/src/solvers/interfaces/mumps_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -175,7 +175,8 @@ namespace Hermes pos += this->Ap[n]; #pragma omp atomic Ax[pos] += v; - irn[pos] = m + 1; // MUMPS is indexing from 1 + // MUMPS is indexing from 1 + irn[pos] = m + 1; jcn[pos] = n + 1; } @@ -191,7 +192,8 @@ namespace Hermes pos += this->Ap[n]; #pragma omp critical (MumpsMatrix_add) Ax[pos] += v; - irn[pos] = m + 1; // MUMPS is indexing from 1 + // MUMPS is indexing from 1 + irn[pos] = m + 1; jcn[pos] = n + 1; } @@ -203,174 +205,174 @@ namespace Hermes { case EXPORT_FORMAT_MATRIX_MARKET: { - FILE* file = fopen(filename, "w"); - if (!file) - throw Exceptions::IOException(Exceptions::IOException::Write, filename); - if (Hermes::Helpers::TypeIsReal::value) - fprintf(file, "%%%%MatrixMarket matrix coordinate real general\n"); - else - fprintf(file, "%%%%MatrixMarket matrix coordinate complex general\n"); - - fprintf(file, "%d %d %d\n", this->size, this->size, this->nnz); - - if (invert_storage) - this->switch_orientation(); - for (unsigned int j = 0; j < this->size; j++) - { - for (int i = this->Ap[j]; i < this->Ap[j + 1]; i++) - { - Hermes::Helpers::fprint_coordinate_num(file, this->Ai[i] + 1, j + 1, mumps_to_Scalar(this->Ax[i]), number_format); - fprintf(file, "\n"); - } - } - if (invert_storage) - this->switch_orientation(); - - fclose(file); + FILE* file = fopen(filename, "w"); + if (!file) + throw Exceptions::IOException(Exceptions::IOException::Write, filename); + if (Hermes::Helpers::TypeIsReal::value) + fprintf(file, "%%%%MatrixMarket matrix coordinate real general\n"); + else + fprintf(file, "%%%%MatrixMarket matrix coordinate complex general\n"); + + fprintf(file, "%d %d %d\n", this->size, this->size, this->nnz); + + if (invert_storage) + this->switch_orientation(); + for (unsigned int j = 0; j < this->size; j++) + { + for (int i = this->Ap[j]; i < this->Ap[j + 1]; i++) + { + Hermes::Helpers::fprint_coordinate_num(file, this->Ai[i] + 1, j + 1, mumps_to_Scalar(this->Ax[i]), number_format); + fprintf(file, "\n"); + } + } + if (invert_storage) + this->switch_orientation(); + + fclose(file); } break; case EXPORT_FORMAT_MATLAB_MATIO: { #ifdef WITH_MATIO - mat_sparse_t sparse; - sparse.nzmax = this->nnz; - if (invert_storage) - this->switch_orientation(); - - sparse.nir = this->nnz; - sparse.ir = this->Ai; - sparse.njc = this->size + 1; - sparse.jc = (int *)this->Ap; - sparse.ndata = this->nnz; - - size_t dims[2]; - dims[0] = this->size; - dims[1] = this->size; - - mat_t *mat = Mat_CreateVer(filename, "", MAT_FT_MAT5); - - matvar_t *matvar; - - // For complex. No allocation here. - double* Ax_re = nullptr; - double* Ax_im = nullptr; - - // For real. - if (Hermes::Helpers::TypeIsReal::value) - { - sparse.data = this->Ax; - matvar = Mat_VarCreate(var_name, MAT_C_SPARSE, MAT_T_DOUBLE, 2, dims, &sparse, MAT_F_DONT_COPY_DATA); - } - else - { - // For complex. - Ax_re = malloc_with_check, double>(this->nnz, this); - Ax_im = malloc_with_check, double>(this->nnz, this); - struct mat_complex_split_t z = { Ax_re, Ax_im }; - - for (int i = 0; i < this->nnz; i++) - { - Ax_re[i] = ((std::complex)(mumps_to_Scalar(this->Ax[i]))).real(); - Ax_im[i] = ((std::complex)(mumps_to_Scalar(this->Ax[i]))).imag(); - sparse.data = &z; - } - matvar = Mat_VarCreate(var_name, MAT_C_SPARSE, MAT_T_DOUBLE, 2, dims, &sparse, MAT_F_DONT_COPY_DATA | MAT_F_COMPLEX); - } - - if (matvar) - { - Mat_VarWrite(mat, matvar, MAT_COMPRESSION_ZLIB); - Mat_VarFree(matvar); - } - if (invert_storage) - this->switch_orientation(); - free_with_check(Ax_re); - free_with_check(Ax_im); - Mat_Close(mat); - - if (!matvar) - throw Exceptions::IOException(Exceptions::IOException::Write, filename); + mat_sparse_t sparse; + sparse.nzmax = this->nnz; + if (invert_storage) + this->switch_orientation(); + + sparse.nir = this->nnz; + sparse.ir = this->Ai; + sparse.njc = this->size + 1; + sparse.jc = (int *)this->Ap; + sparse.ndata = this->nnz; + + size_t dims[2]; + dims[0] = this->size; + dims[1] = this->size; + + mat_t *mat = Mat_CreateVer(filename, "", MAT_FT_MAT5); + + matvar_t *matvar; + + // For complex. No allocation here. + double* Ax_re = nullptr; + double* Ax_im = nullptr; + + // For real. + if (Hermes::Helpers::TypeIsReal::value) + { + sparse.data = this->Ax; + matvar = Mat_VarCreate(var_name, MAT_C_SPARSE, MAT_T_DOUBLE, 2, dims, &sparse, MAT_F_DONT_COPY_DATA); + } + else + { + // For complex. + Ax_re = malloc_with_check, double>(this->nnz, this); + Ax_im = malloc_with_check, double>(this->nnz, this); + struct mat_complex_split_t z = { Ax_re, Ax_im }; + + for (int i = 0; i < this->nnz; i++) + { + Ax_re[i] = ((std::complex)(mumps_to_Scalar(this->Ax[i]))).real(); + Ax_im[i] = ((std::complex)(mumps_to_Scalar(this->Ax[i]))).imag(); + sparse.data = &z; + } + matvar = Mat_VarCreate(var_name, MAT_C_SPARSE, MAT_T_DOUBLE, 2, dims, &sparse, MAT_F_DONT_COPY_DATA | MAT_F_COMPLEX); + } + + if (matvar) + { + Mat_VarWrite(mat, matvar, MAT_COMPRESSION_ZLIB); + Mat_VarFree(matvar); + } + if (invert_storage) + this->switch_orientation(); + free_with_check(Ax_re); + free_with_check(Ax_im); + Mat_Close(mat); + + if (!matvar) + throw Exceptions::IOException(Exceptions::IOException::Write, filename); #endif } break; case EXPORT_FORMAT_PLAIN_ASCII: { - FILE* file = fopen(filename, "w"); - if (!file) - throw Exceptions::IOException(Exceptions::IOException::Write, filename); - - if (invert_storage) - this->switch_orientation(); - for (unsigned int j = 0; j < this->size; j++) - { - for (int i = this->Ap[j]; i < this->Ap[j + 1]; i++) - { - Helpers::fprint_coordinate_num(file, this->Ai[i], j, mumps_to_Scalar(this->Ax[i]), number_format); - fprintf(file, "\n"); - } - } - if (invert_storage) - this->switch_orientation(); - - fclose(file); + FILE* file = fopen(filename, "w"); + if (!file) + throw Exceptions::IOException(Exceptions::IOException::Write, filename); + + if (invert_storage) + this->switch_orientation(); + for (unsigned int j = 0; j < this->size; j++) + { + for (int i = this->Ap[j]; i < this->Ap[j + 1]; i++) + { + Helpers::fprint_coordinate_num(file, this->Ai[i], j, mumps_to_Scalar(this->Ax[i]), number_format); + fprintf(file, "\n"); + } + } + if (invert_storage) + this->switch_orientation(); + + fclose(file); } break; #ifdef WITH_BSON case EXPORT_FORMAT_BSON: { - // Init bson - bson bw; - bson_init(&bw); - - // Matrix size. - bson_append_int(&bw, "size", this->size); - // Nonzeros. - bson_append_int(&bw, "nnz", this->nnz); - - if (invert_storage) - this->switch_orientation(); - - bson_append_start_array(&bw, "Ap"); - for (unsigned int i = 0; i < this->size; i++) - bson_append_int(&bw, "p", this->Ap[i]); - bson_append_finish_array(&bw); - - bson_append_start_array(&bw, "Ai"); - for (unsigned int i = 0; i < this->nnz; i++) - bson_append_int(&bw, "i", this->Ai[i]); - bson_append_finish_array(&bw); - - bson_append_start_array(&bw, "Ax"); - for (unsigned int i = 0; i < this->nnz; i++) - bson_append_double(&bw, "x", real(this->Ax[i])); - bson_append_finish_array(&bw); - - if (!Hermes::Helpers::TypeIsReal::value) - { - bson_append_start_array(&bw, "Ax-imag"); - for (unsigned int i = 0; i < this->nnz; i++) - bson_append_double(&bw, "x-i", imag(this->Ax[i])); - bson_append_finish_array(&bw); - } - bson_append_finish_array(&bw); - - if (invert_storage) - this->switch_orientation(); - - // Done. - bson_finish(&bw); - - // Write to disk. - FILE *fpw; - fpw = fopen(filename, "wb"); - const char *dataw = (const char *)bson_data(&bw); - fwrite(dataw, bson_size(&bw), 1, fpw); - fclose(fpw); - - bson_destroy(&bw); + // Init bson + bson bw; + bson_init(&bw); + + // Matrix size. + bson_append_int(&bw, "size", this->size); + // Nonzeros. + bson_append_int(&bw, "nnz", this->nnz); + + if (invert_storage) + this->switch_orientation(); + + bson_append_start_array(&bw, "Ap"); + for (unsigned int i = 0; i < this->size; i++) + bson_append_int(&bw, "p", this->Ap[i]); + bson_append_finish_array(&bw); + + bson_append_start_array(&bw, "Ai"); + for (unsigned int i = 0; i < this->nnz; i++) + bson_append_int(&bw, "i", this->Ai[i]); + bson_append_finish_array(&bw); + + bson_append_start_array(&bw, "Ax"); + for (unsigned int i = 0; i < this->nnz; i++) + bson_append_double(&bw, "x", real(this->Ax[i])); + bson_append_finish_array(&bw); + + if (!Hermes::Helpers::TypeIsReal::value) + { + bson_append_start_array(&bw, "Ax-imag"); + for (unsigned int i = 0; i < this->nnz; i++) + bson_append_double(&bw, "x-i", imag(this->Ax[i])); + bson_append_finish_array(&bw); + } + bson_append_finish_array(&bw); + + if (invert_storage) + this->switch_orientation(); + + // Done. + bson_finish(&bw); + + // Write to disk. + FILE *fpw; + fpw = fopen(filename, "wb"); + const char *dataw = (const char *)bson_data(&bw); + fwrite(dataw, bson_size(&bw), 1, fpw); + fclose(fpw); + + bson_destroy(&bw); } break; #endif @@ -389,66 +391,66 @@ namespace Hermes case EXPORT_FORMAT_MATLAB_MATIO: { #ifdef WITH_MATIO - mat_t *matfp; - matvar_t *matvar; - - matfp = Mat_Open(filename, MAT_ACC_RDONLY); - - if (!matfp) - throw Exceptions::IOException(Exceptions::IOException::Read, filename); - - matvar = Mat_VarRead(matfp, var_name); - - if (matvar) - { - mat_sparse_t *sparse = (mat_sparse_t *)matvar->data; - - this->nnz = sparse->nir; - this->size = sparse->njc; - - this->Ap = malloc_with_check, int>(this->size + 1, this); - this->Ai = malloc_with_check, int>(this->nnz, this); - this->Ax = malloc_with_check, typename mumps_type::mumps_Scalar>(this->nnz, this); - this->irn = malloc_with_check, int>(this->nnz, this); - this->jcn = malloc_with_check, int>(this->nnz, this); - - void* data = nullptr; - if (Hermes::Helpers::TypeIsReal::value) - data = sparse->data; - else - { - std::complex* complex_data = malloc_with_check, std::complex >(this->nnz, this); - double* real_array = (double*)((mat_complex_split_t*)sparse->data)->Re; - double* imag_array = (double*)((mat_complex_split_t*)sparse->data)->Im; - for (int i = 0; i < this->nnz; i++) - complex_data[i] = std::complex(real_array[i], imag_array[i]); - data = (void*)complex_data; - } - memcpy(this->Ax, data, this->nnz * sizeof(Scalar)); - if (!Hermes::Helpers::TypeIsReal::value) - free_with_check(data); - memcpy(this->Ap, sparse->jc, this->size * sizeof(int)); - this->Ap[this->size] = this->nnz; - memcpy(this->Ai, sparse->ir, this->nnz * sizeof(int)); - - for (unsigned int i = 0; i < this->nnz; i++) - this->irn[i] = this->Ai[i] + 1; - for (unsigned int i = 0; i < this->size; i++) - { - for (int j = this->Ap[i]; j < this->Ap[i + 1]; j++) - jcn[j] = i + 1; - } - - if (invert_storage) - this->switch_orientation(); - } - - Mat_Close(matfp); - - if (!matvar) - throw Exceptions::IOException(Exceptions::IOException::Read, filename); + mat_t *matfp; + matvar_t *matvar; + + matfp = Mat_Open(filename, MAT_ACC_RDONLY); + + if (!matfp) + throw Exceptions::IOException(Exceptions::IOException::Read, filename); + + matvar = Mat_VarRead(matfp, var_name); + + if (matvar) + { + mat_sparse_t *sparse = (mat_sparse_t *)matvar->data; + + this->nnz = sparse->nir; + this->size = sparse->njc; + + this->Ap = malloc_with_check, int>(this->size + 1, this); + this->Ai = malloc_with_check, int>(this->nnz, this); + this->Ax = malloc_with_check, typename mumps_type::mumps_Scalar>(this->nnz, this); + this->irn = malloc_with_check, int>(this->nnz, this); + this->jcn = malloc_with_check, int>(this->nnz, this); + + void* data = nullptr; + if (Hermes::Helpers::TypeIsReal::value) + data = sparse->data; + else + { + std::complex* complex_data = malloc_with_check, std::complex >(this->nnz, this); + double* real_array = (double*)((mat_complex_split_t*)sparse->data)->Re; + double* imag_array = (double*)((mat_complex_split_t*)sparse->data)->Im; + for (int i = 0; i < this->nnz; i++) + complex_data[i] = std::complex(real_array[i], imag_array[i]); + data = (void*)complex_data; + } + memcpy(this->Ax, data, this->nnz * sizeof(Scalar)); + if (!Hermes::Helpers::TypeIsReal::value) + free_with_check(data); + memcpy(this->Ap, sparse->jc, this->size * sizeof(int)); + this->Ap[this->size] = this->nnz; + memcpy(this->Ai, sparse->ir, this->nnz * sizeof(int)); + + for (unsigned int i = 0; i < this->nnz; i++) + this->irn[i] = this->Ai[i] + 1; + for (unsigned int i = 0; i < this->size; i++) + { + for (int j = this->Ap[i]; j < this->Ap[i + 1]; j++) + jcn[j] = i + 1; + } + + if (invert_storage) + this->switch_orientation(); + } + + Mat_Close(matfp); + + if (!matvar) + throw Exceptions::IOException(Exceptions::IOException::Read, filename); #else - throw Exceptions::Exception("MATIO not included."); + throw Exceptions::Exception("MATIO not included."); #endif } break; @@ -459,82 +461,82 @@ namespace Hermes #ifdef WITH_BSON case EXPORT_FORMAT_BSON: { - FILE *fpr; - fpr = fopen(filename, "rb"); - - // file size: - fseek(fpr, 0, SEEK_END); - int size = ftell(fpr); - rewind(fpr); - - // allocate memory to contain the whole file: - char *datar = malloc_with_check(size); - fread(datar, size, 1, fpr); - fclose(fpr); - - bson br; - bson_init_finished_data(&br, datar, 0); - - bson_iterator it; - bson sub; - bson_find(&it, &br, "size"); - this->size = bson_iterator_int(&it); - bson_find(&it, &br, "nnz"); - this->nnz = bson_iterator_int(&it); - - this->Ap = malloc_with_check, int>(this->size + 1, this); - this->Ai = malloc_with_check, int>(this->nnz, this); - this->Ax = malloc_with_check, typename mumps_type::mumps_Scalar>(this->nnz, this); - this->irn = malloc_with_check, int>(this->nnz, this); - this->jcn = malloc_with_check, int>(this->nnz, this); - - // coeffs - bson_iterator it_coeffs; - bson_find(&it_coeffs, &br, "Ap"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - int index_coeff = 0; - while (bson_iterator_next(&it)) - this->Ap[index_coeff++] = bson_iterator_int(&it); - this->Ap[this->size] = this->nnz; - - bson_find(&it_coeffs, &br, "Ai"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - index_coeff = 0; - while (bson_iterator_next(&it)) - this->Ai[index_coeff++] = bson_iterator_int(&it); - - bson_find(&it_coeffs, &br, "Ax"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - index_coeff = 0; - while (bson_iterator_next(&it)) - mumps_assign_Scalar(this->Ax[index_coeff++], bson_iterator_double(&it)); - - if (!Hermes::Helpers::TypeIsReal::value) - { - bson_find(&it_coeffs, &br, "Ax-imag"); - bson_iterator_subobject_init(&it_coeffs, &sub, 0); - bson_iterator_init(&it, &sub); - index_coeff = 0; - while (bson_iterator_next(&it)) - this->Ax[index_coeff++] += bson_iterator_double(&it); - } - - for (unsigned int i = 0; i < this->nnz; i++) - this->irn[i] = this->Ai[i] + 1; - for (unsigned int i = 0; i < this->size; i++) - { - for (int j = this->Ap[i]; j < this->Ap[i + 1]; j++) - jcn[j] = i + 1; - } - - if (invert_storage) - this->switch_orientation(); - - bson_destroy(&br); - free_with_check(datar); + FILE *fpr; + fpr = fopen(filename, "rb"); + + // file size: + fseek(fpr, 0, SEEK_END); + int size = ftell(fpr); + rewind(fpr); + + // allocate memory to contain the whole file: + char *datar = malloc_with_check(size); + fread(datar, size, 1, fpr); + fclose(fpr); + + bson br; + bson_init_finished_data(&br, datar, 0); + + bson_iterator it; + bson sub; + bson_find(&it, &br, "size"); + this->size = bson_iterator_int(&it); + bson_find(&it, &br, "nnz"); + this->nnz = bson_iterator_int(&it); + + this->Ap = malloc_with_check, int>(this->size + 1, this); + this->Ai = malloc_with_check, int>(this->nnz, this); + this->Ax = malloc_with_check, typename mumps_type::mumps_Scalar>(this->nnz, this); + this->irn = malloc_with_check, int>(this->nnz, this); + this->jcn = malloc_with_check, int>(this->nnz, this); + + // coeffs + bson_iterator it_coeffs; + bson_find(&it_coeffs, &br, "Ap"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + int index_coeff = 0; + while (bson_iterator_next(&it)) + this->Ap[index_coeff++] = bson_iterator_int(&it); + this->Ap[this->size] = this->nnz; + + bson_find(&it_coeffs, &br, "Ai"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + index_coeff = 0; + while (bson_iterator_next(&it)) + this->Ai[index_coeff++] = bson_iterator_int(&it); + + bson_find(&it_coeffs, &br, "Ax"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + index_coeff = 0; + while (bson_iterator_next(&it)) + mumps_assign_Scalar(this->Ax[index_coeff++], bson_iterator_double(&it)); + + if (!Hermes::Helpers::TypeIsReal::value) + { + bson_find(&it_coeffs, &br, "Ax-imag"); + bson_iterator_subobject_init(&it_coeffs, &sub, 0); + bson_iterator_init(&it, &sub); + index_coeff = 0; + while (bson_iterator_next(&it)) + this->Ax[index_coeff++] += bson_iterator_double(&it); + } + + for (unsigned int i = 0; i < this->nnz; i++) + this->irn[i] = this->Ai[i] + 1; + for (unsigned int i = 0; i < this->size; i++) + { + for (int j = this->Ap[i]; j < this->Ap[i + 1]; j++) + jcn[j] = i + 1; + } + + if (invert_storage) + this->switch_orientation(); + + bson_destroy(&br); + free_with_check(datar); } #endif } @@ -617,8 +619,8 @@ namespace Hermes return nmat; } - template class HERMES_API MumpsMatrix; - template class HERMES_API MumpsMatrix >; + template class HERMES_API MumpsMatrix < double > ; + template class HERMES_API MumpsMatrix < std::complex > ; } namespace Solvers @@ -639,14 +641,15 @@ namespace Hermes MumpsSolver::MumpsSolver(MumpsMatrix *m, SimpleVector *rhs) : DirectSolver(m, rhs), m(m), rhs(rhs), icntl_14(init_icntl_14) { - inited = false; + inited = false; - // Initial values for some fields of the MUMPS_STRUC structure that may be accessed - // before MUMPS has been initialized. - param.rhs = nullptr; - param.INFOG(33) = -999; // see the case HERMES_REUSE_MATRIX_REORDERING_AND_SCALING - // in setup_factorization() - } + // Initial values for some fields of the MUMPS_STRUC structure that may be accessed + // before MUMPS has been initialized. + param.rhs = nullptr; + // see the case HERMES_REUSE_MATRIX_REORDERING_AND_SCALING + param.INFOG(33) = -999; + // in setup_factorization() + } template MumpsSolver::~MumpsSolver() @@ -685,7 +688,8 @@ namespace Hermes { switch (param.INFOG(1)) { - case 0: return true; // no error + // no error + case 0: return true; case -1: throw Hermes::Exceptions::LinearMatrixSolverException("Error occured on processor %d", MUMPS_INFO(param, 2)); break; case -2: throw Hermes::Exceptions::LinearMatrixSolverException("Number of nonzeros (NNZ) is out of range."); break; case -3: throw Hermes::Exceptions::LinearMatrixSolverException("MUMPS called with an invalid option for JOB."); break; @@ -712,8 +716,10 @@ namespace Hermes } param.job = JOB_INIT; - param.par = 1; // host also performs calculations - param.sym = 0; // 0 = unsymmetric + // host also performs calculations + param.par = 1; + // 0 = unsymmetric + param.sym = 0; param.comm_fortran = USE_COMM_WORLD; mumps_c(¶m); @@ -727,10 +733,14 @@ namespace Hermes param.ICNTL(3) = -1; param.ICNTL(4) = 0; - param.ICNTL(5) = 0; // =/ both centralized assembled matrix - param.ICNTL(18) = 0; // =\ both centralized assembled matrix - param.ICNTL(20) = 0; // centralized dense RHS - param.ICNTL(21) = 0; // centralized dense solution + // =/ both centralized assembled matrix + param.ICNTL(5) = 0; + // =\ both centralized assembled matrix + param.ICNTL(18) = 0; + // centralized dense RHS + param.ICNTL(20) = 0; + // centralized dense solution + param.ICNTL(21) = 0; // Fixing the memory problems - this parameter specifies the maximum // extra fill-in. @@ -826,8 +836,8 @@ namespace Hermes // solution) must be performed. int eff_fact_scheme = this->reuse_scheme; if (!inited) - if (this->reuse_scheme == HERMES_REUSE_MATRIX_REORDERING || this->reuse_scheme == HERMES_REUSE_MATRIX_STRUCTURE_COMPLETELY) - eff_fact_scheme = HERMES_CREATE_STRUCTURE_FROM_SCRATCH; + if (this->reuse_scheme == HERMES_REUSE_MATRIX_REORDERING || this->reuse_scheme == HERMES_REUSE_MATRIX_STRUCTURE_COMPLETELY) + eff_fact_scheme = HERMES_CREATE_STRUCTURE_FROM_SCRATCH; switch (eff_fact_scheme) { @@ -874,8 +884,8 @@ namespace Hermes return true; } - template class HERMES_API MumpsSolver; - template class HERMES_API MumpsSolver >; + template class HERMES_API MumpsSolver < double > ; + template class HERMES_API MumpsSolver < std::complex > ; } } -#endif +#endif \ No newline at end of file diff --git a/hermes_common/src/solvers/interfaces/paralution_solver.cpp b/hermes_common/src/solvers/interfaces/paralution_solver.cpp index 21d819a73c..2f952ce87f 100644 --- a/hermes_common/src/solvers/interfaces/paralution_solver.cpp +++ b/hermes_common/src/solvers/interfaces/paralution_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -69,9 +69,19 @@ namespace Hermes void ParalutionMatrix::alloc() { CSRMatrix::alloc(); + + // This is here because PARALUTION for some reason NULLs these at the end of SetDataPtrCSR routine. + int* ap = this->Ap; + int* ai = this->Ai; + Scalar* ax = this->Ax; + this->paralutionMatrix.SetDataPtrCSR(&this->Ap, &this->Ai, &this->Ax, "paralutionMatrix", this->nnz, this->size, this->size); - } + // This is here because PARALUTION for some reason NULLs these at the end of SetDataPtrCSR routine. + this->Ap = ap; + this->Ai = ai; + this->Ax = ax; + } template ParalutionVector::ParalutionVector() : SimpleVector(), paralutionVector(new paralution::LocalVector) @@ -82,7 +92,10 @@ namespace Hermes ParalutionVector::ParalutionVector(unsigned int size) : SimpleVector(size), paralutionVector(new paralution::LocalVector) { this->alloc(size); - this->paralutionVector->SetDataPtr(&this->v, "paralutionVector", this->size); + // This is here because PARALUTION for some reason NULLs these at the end of SetDataPtrCSR routine. + Scalar* v_ = this->v; + this->paralutionVector->SetDataPtr(&this->v, "paralutionVector", this->size); + this->v = v_; } template @@ -90,8 +103,11 @@ namespace Hermes { SimpleVector::alloc(n); this->paralutionVector->Clear(); + // This is here because PARALUTION for some reason NULLs these at the end of SetDataPtrCSR routine. + Scalar* v_ = this->v; this->paralutionVector->SetDataPtr(&this->v, "vector", this->size); - } + this->v = v_; + } template ParalutionVector::~ParalutionVector() @@ -125,8 +141,8 @@ namespace Hermes memset(this->v, 0, this->size * sizeof(Scalar)); } - template class HERMES_API ParalutionMatrix; - template class HERMES_API ParalutionVector; + template class HERMES_API ParalutionMatrix < double > ; + template class HERMES_API ParalutionVector < double > ; } namespace Solvers { @@ -153,7 +169,9 @@ namespace Hermes template void AbstractParalutionLinearMatrixSolver::free() { - delete this->paralutionSolver; + if (this->paralutionSolver) + delete this->paralutionSolver; + this->paralutionSolver = nullptr; this->sln = nullptr; } @@ -171,7 +189,6 @@ namespace Hermes this->solve(nullptr); } - template void AbstractParalutionLinearMatrixSolver::presolve_init() { @@ -265,12 +282,6 @@ namespace Hermes return this->num_iters; } - template - void AbstractParalutionLinearMatrixSolver::set_verbose_output(bool to_set) - { - Hermes::Mixins::Loggable::set_verbose_output(to_set); - } - template double AbstractParalutionLinearMatrixSolver::get_residual_norm() { @@ -283,6 +294,17 @@ namespace Hermes this->set_precond(new Preconditioners::ParalutionPrecond(ILU)); } + template + void IterativeParalutionLinearMatrixSolver::free() + { + if (preconditioner) + { + delete preconditioner; + preconditioner = nullptr; + } + AbstractParalutionLinearMatrixSolver::free(); + } + template IterativeParalutionLinearMatrixSolver::IterativeParalutionLinearMatrixSolver(ParalutionMatrix *matrix, ParalutionVector *rhs) : AbstractParalutionLinearMatrixSolver(matrix, rhs), IterSolver(matrix, rhs), LoopSolver(matrix, rhs), preconditioner(nullptr) { @@ -293,7 +315,10 @@ namespace Hermes IterativeParalutionLinearMatrixSolver::~IterativeParalutionLinearMatrixSolver() { if (preconditioner) + { delete preconditioner; + preconditioner = nullptr; + } } template @@ -310,30 +335,30 @@ namespace Hermes switch (type) { case CG: - { - return new paralution::CG, paralution::LocalVector, Scalar>(); - } + { + return new paralution::CG, paralution::LocalVector, Scalar>(); + } break; case GMRES: - { - return new paralution::GMRES, paralution::LocalVector, Scalar>(); - } + { + return new paralution::GMRES, paralution::LocalVector, Scalar>(); + } break; case BiCGStab: - { - return new paralution::BiCGStab, paralution::LocalVector, Scalar>(); - } + { + return new paralution::BiCGStab, paralution::LocalVector, Scalar>(); + } break; #if __PARALUTION_VER >= 500 case CR: - { - return new paralution::CR, paralution::LocalVector, Scalar>(); - } + { + return new paralution::CR, paralution::LocalVector, Scalar>(); + } break; case IDR: - { - return new paralution::IDR, paralution::LocalVector, Scalar>(); - } + { + return new paralution::IDR, paralution::LocalVector, Scalar>(); + } break; #endif default: @@ -417,15 +442,15 @@ namespace Hermes } AMG_solver->SetSmoother(smoothers); - AMG_solver->SetSmootherPreIter(3); - AMG_solver->SetSmootherPostIter(3); + AMG_solver->SetSmootherPreIter(5); + AMG_solver->SetSmootherPostIter(5); AMG_solver->Build(); } } - template class HERMES_API IterativeParalutionLinearMatrixSolver; - template class HERMES_API AMGParalutionLinearMatrixSolver; + template class HERMES_API IterativeParalutionLinearMatrixSolver < double > ; + template class HERMES_API AMGParalutionLinearMatrixSolver < double > ; } namespace Preconditioners @@ -455,25 +480,25 @@ namespace Hermes break; #if __PARALUTION_VER >= 500 case MultiElimination: - { - this->mcilu_p = new paralution::MultiColoredILU, paralution::LocalVector, Scalar >; - mcilu_p->Init(0); + { + this->mcilu_p = new paralution::MultiColoredILU < paralution::LocalMatrix, paralution::LocalVector, Scalar > ; + mcilu_p->Set(0); - paralution::MultiElimination, paralution::LocalVector, Scalar>* multiEliminationPreconditioner = - new paralution::MultiElimination, paralution::LocalVector, Scalar>(); - multiEliminationPreconditioner->Init(*mcilu_p, 2, 0.4); - this->paralutionPreconditioner = multiEliminationPreconditioner; - } + paralution::MultiElimination, paralution::LocalVector, Scalar>* multiEliminationPreconditioner = + new paralution::MultiElimination, paralution::LocalVector, Scalar>(); + multiEliminationPreconditioner->Set(*mcilu_p, 2, 0.4); + this->paralutionPreconditioner = multiEliminationPreconditioner; + } break; case SaddlePoint: - { - paralution::DiagJacobiSaddlePointPrecond, paralution::LocalVector, Scalar>* saddlePointPrecond = - new paralution::DiagJacobiSaddlePointPrecond, paralution::LocalVector, Scalar>(); - this->saddlePoint_p_k = new paralution::FSAI, paralution::LocalVector, Scalar>; - this->saddlePoint_p_s = new paralution::SPAI, paralution::LocalVector, Scalar>; - saddlePointPrecond->Init(*this->saddlePoint_p_k, *this->saddlePoint_p_s); - this->paralutionPreconditioner = saddlePointPrecond; - } + { + paralution::DiagJacobiSaddlePointPrecond, paralution::LocalVector, Scalar>* saddlePointPrecond = + new paralution::DiagJacobiSaddlePointPrecond, paralution::LocalVector, Scalar>(); + this->saddlePoint_p_k = new paralution::FSAI < paralution::LocalMatrix, paralution::LocalVector, Scalar > ; + this->saddlePoint_p_s = new paralution::SPAI < paralution::LocalMatrix, paralution::LocalVector, Scalar > ; + saddlePointPrecond->Set(*this->saddlePoint_p_k, *this->saddlePoint_p_s); + this->paralutionPreconditioner = saddlePointPrecond; + } break; #endif default: @@ -489,8 +514,8 @@ namespace Hermes paralution::DiagJacobiSaddlePointPrecond, paralution::LocalVector, Scalar>* saddlePointPrecond = dynamic_cast, paralution::LocalVector, Scalar>*>(this->paralutionPreconditioner); if (saddlePointPrecond) - saddlePointPrecond->Init(*this->saddlePoint_p_k, *this->saddlePoint_p_s); -#endif + saddlePointPrecond->Set(*this->saddlePoint_p_k, *this->saddlePoint_p_s); +#endif return (*this->paralutionPreconditioner); } @@ -531,7 +556,7 @@ namespace Hermes } } - template class HERMES_API ParalutionPrecond; + template class HERMES_API ParalutionPrecond < double > ; } } -#endif +#endif \ No newline at end of file diff --git a/hermes_common/src/solvers/interfaces/petsc_solver.cpp b/hermes_common/src/solvers/interfaces/petsc_solver.cpp index 2b5b79ee55..8dc2ae47cc 100644 --- a/hermes_common/src/solvers/interfaces/petsc_solver.cpp +++ b/hermes_common/src/solvers/interfaces/petsc_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -23,6 +23,8 @@ #ifdef WITH_PETSC #include "petsc_solver.h" #include "callstack.h" +#include "common.h" +#include "util/memory_handling.h" /// \todo Check #ifdef WITH_MPI and use the parallel methods from PETSc accordingly. @@ -32,6 +34,7 @@ namespace Hermes { static int num_petsc_objects = 0; +#ifdef PETSC_USE_COMPLEX inline void vec_get_value(Vec x, PetscInt ni, const PetscInt ix[], std::complex y[]) { VecGetValues(x, ni, ix, y); @@ -39,15 +42,25 @@ namespace Hermes void vec_get_value(Vec x, PetscInt ni, const PetscInt ix[], double y[]) { - PetscScalar *py = malloc_with_check(ni, this); + PetscScalar *py = malloc_with_check(ni); VecGetValues(x, ni, ix, py); for (int i = 0; i < ni; i++)y[i] = py[i].real(); free_with_check(py); } +#else + inline void vec_get_value(Vec x, PetscInt ni, const PetscInt ix[], double y[]) + { + VecGetValues(x, ni, ix, y); + } + inline void vec_get_value(Vec x, PetscInt ni, const PetscInt ix[], std::complex y[]) + { + throw(Exceptions::Exception("PETSc with complex numbers support required.")); + } +#endif int remove_petsc_object() { - PetscTruth petsc_initialized, petsc_finalized; + PetscBool petsc_initialized, petsc_finalized; int ierr = PetscFinalized(&petsc_finalized); CHKERRQ(ierr); ierr = PetscInitialized(&petsc_initialized); CHKERRQ(ierr); if (petsc_finalized == PETSC_TRUE || petsc_initialized == PETSC_FALSE) @@ -58,14 +71,14 @@ namespace Hermes { int ierr = PetscFinalize(); CHKERRQ(ierr); - this->info("PETSc finalized. No more PETSc usage allowed until application restart."); + //FIXME this->info("PETSc finalized. No more PETSc usage allowed until application restart."); } } int add_petsc_object() { int ierr; - PetscTruth petsc_initialized, petsc_finalized; + PetscBool petsc_initialized, petsc_finalized; ierr = PetscFinalized(&petsc_finalized); CHKERRQ(ierr); if (petsc_finalized == PETSC_TRUE) @@ -102,11 +115,11 @@ namespace Hermes assert(this->pages != nullptr); // calc nnz - int *nnz_array = malloc_with_check(this->size, this); + int *nnz_array = malloc_with_check(this->size); // fill in nnz_array int aisize = this->get_num_indices(); - int *ai = malloc_with_check(aisize, this); + int *ai = malloc_with_check(aisize); // sort the indices and remove duplicities, insert into ai int pos = 0; @@ -117,7 +130,7 @@ namespace Hermes } // stote the number of nonzeros nnz = pos; - free_with_check(this->pages; this->pages = nullptr); + free_with_check(this->pages); free_with_check(ai); // @@ -132,7 +145,7 @@ namespace Hermes template void PetscMatrix::free() { - if (inited) MatDestroy(matrix); + if (inited) MatDestroy(&matrix); inited = false; } @@ -146,13 +159,12 @@ namespace Hermes template<> double PetscMatrix::get(unsigned int m, unsigned int n) const { - double v = 0.0; PetscScalar pv; MatGetValues(matrix, 1, (PetscInt*)&m, 1, (PetscInt*)&n, &pv); - v = pv.real(); - return v; + return PetscRealPart(pv); } +#ifdef PETSC_USE_COMPLEX template<> std::complex PetscMatrix >::get(unsigned int m, unsigned int n) const { @@ -160,6 +172,13 @@ namespace Hermes MatGetValues(matrix, 1, (PetscInt*)&m, 1, (PetscInt*)&n, &v); return v; } +#else + template<> + std::complex PetscMatrix >::get(unsigned int m, unsigned int n) const + { + throw(Exceptions::Exception("PETSc with complex numbers support required.")); + } +#endif template void PetscMatrix::zero() @@ -167,6 +186,7 @@ namespace Hermes MatZeroEntries(matrix); } +#ifdef PETSC_USE_COMPLEX inline PetscScalar to_petsc(double x) { return std::complex(x, 0); @@ -176,6 +196,16 @@ namespace Hermes { return x; } +#else + inline PetscScalar to_petsc(double x) + { + return x; + } + inline PetscScalar to_petsc(std::complex x) + { + throw(Exceptions::Exception("PETSc with complex numbers support required.")); + } +#endif template void PetscMatrix::add(unsigned int m, unsigned int n, Scalar v) @@ -188,7 +218,7 @@ namespace Hermes } template - bool PetscMatrix::export_to_file(const char *filename, const char *var_name, MatrixExportFormat fmt, char* number_format) + void PetscMatrix::export_to_file(const char *filename, const char *var_name, MatrixExportFormat fmt, char* number_format) { throw Exceptions::MethodNotImplementedException("PetscVector::export_to_file"); /* @@ -218,7 +248,8 @@ namespace Hermes template void PetscMatrix::add_petsc_matrix(PetscMatrix* mat) { - MatAXPY(matrix, 1, mat->matrix, DIFFERENT_NONZERO_PATTERN); //matrix = 1*mat + matrix (matrix and mat have different nonzero structure) + //matrix = 1*mat + matrix (matrix and mat have different nonzero structure) + MatAXPY(matrix, 1, mat->matrix, DIFFERENT_NONZERO_PATTERN); } template @@ -244,7 +275,7 @@ namespace Hermes { this->size = size; this->nnz = nnz; - PetscScalar* pax = malloc_with_check(nnz, this); + PetscScalar* pax = malloc_with_check(nnz, this); for (unsigned i = 0; i < nnz; i++) pax[i] = to_petsc(ax[i]); MatCreateSeqAIJWithArrays(PETSC_COMM_SELF, size, size, ap, ai, pax, &matrix); @@ -259,7 +290,7 @@ namespace Hermes ptscmatrix->size = this->size; ptscmatrix->nnz = nnz; return ptscmatrix; - }; + } template PetscVector::PetscVector() @@ -287,7 +318,7 @@ namespace Hermes template void PetscVector::free() { - if (inited) VecDestroy(vec); + if (inited) VecDestroy(&vec); inited = false; } @@ -301,13 +332,11 @@ namespace Hermes template<> double PetscVector::get(unsigned int idx) const { - double y = 0; PetscScalar py; VecGetValues(vec, 1, (PetscInt*)&idx, &py); - y = py.real(); - return y; + return PetscRealPart(py); } - +#ifdef PETSC_USE_COMPLEX template<> std::complex PetscVector >::get(unsigned int idx) const { @@ -315,11 +344,18 @@ namespace Hermes VecGetValues(vec, 1, (PetscInt*)&idx, &y); return y; } +#else + template<> + std::complex PetscVector >::get(unsigned int idx) const + { + throw(Exceptions::Exception("PETSc with complex numbers support required.")); + } +#endif template void PetscVector::extract(Scalar *v) const { - int *idx = malloc_with_check(this->size, this); + int *idx = malloc_with_check(this->size); for (unsigned int i = 0; i < this->size; i++) idx[i] = i; vec_get_value(vec, this->size, idx, v); free_with_check(idx); @@ -334,8 +370,8 @@ namespace Hermes template Vector* PetscVector::change_sign() { - PetscScalar* y = malloc_with_check(this->size, this); - int *idx = malloc_with_check(this->size, this); + PetscScalar* y = malloc_with_check(this->size); + int *idx = malloc_with_check(this->size); for (unsigned int i = 0; i < this->size; i++) idx[i] = i; VecGetValues(vec, this->size, idx, y); for (unsigned int i = 0; i < this->size; i++) y[i] *= -1.; @@ -371,8 +407,8 @@ namespace Hermes template Vector* PetscVector::add_vector(Vector* vec) { - assert(this->->get_size() == vec->->get_size()); - for (unsigned int i = 0; i < this->->get_size(); i++) + assert(this->get_size() == vec->get_size()); + for (unsigned int i = 0; i < this->get_size(); i++) this->add(i, vec->get(i)); return this; } @@ -380,7 +416,7 @@ namespace Hermes template Vector* PetscVector::add_vector(Scalar* vec) { - for (unsigned int i = 0; i < this->->get_size(); i++) + for (unsigned int i = 0; i < this->get_size(); i++) this->add(i, vec[i]); return this; } @@ -401,10 +437,10 @@ namespace Hermes */ } - template class HERMES_API PetscMatrix; - template class HERMES_API PetscMatrix >; - template class HERMES_API PetscVector; - template class HERMES_API PetscVector >; + template class HERMES_API PetscMatrix < double > ; + template class HERMES_API PetscMatrix < std::complex > ; + template class HERMES_API PetscVector < double > ; + template class HERMES_API PetscVector < std::complex > ; } namespace Solvers { @@ -412,8 +448,8 @@ namespace Hermes PetscLinearMatrixSolver::PetscLinearMatrixSolver(PetscMatrix *mat, PetscVector *rhs) : DirectSolver(mat, rhs), m(mat), rhs(rhs) { - add_petsc_object(); - } + add_petsc_object(); + } template PetscLinearMatrixSolver::~PetscLinearMatrixSolver() @@ -422,9 +458,9 @@ namespace Hermes } template - bool PetscLinearMatrixSolver::get_matrix_size() + int PetscLinearMatrixSolver::get_matrix_size() { - return m->size(); + return m->get_size(); } template @@ -446,30 +482,30 @@ namespace Hermes VecDuplicate(rhs->vec, &x); ec = KSPSolve(ksp, rhs->vec, x); - if (ec) return false; + //FIXME if (ec) return false; this->tick(); this->time = this->accumulated(); // allocate memory for solution vector free_with_check(this->sln); - this->sln = malloc_with_check(m->size, this); - memset(this->sln, 0, m->size * sizeof(Scalar)); + this->sln = malloc_with_check(m->get_size()); + memset(this->sln, 0, m->get_size() * sizeof(Scalar)); // index map vector (basic serial code uses the map sln[i] = x[i] for all dofs. - int *idx = malloc_with_check(m->size, this); - for (unsigned int i = 0; i < m->size; i++) idx[i] = i; + int *idx = malloc_with_check(m->get_size()); + for (unsigned int i = 0; i < m->get_size(); i++) idx[i] = i; // copy solution to the output solution vector - vec_get_value(x, m->size, idx, this->sln); + vec_get_value(x, m->get_size(), idx, this->sln); free_with_check(idx); - KSPDestroy(ksp); - VecDestroy(x); + KSPDestroy(&ksp); + VecDestroy(&x); } - template class HERMES_API PetscLinearMatrixSolver; - template class HERMES_API PetscLinearMatrixSolver >; + template class HERMES_API PetscLinearMatrixSolver < double > ; + template class HERMES_API PetscLinearMatrixSolver < std::complex > ; } } #endif \ No newline at end of file diff --git a/hermes_common/src/solvers/interfaces/precond_ifpack.cpp b/hermes_common/src/solvers/interfaces/precond_ifpack.cpp index 0a98874b14..e2a2f0d17d 100644 --- a/hermes_common/src/solvers/interfaces/precond_ifpack.cpp +++ b/hermes_common/src/solvers/interfaces/precond_ifpack.cpp @@ -60,13 +60,14 @@ namespace Hermes { this->prec = ipc; this->owner = false; - this->mat = nullptr; // FIXME: take the matrix from ipc + // FIXME: take the matrix from ipc + this->mat = nullptr; } template IfpackPrecond::~IfpackPrecond() { - if(owner) delete prec; + if (owner) delete prec; } template @@ -93,18 +94,18 @@ namespace Hermes EpetraMatrix *mt = static_cast *>(m); assert(mt != nullptr); mat = mt; - if(strcmp(cls, "point-relax") == 0) + if (strcmp(cls, "point-relax") == 0) { create_point_relax(mat, type); apply_params(); initialize(); } - else if(strcmp(cls, "block-relax") == 0) + else if (strcmp(cls, "block-relax") == 0) { create_block_relax(mat, type); apply_params(); } - else if(strcmp(cls, "add-schwartz") == 0) + else if (strcmp(cls, "add-schwartz") == 0) { create_add_schwartz(mat, type, overlap); apply_params(); @@ -128,7 +129,8 @@ namespace Hermes Ifpack_Partitioner *partitioner = new Ifpack_GreedyPartitioner(graph); Teuchos::ParameterList list; - list.set("partitioner: local parts", 1000); //\todo parametrize me + //\todo parametrize me + list.set("partitioner: local parts", 1000); partitioner->SetParameters(list); partitioner->Compute(); @@ -141,19 +143,19 @@ namespace Hermes template void IfpackPrecond::create_add_schwartz(EpetraMatrix *a, const char *name, int overlap) { - if(strcasecmp(name, "ilu") == 0) + if (strcasecmp(name, "ilu") == 0) { prec = new Ifpack_AdditiveSchwarz(a->mat, overlap); } - else if(strcasecmp(name, "ilut") == 0) + else if (strcasecmp(name, "ilut") == 0) { prec = new Ifpack_AdditiveSchwarz(a->mat, overlap); } - else if(strcasecmp(name, "ic") == 0) + else if (strcasecmp(name, "ic") == 0) { prec = new Ifpack_AdditiveSchwarz(a->mat, overlap); } - else if(strcasecmp(name, "ict") == 0) + else if (strcasecmp(name, "ict") == 0) { prec = new Ifpack_AdditiveSchwarz(a->mat, overlap); } @@ -205,8 +207,8 @@ namespace Hermes { return mat->mat->OperatorRangeMap(); } - template class HERMES_API IfpackPrecond; - template class HERMES_API IfpackPrecond >; + template class HERMES_API IfpackPrecond < double > ; + template class HERMES_API IfpackPrecond < std::complex > ; } } #endif \ No newline at end of file diff --git a/hermes_common/src/solvers/interfaces/precond_ml.cpp b/hermes_common/src/solvers/interfaces/precond_ml.cpp index 52e7faf6db..fcd857059b 100644 --- a/hermes_common/src/solvers/interfaces/precond_ml.cpp +++ b/hermes_common/src/solvers/interfaces/precond_ml.cpp @@ -30,9 +30,9 @@ namespace Hermes this->owner = true; this->mat = nullptr; - if(strcmp(type, "sa") == 0) ML_Epetra::SetDefaults("SA", mlist); - else if(strcmp(type, "nssa") == 0) ML_Epetra::SetDefaults("NSSA", mlist); - else if(strcmp(type, "dd") == 0) ML_Epetra::SetDefaults("DD", mlist); + if (strcmp(type, "sa") == 0) ML_Epetra::SetDefaults("SA", mlist); + else if (strcmp(type, "nssa") == 0) ML_Epetra::SetDefaults("NSSA", mlist); + else if (strcmp(type, "dd") == 0) ML_Epetra::SetDefaults("DD", mlist); } template @@ -40,13 +40,14 @@ namespace Hermes { this->prec = mpc; this->owner = false; - this->mat = nullptr; // FIXME: get the matrix from mpc + // FIXME: get the matrix from mpc + this->mat = nullptr; } template MlPrecond::~MlPrecond() { - if(owner) delete prec; + if (owner) delete prec; } template @@ -136,8 +137,8 @@ namespace Hermes { return mat->mat->OperatorRangeMap(); } - template class HERMES_API MlPrecond; - template class HERMES_API MlPrecond >; + template class HERMES_API MlPrecond < double > ; + template class HERMES_API MlPrecond < std::complex > ; } } #endif \ No newline at end of file diff --git a/hermes_common/src/solvers/interfaces/superlu_solver.cpp b/hermes_common/src/solvers/interfaces/superlu_solver.cpp index d83687f3bc..ad46ba92e3 100644 --- a/hermes_common/src/solvers/interfaces/superlu_solver.cpp +++ b/hermes_common/src/solvers/interfaces/superlu_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -33,80 +33,80 @@ namespace Hermes template <> void SuperLu::sequ(SuperMatrix *A, double *r, double *c, double *rowcnd, double *colcnd, double *amax, int *info) { - dsequ (A, r, c, rowcnd, colcnd, amax, info); + dsequ(A, r, c, rowcnd, colcnd, amax, info); } template <> - void SuperLu::laqgs (SuperMatrix *A, float *r, float *c, float rowcnd, float colcnd, float amax, char *equed) + void SuperLu::laqgs(SuperMatrix *A, float *r, float *c, float rowcnd, float colcnd, float amax, char *equed) { - dlaqgs (A, r, c, rowcnd, colcnd, amax, equed); + dlaqgs(A, r, c, rowcnd, colcnd, amax, equed); } template <> - int SuperLu::gstrf (superlu_options_t *options, int m, int n, double anorm, LUstruct_t *LUstruct, gridinfo_t *grid, SuperLUStat_t *stat, int *info) + int SuperLu::gstrf(superlu_options_t *options, int m, int n, double anorm, LUstruct_t *LUstruct, gridinfo_t *grid, SuperLUStat_t *stat, int *info) { - return dgstrf (options, m, n, anorm, LUstruct, grid, stat, info); + return dgstrf(options, m, n, anorm, LUstruct, grid, stat, info); } template <> - float SuperLu::pivotGrowth (int ncols, SuperMatrix *A, int *perm_c, SuperMatrix *L, SuperMatrix *U) + float SuperLu::pivotGrowth(int ncols, SuperMatrix *A, int *perm_c, SuperMatrix *L, SuperMatrix *U) { - return dPivotGrowth (ncols, A, perm_c, L, U); + return dPivotGrowth(ncols, A, perm_c, L, U); } template <> - float SuperLu::langs (char *norm, SuperMatrix *A) + float SuperLu::langs(char *norm, SuperMatrix *A) { - return dlangs (norm, A); + return dlangs(norm, A); } template <> - void SuperLu::gscon (char *norm, SuperMatrix *L, SuperMatrix *U, float anorm, float *rcond, SuperLUStat_t *stat, int *info) + void SuperLu::gscon(char *norm, SuperMatrix *L, SuperMatrix *U, float anorm, float *rcond, SuperLUStat_t *stat, int *info) { - dgscon (norm, L, U, anorm, rcond, stat, info); + dgscon(norm, L, U, anorm, rcond, stat, info); } template <> - void SuperLu::gstrs (trans_t trans, SuperMatrix *L, SuperMatrix *U, int *perm_c, int *perm_r, SuperMatrix *B, SuperLUStat_t *stat, int *info) + void SuperLu::gstrs(trans_t trans, SuperMatrix *L, SuperMatrix *U, int *perm_c, int *perm_r, SuperMatrix *B, SuperLUStat_t *stat, int *info) { - dgstrs (trans, L, U, perm_c, perm_r, B, stat, info); + dgstrs(trans, L, U, perm_c, perm_r, B, stat, info); } template <> - double SuperLu::lamch_ (char *cmach) + double SuperLu::lamch_(char *cmach) { - return dlamch_ (cmach); + return dlamch_(cmach); } template <> - int SuperLu::querySpace (SuperMatrix *a, SuperMatrix *b, mem_usage_t *mu) + int SuperLu::querySpace(SuperMatrix *a, SuperMatrix *b, mem_usage_t *mu) { - return dquerySpace (a, b, mu); + return dquerySpace(a, b, mu); } #endif template bool SuperLUSolver::check_status(unsigned int info) { - if(info == 0) + if (info == 0) { // Success. return true; } - else if(info <= m->get_size()) + else if (info <= m->get_size()) { this->warn("SuperLU: Factor U is singular, solution could not be computed."); return false; } - else if(info == m->get_size() + 1) + else if (info == m->get_size() + 1) { this->warn("SuperLU: RCOND is less than machine precision " "(system matrix is singular to working precision)."); return true; } - else if(info > m->get_size() + 1) + else if (info > m->get_size() + 1) { this->warn("SuperLU: Not enough memory.\n Failure when %.3f MB were allocated.", - (info - m->get_size())/1e6); + (info - m->get_size()) / 1e6); return false; } @@ -118,56 +118,65 @@ namespace Hermes : DirectSolver(m, rhs), m(m), rhs(rhs), local_Ai(nullptr), local_Ap(nullptr) , local_Ax(nullptr), local_rhs(nullptr) { - R = nullptr; - C = nullptr; - perm_r = nullptr; - perm_c = nullptr; - etree = nullptr; + R = nullptr; + C = nullptr; + perm_r = nullptr; + perm_c = nullptr; + etree = nullptr; #ifndef SLU_MT - *equed = '\0'; + *equed = '\0'; #endif - // Set the default input options: + // Set the default input options: #ifdef SLU_MT - // I am not sure if this will work well on Windows: - // http://stackoverflow.com/questions/631664/accessing-environment-variables-in-c - char *nt_var = getenv("OMP_NUM_THREADS"); - if(nt_var) - options.nprocs = std::max(1, atoi(nt_var)); - else - options.nprocs = 1; - - options.fact = EQUILIBRATE; // Rescale the matrix if neccessary. - options.trans = NOTRANS; // Not solving the transposed problem. - options.refact = NO; // Factorize from scratch for the first time. - options.diag_pivot_thresh = 1.0; // Use partial pivoting during GEM. - options.usepr = NO; // Let SuperLU compute the row permutations. - options.drop_tol = 0.0; // Not yet implemented in SuperLU_MT 2.0. - options.SymmetricMode = NO; // Assume general non-symmetric problem. - - // Default options related to the supernodal algorithm. - options.panel_size = sp_ienv(1); - options.relax = sp_ienv(2); + // I am not sure if this will work well on Windows: + // http://stackoverflow.com/questions/631664/accessing-environment-variables-in-c + char *nt_var = getenv("OMP_NUM_THREADS"); + if (nt_var) + options.nprocs = std::max(1, atoi(nt_var)); + else + options.nprocs = 1; + + // Rescale the matrix if neccessary. + options.fact = EQUILIBRATE; + // Not solving the transposed problem. + options.trans = NOTRANS; + // Factorize from scratch for the first time. + options.refact = NO; + // Use partial pivoting during GEM. + options.diag_pivot_thresh = 1.0; + // Let SuperLU compute the row permutations. + options.usepr = NO; + // Not yet implemented in SuperLU_MT 2.0. + options.drop_tol = 0.0; + // Assume general non-symmetric problem. + options.SymmetricMode = NO; + + // Default options related to the supernodal algorithm. + options.panel_size = sp_ienv(1); + options.relax = sp_ienv(2); #else - /* - options.Fact = DOFACT; - options.Equil = YES; - options.ColPerm = COLAMD; - options.DiagPivotThresh = 1.0; - options.Trans = NOTRANS; - options.IterRefine = NOREFINE; - options.SymmetricMode = NO; - options.PivotGrowth = NO; - options.ConditionNumber = NO; - options.PrintStat = YES; - */ - set_default_options(&options); // This function is only present in the sequential SLU. + /* + options.Fact = DOFACT; + options.Equil = YES; + options.ColPerm = COLAMD; + options.DiagPivotThresh = 1.0; + options.Trans = NOTRANS; + options.IterRefine = NOREFINE; + options.SymmetricMode = NO; + options.PivotGrowth = NO; + options.ConditionNumber = NO; + options.PrintStat = YES; + */ + // This function is only present in the sequential SLU. + set_default_options(&options); #endif - options.PrintStat = YES; // Set to NO to suppress output. + // Set to NO to suppress output. + options.PrintStat = YES; - has_A = has_B = inited = false; - } + has_A = has_B = inited = false; + } inline SuperLuType >::Scalar to_superlu(SuperLuType >::Scalar &a, std::complexb) { @@ -208,35 +217,42 @@ namespace Hermes // Prepare data structures serving as input for the solver driver // (according to the chosen factorization reuse strategy). - void *work = nullptr; // Explicit pointer to the factorization workspace + // Explicit pointer to the factorization workspace + void *work = nullptr; // (unused, see below). - int lwork = 0; // Space for the factorization will be allocated + // Space for the factorization will be allocated + int lwork = 0; // internally by system malloc. - double ferr = 1.0; // Estimated relative forward error + // Estimated relative forward error + double ferr = 1.0; // (unused unless iterative refinement is performed). - double berr = 1.0; // Estimated relative backward error + // Estimated relative backward error + double berr = 1.0; // (unused unless iterative refinement is performed). - slu_memusage_t memusage; // Record the memory usage statistics. - double rpivot_growth; // The reciprocal pivot growth factor. - double rcond; // The estimate of the reciprocal condition number. + // Record the memory usage statistics. + slu_memusage_t memusage; + // The reciprocal pivot growth factor. + double rpivot_growth; + // The estimate of the reciprocal condition number. + double rcond; #ifdef SLU_MT options.work = work; options.lwork = lwork; #endif - if( !setup_factorization() ) + if (!setup_factorization()) throw Exceptions::Exception("SuperLU: LU factorization could not be completed."); // If the previous factorization of A is to be fully reused as an input for the solver driver, // keep the (possibly rescaled) matrix from the last factorization, otherwise recreate it // from the master CSCMatrix pointed to by this->m (this also applies to the case when // A does not yet exist). - if(!has_A || this->reuse_scheme != HERMES_REUSE_MATRIX_STRUCTURE_COMPLETELY) + if (!has_A || this->reuse_scheme != HERMES_REUSE_MATRIX_STRUCTURE_COMPLETELY) { - if(A_changed) + if (A_changed) free_matrix(); - if(!has_A) + if (!has_A) { // A will be created from the local copy of the value and index arrays, because these // may be modified by the solver driver. @@ -250,7 +266,7 @@ namespace Hermes free_with_check(local_Ax); local_Ax = malloc_with_check, typename SuperLuType::Scalar>(m->get_nnz(), this); - for (unsigned int i = 0;iget_nnz();i++) + for (unsigned int i = 0; i < m->get_nnz(); i++) to_superlu(local_Ax[i], m->get_Ax()[i]); // Create new_ general (non-symmetric), column-major, non-supernodal, size X size matrix. @@ -265,7 +281,7 @@ namespace Hermes free_with_check(local_rhs); local_rhs = malloc_with_check, typename SuperLuType::Scalar>(rhs->get_size(), this); - for (unsigned int i = 0;iget_size();i++) + for (unsigned int i = 0; i < rhs->get_size(); i++) to_superlu(local_rhs[i], rhs->v[i]); create_dense_matrix(&B, rhs->get_size(), 1, local_rhs, rhs->get_size(), SLU_DN, SLU_DTYPE, SLU_GE); @@ -281,7 +297,7 @@ namespace Hermes int info; #ifdef SLU_MT - if(options.refact == NO) + if (options.refact == NO) { // Get column permutation vector perm_c[], according to the first argument: // 0: natural ordering @@ -306,9 +322,9 @@ namespace Hermes // Estimate reciprocal condition number of A and solve the system. If A is singular, info // will be set to A->ncol + 1. // - slu_mt_solver_driver( &options, &A, perm_c, perm_r, &AC, &equed, R, C, + slu_mt_solver_driver(&options, &A, perm_c, perm_r, &AC, &equed, R, C, &L, &U, &B, &X, nullptr, &rcond, nullptr, nullptr, - &stat, nullptr, &info ); + &stat, nullptr, &info); // ... OR ... @@ -337,19 +353,19 @@ namespace Hermes bool factorized = check_status(info); - if(factorized) + if (factorized) { free_with_check(this->sln); this->sln = malloc_with_check, Scalar>(m->get_size(), this); - Scalar *sol = (Scalar*) ((DNformat*) X.Store)->nzval; + Scalar *sol = (Scalar*)((DNformat*)X.Store)->nzval; for (unsigned int i = 0; i < rhs->get_size(); i++) this->sln[i] = sol[i]; } // If required, print statistics. - if( options.PrintStat ) + if (options.PrintStat) SLU_PRINT_STAT(&stat); // Free temporary local variables. @@ -361,7 +377,7 @@ namespace Hermes this->tick(); this->time = this->accumulated(); - if(!factorized) + if (!factorized) throw Exceptions::LinearMatrixSolverException("SuperLU failed."); } @@ -369,7 +385,7 @@ namespace Hermes bool SuperLUSolver::setup_factorization() { unsigned int A_size = A.nrow < 0 ? 0 : A.nrow; - if(has_A && this->reuse_scheme != HERMES_CREATE_STRUCTURE_FROM_SCRATCH && A_size != m->get_size()) + if (has_A && this->reuse_scheme != HERMES_CREATE_STRUCTURE_FROM_SCRATCH && A_size != m->get_size()) { this->warn("You cannot reuse factorization structures for factorizing matrices of different sizes."); return false; @@ -377,7 +393,7 @@ namespace Hermes // Always factorize from scratch for the first time. int eff_fact_scheme; - if(!inited) + if (!inited) eff_fact_scheme = HERMES_CREATE_STRUCTURE_FROM_SCRATCH; else eff_fact_scheme = this->reuse_scheme; @@ -401,15 +417,15 @@ namespace Hermes free_factorization_data(); // Allocate the row/column reordering vectors. - if( !(perm_c = intMalloc(m->get_size())) ) + if (!(perm_c = intMalloc(m->get_size()))) throw Hermes::Exceptions::Exception("Malloc fails for perm_c[]."); - if( !(perm_r = intMalloc(m->get_size())) ) + if (!(perm_r = intMalloc(m->get_size()))) throw Hermes::Exceptions::Exception("Malloc fails for perm_r[]."); // Allocate vectors with row/column scaling factors. - if( !(R = (double *) SUPERLU_MALLOC(m->get_size() * sizeof(double))) ) + if (!(R = (double *)SUPERLU_MALLOC(m->get_size() * sizeof(double)))) throw Hermes::Exceptions::Exception("SUPERLU_MALLOC fails for R[]."); - if( !(C = (double *) SUPERLU_MALLOC(m->get_size() * sizeof(double))) ) + if (!(C = (double *)SUPERLU_MALLOC(m->get_size() * sizeof(double)))) throw Hermes::Exceptions::Exception("SUPERLU_MALLOC fails for C[]."); #ifdef SLU_MT @@ -420,7 +436,7 @@ namespace Hermes #else // Allocate additional structures used by the driver routine of sequential SuperLU. // Elimination tree is contained in the options structure in SuperLU_MT. - if( !(etree = intMalloc(m->get_size())) ) + if (!(etree = intMalloc(m->get_size()))) throw Hermes::Exceptions::Exception("Malloc fails for etree[]."); options.Fact = DOFACT; @@ -472,7 +488,7 @@ namespace Hermes template void SuperLUSolver::free_matrix() { - if(has_A) + if (has_A) { Destroy_SuperMatrix_Store(&A); has_A = false; @@ -482,14 +498,13 @@ namespace Hermes template void SuperLUSolver::free_rhs() { - if(has_B) + if (has_B) { Destroy_SuperMatrix_Store(&B); has_B = false; } } - template void SuperLUSolver::free() { @@ -506,7 +521,7 @@ namespace Hermes template void SuperLUSolver::free_factorization_data() { - if(inited) + if (inited) { #ifdef SLU_MT SUPERLU_FREE(options.etree); @@ -514,12 +529,12 @@ namespace Hermes SUPERLU_FREE(options.part_super_h); Destroy_CompCol_Permuted(&AC); #else - SUPERLU_FREE (etree); + SUPERLU_FREE(etree); #endif - SUPERLU_FREE (perm_c); - SUPERLU_FREE (perm_r); - SUPERLU_FREE (R); - SUPERLU_FREE (C); + SUPERLU_FREE(perm_c); + SUPERLU_FREE(perm_r); + SUPERLU_FREE(R); + SUPERLU_FREE(C); SLU_DESTROY_L(&L); SLU_DESTROY_U(&U); inited = false; @@ -573,17 +588,17 @@ namespace Hermes int colequ, rowequ; /* Right hand side and solution vectors. */ - DNformat *Bstore = (DNformat*) B->Store; - DNformat *Xstore = (DNformat*) X->Store; - Scalar *Bmat = (Scalar*) Bstore->nzval; - Scalar *Xmat = (Scalar*) Xstore->nzval; + DNformat *Bstore = (DNformat*)B->Store; + DNformat *Xstore = (DNformat*)X->Store; + Scalar *Bmat = (Scalar*)Bstore->nzval; + Scalar *Xmat = (Scalar*)Xstore->nzval; *info = 0; /* ------------------------------------------------------------ Diagonal scaling to equilibrate the matrix. ------------------------------------------------------------*/ - if(dofact || equil) + if (dofact || equil) { *equed = NOEQUIL; rowequ = colequ = FALSE; @@ -594,7 +609,7 @@ namespace Hermes colequ = (*equed == COL) || (*equed == BOTH); } - if( equil ) + if (equil) { t0 = SuperLU_timer_(); /* Compute row and column scalings to equilibrate the matrix A. */ @@ -602,7 +617,7 @@ namespace Hermes double rowcnd, colcnd, amax; SLU_GSEQU(A, R, C, &rowcnd, &colcnd, &amax, &info1); - if( info1 == 0 ) + if (info1 == 0) { /* Equilibrate matrix A. */ SLU_LAQGS(A, R, C, rowcnd, colcnd, amax, equed); @@ -615,13 +630,13 @@ namespace Hermes /* ------------------------------------------------------------ Scale the right hand side. ------------------------------------------------------------*/ - if( notran ) + if (notran) { - if( rowequ ) - for (int i = 0; i < A->nrow; ++i) - SLU_MULT(Bmat[i], R[i]); + if (rowequ) + for (int i = 0; i < A->nrow; ++i) + SLU_MULT(Bmat[i], R[i]); } - else if( colequ ) + else if (colequ) { for (int i = 0; i < A->nrow; ++i) SLU_MULT(Bmat[i], C[i]); @@ -630,11 +645,11 @@ namespace Hermes /* ------------------------------------------------------------ Perform the LU factorization. ------------------------------------------------------------*/ - if( dofact || equil ) + if (dofact || equil) { /* Obtain column etree, the column count (colcnt_h) and supernode partition (part_super_h) for the Householder matrix. */ - if(options->refact == NO) + if (options->refact == NO) { t0 = SuperLU_timer_(); SLU_SP_COLORDER(A, perm_c, options, AC); @@ -650,21 +665,21 @@ namespace Hermes for (int i = 0; i < options->nprocs; ++i) flopcnt += stat->procstat[i].fcops; stat->ops[FACT] = flopcnt; - if( options->lwork == -1 ) + if (options->lwork == -1) { - if(memusage) + if (memusage) memusage->total_needed = *info - A->ncol; return; } } - if( *info > 0 ) + if (*info > 0) { - if( *info <= A->ncol ) + if (*info <= A->ncol) { /* Compute the reciprocal pivot growth factor of the leading rank-deficient *info columns of A. */ - if(recip_pivot_growth) + if (recip_pivot_growth) *recip_pivot_growth = SLU_PIVOT_GROWTH(*info, A, perm_c, L, U); } } @@ -673,13 +688,13 @@ namespace Hermes /* ------------------------------------------------------------ Compute the reciprocal pivot growth factor *recip_pivot_growth. ------------------------------------------------------------*/ - if(recip_pivot_growth) + if (recip_pivot_growth) *recip_pivot_growth = SLU_PIVOT_GROWTH(A->ncol, A, perm_c, L, U); /* ------------------------------------------------------------ Estimate the reciprocal of the condition number of A. ------------------------------------------------------------*/ - if(rcond) + if (rcond) { t0 = SuperLU_timer_(); @@ -708,7 +723,7 @@ namespace Hermes Use iterative refinement to improve the computed solution and compute error bounds and backward error estimates for it. ------------------------------------------------------------*/ - if(ferr && berr) + if (ferr && berr) { t0 = SuperLU_timer_(); SLU_GSRFS(options->trans, A, L, U, perm_r, perm_c, *equed, @@ -720,13 +735,13 @@ namespace Hermes Transform the solution matrix X to a solution of the original system. ------------------------------------------------------------*/ - if( notran ) + if (notran) { - if( colequ ) - for (int i = 0; i < A->nrow; ++i) - SLU_MULT(Xmat[i], C[i]); + if (colequ) + for (int i = 0; i < A->nrow; ++i) + SLU_MULT(Xmat[i], C[i]); } - else if( rowequ ) + else if (rowequ) { for (int i = 0; i < A->nrow; ++i) SLU_MULT(Xmat[i], R[i]); @@ -735,16 +750,16 @@ namespace Hermes /* Set INFO = A->ncol + 1 if the matrix is singular to working precision.*/ char param[1]; param[0] = 'E'; - if( rcond && *rcond < SLU_LAMCH_(param) ) *info = A->ncol + 1; + if (rcond && *rcond < SLU_LAMCH_(param)) *info = A->ncol + 1; } - if(memusage) + if (memusage) SLU_QUERY_SPACE(options->nprocs, L, U, options->panel_size, memusage); } #endif - template class HERMES_API SuperLUSolver; - template class HERMES_API SuperLUSolver >; + template class HERMES_API SuperLUSolver < double > ; + template class HERMES_API SuperLUSolver < std::complex > ; } } #endif \ No newline at end of file diff --git a/hermes_common/src/solvers/interfaces/superlu_solver_cplx.cpp b/hermes_common/src/solvers/interfaces/superlu_solver_cplx.cpp index c39837ac05..6492cf89ed 100644 --- a/hermes_common/src/solvers/interfaces/superlu_solver_cplx.cpp +++ b/hermes_common/src/solvers/interfaces/superlu_solver_cplx.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -30,27 +30,27 @@ namespace Hermes namespace Solvers { template <> - void SuperLUSolver >::create_csc_matrix (SuperMatrix *A, int m, int n, int nnz, + void SuperLUSolver >::create_csc_matrix(SuperMatrix *A, int m, int n, int nnz, SuperLuType >::Scalar *nzval, int *rowind, int *colptr, Stype_t stype, Dtype_t dtype, Mtype_t mtype) { - zCreate_CompCol_Matrix (A, m, n, nnz, (doublecomplex*) nzval, rowind, colptr, stype, dtype, mtype); + zCreate_CompCol_Matrix(A, m, n, nnz, (doublecomplex*)nzval, rowind, colptr, stype, dtype, mtype); } template<> - void SuperLUSolver >::create_dense_matrix (SuperMatrix *X, int m, int n, SuperLuType >::Scalar *x, + void SuperLUSolver >::create_dense_matrix(SuperMatrix *X, int m, int n, SuperLuType >::Scalar *x, int ldx, Stype_t stype, Dtype_t dtype, Mtype_t mtype) { - zCreate_Dense_Matrix (X, m, n, (doublecomplex *) x, ldx, stype, dtype, mtype); + zCreate_Dense_Matrix(X, m, n, (doublecomplex *)x, ldx, stype, dtype, mtype); } template <> - void SuperLUSolver >::solver_driver (superlu_options_t *options, SuperMatrix *A, int *perm_c, int *perm_r, int *etree, char *equed, double *R, + void SuperLUSolver >::solver_driver(superlu_options_t *options, SuperMatrix *A, int *perm_c, int *perm_r, int *etree, char *equed, double *R, double *C, SuperMatrix *L, SuperMatrix *U, void *work, int lwork, SuperMatrix *B, SuperMatrix *X, double *recip_pivot_growth, double *rcond, double *ferr, double *berr, slu_memusage_t *mem_usage, SuperLUStat_t *stat, int *info) { - zgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work, lwork, B, X, recip_pivot_growth, rcond, ferr, berr, (mem_usage_t*) mem_usage, stat, info); + zgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work, lwork, B, X, recip_pivot_growth, rcond, ferr, berr, (mem_usage_t*)mem_usage, stat, info); } } } diff --git a/hermes_common/src/solvers/interfaces/superlu_solver_real.cpp b/hermes_common/src/solvers/interfaces/superlu_solver_real.cpp index 12729c6b4f..f9b360f32f 100644 --- a/hermes_common/src/solvers/interfaces/superlu_solver_real.cpp +++ b/hermes_common/src/solvers/interfaces/superlu_solver_real.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -30,26 +30,26 @@ namespace Hermes namespace Solvers { template <> - void SuperLUSolver::solver_driver (superlu_options_t *options, SuperMatrix *A, int *perm_c, int *perm_r, int *etree, char *equed, double *R, + void SuperLUSolver::solver_driver(superlu_options_t *options, SuperMatrix *A, int *perm_c, int *perm_r, int *etree, char *equed, double *R, double *C, SuperMatrix *L, SuperMatrix *U, void *work, int lwork, SuperMatrix *B, SuperMatrix *X, double *recip_pivot_growth, double *rcond, double *ferr, double *berr, slu_memusage_t *mem_usage, SuperLUStat_t *stat, int *info) { - dgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work, lwork, B, X, recip_pivot_growth, rcond, ferr, berr, (mem_usage_t*) mem_usage, stat, info); + dgssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work, lwork, B, X, recip_pivot_growth, rcond, ferr, berr, (mem_usage_t*)mem_usage, stat, info); } template <> - void SuperLUSolver::create_csc_matrix (SuperMatrix *A, int m, int n, int nnz, SuperLuType::Scalar *nzval, + void SuperLUSolver::create_csc_matrix(SuperMatrix *A, int m, int n, int nnz, SuperLuType::Scalar *nzval, int *rowind, int *colptr, Stype_t stype, Dtype_t dtype, Mtype_t mtype) { - dCreate_CompCol_Matrix (A, m, n, nnz, nzval, rowind, colptr, stype, dtype, mtype); + dCreate_CompCol_Matrix(A, m, n, nnz, nzval, rowind, colptr, stype, dtype, mtype); } template<> - void SuperLUSolver::create_dense_matrix (SuperMatrix *X, int m, int n, SuperLuType::Scalar *x, + void SuperLUSolver::create_dense_matrix(SuperMatrix *X, int m, int n, SuperLuType::Scalar *x, int ldx, Stype_t stype, Dtype_t dtype, Mtype_t mtype) { - dCreate_Dense_Matrix (X, m, n, (double*) x, ldx, stype, dtype, mtype); + dCreate_Dense_Matrix(X, m, n, (double*)x, ldx, stype, dtype, mtype); } } } diff --git a/hermes_common/src/solvers/interfaces/umfpack_solver.cpp b/hermes_common/src/solvers/interfaces/umfpack_solver.cpp index cb496cd797..e025e88c81 100644 --- a/hermes_common/src/solvers/interfaces/umfpack_solver.cpp +++ b/hermes_common/src/solvers/interfaces/umfpack_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -47,8 +47,8 @@ namespace Hermes UMFPackLinearMatrixSolver::UMFPackLinearMatrixSolver(CSCMatrix *m, SimpleVector *rhs) : DirectSolver(m, rhs), m(m), rhs(rhs), symbolic(nullptr), numeric(nullptr) { - umfpack_di_defaults(Control); - } + umfpack_di_defaults(Control); + } template UMFPackLinearMatrixSolver::~UMFPackLinearMatrixSolver() @@ -74,8 +74,6 @@ namespace Hermes // Perform both factorization phases for the first time. if (reuse_scheme != HERMES_CREATE_STRUCTURE_FROM_SCRATCH && symbolic == nullptr && numeric == nullptr) reuse_scheme = HERMES_CREATE_STRUCTURE_FROM_SCRATCH; - else - reuse_scheme = reuse_scheme; int status; switch (reuse_scheme) @@ -254,8 +252,8 @@ namespace Hermes return to_return; } - template class HERMES_API UMFPackLinearMatrixSolver; - template class HERMES_API UMFPackLinearMatrixSolver >; + template class HERMES_API UMFPackLinearMatrixSolver < double > ; + template class HERMES_API UMFPackLinearMatrixSolver < std::complex > ; } } -#endif +#endif \ No newline at end of file diff --git a/hermes_common/src/solvers/linear_matrix_solver.cpp b/hermes_common/src/solvers/linear_matrix_solver.cpp index e56ac1a090..6a3b9a233a 100644 --- a/hermes_common/src/solvers/linear_matrix_solver.cpp +++ b/hermes_common/src/solvers/linear_matrix_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -164,7 +164,6 @@ namespace Hermes } } - template ExternalSolver* static_create_external_solver(CSCMatrix *m, SimpleVector *rhs) { @@ -173,9 +172,9 @@ namespace Hermes } template<> - ExternalSolver::creation ExternalSolver::create_external_solver = static_create_external_solver; + ExternalSolver::creation ExternalSolver::create_external_solver = static_create_external_solver < double > ; template<> - ExternalSolver >::creation ExternalSolver >::create_external_solver = static_create_external_solver >; + ExternalSolver >::creation ExternalSolver >::create_external_solver = static_create_external_solver < std::complex > ; template<> HERMES_API LinearMatrixSolver* create_linear_solver(Matrix* matrix, Vector* rhs, bool use_direct_solver) @@ -185,96 +184,96 @@ namespace Hermes { case Hermes::SOLVER_EXTERNAL: { - if (rhs != nullptr) - return ExternalSolver::create_external_solver(static_cast*>(matrix), static_cast*>(rhs)); - else - return ExternalSolver::create_external_solver(static_cast*>(matrix), static_cast*>(rhs_dummy)); + if (rhs != nullptr) + return ExternalSolver::create_external_solver(static_cast*>(matrix), static_cast*>(rhs)); + else + return ExternalSolver::create_external_solver(static_cast*>(matrix), static_cast*>(rhs_dummy)); } case Hermes::SOLVER_AZTECOO: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); #if defined HAVE_AZTECOO && defined HAVE_EPETRA - if (rhs != nullptr) return new AztecOOSolver(static_cast*>(matrix), static_cast*>(rhs)); - else return new AztecOOSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); + if (rhs != nullptr) return new AztecOOSolver(static_cast*>(matrix), static_cast*>(rhs)); + else return new AztecOOSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("AztecOO not installed."); + throw Hermes::Exceptions::Exception("AztecOO not installed."); #endif - break; + break; } case Hermes::SOLVER_AMESOS: { #if defined HAVE_AMESOS && defined HAVE_EPETRA - if (rhs != nullptr) return new AmesosSolver("Amesos_Klu", static_cast*>(matrix), static_cast*>(rhs)); - else return new AmesosSolver("Amesos_Klu", static_cast*>(matrix), static_cast*>(rhs_dummy)); + if (rhs != nullptr) return new AmesosSolver("Amesos_Klu", static_cast*>(matrix), static_cast*>(rhs)); + else return new AmesosSolver("Amesos_Klu", static_cast*>(matrix), static_cast*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("Amesos not installed."); + throw Hermes::Exceptions::Exception("Amesos not installed."); #endif - break; + break; } case Hermes::SOLVER_MUMPS: { #ifdef WITH_MUMPS - if (rhs != nullptr) return new MumpsSolver(static_cast*>(matrix), static_cast*>(rhs)); - else return new MumpsSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); + if (rhs != nullptr) return new MumpsSolver(static_cast*>(matrix), static_cast*>(rhs)); + else return new MumpsSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("MUMPS was not installed."); + throw Hermes::Exceptions::Exception("MUMPS was not installed."); #endif - break; + break; } case Hermes::SOLVER_PETSC: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); #ifdef WITH_PETSC - if (rhs != nullptr) return new PetscLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs)); - else return new PetscLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); + if (rhs != nullptr) return new PetscLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs)); + else return new PetscLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("PETSc not installed."); + throw Hermes::Exceptions::Exception("PETSc not installed."); #endif - break; + break; } case Hermes::SOLVER_UMFPACK: { #ifdef WITH_UMFPACK - if (rhs != nullptr) return new UMFPackLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs)); - else return new UMFPackLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); + if (rhs != nullptr) return new UMFPackLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs)); + else return new UMFPackLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("UMFPACK was not installed."); + throw Hermes::Exceptions::Exception("UMFPACK was not installed."); #endif - break; + break; } case Hermes::SOLVER_PARALUTION_ITERATIVE: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); #ifdef WITH_PARALUTION - return new IterativeParalutionLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs)); + return new IterativeParalutionLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs)); #else - throw Hermes::Exceptions::Exception("PARALUTION was not installed."); + throw Hermes::Exceptions::Exception("PARALUTION was not installed."); #endif - break; + break; } case Hermes::SOLVER_PARALUTION_AMG: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The AMG solver PARALUTION selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The AMG solver PARALUTION selected as a direct solver."); #ifdef WITH_PARALUTION - return new AMGParalutionLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs)); + return new AMGParalutionLinearMatrixSolver(static_cast*>(matrix), static_cast*>(rhs)); #else - throw Hermes::Exceptions::Exception("PARALUTION was not installed."); + throw Hermes::Exceptions::Exception("PARALUTION was not installed."); #endif - break; + break; } case Hermes::SOLVER_SUPERLU: { #ifdef WITH_SUPERLU - if (rhs != nullptr) return new SuperLUSolver(static_cast*>(matrix), static_cast*>(rhs)); - else return new SuperLUSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); + if (rhs != nullptr) return new SuperLUSolver(static_cast*>(matrix), static_cast*>(rhs)); + else return new SuperLUSolver(static_cast*>(matrix), static_cast*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("SuperLU was not installed."); + throw Hermes::Exceptions::Exception("SuperLU was not installed."); #endif - break; + break; } default: throw Hermes::Exceptions::Exception("Unknown matrix solver requested in create_linear_solver()."); @@ -290,86 +289,86 @@ namespace Hermes { case Hermes::SOLVER_EXTERNAL: { - if (rhs != nullptr) - return ExternalSolver >::create_external_solver(static_cast >*>(matrix), static_cast >*>(rhs)); - else - return ExternalSolver >::create_external_solver(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); + if (rhs != nullptr) + return ExternalSolver >::create_external_solver(static_cast >*>(matrix), static_cast >*>(rhs)); + else + return ExternalSolver >::create_external_solver(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); } case Hermes::SOLVER_AZTECOO: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver AztecOO selected as a direct solver."); #if defined HAVE_AZTECOO && defined HAVE_EPETRA - if (rhs != nullptr) return new AztecOOSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); - else return new AztecOOSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); + if (rhs != nullptr) return new AztecOOSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); + else return new AztecOOSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("AztecOO not installed."); + throw Hermes::Exceptions::Exception("AztecOO not installed."); #endif - break; + break; } case Hermes::SOLVER_AMESOS: { #if defined HAVE_AMESOS && defined HAVE_EPETRA - if (rhs != nullptr) return new AmesosSolver >("Amesos_Klu", static_cast >*>(matrix), static_cast >*>(rhs)); - else return new AmesosSolver >("Amesos_Klu", static_cast >*>(matrix), static_cast >*>(rhs_dummy)); + if (rhs != nullptr) return new AmesosSolver >("Amesos_Klu", static_cast >*>(matrix), static_cast >*>(rhs)); + else return new AmesosSolver >("Amesos_Klu", static_cast >*>(matrix), static_cast >*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("Amesos not installed."); + throw Hermes::Exceptions::Exception("Amesos not installed."); #endif - break; + break; } case Hermes::SOLVER_MUMPS: { #ifdef WITH_MUMPS - if (rhs != nullptr) return new MumpsSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); - else return new MumpsSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); + if (rhs != nullptr) return new MumpsSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); + else return new MumpsSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("MUMPS was not installed."); + throw Hermes::Exceptions::Exception("MUMPS was not installed."); #endif - break; + break; } case Hermes::SOLVER_PETSC: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PETSc selected as a direct solver."); #ifdef WITH_PETSC - if (rhs != nullptr) return new PetscLinearMatrixSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); - else return new PetscLinearMatrixSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); + if (rhs != nullptr) return new PetscLinearMatrixSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); + else return new PetscLinearMatrixSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("PETSc not installed."); + throw Hermes::Exceptions::Exception("PETSc not installed."); #endif - break; + break; } case Hermes::SOLVER_UMFPACK: { #ifdef WITH_UMFPACK - if (rhs != nullptr) return new UMFPackLinearMatrixSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); - else return new UMFPackLinearMatrixSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); + if (rhs != nullptr) return new UMFPackLinearMatrixSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); + else return new UMFPackLinearMatrixSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("UMFPACK was not installed."); + throw Hermes::Exceptions::Exception("UMFPACK was not installed."); #endif - break; + break; } case Hermes::SOLVER_PARALUTION_ITERATIVE: case Hermes::SOLVER_PARALUTION_AMG: { - if (use_direct_solver) - throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); + if (use_direct_solver) + throw Hermes::Exceptions::Exception("The iterative solver PARALUTION selected as a direct solver."); #ifdef WITH_PARALUTION - throw Hermes::Exceptions::Exception("PARALUTION only works for real problems."); + throw Hermes::Exceptions::Exception("PARALUTION only works for real problems."); #else - throw Hermes::Exceptions::Exception("PARALUTION was not installed."); + throw Hermes::Exceptions::Exception("PARALUTION was not installed."); #endif - break; + break; } case Hermes::SOLVER_SUPERLU: { #ifdef WITH_SUPERLU - if (rhs != nullptr) return new SuperLUSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); - else return new SuperLUSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); + if (rhs != nullptr) return new SuperLUSolver >(static_cast >*>(matrix), static_cast >*>(rhs)); + else return new SuperLUSolver >(static_cast >*>(matrix), static_cast >*>(rhs_dummy)); #else - throw Hermes::Exceptions::Exception("SuperLU was not installed."); + throw Hermes::Exceptions::Exception("SuperLU was not installed."); #endif - break; + break; } default: throw Hermes::Exceptions::Exception("Unknown matrix solver requested in create_linear_solver()."); @@ -470,19 +469,19 @@ namespace Hermes this->smootherSolverType = solverType_; } - template class HERMES_API LinearMatrixSolver; - template class HERMES_API LinearMatrixSolver >; - template class HERMES_API SimpleExternalSolver; - template class HERMES_API SimpleExternalSolver >; - template class HERMES_API ExternalSolver; - template class HERMES_API ExternalSolver >; - template class HERMES_API DirectSolver; - template class HERMES_API DirectSolver >; - template class HERMES_API LoopSolver; - template class HERMES_API LoopSolver >; - template class HERMES_API IterSolver; - template class HERMES_API IterSolver >; - template class HERMES_API AMGSolver; - template class HERMES_API AMGSolver >; + template class HERMES_API LinearMatrixSolver < double > ; + template class HERMES_API LinearMatrixSolver < std::complex > ; + template class HERMES_API SimpleExternalSolver < double > ; + template class HERMES_API SimpleExternalSolver < std::complex > ; + template class HERMES_API ExternalSolver < double > ; + template class HERMES_API ExternalSolver < std::complex > ; + template class HERMES_API DirectSolver < double > ; + template class HERMES_API DirectSolver < std::complex > ; + template class HERMES_API LoopSolver < double > ; + template class HERMES_API LoopSolver < std::complex > ; + template class HERMES_API IterSolver < double > ; + template class HERMES_API IterSolver < std::complex > ; + template class HERMES_API AMGSolver < double > ; + template class HERMES_API AMGSolver < std::complex > ; } } \ No newline at end of file diff --git a/hermes_common/src/solvers/matrix_solver.cpp b/hermes_common/src/solvers/matrix_solver.cpp index a62a94dbcf..c80432a9ec 100644 --- a/hermes_common/src/solvers/matrix_solver.cpp +++ b/hermes_common/src/solvers/matrix_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -19,7 +19,7 @@ #include "matrix_solver.h" #ifdef WITH_UMFPACK - #include "interfaces/umfpack_solver.h" +#include "interfaces/umfpack_solver.h" #endif namespace Hermes @@ -55,9 +55,9 @@ namespace Hermes delete this->linear_matrix_solver; - if(temp_matrix) + if (temp_matrix) delete temp_matrix; - if(temp_rhs) + if (temp_rhs) delete temp_rhs; } @@ -96,7 +96,7 @@ namespace Hermes void MatrixSolver::set_jacobian_constant(bool to_set) { this->constant_jacobian = to_set; - if(!to_set) + if (!to_set) this->jacobian_reusable = false; } @@ -110,13 +110,13 @@ namespace Hermes template void MatrixSolver::set_UMFPACK_output(bool to_set, bool with_output) { - if(!dynamic_cast*>(this->linear_matrix_solver)) + if (!dynamic_cast*>(this->linear_matrix_solver)) { this->warn("A different MatrixSolver than UMFPACK is used, ignoring the call to set_UMFPACK_reporting()."); return; } - if(with_output) + if (with_output) ((UMFPackLinearMatrixSolver*)this->linear_matrix_solver)->set_output_level(2); else ((UMFPackLinearMatrixSolver*)this->linear_matrix_solver)->set_output_level(0); @@ -127,10 +127,10 @@ namespace Hermes template void MatrixSolver::handle_UMFPACK_reports() { - if(this->do_UMFPACK_reporting) + if (this->do_UMFPACK_reporting) { UMFPackLinearMatrixSolver* umfpack_matrix_solver = (UMFPackLinearMatrixSolver*)this->linear_matrix_solver; - if(this->linear_matrix_solver->get_used_reuse_scheme() != HERMES_REUSE_MATRIX_STRUCTURE_COMPLETELY) + if (this->linear_matrix_solver->get_used_reuse_scheme() != HERMES_REUSE_MATRIX_STRUCTURE_COMPLETELY) { this->UMFPACK_reporting_data[this->FactorizationSize] = umfpack_matrix_solver->Info[UMFPACK_NUMERIC_SIZE] * umfpack_matrix_solver->Info[UMFPACK_SIZE_OF_UNIT]; this->UMFPACK_reporting_data[this->PeakMemoryUsage] = umfpack_matrix_solver->Info[UMFPACK_PEAK_MEMORY] * umfpack_matrix_solver->Info[UMFPACK_SIZE_OF_UNIT]; @@ -141,7 +141,7 @@ namespace Hermes } } #endif - template class HERMES_API MatrixSolver; - template class HERMES_API MatrixSolver >; + template class HERMES_API MatrixSolver < double > ; + template class HERMES_API MatrixSolver < std::complex > ; } } \ No newline at end of file diff --git a/hermes_common/src/solvers/newton_matrix_solver.cpp b/hermes_common/src/solvers/newton_matrix_solver.cpp index 040906367d..c63451fae5 100644 --- a/hermes_common/src/solvers/newton_matrix_solver.cpp +++ b/hermes_common/src/solvers/newton_matrix_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -52,7 +52,7 @@ namespace Hermes { double residual_norm = this->get_parameter_value(this->p_residual_norms).back(); - if(residual_norm > this->max_allowed_residual_norm) + if (residual_norm > this->max_allowed_residual_norm) return AboveMaxAllowedResidualNorm; else return NonlinearMatrixSolver::get_convergence_state(); @@ -62,7 +62,7 @@ namespace Hermes double NewtonMatrixSolver::update_solution_return_change_norm(Scalar* linear_system_solution) { double current_damping_factor = this->get_parameter_value(this->p_damping_factors).back(); - + double solution_change_norm = 0.; for (int i = 0; i < this->problem_size; i++) { @@ -72,7 +72,7 @@ namespace Hermes return std::sqrt(solution_change_norm) * current_damping_factor; } - template class HERMES_API NewtonMatrixSolver; - template class HERMES_API NewtonMatrixSolver >; + template class HERMES_API NewtonMatrixSolver < double > ; + template class HERMES_API NewtonMatrixSolver < std::complex > ; } -} +} \ No newline at end of file diff --git a/hermes_common/src/solvers/nonlinear_convergence_measurement.cpp b/hermes_common/src/solvers/nonlinear_convergence_measurement.cpp index 43207556c0..cdc8be6450 100644 --- a/hermes_common/src/solvers/nonlinear_convergence_measurement.cpp +++ b/hermes_common/src/solvers/nonlinear_convergence_measurement.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -33,9 +33,9 @@ namespace Hermes // get iteration. unsigned int iteration = nonlinear_solver->get_current_iteration_number(); - const Hermes::vector& residual_norms = nonlinear_solver->get_parameter_value(nonlinear_solver->residual_norms()); - const Hermes::vector& solution_norms = nonlinear_solver->get_parameter_value(nonlinear_solver->solution_norms()); - const Hermes::vector& solution_change_norms = nonlinear_solver->get_parameter_value(nonlinear_solver->solution_change_norms()); + const std::vector& residual_norms = nonlinear_solver->get_parameter_value(nonlinear_solver->residual_norms()); + const std::vector& solution_norms = nonlinear_solver->get_parameter_value(nonlinear_solver->solution_norms()); + const std::vector& solution_change_norms = nonlinear_solver->get_parameter_value(nonlinear_solver->solution_change_norms()); int residual_norms_count = residual_norms.size(); int solution_norms_count = solution_norms.size(); int solution_change_norms_count = solution_change_norms.size(); @@ -50,45 +50,44 @@ namespace Hermes double current_solution_change_norm = solution_change_norms.back(); bool converged; - if(nonlinear_solver->handleMultipleTolerancesAnd) + if (nonlinear_solver->handleMultipleTolerancesAnd) converged = true; else converged = false; double convergence_decision_value[NonlinearConvergenceMeasurementTypeCount]; - convergence_decision_value[0] = ((initial_residual_norm - current_residual_norm) / initial_residual_norm); - convergence_decision_value[1] = ((previous_residual_norm - current_residual_norm) / previous_residual_norm); - convergence_decision_value[2] = (current_residual_norm / initial_residual_norm); - convergence_decision_value[3] = (current_residual_norm / previous_residual_norm); - convergence_decision_value[4] = current_residual_norm; - convergence_decision_value[5] = current_solution_change_norm; - convergence_decision_value[6] = (current_solution_change_norm / previous_solution_norm); + convergence_decision_value[0] = ((previous_residual_norm - current_residual_norm) / previous_residual_norm); + convergence_decision_value[1] = (current_residual_norm / initial_residual_norm); + convergence_decision_value[2] = (current_residual_norm / previous_residual_norm); + convergence_decision_value[3] = current_residual_norm; + convergence_decision_value[4] = current_solution_change_norm; + convergence_decision_value[5] = (current_solution_change_norm / previous_solution_norm); - for(int i = 0; i < NonlinearConvergenceMeasurementTypeCount; i++) + for (int i = 0; i < NonlinearConvergenceMeasurementTypeCount; i++) { - if(!nonlinear_solver->tolerance_set[i]) + if (!nonlinear_solver->tolerance_set[i]) continue; - if(i == 1 && iteration == 1) + if (i == 1 && iteration == 1) { - if(nonlinear_solver->handleMultipleTolerancesAnd) + if (nonlinear_solver->handleMultipleTolerancesAnd) return false; else continue; } bool converged_this_tolerance = (convergence_decision_value[i] < nonlinear_solver->tolerance[i]); - if(nonlinear_solver->handleMultipleTolerancesAnd) + if (nonlinear_solver->handleMultipleTolerancesAnd) converged = converged && converged_this_tolerance; else - if(converged_this_tolerance) + if (converged_this_tolerance) return true; } return converged; } - template class HERMES_API NonlinearConvergenceMeasurement; - template class HERMES_API NonlinearConvergenceMeasurement >; + template class HERMES_API NonlinearConvergenceMeasurement < double > ; + template class HERMES_API NonlinearConvergenceMeasurement < std::complex > ; } } \ No newline at end of file diff --git a/hermes_common/src/solvers/nonlinear_matrix_solver.cpp b/hermes_common/src/solvers/nonlinear_matrix_solver.cpp index a408149b8d..a11f61ccb3 100644 --- a/hermes_common/src/solvers/nonlinear_matrix_solver.cpp +++ b/hermes_common/src/solvers/nonlinear_matrix_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -56,7 +56,7 @@ namespace Hermes template void NonlinearMatrixSolver::free() { - free_with_check(this->sln_vector); + free_with_check(this->sln_vector, true); } template @@ -64,8 +64,8 @@ namespace Hermes { bool toleranceSet = false; for (int i = 0; i < NonlinearConvergenceMeasurementTypeCount; i++) - if (this->tolerance_set[i]) - toleranceSet = true; + if (this->tolerance_set[i]) + toleranceSet = true; if (!toleranceSet) { throw Exceptions::Exception("No tolerance set in NonlinearMatrixSolver."); @@ -97,8 +97,8 @@ namespace Hermes // Number of DOFs. assert(this->problem_size > 0); - free_with_check(this->sln_vector); - this->sln_vector = malloc_with_check, Scalar>(this->problem_size, this); + free_with_check(this->sln_vector, true); + this->sln_vector = malloc_with_check, Scalar>(this->problem_size, this, true); if (coeff_vec == nullptr) memset(this->sln_vector, 0, this->problem_size*sizeof(Scalar)); @@ -106,7 +106,7 @@ namespace Hermes memcpy(this->sln_vector, coeff_vec, this->problem_size*sizeof(Scalar)); // previous_sln_vector - this->previous_sln_vector = calloc_with_check, Scalar>(this->problem_size, this); + this->previous_sln_vector = calloc_with_check, Scalar>(this->problem_size, this, true); // Backup vector for unsuccessful reuse of Jacobian. residual_back = create_vector(); @@ -128,46 +128,40 @@ namespace Hermes switch (toleranceType) { - case ResidualNormRelativeToInitial: - { - this->tolerance[0] = tolerance_; - this->tolerance_set[0] = true; - } - break; case ResidualNormRelativeToPrevious: { - this->tolerance[1] = tolerance_; - this->tolerance_set[1] = true; + this->tolerance[0] = tolerance_; + this->tolerance_set[0] = true; } break; case ResidualNormRatioToInitial: { - this->tolerance[2] = tolerance_; - this->tolerance_set[2] = true; + this->tolerance[1] = tolerance_; + this->tolerance_set[1] = true; } break; case ResidualNormRatioToPrevious: { - this->tolerance[3] = tolerance_; - this->tolerance_set[3] = true; + this->tolerance[2] = tolerance_; + this->tolerance_set[2] = true; } break; case ResidualNormAbsolute: { - this->tolerance[4] = tolerance_; - this->tolerance_set[4] = true; + this->tolerance[3] = tolerance_; + this->tolerance_set[3] = true; } break; case SolutionChangeAbsolute: { - this->tolerance[5] = tolerance_; - this->tolerance_set[5] = true; + this->tolerance[4] = tolerance_; + this->tolerance_set[4] = true; } break; case SolutionChangeRelative: { - this->tolerance[6] = tolerance_; - this->tolerance_set[6] = true; + this->tolerance[5] = tolerance_; + this->tolerance_set[5] = true; } break; default: @@ -236,7 +230,7 @@ namespace Hermes template void NonlinearMatrixSolver::set_manual_damping_coeff(bool onOff, double coeff) { - if (coeff <= 0.0 || coeff > 1.0) + if (onOff && (coeff <= 0.0 || coeff > 1.0)) throw Exceptions::ValueException("coeff", coeff, 0.0, 1.0); if (onOff) { @@ -295,9 +289,6 @@ namespace Hermes if (state == NotConverged) return false; - // And now the finishing states (both good and bad). - this->finalize_solving(); - // Act upon the state. switch (state) { @@ -321,6 +312,9 @@ namespace Hermes break; } + // And now the finishing states (both good and bad). + this->finalize_solving(); + // Return that we should finish. return true; } @@ -328,7 +322,7 @@ namespace Hermes template bool NonlinearMatrixSolver::calculate_damping_factor(unsigned int& successful_steps) { - Hermes::vector& damping_factors_vector = this->get_parameter_value(p_damping_factors); + std::vector& damping_factors_vector = this->get_parameter_value(p_damping_factors); if (this->manual_damping) { @@ -340,7 +334,7 @@ namespace Hermes { if (++successful_steps >= this->necessary_successful_steps_to_increase) { - double new_damping_factor = std::min(this->initial_auto_damping_factor, this->auto_damping_ratio * damping_factors_vector.back()); + double new_damping_factor = std::min(1.0, this->auto_damping_ratio * damping_factors_vector.back()); this->info("\t\tstep successful, new damping factor: %g.", new_damping_factor); damping_factors_vector.push_back(new_damping_factor); } @@ -377,7 +371,7 @@ namespace Hermes template void NonlinearMatrixSolver::deinit_solving() { - free_with_check(this->previous_sln_vector); + free_with_check(this->previous_sln_vector, true); delete residual_back; this->problem_size = -1; if (this->previous_jacobian) @@ -493,11 +487,11 @@ namespace Hermes // Initialize parameters. unsigned int successful_steps_damping = 0; unsigned int successful_steps_jacobian = 0; - Hermes::vector iterations_with_recalculated_jacobian; - Hermes::vector residual_norms; - Hermes::vector solution_norms; - Hermes::vector solution_change_norms; - Hermes::vector damping_factors; + std::vector iterations_with_recalculated_jacobian; + std::vector residual_norms; + std::vector solution_norms; + std::vector solution_change_norms; + std::vector damping_factors; bool residual_norm_drop; unsigned int iteration = 1; @@ -520,7 +514,7 @@ namespace Hermes if (this->do_initial_step_return_finished()) return; - // Main Nonlinear loop + // Main Nonlinear loop while (true) { // Handle the event of step beginning. @@ -542,12 +536,12 @@ namespace Hermes this->get_parameter_value(this->p_residual_norms).push_back(this->calculate_residual_norm()); // Test convergence - if in this loop we found a solution. - this->info("\t\t\tconvergence test"); + this->info("\tNonlinearSolver: Convergence test..."); if (this->handle_convergence_state_return_finished(this->get_convergence_state())) return; // Inspect the damping factor. - this->info("\t\tprobing the damping factor..."); + this->info("\tNonlinearSolver: Probing the damping factor..."); try { // Calculate damping factor, and return whether or not was this a successful step. @@ -593,7 +587,7 @@ namespace Hermes this->residual_back->set_vector(this->get_residual()); // Info & handle the situation as necessary. - this->info("\t\treusing Jacobian."); + this->info("\tNonlinearSolver: Reusing Jacobian."); this->on_reused_jacobian_step_begin(); // Solve the system. @@ -608,7 +602,7 @@ namespace Hermes // Test whether it was okay to reuse the jacobian. if (!this->jacobian_reused_okay(successful_steps_jacobian)) { - this->warn("\t\treused Jacobian disapproved."); + this->warn("\tNonlinearSolver: Reused Jacobian disapproved."); this->get_parameter_value(this->p_residual_norms).pop_back(); this->get_parameter_value(this->p_solution_norms).pop_back(); this->get_parameter_value(this->p_solution_change_norms).pop_back(); @@ -640,14 +634,11 @@ namespace Hermes #pragma endregion // Reassemble the jacobian once not reusable anymore. - this->info("\t\tre-calculating Jacobian."); - this->assemble_jacobian(true); + this->info("\tNonlinearSolver: Re-calculating Jacobian."); - // Set factorization schemes. - if (this->jacobian_reusable) - this->linear_matrix_solver->set_reuse_scheme(HERMES_REUSE_MATRIX_REORDERING); - else - this->linear_matrix_solver->set_reuse_scheme(HERMES_CREATE_STRUCTURE_FROM_SCRATCH); + // Set factorization scheme. + this->assemble_jacobian(true); + this->linear_matrix_solver->set_reuse_scheme(HERMES_CREATE_STRUCTURE_FROM_SCRATCH); // Solve the system, state that the jacobian is reusable should it be desirable. this->solve_linear_system(); @@ -719,8 +710,8 @@ namespace Hermes { } - template class HERMES_API NonlinearMatrixSolver; - template class HERMES_API NonlinearMatrixSolver >; + template class HERMES_API NonlinearMatrixSolver < double > ; + template class HERMES_API NonlinearMatrixSolver < std::complex > ; } namespace Exceptions diff --git a/hermes_common/src/solvers/picard_matrix_solver.cpp b/hermes_common/src/solvers/picard_matrix_solver.cpp index f85abd01aa..4d314173d7 100644 --- a/hermes_common/src/solvers/picard_matrix_solver.cpp +++ b/hermes_common/src/solvers/picard_matrix_solver.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -28,7 +28,6 @@ namespace Hermes { namespace Solvers { - template PicardMatrixSolver::PicardMatrixSolver() : NonlinearMatrixSolver() { @@ -283,7 +282,7 @@ namespace Hermes free_with_check(rhs); } - template class HERMES_API PicardMatrixSolver; - template class HERMES_API PicardMatrixSolver >; + template class HERMES_API PicardMatrixSolver < double > ; + template class HERMES_API PicardMatrixSolver < std::complex > ; } } \ No newline at end of file diff --git a/hermes_common/src/third_party/backtrace.c b/hermes_common/src/third_party/backtrace.c deleted file mode 100644 index 35e3475219..0000000000 --- a/hermes_common/src/third_party/backtrace.c +++ /dev/null @@ -1,383 +0,0 @@ -/* - A hacky replacement for backtrace_symbols in glibc - - backtrace_symbols in glibc looks up symbols using dladdr which is limited in - the symbols that it sees. libbacktracesymbols opens the executable and shared - libraries using libbfd and will look up backtrace information using the symbol - table and the dwarf line information. - - It may make more sense for this program to use libelf instead of libbfd. - However, I have not investigated that yet. - - Derived from addr2line.c from GNU Binutils by Jeff Muizelaar - - Copyright 2007 Jeff Muizelaar - */ - -/* addr2line.c -- convert addresses to line number and function name - Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - Contributed by Ulrich Lauther - - This file was part of GNU Binutils. - - 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define fatal(a, b) exit(1) -#define bfd_fatal(a) exit(1) -#define bfd_nonfatal(a) exit(1) -#define list_matching_formats(a) exit(1) - -/* 2 characters for each byte, plus 1 each for 0, x, and NULL */ -#define PTRSTR_LEN (sizeof(void *) * 2 + 3) -#define true 1 -#define false 0 - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#if 0 - -void(*dbfd_init)(void); -bfd_vma(*dbfd_scan_vma)(const char *string, const char **end, int base); -bfd* (*dbfd_openr)(const char *filename, const char *target); -bfd_boolean(*dbfd_check_format)(bfd *abfd, bfd_format format); -bfd_boolean(*dbfd_check_format_matches)(bfd *abfd, bfd_format format, char ***matching); -bfd_boolean(*dbfd_close)(bfd *abfd); -bfd_boolean(*dbfd_map_over_sections)(bfd *abfd, void(*func)(bfd *abfd, asection *sect, void *obj), - void *obj); -#define bfd_init dbfd_init - -static void load_funcs(void) -{ - void * handle = dlopen("libbfd.so", RTLD_NOW); - dbfd_init = (void(*)())dlsym(handle, "bfd_init"); - dbfd_scan_vma = (bfd_vma(*)(const char *, const char **, int))dlsym(handle, "bfd_scan_vma"); - dbfd_openr = (bfd*(*)(const char *, const char *))dlsym(handle, "bfd_openr"); - dbfd_check_format = (bfd_boolean(*)(bfd *, bfd_format))dlsym(handle, "bfd_check_format"); - dbfd_check_format_matches = (bfd_boolean(*)(bfd *, bfd_format, char ***))dlsym(handle, "bfd_check_format_matches"); - dbfd_close = (bfd_boolean(*)(bfd *))dlsym(handle, "bfd_close"); - dbfd_map_over_sections = (bfd_boolean(*)(bfd *, void(*func)(bfd *, asection *, void *obj), void *)) dlsym(handle, "bfd_map_over_sections"); -} - -#endif - -namespace Hermes -{ -#include - - static asymbol **syms; /* Symbol table. */ - - /* 150 isn't special; it's just an arbitrary non-ASCII char value. */ -#define OPTION_DEMANGLER (150) - - static void slurp_symtab(bfd * abfd); - static void find_address_in_section(bfd *abfd, asection *section, void *data); - - /* Read in the symbol table. */ - - static void slurp_symtab(bfd * abfd) - { - long symcount; - unsigned int size; - - if ((bfd_get_file_flags(abfd) & HAS_SYMS) == 0) - return; - - symcount = bfd_read_minisymbols(abfd, false, (PTR*)& syms, &size); - if (symcount == 0) - symcount = bfd_read_minisymbols(abfd, true /* dynamic */, - (PTR*)& syms, &size); - - if (symcount < 0) - bfd_fatal(bfd_get_filename(abfd)); - } - - /* These global variables are used to pass information between - translate_addresses and find_address_in_section. */ - - static bfd_vma pc; - static char *filename; - static const char *functionname; - static unsigned int line; - static int found; - - /* Look for an address in a section. This is called via - bfd_map_over_sections. */ - - static void find_address_in_section(bfd *abfd, asection *section, void *data __attribute__((__unused__))) - { - bfd_vma vma; - bfd_size_type size; - - if (found) - return; - - if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0) - return; - - vma = bfd_get_section_vma(abfd, section); - if (pc < vma) - return; - - size = bfd_section_size(abfd, section); - if (pc >= vma + size) - return; - - found = bfd_find_nearest_line(abfd, section, syms, pc - vma, (const char**)&filename, &functionname, &line); - } - - /* Read hexadecimal addresses from stdin, translate into - file_name:line_number and optionally function name. */ -#if 0 - static void translate_addresses(bfd * abfd, char (*addr)[PTRSTR_LEN], int naddr) - { - while (naddr) { - pc = bfd_scan_vma(addr[naddr-1], NULL, 16); - - found = false; - bfd_map_over_sections(abfd, find_address_in_section, - (PTR) NULL); - - if (!found) { - printf("[%s] \?\?() \?\?:0\n",addr[naddr-1]); - } else { - const char *name; - - name = functionname; - if (name == NULL || *name == '\0') - name = "??"; - if (filename != NULL) { - char *h; - - h = strrchr(filename, '/'); - if (h != NULL) - filename = h + 1; - } - - printf("\t%s:%u\t", filename ? filename : "??", - line); - - printf("%s()\n", name); - - } - - /* fflush() is essential for using this command as a server - child process that reads addresses from a pipe and responds - with line number information, processing one address at a - time. */ - fflush(stdout); - naddr--; - } - } -#endif - - static char** translate_addresses_buf(bfd * abfd, bfd_vma *addr, int naddr) - { - int naddr_orig = naddr; - char b; - int total = 0; - enum { Count = 0, Print = 1 } state; - char *buf = &b; - int len = 0; - char **ret_buf = NULL; - /* iterate over the formating twice. - * the first time we count how much space we need - * the second time we do the actual printing */ - for (int stateI = Count; stateI <= Print; stateI++) { - if (stateI == (int)Print) { - ret_buf = (char**)malloc(total + sizeof(char*)*naddr); - buf = (char*)(ret_buf + naddr); - len = total; - } - while (naddr) { - if (stateI == (int)Print) - ret_buf[naddr - 1] = buf; - pc = addr[naddr - 1]; - - found = false; - bfd_map_over_sections(abfd, find_address_in_section, - (PTR)NULL); - - if (!found) { - total += snprintf(buf, len, "[0x%llx] \?\?() \?\?:0", (long long unsigned int) addr[naddr - 1]) + 1; - } - else { - const char *name; - - name = functionname; - if (name == NULL || *name == '\0') - name = "??"; - if (filename != NULL) { - char *h; - - h = strrchr(filename, '/'); - if (h != NULL) - filename = h + 1; - } - total += snprintf(buf, len, "%s:%u\t%s()", filename ? filename : "??", - line, name) + 1; - - } - if (stateI == (int)Print) { - /* set buf just past the end of string */ - buf = buf + total + 1; - } - naddr--; - } - naddr = naddr_orig; - } - return ret_buf; - } - /* Process a file. */ - - static char **process_file(const char *file_name, bfd_vma *addr, int naddr) - { - bfd *abfd; - char **matching; - char **ret_buf; - - abfd = bfd_openr(file_name, NULL); - - if (abfd == NULL) - bfd_fatal(file_name); - - if (bfd_check_format(abfd, bfd_archive)) - fatal("%s: can not get addresses from archive", file_name); - - if (!bfd_check_format_matches(abfd, bfd_object, &matching)) { - bfd_nonfatal(bfd_get_filename(abfd)); - if (bfd_get_error() == - bfd_error_file_ambiguously_recognized) { - list_matching_formats(matching); - free(matching); - } - xexit(1); - } - - slurp_symtab(abfd); - - ret_buf = translate_addresses_buf(abfd, addr, naddr); - - if (syms != NULL) { - free(syms); - syms = NULL; - } - - bfd_close(abfd); - return ret_buf; - } - -#define MAX_DEPTH 16 - - struct file_match { - const char *file; - void *address; - void *base; - void *hdr; - }; - - static int find_matching_file(struct dl_phdr_info *info, - size_t size, void *data) - { - struct file_match *match = (file_match*)data; - /* This code is modeled from Gfind_proc_info-lsb.c:callback() from libunwind */ - long n; - const ElfW(Phdr) *phdr; - ElfW(Addr) load_base = info->dlpi_addr; - phdr = info->dlpi_phdr; - for (n = info->dlpi_phnum; --n >= 0; phdr++) { - if (phdr->p_type == PT_LOAD) { - ElfW(Addr) vaddr = phdr->p_vaddr + load_base; - if ((long)match->address >= vaddr && (long)match->address < vaddr + phdr->p_memsz) { - /* we found a match */ - match->file = info->dlpi_name; - match->base = (void*)info->dlpi_addr; - } - } - } - return 0; - } - - char **backtrace_symbols(void *const *buffer, int size) - { - int stack_depth = size - 1; - int x, y; - /* discard calling function */ - int total = 0; - - char ***locations; - char **final; - char *f_strings; - - locations = (char***)malloc(sizeof(char**)* (stack_depth + 1)); - - bfd_init(); - for (x = stack_depth, y = 0; x >= 0; x--, y++){ - struct file_match match; - match.address = buffer[x]; - char **ret_buf; - bfd_vma addr; - dl_iterate_phdr(find_matching_file, &match); - addr = (long)buffer[x] - (long)match.base; - if (match.file && strlen(match.file)) - ret_buf = process_file(match.file, &addr, 1); - else - ret_buf = process_file("/proc/self/exe", &addr, 1); - locations[x] = ret_buf; - total += strlen(ret_buf[0]) + 1; - } - - /* allocate the array of char* we are going to return and extra space for - * all of the strings */ - final = (char**)malloc(total + (stack_depth + 1) * sizeof(char*)); - /* get a pointer to the extra space */ - f_strings = (char*)(final + stack_depth + 1); - - /* fill in all of strings and pointers */ - for (x = stack_depth; x >= 0; x--){ - strcpy(f_strings, locations[x][0]); - free(locations[x]); - final[x] = f_strings; - f_strings += strlen(f_strings) + 1; - } - - free(locations); - - return final; - } - - void - backtrace_symbols_fd(void *const *buffer, int size, int fd) - { - int j; - char **strings; - - strings = backtrace_symbols(buffer, size); - if (strings == NULL) { - perror("backtrace_symbols"); - exit(EXIT_FAILURE); - } - - for (j = 0; j < size; j++) - printf("%s\n", strings[j]); - - free(strings); - } -} \ No newline at end of file diff --git a/hermes_common/src/util/callstack.cpp b/hermes_common/src/util/callstack.cpp index 1ce477457b..56a8d6853b 100644 --- a/hermes_common/src/util/callstack.cpp +++ b/hermes_common/src/util/callstack.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -18,7 +18,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file callstack.cpp \brief File containing functionality for investigating call stack. -*/ + */ #include "callstack.h" #include #include diff --git a/hermes_common/src/util/memory_handling.cpp b/hermes_common/src/util/memory_handling.cpp index c70529b0fa..6e52919f75 100644 --- a/hermes_common/src/util/memory_handling.cpp +++ b/hermes_common/src/util/memory_handling.cpp @@ -1,7 +1,7 @@ // This file is part of HermesCommon // // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR). -// Email: hpfem-group@unr.edu, home page: http://hpfem.org/. +// Email: hpfem-group@unr.edu, home page: http://www.hpfem.org/. // // Hermes2D is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -22,8 +22,8 @@ #include "memory_handling.h" namespace Hermes { - #ifdef WITH_PJLIB +#ifdef WITH_PJLIB HERMES_COMMON_API pj_caching_pool HermesCommonMemoryPoolCache; HERMES_COMMON_API GlobalPoolCache hermesCommonGlobalPoolCache; - #endif -} +#endif +} \ No newline at end of file diff --git a/hermes_common/src/util/qsort.cpp b/hermes_common/src/util/qsort.cpp index 64dab17c84..5761ec34ea 100644 --- a/hermes_common/src/util/qsort.cpp +++ b/hermes_common/src/util/qsort.cpp @@ -14,7 +14,7 @@ // along with Hermes2D. If not, see . /*! \file qsort.cpp \brief The QuickSort routine from glibc-2.5 modified for sorting int arrays. -*/ + */ #include "qsort.h" #include @@ -31,7 +31,7 @@ class stack_node public: intType *lo; intType *hi; -} ; +}; #define STACK_SIZE (CHAR_BIT * sizeof(size_t)) #define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++top)) @@ -40,15 +40,14 @@ class stack_node #define min(x, y) ((x) < (y) ? (x) : (y)) -/// \brief The QuickSort routine from glibc-2.5 modified for sorting int arrays. template void qsort_int(intType* pbase, size_t total_elems) { register intType *base_ptr = pbase; - if(total_elems == 0) return; + if (total_elems == 0) return; - if(total_elems > MAX_THRESH) + if (total_elems > MAX_THRESH) { intType *lo = base_ptr; intType *hi = lo + total_elems - 1; @@ -70,17 +69,17 @@ void qsort_int(intType* pbase, size_t total_elems) intType *mid = lo + ((hi - lo) >> 1); - if(*mid < *lo) - SWAP (mid, lo); - if(*hi < *mid) - SWAP (mid, hi) + if (*mid < *lo) + SWAP(mid, lo); + if (*hi < *mid) + SWAP(mid, hi) else goto jump_over; - if(*mid < *lo) + if (*mid < *lo) SWAP(mid, lo); -jump_over: + jump_over: - left_ptr = lo + 1; + left_ptr = lo + 1; right_ptr = hi - 1; // Here's the famous ``collapse the walls'' section of quicksort. @@ -94,43 +93,42 @@ void qsort_int(intType* pbase, size_t total_elems) while (*mid < *right_ptr) right_ptr--; - if(left_ptr < right_ptr) + if (left_ptr < right_ptr) { SWAP(left_ptr, right_ptr); - if(mid == left_ptr) + if (mid == left_ptr) mid = right_ptr; - else if(mid == right_ptr) + else if (mid == right_ptr) mid = left_ptr; left_ptr++; right_ptr--; } - else if(left_ptr == right_ptr) + else if (left_ptr == right_ptr) { left_ptr++; right_ptr--; break; } - } - while (left_ptr <= right_ptr); + } while (left_ptr <= right_ptr); // Set up pointers for next iteration. First determine whether // left and right partitions are below the threshold size. If so, // ignore one or both. Otherwise, push the larger partition's // bounds on the stack and continue sorting the smaller one. - if((size_t) (right_ptr - lo) <= MAX_THRESH) + if ((size_t)(right_ptr - lo) <= MAX_THRESH) { - if((size_t) (hi - left_ptr) <= MAX_THRESH) + if ((size_t)(hi - left_ptr) <= MAX_THRESH) // Ignore both small partitions. POP(lo, hi); else // Ignore small left partition. lo = left_ptr; } - else if((size_t) (hi - left_ptr) <= MAX_THRESH) + else if ((size_t)(hi - left_ptr) <= MAX_THRESH) // Ignore small right partition. hi = right_ptr; - else if((right_ptr - lo) > (hi - left_ptr)) + else if ((right_ptr - lo) > (hi - left_ptr)) { // Push larger left partition indices. PUSH(lo, right_ptr); @@ -161,10 +159,10 @@ void qsort_int(intType* pbase, size_t total_elems) // and the operation speeds up insertion sort's inner loop. for (run_ptr = tmp_ptr + 1; run_ptr <= thresh; run_ptr++) - if(*run_ptr < *tmp_ptr) + if (*run_ptr < *tmp_ptr) tmp_ptr = run_ptr; - if(tmp_ptr != base_ptr) + if (tmp_ptr != base_ptr) SWAP(tmp_ptr, base_ptr); // Insertion sort, running from left-hand-side up to right-hand-side. @@ -176,7 +174,7 @@ void qsort_int(intType* pbase, size_t total_elems) tmp_ptr--; tmp_ptr++; - if(tmp_ptr != run_ptr) + if (tmp_ptr != run_ptr) { intType c = *run_ptr; register intType *hi, *lo;